Package java.awt

Examples of java.awt.PopupMenu$AccessibleAWTPopupMenu


            .getDashBundle("ProcessDashboard.SysTray.Menu");


    public MenuHandler(ProcessDashboard pdash, TrayIcon icon,
            Reminder reminder) {
        this.popupMenu = new PopupMenu();
        icon.setPopupMenu(popupMenu);

        createSharedActions(pdash);

        JMenuBar configMenus = pdash.getConfigurationMenus();
View Full Code Here


  }

  private PopupMenu createPopupMenu(final ViewState state) {
    final String ACTIONS_POP_MENU_NAME = "Actions";
    final String VIEW_CONDITION_MAP = "View...";
    PopupMenu actionsMenu = new PopupMenu(ACTIONS_POP_MENU_NAME);
    actionsMenu.add(new MenuItem(VIEW_CONDITION_MAP));
    actionsMenu.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand().equals(VIEW_CONDITION_MAP)) {
          DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
              .getSelectionPath().getLastPathComponent();
          ModelGraph graphToFocus = null;
          if (Boolean.parseBoolean(state
              .getFirstPropertyValue(EXPAND_PRECONDITIONS))
              || Boolean.parseBoolean(state
                  .getFirstPropertyValue(EXPAND_POSTCONDITIONS))) {
            // if (node.getUserObject() instanceof String &&
            // (node.getUserObject().equals("pre-conditions") ||
            // node.getUserObject().equals("post-conditions"))) {
            ModelGraph graph = state.getSelected();
            if (Boolean.parseBoolean(state
                .getFirstPropertyValue(EXPAND_PRECONDITIONS)))
              graphToFocus = graph.getPreConditions();
            else
              graphToFocus = graph.getPostConditions();
          } else if (node.getUserObject() instanceof ModelGraph) {
            graphToFocus = (ModelGraph) node.getUserObject();
          }
          DefaultTreeView.this.notifyListeners(new ViewChange.NEW_VIEW(
              graphToFocus, DefaultTreeView.this));
        }
      }

    });

    final String ORDER_SUB_POP_MENU_NAME = "Order";
    final String TO_FRONT_ITEM_NAME = "Move To Front";
    final String TO_BACK_ITEM_NAME = "Move To Back";
    final String FORWARD_ITEM_NAME = "Move Forward";
    final String BACKWARDS_ITEM_NAME = "Move Backwards";
    actionsMenu.add(orderSubMenu = new PopupMenu(ORDER_SUB_POP_MENU_NAME));
    orderSubMenu.add(new MenuItem(TO_FRONT_ITEM_NAME));
    orderSubMenu.add(new MenuItem(TO_BACK_ITEM_NAME));
    orderSubMenu.add(new MenuItem(FORWARD_ITEM_NAME));
    orderSubMenu.add(new MenuItem(BACKWARDS_ITEM_NAME));
    orderSubMenu.addActionListener(new ActionListener() {
View Full Code Here

          }
          state.setSelected(mouseOverGraph);
        } else {
          state.setSelected(null);
        }
        PopupMenu actionsMenu = createActionMenu(state);
        GraphView.this.notifyListeners();
        GraphView.this.jgraph.add(actionsMenu);
        actionsMenu.show(GraphView.this.jgraph, e.getPoint().x, e.getPoint().y);
      } else if (e.getButton() == MouseEvent.BUTTON1) {
        if (state.getMode() == View.Mode.ZOOM_IN) {
          state.setProperty(SCALE, Double.toString(Double.parseDouble(state
              .getFirstPropertyValue(SCALE)) + 0.1));
          state.setSelected(null);
View Full Code Here

    }
  }


  private PopupMenu createActionMenu(final ViewState state) {
    PopupMenu actionsMenu = new PopupMenu(ACTIONS_POP_MENU_NAME);
    PopupMenu newSubMenu = new PopupMenu(NEW_SUB_POP_MENU_NAME);
    MenuItem taskItem = new MenuItem(NEW_TASK_ITEM_NAME);
    MenuItem condItem = new MenuItem(NEW_CONDITION_ITEM_NAME);
    newSubMenu.add(taskItem);
    newSubMenu.add(condItem);
    newSubMenu.add(new MenuItem(NEW_PARALLEL_ITEM_NAME));
    newSubMenu.add(new MenuItem(NEW_SEQUENTIAL_ITEM_NAME));
    newSubMenu.addActionListener(this.myGraphListener);
    actionsMenu.add(newSubMenu);
    MenuItem viewReferrencedWorkflow = new MenuItem(VIEW_REF_WORKFLOW);
    actionsMenu.add(viewReferrencedWorkflow);
    MenuItem deleteItem = new MenuItem(DELETE_ITEM_NAME);
    actionsMenu.add(deleteItem);
    MenuItem formatItem = new MenuItem(FORMAT_ITEM_NAME);
    actionsMenu.add(formatItem);

    PopupMenu orderSubMenu = new PopupMenu(ORDER_SUB_POP_MENU_NAME);

    ModelGraph modelGraph = state.getSelected();
    newSubMenu.setEnabled(modelGraph == null
        || modelGraph.getModel().isParentType());
    deleteItem.setEnabled(modelGraph != null);
    formatItem.setEnabled(true);
    if (modelGraph != null) {
      viewReferrencedWorkflow.setEnabled(modelGraph.getModel().isRef());
      taskItem.setEnabled(!modelGraph.isCondition());
      condItem.setEnabled(modelGraph.isCondition());
      orderSubMenu.setEnabled(modelGraph.getParent() != null
          && !(modelGraph.isCondition() && !modelGraph.getParent()
              .isCondition()));
    } else {
      boolean isCondition = false;
      if (state.getGraphs().size() > 0)
        isCondition = state.getGraphs().get(0).isCondition();
      viewReferrencedWorkflow.setEnabled(false);
      taskItem.setEnabled(!isCondition);
      condItem.setEnabled(isCondition);
    }

    actionsMenu.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand().equals(DELETE_ITEM_NAME)) {
          GuiUtils.removeNode(state.getGraphs(), state.getSelected().getModel());
          state.setSelected(null);
          GraphView.this.notifyListeners();
        } else if (e.getActionCommand().equals(FORMAT_ITEM_NAME)) {
          GraphView.this.refreshView(state);
        } else if (e.getActionCommand().equals(VIEW_REF_WORKFLOW)) {
          scrollSelectedToVisible = true;
          GraphView.this.notifyListeners(new ViewChange.VIEW_MODEL(state
              .getSelected().getModel().getModelId(), GraphView.this));
        }
      }
    });
    PopupMenu edgesSubMenu = new PopupMenu(EDGES_SUB_POP_MENU_NAME);
    edgesSubMenu.add(new MenuItem(TASK_LEVEL));
    edgesSubMenu.add(new MenuItem(WORKFLOW_LEVEL));
    actionsMenu.add(edgesSubMenu);
    edgesSubMenu.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand().equals(TASK_LEVEL)) {
          state.setProperty(EDGE_DISPLAY_MODE, TASK_MODE);
        } else if (e.getActionCommand().equals(WORKFLOW_LEVEL)) {
View Full Code Here

  public void attachServe(Method stop, String[] contextPath) {
    s = stop;
    if (SystemTray.isSupported() == false)
      return;
    SystemTray st = SystemTray.getSystemTray();
    PopupMenu popup = new PopupMenu();
    popup.setFont(new Font("Arial", Font.PLAIN, 12));
    //System.err.printf("%s%n", Arrays.toString(java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() .getAvailableFontFamilyNames()));
    MenuItem mi;
    if (Desktop.isDesktopSupported()) {
      for (String cp : contextPath) {
        popup.add(mi = new MenuItem(getResource("label_open") + cp));
        mi.setActionCommand("!" + cp);
        mi.addActionListener(this);
      }
    }
    popup.addSeparator();
    popup.add(mi = new MenuItem(getResource("label_stop")));
    mi.setActionCommand("stop");
    mi.addActionListener(this);
    popup.add(mi = new MenuItem(getResource("label_exit")));
    mi.setActionCommand("exit");
    mi.addActionListener(this);
    //java.net.URL u;
    // TODO icon can be customizable
    ti = new TrayIcon(Toolkit.getDefaultToolkit().getImage(
View Full Code Here

 
  // Create the popup menu for each Tray Icon (on right mouse click)
  public PopupMenu makeMenu()
  {
    // Make new popup menu
    PopupMenu menu = new PopupMenu();
    MenuItem item;
    Menu subMenu = new Menu(I18N.gettext("main.main.jetimenu.Account"));
    item = new MenuItem(I18N.gettext("main.main.jetimenu.Login")+"...");
    item.addActionListener(new java.awt.event.ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        LoginWindow.createLoginWindow(backend);
      }
    });
    subMenu.add(item);
    item = new MenuItem(I18N.gettext("main.main.jetimenu.Manage_Services")+"...");
    item.addActionListener(new java.awt.event.ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        //new RegisterServices(backend.getRegisterServices(),backend).show();
        new RegisterServices(backend).setVisible(true);
      }
    });
    subMenu.add(item);


    menu.add(subMenu);
    subMenu = new Menu(I18N.gettext("systemtray.Status"));
    item = new MenuItem(I18N.gettext("main.main.statusmenu.Change_message"));
    item.addActionListener(new java.awt.event.ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        String message = JOptionPane.showInputDialog(backend.getMainWindow(),I18N.gettext("main.main.statusmenu.Status_message"));
        if (message == null) return;
        StatusButton.changeStatus(status,message);
      }
    });
    subMenu.add(item);
 
    subMenu.add(statusMenu(Presence.FREE_FOR_CHAT));
    subMenu.add(statusMenu(Presence.AVAILABLE));
    subMenu.add(statusMenu(Presence.DND));
    subMenu.add(statusMenu(Presence.AWAY));
    subMenu.add(statusMenu(Presence.XA));

   
    item = new MenuItem(I18N.gettext("main.main.presencebutton.Invisible"));
    item.addActionListener(new java.awt.event.ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        StatusButton.changeStatus(Presence.INVISIBLE,null);
      }
    });
    subMenu.add(item);
    menu.add(subMenu);

    // Add exit item
    item = new MenuItem(I18N.gettext("main.main.jetimenu.Exit"));
    item.addActionListener(new java.awt.event.ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        backend.getMain().close();
      }
    });
    menu.add(item);
    return menu;
  }
View Full Code Here

        tray = SystemTray.getSystemTray();

        Imagem icone = new Imagem();
        Image icon = icone.getIcone();

        PopupMenu menu = new PopupMenu();

        MenuItem itemAbrir = new MenuItem("Abrir");
        itemAbrir.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                GerenciadorOperacional.setVisibleFramePrincipal(true);
            }
        });

        MenuItem itemSair = new MenuItem("Sair");
       
        itemSair.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                GerenciadorOperacional.encerrarPrograma();
            }
        });

        menu.add(itemAbrir);
        menu.addSeparator();
        menu.add(itemSair);

        trayIcon = new TrayIcon(icon, "Tooltip", menu);

        try {
            tray.add(trayIcon);
View Full Code Here

            SystemTray tray = SystemTray.getSystemTray();
            //Se construye la imagen que se va a usar
            ImageIcon imagen1 = new ImageIcon(getClass().getResource("/images/travel-logo.png").getFile());
            Image imagen = imagen1.getImage();
            //El popup que despliega nuestra app
            PopupMenu popup = new PopupMenu();
            //Se agregan los items a nuestra app
            MenuItem item1 = new MenuItem("Exit");
            MenuItem item2 = new MenuItem("Acerca de...");
            MenuItem item3 = new MenuItem("Ayuda");
            //Añadimos los items al popup
            popup.add(item3);
            popup.addSeparator();
            popup.add(item2);
            popup.addSeparator();
            popup.add(item1);
            //Agragamos los eventos
            item1.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
View Full Code Here

        if(parentFrame != null) {
          parentFrame.dispose();
        }
      }
    };
    popup = new PopupMenu();
    final MenuItem exitItem = new MenuItem("Exit");
    exitItem.addActionListener(exitJalk);
    popup.add(exitItem);

    // construct the TrayIcon
View Full Code Here

        tray = SystemTray.getSystemTray();

        Imagem icone = new Imagem();
        Image icon = icone.getIcone();

        PopupMenu menu = new PopupMenu();

        MenuItem itemOpcoes = new MenuItem("Opções");
        itemOpcoes.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JOptionPane.showMessageDialog(null, "Ainda nada", "Opções", JOptionPane.INFORMATION_MESSAGE);
            }
        });

        MenuItem itemSair = new MenuItem("Sair");
       
        itemSair.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                GerenciadorOperacional.encerrar();
            }
        });

        menu.add(itemOpcoes);
        menu.addSeparator();
        menu.add(itemSair);

        trayIcon = new TrayIcon(icon, "Tooltip", menu);

        try {
            tray.add(trayIcon);
View Full Code Here

TOP

Related Classes of java.awt.PopupMenu$AccessibleAWTPopupMenu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.