Search in sources :

Example 1 with HasRuntimeClientProperty

use of com.servoy.j2db.ui.runtime.HasRuntimeClientProperty in project servoy-client by Servoy.

the class Utils method removeJavascripLinkFromDisplay.

public static Object removeJavascripLinkFromDisplay(IDisplayData display, Object[] value) {
    Object obj = value == null ? display.getValueObject() : value[0];
    if (obj instanceof String && display instanceof IScriptableProvider) {
        IScriptable scriptable = ((IScriptableProvider) display).getScriptObject();
        if (scriptable instanceof HasRuntimeClientProperty) {
            HasRuntimeClientProperty scriptableWithClientProperty = (HasRuntimeClientProperty) scriptable;
            if (!Boolean.TRUE.equals(scriptableWithClientProperty.getClientProperty(IApplication.ALLOW_JAVASCRIPT_LINK_INPUT))) {
                // $NON-NLS-1$ //$NON-NLS-2$
                obj = ((String) obj).replaceAll("(?i)javascript:", "");
                display.setValueObject(obj);
            }
        }
    }
    return obj;
}
Also used : HasRuntimeClientProperty(com.servoy.j2db.ui.runtime.HasRuntimeClientProperty) NativeJavaObject(org.mozilla.javascript.NativeJavaObject) JSONObject(org.json.JSONObject) XMLObject(org.mozilla.javascript.xml.XMLObject) IScriptableProvider(com.servoy.j2db.scripting.IScriptableProvider) IScriptable(com.servoy.j2db.scripting.IScriptable)

Example 2 with HasRuntimeClientProperty

use of com.servoy.j2db.ui.runtime.HasRuntimeClientProperty in project servoy-client by Servoy.

the class ScrollResponseHeaderContainer method putClientProperty.

/**
 * put client property for current and future components.
 */
public void putClientProperty(IPersist persist, Object key, Object value) {
    Map<Object, Object> clientProperties = elementToClientProperties.get(persist);
    if (clientProperties == null) {
        elementToClientProperties.put(persist, clientProperties = new HashMap<Object, Object>());
    }
    clientProperties.put(key, value);
    for (Entry<Component, IPersist> entry : cellToElement.entrySet()) {
        if (entry.getValue().equals(persist)) {
            Component component = entry.getKey();
            if (component instanceof IScriptableProvider) {
                IScriptable scriptObject = ((IScriptableProvider) component).getScriptObject();
                if (scriptObject instanceof HasRuntimeClientProperty) {
                    ((HasRuntimeClientProperty) scriptObject).putClientProperty(key, value);
                }
            }
        }
    }
}
Also used : HasRuntimeClientProperty(com.servoy.j2db.ui.runtime.HasRuntimeClientProperty) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) IPersist(com.servoy.j2db.persistence.IPersist) IComponent(com.servoy.j2db.ui.IComponent) AbstractRuntimeBaseComponent(com.servoy.j2db.ui.scripting.AbstractRuntimeBaseComponent) BaseComponent(com.servoy.j2db.persistence.BaseComponent) GraphicalComponent(com.servoy.j2db.persistence.GraphicalComponent) IFieldComponent(com.servoy.j2db.ui.IFieldComponent) Component(org.apache.wicket.Component) IPortalComponent(com.servoy.j2db.ui.IPortalComponent) IRuntimeComponent(com.servoy.j2db.ui.runtime.IRuntimeComponent) IScriptableProvider(com.servoy.j2db.scripting.IScriptableProvider) IScriptable(com.servoy.j2db.scripting.IScriptable)

Aggregations

IScriptable (com.servoy.j2db.scripting.IScriptable)2 IScriptableProvider (com.servoy.j2db.scripting.IScriptableProvider)2 HasRuntimeClientProperty (com.servoy.j2db.ui.runtime.HasRuntimeClientProperty)2 BaseComponent (com.servoy.j2db.persistence.BaseComponent)1 GraphicalComponent (com.servoy.j2db.persistence.GraphicalComponent)1 IPersist (com.servoy.j2db.persistence.IPersist)1 IComponent (com.servoy.j2db.ui.IComponent)1 IFieldComponent (com.servoy.j2db.ui.IFieldComponent)1 IPortalComponent (com.servoy.j2db.ui.IPortalComponent)1 IRuntimeComponent (com.servoy.j2db.ui.runtime.IRuntimeComponent)1 AbstractRuntimeBaseComponent (com.servoy.j2db.ui.scripting.AbstractRuntimeBaseComponent)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Component (org.apache.wicket.Component)1 JSONObject (org.json.JSONObject)1 NativeJavaObject (org.mozilla.javascript.NativeJavaObject)1 XMLObject (org.mozilla.javascript.xml.XMLObject)1