I heard that scout eclipse can create table page - AbstractPageWithTable out of database table properties, without manually adding columns for it.
Is this true, and if it is is somebody knows how to do it?
Dynamic UI Components:
I am not sure I understand your question correctly. Can I rephrase it like this:
How can I add a column dynamically (without having to define them as inner class)?
Here some pointers on the Scout Forum:
Is possible to create a dynamic PageView and Form ?
How to create UI fields at runtime?
...
My personal opinion is that the scout philosophy is to have a declarative UI defined with inner classes. I am not sure I would recommend someone to use this dynamic approach...
Scaffoling for Eclipse Scout:
From your comment, I now understand your question like this:
Given an existing database, is it possible to generate some elements of the application like TablePages?
I am afraid there is no open-source tool doing this for the moment. In our company, we have some developers, having a series of scripts to do something like what you are describing.
There is a project called SAML (Scout Application Modeling Language) where the user interface is described with a DSL and the Scout entities are generated. This is more a prototype that was built for the Kepler version of scout (3.9). For the moment there is no active development on it.
I have also started some builder where you do something like:
SimpleApplicationBuilder app = SimpleApplicationBuilder.create("myapp", "simple.myapp", "");
IScoutFormBuilder formBuilder = ScoutBuilders.form("MyFirstForm", "simple.myapp.client.ui.forms", "simple.myapp.shared.services")
.propTitle(app.nlsKey("MyFormTitle"))
.propSubTitle(app.nlsKey("MyFormSubTitle"))
.propAskIfNeedSave(false)
.propDisplayHint(DisplayHint.DISPLAY_HINT_VIEW)
.addField(ScoutBuilders.groupBox("ContentGroupBox")
.propBorderVisible(false)
.addField(ScoutBuilders.stringField("MyStringField")
.propLabel(app.nlsKey("MyStringLabel"))
)
.addField(ScoutBuilders.tableField("MyTableField")
.propTableStatusVisible(true)
.addTable(ScoutBuilders.table("MyTable")
.propAutoResizeColumns(true)
.addColumn(ScoutBuilders.integerColumn("IdComlum")
.propDisplayable(false)
)
.addColumn(ScoutBuilders.stringColumn("NameComlum")
.propHeaderText(app.nlsKey("Name"))
)
.addColumn(ScoutBuilders.integerColumn("AgeComlum")
.propHeaderText(app.nlsKey("Age"))
)
)
)
);
app.addForm(formBuilder);
The idea is to have a Java model of the application source code. It should allows to be able to do modifications or to add new entities and then to generate or modify the code. My tool is not open source for the moment (it is not finished yet and I do not have enough time to work on it).
I definitively think that scaffolding for Eclipse Scout would be great. I have published a master thesis proposal to work with a student on this topic. I hope we will be able to move forward.
Here some pointers in the Eclipse Scout forum:
Scout usage from command line
Form Generator based on DB Table layout
Let me know if you are interested in those topics.
Related
I am new to decision table so please forgive me if I asked a very basic question. I am working on an angular web app that uses decision table.
Could we change the table header 'Output' to something else?
Unfortunately, I cannot find any such label neither in the HTML nor in the controller.
For future reference:
It cannot be done through CSS. therefore following is my solution.
Inspect the code that either the dmn table is using modeling module or some other bpmn table features. In my case, it is using modeling. I override the following module by inheriting from it, to make the Input header cell dynamic and output fixed or change the label as well.
https://github.com/bpmn-io/dmn-js/blob/31803afe1bdccdc350da73293a75e2cbf3f14932/lib/table/features/modeling/Modeling.js
I'm currently making a bilingual Expression Engine 2.5.2 website. I'm using this technique to create the two langues, which works perfectly.
I have created a {country_code} global variable in the two index.php files which allows me to detect the current language.
Using this technique, I have no problems to get language-relative data when accessing an entry. My only concern is that I apparently have to privilege a language-specific "clean" URL.
Example entry:
{entry_id} = 123
{title} = My test article
{title_permalink} = my-test-article
{name_fr} = Mon article
{name_en} = My article
If I request http://www.example.com/index.php/en/blog/articles/my-test-article, I expect to to find, in english, "My article" using the template articles in the blog template group.
Everything is fine, but the french translation is accessible when requesting http://www.example.com/index.php/fr/blog/articles/my-test-article. The correct translation of the URL should be http://www.example.com/index.php/fr/blogue/articles/mon-article-test.
Anyone encountered a problem like this? Any solutions via extensions or modules?
I believe the Transcribe module solves this by both providing the ability to translate template group and template names, and having you create a separate entry for each language and piece of content in your site (hence, you have two separate URL titles). But that means buying into their entire methodology for a multi-lingual site.
Myself, I usually just stick to using the entry_id instead of the url_title, and live with the template names being in the primary language.
The best way I found to achieve this is by embedding templates with segment translations, duplicating template groups and duplicating channels.
In the blog/articles template:
{embed="shared/.head" segment_2_translation="blogue" segment_3_translation="articles"}
In the blogue/articles template:
{embed="shared/.head" segment_2_translation="blog" segment_3_translation="articles"}
In shared/.head template:
[...] {if lang == "fr"}English{if:else}Français{/if} [...]
And then you can create a Articles (FR) and a Articles (EN) channels, and each will have their unique URL titles. You can also add a relationship custom field for each channel to associate an entry with it's translation.
It feels messy, but it is the only way I could make it work without modules, plugins or whatnot.
I would like to create a table that looks/behaves like the one to manage fields when editing content types.
How is this one named? Is this form API?
If you're looking for the drag and drop sorting behavior, then you should look at the documentation for drupal_add_tabledrag.
And perhaps this tutorial might help: http://aswapathy.com/d78tu/tabledrag/theme_the_form_doc
I would implement it using Forms API together with a table.
If you are new to forms API, this step by step introduction is really good:
http://drupal.org/node/262422
I develop web application using Drools. All my drools files store into the database. After modifying some rule I must create new KnowledgeBase and add packages which I create from rules. How I can update only those packages in KnowledgeBase that I need, because regenerate all KnowledgeBase very expensive of time; For example I make next step;
User edit rule and push apply button.
After that I do something that:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newReaderResource( Reader, getClass() ),ResourceType.DRL );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
I store rule script how text in database and use Reader to add package in KnowledgeBuilder.. I take rule database format from here
http://docs.codehaus.org/display/DROOLS/Loading+and+managing+rules+dynamically+from+a+database
I tried to remove package by name from Knowledge Base and add again but not successful. What I must to do for update my Knowledge Base. I can't create new Knowledge Base every time when user edit and save rule, I must do something actions for update some part of Knowledge Base, let me put it this way.
Please, help.
Did you read about the knowledgeAgent inside the drools documentation? That component contains the logic to merge new changes into an existing knowledge base, as far as I remember.
Cheers
I read what knowledgeAgent work only with changeset.xml configuration and scan resurce which was define in changeset.xml
A friend of mine is now building a web application with J2EE and Struts, and it's going to be prepared to display pages in several languages.
I was told that the best way to support a multi-language site is to use a properties file where you store all the strings of your pages, something like:
welcome.english = "Welcome!"
welcome.spanish = "¡Bienvenido!"
...
This solution is ok, but what happens if your site displays news or something like that (a blog)? I mean, content that is not static, that is updated often... The people that keep the site have to write every new entry in each supported language, and store each version of the entry in the database. The application loads only the entries in the user's chosen language.
How do you design the database to support this kind of implementation?
Thanks.
Warning: I'm not a java hacker, so YMMV but...
The problem with using a list of "properties" is that you need a lot of discipline. Every time you add a string that should be output to the user you will need to open your properties file, look to see if that string (or something roughly equivalent to it) is already in the file, and then go and add the new property if it isn't. On top of this, you'd have to hope the properties file was fairly human readable / editable if you wanted to give it to an external translation team to deal with.
The database based approach is useful for all your database based content. Ideally you want to make it easy to tie pieces of content together with their translations. It only really falls down for all the places you may want to output something that isn't out of a database (error messages etc.).
One fairly old technology which we find still works really well, is to use gettext. Gettext or some variant seems to be available for most languages and platforms. The basic premise is that you wrap your output in a special function call like so:
echo _("Please do not press this button again");
Then running the gettext tools over your source code will extract all the instances wrapped like that into a "po" file. This will contain entries such as:
#: myfolder/my.source:239
msgid "Please do not press this button again"
msgstr ""
And you can add your translation to the appropriate place:
#: myfolder/my.source:239
msgid "Please do not press this button again"
msgstr "s’il vous plaît ne pas appuyer sur le bouton ci-dessous à nouveau"
Subsequent runs of the gettext tools simply update your po files. You don't even need to extract the po file from your source. If you know you may want to translate your site down the line, then you can just use the format shown above (the underscored function) with all your output. If you don't provide a po file it will just return whatever you put in the quotes. gettext is designed to work with locales so the users locale is used to retrieve the appropriate po file. This makes it really easy to add new translations.
Gettext Pros
Doesn't get in your way while coding
Very easy to add translations
PO files can be compiled down for speed
There are libraries available for most languages / platforms
There are good cross platform tools for dealing with translations. It is actually possible to get your translation team set up with a tool such as poEdit to make it very easy for them to manage translation projects
Gettext Cons
Solves your site "furniture" needs, but you would usually still want a database based approach for your database driven content
For more info on gettext see this wikipedia page
They way I have designed the database before is to have an News-table containing basic info like NewsID (int), NewsPubDate (datetime), NewsAuthor (varchar/int) and then have a linked table NewsText that has these columns: NewsID(int), NewsText(text), NewsLanguageID(int). And at last you have a Language-table that has LanguageID(int) and LanguageName(varchar).
Then, when you want to show your users the news-page you do:
SELECT NewsText FROM News INNER JOIN NewsText ON News.NewsID = NewsText.NewsID
WHERE NewsText.NewsLanguageID = <<Session["UserLanguageID"]>>
That Session-bit is a local variable where you store the users language when they log in or enters the site for the first time.
Java web applications support internationalization using the java standard tag library.
You've really got 2 problems. Static content and dynamic content.
for static content you can use jstl. It uses java ResourceBundles to accomplish this. I managed to get a Databased backed bundle working with the help of this site.
The second problem is dynamic content.
To solve this problem you'll need to store the data so that you can retrieve different translations based on the user's Locale. (Locale includes Country and Language).
It's not trivial, but it is something you can do with a little planning up front.
#Auron
thats what we apply it to. Our apps are all PHP, but gettext has a long heritage.
Looks like there is a good Java implementation
Tag libraries are fine if you're using JSP, but you can also achieve I18N using a template-based technology such as FreeMarker.