use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.
the class JSForm method removeButton.
/**
* Removes a JSButton that has the specified name. Returns true if removal was successful, false otherwise.
*
* @sample
* var form = solutionModel.newForm('newFormX',myDatasource,null,true,800,600);
* var b1 = form.newButton('This is button1',100,100,200,50,null);
* b1.name = 'b1';
* var jsmethod = form.newMethod("function removeMe(event) { var form = solutionModel.getForm('newFormX'); if (form.removeButton('b1') == true) application.output('Button has been removed ok'); else application.output('Button could not be deleted'); forms['newFormX'].controller.recreateUI();}");
* var b2 = form.newButton('Click here to remove button1',100,230,200,50,jsmethod);
* b2.name = 'b2';
* forms['newFormX'].controller.show();
*
* @param name the specified name of the JSButton to be removed
*
* @return true if the JSButton has been removed; false otherwise
*/
@ServoyClientSupport(mc = true, ng = true, wc = true, sc = true)
@JSFunction
public boolean removeButton(String name) {
if (name == null)
return false;
checkModification();
Iterator<GraphicalComponent> graphicalComponents = getContainer().getGraphicalComponents();
while (graphicalComponents.hasNext()) {
GraphicalComponent button = graphicalComponents.next();
if (name.equals(button.getName()) && ComponentFactory.isButton(button)) {
getContainer().removeChild(button);
return true;
}
}
return false;
}
use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.
the class JSForm method removeBean.
/**
* Removes a JSBean that has the specified name. Returns true if removal was successful, false otherwise.
*
* @sample
* var form = solutionModel.getForm('myform');
* form.removeBean('mybean')
*
* @param name the specified name of the JSBean to be removed
*
* @return true if the JSBean has been removed; false otherwise
*/
@ServoyClientSupport(mc = true, ng = true, wc = true, sc = true)
@JSFunction
public boolean removeBean(String name) {
if (name == null)
return false;
checkModification();
Iterator<Bean> beans = getContainer().getBeans();
while (beans.hasNext()) {
Bean bean = beans.next();
if (name.equals(bean.getName())) {
getContainer().removeChild(bean);
return true;
}
}
return false;
}
use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.
the class JSForm method js_setOnRecordEditStartMethod.
/**
* @deprecated As of release 4.1, replaced by setOnRecordEditStart(JSMethod).
*/
@Deprecated
@ServoyClientSupport(ng = false, wc = true, sc = true)
public void js_setOnRecordEditStartMethod(Object functionOrInteger) {
checkModification();
if (functionOrInteger instanceof Function) {
Function function = (Function) functionOrInteger;
ScriptMethod scriptMethod = getScriptMethod(function, application.getFlattenedSolution());
if (scriptMethod != null) {
getForm().setOnRecordEditStartMethodID(scriptMethod.getID());
} else {
getForm().setOnRecordEditStartMethodID(0);
}
} else if (functionOrInteger instanceof Number) {
getForm().setOnRecordEditStartMethodID(((Number) functionOrInteger).intValue());
}
}
use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.
the class JSForm method removeLabel.
/**
* Removes a JSLabel that has the given name. Returns true if removal successful, false otherwise
*
* @sample
* var form = solutionModel.newForm('newFormX',myDatasource,null,true,1000,750);
* var jslabel = form.newLabel('JSLabel to delete',100,200,200,50,null);
* jslabel.name = 'jsl';
* jslabel.transparent = false;
* jslabel.background = 'green';
* var jsmethod = form.newMethod("function removeMe(event) { var form = solutionModel.getForm('newFormX'); if (form.removeComponent('jsl') == true) application.output('Label has been removed'); else application.output('Label could not be deleted'); forms['newFormX'].controller.recreateUI();}");
* var removerButton = form.newButton('Click here to remove the green label',450,500,250,50,jsmethod);
* removerButton.name = 'remover';
* forms['newFormX'].controller.show();
*
* @param name the specified name of the JSLabel to be removed
*
* @return true if the JSLabel with the given name has successfully been removed; false otherwise
*/
@ServoyClientSupport(mc = true, ng = true, wc = true, sc = true)
@JSFunction
public boolean removeLabel(String name) {
if (name == null)
return false;
checkModification();
Iterator<GraphicalComponent> graphicalComponents = getContainer().getGraphicalComponents();
while (graphicalComponents.hasNext()) {
GraphicalComponent label = graphicalComponents.next();
if (name.equals(label.getName()) && !ComponentFactory.isButton(label)) {
getContainer().removeChild(label);
return true;
}
}
return false;
}
use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.
the class JSBaseContainer method removeWebComponent.
/**
* Removes a JSWebComponent that has the specified name. Returns true if removal was successful, false otherwise.
*
* @sample
* var form = solutionModel.getForm('myform');
* form.removeWebComponent('mybean')
*
* @param name the specified name of the JSWebComponent to be removed
*
* @return true if the JSWebComponent has been removed; false otherwise
*/
@ServoyClientSupport(mc = false, ng = true, wc = false, sc = false)
@JSFunction
public boolean removeWebComponent(String name) {
if (name == null)
return false;
checkModification();
Iterator<WebComponent> webComponents = getContainer().getWebComponents();
while (webComponents.hasNext()) {
WebComponent webComponent = webComponents.next();
if (name.equals(webComponent.getName())) {
getContainer().removeChild(webComponent);
return true;
}
}
return false;
}
Aggregations