/** * Adds the smartUpdate command to the specific component. * @since 7.0.3 */ public static void smartUpdate(Component comp, String key, Object value, boolean append) { if (comp instanceof AbstractComponent) ((AbstractComponent) comp).smartUpdate(key, value, append); }
/** A special smart update to update a value in character. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, char value) { smartUpdate(attr, new Character(value)); }
/** A special smart update to update an event listener for the * peer widget. * By default, it assumes the peer widget has a method called * <code>setListener<code> and it will be invoked as follows. * * <pre><code>wgt.setListener([evtnm, script]);</code></pre> * * <p>Devices that supports it in another way have to override this * method. Devices that don't support it have to override this method * to throw UnsupportedOperationException. * * @param evtnm the event name, such as onClick * @param script the script. If null, it means to remove the event * listener from the peer widget * @since 5.0.0 */ protected void smartUpdateWidgetListener(String evtnm, String script) { smartUpdate("listener", new String[] { evtnm, script }, true); }
/** A special smart update to update a value in boolean. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, boolean value) { smartUpdate(attr, Boolean.valueOf(value)); }
/** A special smart update to update a value in float. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, float value) { smartUpdate(attr, new Float(value)); }
/** A special smart update to update a value in double. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, double value) { smartUpdate(attr, new Double(value)); }
/** A special smart update to update a value in long. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, long value) { smartUpdate(attr, new Long(value)); }
/** A special smart update to update a value in byte. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, byte value) { smartUpdate(attr, new Byte(value)); }
/** A special smart update to update a value in int. * <p>It is the same as {@link #smartUpdate(String, Object)}. * @since 5.0.0 */ protected void smartUpdate(String attr, int value) { smartUpdate(attr, new Integer(value)); }
smartUpdate(attr, value, false);
public boolean setVisible(boolean visible) { final boolean old = _auxinf == null || _auxinf.visible; if (old != visible) { initAuxInfo().visible = visible; smartUpdate("visible", _auxinf.visible); } return old; }
/** A special smart update to update a method or a field of the peer widget. * By default, it invokes the client widget's <code>setOverride</code> as follows. * * <pre><code>wgt.setOverride([name: script]);</code></pre> * * <p>Devices that supports it in another way have to override this * method. Devices that don't support it have to override this method * to throw UnsupportedOperationException. * * @param name the method name, such as setValue * @param script the content of the method or field to override. * Notice that it must be a valid JavaScript snippet. * If null, the previous method/field override * will be removed. And, the method/field defined in original widget will * be restored. * @since 5.0.0 */ protected void smartUpdateWidgetOverride(String name, String script) { smartUpdate("override", new Object[] { name, new JavaScriptValue(script) }, true); }
public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) { if (evtnm == null || listener == null) throw new IllegalArgumentException("null"); if (_auxinf != null && _auxinf.listeners != null) { final boolean oldasap = Events.isListened(this, evtnm, true); final List<EventListenerInfo> lis = _auxinf.listeners.get(evtnm); if (lis != null) { for (Iterator<EventListenerInfo> it = lis.iterator(); it.hasNext();) { final EventListenerInfo li = it.next(); if (li.listener.equals(listener)) { it.remove(); if (lis.isEmpty()) _auxinf.listeners.remove(evtnm); final Desktop desktop = getDesktop(); if (desktop != null) { onListenerChange(desktop, false); if (getClientEvents().containsKey(evtnm)) { if (lis.isEmpty() && !Events.isListened(this, evtnm, false)) smartUpdate("$" + evtnm, (Object) null); //no listener at all else if (oldasap != Events.isListened(this, evtnm, true)) smartUpdate("$" + evtnm, !oldasap); } } return true; } } } } return false; }
public void setAutag(String tag) { if (tag != null && Strings.isEmpty(tag)) tag = null; if (!Objects.equals(_auxinf != null ? _auxinf.autag : null, tag)) { initAuxInfo().autag = tag; smartUpdate("autag", getAutag()); } }
final boolean asap = Events.isListened(this, evtnm, true); if (lis.size() == 1 || oldasap != asap) smartUpdate("$" + evtnm, asap);
public void setMold(String mold) { if (mold != null && (DEFAULT.equals(mold) || mold.length() == 0)) mold = null; if (!Objects.equals(_auxinf != null ? _auxinf.mold : DEFAULT, mold)) { if (!_def.hasMold(mold != null ? mold : DEFAULT)) throw new UiException("Unknown mold: " + mold + "; allowed: " + _def.getMoldNames()); final String oldtype = getWidgetClass(); initAuxInfo().mold = mold; if (Objects.equals(oldtype, getWidgetClass())) smartUpdate("mold", getMold()); else invalidate(); } }
smartUpdate("id", _id);