Search in sources :

Example 66 with JSeparator

use of javax.swing.JSeparator in project vcell by virtualcell.

the class CSGObjectPropertiesPanel method showPopupMenu.

private void showPopupMenu(MouseEvent e) {
    if (!e.isPopupTrigger()) {
        return;
    }
    if (popupMenu == null) {
        popupMenu = new JPopupMenu();
    }
    if (popupMenu.isShowing()) {
        return;
    }
    selectClickPath(e);
    TreePath[] selectedPaths = csgObjectTree.getSelectionPaths();
    boolean bShowPopup = true;
    boolean bTransform = false;
    boolean bApplySetOperator = false;
    boolean bAddPrimitive = false;
    boolean bAddTransformation = false;
    boolean bAddOperator = false;
    boolean bEdit = false;
    boolean bDelete = true;
    if (selectedPaths == null) {
        return;
    }
    for (TreePath tp : selectedPaths) {
        Object obj = tp.getLastPathComponent();
        if (obj == null || !(obj instanceof BioModelNode)) {
            continue;
        }
        BioModelNode selectedNode = (BioModelNode) obj;
        Object userObject = selectedNode.getUserObject();
        if (userObject == csgObject) {
            bDelete = false;
            if (csgObject.getRoot() == null) {
                bAddPrimitive = true;
                bAddOperator = true;
                bAddTransformation = true;
            }
        } else if (userObject instanceof CSGPrimitive) {
            bApplySetOperator = true;
            bTransform = true;
            bAddPrimitive = false;
            bAddOperator = false;
            bAddTransformation = false;
        } else if (userObject instanceof CSGSetOperator) {
            bApplySetOperator = true;
            bTransform = true;
            bAddPrimitive = true;
            bAddOperator = true;
            bAddTransformation = true;
        } else if (userObject instanceof CSGTransformation) {
            bApplySetOperator = true;
            bTransform = true;
            bEdit = true;
            if (((CSGTransformation) userObject).getChild() == null) {
                bAddPrimitive = true;
                bAddOperator = true;
                bAddTransformation = true;
            }
        }
    }
    if (bShowPopup) {
        popupMenu.removeAll();
        if (bAddPrimitive || bAddTransformation || bAddOperator) {
            getAddPrimitiveMenu().setEnabled(bAddPrimitive);
            getAddTransformationMenu().setEnabled(bAddTransformation);
            getAddSetOperatorMenu().setEnabled(bAddOperator);
            popupMenu.add(getAddMenu());
        }
        if (popupMenu.getComponents().length > 0) {
            popupMenu.add(new JSeparator());
        }
        // everything can be renamed
        popupMenu.add(getRenameMenuItem());
        if (bEdit) {
            popupMenu.add(getEditMenuItem());
        }
        if (bDelete) {
            popupMenu.add(getDeleteMenuItem());
        }
        if (bTransform) {
            if (popupMenu.getComponents().length > 0) {
                popupMenu.add(new JSeparator());
            }
            popupMenu.add(getTransformMenu());
        }
        if (bApplySetOperator) {
            if (popupMenu.getComponents().length > 0 && !bTransform) {
                popupMenu.add(new JSeparator());
            }
            popupMenu.add(getApplySetOperatorMenu());
        }
        Point mousePoint = e.getPoint();
        popupMenu.show(csgObjectTree, mousePoint.x, mousePoint.y);
    }
}
Also used : TreePath(javax.swing.tree.TreePath) CSGTransformation(cbit.vcell.geometry.CSGTransformation) CSGPrimitive(cbit.vcell.geometry.CSGPrimitive) CSGObject(cbit.vcell.geometry.CSGObject) BioModelNode(cbit.vcell.desktop.BioModelNode) Point(java.awt.Point) CSGSetOperator(cbit.vcell.geometry.CSGSetOperator) JPopupMenu(javax.swing.JPopupMenu) JSeparator(javax.swing.JSeparator)

Example 67 with JSeparator

use of javax.swing.JSeparator in project vcell by virtualcell.

the class CartoonTool method popupMenu.

protected final void popupMenu(Shape shape, int x, int y) throws Exception {
    if (getGraphPane() == null) {
        return;
    }
    if (shape != null) {
        List<JMenuItem> currentMenuList = new ArrayList<JMenuItem>();
        // Add stuff to menu based on state of cartoons
        for (JMenuItem menuItem : menuItems) {
            if (menuItem instanceof JMenu) {
                // accommodate the
                // image-submenu
                boolean menuNeeded = false;
                for (int k = 0; k < ((JMenu) menuItem).getItemCount(); k++) {
                    JMenuItem subMenuItem = ((JMenu) menuItem).getItem(k);
                    if (shapeHasMenuAction(shape, subMenuItem.getActionCommand())) {
                        boolean actionEnabled = shapeHasMenuActionEnabled(shape, subMenuItem.getActionCommand());
                        subMenuItem.setEnabled(actionEnabled);
                        if (!menuNeeded) {
                            menuNeeded = true;
                        }
                    }
                }
                if (menuNeeded) {
                    menuItem.setEnabled(true);
                    currentMenuList.add(menuItem);
                }
                continue;
            }
            if (shapeHasMenuAction(shape, menuItem.getActionCommand())) {
                currentMenuList.add(menuItem);
                menuItem.setEnabled(shapeHasMenuActionEnabled(shape, menuItem.getActionCommand()));
            }
        }
        List<JMenuItem> editV = new ArrayList<JMenuItem>();
        JPopupMenu popupMenu = new javax.swing.JPopupMenu();
        popupMenu.setName("CartoonToolJPopupMenu");
        for (int i = 0; i < currentMenuList.size(); i += 1) {
            JMenuItem addableJMenuItem = currentMenuList.get(i);
            if (miscMenuItems.contains(addableJMenuItem) || addableJMenuItem == saveAsImageMenu || paintingMenuItems.contains(addableJMenuItem) || groupMenuItems.contains(addableJMenuItem)) {
                popupMenu.add(addableJMenuItem);
            } else if (editMenuItems.contains(addableJMenuItem)) {
                editV.add(addableJMenuItem);
            } else {
                throw new RuntimeException("Unknown JMenuItem=" + addableJMenuItem.toString());
            }
        }
        // 
        if (editV.size() > 0) {
            for (int i = 0; i < editV.size(); i += 1) {
                popupMenu.add(editV.get(i), i);
            }
            popupMenu.add(new JSeparator(), editV.size());
        }
        if (popupMenu != null && (popupMenu.getComponentCount() > 0)) {
            popupMenu.show(getGraphPane(), x, y);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) Point(java.awt.Point) JPopupMenu(javax.swing.JPopupMenu) JSeparator(javax.swing.JSeparator)

Example 68 with JSeparator

use of javax.swing.JSeparator in project vcell by virtualcell.

the class DocumentWindow method getToolMenu.

/**
 * Return the tool menu.
 * @return javax.swing.JMenu
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JMenu getToolMenu() {
    if (toolMenu == null) {
        try {
            toolMenu = new javax.swing.JMenu();
            toolMenu.setName("ToolMenu");
            toolMenu.setText("Tools");
            // toolMenu.add(getRunBNGMenuItem());
            toolMenu.add(new JSeparator());
            toolMenu.add(getRunVFrapItem());
            toolMenu.add(new JSeparator());
            toolMenu.add(getRunVCellVisItItem());
            toolMenu.add(new JSeparator());
            toolMenu.add(getTransMAMenuItem());
            toolMenu.add(getViewJobsMenuItem());
        } catch (Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return toolMenu;
}
Also used : JMenu(javax.swing.JMenu) JSeparator(javax.swing.JSeparator)

Example 69 with JSeparator

use of javax.swing.JSeparator in project vcell by virtualcell.

the class DocumentWindow method getFileMenu.

/**
 * Return the FileMenu property value.
 * @return javax.swing.JMenu
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private javax.swing.JMenu getFileMenu() {
    if (ivjFileMenu == null) {
        try {
            ivjFileMenu = new javax.swing.JMenu();
            ivjFileMenu.setName("FileMenu");
            ivjFileMenu.setText("File");
            ivjFileMenu.add(getNewMenuItem());
            ivjFileMenu.add(getOpenMenuItem());
            // ivjFileMenu.add(recentMenuItem); gcw pending
            ivjFileMenu.add(getCloseMenuItem());
            ivjFileMenu.add(new JSeparator());
            ivjFileMenu.add(getSaveMenuItem());
            ivjFileMenu.add(getSave_VersionMenuItem());
            ivjFileMenu.add(getSave_AsMenuItem());
            ivjFileMenu.add(getSave_AsLocalMenuItem());
            ivjFileMenu.add(new JSeparator());
            ivjFileMenu.add(getJMenuItemRevert());
            ivjFileMenu.add(getJMenuItemCompare());
            ivjFileMenu.add(new JSeparator());
            ivjFileMenu.add(getPermissionsMenuItem());
            ivjFileMenu.add(getJMenuItemMIRIAM());
            ivjFileMenu.add(getJMenuItemPreferences());
            ivjFileMenu.add(getEdit_Annotation_JMenuItem());
            ivjFileMenu.add(new JSeparator());
            ivjFileMenu.add(getJMenuItemFieldData());
            ivjFileMenu.add(getTestingFrameworkMenuItem());
            ivjFileMenu.add(new JSeparator());
            ivjFileMenu.add(getJMenuItemImport());
            ivjFileMenu.add(getJMenuItemExport());
            ivjFileMenu.add(new JSeparator());
            // ivjFileMenu.add(getJMenuImportPathway());
            ivjFileMenu.add(new JSeparator());
            ivjFileMenu.add(getExitMenuItem());
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    return ivjFileMenu;
}
Also used : JMenu(javax.swing.JMenu) JSeparator(javax.swing.JSeparator)

Example 70 with JSeparator

use of javax.swing.JSeparator in project vcell by virtualcell.

the class MicroscopeMeasurementPanel method createFluorescentSpeciesPanel.

private JPanel createFluorescentSpeciesPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    int gridy = 0;
    JLabel label = new JLabel("Choose Fluorescent Species");
    Font boldFont = label.getFont().deriveFont(Font.BOLD);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setFont(boldFont);
    JPanel p = new JPanel();
    p.setBackground(ItemBackgroundColor);
    p.add(label);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(p, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    panel.add(new JSeparator(), gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(4, 10, 4, 4);
    gbc.weightx = 1;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    JScrollPane scrollPane1 = new JScrollPane(allSpeciesContextList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane1.setPreferredSize(new Dimension(200, 200));
    panel.add(scrollPane1, gbc);
    JPanel buttonPanel = new JPanel(new GridLayout(2, 1, 0, 10));
    buttonPanel.add(addButton);
    buttonPanel.add(removeButton);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.insets = new Insets(4, 4, 4, 4);
    panel.add(buttonPanel, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = gridy;
    gbc.insets = new Insets(4, 4, 4, 10);
    gbc.weightx = 1;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    JScrollPane scrollPane2 = new JScrollPane(fluorescentSpeciesContextList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane2.setPreferredSize(scrollPane1.getPreferredSize());
    panel.add(scrollPane2, gbc);
    panel.setBorder(GuiConstants.TAB_PANEL_BORDER);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font) JSeparator(javax.swing.JSeparator)

Aggregations

JSeparator (javax.swing.JSeparator)147 JPanel (javax.swing.JPanel)74 JLabel (javax.swing.JLabel)65 ActionEvent (java.awt.event.ActionEvent)44 BoxLayout (javax.swing.BoxLayout)44 JButton (javax.swing.JButton)44 JMenuItem (javax.swing.JMenuItem)38 JMenu (javax.swing.JMenu)32 GridBagConstraints (java.awt.GridBagConstraints)31 Insets (java.awt.Insets)30 ActionListener (java.awt.event.ActionListener)30 Dimension (java.awt.Dimension)24 FlowLayout (java.awt.FlowLayout)24 JScrollPane (javax.swing.JScrollPane)24 GridBagLayout (java.awt.GridBagLayout)22 JPopupMenu (javax.swing.JPopupMenu)19 BorderLayout (java.awt.BorderLayout)16 JTextField (javax.swing.JTextField)16 JCheckBox (javax.swing.JCheckBox)13 AbstractAction (javax.swing.AbstractAction)12