Single Solution to act as Many Solutions

Hi all.

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.

cheers
J

Hi Julian,

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.

Hope this helps.

setTabpanel.servoy (5.84 KB)

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)

It seems you did recieve an update on 2.2.1rc3, you need the updated file: http://downloads.servoy.com/downloads/2 … rnate2.jar
will be included in 2.2.1 final (expected this week)

since the tabpanel is relationless, you have to set the foundset of the form you’re about to display yourself.

Could someboy please show me how to do this ?

Also, just a note on a file-locking issue with the new hibernate2.jar.

With this jar in place, after an exit of the initial Servoy Developer application instance, a restart fails.

It fails with the following error:

D:\tools\servoy\ServoyInstallation>servoy_developer.bat
The process cannot access the file because it is being used by another process.

I discovered that by exiting the sybase servoy_repository (via right-click popup on Windows taskbar), the startup script then executed successfully.

Make sure no Servoy instance is not running when updating jars or doing a Servoy update, Java keeps the jars locked

Julian,

You can do a loadRecords(blabla) and that will set your foundset…

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 (?)

You can do a loadRecords(blabla) and that will set your foundset…

It’s the ‘blabla’ part that I need to understand :(

SalernoJ:
It’s the ‘blabla’ part that I need to understand :frowning:

You mean that part what was discussed here?
http://forum.servoy.com/viewtopic.php?t=5079

I posted a reply but inadvetently placed in the thread which Robert Ivens spent some time discussing found sets and tab panes:

http://forum.servoy.com/viewtopic.php?p … ght=#25658

The blab bla part can be a foundset from another form, a dataset, an array of id’s and a query.

In your case that would be the foundset from the form that you want loaded into the other forms.

Based on the same table you can do:

forms.form2.loadRecords(foundset);
forms.form3.loadRecords(foundset);

That is when you are on the form that has the foundset. Otherwise you would do:

forms.form2.loadRecors(forms.form1.foundset);

Hope this helps…

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)


I hope this is what you are looking for!

Hold on guys,
(I’ve seen the solution Marcel)

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.

OK, portal stuff ‘yikes’… That’s why I didn’t understand… Go for list views and/or do what maarten says I would say!

Thanks Maarten. Thanks Marcel.

Go for list views and/or do what maarten says I would say!

No…this portal approach is the right ui construct for this scenario.

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.

Can you show me that code ?

I’ve sent you a mail yesterday.
Didn’t you get it.? will resend right now.

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 ;)

J