Child pages
  • Solution Model

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titleNote

When changing an existing form which has already been loaded, you need to refresh it before the end of the method by using controller.recreateUI(). If the form is not refreshed then this will result in an error.

You also need to take the following into consideration:

  • when controller.recreateUI() is called on a form, all elements are recreated based on the solutionModel solution Model for that form. This means that any Any other runtime changes to the elements are will be lost, like a dynamically added tab with elements.myTabPanel.addTab().
  • Any reference to the elements on the form that is stored will become invalid, as the element is recreated.
  • Function controller.recreateUI() cannot be used while a Drag 'n' Drop operation is underway on the form.

...

Code Block
var bean = form.newBean('myBean', 'com.servoy.extensions.beans.dbtreeview.DBTreeView', 200, 200, 300, 300);

To get existing bean : myBean:

Code Block
form.getBean('myBean');

...

To change its height to 30":

Code Block
button.height = 30;

...

Code Block
var label = form.newLabel('Text', 0, 0, 100, 20);
label.name = 'myLabel';

To retrieve get existing label myLabel:

Code Block
var label = form.getLabel('myLabel');

To change its horizontal alignment to center:

Code Block
var label.horizontalAlignment = form.getLabel('myLabel');

...

SM_ALIGNMENT.CENTER;
Code Block

To

...

remove

...

existing

...

label

...

myLabel

...

:

...

Code Block

form.removeLabel('myLabel');
Code Block

\\
h5. Portals

To create a new portal with name _myPortal_ based on relation _myRelation_:

...


Portals

To create a new portal with name myPortal based on relation myRelation:

Code Block

var relation = solutionModel.getRelation('myRelation');

...


var portal = form.newPortal('myPortal', relation, 0, 0, 500, 500);

...

code


To

...

get

...

existing

...

portal

...

myPortal

...

:

Code Block
var portal = form.getPortal('myPortal');

...

code


To

...

make

...

it

...

resizable:

Code Block
portal.resizable = true;

...

code


To

...

remove

...

existing

...

portal

...

myPortal

...

:

Code Block
form.removePortal('myPortal');

...

Code Block

\\
h5. Tab panels

To create a new tab with name _myTabPanel_:

...



Tab panels

To create a new tab with name myTabPanel:

Code Block

var tabPanel = form.newTabPanel('myTabPanel', 0, 0, 500, 500);

...

code


To

...

get

...

existing

...

tab

...

panel

...

myTabPanel

...

:

Code Block
var tabPanel = form.getTabPanel('myTabPanel);

...

code


To

...

add

...

a

...

new

...

tab

...

with

...

name

...

myTab

...

based

...

on

...

relation

...

myRelation

...

:

Code Block
var relation = solutionModel.getRelation('myRelation');

...


var tab = tabPanel.newTab('myTab', 'Text', myRelatedForm, relation);
Code Block

To

...

remove

...

existing

...

tab

...

panel

...

myTabPanel

...

:

Code Block
form.removeTabPanel('myTabPanel');
Code Block

\\
h4. Relations

To create a new relation with name _myRelation_ between tables _customers_ and _orders_:

...


Relations

To create a new relation with name myRelation between tables customers and orders:

Code Block

var relation = solutionModel.newRelation('myRelation', 'db:/example_data/customers', 'db:/example_data/orders', JSRelation.INNER_JOIN);
Code Block

To

...

get

...

existing

...

relation

...

myRelation

...

:

Code Block
var relation = solutionModel.getRelation('myRelation');
Code Block

To

...

create

...

new

...

a

...

new

...

relation

...

item

...

based

...

on

...

fields

...

id

...

and

...

customer_id

...

:

Code Block
relation.newRelationItem('id', '=', 'customer_id');

...

code


To

...

remove

...

existing

...

relation

...

myRelation

...

:

Code Block
solutionModel.removeRelation('myRelation');

...

Code Block

\\
h4. Value lists

To create a new value list with name _myValueList_:

...



Value lists

To create a new value list with name myValueList:

Code Block

var valueList = solutionModel.newValueList('myValueList', JSValueList.CUSTOM_VALUES);

...

code


To

...

get

...

existing

...

value

...

list

...

var valueList = myValueList:

Code Block

var valueList = solutionModel.getValueList('myValueList');
Code Block

To

...

set

...

custom

...

values

...

for

...

the

...

value

...

list:

Code Block
valueList.customValues = '1\n2';

...

code


To

...

remove

...

existing

...

value

...

list

...

myValueList

...

:

Code Block
solutionModel.removeValueList('myValueList');
Code Block

\\
h4. Media

To create new media with name _myMedia_:

...


Media

To create new media with name myMedia:

Code Block

var media = solutionModel.newMedia('myMedia', plugins.http.getMediaData('http://www.servoy.com/images/logo_servoy.gif'));
Code Block

To

...

get

...

existing

...

media

...

myMedia

...

:

Code Block
var media = solutionModel.getMedia('myMedia');
Code Block

To

...

change

...

it

...

content:

Code Block
media.bytes = plugins.http.getMediaData('http://servoy.com/images/headerimages/open_source.jpg');

...

code


To

...

remove

...

existing

...

media

...

myMedia

...

:

Code Block
solutionModel.removeMedia('myMedia');

...

code