All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.contextfw.web.application.component.ComponentFunctionCall Maven / Gradle / Ivy

package net.contextfw.web.application.component;


/**
 * Defines a javascript call invoked from server side.
 * 
 * 

* This class is a convinience class to make component based calls in with * correct convention. *

*

* The call will be in form: ComponentName('id').methodName([args,...]); *

*/ public class ComponentFunctionCall extends Script { private final Class clazz; private final String function; private final String id; private final Object[] args; /** * Sole constructor * * @param component * The component where this is to be invoked * @param function * The function name * @param args * The arguments. */ public ComponentFunctionCall(Component component, String function, Object... args) { this.clazz = component.getClass(); this.id = component.getId(); this.args = args; this.function = function; } @Override public String getScript(ScriptContext scriptContext) { return FunctionCall.toScript(scriptContext.getBuildName(clazz) + "(\"" + id + "\")." + function, args == null ? 0 : args.length); } @Override public Object[] getArguments(ScriptContext scriptContext) { return args; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy