예제 #1
0
            public void actionPerformed(ActionEvent e) {
              blurItem.setEnabled(!disablingItem.isSelected());
              embossItem.setEnabled(!disablingItem.isSelected());
              busyPainterItem.setEnabled(!disablingItem.isSelected());

              busyPainterUI.setLocked(disablingItem.isSelected());
            }
예제 #2
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());
    }
예제 #3
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);
   }
 }
예제 #4
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);
  }
예제 #5
0
  private void generateMenus() {

    _menuBar = new JMenuBar();

    JMenu menuFile = new JMenu("File");
    JMenu menuGame = new JMenu("Game");
    JMenu menuHelp = new JMenu("Help");

    menuFile.setMnemonic('f');
    menuGame.setMnemonic('g');
    menuHelp.setMnemonic('h');

    JMenuItem menuFileExit = new JMenuItem("Exit", 'x');
    JMenuItem menuFileNew = new JMenuItem("New", 'n');

    _menuGameGo = new JMenuItem("Go", 'g');
    _menuGamePause = new JMenuItem("Pause", 'p');
    _menuGamePause.setEnabled(false);

    JCheckBoxMenuItem menuGameZoomToggle = new JCheckBoxMenuItem("Zoom 2X", false);
    menuGameZoomToggle.setMnemonic('z');

    JMenuItem menuGameOptions = new JMenuItem("Options...", 'o');

    JMenuItem menuHelpAbout = new JMenuItem("About", 'a');

    menuFileExit.addActionListener(this);
    menuFileNew.addActionListener(this);

    _menuGameGo.addActionListener(this);
    _menuGamePause.addActionListener(this);
    menuGameZoomToggle.addActionListener(this);
    menuGameOptions.addActionListener(this);

    menuHelpAbout.addActionListener(this);

    menuFile.add(menuFileNew);
    menuFile.add(menuFileExit);

    menuGame.add(_menuGameGo);
    menuGame.add(_menuGamePause);
    menuGame.add(menuGameZoomToggle);
    menuGame.add(menuGameOptions);

    menuHelp.add(menuHelpAbout);

    _menuBar.add(menuFile);
    _menuBar.add(menuGame);
    _menuBar.add(menuHelp);

    setJMenuBar(_menuBar);
  }
예제 #6
0
 /** Configures a JCheckBoxMenuItem for an Action. */
 public static void configureJCheckBoxMenuItem(final JCheckBoxMenuItem mi, final Action a) {
   mi.setSelected((Boolean) a.getValue(Actions.SELECTED_KEY));
   PropertyChangeListener propertyHandler =
       new PropertyChangeListener() {
         public void propertyChange(PropertyChangeEvent evt) {
           if (evt.getPropertyName().equals(Actions.SELECTED_KEY)) {
             mi.setSelected((Boolean) a.getValue(Actions.SELECTED_KEY));
           }
         }
       };
   a.addPropertyChangeListener(propertyHandler);
   mi.putClientProperty("actionPropertyHandler", propertyHandler);
 }
예제 #7
0
  public Vector getItems() {
    Vector items = new Vector();

    ActionListener al = new PopupMenuHandler();

    JMenuItem colorItem = new JMenuItem(colorString);
    colorItem.addActionListener(al);
    items.addElement(colorItem);

    JCheckBoxMenuItem dashedItem = new JCheckBoxMenuItem(dashedString);
    dashedItem.setSelected(dashed);
    dashedItem.addActionListener(al);
    items.addElement(dashedItem);

    return items;
  }
예제 #8
0
  /** Initializes the core phone objects. */
  private void initializePhone() {
    // Load Preferences
    loadPreferences();

    if (preferences == null) {
      return;
    }

    guiManager = new GuiManager();
    guiManager.addUserActionListener(this);
    logManager = new LogManagerImpl(this);

    this.getLogManager().setRemoteLogging(true);

    try {
      EventQueue.invokeAndWait(
          new Runnable() {
            @Override
            public void run() {
              registerMenu = new JCheckBoxMenuItem(PhoneRes.getIString("phone.enabled"));
            }
          });
    } catch (Exception e) {
      Log.error(e);
    }

    registerMenu.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (getStatus() == SipRegisterStatus.Unregistered
                || getStatus() == SipRegisterStatus.RegistrationFailed) {

              register();
            } else {
              handleUnregisterRequest();
            }
          }
        });

    SIPConfig.setPreferredNetworkAddress(preferences.getPreferredAddress());
    NetworkAddressManager.start();

    try {
      EventQueue.invokeAndWait(
          new Runnable() {
            @Override
            public void run() {
              // Initialize Missed calls
              missedCalls = new MissedCalls();
            }
          });
    } catch (Exception e) {
      Log.error(e);
    }

    final JMenu actionsMenu =
        SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.actions"));
    actionsMenu.add(registerMenu);
  }
 @Override
 public void setUI(final MenuItemUI ui) {
   final MenuItemUI newUi =
       UIUtil.isUnderGTKLookAndFeel() && GtkMenuItemUI.isUiAcceptable(ui)
           ? new GtkMenuItemUI(ui)
           : ui;
   super.setUI(newUi);
 }
 @Override
 public void updateUI() {
   if (UIUtil.isStandardMenuLAF()) {
     super.updateUI();
   } else {
     setUI(BegMenuItemUI.createUI(this));
   }
 }
예제 #11
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);
  }
예제 #12
0
    public DescPropPopup() {
      super("Descriptor Properties");
      v = new JCheckBoxMenuItem("Valid");
      v.addActionListener(new ValidAction());
      p = new JCheckBoxMenuItem("Propagating");
      p.addActionListener(new PropAction());
      delete = new JMenuItem("Delete");
      delete.addActionListener(new DeleteAction());
      duplicate = new JMenuItem("Duplicate");
      duplicate.addActionListener(new DuplicateAction());
      interp = new JMenuItem("Interpolate...");
      interp.addActionListener(new InterpAction());
      interpToMark = new JMenu("Interpolate to Mark");
      interpToMark.setEnabled(false);
      itmAction = new InterpToMarkAction();
      shift = new JMenuItem("Shift...");
      shift.addActionListener(new ShiftAction());
      shiftToMark = new JMenu("Shift to Mark");
      shiftToMark.setEnabled(false);
      stmAction = new ShiftToMarkAction();

      occlusions = new JMenuItem("Occlusions...");
      occAction = new OccAction();
      occlusions.addActionListener(occAction);
      occSeparator = new JSeparator();

      wrt = new JCheckBoxMenuItem("Display with Respect To", false);
      wrt.addActionListener(new WithRespectToAction());

      add(occlusions);
      add(occSeparator);
      add(v);
      add(p);
      add(occSeparator);
      add(delete);
      add(duplicate);
      add(occSeparator);
      add(interp);
      add(interpToMark);
      add(occSeparator);
      add(shift);
      add(shiftToMark);
      add(occSeparator);
      add(wrt);
    }
예제 #13
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);
  }
예제 #14
0
 private JComponent createToolPanel() {
   JComponent box = Box.createVerticalBox();
   JCheckBox button = new JCheckBox(disablingItem.getText());
   button.setModel(disablingItem.getModel());
   box.add(Box.createGlue());
   box.add(button);
   box.add(Box.createGlue());
   JRadioButton blur = new JRadioButton(blurItem.getText());
   blur.setModel(blurItem.getModel());
   box.add(blur);
   JRadioButton emboss = new JRadioButton(embossItem.getText());
   emboss.setModel(embossItem.getModel());
   box.add(emboss);
   JRadioButton translucent = new JRadioButton(busyPainterItem.getText());
   translucent.setModel(busyPainterItem.getModel());
   box.add(translucent);
   box.add(Box.createGlue());
   return box;
 }
예제 #15
0
  /** Create the menu bar for the GUI */
  private void createMenu() {
    // Create menu bar
    menuBar = new JMenuBar();
    clientFrame.setJMenuBar(menuBar);

    // Create menus
    fileMenu = new JMenu("File");
    helpMenu = new JMenu("Help");

    // Add menus to bar
    menuBar.add(fileMenu);
    menuBar.add(helpMenu);

    // Create File Menu Items
    hostItem = new JCheckBoxMenuItem("Allow Uploads", true);
    portItem = new JCheckBoxMenuItem("Use Passive Mode", true);
    exitItem = new JMenuItem("Exit");

    // Add Items to File Menu
    fileMenu.add(hostItem);
    fileMenu.add(portItem);
    fileMenu.addSeparator();
    fileMenu.add(exitItem);

    // Create Help Menu Items
    helpItem = new JMenuItem("Help");
    aboutItem = new JMenuItem("About LeetFTP");

    // Add Items to Help Menu
    helpMenu.add(helpItem);
    helpMenu.addSeparator();
    helpMenu.add(aboutItem);

    // Create menu action handler and set it active
    MenuHandler menuHandler = new MenuHandler();

    hostItem.addActionListener(menuHandler);
    portItem.addActionListener(menuHandler);
    exitItem.addActionListener(menuHandler);
    helpItem.addActionListener(menuHandler);
    aboutItem.addActionListener(menuHandler);
  }
예제 #16
0
  private void addCovMatrixTestMenuItems(JMenu test) {
    IndTestType testType = getTestType();
    if (testType != IndTestType.FISHER_Z
    //                && testType != IndTestType.CORRELATION_T
    ) {
      setTestType(IndTestType.FISHER_Z);
    }

    ButtonGroup group = new ButtonGroup();
    JCheckBoxMenuItem fishersZ = new JCheckBoxMenuItem("Fisher's Z");
    group.add(fishersZ);
    test.add(fishersZ);

    //        JCheckBoxMenuItem tTest = new JCheckBoxMenuItem("Cramer's T");
    //        group.add(tTest);
    //        test.add(tTest);

    testType = getTestType();

    if (testType == IndTestType.FISHER_Z) {
      fishersZ.setSelected(true);
    }
    //        else if (testType == IndTestType.CORRELATION_T) {
    //            tTest.setSelected(true);
    //        }

    fishersZ.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setTestType(IndTestType.FISHER_Z);
            JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Using Fisher's Z.");
          }
        });

    //        tTest.addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                setTestType(IndTestType.CORRELATION_T);
    //                JOptionPane.showMessageDialog(JOptionUtils.centeringComp(),
    //                        "Using Cramer's T.");
    //            }
    //        });
  }
예제 #17
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);
      }
    }
  }
예제 #18
0
 private void createWindowsMenu() {
   windowsMenu = new JMenu("Windows");
   menuBar.add(windowsMenu);
   showCmdsItem = new JCheckBoxMenuItem("Show Commands");
   showCmdsItem.setState(true);
   windowsMenu.add(showCmdsItem);
   showResultsItem = new JCheckBoxMenuItem("Show Results");
   showResultsItem.setState(true);
   windowsMenu.add(showResultsItem);
   showTraceItem = new JCheckBoxMenuItem("Show Trace Output");
   showTraceItem.setState(true);
   windowsMenu.add(showTraceItem);
   tileItem = new JMenuItem("Tile");
   tileItem.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           MainWindow.this.tile();
         }
       });
   windowsMenu.add(tileItem);
 }
예제 #19
0
  @NotNull
  private JPopupMenu createMenu(final Node config) {
    JPopupMenu menu = new JPopupMenu();
    final JCheckBoxMenuItem showRpmItem = new JCheckBoxMenuItem("Show RPM");
    final JCheckBoxMenuItem showCommandsItem = new JCheckBoxMenuItem("Show Commands");
    showRpmItem.setSelected(showRpmPanel);
    ActionListener showCheckboxListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            showRpmPanel = showRpmItem.isSelected();
            showMessagesPanel = showCommandsItem.isSelected();
            config.setProperty(SHOW_RPM, showRpmPanel);
            config.setProperty(SHOW_MESSAGES, showMessagesPanel);
            applyShowFlags();
            // todo: this is not needed if we show/hide RPM panel. TODO: split into two different
            // listeners
            middleSplitPanel.setDividerLocation(0.5);
          }
        };
    showRpmItem.addActionListener(showCheckboxListener);
    showCommandsItem.addActionListener(showCheckboxListener);

    menu.add(showRpmItem);
    showCommandsItem.setSelected(showMessagesPanel);
    menu.add(showCommandsItem);
    menu.add(new JPopupMenu.Separator());
    menu.add(new JPopupMenu("Reset Config"));
    return menu;
  }
예제 #20
0
  private JMenuBar createMenuBar() {
    JMenu menu = new JMenu("Menu");

    disablingItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));

    menu.add(disablingItem);
    menu.addSeparator();

    blurItem.setSelected(true);
    blurItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_MASK));
    menu.add(blurItem);

    embossItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, InputEvent.ALT_MASK));
    menu.add(embossItem);

    busyPainterItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, InputEvent.ALT_MASK));
    menu.add(busyPainterItem);

    ButtonGroup group = new ButtonGroup();
    group.add(blurItem);
    group.add(embossItem);
    group.add(busyPainterItem);

    ItemListener menuListener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (blurItem.isSelected()) {
              //                    layer.setUI(blurUI);
            } else if (embossItem.isSelected()) {
              //                    layer.setUI(embossUI);
            } else if (busyPainterItem.isSelected()) {
              layer.setUI(busyPainterUI);
            }
          }
        };

    blurItem.addItemListener(menuListener);
    embossItem.addItemListener(menuListener);
    busyPainterItem.addItemListener(menuListener);

    //        embossUI.getUnlockButton().addActionListener(new ActionListener() {
    //            public void actionPerformed(ActionEvent e) {
    //                disablingItem.doClick();
    //            }
    //        });

    JMenuBar bar = new JMenuBar();
    bar.add(menu);

    bar.add(new LafMenu());
    return bar;
  }
예제 #21
0
  /**
   * Fired when softphone is register sucessfully
   *
   * @param evt RegistrationEvent
   */
  public void registered(RegistrationEvent evt) {
    status = SipRegisterStatus.Registered;

    preferences.setPreferredAddress(NetworkAddressManager.getLocalHost().getHostAddress());
    // preference.commit();

    registerStatusChanged(new RegisterEvent(this, SipRegisterStatus.Registered, evt.getReason()));

    if (callTo.length() > 2) {
      handleDialRequest(callTo);
    }
    registerMenu.setSelected(true);
  }
예제 #22
0
 /**
  * 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);
     }
   }
 }
예제 #23
0
 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());
 }
예제 #24
0
    // {{{ showPopupMenu method
    private void showPopupMenu(MouseEvent evt) {
      TreePath path = resultTree.getSelectionPath();
      DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();

      popupMenu = new JPopupMenu();
      Object userObj = node.getUserObject();
      if (userObj instanceof HyperSearchFileNode || userObj instanceof HyperSearchResult) {
        popupMenu.add(new GoToNodeAction("hypersearch-results.open", M_OPEN));
        popupMenu.add(new GoToNodeAction("hypersearch-results.open-view", M_OPEN_NEW_VIEW));
        popupMenu.add(
            new GoToNodeAction("hypersearch-results.open-plain-view", M_OPEN_NEW_PLAIN_VIEW));
        popupMenu.add(new GoToNodeAction("hypersearch-results.open-split", M_OPEN_NEW_SPLIT));
      }
      if (!(userObj instanceof HyperSearchFolderNode)) popupMenu.add(new RemoveTreeNodeAction());
      popupMenu.add(new ExpandChildTreeNodesAction());
      if (userObj instanceof HyperSearchFolderNode || userObj instanceof HyperSearchOperationNode) {
        popupMenu.add(new CollapseChildTreeNodesAction());
        if (userObj instanceof HyperSearchFolderNode) popupMenu.add(new NewSearchAction());
      }
      if (userObj instanceof HyperSearchOperationNode) {
        popupMenu.add(new JPopupMenu.Separator());
        HyperSearchOperationNode resultNode = (HyperSearchOperationNode) userObj;
        JCheckBoxMenuItem chkItem =
            new JCheckBoxMenuItem(
                jEdit.getProperty("hypersearch-results.tree-view"),
                resultNode.isTreeViewDisplayed());
        chkItem.addActionListener(new TreeDisplayAction());
        popupMenu.add(chkItem);

        popupMenu.add(new RedoSearchAction((HyperSearchOperationNode) userObj));
      }
      popupMenu.add(new CopyToClipboardAction());

      GUIUtilities.showPopupMenu(popupMenu, evt.getComponent(), evt.getX(), evt.getY());
      evt.consume();
    } // }}}
예제 #25
0
  /**
   * Make the view menu
   *
   * @param viewMenu view menu
   * @return The view menu
   */
  public JMenu makeViewMenu(JMenu viewMenu) {
    showAlignmentPointsMI = new JCheckBoxMenuItem("Show Alignment Points", true);
    viewMenu.add(showAlignmentPointsMI);
    showAlignmentPointsMI.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            repaint();
          }
        });

    viewMenu.addSeparator();
    super.makeViewMenu(viewMenu);
    viewMenu.addSeparator();
    viewMenu.add(makeMenuItem("Black background", CMD_BLACKBG));
    viewMenu.add(makeMenuItem("White background", CMD_WHITEBG));
    return viewMenu;
  }
예제 #26
0
  /**
   * Fired when softphone is unregistered sucessfully
   *
   * @param evt RegistrationEvent
   */
  public void unregistered(RegistrationEvent evt) {
    try {
      status = SipRegisterStatus.Unregistered;

      registerStatusChanged(
          new RegisterEvent(this, SipRegisterStatus.Unregistered, evt.getReason()));

      // we could now exit
      synchronized (unregistrationLock) {
        unregistrationLock.notifyAll();
      }

      destroySoftPhone();
      registerMenu.setSelected(false);
    } catch (Exception e) {
      Log.error("unregistered", e);
    }
  }
예제 #27
0
    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);
      }
    }
예제 #28
0
 public void registrationFailed(RegistrationEvent evt) {
   status = SipRegisterStatus.RegistrationFailed;
   registerStatusChanged(
       new RegisterEvent(this, SipRegisterStatus.RegistrationFailed, evt.getReason()));
   registerMenu.setSelected(false);
 }
예제 #29
0
    public static void makeMenuBar(JFrame frame, final AirspaceBuilderController controller) {
      JMenuBar menuBar = new JMenuBar();
      final JCheckBoxMenuItem resizeNewShapesItem;
      final JCheckBoxMenuItem enableEditItem;

      JMenu menu = new JMenu("File");
      {
        JMenuItem item = new JMenuItem("Open...");
        item.setAccelerator(
            KeyStroke.getKeyStroke(
                KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
        item.setActionCommand(OPEN);
        item.addActionListener(controller);
        menu.add(item);

        item = new JMenuItem("Open URL...");
        item.setActionCommand(OPEN_URL);
        item.addActionListener(controller);
        menu.add(item);

        item = new JMenuItem("Save...");
        item.setAccelerator(
            KeyStroke.getKeyStroke(
                KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
        item.setActionCommand(SAVE);
        item.addActionListener(controller);
        menu.add(item);

        menu.addSeparator();

        item = new JMenuItem("Load Demo Shapes");
        item.setActionCommand(OPEN_DEMO_AIRSPACES);
        item.addActionListener(controller);
        menu.add(item);
      }
      menuBar.add(menu);

      menu = new JMenu("Shape");
      {
        JMenu subMenu = new JMenu("New");
        for (final AirspaceFactory factory : defaultAirspaceFactories) {
          JMenuItem item = new JMenuItem(factory.toString());
          item.addActionListener(
              new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                  controller.createNewEntry(factory);
                }
              });
          subMenu.add(item);
        }
        menu.add(subMenu);

        resizeNewShapesItem = new JCheckBoxMenuItem("Fit new shapes to viewport");
        resizeNewShapesItem.setActionCommand(SIZE_NEW_SHAPES_TO_VIEWPORT);
        resizeNewShapesItem.addActionListener(controller);
        resizeNewShapesItem.setState(controller.isResizeNewShapesToViewport());
        menu.add(resizeNewShapesItem);

        enableEditItem = new JCheckBoxMenuItem("Enable shape editing");
        enableEditItem.setActionCommand(ENABLE_EDIT);
        enableEditItem.addActionListener(controller);
        enableEditItem.setState(controller.isEnableEdit());
        menu.add(enableEditItem);
      }
      menuBar.add(menu);

      menu = new JMenu("Selection");
      {
        JMenuItem item = new JMenuItem("Deselect");
        item.setAccelerator(
            KeyStroke.getKeyStroke(
                KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
        item.setActionCommand(CLEAR_SELECTION);
        item.addActionListener(controller);
        menu.add(item);

        item = new JMenuItem("Delete");
        item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
        item.setActionCommand(REMOVE_SELECTED);
        item.addActionListener(controller);
        menu.add(item);
      }
      menuBar.add(menu);

      frame.setJMenuBar(menuBar);

      controller.addPropertyChangeListener(
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
              if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals((e.getPropertyName()))) {
                resizeNewShapesItem.setSelected(controller.isResizeNewShapesToViewport());
              } else if (ENABLE_EDIT.equals(e.getPropertyName())) {
                enableEditItem.setSelected(controller.isEnableEdit());
              }
            }
          });
    }
예제 #30
0
  // Method builds menu action listeners.
  private void buildMenuActionListeners() {
    /*
    || Section adds action listeners to window frame menus:
    || ===================================================
    ||  - Menu file:
    ||    ---------
    ||    - menuItemSend
    ||    - menuItemReceive
    ||    - menuItemExit
    ||
    ||  - Menu edit:
    ||    ---------
    ||    - menuItemHelp
    */

    // ---------------------------------/
    // Menu item listeners to file menu.
    // ---------------------------------/

    menuItemNew.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // New file.
            newFile();
          } // End of actionPerformed method.
        }); // End of menuItemNew action listener.

    menuItemOpen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Open file.
            openFile();
          } // End of actionPerformed method.
        }); // End of menuItemOpen action listener.

    menuItemClose.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Close file.
            closeFile();
          } // End of actionPerformed method.
        }); // End of menuItemClose action listener.

    menuItemSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Save current sender JTextAreaPanel String as current file.
            saveFile();
          } // End of actionPerformed method.
        }); // End of menuItemSave action listener.

    menuItemSaveAs.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Save current sender JTextAreaPanel String as new file.
            saveAsFile();
          } // End of actionPerformed method.
        }); // End of menuItemSaveAs action listener.

    menuItemExit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Exit the system on menu exit.
            System.exit(0);
          } // End of actionPerformed() method.
        }); // End of menuItemExit action listener.

    menuItemSend.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Send message.
            setMessage(sender, receiver);
          } // End of actionPerformed() method.
        }); // End of menuItemSend action listener.

    menuItemReceive.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Receive message.
            getMessage(receiver);
          } // End of actionPerformed() method.
        }); // End of menuItemReceive action listener.

    menuItemConnect.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Functionality to be implemented.
            System.out.println("This is future functionality to Connect to DB.");
          } // End of actionPerformed() method.
        }); // End of menuItemConnect action listener.

    menuItemSubmit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Functionality to be implemented.
            System.out.println("This is future functionality to Submit SQL.");
          } // End of actionPerformed() method.
        }); // End of menuItemSubmit action listener.

    // ---------------------------------/
    // Menu item listeners to help menu.
    // ---------------------------------/

    // Add menu item listeners for debug check box menu item.
    menuCheckBoxItemDebug.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            // Set stack trace enablement to opposite state.
            setDebugEnabled(!getDebugEnabled());
          } // End of actionPerformed method.
        }); // End of menuCheckBoxItemDebug item listener.

    // Add menu item action listener for help menu.
    menuItemHelp.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // Call inner class help handler.
            new HelpHandler(JMessagingFrame.this, true);
          } // End of actionPerformed() method.
        }); // End of menuItemHelp action listener.
  } // End of buildMenuActionListeners() method.