Пример #1
0
 @Override
 public void onComponentEvent(ComponentEvent ce) {
   super.onComponentEvent(ce);
   ButtonEvent be = (ButtonEvent) ce;
   switch (ce.getEventTypeInt()) {
     case Event.ONMOUSEOVER:
       onMouseOver(ce);
       break;
     case Event.ONMOUSEOUT:
       onMouseOut(ce);
       break;
     case Event.ONMOUSEDOWN:
       ce.stopEvent();
       onMouseDown(ce);
       break;
     case Event.ONMOUSEUP:
       ce.stopEvent();
       onMouseUp(ce);
       break;
     case Event.ONCLICK:
       ce.stopEvent();
       onClick(ce);
       break;
     case Event.ONFOCUS:
       onFocus(ce);
       break;
     case Event.ONBLUR:
       onBlur(be);
   }
 }
Пример #2
0
 public void handleEvent(GridEvent<Rule> be) {
   for (int i = 0; i < be.getGrid().getStore().getCount(); i++) {
     final Widget wid = be.getGrid().getView().getWidget(i, be.getColIndex());
     if ((wid != null) && (wid instanceof BoxComponent)) {
       ((BoxComponent) wid).setWidth(be.getWidth() - offset);
     }
   }
 }
Пример #3
0
  @Override
  protected void afterRender() {
    super.afterRender();

    setTabIndex(tabIndex);

    setIcon(icon);

    autoWidth();
  }
Пример #4
0
  protected void onRender(Element target, int index) {
    if (template == null) {
      if (buttonTemplate == null) {
        StringBuffer sb = new StringBuffer();
        sb.append(
            "<table cellspacing=\"0\" class=\"x-btn\" role=\"presentation\"><tbody class=\"{2}\" >");
        sb.append(
            "<tr><td class=\"x-btn-tl\"><i>&#160;</i></td><td class=\"x-btn-tc\"></td><td class=\"x-btn-tr\"><i>&#160;</i></td></tr>");
        sb.append(
            "<tr><td class=\"x-btn-ml\"><i>&#160;</i></td><td class=\"x-btn-mc\"><em class=\"{3}\" unselectable=\"on\"><button class=\"x-btn-text\" type=\"{1}\">{0}</button></em></td><td class=\"x-btn-mr\"><i>&#160;</i></td></tr>");
        sb.append(
            "<tr><td class=\"x-btn-bl\"><i>&#160;</i></td><td class=\"x-btn-bc\"></td><td class=\"x-btn-br\"><i>&#160;</i></td></tr>");
        sb.append("</tbody></table>");

        buttonTemplate = new Template(sb.toString());
      }
      template = buttonTemplate;
    }

    setElement(
        template.create(
            (text != null && text.length() > 0) ? text : "&nbsp;",
            getType(),
            "x-btn-"
                + scale.name().toLowerCase()
                + " x-btn-icon-"
                + scale.name().toLowerCase()
                + "-"
                + iconAlign.name().toLowerCase(),
            getMenuClass()),
        target,
        index);

    super.onRender(target, index);

    buttonEl = el().selectNode(buttonSelector);
    buttonEl.makePositionable();

    if (getFocusEl() != null) {
      getFocusEl().addEventsSunk(Event.FOCUSEVENTS);
    }

    preview.getIgnoreList().add(getElement());

    buttonEl.setTabIndex(0);

    if (GXT.isAriaEnabled()) {
      Accessibility.setRole(buttonEl.dom, Accessibility.ROLE_BUTTON);
      if (menu != null) {
        Accessibility.setState(buttonEl.dom, "aria-haspopup", "true");
      }
    }

    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS);
  }
Пример #5
0
  protected void onRender(Element target, int index) {
    setElement(DOM.createDiv(), target, index);
    addStyleName("x-icon-btn");
    addStyleName("x-nodrag");
    addStyleName(style);
    sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.FOCUSEVENTS | Event.ONKEYUP);
    super.onRender(target, index);

    if (GXT.isHighContrastMode) {
      getElement().setInnerHTML("<i>&nbsp;</i>");
    }

    if (GXT.isFocusManagerEnabled()) {
      el().setTabIndex(0);
      Accessibility.setRole(getElement(), Accessibility.ROLE_BUTTON);
    }
  }
Пример #6
0
 @Override
 protected void onEnable() {
   super.onEnable();
   el().enable();
 }
Пример #7
0
 @Override
 protected void onDetach() {
   super.onDetach();
   preview.remove();
 }