use of com.servoy.j2db.server.ngclient.component.RuntimeWebComponent in project servoy-client by Servoy.
the class WebFormUI method getScriptableComponents.
public Collection<WebComponent> getScriptableComponents() {
List<WebComponent> components = new ArrayList<WebComponent>();
Object[] names = getElementsScope().getIds();
if (names != null) {
for (Object componentName : names) {
Object component = getElementsScope().get((String) componentName, null);
if (component instanceof RuntimeWebComponent) {
components.add(((RuntimeWebComponent) component).getComponent());
}
}
}
return components;
}
use of com.servoy.j2db.server.ngclient.component.RuntimeWebComponent in project servoy-client by Servoy.
the class WebFormUI method removeComponentFromElementsScope.
// this should be the opposite of formUI.contributeComponentToElementsScope(...)
public void removeComponentFromElementsScope(FormElement fe, WebObjectSpecification componentSpec, WebFormComponent component) {
ElementScope elementsScope = getElementsScope();
if (elementsScope != null) {
if (!FormElement.ERROR_BEAN.equals(componentSpec.getName()) && (!fe.getName().startsWith("svy_") || ((fe.getPersistIfAvailable() instanceof IFormElement) && ((IFormElement) fe.getPersistIfAvailable()).getGroupID() != null))) {
if (!fe.getName().startsWith("svy_")) {
RuntimeWebComponent runtimeComponent = (RuntimeWebComponent) elementsScope.remove(fe.getRawName());
elementsScope.removeIndexByValue(runtimeComponent);
}
String groupID = fe.getPersistIfAvailable() instanceof IFormElement ? ((IFormElement) fe.getPersistIfAvailable()).getGroupID() : null;
if (groupID != null) {
if (groups == null)
groups = new HashMap<String, RuntimeWebGroup>(4);
RuntimeWebGroup group = groups.get(groupID);
if (group != null) {
String groupName = FormElementGroup.getName(groupID);
group.remove(component);
if (group.getComponentCount() == 0)
elementsScope.remove(groupName);
groups.remove(groupID);
}
}
}
} else {
Debug.error(new RuntimeException("Trying to remove component from a non-existent elements scope for form: " + getName()));
}
}
Aggregations