use of com.servoy.j2db.server.ngclient.property.types.ReadonlySabloValue in project servoy-client by Servoy.
the class RuntimeWebGroup method putProperty.
private void putProperty(String propertyName, Object value, WebFormComponent component) {
if (propertyName == null)
return;
Object previousVal = component.getProperty(propertyName);
Object val = null;
if (propertyName.equals(WebFormUI.READONLY)) {
val = Boolean.valueOf((boolean) value);
Object readonlyproperty = component.getProperty(WebFormUI.READONLY);
if (readonlyproperty instanceof ReadonlySabloValue) {
ReadonlySabloValue oldValue = (ReadonlySabloValue) readonlyproperty;
// use the rhino conversion to convert from boolean to ReadOnlySabloValue
PropertyDescription pd = component.getFormElement().getWebComponentSpec().getProperty(WebFormUI.READONLY);
if (pd != null)
val = ReadonlyPropertyType.INSTANCE.toSabloComponentValue(val, oldValue, pd, component);
}
} else {
val = NGConversions.INSTANCE.convertRhinoToSabloComponentValue(value, previousVal, component.getSpecification().getProperties().get(propertyName), component);
}
if (val != previousVal)
component.setProperty(propertyName, val);
}
use of com.servoy.j2db.server.ngclient.property.types.ReadonlySabloValue in project servoy-client by Servoy.
the class WebFormUI method propagatePropertyToAllComponents.
private void propagatePropertyToAllComponents(String property, boolean value) {
for (WebComponent component : getComponents()) {
Object newValue = Boolean.valueOf(value);
if (READONLY.equals(property)) {
Object readonlyproperty = component.getProperty(READONLY);
if (readonlyproperty instanceof ReadonlySabloValue) {
ReadonlySabloValue oldValue = (ReadonlySabloValue) readonlyproperty;
// use the rhino conversion to convert from boolean to ReadOnlySabloValue
PropertyDescription pd = ((WebFormComponent) component).getFormElement().getWebComponentSpec().getProperty(READONLY);
if (pd != null)
newValue = ReadonlyPropertyType.INSTANCE.toSabloComponentValue(Boolean.valueOf(value), oldValue, pd, component);
}
}
component.setProperty(property, newValue);
}
}
use of com.servoy.j2db.server.ngclient.property.types.ReadonlySabloValue in project servoy-client by Servoy.
the class WebFormController method focusField.
@SuppressWarnings("nls")
@Override
protected boolean focusField(String fieldName, boolean skipReadonly) {
WebComponent component = null;
WebObjectFunctionDefinition apiFunction = null;
if (fieldName != null) {
component = formUI.getComponent(fieldName);
if (component == null) {
RuntimeWebComponent[] runtimeComponents = getWebComponentElements();
if (runtimeComponents != null) {
for (RuntimeWebComponent runtimeComponent : runtimeComponents) {
if (Utils.equalObjects(fieldName, runtimeComponent.getComponent().getName())) {
component = runtimeComponent.getComponent();
break;
}
}
}
}
if (component != null) {
apiFunction = component.getSpecification().getApiFunction("requestFocus");
}
} else {
Collection<WebComponent> tabSequenceComponents = getTabSequenceComponents();
if (tabSequenceComponents != null) {
for (WebComponent seqComponent : tabSequenceComponents) {
apiFunction = seqComponent.getSpecification().getApiFunction("requestFocus");
if (apiFunction != null && seqComponent.isVisible()) {
if (skipReadonly) {
Object value = seqComponent.getProperty(WebFormUI.READONLY);
if (value instanceof ReadonlySabloValue) {
value = Boolean.valueOf(((ReadonlySabloValue) value).getValue());
}
if (Boolean.TRUE.equals(value)) {
continue;
}
}
component = seqComponent;
break;
}
}
}
}
if (apiFunction != null && component != null) {
component.invokeApi(apiFunction, null);
return true;
}
return false;
}
Aggregations