示例#1
0
  public void onModuleLoad() {
    GXT.setDefaultTheme(Theme.GRAY, true);

    Window gridWindow = createGridWindow();
    Window accordionWindow = createAccordionWindow();
    Window statisticWindow = createStatisticWindow();
    Window geolocationWindow = createGeolocationWindow();
    Window prezioWindow = createPrezioWindow();
    Window videoWindow = createVideoWindow();

    //		Dispatcher dispatcher = Dispatcher.get();
    //	    dispatcher.dispatch(AppEvents.Login);

    //	    desktop.getDesktop().hide();

    //	    desktop.getShortcuts().noti

    //	    desktop.getDesktop().setEnabled(false);
    //	    desktop.getDesktop().hide();
    //	    GXT.hideLoadingPanel("loading");
    //		desktop.getDesktop().setEnabled(true);
    //		desktop.getDesktop().show();
    //		desktop.getDesktop().setZIndex(10);
    //	    desktop.getTaskBar().setVisible(false);
    Window w = getEmptyWindow();
    desktop.addWindow(w);
    w.show();
    w.maximize();
    LoginDialog login = new LoginDialog(w);

    w.setZIndex(1);
    login.show();
    login.focus();
    login.setVisible(true);

    desktop.addWindow(prezioWindow);
    prezioWindow.show();
    prezioWindow.maximize();
    prezioWindow.focus();

    //	    login.setZIndex(15);

    SelectionListener<MenuEvent> menuListener =
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent me) {
            itemSelected(me);
          }
        };

    SelectionListener<ComponentEvent> shortcutListener =
        new SelectionListener<ComponentEvent>() {
          @Override
          public void componentSelected(ComponentEvent ce) {
            itemSelected(ce);
          }
        };

    Shortcut s1 = new Shortcut();
    s1.setText("Messages Window");
    s1.setId("grid-win-shortcut");
    s1.setData("window", gridWindow);
    s1.addSelectionListener(shortcutListener);
    desktop.addShortcut(s1);

    Shortcut s2 = new Shortcut();
    s2.setText("Contact list");
    s2.setId("acc-win-shortcut");
    s2.setData("window", accordionWindow);
    s2.addSelectionListener(shortcutListener);
    desktop.addShortcut(s2);

    Shortcut s3 = new Shortcut();
    s3.setText("Statistics");
    s3.setId("stat-win-shortcut");
    s3.setData("window", statisticWindow);
    s3.addSelectionListener(shortcutListener);
    desktop.addShortcut(s3);

    TaskBar taskBar = desktop.getTaskBar();

    StartMenu menu = taskBar.getStartMenu();
    menu.setHeading("Eurecom Presentation!");
    menu.setIconStyle("user");

    MenuItem menuItem = new MenuItem("Messages Window");
    menuItem.setData("window", gridWindow);
    menuItem.setIcon(IconHelper.createStyle("icon-grid"));
    menuItem.addSelectionListener(menuListener);
    menu.add(menuItem);

    menuItem = new MenuItem("Archives Window");
    menuItem.setIcon(IconHelper.createStyle("tabs"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", createTabWindow());
    menu.add(menuItem);

    menuItem = new MenuItem("Contact list");
    menuItem.setIcon(IconHelper.createStyle("accordion"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", accordionWindow);
    menu.add(menuItem);

    menuItem = new MenuItem("Statistic window");
    menuItem.setIcon(IconHelper.createStyle("icon-statistic"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", statisticWindow);
    menu.add(menuItem);

    menuItem = new MenuItem("Geolocation window");
    menuItem.setIcon(IconHelper.createStyle("icon-geo"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", geolocationWindow);
    menu.add(menuItem);

    menuItem = new MenuItem("Last messages");
    menuItem.setIcon(IconHelper.createStyle("icon-sms-menu"));

    Menu sub = new Menu();

    for (int i = 0; i < 3; i++) {
      MenuItem item = new MenuItem("Message " + (i + 1));
      item.setData("window", createBogusWindow(i));
      item.setIcon(IconHelper.createStyle("icon-sms"));
      item.addSelectionListener(menuListener);
      sub.add(item);
    }

    MenuItem item = new MenuItem("Received mms");
    item.setIcon(IconHelper.createStyle("icon-video"));
    item.addSelectionListener(menuListener);
    item.setData("window", videoWindow);
    sub.add(item);

    item = new MenuItem("Presentation window");
    item.setIcon(IconHelper.createStyle("icon-ppt"));
    item.addSelectionListener(menuListener);
    item.setData("window", prezioWindow);
    sub.add(item);

    menuItem.setSubMenu(sub);

    menu.add(menuItem);

    // tools
    MenuItem tool = new MenuItem("Settings");
    tool.setIcon(IconHelper.createStyle("settings"));
    tool.addSelectionListener(
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            Info.display("Event", "The 'Settings' tool was clicked");
          }
        });
    menu.addTool(tool);

    menu.addToolSeperator();

    tool = new MenuItem("Logout");
    tool.setIcon(IconHelper.createStyle("logout"));
    tool.addSelectionListener(
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            Info.display("Event", "The 'Logout' tool was clicked");
          }
        });
    menu.addTool(tool);
  }
示例#2
0
  protected void afterShow() {
    hidden = false;

    // layout early to render window's content for size calcs
    if (!layoutExecuted || isLayoutNeeded()) {
      layout();
    }

    if (restorePos != null) {
      setPosition(restorePos.x, restorePos.y);
      if (restoreSize != null) {
        setSize(restoreSize.width, restoreSize.height);
      }
    }
    if (restoreWindowScrolling != null) {
      com.google.gwt.dom.client.Document.get().enableScrolling(false);
    }

    int h = getHeight();
    int w = getWidth();
    if (h < minHeight && w < minWidth) {
      setSize(minWidth, minHeight);
    } else if (h < minHeight) {
      setHeight(minHeight);
    } else if (w < minWidth) {
      setWidth(minWidth);
    }

    // not positioned, then center
    if (!positioned) {
      el().center(true);
    }

    el().updateZIndex(0);
    if (modal) {
      modalPreview =
          Event.addNativePreviewHandler(
              new NativePreviewHandler() {
                public void onPreviewNativeEvent(NativePreviewEvent event) {
                  if (Element.is(event.getNativeEvent().getEventTarget())) {
                    Element target = (Element) Element.as(event.getNativeEvent().getEventTarget());

                    String tag = target.getTagName();
                    // ignore html and body because of frames
                    if (!resizing
                        && !dragging
                        && !tag.equalsIgnoreCase("html")
                        && !tag.equalsIgnoreCase("body")
                        && event.getTypeInt() != Event.ONLOAD
                        && manager.getActive() == Window.this
                        && (modalPanel == null
                            || (modalPanel != null
                                && !modalPanel.getElement().isOrHasChild(target)))
                        && !Window.this.getElement().isOrHasChild(target)
                        && fly(target).findParent(".x-ignore", -1) == null) {
                      ArrayList<Component> col =
                          new ArrayList<Component>(ComponentManager.get().getAll());
                      for (Component c : col) {
                        if (c instanceof TriggerField<?>) {
                          triggerBlur((TriggerField<?>) c);
                        } else if (c instanceof Menu) {
                          ((Menu) c).hide(true);
                        }
                      }
                      Window.this.focus();
                    }
                  }
                }

                private native void triggerBlur(TriggerField<?> field) /*-{
    [email protected]::triggerBlur(Lcom/extjs/gxt/ui/client/event/ComponentEvent;)(null);
  }-*/;
              });
    }

    // missing cursor workaround
    if (GXT.isGecko) {
      El e = el().selectNode(".x-window-bwrap");
      if (e != null) {
        e.dom.getStyle().setProperty("overflow", "auto");
        e.dom.getStyle().setProperty("position", "static");
      }
    }

    eventPreview.add();

    if (maximized) {
      maximize();
    }
    removeStyleName(HideMode.VISIBILITY.value());

    if (GXT.isAriaEnabled()) {
      Accessibility.setState(getElement(), "aria-hidden", "false");
    }

    fireEvent(Events.Show, new WindowEvent(this));
    toFront();
  }