@Override protected void onRender(Element target, int index) { setElement(DOM.createDiv(), target, index); el().makePositionable(true); super.onRender(target, index); ul = new El(DOM.createDiv()); ul.addStyleName(baseStyle + "-list"); getElement().appendChild(ul.dom); // add menu to ignore list eventPreview.getIgnoreList().add(getElement()); el().setTabIndex(0); el().setElementAttribute("hideFocus", "true"); el().addStyleName("x-ignore"); if (GXT.isAriaEnabled()) { Accessibility.setRole(getElement(), "menu"); Accessibility.setRole(ul.dom, "presentation"); handleRadioGroups(); } if (plain) { addStyleName("x-menu-plain"); } if (!showSeparator) { addStyleName("x-menu-nosep"); } sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.KEYEVENTS | Event.ONMOUSEWHEEL); }
@Override protected void onRender(Element parent, int pos) { super.onRender(parent, pos); el().makePositionable(true); if (manager == null) { manager = WindowManager.get(); } if (plain) { addStyleName("x-window-plain"); } eventPreview = new BaseEventPreview() { @Override protected boolean onAutoHide(PreviewEvent ce) { if (autoHide) { if (resizing) { return false; } hide(); return true; } return false; } @Override protected void onPreviewKeyPress(PreviewEvent pe) { WindowEvent we = new WindowEvent(Window.this, pe.getEvent()); onKeyPress(we); } }; eventPreview.getIgnoreList().add(getElement()); sinkEvents(Event.ONMOUSEDOWN | Event.ONKEYPRESS); el().setTabIndex(0); el().setElementAttribute("hideFocus", "true"); if (GXT.isAriaEnabled()) { Accessibility.setRole(getElement(), "alertdialog"); Accessibility.setState(getElement(), "aria-labelledby", head.getId() + "-label"); Accessibility.setState(getElement(), "aria-hidden", "true"); } if (modal || maximizable || constrain) { monitorWindowResize = true; } if (super.width == null) { setWidth(Math.max(initialWidth, minWidth)); } }
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> </i></td><td class=\"x-btn-tc\"></td><td class=\"x-btn-tr\"><i> </i></td></tr>"); sb.append( "<tr><td class=\"x-btn-ml\"><i> </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> </i></td></tr>"); sb.append( "<tr><td class=\"x-btn-bl\"><i> </i></td><td class=\"x-btn-bc\"></td><td class=\"x-btn-br\"><i> </i></td></tr>"); sb.append("</tbody></table>"); buttonTemplate = new Template(sb.toString()); } template = buttonTemplate; } setElement( template.create( (text != null && text.length() > 0) ? text : " ", 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); }
protected void startDrag(DragEvent de) { dragging = true; WindowManager.get().bringToFront(this); hideShadow(); ghost = ghost(); if (eventPreview != null && ghost != null) { eventPreview.getIgnoreList().add(ghost.dom); } showWindow(false); Draggable d = de.getDraggable(); d.setProxy(ghost); }