private String convertStyle(JsPropertyMap<String> rippleStyle) { StringBuilder style = new StringBuilder(); rippleStyle.forEach(key -> { style.append(key + ":" + rippleStyle.get(key) + ";"); }); return style.toString(); }
private String convertStyle(JsPropertyMap<String> rippleStyle) { StringBuilder style = new StringBuilder(); rippleStyle.forEach(key -> { style.append(key + ":" + rippleStyle.get(key) + ";"); }); return style.toString(); }
private Map<String, Object> initClassPropertiesCache(JsObject object, String className) { final Map<String, Object> tmpCache = new HashMap<>(); classesPropertyCaches.put(className, tmpCache); JsPropertyMap prototype = (JsPropertyMap) object.__proto__; prototype.forEach(property -> { Object value = prototype.get(property); if (isDefaultValue(value)) { tmpCache.put(property, value); } }); return tmpCache; }
/** * Copy a Java class prototype to a VueComponent declaration. This allows VueComponent created by * Vue to pass as an instance of the {@link IsVueComponent} class they represent. * * @param extendedVueJsConstructor The Vue.js constructor function to extend * @param javaComponentPrototype The {@link IsVueComponent} class JS prototype to extend with * @param <T> The type of the VueComponent */ public static <T extends IsVueComponent> void extendVueConstructorWithJavaPrototype( VueJsConstructor<T> extendedVueJsConstructor, JsPropertyMap<Object> javaComponentPrototype) { JsPropertyMap vueProto = (JsPropertyMap) ((JsPropertyMap) extendedVueJsConstructor).get("prototype"); JsObject vueProtoJsObject = ((JsObject) vueProto); javaComponentPrototype.forEach(protoProp -> { if (!vueProtoJsObject.hasOwnProperty(protoProp)) { vueProto.set(protoProp, javaComponentPrototype.get(protoProp)); } }); }
props.forEach( p -> {
/** * Init instance properties for the given VueComponent instance. The Constructor for VueComponent * is provided by Vue and doesn't extend the {@link IsVueComponent} constructor. This method get * an instance of the Java class for the VueComponent and copy properties to the * VueComponentInstance. This will initialise properties that are initialised inline in the class. * For example: List<String> myList = new LinkedList<String>(); * * @param vueComponentInstance An instance of VueComponent to initialize * @param javaComponentClassInstance An instance of the Component class */ public static void initComponentInstanceFields(IsVueComponent vueComponentInstance, IsVueComponent javaComponentClassInstance) { JsPropertyMap<Object> vueComponentInstancePropertyMap = Js.cast(vueComponentInstance); JsPropertyMap<Object> javaComponentClassInstancePropertyMap = Js .cast(javaComponentClassInstance); javaComponentClassInstancePropertyMap.forEach(key -> { try { if (!javaComponentClassInstancePropertyMap.has(key) || vueComponentInstancePropertyMap.get(key) != null) { return; } vueComponentInstancePropertyMap.set(key, javaComponentClassInstancePropertyMap.get(key)); } catch (Exception e) { } }); }