Exemple #1
0
  @Override
  protected Menu createContextMenu(final int colIndex) {
    Menu menu = super.createContextMenu(colIndex);

    if (menu != null && enableGroupingMenu && cm.isGroupable(colIndex)) {
      MenuItem groupBy = new MenuItem(GXT.MESSAGES.groupingView_groupByText());
      groupBy.setIcon(getImages().getGroupBy());
      groupBy.addSelectionListener(
          new SelectionListener<MenuEvent>() {

            @Override
            public void componentSelected(MenuEvent ce) {
              onGroupByClick(ce, colIndex);
            }
          });
      menu.add(new SeparatorMenuItem());
      menu.add(groupBy);
    }

    if (menu != null && enableGroupingMenu && enableGrouping && enableNoGroups) {
      final CheckMenuItem showInGroups =
          new CheckMenuItem(GXT.MESSAGES.groupingView_showGroupsText());
      showInGroups.setChecked(true);
      showInGroups.addSelectionListener(
          new SelectionListener<MenuEvent>() {

            @Override
            public void componentSelected(MenuEvent ce) {
              onShowGroupsClick(ce, showInGroups.isChecked());
            }
          });
      menu.add(showInGroups);
    }
    return menu;
  }
 public static void setTreePanel(GPTreePanel<GPBeanTreeModel> treePanel) {
   TreeContextMenuFactory.treePanel = treePanel;
   pasteAction = new PasteLayerAction(treePanel);
   pasteMenuItem = new MenuItem("Paste in Folder");
   pasteMenuItem.setIcon(LayerResources.ICONS.paste());
   pasteMenuItem.setEnabled(Boolean.FALSE);
   pasteMenuItem.addSelectionListener(pasteAction);
 }
 private void update() {
   boolean hasActiveWindow = svgWindows.size() > 0;
   exportAsSvgMenuItem.setEnabled(hasActiveWindow);
   closeWindowItem.setEnabled(hasActiveWindow);
   tileWindowsItem.setEnabled(hasActiveWindow);
   stackWindowsItem.setEnabled(hasActiveWindow);
   resetViewItem.setEnabled(hasActiveWindow);
 }
  private MenuItem newFolder() {
    MenuItem item = new MenuItem("New Folder");

    item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.category()));

    item.addListener(Events.OnClick, new AddFolderBaseEventListener());

    return item;
  }
 private MenuItem acceptConnectionMenuItem(final Menu scrollMenu, final ConnectionRequest r)
     throws NimbitsException {
   final MenuItem m = new MenuItem(r.getRequestorEmail().getValue());
   m.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.connection()));
   m.addListener(
       Events.Select,
       new AcceptConnectionBaseEventListener(r, scrollMenu, m, connectionRequest));
   return m;
 }
  private MenuItem uploadFile() {
    MenuItem item = new MenuItem("Upload File");

    item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.diagram()));

    item.addListener(Events.OnClick, uploadFileListener);

    return item;
  }
  private MenuItem newDataPoint() {
    final MenuItem item = new MenuItem("Data Point");

    item.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.addNew()));
    item.setToolTip(UserMessages.MESSAGE_NEW_POINT);
    item.addListener(Events.OnClick, new NewPointBaseEventListener());

    return item;
  }
  private static MenuItem urlMenuItem(
      final String text, final AbstractImagePrototype icon, final String url) {
    MenuItem item = new MenuItem(text);

    item.setIcon(icon);

    item.addListener(Events.OnClick, new OpenUrlBaseEventListener(url));

    return item;
  }
  private MenuItem actionMenuItem(
      final String text, final AbstractImagePrototype icon, final Action action) {
    MenuItem item = new MenuItem(text);

    item.setIcon(icon);

    item.addListener(Events.OnClick, new ActionEventListener(action));

    return item;
  }
 public Menu getListMenu() {
   Menu m = new Menu();
   MenuItem item = new MenuItem();
   item.setText("Remove");
   item.addSelectionListener(
       new SelectionListener<MenuEvent>() {
         @Override
         public void componentSelected(MenuEvent ce) {
           selected.remove((DataListItem) ce.getSource());
         }
       });
   m.add(item);
   return m;
 }
Exemple #11
0
  public void _add() {
    int armStatus = ArmWrapper.FAILED;
    try {
      ArmWrapper.startTransaction(
          this, "com.base.myproject.client.ui.BaseMenuBar", "_add", new Object[] {});
      Button item1 = new Button("Button w/ Menu");
      item1.setIconStyle("icon-menu-show");
      Menu menu = new Menu();
      CheckMenuItem menuItem = new CheckMenuItem("I Like Cats");
      menuItem.setChecked(true);
      menu.add(menuItem);

      menuItem = new CheckMenuItem("I Like Dogs");
      menu.add(menuItem);
      item1.setMenu(menu);

      MenuItem menuitem2 = new MenuItem();
      menuitem2.setText("menuitem2");
      menuitem2.addSelectionListener(
          new SelectionListener() {

            @Override
            public void componentSelected(ComponentEvent ce) {
              // TODO Auto-generated method stub

            }

            public void handleEvent(BaseEvent be) {
              // TODO Auto-generated method stub
              // System.out.println("++");
              HTML homeText = new HTML("Tab you have selected is Home.");
              // BaseTabPanel.getInstance().addTab("zgw2", homeText);
              // BaseTabPanel.getInstance().addTab("zgw3", new BasePanel());
              BaseTabPanel.getInstance().addTab("zgw4", new TestBusi());
            }
          });

      menu.add(menuitem2);

      basemenubar.add(item1);
      armStatus = ArmWrapper.GOOD;
      // basemenubar.add(menuitem2);
    } finally {
      ArmWrapper.stopTransaction("com.base.myproject.client.ui.BaseMenuBar", "_add", armStatus);
    }
  }
 public static Menu getRootContextMenu() {
   if (rootContextMenu == null) {
     rootContextMenu = new Menu();
     AddFolderMenuAction addFolderAction = new AddFolderMenuAction(treePanel);
     MenuItem addFolder = new MenuItem();
     addFolder.setText(addFolderAction.getTitle());
     addFolder.setIcon(addFolderAction.getImage());
     addFolder.addSelectionListener(addFolderAction);
     rootContextMenu.add(addFolder);
     MenuItem shareProject = new MenuItem();
     shareProject.setText(shareProjectMenuAction.getTitle());
     shareProject.setIcon(shareProjectMenuAction.getImage());
     shareProject.addSelectionListener(shareProjectMenuAction);
     shareProject.setEnabled(shareProjectMenuAction.isEnabled());
     rootContextMenu.add(shareProject);
   }
   return rootContextMenu;
 }
 /**
  * Creates the import menu item.
  *
  * @return the menu item
  */
 @SuppressWarnings("unused")
 private MenuItem createImportMenuItem() {
   MenuItem importMenuItem = new MenuItem("Import");
   importMenuItem.ensureDebugId(DebugId.IMPORT);
   // importMenuItem.setIcon(icons.importIcon());
   final ApplicationView that = this;
   importMenuItem.addSelectionListener(
       new SelectionListener<MenuEvent>() {
         @Override
         public void componentSelected(MenuEvent ce) {
           final ImportZipWindow importWindow = new ImportZipWindow();
           importWindow.addListener(
               ResponseJSONEvent.RESPONSEJSON,
               new ResponseJSONListener() {
                 @Override
                 public void afterSubmit(ResponseJSONEvent be) {
                   // that.activityPanel.reRenderTree(be.getData().toString(), screenTab);
                   importWindow.hide();
                 }
               });
         }
       });
   return importMenuItem;
 }
  public static Menu getFolderContextMenu() {
    if (folderContextMenu == null) {
      folderContextMenu = new Menu();
      folderContextMenu.add(pasteMenuItem);

      MenuItem folderRename = new MenuItem();
      folderRename.setText("Rename Folder");
      folderRename.setIcon(LayerResources.ICONS.editFolder());
      folderRename.addSelectionListener(new ShowFolderRenameAction(treePanel));
      folderContextMenu.add(folderRename);

      MenuItem createViewportFolderMenu = new MenuItem();
      createViewportFolderMenu.setText("Create Viewport");
      createViewportFolderMenu.setIcon(BasicWidgetResources.ICONS.viewport());
      createViewportFolderMenu.addSelectionListener(new CreateFolderViewportAction(treePanel));
      folderContextMenu.add(createViewportFolderMenu);
    }
    return folderContextMenu;
  }
 public static Menu getMultiSelectionMenu(boolean isOnlyLayers) {
   if (multipleSelectionContextMenu == null) {
     multipleSelectionContextMenu = new Menu();
     DeleteElementsMenuAction deleteElementsMenuAction = new DeleteElementsMenuAction(treePanel);
     MenuItem deleteElements = new MenuItem();
     deleteElements.setText(deleteElementsMenuAction.getTitle());
     deleteElements.setIcon(deleteElementsMenuAction.getImage());
     deleteElements.addSelectionListener(deleteElementsMenuAction);
     multipleSelectionContextMenu.add(deleteElements);
     copyMultiLayers = new MenuItem("Copy Layers");
     copyMultiLayers.setIcon(LayerResources.ICONS.copy());
     copyMultiLayers.addSelectionListener(
         new CopyLayerAction(treePanel, pasteAction, pasteMenuItem));
   }
   if (isOnlyLayers) {
     multipleSelectionContextMenu.add(copyMultiLayers);
   } else if (multipleSelectionContextMenu.getItems().contains(copyMultiLayers)) {
     multipleSelectionContextMenu.remove(copyMultiLayers);
   }
   return multipleSelectionContextMenu;
 }
Exemple #16
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);
  }
  private MenuBar createMenuBar() {
    Menu fileMenu = new Menu();
    final MenuItem newDocumentMenuItem = new MenuItem(AppConstants.INSTANCE.newDocumentMenuItem());
    fileMenu.add(newDocumentMenuItem);
    final MenuItem openUrlItem = new MenuItem(AppConstants.INSTANCE.openUrlMenuItem());
    fileMenu.add(openUrlItem);
    final MenuItem openLocalMenuItem = new MenuItem(AppConstants.INSTANCE.openLocalMenuItem());
    fileMenu.add(openLocalMenuItem);
    final MenuItem openRssFeedItem = new MenuItem(AppConstants.INSTANCE.openRssFeedMenuItem());
    fileMenu.add(openRssFeedItem);
    exportAsSvgMenuItem = new MenuItem(AppConstants.INSTANCE.exportAsSvgMenuItem());
    fileMenu.add(exportAsSvgMenuItem);
    MenuItem recentDocumentsItem = new MenuItem(AppConstants.INSTANCE.recentDocumentsMenuItem());
    recentDocsMenu = new Menu();
    recentDocumentsItem.setSubMenu(recentDocsMenu);
    fileMenu.add(recentDocumentsItem);

    Menu windowMenu = new Menu();
    resetViewItem = new MenuItem(AppConstants.INSTANCE.resetViewMenuItem());
    windowMenu.add(resetViewItem);
    windowMenu.add(new SeparatorMenuItem());
    tileWindowsItem = new MenuItem(AppConstants.INSTANCE.tileWindowsMenuItem());
    windowMenu.add(tileWindowsItem);
    stackWindowsItem = new MenuItem(AppConstants.INSTANCE.stackWindowsMenuItem());
    windowMenu.add(stackWindowsItem);
    windowMenu.add(new SeparatorMenuItem());
    closeWindowItem = new MenuItem(AppConstants.INSTANCE.closeWindowMenuItem());
    windowMenu.add(closeWindowItem);

    Menu toolsMenu = new Menu();
    final MenuItem inspectorMenuItem = new MenuItem(AppConstants.INSTANCE.inspectorMenuItem());
    toolsMenu.add(inspectorMenuItem);

    Menu aboutMenu = new Menu();
    final MenuItem aboutItem = new MenuItem(AppConstants.INSTANCE.aboutMenuItem());
    aboutMenu.add(aboutItem);

    MenuBar menuBar = new MenuBar();
    menuBar.setBorders(true);
    menuBar.setStyleAttribute("borderTop", "none");
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.fileMenu(), fileMenu));
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.windowMenu(), windowMenu));
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.toolsMenu(), toolsMenu));
    menuBar.add(new MenuBarItem(AppConstants.INSTANCE.aboutMenu(), aboutMenu));

    dispatcher =
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent me) {
            MenuItem item = (MenuItem) me.getItem();
            if (item == newDocumentMenuItem) {
              newDocument();
            } else if (item == openUrlItem) {
              openUrl();
            } else if (item == openLocalMenuItem) {
              openLocal();
            } else if (item == openRssFeedItem) {
              openRssFeed();
            } else if (item == exportAsSvgMenuItem) {
              exportAsSvg();
            } else if (item == resetViewItem) {
              resetView();
            } else if (item == tileWindowsItem) {
              tileWindows();
            } else if (item == stackWindowsItem) {
              stackWindows();
            } else if (item == closeWindowItem) {
              closeWindow(activeWindow);
            } else if (item == inspectorMenuItem) {
              inspector();
            } else if (item == aboutItem) {
              about();
            }
          }
        };
    newDocumentMenuItem.addSelectionListener(dispatcher);
    openUrlItem.addSelectionListener(dispatcher);
    openLocalMenuItem.addSelectionListener(dispatcher);
    openRssFeedItem.addSelectionListener(dispatcher);
    exportAsSvgMenuItem.addSelectionListener(dispatcher);
    resetViewItem.addSelectionListener(dispatcher);
    tileWindowsItem.addSelectionListener(dispatcher);
    stackWindowsItem.addSelectionListener(dispatcher);
    closeWindowItem.addSelectionListener(dispatcher);
    inspectorMenuItem.addSelectionListener(dispatcher);
    aboutItem.addSelectionListener(dispatcher);
    return menuBar;
  }
  public LayoutContainer getRightSide() {
    RowLayout layout = new RowLayout();
    // layout.setMargin(0);
    // layout.setSpacing(0);

    ButtonBar south = new ButtonBar();
    south.setAlignment(HorizontalAlignment.RIGHT);
    final Button complete =
        new Button(
            "Complete Split",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                onClose();
              }
            });
    south.add(complete);
    complete.setEnabled(false);

    LayoutContainer container = new LayoutContainer();
    container.setLayout(layout);
    container.setLayoutOnChange(true);

    final DataList moveList = new DataList();
    final ListBox listBox = new ListBox();
    listBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            moveList.removeAll();
            ArrayList<String> list =
                parentToChildList.get(listBox.getValue(listBox.getSelectedIndex()));
            if (list == null) return;
            Iterator<String> iterator = list.listIterator();
            while (iterator.hasNext()) {
              // FIXME: look at this, i just fix this and dont know if it's right. CS
              String nodeID = iterator.next();
              Taxon cur = TaxonomyCache.impl.getTaxon(nodeID);
              DataListItem li = new DataListItem(cur.getFullName());
              li.setData("nodeID", nodeID);
              li.setData("node", cur);
              moveList.add(li);
            }
            layout();
          }
        });

    Menu m = new Menu();
    MenuItem item = new MenuItem();
    item.setText("Remove");
    item.addSelectionListener(
        new SelectionListener<MenuEvent>() {
          @Override
          public void componentSelected(MenuEvent ce) {
            DataListItem item = (DataListItem) ce.getSource();
            ArrayList<String> list =
                parentToChildList.get(listBox.getValue(listBox.getSelectedIndex()));
            if (list != null) list.remove(item.getData("nodeID"));

            moveList.remove(item);
            children.add(item);
            layout();
          }
        });
    m.add(item);
    moveList.setContextMenu(m);

    VerticalPanel table = new VerticalPanel();
    table.add(new HTML("Current Taxonomic Group: "));
    table.add(listBox);
    listBox.setWidth("100%");
    listBox.setEnabled(false);

    final ButtonBar bar = new ButtonBar();
    bar.setAlignment(HorizontalAlignment.RIGHT);
    final Button addChild =
        new Button(
            "Add Child",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                List<DataListItem> sel = children.getSelectedItems();
                if (sel == null) return;
                ArrayList<String> list =
                    parentToChildList.get(listBox.getValue(listBox.getSelectedIndex()));
                for (DataListItem selected : sel) {
                  children.remove(selected);
                  String nodeID = selected.getData("nodeID");
                  if (!list.contains(nodeID)) {
                    list.add(nodeID);
                    DataListItem item = new DataListItem(selected.getText());
                    item.setData("nodeID", nodeID);
                    item.setData("node", selected.getData("node"));
                    moveList.add(item);
                  }
                }
                layout();
              }
            });
    addChild.setEnabled(false);
    bar.add(addChild);
    bar.add(
        new Button(
            "Create New Taxon",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                TaxonomyCache.impl.fetchTaxon(
                    currentNode.getParentId(),
                    false,
                    new GenericCallback<Taxon>() {
                      public void onFailure(Throwable caught) {
                        WindowUtils.errorAlert(
                            "Error",
                            "Could not " + "find parent level to attach new taxonomic concept to.");
                      }

                      public void onSuccess(Taxon result) {
                        complete.setEnabled(true);

                        final CreateNewTaxonPanel panel = new CreateNewTaxonPanel(result);
                        panel.addListener(
                            Events.StateChange,
                            new Listener<BaseEvent>() {
                              public void handleEvent(BaseEvent be) {
                                Taxon newNode = (Taxon) be.getSource();
                                parentToChildList.put(
                                    newNode.getId() + "", new ArrayList<String>());
                                listBox.addItem(newNode.getFullName(), newNode.getId() + "");
                                listBox.setSelectedIndex(listBox.getItemCount() - 1);
                                listBox.setEnabled(true);
                                moveList.removeAll();
                                addChild.setEnabled(true);
                              }
                            });
                        panel.show();
                      }
                    });
              }
            }));

    container.add(table, new RowData(1d, 25));
    container.add(bar, new RowData(1d, 25));
    container.add(new HTML("Children to add to new taxon:"), new RowData(1d, 25));
    container.add(moveList, new RowData(1d, 1d));
    container.add(south, new RowData(1d, 25));

    return container;
  }
Exemple #19
0
 public static void setIcon(MenuItem menuItem, String iconName) {
   if (MENU_ICONS && menuItem != null && iconName != null && iconName.length() > 0) {
     menuItem.setIcon(getMenuIcon(iconName));
   }
 }
  public void onModuleLoad() {
    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);
          }
        };

    Window chesseWindows = createCheeseWindows();
    Window configuratorWindows = createConfiguratorWindows();

    Shortcut s1 = new Shortcut();
    s1.setText("3DappsTest");
    s1.setId("grid-win-shortcut");
    s1.setData("window", chesseWindows);
    s1.addSelectionListener(shortcutListener);
    desktop.addShortcut(s1);

    Shortcut s2 = new Shortcut();
    s2.setText("Zweiter Test 3D app");
    s2.setId("acc-win-shortcut");
    s2.setData("window", configuratorWindows);
    s2.addSelectionListener(shortcutListener);
    desktop.addShortcut(s2);

    TaskBar taskBar = desktop.getTaskBar();

    StartMenu menu = taskBar.getStartMenu();
    menu.setHeading("Charly TestUser");
    menu.setIconStyle("user");

    MenuItem menuItem = new MenuItem("3DappsTest");
    menuItem.setData("window", chesseWindows);
    menuItem.setIcon(IconHelper.createStyle("icon-grid"));
    menuItem.addSelectionListener(menuListener);
    menu.add(menuItem);

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

    menuItem = new MenuItem("Zweiter Test 3Dapp");
    menuItem.setIcon(IconHelper.createStyle("accordion"));
    menuItem.addSelectionListener(menuListener);
    menuItem.setData("window", configuratorWindows);
    menu.add(menuItem);

    menuItem = new MenuItem("Bogus Submenu");
    menuItem.setIcon(IconHelper.createStyle("bogus"));

    Menu sub = new Menu();

    for (int i = 0; i < 5; i++) {
      MenuItem item = new MenuItem("Bogus Window " + (i + 1));
      item.setData("window", createBogusWindow(i));
      item.addSelectionListener(menuListener);
      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);
  }
  public static Menu getLayerContextMenu() {
    if (layerContextMenu == null) {
      layerContextMenu = new Menu();
      // add zoom to max extent
      MenuItem zoomToMaxExtend = new MenuItem();
      zoomToMaxExtend.setText("Zoom to layer extend");
      zoomToMaxExtend.setIcon(LayerResources.ICONS.zoomToMaxExtend());
      zoomToMaxExtend.addSelectionListener(new ZoomToLayerExtentAction(treePanel));
      layerContextMenu.add(zoomToMaxExtend);

      MenuItem exportMenuItem = new MenuItem();
      exportMenuItem.setText("Export");
      exportMenuItem.setSubMenu(new GPExportMenu(treePanel));
      layerContextMenu.add(exportMenuItem);

      MenuItem cqlFilterMenuItem = new MenuItem();
      cqlFilterMenuItem.setText("CQL Filter");
      cqlFilterMenuItem.setSubMenu(new GPCQLFilterMenu(treePanel));
      layerContextMenu.add(cqlFilterMenuItem);

      MenuItem timeFilterMenuItem = new MenuItem();
      timeFilterMenuItem.setText("TIME Filter");
      timeFilterMenuItem.setSubMenu(new GPTimeFilterMenu(treePanel));
      layerContextMenu.add(timeFilterMenuItem);

      MenuItem layerProperties = new MenuItem();
      layerProperties.setText("Layer Properties");
      layerProperties.setIcon(LayerResources.ICONS.layerProperties());
      layerProperties.addSelectionListener(new ShowLayerPropertiesAction(treePanel));

      MenuItem copyMenuItem = new MenuItem("Copy Layer");
      copyMenuItem.setIcon(LayerResources.ICONS.copy());
      copyMenuItem.addSelectionListener(new CopyLayerAction(treePanel, pasteAction, pasteMenuItem));

      layerContextMenu.add(copyMenuItem);

      MenuItem createViewportLayerMenu = new MenuItem();
      createViewportLayerMenu.setText("Create Viewport");
      createViewportLayerMenu.setIcon(BasicWidgetResources.ICONS.viewport());
      createViewportLayerMenu.addSelectionListener(new CreateLayerViewportAction(treePanel));
      layerContextMenu.add(createViewportLayerMenu);

      // TODO ADD EditWFS dynamically
      EditWFSAction editFeatureAction = new EditWFSAction(treePanel);
      MenuItem editFeature = new MenuItem();
      editFeature.setText(editFeatureAction.getTitle());
      editFeature.setIcon(editFeatureAction.getImage());
      editFeature.addSelectionListener(editFeatureAction);
      layerContextMenu.add(editFeature);

      refreshTimeComboBox =
          new ComboBox() {
            @Override
            protected void onSelect(ModelData model, int index) {
              super.onSelect(model, index);
              refreshTimeComboBox.clearSelections();
              layerContextMenu.hide();
            }
          };
      refreshTimeComboBox.setEmptyText("Refresh Time");
      ListStore<LayerRefreshTimeValue> store = new ListStore<LayerRefreshTimeValue>();
      store.add(LayerRefreshTimeValue.getLayerRefreshTimeList());
      refreshTimeComboBox.setStore(store);
      refreshTimeComboBox.setEditable(Boolean.FALSE);
      refreshTimeComboBox.setForceSelection(Boolean.TRUE);
      refreshTimeComboBox.setTypeAhead(Boolean.FALSE);
      refreshTimeComboBox.setUseQueryCache(Boolean.FALSE);
      refreshTimeComboBox.setDisplayField(LayerRefreshTimeValue.REFRESH_TIME_KEY);
      //        refreshMenuItem.setIcon(LayerResources.ICONS.layerRefresh());
      refreshTimeComboBox.addSelectionChangedListener(new RefreshLayerAction(treePanel));
      layerContextMenu.add(refreshTimeComboBox);

      layerContextMenu.add(layerProperties);
    }
    return layerContextMenu;
  }