Beispiel #1
0
    @Override
    public void actionPerformed(ActionEvent evt) {
      JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
      boolean curState = menuItem.isSelected();

      TreePath path = resultTree.getSelectionPath();
      DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();

      HyperSearchOperationNode operNodeObj = (HyperSearchOperationNode) operNode.getUserObject();
      if (curState) operNodeObj.cacheResultNodes(operNode);
      operNode.removeAllChildren();
      if (curState) {
        Exception excp = null;
        try {
          operNodeObj.insertTreeNodes(resultTree, operNode);
        } catch (Exception ex) {
          operNodeObj.restoreFlatNodes(resultTree, operNode);
          menuItem.setSelected(false);
          excp = ex;
        } finally {
          ((DefaultTreeModel) resultTree.getModel()).nodeStructureChanged(operNode);
          expandAllNodes(operNode);
          resultTree.scrollPathToVisible(new TreePath(operNode.getPath()));
        }
        if (excp != null) throw new RuntimeException(excp);
      } else operNodeObj.restoreFlatNodes(resultTree, operNode);

      operNodeObj.setTreeViewDisplayed(menuItem.isSelected());
    }
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == exitItem) {
     kbc.stopLoop();
     setVisible(false);
     dispose();
   } else if (e.getSource() == saveItem) {
     saveImage();
   } else if (e.getSource() == sleepItem1) {
     setDelay(1);
   } else if (e.getSource() == sleepItem2) {
     setDelay(2);
   } else if (e.getSource() == sleepItem5) {
     setDelay(5);
   } else if (e.getSource() == sleepItem10) {
     setDelay(10);
   } else if (e.getSource() instanceof JCheckBoxMenuItem) {
     JCheckBoxMenuItem jmi = (JCheckBoxMenuItem) e.getSource();
     String stat = jmi.getText();
     if (jmi.isSelected()) {
       kbc.addStatistic(stat);
     } else {
       kbc.removeStatistic(stat);
     }
   }
 }
Beispiel #3
0
 private void setListeners() {
   // Regular items
   openItem.addActionListener(controller);
   exitItem.addActionListener(controller);
   connectItem.addActionListener(controller);
   disconnectItem.addActionListener(controller);
   reconnectItem.addActionListener(controller);
   resetItem.addActionListener(controller);
   // Checkboxes
   perspectiveItem.addActionListener(controller);
   sideViewitem.addActionListener(controller);
   topViewItem.addActionListener(controller);
   showGridItem.addActionListener(controller);
   // Radios
   layoutItem1.addActionListener(controller);
   layoutItem2.addActionListener(controller);
   layoutItem3.addActionListener(controller);
   layoutItem4.addActionListener(controller);
   // And more regular items
   settingsItem.addActionListener(controller);
   modeItem1.addActionListener(controller);
   modeItem2.addActionListener(controller);
   helpItem.addActionListener(controller);
   aboutItem.addActionListener(controller);
 }
Beispiel #4
0
 public void updateMidiInMenuOptions(String[] midiInOptions) {
   midiInMenu.removeAll();
   pageChangeMidiInMenu.removeAll();
   for (int i = 0; i < midiInOptions.length; i++) {
     midiInMenu.remove(getNoInputDevicesEnabledItem());
     pageChangeMidiInMenu.remove(getNoInputDevicesEnabledItem2());
     JCheckBoxMenuItem cbMenuItem = new JCheckBoxMenuItem("MIDI Input: " + midiInOptions[i]);
     JCheckBoxMenuItem cbMenuItem2 = new JCheckBoxMenuItem("MIDI Input: " + midiInOptions[i]);
     cbMenuItem.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             String[] pieces = e.getActionCommand().split("MIDI Input: ");
             actionToggleMidiInput(pieces[1]);
           }
         });
     cbMenuItem2.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             String[] pieces = e.getActionCommand().split("MIDI Input: ");
             actionTogglePageChangeMidiInput(pieces[1]);
           }
         });
     midiInMenu.add(cbMenuItem);
     pageChangeMidiInMenu.add(cbMenuItem2);
   }
   if (midiInMenu.getItemCount() == 0) {
     midiInMenu.add(getNoInputDevicesEnabledItem());
     pageChangeMidiInMenu.add(getNoInputDevicesEnabledItem2());
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see com.coolsql.system.menubuild.IMenuLoadListener#action(javax.swing.JMenuItem)
   */
  public void action(final JMenuItem item) {
    if (item instanceof JCheckBoxMenuItem) {
      boolean isDisplay =
          Setting.getInstance()
              .getBoolProperty(PropertyConstant.PROPERTY_VIEW_SQLEDITOR_ISDISPLAY, true);
      if (!isDisplay) ViewManage.getInstance().getSqlEditor().hidePanel(false);
      final JCheckBoxMenuItem m = (JCheckBoxMenuItem) item;
      m.setSelected(isDisplay);

      ViewManage.getInstance()
          .getSqlEditor()
          .addPropertyChangeListener(
              new PropertyChangeListener() {

                public void propertyChange(PropertyChangeEvent evt) {
                  if (View.PROPERTY_HIDDEN.equals(evt.getPropertyName())) {
                    Object ob = evt.getNewValue();
                    if (ob instanceof Boolean) {
                      m.setSelected(((Boolean) evt.getNewValue()).booleanValue());
                      if (!(Boolean) ob) GUIUtil.updateSystemStatusBarForSQLEditor("");
                    }
                  }
                }
              });
    }
  }
Beispiel #6
0
            public void actionPerformed(ActionEvent e) {
              blurItem.setEnabled(!disablingItem.isSelected());
              embossItem.setEnabled(!disablingItem.isSelected());
              busyPainterItem.setEnabled(!disablingItem.isSelected());

              busyPainterUI.setLocked(disablingItem.isSelected());
            }
  protected void initColumnSelectorItems() {
    cornerPopup.removeAll();

    JCheckBoxMenuItem menuItem;

    for (int i = 0; i < realFieldsListTableModel.getColumnCount(); i++) {
      menuItem = new JCheckBoxMenuItem(realFieldsListTableModel.getColumnName(i));
      menuItem.setActionCommand(Integer.valueOf(i).toString());
      addMenuItemListener(menuItem);

      if (fieldsListTable != null) {
        menuItem.setState(fieldsListTableModel.isRealColumnVisible(i));

        if (i == 0) {
          menuItem.setEnabled(false);
        }
      } else {
        menuItem.setState(true);
      }

      cornerPopup.add(menuItem);
    }

    cornerPopup.pack();
  }
Beispiel #8
0
 private static JMenuItem getMenuItem_ShowTabs() {
   final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem("Panel Tabs");
   menuItem.setAccelerator(MenuUtil.getAcceleratorKey(KeyEvent.VK_T));
   menuItem.setState(!prefs.getPrefBoolean(FPref.UI_HIDE_GAME_TABS));
   menuItem.addActionListener(getShowTabsAction(menuItem));
   return menuItem;
 }
Beispiel #9
0
 /** Update an Editor type panel in Show Panels sub menu */
 public void updateEditorPanel(Editor panel) {
   if (panelsList.size() == 0) {
     return;
   }
   for (int i = 0; i < panelsList.size(); i++) {
     Object o = panelsList.get(i);
     if (o == panel) {
       JCheckBoxMenuItem r = (JCheckBoxMenuItem) panelsSubMenu.getItem(i);
       if (panel instanceof LayoutEditor) {
         if (panel.isVisible()) {
           r.setSelected(true);
         } else {
           r.setSelected(false);
         }
       } else {
         if (panel.getTargetFrame().isVisible()) {
           r.setSelected(true);
         } else {
           r.setSelected(false);
         }
       }
       return;
     }
   }
 }
  @Override
  public void actionPerformed(ActionEvent e) {
    try {
      JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getSource();
      activefilter = item.getText();
      if (item.isSelected()) // filter added, will be registered by picker
        // with options if needed
        if (activefilter.equals(ParticlePicker.xmippsmoothfilter)) {
          getParticlePicker().addFilter(ParticlePicker.xmippsmoothfilter, "xmipp");
          reloadImage();
        } else {
          command = activefilter;
          applyFilter(activefilter);
        }
      else {
        // filter removed
        getParticlePicker().removeFilter(activefilter);
        reloadImage();
        if (particlesdialog != null) loadParticles(true);
      }
      if (getParticlePicker().getMode() != Mode.ReadOnly) getParticlePicker().saveConfig();
    } catch (Exception ex) {

      ex.printStackTrace();
      showException(ex);
    }
  }
Beispiel #11
0
  private void runScript(File script) {
    FileReader fr;
    try {
      fr = new FileReader(script);
    } catch (FileNotFoundException e) {
      HF.showErrorMessage(i18n.getMessage("FileNotFound!"));
      return;
    }

    BufferedReader br = new BufferedReader(fr);

    try {
      String s = br.readLine();
      while (s != null) {
        getLSConsoleModel().setCommandLineText(s);
        getLSConsoleModel().execCommand();
        s = br.readLine();
      }
    } catch (Exception e) {
      HF.showErrorMessage(e);
      return;
    }

    if (!cbmiLSConsoleShown.isSelected()) cbmiLSConsoleShown.doClick(0);

    String s = script.getAbsolutePath();
    recentScripts.remove(s);
    recentScripts.insertElementAt(s, 0);

    while (recentScripts.size() > ClassicPrefs.getRecentScriptsSize()) {
      recentScripts.removeElementAt(recentScripts.size() - 1);
    }

    updateRecentScriptsMenu();
  }
Beispiel #12
0
  /** Create the terminal's menubar, all menus and items. */
  private JMenuBar makeMenuBar() {
    JMenuBar menubar = new JMenuBar();
    JMenu menu = new JMenu(Config.getString("terminal.options"));
    JMenuItem item;
    item = menu.add(new ClearAction());
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, SHORTCUT_MASK));
    item = menu.add(getCopyAction());
    item.setText(Config.getString("terminal.copy"));
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, SHORTCUT_MASK));
    item = menu.add(new SaveAction());
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, SHORTCUT_MASK));
    menu.add(new PrintAction());
    menu.add(new JSeparator());

    autoClear = new JCheckBoxMenuItem(new AutoClearAction());
    autoClear.setSelected(clearOnMethodCall);
    menu.add(autoClear);

    recordCalls = new JCheckBoxMenuItem(new RecordCallAction());
    recordCalls.setSelected(recordMethodCalls);
    menu.add(recordCalls);

    unlimitedBuffering = new JCheckBoxMenuItem(new BufferAction());
    unlimitedBuffering.setSelected(unlimitedBufferingCall);
    menu.add(unlimitedBuffering);

    menu.add(new JSeparator());
    item = menu.add(new CloseAction());
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, SHORTCUT_MASK));

    menubar.add(menu);
    return menubar;
  }
  /** Sets the visibility of the column with the specified name. */
  public void setColumnVisible(String name, boolean visible) {
    // Get column and set visibility.
    TableColumnExt column = getColumnExt(name);
    column.setVisible(visible);

    // Get column title.
    String columnTitle = column.getTitle();

    // Find checkbox menu item with matching title.
    JCheckBoxMenuItem matchingItem = null;
    int itemCount = headerPopup.getComponentCount();
    for (int i = 0; i < itemCount; i++) {
      Component menuComponent = headerPopup.getComponent(i);
      if (menuComponent instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem item = (JCheckBoxMenuItem) menuComponent;
        String itemTitle = item.getText();
        if (itemTitle.equals(columnTitle)) {
          matchingItem = item;
          break;
        }
      }
    }

    // Select matching menu item.
    if (matchingItem != null) {
      matchingItem.setSelected(visible);
    }
  }
Beispiel #14
0
 private JCheckBoxMenuItem getChckbxmntmShowInlinePhotos() {
   if (chckbxmntmShowInlinePhotos == null) {
     chckbxmntmShowInlinePhotos = new JCheckBoxMenuItem();
     chckbxmntmShowInlinePhotos.setSelected(true);
     chckbxmntmShowInlinePhotos.setAction(new ToggleInlinePhotoEnabled(picodeMain));
   }
   return chckbxmntmShowInlinePhotos;
 }
Beispiel #15
0
 /** Unconfigures a JCheckBoxMenuItem for an Action. */
 public static void unconfigureJCheckBoxMenuItem(JCheckBoxMenuItem mi, Action a) {
   PropertyChangeListener propertyHandler =
       (PropertyChangeListener) mi.getClientProperty("actionPropertyHandler");
   if (propertyHandler != null) {
     a.removePropertyChangeListener(propertyHandler);
     mi.putClientProperty("actionPropertyHandler", null);
   }
 }
Beispiel #16
0
 public BaseTranslate() {
   menuItem = new JCheckBoxMenuItem();
   Mnemonics.setLocalizedText(menuItem, getName());
   menuItem.addActionListener(this);
   enabled = Preferences.isPreference(getPreferenceName());
   menuItem.setState(enabled);
   Core.getMainWindow().getMainMenu().getMachineTranslationMenu().add(menuItem);
 }
Beispiel #17
0
 private void updateMenus(boolean flag) {
   numberingItem.setEnabled(flag);
   jpegExportItem.setEnabled(flag);
   saveAsItem.setEnabled(flag);
   groupingItem.setEnabled(flag);
   orderingOffItem.setEnabled(flag);
   orderingOverlapItem.setEnabled(flag);
 }
 /**
  * @param text
  * @param cmdName
  * @param icon
  * @return
  */
 public static JCheckBoxMenuItem createChkMenuItem(String text, String cmdName, ImageIcon icon) {
   JCheckBoxMenuItem item = new JCheckBoxMenuItem(text);
   item.setActionCommand(cmdName);
   if (icon != null) {
     item.setIcon(icon);
   }
   return item;
 }
  /**
   * @see AbstractAction
   * @param event
   */
  public void actionPerformed(final ActionEvent event) {

    // Perform action
    JCheckBoxMenuItem cb = (JCheckBoxMenuItem) event.getSource();

    // Determine status
    networkPanel.setWeightsVisible(cb.isSelected());
  }
Beispiel #20
0
 @Override
 public void actionPerformed(ActionEvent e) {
   JCheckBoxMenuItem check = (JCheckBoxMenuItem) e.getSource();
   // Do not allow the last column to be hidden
   if (!check.isSelected() && tcm.getColumnCount(true) == 1) {
     return;
   }
   tcm.setColumnVisible(tc, check.isSelected());
 }
 /** Set the tool tip texts (used for language change, and at initialization labels). */
 public void setLabels() {
   btnColumns.setToolTipText(loc.getMenuTooltip("Columns"));
   btnOptions.setToolTipText(loc.getMenuTooltip("Options"));
   btnExport.setToolTipText(loc.getPlainTooltip("ExportAsWebpage"));
   btnPrint.setToolTipText(loc.getMenuTooltip("Print"));
   btnHelp.setToolTipText(loc.getMenuTooltip("FastHelp"));
   miShowOnlyBreakpoints.setText(loc.getPlain("ShowOnlyBreakpoints"));
   miColorfulConstructionProtocol.setText(loc.getPlain("ColorfulConstructionProtocol"));
 }
  /** @see org.jgraph.pad.actions.IpssAbstractGraphAction#getMenuComponent(String) */
  protected Component getMenuComponent(String actionCommand) {
    JCheckBoxMenuItem button = new JCheckBoxMenuItem(this);
    abstractButtons.add(button);
    GPBarFactory.fillMenuButton(button, getName(), actionCommand);
    String presentationText = getPresentationText(actionCommand);
    if (presentationText != null) button.setText(presentationText);

    return button;
  }
 private JCheckBoxMenuItem addFilterMenuItem(
     String command, boolean defaultlistener, ParticlePicker picker) {
   JCheckBoxMenuItem mi = new JCheckBoxMenuItem(command);
   mifilters.add(mi);
   mi.setSelected(picker.isFilterAdded(command));
   if (defaultlistener) mi.addActionListener(this);
   filtersmn.add(mi);
   // mi.setEnabled(picker.getMode() != Mode.ReadOnly);
   return mi;
 }
Beispiel #24
0
  public static JCheckBoxMenuItem createMenuItem2(Action a, char m, int key, HotKey hotKey) {
    JCheckBoxMenuItem res = new JCheckBoxMenuItem(a);
    res.setMnemonic(m);

    int mask = getMask(hotKey);

    if (key != 0) res.setAccelerator(KeyStroke.getKeyStroke(key, mask));

    return res;
  }
 /**
  * Create the Statistics Menu, showing all available statistics for the chosen ChartableKstat.
  *
  * @param cks the ChartableKstat to show the statistics of in the menu
  * @param statistics the initial statistics, which will be checked
  * @return the Statistics Menu
  */
 protected JMenu statisticsMenu(ChartableKstat cks, List<String> statistics) {
   JMenu jmstat = new JMenu(KstatResources.getString("CHART.SHOW"));
   jmstat.setMnemonic(KeyEvent.VK_S);
   for (String stat : cks.getStatistics()) {
     JCheckBoxMenuItem jmi = new JCheckBoxMenuItem(stat, statistics.contains(stat));
     jmi.addActionListener(this);
     jmstat.add(jmi);
   }
   return jmstat;
 }
 private boolean optionRNADisplay() {
   // les options d'affichages generales
   if (_type.equals("gaspin")) {
     _vp.getVARNAUI().UIToggleGaspinMode();
   } else if (_type.equals("backbone")) {
     _vp.getVARNAUI().UISetBackboneColor();
   } else if (_type.equals("bonds")) {
     Color c = JColorChooser.showDialog(_vp, "Choose new bonds color", _vp.getBackground());
     if (c != null) {
       _vp.setDefaultBPColor(c);
       _vp.repaint();
     }
   } else if (_type.equals("basecolorforBP")) {
     if (_source != null) {
       if (_source instanceof JCheckBoxMenuItem) {
         JCheckBoxMenuItem check = (JCheckBoxMenuItem) _source;
         _vp.setUseBaseColorsForBPs(check.getState());
         _vp.repaint();
       }
     }
   } else if (_type.equals("bpstyle")) {
     _vp.getVARNAUI().UISetBPStyle();
   } else if (_type.equals("specialbasecolored")) {
     _vp.getVARNAUI().UIToggleColorSpecialBases();
   } else if (_type.equals("showwarnings")) {
     _vp.getVARNAUI().UIToggleShowWarnings();
   } else if (_type.equals("dashbasecolored")) {
     _vp.getVARNAUI().UIToggleColorGapsBases();
   } else if (_type.equals("numPeriod")) {
     _vp.getVARNAUI().UISetNumPeriod();
   } else if (_type.equals("eachKind")) {
     if (_vp.getRNA().get_listeBases() != null) {
       _vp.getVARNAUI().UIBaseTypeColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("eachCouple")) {
     if (_vp.getRNA().get_listeBases() != null && _vp.getRNA().get_listeBases().size() != 0) {
       _vp.getVARNAUI().UIBasePairTypeColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("eachBase")) {
     if (_vp.getRNA().get_listeBases() != null && _vp.getRNA().get_listeBases().size() != 0) {
       _vp.getVARNAUI().UIBaseAllColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("specialBasesColor")) {
     _vp.getVARNAUI().UIPickSpecialBasesColor();
   } else if (_type.equals("dashBasesColor")) {
     _vp.getVARNAUI().UIPickGapsBasesColor();
   } else return colorBases();
   return true;
 }
Beispiel #27
0
  public void showForCreation() {

    hiddenObstacle.setSelected(false);
    hiddenObstacle.setEnabled(false);
    for (JRadioButton tof : typeOfFood) {
      tof.setEnabled(true);
    }
    newCreatureButton.setEnabled(true);
    newJewelButton.setEnabled(true);
    group.setSelected(model, true);
  }
Beispiel #28
0
 public void actionPerformed(ActionEvent e) {
   super.actionPerformed(e);
   JMenuItem jmi = (JMenuItem) e.getSource();
   if (displayset.contains(jmi)) {
     mainPanel.setNames(jmi.getText());
   } else if (jmi == hiddenItem) {
     mainPanel.showIgnored(hiddenItem.isSelected());
   } else if (jmi == aggrItem) {
     mainPanel.showAggregates(aggrItem.isSelected());
   }
 }
Beispiel #29
0
 protected void showTableHeaderPopup(MouseEvent e) {
   JPopupMenu popupMenu = new JPopupMenu();
   for (int i = 0; i < columnModel.getColumnCount(false); i++) {
     TableColumn tc = columnModel.getColumnByModelIndex(i);
     JCheckBoxMenuItem menuItem =
         new JCheckBoxMenuItem(
             dataTable.getModel().getColumnName(i), columnModel.isColumnVisible(tc));
     menuItem.addActionListener(new headerActionListener(tc));
     popupMenu.add(menuItem);
   }
   popupMenu.show(e.getComponent(), e.getX(), e.getY());
 }
Beispiel #30
-1
  /**
   * Invoked when an item has been selected or deselected by the user.
   *
   * <p>Invoked when an item has been selected or deselected by the user. The code written for this
   * method performs the operations that need to occur when an item is selected (or deselected).
   */
  public void itemStateChanged(ItemEvent e) {
    /* format menu */
    if (e.getSource() == wordWrap) {
      editor.setLineWrap(!editor.getLineWrap());
      side.setLineWrap(editor.getLineWrap());
      // wordWrap.setText(editor.getLineWrap() ? "Disable Word Wrap" : "Enable Word Wrap");
      wordWrap.setDisplayedMnemonicIndex(wordWrap.getText().indexOf('W'));
    }

    /* view menu */
    if (e.getSource() == toggleSide) {
      // hide the sidePane, sideButton, and update the text in the toggleSide JMenuItem (need to
      // update mnemonicindex as well)
      sidePane.setVisible(!sidePane.isVisible());
      sideButton.setVisible(sidePane.isVisible());
      // toggleSide.setText(sidePane.isVisible() ? "Hide Side Pane" : "Show Side Pane");
      toggleSide.setDisplayedMnemonicIndex(5);

      // easier to remove everything and then add them back
      centerPanel.removeAll();
      centerPanel.add(editorPane);
      if (sideButton.isVisible()) {
        centerPanel.add(sidePane);
      }
      centerPanel.validate();
    }
  }