コード例 #1
0
ファイル: LockableDemo.java プロジェクト: njmube/Invoicex
            public void actionPerformed(ActionEvent e) {
              blurItem.setEnabled(!disablingItem.isSelected());
              embossItem.setEnabled(!disablingItem.isSelected());
              busyPainterItem.setEnabled(!disablingItem.isSelected());

              busyPainterUI.setLocked(disablingItem.isSelected());
            }
コード例 #2
0
ファイル: HyperSearchResults.java プロジェクト: SELab/jEdit
    @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());
    }
コード例 #3
0
ファイル: BeanTableDataModel.java プロジェクト: KenC57/JMRI
 @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());
 }
コード例 #4
0
ファイル: JFSstat.java プロジェクト: ptribble/solview
 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());
   }
 }
コード例 #5
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();
  }
コード例 #6
0
  @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);
    }
  }
コード例 #7
0
 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);
     }
   }
 }
コード例 #8
0
  /**
   * @see AbstractAction
   * @param event
   */
  public void actionPerformed(final ActionEvent event) {

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

    // Determine status
    networkPanel.setWeightsVisible(cb.isSelected());
  }
コード例 #9
0
ファイル: GameMenu.java プロジェクト: DanVanAtta/triplea
  private void addNotificationSettings(final JMenu parentMenu) {
    final JMenu notificationMenu = new JMenu();
    notificationMenu.setMnemonic(KeyEvent.VK_U);
    notificationMenu.setText("User Notifications");
    final JCheckBoxMenuItem showEndOfTurnReport = new JCheckBoxMenuItem("Show End of Turn Report");
    showEndOfTurnReport.setMnemonic(KeyEvent.VK_R);
    final JCheckBoxMenuItem showTriggeredNotifications =
        new JCheckBoxMenuItem("Show Triggered Notifications");
    showTriggeredNotifications.setMnemonic(KeyEvent.VK_T);
    final JCheckBoxMenuItem showTriggerChanceSuccessful =
        new JCheckBoxMenuItem("Show Trigger/Condition Chance Roll Successful");
    showTriggerChanceSuccessful.setMnemonic(KeyEvent.VK_S);
    final JCheckBoxMenuItem showTriggerChanceFailure =
        new JCheckBoxMenuItem("Show Trigger/Condition Chance Roll Failure");
    showTriggerChanceFailure.setMnemonic(KeyEvent.VK_F);
    notificationMenu.addMenuListener(
        new MenuListener() {
          @Override
          public void menuSelected(final MenuEvent e) {
            showEndOfTurnReport.setSelected(iuiContext.getShowEndOfTurnReport());
            showTriggeredNotifications.setSelected(iuiContext.getShowTriggeredNotifications());
            showTriggerChanceSuccessful.setSelected(iuiContext.getShowTriggerChanceSuccessful());
            showTriggerChanceFailure.setSelected(iuiContext.getShowTriggerChanceFailure());
          }

          @Override
          public void menuDeselected(final MenuEvent e) {}

          @Override
          public void menuCanceled(final MenuEvent e) {}
        });
    showEndOfTurnReport.addActionListener(
        e -> iuiContext.setShowEndOfTurnReport(showEndOfTurnReport.isSelected()));
    showTriggeredNotifications.addActionListener(
        e -> iuiContext.setShowTriggeredNotifications(showTriggeredNotifications.isSelected()));
    showTriggerChanceSuccessful.addActionListener(
        e -> iuiContext.setShowTriggerChanceSuccessful(showTriggerChanceSuccessful.isSelected()));
    showTriggerChanceFailure.addActionListener(
        e -> iuiContext.setShowTriggerChanceFailure(showTriggerChanceFailure.isSelected()));
    notificationMenu.add(showEndOfTurnReport);
    notificationMenu.add(showTriggeredNotifications);
    notificationMenu.add(showTriggerChanceSuccessful);
    notificationMenu.add(showTriggerChanceFailure);
    parentMenu.add(notificationMenu);
  }
コード例 #10
0
 @Override
 public void actionPerformed(ActionEvent ae) {
   if (ae.getSource().equals(openItem)) {
     File f = null;
     if (null == (f = SpeedyGrader.getInstance().getFilesLoc())) {
       f = new File(System.getProperty("user.home"));
     }
     JFileChooser chooser = new JFileChooser(f);
     chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
     int ret = chooser.showOpenDialog(this);
     if (ret == JFileChooser.APPROVE_OPTION) {
       newFolderSelected(chooser.getSelectedFile());
     }
   } else if (ae.getSource().equals(inputItem)) {
     new InputDialog();
   } else if (ae.getSource().equals(saveItem)) {
     for (EditorPanel ep : editorPanels) {
       ep.save();
     }
     SpeedyGrader.getInstance().startComplieAndRun();
   } else if (ae.getSource().equals(refreshItem)) {
     newFolderSelected(null);
   } else if (ae.getSource().equals(githubItem)) {
     String url = "https://github.com/MitchellSlavik/SpeedyGrader";
     Desktop d = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
     if (d != null && d.isSupported(Action.BROWSE)) {
       try {
         d.browse(URI.create(url));
       } catch (IOException e) {
         e.printStackTrace();
       }
     } else {
       JOptionPane.showMessageDialog(
           this,
           "We were unable to open a web browser. The url has been copied to your clipboard.",
           "Unable to preform operation",
           JOptionPane.ERROR_MESSAGE);
       StringSelection selection = new StringSelection(url);
       Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
       clipboard.setContents(selection, selection);
     }
   } else if (ae.getSource().equals(aboutItem)) {
     new AboutDialog();
   } else if (ae.getSource().equals(installItem)) {
     new InstallDialog();
   } else if (ae.getSource().equals(upgradeItem)) {
     new AutoUpdater();
   } else if (ae.getSource().equals(editorSplitToggle)) {
     splitEditorPane.setOrientation(
         editorSplitToggle.isSelected() ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
     this.validate();
     this.repaint();
   }
 }
コード例 #11
0
ファイル: SearchManager2.java プロジェクト: steog88/jabref
 /**
  * Add the correct key listeners to the search text field, depending on whether and autocomplete
  * listener has been set and whether incremental search is selected.
  */
 private void updateKeyListeners() {
   KeyListener[] listeners = searchField.getKeyListeners();
   for (KeyListener listener : listeners) {
     searchField.removeKeyListener(listener);
   }
   if (increment.isSelected()) {
     searchField.addKeyListener(this);
   } else {
     if (searchAutoComplete.isSelected() && (autoCompleteListener != null)) {
       searchField.addKeyListener(autoCompleteListener);
     }
   }
 }
コード例 #12
0
ファイル: SearchManager2.java プロジェクト: steog88/jabref
 public void updatePrefs() {
   Globals.prefs.putBoolean(JabRefPreferences.SEARCH_REQ, searchReq.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.SEARCH_OPT, searchOpt.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.SEARCH_GEN, searchGen.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.SEARCH_ALL, searchAll.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.INCREMENT_S, increment.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.SELECT_S, select.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.FLOAT_SEARCH, floatSearch.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.CASE_SENSITIVE_SEARCH, caseSensitive.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.REG_EXP_SEARCH, regExpSearch.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.HIGH_LIGHT_WORDS, highLightWords.isSelected());
   Globals.prefs.putBoolean(
       JabRefPreferences.SHOW_SEARCH_IN_DIALOG, showResultsInDialog.isSelected());
   Globals.prefs.putBoolean(JabRefPreferences.SEARCH_ALL_BASES, searchAllBases.isSelected());
 }
コード例 #13
0
ファイル: DetailsFrame.java プロジェクト: ncweiler/fiji
 public void updateTreeAndLabels() {
   ImagePlus imp = WindowManager.getCurrentImage();
   if (imp == null) return;
   Reader reader = ServiceMediator.getReader();
   reader.updateMetadata(imp);
   if (imp.getOriginalFileInfo() instanceof LSMFileInfo) {
     lsm = (LSMFileInfo) imp.getOriginalFileInfo();
     setTitle(title + " - " + lsm.fileName);
     detailsTree.clearSelection();
     table.clearSelection();
     collapseAll();
     if (filterCBItem.isSelected()) updateFilteredTree(true);
     else updateFilteredTree(false);
   }
 }
コード例 #14
0
 public boolean isShowConstraintNames() {
   return _mnuShowConstraintNames.isSelected();
 }
コード例 #15
0
ファイル: PlayerPanel.java プロジェクト: diab0l/mtg-forge
 private boolean isSimulatedAi() {
   return radioAi.isSelected() && radioAiUseSimulation.isSelected();
 }
コード例 #16
0
 public boolean isShowQualifiedTableNames() {
   return _mnuShowQualifiedTableNames.isSelected();
 }
コード例 #17
0
 @Override
 public void actionPerformed(ActionEvent ae) {
   if (ae.getSource() == entityInfoMenuItem) {
     MapNode mNode = pane.getRenderer().getNextNode(x, y);
     if (mNode != null) pane.showMapEntityInfoDialog(mNode, pane.isDebugModeEnabled());
   } else if (ae.getSource() == clearMenuItem) {
     pane.getMap().clearMarkersAndTracks();
   } else if (ae.getSource() == createMarkerMenuItem) {
     PositionPanel panel = new PositionPanel();
     int res =
         JOptionPane.showConfirmDialog(
             pane, panel, "Specify a Position", JOptionPane.OK_CANCEL_OPTION);
     if (res == JOptionPane.OK_OPTION) {
       float lat = panel.getLat();
       float lon = panel.getLon();
       if (!Float.isNaN(lat) && !Float.isNaN(lon)) {
         pane.getMap().addMarker(lat, lon);
         pane.adjustToCenter(lat, lon);
       }
     }
   } else if (ae.getSource() == removeMarkerMenuItem) {
     pane.removeNearestMarker(x, y);
   } else if (ae.getSource() == loadMarkersMenuItem) {
     XMLDecoder decoder = null;
     try {
       File xmlFile = null;
       if (getFileChooser().showDialog(pane, "Load Markers") == JFileChooser.APPROVE_OPTION) {
         xmlFile = getFileChooser().getSelectedFile();
         if (!xmlFile.getPath().contains(".")) xmlFile = new File(xmlFile.getPath() + ".xml");
       }
       if (xmlFile != null && xmlFile.exists()) {
         pane.getMap().clearMarkersAndTracks();
         decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(xmlFile)));
         int size = (Integer) decoder.readObject();
         for (int i = 0; i < size; i++) {
           WritablePosition pos = (WritablePosition) decoder.readObject();
           pane.getMap().addMarker(pos.getLat(), pos.getLon());
         }
         pane.fireMapViewEvent(new MapViewEvent(pane, MapViewEvent.Type.MARKER_ADDED));
       }
     } catch (IOException e) {
       e.printStackTrace();
     } finally {
       if (decoder != null) decoder.close();
     }
   } else if (ae.getSource() == saveMarkersMenuItem) {
     XMLEncoder encoder = null;
     try {
       File xmlFile = null;
       if (getFileChooser().showDialog(pane, "Save Markers") == JFileChooser.APPROVE_OPTION) {
         xmlFile = getFileChooser().getSelectedFile();
         if (!xmlFile.getPath().contains(".")) xmlFile = new File(xmlFile.getPath() + ".xml");
         encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(xmlFile)));
         encoder.writeObject(pane.getMap().getMarkers().size());
         for (MapNode node : pane.getMap().getMarkers())
           encoder.writeObject(new WritablePosition(node));
       }
     } catch (IOException e) {
       e.printStackTrace();
     } finally {
       if (encoder != null) encoder.close();
     }
   } else if (ae.getSource() == functionsMenuItem) {
     JOptionPane.showMessageDialog(
         pane,
         MapViewPane.FUNCTION_DESCRIPTION.split("\\|"),
         "Function Description",
         JOptionPane.INFORMATION_MESSAGE);
   } else if (ae.getSource() == debugMenuItem) {
     pane.enableDebugMode(debugMenuItem.isSelected());
   }
 }
コード例 #18
0
ファイル: StationModelCanvas.java プロジェクト: ethanrd/IDV
 /**
  * Should we draw the alignment points in the canvas
  *
  * @return Draw the alignment points in the canvas
  */
 public boolean shouldShowAlignmentPoints() {
   if (showAlignmentPointsMI != null) {
     return showAlignmentPointsMI.isSelected();
   }
   return true;
 }
コード例 #19
0
 protected void setLSConsoleVisible(boolean b) {
   if (b != cbmiLSConsoleShown.isSelected()) cbmiLSConsoleShown.doClick(0);
 }
コード例 #20
0
ファイル: BaseTranslate.java プロジェクト: alex73/OmegaT
 public void actionPerformed(ActionEvent e) {
   enabled = menuItem.isSelected();
   Preferences.setPreference(getPreferenceName(), enabled);
 }
コード例 #21
0
ファイル: CallManager.java プロジェクト: ymatlashenko/olyo
  /**
   * Handles the <tt>ActionEvent</tt> generated when user presses one of the buttons in this panel.
   */
  public void actionPerformed(ActionEvent evt) {
    JButton button = (JButton) evt.getSource();
    String buttonName = button.getName();

    if (buttonName.equals("call")) {
      Component selectedPanel = mainFrame.getSelectedTab();

      // call button is pressed over an already open call panel
      if (selectedPanel != null
          && selectedPanel instanceof CallPanel
          && ((CallPanel) selectedPanel).getCall().getCallState()
              == CallState.CALL_INITIALIZATION) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Iterator participantPanels = callPanel.getParticipantsPanels();

        while (participantPanels.hasNext()) {
          CallParticipantPanel panel = (CallParticipantPanel) participantPanels.next();

          panel.setState("Connecting");
        }

        Call call = callPanel.getCall();

        answerCall(call);
      }
      // call button is pressed over the call list
      else if (selectedPanel != null
          && selectedPanel instanceof CallListPanel
          && ((CallListPanel) selectedPanel).getCallList().getSelectedIndex() != -1) {

        CallListPanel callListPanel = (CallListPanel) selectedPanel;

        GuiCallParticipantRecord callRecord =
            (GuiCallParticipantRecord) callListPanel.getCallList().getSelectedValue();

        String stringContact = callRecord.getParticipantName();

        createCall(stringContact);
      }
      // call button is pressed over the contact list
      else if (selectedPanel != null && selectedPanel instanceof ContactListPanel) {
        // call button is pressed when a meta contact is selected
        if (isCallMetaContact) {
          Object[] selectedContacts =
              mainFrame.getContactListPanel().getContactList().getSelectedValues();

          Vector telephonyContacts = new Vector();

          for (int i = 0; i < selectedContacts.length; i++) {

            Object o = selectedContacts[i];

            if (o instanceof MetaContact) {

              Contact contact =
                  ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

              if (contact != null) telephonyContacts.add(contact);
              else {
                new ErrorDialog(
                        this.mainFrame,
                        Messages.getI18NString("warning").getText(),
                        Messages.getI18NString(
                                "contactNotSupportingTelephony",
                                new String[] {((MetaContact) o).getDisplayName()})
                            .getText())
                    .showDialog();
              }
            }
          }

          if (telephonyContacts.size() > 0) createCall(telephonyContacts);

        } else if (!phoneNumberCombo.isComboFieldEmpty()) {

          // if no contact is selected checks if the user has chosen
          // or has
          // writen something in the phone combo box

          String stringContact = phoneNumberCombo.getEditor().getItem().toString();

          createCall(stringContact);
        }
      } else if (selectedPanel != null && selectedPanel instanceof DialPanel) {
        String stringContact = phoneNumberCombo.getEditor().getItem().toString();
        createCall(stringContact);
      }
    } else if (buttonName.equalsIgnoreCase("hangup")) {
      Component selectedPanel = this.mainFrame.getSelectedTab();

      if (selectedPanel != null && selectedPanel instanceof CallPanel) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
        NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Call call = callPanel.getCall();

        if (removeCallTimers.containsKey(callPanel)) {
          ((Timer) removeCallTimers.get(callPanel)).stop();
          removeCallTimers.remove(callPanel);
        }

        removeCallPanel(callPanel);

        if (call != null) {
          ProtocolProviderService pps = call.getProtocolProvider();

          OperationSetBasicTelephony telephony = mainFrame.getTelephonyOpSet(pps);

          Iterator participants = call.getCallParticipants();

          while (participants.hasNext()) {
            try {
              // now we hang up the first call participant in the
              // call
              telephony.hangupCallParticipant((CallParticipant) participants.next());
            } catch (OperationFailedException e) {
              logger.error("Hang up was not successful: " + e);
            }
          }
        }
      }
    } else if (buttonName.equalsIgnoreCase("minimize")) {
      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (!hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(true);

      this.setCallPanelVisible(false);
    } else if (buttonName.equalsIgnoreCase("restore")) {

      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(false);

      this.setCallPanelVisible(true);
    }
  }
コード例 #22
0
 public boolean timeoutPrograms() {
   return timeoutPrograms.isSelected();
 }
コード例 #23
0
ファイル: SearchManager2.java プロジェクト: steog88/jabref
  public SearchManager2(JabRefFrame frame, SidePaneManager manager) {
    super(manager, GUIGlobals.getIconUrl("search"), Globals.lang("Search"));

    this.frame = frame;
    incSearcher = new IncrementalSearcher(Globals.prefs);

    // setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.magenta));

    searchReq =
        new JCheckBoxMenuItem(
            Globals.lang("Search required fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REQ));
    searchOpt =
        new JCheckBoxMenuItem(
            Globals.lang("Search optional fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_OPT));
    searchGen =
        new JCheckBoxMenuItem(
            Globals.lang("Search general fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_GEN));
    searchAll =
        new JCheckBoxMenuItem(
            Globals.lang("Search all fields"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL));
    regExpSearch =
        new JCheckBoxMenuItem(
            Globals.lang("Use regular expressions"),
            Globals.prefs.getBoolean(JabRefPreferences.REG_EXP_SEARCH));

    increment = new JRadioButton(Globals.lang("Incremental"), false);
    floatSearch = new JRadioButton(Globals.lang("Float"), true);
    hideSearch = new JRadioButton(Globals.lang("Filter"), true);
    showResultsInDialog = new JRadioButton(Globals.lang("Show results in dialog"), true);
    searchAllBases =
        new JRadioButton(
            Globals.lang("Global search"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL_BASES));
    ButtonGroup types = new ButtonGroup();
    types.add(increment);
    types.add(floatSearch);
    types.add(hideSearch);
    types.add(showResultsInDialog);
    types.add(searchAllBases);

    select = new JCheckBoxMenuItem(Globals.lang("Select matches"), false);
    increment.setToolTipText(Globals.lang("Incremental search"));
    floatSearch.setToolTipText(Globals.lang("Gray out non-matching entries"));
    hideSearch.setToolTipText(Globals.lang("Hide non-matching entries"));
    showResultsInDialog.setToolTipText(Globals.lang("Show search results in a window"));

    // Add an item listener that makes sure we only listen for key events
    // when incremental search is turned on.
    increment.addItemListener(this);
    floatSearch.addItemListener(this);
    hideSearch.addItemListener(this);
    showResultsInDialog.addItemListener(this);
    // Add the global focus listener, so a menu item can see if this field was focused when
    // an action was called.
    searchField.addFocusListener(Globals.focusListener);

    if (searchAll.isSelected()) {
      searchReq.setEnabled(false);
      searchOpt.setEnabled(false);
      searchGen.setEnabled(false);
    }
    searchAll.addChangeListener(
        new ChangeListener() {

          @Override
          public void stateChanged(ChangeEvent event) {
            boolean state = !searchAll.isSelected();
            searchReq.setEnabled(state);
            searchOpt.setEnabled(state);
            searchGen.setEnabled(state);
          }
        });

    caseSensitive =
        new JCheckBoxMenuItem(
            Globals.lang("Case sensitive"),
            Globals.prefs.getBoolean(JabRefPreferences.CASE_SENSITIVE_SEARCH));

    highLightWords =
        new JCheckBoxMenuItem(
            Globals.lang("Highlight Words"),
            Globals.prefs.getBoolean(JabRefPreferences.HIGH_LIGHT_WORDS));

    searchAutoComplete =
        new JCheckBoxMenuItem(
            Globals.lang("Autocomplete names"),
            Globals.prefs.getBoolean(JabRefPreferences.SEARCH_AUTO_COMPLETE));
    settings.add(select);

    // 2005.03.29, trying to remove field category searches, to simplify
    // search usability.
    // settings.addSeparator();
    // settings.add(searchReq);
    // settings.add(searchOpt);
    // settings.add(searchGen);
    // settings.addSeparator();
    // settings.add(searchAll);
    // ---------------------------------------------------------------
    settings.addSeparator();
    settings.add(caseSensitive);
    settings.add(regExpSearch);
    settings.addSeparator();
    settings.add(highLightWords);
    settings.addSeparator();
    settings.add(searchAutoComplete);

    searchField.addActionListener(this);
    searchField.addCaretListener(this);
    search.addActionListener(this);
    searchField.addFocusListener(
        new FocusAdapter() {

          @Override
          public void focusGained(FocusEvent e) {
            if (increment.isSelected()) {
              searchField.setText("");
            }
          }

          @Override
          public void focusLost(FocusEvent e) {
            incSearch = false;
            incSearchPos = -1; // Reset incremental
            // search. This makes the
            // incremental search reset
            // once the user moves focus to
            // somewhere else.
            if (increment.isSelected()) {
              // searchField.setText("");
              // System.out.println("focuslistener");
            }
          }
        });
    escape.addActionListener(this);
    escape.setEnabled(false); // enabled after searching

    openset.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            if (settings.isVisible()) {
              // System.out.println("oee");
              // settings.setVisible(false);
            } else {
              JButton src = (JButton) e.getSource();
              settings.show(src, 0, openset.getHeight());
            }
          }
        });

    searchAutoComplete.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            Globals.prefs.putBoolean(
                JabRefPreferences.SEARCH_AUTO_COMPLETE, searchAutoComplete.isSelected());
            if (SearchManager2.this.frame.basePanel() != null) {
              SearchManager2.this.frame.basePanel().updateSearchManager();
            }
          }
        });
    Insets margin = new Insets(0, 2, 0, 2);
    // search.setMargin(margin);
    escape.setMargin(margin);
    openset.setMargin(margin);
    JButton help = new JButton(GUIGlobals.getImage("help"));
    int butSize = help.getIcon().getIconHeight() + 5;
    Dimension butDim = new Dimension(butSize, butSize);
    help.setPreferredSize(butDim);
    help.setMinimumSize(butDim);
    help.setMargin(margin);
    help.addActionListener(new HelpAction(Globals.helpDiag, GUIGlobals.searchHelp, "Help"));

    // Select the last used mode of search:
    if (Globals.prefs.getBoolean(JabRefPreferences.INCREMENT_S)) {
      increment.setSelected(true);
    } else if (Globals.prefs.getBoolean(JabRefPreferences.FLOAT_SEARCH)) {
      floatSearch.setSelected(true);
    } else if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_SEARCH_IN_DIALOG)) {
      showResultsInDialog.setSelected(true);
    } else if (Globals.prefs.getBoolean(JabRefPreferences.SEARCH_ALL_BASES)) {
      searchAllBases.setSelected(true);
    } else {
      hideSearch.setSelected(true);
    }

    JPanel main = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    main.setLayout(gbl);
    GridBagConstraints con = new GridBagConstraints();
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.fill = GridBagConstraints.BOTH;
    con.weightx = 1;

    gbl.setConstraints(searchField, con);
    main.add(searchField);
    // con.gridwidth = 1;
    gbl.setConstraints(search, con);
    main.add(search);
    con.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(escape, con);
    main.add(escape);
    con.insets = new Insets(0, 2, 0, 0);
    gbl.setConstraints(increment, con);
    main.add(increment);
    gbl.setConstraints(floatSearch, con);
    main.add(floatSearch);
    gbl.setConstraints(hideSearch, con);
    main.add(hideSearch);
    gbl.setConstraints(showResultsInDialog, con);
    main.add(showResultsInDialog);
    gbl.setConstraints(searchAllBases, con);
    main.add(searchAllBases);
    con.insets = new Insets(0, 0, 0, 0);
    JPanel pan = new JPanel();
    GridBagLayout gb = new GridBagLayout();
    gbl.setConstraints(pan, con);
    pan.setLayout(gb);
    con.weightx = 1;
    con.gridwidth = 1;
    gb.setConstraints(openset, con);
    pan.add(openset);
    con.weightx = 0;
    gb.setConstraints(help, con);
    pan.add(help);
    main.add(pan);
    main.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    setContentContainer(main);

    searchField.getInputMap().put(Globals.prefs.getKey("Repeat incremental search"), "repeat");

    searchField
        .getActionMap()
        .put(
            "repeat",
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                if (increment.isSelected()) {
                  repeatIncremental();
                }
              }
            });
    searchField.getInputMap().put(Globals.prefs.getKey("Clear search"), "escape");
    searchField
        .getActionMap()
        .put(
            "escape",
            new AbstractAction() {

              @Override
              public void actionPerformed(ActionEvent e) {
                hideAway();
                // SearchManager2.this.actionPerformed(new ActionEvent(escape, 0, ""));
              }
            });
    setSearchButtonSizes();
    updateSearchButtonText();
  }
コード例 #24
0
 protected boolean isLeftPaneVisible() {
   return cbmiLeftPaneVisible.isSelected();
 }
コード例 #25
0
 /**
  * @see AbstractAction
  * @param event
  */
 public void actionPerformed(final ActionEvent event) {
   JCheckBoxMenuItem cb = (JCheckBoxMenuItem) event.getSource();
   networkPanel.setAutoZoomMode(cb.isSelected());
 }
コード例 #26
0
 protected void setLeftPaneVisible(boolean b) {
   if (b != cbmiLeftPaneVisible.isSelected()) cbmiLeftPaneVisible.doClick(0);
 }
コード例 #27
0
ファイル: DetailsFrame.java プロジェクト: ncweiler/fiji
  public DefaultMutableTreeNode findNode(
      String string, Enumeration<DefaultMutableTreeNode> nodes, DefaultMutableTreeNode last) {
    DefaultMutableTreeNode result = null;
    DefaultMutableTreeNode node = null;
    Object[][] data = null;
    string = string.toLowerCase();
    if (last != null) {
      if (last instanceof InfoNode) {
        InfoNode info = (InfoNode) last;
        LinkedHashMap<String, Object> dataMap = (LinkedHashMap<String, Object>) info.data;
        if (filterCBItem.isSelected()) dataMap = getFilteredMap(dataMap);
        Iterator<String> iterator = dataMap.keySet().iterator();
        String tag;
        data = new Object[dataMap.size()][2];
        for (int i = 0; iterator.hasNext(); i++) {
          tag = iterator.next();
          data[i][0] = tag;
          data[i][1] = dataMap.get(tag);
        }
        boolean pointCreated = false;
        if (searchCoordinates == null) {
          searchCoordinates = new Point(0, 0);
          pointCreated = true;
        }

        int i = searchCoordinates.x;
        int j = searchCoordinates.y;
        while (i < data.length) {

          while (j < 2) {
            if (pointCreated || !searchCoordinates.equals(new Point(i, j))) {
              Object property = data[i][j];
              if (property.toString().toLowerCase().indexOf(string) > 0) {
                searchCoordinates = new Point(i, j);
                return last;
              }
            }
            j++;
          }
          j = 0;
          i++;
        }
      }
      while (nodes.hasMoreElements() && (!nodes.nextElement().equals(last))) ;
    }

    searchCoordinates = null;

    while (nodes.hasMoreElements() && (result == null)) {
      node = (DefaultMutableTreeNode) nodes.nextElement();
      String nodeTitle = node.getUserObject().toString();

      if (nodeTitle.toLowerCase().indexOf(string) > 0) {
        result = node;
      }
    }
    if (result == null)
      JOptionPane.showMessageDialog(
          this,
          "End of metadata reached. I could not find any tags, properties or values. The next search will start from the beginning.",
          "Find...",
          JOptionPane.INFORMATION_MESSAGE);
    return result;
  }
コード例 #28
0
 protected boolean isLSConsoleShown() {
   return cbmiLSConsoleShown.isSelected();
 }
コード例 #29
0
ファイル: SearchManager2.java プロジェクト: steog88/jabref
 private boolean isSpecificSearch() {
   return !increment.isSelected()
       && SearchExpression.isValid(
           caseSensitive.isSelected(), regExpSearch.isSelected(), searchField.getText());
 }