I am pondering the best way to create a set of ‘demo solutions’.
The purpose of each demo will be to show my plugin and beans.
I have a basic setup which I would like to keep and develop further to allow for the following…
Currently, I have a single solution, which has an ‘application’ form.
This form is very convenient because it allows for the creation of related ‘media’ records (irrespective of the form being swapped via an adjacent tab panel).
The ‘application’ record represents some user context and provides for ‘parent aggregation’, just as any join table should do.
Now, what I currently have on that ‘application’ form is:
a portal (for the creation and summary of related records), and
as i said, a tab-panel containing a number of forms; each form represents a ‘view’ that I would like to be presented to the user of a ‘demo solution’
In the case of each ‘demo solution’ I want to show just ONE form tab panel. I do NOT want the users to be able to switch to another tab pane (and hence another form representing another functional plugin or bean).
Now, I could make n copies of the solution and delete the ‘unwanted’ forms from each ‘application’ view form. Obviously that’s a rather crappy way to develop software, not to mention the duplication, maintenance and debugging issues.
So, I am trying to think of a way where ‘1 solution can act as many solutions’. So, the solutions might notionally be named:
demo.1.form.A.in.tab.pane
demo.2.form.B.in.tab.pane
etc
Now, I would like to have this ‘solution selection’ in the dialog box somehow simply not show the compliment of tab panel forms which are not required for the particular demo solution.
Is this possible ?
I want to maintain only 1 concrete solution.
Here’s a small solution demonstrating how to show/hide tabs at runtime.
I think this might lead you in the right direction
3 forms:
form place holder with relationless tabpanel
form1
form2
When you start the solution there’s the place holder form
the global is prefilled with 1.
1)click “GO” > form1 shows up in tabpanel.
2) change global into 2
3) click “GO” > form2 shows up in tabpanel.
So based on an argument(s), you are able to show whatever form you wish.
note: since the tabpanel is relationless, you have to set the foundset of the form you’re about to display yourself.
Servoy R2 2.2.1rc3 build-332 on Windows XP using Java 1.5.0_04
On import I get the following error:
Oct 8, 2005 8:48:40 AM net.sf.hibernate.dialect.Dialect
INFO: Using dialect: net.sf.hibernate.dialect.SybaseAnywhereDialect
java.sql.SQLException: connection already closed or transaction in progress
java.sql.SQLException: connection already closed or transaction in progress
at com.servoy.j2db.persistence.datasource.TransactionConnection.close(Unknown Source)
at com.servoy.j2db.util.Utils.closeConnection(Unknown Source)
at com.servoy.j2db.persistence.i.a(Unknown Source)
at com.servoy.j2db.persistence.XMLImporter.importSolutionFromFileAs(Unknown Source)
at com.servoy.j2db.develop.j$6.run(Unknown Source)
at com.servoy.j2db.util.ap.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NoSuchMethodError: net.sf.hibernate.mapping.Column.setQuoted(Z)V
java.lang.NoSuchMethodError: net.sf.hibernate.mapping.Column.setQuoted(Z)V
at com.servoy.j2db.c.a.a(Unknown Source)
at com.servoy.j2db.c.a.if(Unknown Source)
at com.servoy.j2db.persistence.Server.a(Unknown Source)
at com.servoy.j2db.persistence.Server.syncTableObjWithDB(Unknown Source)
at com.servoy.j2db.persistence.i.a(Unknown Source)
at com.servoy.j2db.persistence.i.a(Unknown Source)
at com.servoy.j2db.persistence.XMLImporter.importSolutionFromFileAs(Unknown Source)
at com.servoy.j2db.develop.j$6.run(Unknown Source)
at com.servoy.j2db.util.ap.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Make sure no Servoy instance is not running when updating jars or doing a Servoy update, Java keeps the jars locked
No, this is definitely happening with each VM startup.
Servoy was definitely not running when the upgrade occurred.
Each alternate startup requires a ‘servoy_repository’ exit and then I can start developer again.
It is strange.
It is as thought sybase may have loaded a resource from the jar (?)
Hi Marcel
That sounds promising. Can you show me in this concrete example what needs to change ?
//remove all current tabs attached to the tabpanel
for(var i=1 ; i<=forms.media_application_tab_swapping.elements.tabs_70.getMaxTabIndex() ; i++)
{
forms.media_application_tab_swapping.elements.tabs_70.removeTabAt(i)
}
//get the attributes to perform the request on the join table
var args = new Array();
args[0] = forms.media_application_tab_swapping.media_applicationid;
args[1] = forms.media_application_tab_swapping.table_name;
//perform the query
var query = ‘select foreign_key, mediaid, foreign_table from media where foreign_key = ? and foreign_table = ? group by mediaid, foreign_key, foreign_table’;
//load the dataset
var ds = databaseManager.getDataSetByQuery(currentcontroller.getServerName(), query, args, 1000);
//globals.CYBERSACK_SELECTED_COMPONENT is set in a prior dialog
if(“_BlueForm” == globals.CYBERSACK_SELECTED_COMPONENT)
{
var x = forms.media_application_tab_swapping.elements.tabs_70.addTab(forms._BlueForm, “BLUE”, “Blue Form”, null, null, null);
forms._BlueForm.controller.loadRecords(ds);
}
else if(“_GreenForm” == globals.CYBERSACK_SELECTED_COMPONENT)
{
var x = forms.media_application_tab_swapping.elements.tabs_70.addTab(forms._GreenForm, “Green”, “Green Form”, null, null, null);
forms._GreenForm.controller.loadRecords(ds);
}
//lastly, set the tab index to be 1
forms.media_application_tab_swapping.elements.tabs_70.tabIndex = 1;
If I understand correct you say ds is your wanted dataset. But when creating the dataset your remark says load the dataset. Unless I misinterpret this you are not loading this on the form you execute the code on. So there is no new foundset yet…
Again, when I understand correct what you want you should do:
//load the dataset
var ds = databaseManager.getDataSetByQuery(currentcontroller.getServerName(), query, args, 1000);
controller.loadRecords(ds);
var set = foundset;
and then```
forms._BlueForm.controller.loadRecords(set)
Julian is trying to sync a PORTAL in the main form with a relationless tabpanel in the main form.
Portals are always set by the relation it’s based on. (no foundset stuff)
What you need to do is SET the left hand keys args[0] args[1]
based on the CHOICE that’s made in the select component Dialog.
Other option would be, replacing your portal by a relationless tabpanel that shows a form list view of “media” table. This view will be in sync with _Blueform since they share the same foundset.
But you’ll still have to set left hand keys args[0] args[1] based on user’s choice.
I did receive it. Thanks Maarten.
But, unfortunately, it does not work as you expect it would.
In the case where :
media_applicationid= 15
table_name=“media_application”;
I inserted the following lines of code :
forms.media_application_tab_swapping.media_applicationid= 15;
forms.media_application_tab_swapping.table_name=“media_application”;
which can be more generalized as
forms.media_application_tab_swapping.media_applicationid = args[0];
forms.media_application_tab_swapping.table_name = args[1];
(seeing that we set args[0] and args[1] according to the form fields anyway)
But this has no effect.
Can you please open the attachment and try it for yourself.
All this talk is just that until someone can actually test it as working