示例#1
0
  @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));
    }
  }
示例#2
0
 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);
 }