/** * Create a builder to configure an {@link Event} of the specified type. * * @param eventType The type of the browser event to build. * @return The builder which can be used to configure the event to build. */ public static EventBuilder create(int eventType) { EventBuilder builder = new EventBuilder(); JavaScriptObjects.setProperty(builder.event, JsoProperties.EVENT_TYPE, eventType); return builder; }
protected void appendText(T wrapped, String data) { if (HasText.class.isInstance(wrapped)) { ((HasText) wrapped).setText(data); } else { Text text = JavaScriptObjects.newText(data); wrapped.getElement().appendChild(text); } }
public EventBuilder setTarget(Element target) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_TARGET, target); return this; }
public EventBuilder setShiftKey(boolean shiftKey) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_SHIFT, shiftKey); return this; }
public EventBuilder setMetaKey(boolean metaKey) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_META, metaKey); return this; }
public EventBuilder setKeyCode(int keyCode) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEYCODE, keyCode); return this; }
public EventBuilder setCtrlKey(boolean ctrlKey) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_CTRL, ctrlKey); return this; }
public EventBuilder setButton(int button) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_BUTTON, button); return this; }
public EventBuilder setAltKey(boolean altKey) { JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_ALT, altKey); return this; }
/** * Manually set a DOM element width. * * @param element The targeted element. * @param width The width value. */ public static void setClientWidth(Element element, int width) { JavaScriptObjects.setProperty(element, JsoProperties.ELEMENT_CLIENT_WIDTH, width); }
/** * Manually set a DOM element height. * * @param element The targeted element. * @param height The height value. */ public static void setClientHeight(Element element, int height) { JavaScriptObjects.setProperty(element, JsoProperties.ELEMENT_CLIENT_HEIGHT, height); }