Example #1
0
  /**
   * 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);
   }
 }
Example #3
0
 public EventBuilder setTarget(Element target) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_TARGET, target);
   return this;
 }
Example #4
0
 public EventBuilder setShiftKey(boolean shiftKey) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_SHIFT, shiftKey);
   return this;
 }
Example #5
0
 public EventBuilder setMetaKey(boolean metaKey) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_META, metaKey);
   return this;
 }
Example #6
0
 public EventBuilder setKeyCode(int keyCode) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEYCODE, keyCode);
   return this;
 }
Example #7
0
 public EventBuilder setCtrlKey(boolean ctrlKey) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_CTRL, ctrlKey);
   return this;
 }
Example #8
0
 public EventBuilder setButton(int button) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_BUTTON, button);
   return this;
 }
Example #9
0
 public EventBuilder setAltKey(boolean altKey) {
   JavaScriptObjects.setProperty(event, JsoProperties.EVENT_KEY_ALT, altKey);
   return this;
 }
Example #10
0
 /**
  * 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);
 }
Example #11
0
 /**
  * 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);
 }