Esempio n. 1
0
 private void updateMenus(boolean flag) {
   numberingItem.setEnabled(flag);
   jpegExportItem.setEnabled(flag);
   saveAsItem.setEnabled(flag);
   groupingItem.setEnabled(flag);
   orderingOffItem.setEnabled(flag);
   orderingOverlapItem.setEnabled(flag);
 }
  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();
  }
Esempio n. 3
0
  // enable/disable all menu items/actions
  private void setAllEnabled(boolean enabled) {
    DbgOutput.println(2, "enabled: " + enabled);
    fileMenu.setEnabled(enabled);
    newItem.setEnabled(enabled);
    openItem.setEnabled(enabled);
    closeItem.setEnabled(enabled);
    // dumpItem.setEnabled(enabled);
    flushItem.setEnabled(enabled);
    optionsItem.setEnabled(enabled);
    settingsItem.setEnabled(enabled);

    debugMenu.setEnabled(enabled);
    stepAction.setEnabled(enabled);
    stopAction.setEnabled(enabled);
    cancelAction.setEnabled(enabled);
    nextAction.setEnabled(enabled);
    contAction.setEnabled(enabled);
    breakpointsItem.setEnabled(enabled);

    opsMenu.setEnabled(enabled);
    insertItem.setEnabled(enabled);
    deleteItem.setEnabled(enabled);
    searchItem.setEnabled(enabled);
    executeItem.setEnabled(enabled);

    treeStatsMenu.setEnabled(enabled);
    utilItem.setEnabled(enabled);
    predSzItem.setEnabled(enabled);
    slotCntItem.setEnabled(enabled);

    analysisMenu.setEnabled(enabled);
    newAnalysisItem.setEnabled(enabled);
    openAnalysisItem.setEnabled(enabled);
    completeAnalysisItem.setEnabled(enabled);
    wkldStatsItem.setEnabled(enabled);
    splitStatsItem.setEnabled(enabled);
    penaltyStatsItem.setEnabled(enabled);

    // these are never disabled
    windowsMenu.setEnabled(true);
    showCmdsItem.setEnabled(true);
    showResultsItem.setEnabled(true);
    showTraceItem.setEnabled(true);
    tileItem.setEnabled(true);
  }
    public void show(Component invoker, int x, int y) {
      ViperViewMediator mediator = getMediator();
      Point pnt = new Point(x, y);
      EnhancedTable tab = getTable();
      int row = tab.rowAtPoint(pnt);
      desc = getCurrentModel().getDescriptorAtRow(row);
      int col = tab.columnAtPoint(pnt);
      Object cellValue = tab.getValueAt(row, col);
      if (cellValue instanceof Attribute) {
        attr = (Attribute) cellValue;

        // hide the "Occlusions..." option when we're not dealing with a Textline object
        boolean isTextline = attr.getAttrConfig().getAttrType().endsWith("textline");
        occlusions.setVisible(isTextline);
        occSeparator.setVisible(isTextline);

        Instant now = mediator.getCurrentFrame();
        if (now == null) {
          mediator.getDisplayWRTManager().setAttribute(null, null);
          wrt.setEnabled(false);
          wrt.setSelected(false);
        } else {
          boolean isDwrt = attr == mediator.getDisplayWRTManager().getAttribute();
          boolean dwrtable =
              (attr.getAttrValueAtInstant(now) instanceof HasCentroid
                  && attr.getDescriptor().getValidRange().contains(now));
          wrt.setEnabled(dwrtable);
          wrt.setSelected(isDwrt);
        }
      } else {
        attr = null;
        wrt.setEnabled(false);
        wrt.setSelected(false);
      }
      if (null != desc) {
        PropagateInterpolateModule proper = getMediator().getPropagator();
        p.setSelected(proper.isPropagatingThis(desc));
        v.setSelected(mediator.isThisValidNow(desc));
        resetMarks();
        super.show(invoker, x, y);
      }
    }
Esempio n. 5
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);
  }
Esempio n. 6
0
  public void setFood(Thing fd) {
    this.food = fd;
    ta.setText("                                     " + this.food.getMyName());
    if (((Food) this.food).perishable) {
      typeOfFood.get(1).setSelected(true);
    } else {
      typeOfFood.get(0).setSelected(true);
    }

    hiddenObstacle.setEnabled(true);
    if (food.returnIfWasHidden()) {
      hiddenObstacle.setSelected(true);

    } else {
      hiddenObstacle.setSelected(false);
    }
    setVisible(false);
  }
Esempio n. 7
0
  public void update() {

    newCreatureButton.setEnabled(false);
    newJewelButton.setEnabled(false);

    if (food != null) {

      for (JRadioButton tof : typeOfFood) {
        tof.setEnabled(false);
      }
      group.setSelected(model, false);

      hiddenObstacle.setEnabled(true);
      if (food.returnIfWasHidden()) {
        hiddenObstacle.setSelected(true);

      } else {
        hiddenObstacle.setSelected(false);
      }
    }
  }
    @Override
    public void run() {
      if (androidMode.getSDK() == null) return;

      final Devices devices = Devices.getInstance();
      java.util.List<Device> deviceList = devices.findMultiple(false);
      Device selectedDevice = devices.getSelectedDevice();

      if (deviceList.size() == 0) {
        // if (deviceMenu.getItem(0).isEnabled()) {
        if (0 < deviceMenu.getItemCount()) {
          deviceMenu.removeAll();
          JMenuItem noDevicesItem = new JMenuItem("No connected devices");
          noDevicesItem.setEnabled(false);
          deviceMenu.add(noDevicesItem);
        }
        devices.setSelectedDevice(null);
      } else {
        deviceMenu.removeAll();

        if (selectedDevice == null) {
          selectedDevice = deviceList.get(0);
          devices.setSelectedDevice(selectedDevice);
        } else {
          // check if selected device is still connected
          boolean found = false;
          for (Device device : deviceList) {
            if (device.equals(selectedDevice)) {
              found = true;
              break;
            }
          }

          if (!found) {
            selectedDevice = deviceList.get(0);
            devices.setSelectedDevice(selectedDevice);
          }
        }

        for (final Device device : deviceList) {
          final JCheckBoxMenuItem deviceItem = new JCheckBoxMenuItem(device.getName());
          deviceItem.setEnabled(true);

          if (device.equals(selectedDevice)) deviceItem.setState(true);

          // prevent checkboxmenuitem automatic state changing onclick
          deviceItem.addChangeListener(
              new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                  if (device.equals(devices.getSelectedDevice())) deviceItem.setState(true);
                  else deviceItem.setState(false);
                }
              });

          deviceItem.addActionListener(
              new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                  devices.setSelectedDevice(device);

                  for (int i = 0; i < deviceMenu.getItemCount(); i++) {
                    ((JCheckBoxMenuItem) deviceMenu.getItem(i)).setState(false);
                  }

                  deviceItem.setState(true);
                }
              });

          deviceMenu.add(deviceItem);
        }
      }
    }
Esempio n. 9
0
  private JPopupMenu getTerminPopupMenu() {
    JPopupMenu jPopupMenu = new JPopupMenu();
    JMenuItem jmen = new JMenuItem();
    jmen.setText(
        (this.desktop == 0
            ? "in den "
                + (SystemConfig.desktopHorizontal ? "unteren" : "rechten")
                + " Container verschieben"
            : "in den "
                + (SystemConfig.desktopHorizontal ? "oberen" : "linken")
                + " Container verschieben"));

    jmen.setIcon(
        (this.desktop == 0
            ? new ImageIcon(
                Reha.proghome
                    + (SystemConfig.desktopHorizontal ? "/icons/unten.gif" : "/icons/forward.gif"))
            : new ImageIcon(
                Reha.proghome
                    + (SystemConfig.desktopHorizontal
                        ? "/icons/oben.gif"
                        : "/icons/backward.gif"))));
    jmen.setRolloverEnabled(true);
    jmen.setEnabled(true);
    jmen.setActionCommand("verschieben");
    jmen.addActionListener(this);
    jPopupMenu.add(jmen);

    jPopupMenu.addSeparator();
    jmen = new JMenuItem();
    jmen.setText("jetzt(!) Fenster auf verfügbare Größe anpassen");
    jmen.setEnabled(true);
    jmen.setRolloverEnabled(true);
    jmen.setActionCommand("anpassen");
    jmen.addActionListener(this);
    jPopupMenu.add(jmen);
    jPopupMenu.addSeparator();

    JCheckBoxMenuItem cbMenuItem =
        new JCheckBoxMenuItem("stets versuchen das Fenster auf maximale Größe einstellen");
    cbMenuItem.setSelected((stetsgross ? true : false));
    cbMenuItem.setActionCommand("stetsgross");
    cbMenuItem.addActionListener(this);
    cbMenuItem.setEnabled(true);
    cbMenuItem.setRolloverEnabled(true);
    jPopupMenu.add(cbMenuItem);

    cbMenuItem = new JCheckBoxMenuItem("das Fenster immer so lassen wie es (nunmal) ist...");
    cbMenuItem.setSelected((!stetsgross ? true : false));
    cbMenuItem.setActionCommand("stetslassen");
    cbMenuItem.addActionListener(this);
    cbMenuItem.setEnabled(true);
    cbMenuItem.setRolloverEnabled(true);
    jPopupMenu.add(cbMenuItem);

    jPopupMenu.addSeparator();

    jmen = new JMenuItem();
    jmen.setText("Fenster zu Icon verkleinern");
    jmen.setIcon(new ImageIcon(Reha.proghome + "/icons/buttongreen.png"));
    jmen.setEnabled(true);
    jmen.setActionCommand("icon");
    jmen.addActionListener(this);
    jPopupMenu.add(jmen);

    jmen = new JMenuItem();
    jmen.setText("Fenster schließen");
    jmen.setIcon(new ImageIcon(Reha.proghome + "/icons/buttonred.png"));
    jmen.setEnabled(true);
    jmen.setActionCommand("schliessen");
    jmen.addActionListener(this);
    jPopupMenu.add(jmen);

    return jPopupMenu;
  }
    @Override
    public void mouseClicked(MouseEvent event) {
      Kenai.Status s = getKenaiStatus();
      if (event.getClickCount() == 2) {
        if (s == Kenai.Status.ONLINE) {
          ChatTopComponent.openAction(ChatTopComponent.findInstance(), "", "", false)
              .actionPerformed(new ActionEvent(event, event.getID(), "")); // NOI18N
        }
      } else {
        if (s != Kenai.Status.OFFLINE) {
          JPopupMenu menu = new JPopupMenu();
          final JMenuItem contactListMenu =
              new JMenuItem(NbBundle.getMessage(PresenceIndicator.class, "CTL_WhoIsOnlineAction"));
          menu.add(contactListMenu);
          contactListMenu.setEnabled(s == Kenai.Status.ONLINE);
          final JCheckBoxMenuItem onlineCheckBox =
              new JCheckBoxMenuItem(
                  NbBundle.getMessage(PresenceIndicator.class, "CTL_OnlineCheckboxMenuItem"),
                  s == Kenai.Status.ONLINE); // NOI18N
          menu.add(onlineCheckBox);

          for (final Kenai k : KenaiManager.getDefault().getKenais()) {
            if (k.getStatus() == Kenai.Status.OFFLINE) continue;
            JMenu m = new JMenu(k.getName());
            final JCheckBoxMenuItem onlineCheckBoxForKenai =
                new JCheckBoxMenuItem(
                    NbBundle.getMessage(PresenceIndicator.class, "CTL_OnlineCheckboxMenuItem"),
                    k.getStatus() == Kenai.Status.ONLINE); // NOI18N
            m.add(onlineCheckBoxForKenai);
            final JMenuItem logoutItem =
                new JMenuItem(
                    NbBundle.getMessage(PresenceIndicator.class, "CTL_LogoutMenuItem")); // NOI18N
            m.add(logoutItem);
            menu.add(m);

            onlineCheckBoxForKenai.setEnabled(Utilities.isChatSupported(k));
            onlineCheckBoxForKenai.addActionListener(
                new ActionListener() {

                  @Override
                  public void actionPerformed(ActionEvent e) {
                    try {
                      PasswordAuthentication passwordAuthentication = k.getPasswordAuthentication();
                      if (passwordAuthentication != null) {
                        k.login(
                            passwordAuthentication.getUserName(),
                            passwordAuthentication.getPassword(),
                            onlineCheckBoxForKenai.isSelected());
                      }
                    } catch (KenaiException ex) {
                      Exceptions.printStackTrace(ex);
                    }
                  }
                });

            logoutItem.addActionListener(
                new ActionListener() {

                  public void actionPerformed(ActionEvent e) {
                    RequestProcessor.getDefault()
                        .post(
                            new Runnable() {

                              @Override
                              public void run() {
                                k.logout();
                              }
                            });
                  }
                });
          }
          final JMenuItem logoutItem =
              new JMenuItem(
                  NbBundle.getMessage(PresenceIndicator.class, "CTL_LogoutMenuItem")); // NOI18N
          menu.add(logoutItem);
          onlineCheckBox.addActionListener(
              new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                  RequestProcessor.getDefault()
                      .post(
                          new Runnable() {

                            public void run() {
                              try {
                                for (Kenai kenai : KenaiManager.getDefault().getKenais()) {
                                  PasswordAuthentication passwordAuthentication =
                                      kenai.getPasswordAuthentication();
                                  if (passwordAuthentication != null
                                      && Utilities.isChatSupported(kenai)) {
                                    kenai.login(
                                        passwordAuthentication.getUserName(),
                                        passwordAuthentication.getPassword(),
                                        onlineCheckBox.isSelected());
                                  }
                                }
                              } catch (KenaiException ex) {
                                Exceptions.printStackTrace(ex);
                              }
                            }
                          });
                }
              });
          logoutItem.addActionListener(
              new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                  Actions.forID("Team", "org.netbeans.modules.team.ui.LogoutAction")
                      .actionPerformed(e);
                }
              });

          contactListMenu.addActionListener(new WhoIsOnlineAction());
          menu.show(label, event.getPoint().x, event.getPoint().y);
        }
      }
    }
Esempio n. 11
0
  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();
  }