Пример #1
0
  // -----------stops listeners and reestablish blocked menues-----------
  private void shutDownEverything() {
    this.removeMouseListener(mouseListener);
    this.removeMouseMotionListener(mouseListener);

    menuBar.getMenu(0).getMenuComponent(0).setEnabled(false); // keep everything disable (for now)
    menuBar.getMenu(0).getMenuComponent(1).setEnabled(false);
  }
Пример #2
0
  /** Disable the visual components in order to they are not functional in the AL process */
  public void setDisabledComponents() {

    comboBox.setEnabled(false);
    menubar.setEnabled(false);
    slider.setEnabled(false);
    menubar.getMenu(0).setEnabled(false);
  }
Пример #3
0
  /** Enable the visual components */
  public void enabledMetrics() {
    comboBox.setEnabled(true);
    menubar.setEnabled(true);
    menubar.getMenu(0).setEnabled(true);

    slider.setValue(1);
    slider.setMaximum(
        (evaluationsCollection.get(0).size() > 1) ? (evaluationsCollection.get(0).size() - 1) : 1);
    slider.setEnabled(true);
  }
Пример #4
0
  /**
   * Fired by a view when the figure seleciton changes. Since Commands and Tools are Actions and
   * they are registered to hear these events, they will handle themselves. So selection sensitive
   * menuitems will update their own states.
   *
   * @see DrawingEditor
   */
  public void figureSelectionChanged(DrawingView view) {
    JMenuBar mb = getJMenuBar();
    CommandMenu editMenu = (CommandMenu) mb.getMenu(EDIT_MENU);
    // make sure it does exist
    if (editMenu != null) {
      editMenu.checkEnabled();
    }
    CommandMenu alignmentMenu = (CommandMenu) mb.getMenu(ALIGNMENT_MENU);
    // make sure it does exist
    if (alignmentMenu != null) {
      alignmentMenu.checkEnabled();
    }

    JMenu attributeMenu = mb.getMenu(ATTRIBUTES_MENU);
    // make sure it does exist
    if (attributeMenu != null) {
      for (int i = 0; i < attributeMenu.getItemCount(); i++) {
        JMenuItem currentMenu = attributeMenu.getItem(i);
        if (currentMenu instanceof CommandMenu) {
          ((CommandMenu) currentMenu).checkEnabled();
        }
      }
    }
  }
Пример #5
0
 public boolean isValid(final KeyStroke keystroke, final Character keyChar) {
   if (keystroke == null) {
     return true;
   }
   final Node menuBarNode = menuBuilder.getMenuBar(menuBuilder.get(key));
   if (menuBarNode == null) {
     return true;
   }
   if (keyChar != KeyEvent.CHAR_UNDEFINED
       && (keystroke.getModifiers() & (Event.ALT_MASK | Event.CTRL_MASK | Event.META_MASK))
           == 0) {
     final String keyTypeActionString =
         ResourceController.getResourceController()
             .getProperty("key_type_action", FirstAction.EDIT_CURRENT.toString());
     FirstAction keyTypeAction = FirstAction.valueOf(keyTypeActionString);
     return FirstAction.IGNORE.equals(keyTypeAction);
   }
   if ((keystroke.getModifiers() & (Event.ALT_MASK | Event.CTRL_MASK | Event.META_MASK))
       == Event.ALT_MASK) {
     final JMenuBar menuBar = (JMenuBar) menuBarNode.getUserObject();
     final int menuCount = menuBar.getMenuCount();
     for (int i = 0; i < menuCount; i++) {
       final JMenu menu = menuBar.getMenu(i);
       final char c = (char) menu.getMnemonic();
       if (Character.toLowerCase(keystroke.getKeyCode()) == Character.toLowerCase(c)) {
         JOptionPane.showMessageDialog(
             parentComponent,
             menu.getText(),
             TextUtils.getText("used_in_menu"),
             JOptionPane.WARNING_MESSAGE);
         return false;
       }
     }
   }
   if (!checkForOverwriteShortcut(menuBarNode, keystroke)) {
     return false;
   }
   final KeyStroke derivedKS = FreeplaneMenuBar.derive(keystroke, keyChar);
   if (derivedKS == keystroke) {
     return true;
   }
   return checkForOverwriteShortcut(menuBarNode, derivedKS);
 }