Package java.awt

Examples of java.awt.PopupMenu$AccessibleAWTPopupMenu


    Vector closestConnections =
      BeanConnection.getClosestConnections(new Point(x, y),
          10, m_mainKFPerspective.getCurrentTabIndex());

    PopupMenu rightClickMenu = new PopupMenu();
    int menuItemCount = 0;
    if (m_mainKFPerspective.getSelectedBeans().size() > 0 ||
        closestConnections.size() > 0 ||
        (m_pasteBuffer != null && m_pasteBuffer.length() > 0)) {

      if (m_mainKFPerspective.getSelectedBeans().size() > 0) {

        MenuItem snapItem = new MenuItem("Snap selected to grid");
        snapItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            snapSelectedToGrid();
          }
        });
        rightClickMenu.add(snapItem);
        menuItemCount++;

        MenuItem copyItem = new MenuItem("Copy selected");
        copyItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            copyToClipboard();
            m_mainKFPerspective.setSelectedBeans(new Vector());
          }
        });
        rightClickMenu.add(copyItem);
        menuItemCount++;

        MenuItem cutItem = new MenuItem("Cut selected");
        cutItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // only delete if our copy was successful!
            if (copyToClipboard()) {             
              deleteSelectedBeans();
            }
          }
        });
        rightClickMenu.add(cutItem);
        menuItemCount++;

        MenuItem deleteSelected = new MenuItem("Delete selected");
        deleteSelected.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            deleteSelectedBeans();
          }
        });
        rightClickMenu.add(deleteSelected);
        menuItemCount++;

        // Able to group selected subflow?
        boolean groupable = true;
        final Vector selected = m_mainKFPerspective.getSelectedBeans();
        // check if sub flow is valid
        final Vector inputs = BeanConnection.inputs(selected,
            m_mainKFPerspective.getCurrentTabIndex());
        final Vector outputs = BeanConnection.outputs(selected,
            m_mainKFPerspective.getCurrentTabIndex());

        // screen the inputs and outputs
        if (inputs.size() == 0 || outputs.size() == 0) {
          groupable = false;
        }

        // dissallow MetaBeans in the selected set (for the
        // time being).
        if (groupable) {
          for (int i = 0; i < selected.size(); i++) {
            BeanInstance temp = (BeanInstance)selected.elementAt(i);
            if (temp.getBean() instanceof MetaBean) {
              groupable = false;
              break;
            }
          }
        }

        if (groupable) {
          // show connector dots for input beans
          for (int i = 0; i < inputs.size(); i++) {
            BeanInstance temp = (BeanInstance)inputs.elementAt(i);
            if (temp.getBean() instanceof Visible) {
              ((Visible)temp.getBean()).getVisual().
              setDisplayConnectors(true, java.awt.Color.red);
            }
          }

          // show connector dots for output beans
          for (int i = 0; i < outputs.size(); i++) {
            BeanInstance temp = (BeanInstance)outputs.elementAt(i);
            if (temp.getBean() instanceof Visible) {
              ((Visible)temp.getBean()).getVisual().
              setDisplayConnectors(true, java.awt.Color.green);
            }
          }

          MenuItem groupItem = new MenuItem("Group selected");
          groupItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              groupSubFlow(selected, inputs, outputs);
            }
          });
          rightClickMenu.add(groupItem);
          menuItemCount++;
        }                       
      }     

      if (m_pasteBuffer != null && m_pasteBuffer.length() > 0) {
        rightClickMenu.addSeparator();
        menuItemCount++;

        MenuItem pasteItem = new MenuItem("Paste");
        pasteItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // deserialize, integerate and
            // position at x, y

            pasteFromClipboard(x, y, m_pasteBuffer, true);
          }       
        });
        rightClickMenu.add(pasteItem);
        menuItemCount++;
      }


      if (closestConnections.size() > 0) {
        rightClickMenu.addSeparator();
        menuItemCount++;

        MenuItem deleteConnection = new MenuItem("Delete Connection:");
        deleteConnection.setEnabled(false);
        rightClickMenu.insert(deleteConnection, menuItemCount);
        menuItemCount++;

        for (int i = 0; i < closestConnections.size(); i++) {
          final BeanConnection bc = (BeanConnection) closestConnections.elementAt(i);
          String connName = bc.getSourceEventSetDescriptor().getName();

          //JMenuItem deleteItem = new JMenuItem(connName);
          String targetName = "";
          if (bc.getTarget().getBean() instanceof BeanCommon) {
            targetName = ((BeanCommon)bc.getTarget().getBean()).getCustomName();
          } else {
            targetName = bc.getTarget().getBean().getClass().getName();
            targetName = targetName.substring(targetName.lastIndexOf('.')+1, targetName.length());
          }
          MenuItem deleteItem = new MenuItem(connName + "-->" + targetName);
          deleteItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              addUndoPoint();

              bc.remove(m_mainKFPerspective.getCurrentTabIndex());
              m_beanLayout.revalidate();
              m_beanLayout.repaint();
              m_mainKFPerspective.setEditedStatus(true);
              if (m_mainKFPerspective.getSelectedBeans().size() > 0) {
                m_mainKFPerspective.setSelectedBeans(new Vector());
              }               
              notifyIsDirty();
            }
          });
          rightClickMenu.add(deleteItem);
          menuItemCount++;
        }
      }           
    }

    if (menuItemCount > 0) {
      rightClickMenu.addSeparator();
      menuItemCount++;
    }

    MenuItem noteItem = new MenuItem("New note");
    noteItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {

        Note n = new Note();
        m_toolBarBean = n;

        KnowledgeFlowApp.this.setCursor(Cursor.
            getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
        m_mode = ADDING;
      }
    });
    rightClickMenu.add(noteItem);
    menuItemCount++;

    m_beanLayout.add(rightClickMenu);
    rightClickMenu.show(m_beanLayout, x, y);
  }
View Full Code Here


    if (closestConnections.size() > 0) {
      int menuItemCount = 0;

      // modifications by Zerbetto
      //JPopupMenu deleteConnectionMenu = new JPopupMenu();
      PopupMenu deleteConnectionMenu = new PopupMenu();

      //      deleteConnectionMenu.insert(new JLabel("Delete Connection",
      //               SwingConstants.CENTER),
      //          menuItemCount);
      MenuItem deleteConnection = new MenuItem("Delete Connection:");
      deleteConnection.setEnabled(false);
      deleteConnectionMenu.insert(deleteConnection, menuItemCount);
      menuItemCount++;

      for (int i = 0; i < closestConnections.size(); i++) {
        final BeanConnection bc = (BeanConnection) closestConnections.elementAt(i);
        String connName = bc.getSourceEventSetDescriptor().getName();

        //JMenuItem deleteItem = new JMenuItem(connName);
        String targetName = "";
        if (bc.getTarget().getBean() instanceof BeanCommon) {
          targetName = ((BeanCommon)bc.getTarget().getBean()).getCustomName();
        } else {
          targetName = bc.getTarget().getBean().getClass().getName();
          targetName = targetName.substring(targetName.lastIndexOf('.')+1, targetName.length());
        }
        MenuItem deleteItem = new MenuItem(connName + "-->" + targetName);
        deleteItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            bc.remove(m_mainKFPerspective.getCurrentTabIndex());
            m_beanLayout.revalidate();
            m_beanLayout.repaint();
            m_mainKFPerspective.setEditedStatus(true);
            notifyIsDirty();
          }
        });
        deleteConnectionMenu.add(deleteItem);
        menuItemCount++;
      }

      //deleteConnectionMenu.show(m_beanLayout, x, y);
      m_beanLayout.add(deleteConnectionMenu);
      deleteConnectionMenu.show(m_beanLayout, x, y);
    }
  }
View Full Code Here

  /**
   * @author : aniruddha<br>
   * @date : Aug 31, 2006, 3:16:55 PM<br>
   */
  private void builtPopupMenus() {
    m_menuMonth = new PopupMenu();

    for (int l_iCounter = 0; l_iCounter < m_menuMonths.length; l_iCounter++) {
      m_menuMonths[l_iCounter] = new MenuItem(m_strMonths[l_iCounter]);
      m_menuMonths[l_iCounter].addActionListener(this);
      m_menuMonth.add(m_menuMonths[l_iCounter]);
View Full Code Here

    if (LoginHandler.getDefault().performLogin() == false)
      System.exit(0);
   
    final JFrame frm = new JFrame("Dot Project Desktop Client");

    PopupMenu popup = new PopupMenu();
    MenuItem openItem = new MenuItem("Open");
    MenuItem exitItem = new MenuItem("Exit");
    popup.add(openItem);
    popup.add(exitItem);

    final TrayIcon trayIcon = new TrayIcon(IconHelper.getProductLogoImage(), "double click here to open Dot Project Client", popup);
    final SystemTray tray = SystemTray.getSystemTray();
    trayIcon.setImageAutoSize(true);
View Full Code Here

          System.exit(0);
      }
    };

   
    PopupMenu popup = new PopupMenu();
    showHide = new MenuItem("Show Member List");
    showHide.addActionListener(listener);
    popup.add(showHide);
       
    openForum = new MenuItem("Open Forum");
    openForum.addActionListener(listener);
    popup.add(openForum);
   
    joinChat = new MenuItem("Join Chat");
    joinChat.addActionListener(listener);
    popup.add(joinChat);
   
    joinVent = new MenuItem("Join Vent");
    joinVent.addActionListener(listener);
    popup.add(joinVent);

    MenuItem item = new MenuItem("Configuration...");
    item.addActionListener(listener);
    popup.add(item);
    popup.addSeparator();
    item = new MenuItem("Exit Harlequin");
    item.addActionListener(listener);
    popup.add(item);

    baseimage = Images.getImage("/images/harlequin.png");
    trayicon = new TrayIcon(baseimage, Configuration.properties.getProperty("client.title"),
        popup);
View Full Code Here

      return;
    }

    Image image = Toolkit.getDefaultToolkit().getImage("tray.gif");

    PopupMenu pm = new PopupMenu();
    {
      MenuItem mi = new MenuItem("BNU-Bot " + CurrentVersion.version().toString());
      mi.setEnabled(false);
      pm.add(mi);

      pm.addSeparator();

      mi = new MenuItem("Hide/show");
      mi.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          setVisible(!isVisible());
          if(isVisible())
            toFront();
        }
      });
      pm.add(mi);

      mi = new MenuItem("Exit");
      mi.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          System.exit(0);
        }
      });
      pm.add(mi);
    }

    tray = new TrayIcon(image);
    tray.setPopupMenu(pm);
    if(OperatingSystem.userOS != OperatingSystem.OSX)
View Full Code Here

        MenuItem close_mi = new MenuItem("close");
        close_mi.addActionListener(close);
        window.add(close_mi);

        //popup menu
        final PopupMenu p_window = new PopupMenu("Window");
        MenuItem p_show_mi = new MenuItem("show");
        p_show_mi.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.setVisible(true);
            }
        });
        p_window.add(p_show_mi);
        MenuItem p_hide_mi = new MenuItem("hide");
        p_hide_mi.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.setVisible(false);
            }
        });
        p_window.add(p_hide_mi);
        MenuItem p_back_mi = new MenuItem("back");
        p_back_mi.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.toBack();
            }
        });
        p_window.add(p_back_mi);
        MenuItem p_front_mi = new MenuItem("front");
        p_front_mi.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                f2.toFront();
            }
        });
        p_window.add(p_front_mi);
        p_window.addSeparator();
        MenuItem p_close_mi = new MenuItem("close");
        p_close_mi.addActionListener(close);
        p_window.add(p_close_mi);

        f.add(p_window);
        f.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent event) {
                p_window.show(f, event.getX(), event.getY());
            }
        });

        f.setMenuBar(mb);
        f.validate();
View Full Code Here

                Menu m = new Menu("Menu " + (menuList.size() + 1));
                menuList.add(m);
                mb.add(m);
            }
        });
        final PopupMenu popup = new PopupMenu("Popup");
        f.add(popup);
        f.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent event) {
                if (event.isPopupTrigger()) {
                    popup.show(f, event.getX(), event.getY());
                }
            }
        });
        f.add(addMenu, BorderLayout.NORTH);
        Button addItem = new Button("Add item");
        addItem.addActionListener(new ActionListener() {
            int cnt = 1;

            public void actionPerformed(ActionEvent event) {
                for (Menu m : menuList) {
                    m.add(new MenuItem("Item " + cnt));
                }
                popup.add(new MenuItem("Item " + cnt));
                cnt++;
            }
        });
        f.add(addItem, BorderLayout.WEST);
        Button addSeparator = new Button("Add separator");
        addSeparator.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                for (Menu m : menuList) {
                    m.addSeparator();
                }
                popup.addSeparator();
            }
        });
        f.add(addSeparator, BorderLayout.EAST);
        Button removeItem = new Button("Remove item");
        removeItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                for (Menu m : menuList) {
                    if (m.getItemCount() > 0)
                        m.remove(0);
                }
                if (popup.getItemCount() > 0)
                    popup.remove(0);
            }
        });
        f.add(removeItem, BorderLayout.SOUTH);
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent event) {
View Full Code Here

   Menu f5 = new Menu();
   harness.check(f5.getName(), "menu3");
   harness.check(f4.getName(), "menu4");
   harness.check(f3.getName(), "menu5");
   
   PopupMenu g0 = new PopupMenu();
   PopupMenu g1 = new PopupMenu();
   PopupMenu g2 = new PopupMenu();
   harness.check(g0.getName(), "popup0");
   harness.check(g1.getName(), "popup1");
   harness.check(g2.getName(), "popup2");
   PopupMenu g3 = new PopupMenu();
   PopupMenu g4 = new PopupMenu();
   PopupMenu g5 = new PopupMenu();
   harness.check(g5.getName(), "popup3");
   harness.check(g4.getName(), "popup4");
   harness.check(g3.getName(), "popup5");
  
   ScrollPane h0 = new ScrollPane();
   ScrollPane h1 = new ScrollPane();
View Full Code Here

   * @return PopupMenu
   */
  private PopupMenu createTrayPopup() {
   
   
    PopupMenu trayPopup = new PopupMenu();

    // About
    MenuItem aboutItem = new MenuItem("About");
    aboutItem.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        showAbout();
      }
     
    });
    trayPopup.add(aboutItem);
   
    trayPopup.addSeparator();
   
    // Shutdown
    MenuItem shutdownItem = new MenuItem("Shutdown");
    shutdownItem.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        doShutdownCluster();
      }
     
    });
    trayPopup.add(shutdownItem);
   
    return trayPopup;
  }
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.