Search in sources :

Example 11 with ServoyClientSupport

use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.

the class JSBaseContainer method getWebComponents.

/**
 * Returns all JSWebComponents of this form/container.
 * If this method is called on a form, then it will return all web components on that form.
 * If the form is responsive, it will return the web components from all the containers.
 *
 * @sample
 * var webComponents = myForm.getWebComponents(false);
 * for (var i in webComponents)
 * {
 * 	if (webComponents[i].name != null)
 * 		application.output(webComponents[i].name);
 * }
 *
 * @param returnInheritedElements boolean true to also return the elements from parent form
 * @return the list of all JSWebComponents on this forms
 */
@ServoyClientSupport(mc = false, ng = true, wc = false, sc = false)
@JSFunction
public JSWebComponent[] getWebComponents(boolean returnInheritedElements) {
    List<JSWebComponent> webComponents = new ArrayList<JSWebComponent>();
    AbstractContainer form2use = returnInheritedElements ? getFlattenedContainer() : getContainer();
    Iterator<WebComponent> iterator = form2use.getWebComponents();
    while (iterator.hasNext()) {
        WebComponent webComponent = iterator.next();
        webComponents.add(createWebComponent(getCorrectIJSParent(this, webComponent), webComponent, application, false));
    }
    return webComponents.toArray(new JSWebComponent[webComponents.size()]);
}
Also used : WebComponent(com.servoy.j2db.persistence.WebComponent) AbstractContainer(com.servoy.j2db.persistence.AbstractContainer) ArrayList(java.util.ArrayList) JSFunction(org.mozilla.javascript.annotations.JSFunction) ServoyClientSupport(com.servoy.base.scripting.annotations.ServoyClientSupport)

Example 12 with ServoyClientSupport

use of com.servoy.base.scripting.annotations.ServoyClientSupport in project servoy-client by Servoy.

the class JSBaseContainer method getLayoutContainers.

/**
 * Returns all JSLayoutContainers objects of this container
 *
 * @sample
 * var frm = solutionModel.getForm("myForm");
 * var containers = frm.getLayoutContainers();
 * for (var c in containers)
 * {
 * 		var fname = containers[c].name;
 * 		application.output(fname);
 * }
 *
 * @param returnInheritedElements boolean true to also return the elements from parent form
 * @return all JSLayoutContainers objects of this container
 */
@ServoyClientSupport(mc = false, ng = true, wc = false, sc = false)
@JSFunction
public JSLayoutContainer[] getLayoutContainers(boolean returnInheritedElements) {
    List<JSLayoutContainer> containers = new ArrayList<JSLayoutContainer>();
    AbstractContainer container = returnInheritedElements ? getFlattenedContainer() : getContainer();
    Iterator<LayoutContainer> iterator = container.getLayoutContainers();
    while (iterator.hasNext()) {
        containers.add(application.getScriptEngine().getSolutionModifier().createLayoutContainer(this, iterator.next()));
    }
    return containers.toArray(new JSLayoutContainer[containers.size()]);
}
Also used : AbstractContainer(com.servoy.j2db.persistence.AbstractContainer) LayoutContainer(com.servoy.j2db.persistence.LayoutContainer) ArrayList(java.util.ArrayList) JSFunction(org.mozilla.javascript.annotations.JSFunction) ServoyClientSupport(com.servoy.base.scripting.annotations.ServoyClientSupport)

Aggregations

ServoyClientSupport (com.servoy.base.scripting.annotations.ServoyClientSupport)12 JSFunction (org.mozilla.javascript.annotations.JSFunction)11 AbstractContainer (com.servoy.j2db.persistence.AbstractContainer)3 ScriptMethod (com.servoy.j2db.persistence.ScriptMethod)3 WebComponent (com.servoy.j2db.persistence.WebComponent)3 Function (org.mozilla.javascript.Function)3 GraphicalComponent (com.servoy.j2db.persistence.GraphicalComponent)2 ArrayList (java.util.ArrayList)2 Bean (com.servoy.j2db.persistence.Bean)1 Field (com.servoy.j2db.persistence.Field)1 Form (com.servoy.j2db.persistence.Form)1 LayoutContainer (com.servoy.j2db.persistence.LayoutContainer)1 RepositoryException (com.servoy.j2db.persistence.RepositoryException)1 Point (java.awt.Point)1 DocFlavor (javax.print.DocFlavor)1 PrintService (javax.print.PrintService)1 HashPrintRequestAttributeSet (javax.print.attribute.HashPrintRequestAttributeSet)1 PrintRequestAttributeSet (javax.print.attribute.PrintRequestAttributeSet)1