Beispiel #1
0
 private void itemSelected(ComponentEvent ce) {
   Window w;
   if (ce instanceof MenuEvent) {
     MenuEvent me = (MenuEvent) ce;
     w = me.getItem().getData("window");
   } else {
     w = ce.getComponent().getData("window");
   }
   if (!desktop.getWindows().contains(w)) {
     desktop.addWindow(w);
   }
   if (w != null && !w.isVisible()) {
     w.show();
   } else {
     w.toFront();
   }
 }
Beispiel #2
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);
  }