Apr 29, 2024 14:41 Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients Sample Parameters Returns Supported Clients SampleSupported Clients
NGClient
Extends
JSComponent
Property Summary
Number
anchors
Enables a component to stick to a specific side of form and/or to
grow or shrink when a window is resized.
Boolean
enabled
The enable state of the component, default true.
Number
formIndex
The Z index of this component.
Number
height
The height in pixels of the component.
String
name
The name of the component.
String
typeName
The webcomponent type (name from the spec).
Boolean
visible
The visible property of the component, default true.
Number
width
The width in pixels of the component.
Number
x
The x coordinate of the component on the form.
Number
y
The y coordinate of the component on the form.
Methods Summary
Object
getDesignTimeProperty(key)
Get a design-time property of an element.
Array
getDesignTimePropertyNames()
Get the design-time properties of an element.
String
getFormName()
Returns the name of the form.
JSMethod
getHandler(handlerName)
Returns the JSMethod handler with the given name.
Object
getJSONProperty(propertyName)
Get the design-time value of the given property.
UUID
getUUID()
Returns the UUID of this component.
Object
putDesignTimeProperty(key, value)
Set a design-time property of an element.
Object
removeDesignTimeProperty(key)
Clear a design-time property of an element.
void
resetHandler(handlerName)
Similar to resetJSONProperty but for handlers.
void
resetJSONProperty(propertyName)
Reset the design-time value of the given property.
void
setHandler(handlerName, method)
Set the JSMethod handler for the given handler name.
void
setJSONProperty(propertyName, value)
Set the design-time value for the given property.
Property Details
anchors
var form = solutionModel.newForm('mediaForm', 'db:/example_data/parent_table', null, false, 400, 300);
var strechAllDirectionsLabel = form.newLabel('Strech all directions', 10, 10, 380, 280);
strechAllDirectionsLabel.background = 'red';
strechAllDirectionsLabel.anchors = SM_ANCHOR.ALL;
var strechVerticallyLabel = form.newLabel('Strech vertically', 10, 10, 190, 280);
strechVerticallyLabel.background = 'green';
strechVerticallyLabel.anchors = SM_ANCHOR.WEST | SM_ANCHOR.NORTH | SM_ANCHOR.SOUTH;
var strechHorizontallyLabel = form.newLabel('Strech horizontally', 10, 10, 380, 140);
strechHorizontallyLabel.background = 'blue';
strechHorizontallyLabel.anchors = SM_ANCHOR.NORTH | SM_ANCHOR.WEST | SM_ANCHOR.EAST;
var stickToTopLeftCornerLabel = form.newLabel('Stick to top-left corner', 10, 10, 200, 100);
stickToTopLeftCornerLabel.background = 'orange';
stickToTopLeftCornerLabel.anchors = SM_ANCHOR.NORTH | SM_ANCHOR.WEST; // This is equivalent to SM_ANCHOR.DEFAULT
var stickToBottomRightCornerLabel = form.newLabel('Stick to bottom-right corner', 190, 190, 200, 100);
stickToBottomRightCornerLabel.background = 'pink';
stickToBottomRightCornerLabel.anchors = SM_ANCHOR.SOUTH | SM_ANCHOR.EAST;
enabled
var form = solutionModel.newForm('printForm', 'db:/example_data/parent_table', null, false, 400, 300);
var field = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 20);
field.enabled = false;
formIndex
var labelBelow = form.newLabel('Green', 10, 10, 100, 50);
labelBelow.background = 'green';
labelBelow.formIndex = 10;
var fieldAbove = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 30);
fieldAbove.background = '#FF0000';
fieldAbove.formIndex = 20;
height
var field = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 20);
application.output('original width: ' + field.width);
application.output('original height: ' + field.height);
field.width = 200;
field.height = 100;
application.output('modified width: ' + field.width);
application.output('modified height: ' + field.height);
name
var form = solutionModel.newForm('someForm', 'db:/example_data/parent_table', null, false, 620, 300);
var label = form.newLabel('Label', 10, 10, 150, 150);
label.name = 'myLabel'; // Give a name to the component.
forms['someForm'].controller.show()
// Now use the name to access the component.
forms['someForm'].elements['myLabel'].text = 'Updated text';
typeName
var wc = form.getWebComponent('mycomponent');
application.output(bean.typeName);
visible
var form = solutionModel.newForm('printForm', 'db:/example_data/parent_table', null, false, 400, 300);
var field = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 20);
field.visible = false;
width
var field = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 20);
application.output('original width: ' + field.width);
application.output('original height: ' + field.height);
field.width = 200;
field.height = 100;
application.output('modified width: ' + field.width);
application.output('modified height: ' + field.height);
x
var field = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 20);
application.output('original location: ' + field.x + ', ' + field.y);
field.x = 90;
field.y = 90;
application.output('changed location: ' + field.x + ', ' + field.y);
y
var field = form.newField('parent_table_text', JSField.TEXT_FIELD, 10, 10, 100, 20);
application.output('original location: ' + field.x + ', ' + field.y);
field.x = 90;
field.y = 90;
application.output('changed location: ' + field.x + ', ' + field.y);
Methods Details
getDesignTimeProperty(key)
String
key
the name of the property
var frm = solutionModel.getForm('orders')
var fld = frm.getField('fld')
var prop = fld.getDesignTimeProperty('myprop')
getDesignTimePropertyNames()
var frm = solutionModel.getForm('orders')
var fld = frm.getField('fld')
var propNames = fld.getDesignTimePropertyNames()
getFormName()
var name = %%prefix%%%%elementName%%.getFormName();
getHandler(handlerName)
String
handlerName
the name of the handler to get
var wc = form.getWebComponent('mycomponent');
var handler = wc.getHandler('onActionMethodID');
getJSONProperty(propertyName)
String
propertyName
the name of the property to get
var wc = form.getWebComponent('mycomponent');
application.output(wc.getJSONProperty('mytext')); // will output a string value if present for a string typed property
application.output(wc.getJSONProperty('mynumber')); // getter will return a number if present
application.output(JSON.stringify(wc.getJSONProperty('mycustomtype'), null, ' ')); // getter returns an object if present for custom types is spec files
application.output(JSON.stringify(wc.getJSONProperty('myarray'), null, ' ')); // getter returns an array type if present for array types
application.output(JSON.stringify(wc.getJSONProperty('myfoundset'), null, ' ')); // getter returns an object representing the design settings of the given property if present
//In case you want to change a more complex property (e.g. tabs) obtained with getJSONProperty, setJSONProperty must be used:
var tabs = jsTabPanel.getJSONPRoperty("tabs");
tabs[0].containsFormId = jsForm;
jsTabPanel.setJSONProperty("tabs", tabs);
getUUID()
var button_uuid = solutionModel.getForm("my_form").getButton("my_button").getUUID();
application.output(button_uuid.toString());
putDesignTimeProperty(key, value)
String
key
the name of the property
Object
value
the value to store
var frm = solutionModel.getForm('orders')
var fld = frm.getField('fld')
fld.putDesignTimeProperty('myprop', 'strawberry')
removeDesignTimeProperty(key)
String
key
the name of the property
var frm = solutionModel.getForm('orders')
var fld = frm.getField('fld')
fld.removeDesignTimeProperty('myprop')
resetHandler(handlerName)
String
handlerName
the name of the handler to reset
var wc = form.getWebComponent('mycomponent'); // form is extending another form who's 'onActionMethodID' does something nice
wc.setHandler('onActionMethodID', form.getMethod('onCoolerAction'));
// hmm, I changed my mind - I like 'nice' action better
wc.resetHandler('onActionMethodID');
resetJSONProperty(propertyName)
String
propertyName
the name of the property to reset
var wc = form.getWebComponent('mycomponent'); // form is extending another form who's 'mycomponent' has property 'mytext' set to something...
wc.setJSONProperty('mytext', 'Hello World Extended!');
// hmm I changed my mind - I like simple 'Hello World' better
wc.resetJSONProperty('mytext');
setHandler(handlerName, method)
String
handlerName
the name of the handler to get
JSMethod
method
the JSMethod to attach to the handler (can be also JSMethod that has arguments)
var wc = form.getWebComponent('mycomponent');
wc.setHandler('onActionMethodID', form.getMethod('onAction'));
setJSONProperty(propertyName, value)
String
propertyName
the name of the property to set
Object
value
the new value of the property
var wc = form.getWebComponent('mycomponent');
wc.setJSONProperty('mytext', 'Hello World!');
wc.setJSONProperty('mynumber', 1);
wc.setJSONProperty('myborder', 'LineBorder,1,#ccffcc');
wc.setJSONProperty('mydynamicfoundset', { dataproviders: { dp1: "city", dp2: "country" }, foundsetSelector: "" }); // foundset property type using
// the parent form's foundset and providing two columns of the foundset to client; see foundset property type wiki page for more information