List of usage examples for java.awt.event ActionEvent ActionEvent
public ActionEvent(Object source, int id, String command)
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Creates and shows the GUI. Called by the swing application framework *///from w w w . j a v a 2s . c o m @Override protected void startup() { final JFrame mainFrame = getMainFrame(); _defaultGlassPane = mainFrame.getGlassPane(); mainFrame.setTitle("Intkey"); mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); mainFrame.setIconImages(IconHelper.getRedIconList()); _helpController = new HelpController(HELPSET_PATH); _taxonformatter = new ItemFormatter(false, CommentStrippingMode.STRIP_ALL, AngleBracketHandlingMode.REMOVE, true, false, true); _context = new IntkeyContext(new IntkeyUIInterceptor(this), new DirectivePopulatorInterceptor(this)); _advancedModeOnlyDynamicButtons = new ArrayList<JButton>(); _normalModeOnlyDynamicButtons = new ArrayList<JButton>(); _activeOnlyWhenCharactersUsedButtons = new ArrayList<JButton>(); _dynamicButtonsFullHelp = new HashMap<JButton, String>(); ActionMap actionMap = getContext().getActionMap(); _rootPanel = new JPanel(); _rootPanel.setAlignmentX(Component.LEFT_ALIGNMENT); _rootPanel.setBackground(SystemColor.control); _rootPanel.setLayout(new BorderLayout(0, 0)); _globalOptionBar = new JPanel(); _globalOptionBar.setBorder(new EmptyBorder(0, 5, 0, 5)); _rootPanel.add(_globalOptionBar, BorderLayout.NORTH); _globalOptionBar.setLayout(new BorderLayout(0, 0)); _pnlDynamicButtons = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) _pnlDynamicButtons.getLayout(); flowLayout_1.setVgap(0); flowLayout_1.setHgap(0); _globalOptionBar.add(_pnlDynamicButtons, BorderLayout.WEST); _btnContextHelp = new JButton(); _btnContextHelp.setMinimumSize(new Dimension(30, 30)); _btnContextHelp.setMaximumSize(new Dimension(30, 30)); _btnContextHelp.setAction(actionMap.get("btnContextHelp")); _btnContextHelp.setPreferredSize(new Dimension(30, 30)); _btnContextHelp.setMargin(new Insets(2, 5, 2, 5)); _btnContextHelp.addActionListener(actionMap.get("btnContextHelp")); _globalOptionBar.add(_btnContextHelp, BorderLayout.EAST); _rootSplitPane = new JSplitPane(); _rootSplitPane.setDividerSize(3); _rootSplitPane.setResizeWeight(0.5); _rootSplitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); _rootSplitPane.setContinuousLayout(true); _rootPanel.add(_rootSplitPane); _innerSplitPaneLeft = new JSplitPane(); _innerSplitPaneLeft.setMinimumSize(new Dimension(25, 25)); _innerSplitPaneLeft.setAlignmentX(Component.CENTER_ALIGNMENT); _innerSplitPaneLeft.setDividerSize(3); _innerSplitPaneLeft.setResizeWeight(0.5); _innerSplitPaneLeft.setContinuousLayout(true); _innerSplitPaneLeft.setOrientation(JSplitPane.VERTICAL_SPLIT); _rootSplitPane.setLeftComponent(_innerSplitPaneLeft); _pnlAvailableCharacters = new JPanel(); _innerSplitPaneLeft.setLeftComponent(_pnlAvailableCharacters); _pnlAvailableCharacters.setLayout(new BorderLayout(0, 0)); _sclPaneAvailableCharacters = new JScrollPane(); _pnlAvailableCharacters.add(_sclPaneAvailableCharacters, BorderLayout.CENTER); _listAvailableCharacters = new JList(); // _listAvailableCharacters.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); _listAvailableCharacters.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); _listAvailableCharacters.setCellRenderer(_availableCharactersListCellRenderer); _listAvailableCharacters.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { int selectedIndex = _listAvailableCharacters.getSelectedIndex(); if (selectedIndex >= 0) { try { Character ch = (Character) _availableCharacterListModel.getElementAt(selectedIndex); executeDirective(new UseDirective(), Integer.toString(ch.getCharacterId())); } catch (Exception ex) { ex.printStackTrace(); } } } } }); _sclPaneAvailableCharacters.setViewportView(_listAvailableCharacters); _pnlAvailableCharactersHeader = new JPanel(); _pnlAvailableCharacters.add(_pnlAvailableCharactersHeader, BorderLayout.NORTH); _pnlAvailableCharactersHeader.setLayout(new BorderLayout(0, 0)); _lblNumAvailableCharacters = new JLabel(); _lblNumAvailableCharacters.setBorder(new EmptyBorder(0, 5, 0, 0)); _lblNumAvailableCharacters.setFont(new Font("Tahoma", Font.PLAIN, 15)); _lblNumAvailableCharacters.setText(MessageFormat.format(availableCharactersCaption, 0)); _pnlAvailableCharactersHeader.add(_lblNumAvailableCharacters, BorderLayout.WEST); _pnlAvailableCharactersButtons = new JPanel(); FlowLayout flowLayout = (FlowLayout) _pnlAvailableCharactersButtons.getLayout(); flowLayout.setVgap(2); flowLayout.setHgap(2); _pnlAvailableCharactersHeader.add(_pnlAvailableCharactersButtons, BorderLayout.EAST); // All toolbar buttons should be disabled until a dataset is loaded. _btnRestart = new JButton(); _btnRestart.setAction(actionMap.get("btnRestart")); _btnRestart.setPreferredSize(new Dimension(30, 30)); _btnRestart.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnRestart); _btnBestOrder = new JButton(); _btnBestOrder.setAction(actionMap.get("btnBestOrder")); _btnBestOrder.setPreferredSize(new Dimension(30, 30)); _btnBestOrder.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnBestOrder); _btnSeparate = new JButton(); _btnSeparate.setAction(actionMap.get("btnSeparate")); _btnSeparate.setVisible(_advancedMode); _btnSeparate.setPreferredSize(new Dimension(30, 30)); _btnSeparate.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnSeparate); _btnNaturalOrder = new JButton(); _btnNaturalOrder.setAction(actionMap.get("btnNaturalOrder")); _btnNaturalOrder.setPreferredSize(new Dimension(30, 30)); _btnNaturalOrder.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnNaturalOrder); _btnDiffSpecimenTaxa = new JButton(); _btnDiffSpecimenTaxa.setAction(actionMap.get("btnDiffSpecimenTaxa")); _btnDiffSpecimenTaxa.setEnabled(false); _btnDiffSpecimenTaxa.setPreferredSize(new Dimension(30, 30)); _pnlAvailableCharactersButtons.add(_btnDiffSpecimenTaxa); _btnSetTolerance = new JButton(); _btnSetTolerance.setAction(actionMap.get("btnSetTolerance")); _btnSetTolerance.setPreferredSize(new Dimension(30, 30)); _btnSetTolerance.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnSetTolerance); _btnSetMatch = new JButton(); _btnSetMatch.setAction(actionMap.get("btnSetMatch")); _btnSetMatch.setVisible(_advancedMode); _btnSetMatch.setPreferredSize(new Dimension(30, 30)); _btnSetMatch.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnSetMatch); _btnSubsetCharacters = new JButton(); _btnSubsetCharacters.setAction(actionMap.get("btnSubsetCharacters")); _btnSubsetCharacters.setPreferredSize(new Dimension(30, 30)); _btnSubsetCharacters.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnSubsetCharacters); _btnFindCharacter = new JButton(); _btnFindCharacter.setAction(actionMap.get("btnFindCharacter")); _btnFindCharacter.setPreferredSize(new Dimension(30, 30)); _btnFindCharacter.setEnabled(false); _pnlAvailableCharactersButtons.add(_btnFindCharacter); _pnlAvailableCharactersButtons.setEnabled(false); _pnlUsedCharacters = new JPanel(); _innerSplitPaneLeft.setRightComponent(_pnlUsedCharacters); _pnlUsedCharacters.setLayout(new BorderLayout(0, 0)); _sclPnUsedCharacters = new JScrollPane(); _pnlUsedCharacters.add(_sclPnUsedCharacters, BorderLayout.CENTER); _listUsedCharacters = new JList(); _listUsedCharacters.setCellRenderer(_usedCharactersListCellRenderer); _listUsedCharacters.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); _listUsedCharacters.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { int selectedIndex = _listUsedCharacters.getSelectedIndex(); if (selectedIndex >= 0) { try { Attribute attr = (Attribute) _usedCharacterListModel.getElementAt(selectedIndex); if (_context.charactersFixed() && _context.getFixedCharactersList() .contains(attr.getCharacter().getCharacterId())) { return; } executeDirective(new ChangeDirective(), Integer.toString(attr.getCharacter().getCharacterId())); } catch (Exception ex) { ex.printStackTrace(); } } } } }); _sclPnUsedCharacters.setViewportView(_listUsedCharacters); _pnlUsedCharactersHeader = new JPanel(); _pnlUsedCharacters.add(_pnlUsedCharactersHeader, BorderLayout.NORTH); _pnlUsedCharactersHeader.setLayout(new BorderLayout(0, 0)); _lblNumUsedCharacters = new JLabel(); _lblNumUsedCharacters.setBorder(new EmptyBorder(7, 5, 7, 0)); _lblNumUsedCharacters.setFont(new Font("Tahoma", Font.PLAIN, 15)); _lblNumUsedCharacters.setText(MessageFormat.format(usedCharactersCaption, 0)); _pnlUsedCharactersHeader.add(_lblNumUsedCharacters, BorderLayout.WEST); _innerSplitPaneRight = new JSplitPane(); _innerSplitPaneRight.setMinimumSize(new Dimension(25, 25)); _innerSplitPaneRight.setDividerSize(3); _innerSplitPaneRight.setResizeWeight(0.5); _innerSplitPaneRight.setContinuousLayout(true); _innerSplitPaneRight.setOrientation(JSplitPane.VERTICAL_SPLIT); _rootSplitPane.setRightComponent(_innerSplitPaneRight); _pnlRemainingTaxa = new JPanel(); _innerSplitPaneRight.setLeftComponent(_pnlRemainingTaxa); _pnlRemainingTaxa.setLayout(new BorderLayout(0, 0)); _sclPnRemainingTaxa = new JScrollPane(); _pnlRemainingTaxa.add(_sclPnRemainingTaxa, BorderLayout.CENTER); _listRemainingTaxa = new JList(); _listRemainingTaxa.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { displayInfoForSelectedTaxa(); } } }); _sclPnRemainingTaxa.setViewportView(_listRemainingTaxa); _pnlRemainingTaxaHeader = new JPanel(); _pnlRemainingTaxa.add(_pnlRemainingTaxaHeader, BorderLayout.NORTH); _pnlRemainingTaxaHeader.setLayout(new BorderLayout(0, 0)); _lblNumRemainingTaxa = new JLabel(); _lblNumRemainingTaxa.setBorder(new EmptyBorder(0, 5, 0, 0)); _lblNumRemainingTaxa.setFont(new Font("Tahoma", Font.PLAIN, 15)); _lblNumRemainingTaxa.setText(MessageFormat.format(remainingTaxaCaption, 0)); _pnlRemainingTaxaHeader.add(_lblNumRemainingTaxa, BorderLayout.WEST); _pnlRemainingTaxaButtons = new JPanel(); FlowLayout fl_pnlRemainingTaxaButtons = (FlowLayout) _pnlRemainingTaxaButtons.getLayout(); fl_pnlRemainingTaxaButtons.setVgap(2); fl_pnlRemainingTaxaButtons.setHgap(2); _pnlRemainingTaxaHeader.add(_pnlRemainingTaxaButtons, BorderLayout.EAST); // All toolbar buttons should be disabled until a dataset is loaded. _btnTaxonInfo = new JButton(); _btnTaxonInfo.setAction(actionMap.get("btnTaxonInfo")); _btnTaxonInfo.setPreferredSize(new Dimension(30, 30)); _btnTaxonInfo.setEnabled(false); _pnlRemainingTaxaButtons.add(_btnTaxonInfo); _btnDiffTaxa = new JButton(); _btnDiffTaxa.setAction(actionMap.get("btnDiffTaxa")); _btnDiffTaxa.setPreferredSize(new Dimension(30, 30)); _btnDiffTaxa.setEnabled(false); _pnlRemainingTaxaButtons.add(_btnDiffTaxa); _btnSubsetTaxa = new JButton(); _btnSubsetTaxa.setAction(actionMap.get("btnSubsetTaxa")); _btnSubsetTaxa.setPreferredSize(new Dimension(30, 30)); _btnSubsetTaxa.setEnabled(false); _pnlRemainingTaxaButtons.add(_btnSubsetTaxa); _btnFindTaxon = new JButton(); _btnFindTaxon.setAction(actionMap.get("btnFindTaxon")); _btnFindTaxon.setPreferredSize(new Dimension(30, 30)); _btnFindTaxon.setEnabled(false); _pnlRemainingTaxaButtons.add(_btnFindTaxon); _pnlEliminatedTaxa = new JPanel(); _innerSplitPaneRight.setRightComponent(_pnlEliminatedTaxa); _pnlEliminatedTaxa.setLayout(new BorderLayout(0, 0)); _sclPnEliminatedTaxa = new JScrollPane(); _pnlEliminatedTaxa.add(_sclPnEliminatedTaxa, BorderLayout.CENTER); _listEliminatedTaxa = new JList(); _listEliminatedTaxa.addMouseListener(new MouseInputAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { displayInfoForSelectedTaxa(); } } }); _sclPnEliminatedTaxa.setViewportView(_listEliminatedTaxa); _pnlEliminatedTaxaHeader = new JPanel(); _pnlEliminatedTaxa.add(_pnlEliminatedTaxaHeader, BorderLayout.NORTH); _pnlEliminatedTaxaHeader.setLayout(new BorderLayout(0, 0)); _lblEliminatedTaxa = new JLabel(); _lblEliminatedTaxa.setBorder(new EmptyBorder(7, 5, 7, 0)); _lblEliminatedTaxa.setFont(new Font("Tahoma", Font.PLAIN, 15)); _lblEliminatedTaxa.setText(MessageFormat.format(eliminatedTaxaCaption, 0)); _pnlEliminatedTaxaHeader.add(_lblEliminatedTaxa, BorderLayout.WEST); JMenuBar menuBar = buildMenus(_advancedMode); getMainView().setMenuBar(menuBar); _txtFldCmdBar = new JTextField(); _txtFldCmdBar.setCaretColor(Color.WHITE); _txtFldCmdBar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String cmdStr = _txtFldCmdBar.getText(); cmdStr = cmdStr.trim(); if (_cmdMenus.containsKey(cmdStr)) { JMenu cmdMenu = _cmdMenus.get(cmdStr); cmdMenu.doClick(); } else { _context.parseAndExecuteDirective(cmdStr); } _txtFldCmdBar.setText(null); } }); _txtFldCmdBar.setFont(new Font("Courier New", Font.BOLD, 13)); _txtFldCmdBar.setForeground(SystemColor.text); _txtFldCmdBar.setBackground(Color.BLACK); _txtFldCmdBar.setOpaque(true); _txtFldCmdBar.setVisible(_advancedMode); _rootPanel.add(_txtFldCmdBar, BorderLayout.SOUTH); _txtFldCmdBar.setColumns(10); _logDialog = new RtfReportDisplayDialog(getMainFrame(), new SimpleRtfEditorKit(null), null, logDialogTitle); // Set context-sensitive help keys for toolbar buttons _helpController.setHelpKeyForComponent(_btnRestart, HELP_ID_CHARACTERS_TOOLBAR_RESTART); _helpController.setHelpKeyForComponent(_btnBestOrder, HELP_ID_CHARACTERS_TOOLBAR_BEST); _helpController.setHelpKeyForComponent(_btnSeparate, HELP_ID_CHARACTERS_TOOLBAR_SEPARATE); _helpController.setHelpKeyForComponent(_btnNaturalOrder, HELP_ID_CHARACTERS_TOOLBAR_NATURAL); _helpController.setHelpKeyForComponent(_btnDiffSpecimenTaxa, HELP_ID_CHARACTERS_TOOLBAR_DIFF_SPECIMEN_REMAINING); _helpController.setHelpKeyForComponent(_btnSetTolerance, HELP_ID_CHARACTERS_TOOLBAR_TOLERANCE); _helpController.setHelpKeyForComponent(_btnSetMatch, HELP_ID_CHARACTERS_TOOLBAR_SET_MATCH); _helpController.setHelpKeyForComponent(_btnSubsetCharacters, HELP_ID_CHARACTERS_TOOLBAR_SUBSET_CHARACTERS); _helpController.setHelpKeyForComponent(_btnFindCharacter, HELP_ID_CHARACTERS_TOOLBAR_FIND_CHARACTERS); _helpController.setHelpKeyForComponent(_btnTaxonInfo, HELP_ID_TAXA_TOOLBAR_INFO); _helpController.setHelpKeyForComponent(_btnDiffTaxa, HELP_ID_TAXA_TOOLBAR_DIFF_TAXA); _helpController.setHelpKeyForComponent(_btnSubsetTaxa, HELP_ID_TAXA_TOOLBAR_SUBSET_TAXA); _helpController.setHelpKeyForComponent(_btnFindTaxon, HELP_ID_TAXA_TOOLBAR_FIND_TAXA); // This mouse listener on the default glasspane is to assist with // context senstive help. It intercepts the mouse events, // determines what component was being clicked on, then takes the // appropriate action to provide help for the component _defaultGlassPane.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // Determine what point has been clicked on Point glassPanePoint = e.getPoint(); Point containerPoint = SwingUtilities.convertPoint(getMainFrame().getGlassPane(), glassPanePoint, getMainFrame().getContentPane()); Component component = SwingUtilities.getDeepestComponentAt(getMainFrame().getContentPane(), containerPoint.x, containerPoint.y); // Get the java help ID for this component. If none has been // defined, this will be null String helpID = _helpController.getHelpKeyForComponent(component); // change the cursor back to the normal one and take down the // classpane mainFrame.setCursor(Cursor.getDefaultCursor()); mainFrame.getGlassPane().setVisible(false); // If a help ID was found, display the related help page in the // help viewer if (_helpController.getHelpKeyForComponent(component) != null) { _helpController.helpAction().actionPerformed(new ActionEvent(component, 0, null)); _helpController.displayHelpTopic(mainFrame, helpID); } else { // If a dynamically-defined toolbar button was clicked, show // the help for this button in the ToolbarHelpDialog. if (component instanceof JButton) { JButton button = (JButton) component; if (_dynamicButtonsFullHelp.containsKey(button)) { String fullHelpText = _dynamicButtonsFullHelp.get(button); if (fullHelpText == null) { fullHelpText = noHelpAvailableCaption; } RTFBuilder builder = new RTFBuilder(); builder.startDocument(); builder.appendText(fullHelpText); builder.endDocument(); ToolbarHelpDialog dlg = new ToolbarHelpDialog(mainFrame, builder.toString(), button.getIcon()); show(dlg); } } } } }); show(_rootPanel); }
From source file:com.servoy.j2db.util.Utils.java
public static int streamCopy(InputStream is, OutputStream os, ActionListener l, int actionSize) throws IOException { int actionBlock = actionSize; if (is == null || os == null) return 0; int bufferSize = 128; byte[] buffer = new byte[bufferSize]; int length = 0; int totalLength = 0; while ((length = is.read(buffer)) >= 0) { os.write(buffer, 0, length);/* w ww . ja va 2 s. co m*/ totalLength += length; if (actionSize > 0 && totalLength > actionBlock) { actionBlock += actionSize; if (l != null) l.actionPerformed(new ActionEvent("streamCopy", ActionEvent.ACTION_PERFORMED, "streamCopy")); //$NON-NLS-1$ //$NON-NLS-2$ } } return totalLength; }
From source file:com.t3.client.ui.T3Frame.java
public void closingMaintenance() { if (AppPreferences.getSaveReminder()) { if (TabletopTool.getPlayer().isGM()) { int result = TabletopTool.confirmImpl(I18N.getText("msg.title.saveCampaign"), JOptionPane.YES_NO_CANCEL_OPTION, "msg.confirm.saveCampaign", (Object[]) null); // int result = JOptionPane.showConfirmDialog(TabletopTool.getFrame(), I18N.getText("msg.confirm.saveCampaign"), I18N.getText("msg.title.saveCampaign"), JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) { return; }/* www.j av a2 s . co m*/ if (result == JOptionPane.YES_OPTION) { final Observer callback = new Observer() { @Override public void update(java.util.Observable o, Object arg) { if (arg instanceof String) { // There was an error during the save -- don't terminate TabletopTool! } else { TabletopTool.getFrame().close(); } } }; ActionEvent ae = new ActionEvent(callback, 0, "close"); AppActions.SAVE_CAMPAIGN.actionPerformed(ae); return; } } else { if (!TabletopTool.confirm("msg.confirm.disconnecting")) { return; } } } close(); }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep4(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step4.1", "Import"), localeDelegate.getMessage( "dbtransfer.import.step4.2", "Der Import der Konfiguration kann nun gestartet werden.")); utils.initJPanel(step, new double[] { 180, TableLayout.FILL }, new double[] { TableLayout.PREFERRED, 10, TableLayout.PREFERRED, TableLayout.PREFERRED }); final JLabel lbWarning = new JLabel("<html>" + localeDelegate.getMessage("dbtransfer.import.step4.3", " <b>Achtung</b>: Durch den Konfigurationsimport werden Teile der Konfiguration auf diesem System \u00fcberschrieben!<br>" + "Vor dem Import wird dringend empfohlen ein Backup der Datenbank durchzuf\u00fchren.<br><br>" + "Wollen Sie fortfahren und den Konfigurationimport starten?") + "</html>"); final JButton btnStartImport = new JButton( localeDelegate.getMessage("dbtransfer.import.step4.4", "importieren") + "..."); // final JProgressBar progressBar = new JProgressBar(0, 200); step.add(lbWarning, "0,0,1,0"); step.add(btnStartImport, "0,2"); // step.add(progressBar, "0,3"); btnStartImport.addActionListener(new ActionListener() { @Override/* www. j av a 2 s.co m*/ public void actionPerformed(ActionEvent ae) { // progressBar.setValue(0); ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_RUN); Thread t = new Thread() { @Override public void run() { try { btnStartImport.setEnabled(false); blnImportStarted = true; wizard.getModel().refreshModelState(); // progressBar.setVisible(true); // start configuration import if (chbxIncludeUser.isSelected()) { importTransferObject.getTransferOptions().put(TransferOption.IMPORT_USER, null); } else { importTransferObject.getTransferOptions().remove(TransferOption.IMPORT_USER); } if (chbxIncludeLDAP.isSelected()) { importTransferObject.getTransferOptions().put(TransferOption.IMPORT_USER, null); } else { importTransferObject.getTransferOptions().remove(TransferOption.IMPORT_USER); } if (chbxIncludeObjectimport.isSelected()) { importTransferObject.getTransferOptions().put(TransferOption.IMPORT_USER, null); } else { importTransferObject.getTransferOptions().remove(TransferOption.IMPORT_USER); } if (chbxAlternativeDBLogin.isSelected()) { importTransferObject.getTransferOptions().put(TransferOption.DBADMIN, tfAlternativeDBLogin.getText()); importTransferObject.getTransferOptions().put(TransferOption.DBADMIN_PASSWORD, new String(pfAlternativeDBPassword.getPassword())); } else { importTransferObject.getTransferOptions().remove(TransferOption.DBADMIN); importTransferObject.getTransferOptions().remove(TransferOption.DBADMIN_PASSWORD); } // create new parameter list Collection<EntityObjectVO> parameterSelection = new ArrayList<EntityObjectVO>(); for (ParameterEditor pe : lstParameterEditors) { if (pe.getParameter().isDeleted() && pe.isIncomingValue()) { // nothing to do. if parameter not in list runTransfer would delete it. } else { EntityObjectVO parameterCopy = new EntityObjectVO(); parameterCopy.initFields(pe.getParameter().getFields().size(), 0); parameterCopy.getFields().putAll(pe.getParameter().getFields()); parameterCopy.getFields().put("value", pe.getValue()); parameterSelection.add(parameterCopy); } } // copy transfer to add parameter list. // only temporary in case we go back one step, then we need the old list. Transfer transfer = new Transfer(importTransferObject); transfer.setParameter(parameterSelection); importTransferResult = getTransferFacadeRemote().runTransfer(transfer); // Nicht invalidateAllClientCaches() aufrufen! Nach einem Aufruf sind die Menus solange deaktiviert, // bis alle NovabitInternalFrames geschlossen wurden... BUG? // // Main.getMainController().invalidateAllClientCaches(); notifyParent .actionPerformed(new ActionEvent(DBTransferImport.this, 0, IMPORT_EXECUTED)); step.setComplete(true); model.nextStep(); } catch (Exception e) { // progressBar.setVisible(false); btnStartImport.setEnabled(true); blnImportStarted = false; wizard.getModel().refreshModelState(); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { // progressBar.setVisible(false); ifrm.unlockLayer(); //invalidateAllCaches muss mit runCommandLater aufgerufen werden, da irgendeine Methode setzt den GlassPane //auf visible und nach dem Beenden der Aktion nicht mehr auf invisible. Aus disem Grund ist der Men\u00fc nicht "erreichbar". UIUtils.runCommandLater(Main.getInstance().getMainFrame(), new CommonRunnable() { @Override public void run() throws CommonBusinessException { Main.getInstance().getMainController().invalidateAllClientCaches(); } }); } } }; t.start(); } }); // progressBar.setVisible(false); return step; }
From source file:net.rptools.maptool.client.ui.MapToolFrame.java
public void closingMaintenance() { if (AppPreferences.getSaveReminder()) { if (MapTool.getPlayer().isGM()) { int result = MapTool.confirmImpl(I18N.getText("msg.title.saveCampaign"), JOptionPane.YES_NO_CANCEL_OPTION, "msg.confirm.saveCampaign", (Object[]) null); // int result = JOptionPane.showConfirmDialog(MapTool.getFrame(), I18N.getText("msg.confirm.saveCampaign"), I18N.getText("msg.title.saveCampaign"), JOptionPane.YES_NO_CANCEL_OPTION); if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) { return; }// ww w.j a v a2 s. c om if (result == JOptionPane.YES_OPTION) { final Observer callback = new Observer() { public void update(java.util.Observable o, Object arg) { if (arg instanceof String) { // There was an error during the save -- don't terminate MapTool! } else { MapTool.getFrame().close(); } } }; ActionEvent ae = new ActionEvent(callback, 0, "close"); AppActions.SAVE_CAMPAIGN.actionPerformed(ae); return; } } else { if (!MapTool.confirm("msg.confirm.disconnecting")) { return; } } } close(); }
From source file:processing.app.Base.java
public void rebuildBoardsMenu() throws Exception { boardsCustomMenus = new LinkedList<>(); // The first custom menu is the "Board" selection submenu JMenu boardMenu = new JMenu(tr("Board")); boardMenu.putClientProperty("removeOnWindowDeactivation", true); MenuScroller.setScrollerFor(boardMenu).setTopFixedCount(1); boardMenu.add(new JMenuItem(new AbstractAction(tr("Boards Manager...")) { public void actionPerformed(ActionEvent actionevent) { String filterText = ""; String dropdownItem = ""; if (actionevent instanceof Event) { filterText = ((Event) actionevent).getPayload().get("filterText").toString(); dropdownItem = ((Event) actionevent).getPayload().get("dropdownItem").toString(); }/*from w w w .j av a 2 s . c o m*/ try { openBoardsManager(filterText, dropdownItem); } catch (Exception e) { //TODO show error e.printStackTrace(); } } })); boardsCustomMenus.add(boardMenu); // If there are no platforms installed we are done if (BaseNoGui.packages.size() == 0) return; // Separate "Install boards..." command from installed boards boardMenu.add(new JSeparator()); // Generate custom menus for all platforms Set<String> customMenusTitles = new LinkedHashSet<>(); for (TargetPackage targetPackage : BaseNoGui.packages.values()) { for (TargetPlatform targetPlatform : targetPackage.platforms()) { customMenusTitles.addAll(targetPlatform.getCustomMenus().values()); } } for (String customMenuTitle : customMenusTitles) { JMenu customMenu = new JMenu(tr(customMenuTitle)); customMenu.putClientProperty("removeOnWindowDeactivation", true); boardsCustomMenus.add(customMenu); } List<JMenuItem> menuItemsToClickAfterStartup = new LinkedList<>(); ButtonGroup boardsButtonGroup = new ButtonGroup(); Map<String, ButtonGroup> buttonGroupsMap = new HashMap<>(); // Cycle through all packages boolean first = true; for (TargetPackage targetPackage : BaseNoGui.packages.values()) { // For every package cycle through all platform for (TargetPlatform targetPlatform : targetPackage.platforms()) { // Add a separator from the previous platform if (!first) boardMenu.add(new JSeparator()); first = false; // Add a title for each platform String platformLabel = targetPlatform.getPreferences().get("name"); if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) { JMenuItem menuLabel = new JMenuItem(tr(platformLabel)); menuLabel.setEnabled(false); boardMenu.add(menuLabel); } // Cycle through all boards of this platform for (TargetBoard board : targetPlatform.getBoards().values()) { if (board.getPreferences().get("hide") != null) continue; JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, menuItemsToClickAfterStartup, buttonGroupsMap, board, targetPlatform, targetPackage); boardMenu.add(item); boardsButtonGroup.add(item); } } } if (menuItemsToClickAfterStartup.isEmpty()) { menuItemsToClickAfterStartup.add(selectFirstEnabledMenuItem(boardMenu)); } for (JMenuItem menuItemToClick : menuItemsToClickAfterStartup) { menuItemToClick.setSelected(true); menuItemToClick.getAction().actionPerformed(new ActionEvent(this, -1, "")); } }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerControl.java
/** * Reacts to property changed. //from ww w .j a va 2s.com * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent pce) { String name = pce.getPropertyName(); if (name == null) return; if (TreeViewer.CANCEL_LOADING_PROPERTY.equals(name)) { Browser browser = model.getSelectedBrowser(); if (browser != null) browser.cancel(); } else if (Browser.POPUP_MENU_PROPERTY.equals(name)) { Integer c = (Integer) pce.getNewValue(); Browser browser = model.getSelectedBrowser(); if (browser != null) view.showPopup(c.intValue(), browser.getClickComponent(), browser.getClickPoint()); } else if (Browser.CLOSE_PROPERTY.equals(name)) { Browser browser = (Browser) pce.getNewValue(); if (browser != null) view.removeBrowser(browser); } else if (TreeViewer.FINDER_VISIBLE_PROPERTY.equals(name)) { Boolean b = (Boolean) pce.getNewValue(); if (!b.booleanValue()) { model.clearFoundResults(); model.onComponentStateChange(true); } } else if (TreeViewer.SELECTED_BROWSER_PROPERTY.equals(name)) { Browser b = model.getSelectedBrowser(); Iterator i = model.getBrowsers().values().iterator(); Browser browser; while (i.hasNext()) { browser = (Browser) i.next(); browser.setSelected(browser.equals(b)); } } else if (Browser.SELECTED_TREE_NODE_DISPLAY_PROPERTY.equals(name)) { model.onSelectedDisplay(); view.updateMenuItems(); } else if (TreeViewer.HIERARCHY_ROOT_PROPERTY.equals(name)) { /* Map browsers = model.getBrowsers(); Iterator i = browsers.values().iterator(); Browser browser; while (i.hasNext()) { browser = (Browser) i.next(); //browser.cleanFilteredNodes(); //browser.switchUser(); } */ } else if (AddExistingObjectsDialog.EXISTING_ADD_PROPERTY.equals(name)) { model.addExistingObjects((Set) pce.getNewValue()); } else if (UserManagerDialog.USER_SWITCH_PROPERTY.equals(name)) { Map m = (Map) pce.getNewValue(); Iterator i = m.entrySet().iterator(); Long groupID; List<ExperimenterData> users; Entry entry; while (i.hasNext()) { entry = (Entry) i.next(); groupID = (Long) entry.getKey(); users = (List<ExperimenterData>) entry.getValue(); model.setHierarchyRoot(groupID, users); } } else if (UserManagerDialog.NO_USER_SWITCH_PROPERTY.equals(name)) { UserNotifier un = TreeViewerAgent.getRegistry().getUserNotifier(); un.notifyInfo("User Selection", "Please select a user first."); } else if (EditorDialog.CREATE_PROPERTY.equals(name)) { DataObject data = (DataObject) pce.getNewValue(); model.createObject(data, true); } else if (EditorDialog.CREATE_NO_PARENT_PROPERTY.equals(name)) { DataObject data = (DataObject) pce.getNewValue(); model.createObject(data, false); } else if (MetadataViewer.ON_DATA_SAVE_PROPERTY.equals(name)) { Object object = pce.getNewValue(); if (object != null) { if (object instanceof DataObject) model.onDataObjectSave((DataObject) object, TreeViewer.UPDATE_OBJECT); else model.onDataObjectSave((List) object, TreeViewer.UPDATE_OBJECT); } } else if (DataBrowser.SELECTED_NODE_DISPLAY_PROPERTY.equals(name)) { model.setSelectedNode(pce.getNewValue()); } else if (DataBrowser.UNSELECTED_NODE_DISPLAY_PROPERTY.equals(name)) { model.setUnselectedNode(pce.getNewValue()); } else if (DataBrowser.DATA_OBJECT_CREATED_PROPERTY.equals(name)) { Map map = (Map) pce.getNewValue(); if (map != null && map.size() == 1) { DataObject data = null; Set set = map.entrySet(); Entry entry; Iterator i = set.iterator(); Object o; DataObject parent = null; while (i.hasNext()) { entry = (Entry) i.next(); data = (DataObject) entry.getKey(); o = entry.getValue(); if (o != null) parent = (DataObject) o; break; } if (parent == null) model.onOrphanDataObjectCreated(data); else model.onDataObjectSave(data, parent, TreeViewer.CREATE_OBJECT); } } else if (DataBrowser.ADDED_TO_DATA_OBJECT_PROPERTY.equals(name)) { //Browser browser = model.getSelectedBrowser(); //if (browser != null) browser.refreshLoggedExperimenterData(); model.refreshTree(); } else if (DataBrowser.COPY_RND_SETTINGS_PROPERTY.equals(name)) { Object data = pce.getNewValue(); if (data != null) model.copyRndSettings((ImageData) data); else model.copyRndSettings(null); } else if (DataBrowser.PASTE_RND_SETTINGS_PROPERTY.equals(name)) { Object data = pce.getNewValue(); PasteRndSettingsCmd cmd; if (data instanceof Collection) cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.PASTE, (Collection) data); else cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.PASTE); cmd.execute(); } else if (DataBrowser.RESET_RND_SETTINGS_PROPERTY.equals(name)) { Object data = pce.getNewValue(); PasteRndSettingsCmd cmd; if (data instanceof Collection) cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.RESET, (Collection) data); else cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.RESET); cmd.execute(); } else if (DataBrowser.SET__ORIGINAL_RND_SETTINGS_PROPERTY.equals(name)) { Object data = pce.getNewValue(); PasteRndSettingsCmd cmd; if (data instanceof Collection) cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.SET_MIN_MAX, (Collection) data); else cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.SET_MIN_MAX); cmd.execute(); } else if (DataBrowser.SET__ORIGINAL_RND_SETTINGS_PROPERTY.equals(name)) { Object data = pce.getNewValue(); PasteRndSettingsCmd cmd; if (data instanceof Collection) cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.SET_OWNER, (Collection) data); else cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.SET_OWNER); cmd.execute(); } else if (DataBrowser.CUT_ITEMS_PROPERTY.equals(name)) { CutCmd cmd = new CutCmd(model); cmd.execute(); } else if (DataBrowser.COPY_ITEMS_PROPERTY.equals(name)) { CopyCmd cmd = new CopyCmd(model); cmd.execute(); } else if (DataBrowser.PASTE_ITEMS_PROPERTY.equals(name)) { PasteCmd cmd = new PasteCmd(model); cmd.execute(); } else if (DataBrowser.REMOVE_ITEMS_PROPERTY.equals(name)) { DeleteCmd cmd = new DeleteCmd(model.getSelectedBrowser()); cmd.execute(); } else if (DataBrowser.VIEW_IMAGE_NODE_PROPERTY.equals(name)) { //view.get Browser browser = model.getSelectedBrowser(); if (browser != null) { TreeImageDisplay node = browser.getLastSelectedDisplay(); model.browse(node, (DataObject) pce.getNewValue(), false); } } else if (DataBrowser.INTERNAL_VIEW_NODE_PROPERTY.equals(name)) { ViewCmd cmd = new ViewCmd(model, true); cmd.execute(); } else if (Finder.RESULTS_FOUND_PROPERTY.equals(name)) { model.setSearchResult(pce.getNewValue()); } else if (GenericDialog.SAVE_GENERIC_PROPERTY.equals(name)) { Object parent = pce.getNewValue(); if (parent instanceof MetadataViewer) { MetadataViewer mv = (MetadataViewer) parent; mv.saveData(); } } else if (Browser.DATA_REFRESHED_PROPERTY.equals(name)) { model.onSelectedDisplay(); } else if (MetadataViewer.ADMIN_UPDATED_PROPERTY.equals(name)) { Object data = pce.getNewValue(); Map browsers = model.getBrowsers(); Set set = browsers.entrySet(); Entry entry; Iterator i = set.iterator(); Browser browser; while (i.hasNext()) { entry = (Entry) i.next(); browser = (Browser) entry.getValue(); browser.refreshAdmin(data); } view.createTitle(); } else if (DataBrowser.TAG_WIZARD_PROPERTY.equals(name)) { model.showTagWizard(); } else if (DataBrowser.FIELD_SELECTED_PROPERTY.equals(name)) { model.setSelectedField(pce.getNewValue()); } else if (MetadataViewer.RENDER_THUMBNAIL_PROPERTY.equals(name)) { long imageID = ((Long) pce.getNewValue()).longValue(); List<Long> ids = new ArrayList<Long>(1); ids.add(imageID); view.reloadThumbnails(ids); } else if (MetadataViewer.APPLY_SETTINGS_PROPERTY.equals(name)) { Object object = pce.getNewValue(); if (object instanceof ImageData) { ImageData img = (ImageData) object; model.copyRndSettings((ImageData) object); List<Long> ids = new ArrayList<Long>(1); ids.add(img.getId()); view.reloadThumbnails(ids); //improve code to speed it up List l = model.getSelectedBrowser().getSelectedDataObjects(); Collection toUpdate; if (l.size() > 1) toUpdate = l; else toUpdate = model.getDisplayedImages(); if (toUpdate != null) { PasteRndSettingsCmd cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.PASTE, toUpdate); cmd.execute(); } } else if (object instanceof Object[]) { Object[] objects = (Object[]) object; WellSampleData wsd = (WellSampleData) objects[0]; WellData well = (WellData) objects[1]; ImageData img = wsd.getImage(); model.copyRndSettings(img); List<Long> ids = new ArrayList<Long>(1); ids.add(img.getId()); view.reloadThumbnails(ids); ids = new ArrayList<Long>(1); ids.add(well.getPlate().getId()); model.pasteRndSettings(ids, PlateData.class); } } else if (JXTaskPaneContainerSingle.SELECTED_TASKPANE_PROPERTY.equals(name)) { handleTaskPaneSelection((JXTaskPane) pce.getNewValue()); } else if (MetadataViewer.GENERATE_FIGURE_PROPERTY.equals(name)) { Object object = pce.getNewValue(); if (!(object instanceof FigureParam)) return; UserNotifier un = TreeViewerAgent.getRegistry().getUserNotifier(); IconManager icons = IconManager.getInstance(); Icon icon = icons.getIcon(IconManager.SPLIT_VIEW_FIGURE_22); FigureActivityParam activity; List<Long> ids = new ArrayList<Long>(); Iterator i; DataObject obj; FigureParam param = (FigureParam) object; Collection l; if (param.isSelectedObjects()) { Browser b = model.getSelectedBrowser(); if (b != null) l = b.getSelectedDataObjects(); else { l = new ArrayList<DataObject>(); Collection<DataObject> nodes = model.getSelectedObjectsFromBrowser(); if (nodes != null) { l.addAll(nodes); } } } else { l = model.getDisplayedImages(); } if (CollectionUtils.isEmpty(l)) return; Class klass = null; Object p = null; if (param.getIndex() == FigureParam.THUMBNAILS) { Browser browser = model.getSelectedBrowser(); if (browser != null) { TreeImageDisplay[] nodes = browser.getSelectedDisplays(); if (nodes != null && nodes.length > 0) { TreeImageDisplay node = nodes[0]; Object ho = node.getUserObject(); TreeImageDisplay pNode; if (ho instanceof DatasetData) { klass = ho.getClass(); p = ho; } else if (ho instanceof ImageData) { klass = ho.getClass(); pNode = node.getParentDisplay(); if (pNode != null) { p = pNode.getUserObject(); if (!(p instanceof DatasetData)) p = null; } if (p == null) p = ho; } if (p != null) param.setAnchor((DataObject) p); } } } i = l.iterator(); int n = 0; List<Long> groupIds = new ArrayList<Long>(); boolean canRun = true; while (i.hasNext()) { obj = (DataObject) i.next(); if (groupIds.size() == 0) groupIds.add(obj.getGroupId()); if (groupIds.contains(obj.getGroupId())) { ids.add(obj.getId()); if (n == 0) p = obj; n++; } else { canRun = false; break; } } if (!canRun) { un.notifyInfo("Script", "You can run the script only\non " + "objects from the same group"); return; } if (ids.size() == 0) return; // not set if (param.getIndex() != FigureParam.THUMBNAILS) param.setAnchor((DataObject) p); activity = new FigureActivityParam(object, ids, klass, FigureActivityParam.SPLIT_VIEW_FIGURE); activity.setIcon(icon); un.notifyActivity(new SecurityContext(groupIds.get(0)), activity); } else if (MetadataViewer.HANDLE_SCRIPT_PROPERTY.equals(name)) { UserNotifier un = TreeViewerAgent.getRegistry().getUserNotifier(); ScriptActivityParam p = (ScriptActivityParam) pce.getNewValue(); int index = p.getIndex(); ScriptObject script = p.getScript(); if (index == ScriptActivityParam.VIEW) { Environment env = (Environment) TreeViewerAgent.getRegistry().lookup(LookupNames.ENV); String path = env.getOmeroFilesHome(); path += File.separator + script.getName(); File f = new File(path); DownloadAndLaunchActivityParam activity = new DownloadAndLaunchActivityParam( p.getScript().getScriptID(), DownloadAndLaunchActivityParam.ORIGINAL_FILE, f, null); un.notifyActivity(model.getSecurityContext(), activity); } else if (index == ScriptActivityParam.DOWNLOAD) { downloadScript(p); } } else if (OpenWithDialog.OPEN_DOCUMENT_PROPERTY.equals(name)) { ApplicationData data = (ApplicationData) pce.getNewValue(); //Register if (data == null) return; String format = view.getObjectMimeType(); //if (format == null) return; if (format != null) TreeViewerFactory.register(data, format); model.openWith(data); } else if (DataBrowser.OPEN_EXTERNAL_APPLICATION_PROPERTY.equals(name)) { model.openWith((ApplicationData) pce.getNewValue()); } else if (AdminDialog.CREATE_ADMIN_PROPERTY.equals(name)) { AdminObject object = (AdminObject) pce.getNewValue(); model.administrate(object); } else if (MetadataViewer.REGISTER_PROPERTY.equals(name)) { model.register((DataObjectRegistration) pce.getNewValue()); } else if (MetadataViewer.RESET_PASSWORD_PROPERTY.equals(name)) { model.resetPassword((String) pce.getNewValue()); } else if (MetadataViewer.UPLOAD_SCRIPT_PROPERTY.equals(name)) { TreeViewerAction action = getAction(UPLOAD_SCRIPT); action.actionPerformed(new ActionEvent(this, 1, "")); } else if (SelectionWizard.SELECTED_ITEMS_PROPERTY.equals(name)) { Map m = (Map) pce.getNewValue(); if (m == null || m.size() != 1) return; Entry entry; Iterator i = m.entrySet().iterator(); Class klass; TreeImageDisplay node; Collection<ExperimenterData> list; Object uo; AdminObject object; while (i.hasNext()) { entry = (Entry) i.next(); klass = (Class) entry.getKey(); if (ExperimenterData.class.equals(klass)) { list = (Collection<ExperimenterData>) entry.getValue(); node = model.getSelectedBrowser().getLastSelectedDisplay(); if (node != null) { uo = node.getUserObject(); if (uo instanceof GroupData) { object = new AdminObject((GroupData) uo, list); model.administrate(object); } } } } } else if (DataBrowser.SET__OWNER_RND_SETTINGS_PROPERTY.equals(name)) { Object data = pce.getNewValue(); PasteRndSettingsCmd cmd; if (data instanceof Collection) cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.SET_OWNER, (Collection) data); else cmd = new PasteRndSettingsCmd(model, PasteRndSettingsCmd.SET_OWNER); cmd.execute(); } else if (ScriptingDialog.RUN_SELECTED_SCRIPT_PROPERTY.equals(name)) { handleScript((ScriptObject) pce.getNewValue(), ScriptActivityParam.RUN); } else if (ScriptingDialog.DOWNLOAD_SELECTED_SCRIPT_PROPERTY.equals(name)) { Object value = pce.getNewValue(); if (value instanceof ScriptObject) handleScript((ScriptObject) value, ScriptActivityParam.DOWNLOAD); else if (value instanceof String) { ScriptObject script = view.getScriptFromName((String) value); if (script != null) handleScript(script, ScriptActivityParam.DOWNLOAD); } } else if (ScriptingDialog.VIEW_SELECTED_SCRIPT_PROPERTY.equals(name)) { Object value = pce.getNewValue(); if (value instanceof ScriptObject) handleScript((ScriptObject) value, ScriptActivityParam.VIEW); else if (value instanceof String) { ScriptObject script = view.getScriptFromName((String) value); if (script != null) handleScript(script, ScriptActivityParam.VIEW); } } else if (TreeViewer.SCRIPTS_LOADING_PROPERTY.equals(name)) { view.setScriptsLoadingStatus(true); } else if (TreeViewer.SCRIPTS_LOADED_PROPERTY.equals(name)) { view.setScriptsLoadingStatus(false); } else if (DataBrowser.SELECTED_DATA_BROWSER_NODES_DISPLAY_PROPERTY.equals(name)) { model.setSelectedNodes(pce.getNewValue()); } else if (TreeViewer.GROUP_CHANGED_PROPERTY.equals(name)) { view.setPermissions(); } else if (MacOSMenuHandler.QUIT_APPLICATION_PROPERTY.equals(name)) { Action a = getAction(EXIT); ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, ""); a.actionPerformed(event); } else if (GroupManagerDialog.GROUP_SWITCH_PROPERTY.equals(name)) { List<GroupData> groups = (List<GroupData>) pce.getNewValue(); if (groups.size() == 0) { UserNotifier un = TreeViewerAgent.getRegistry().getUserNotifier(); un.notifyInfo(GroupManagerDialog.TITLE, "At least one group " + "must be selected."); return; } model.setUserGroup(groups); } else if (DataBrowser.ACTIVATE_USER_PROPERTY.equals(name)) { ExperimenterData exp = (ExperimenterData) pce.getNewValue(); if (exp != null) model.activateUser(exp); } else if (DataBrowser.RESET_PASSWORD_PROPERTY.equals(name)) { getAction(RESET_PASSWORD).actionPerformed(new ActionEvent(pce.getNewValue(), 0, "Reset Password")); } }
From source file:com.projity.contrib.calendar.JXXMonthView.java
/** * Fires an ActionEvent to all listeners. *///w ww.j a va 2 s. c o m protected void fireActionPerformed() { Object[] listeners = listenerList.getListenerList(); ActionEvent e = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ActionListener.class) { if (e == null) { e = new ActionEvent(JXXMonthView.this, ActionEvent.ACTION_PERFORMED, _actionCommand); } ((ActionListener) listeners[i + 1]).actionPerformed(e); } } }
From source file:org.wings.SComponent.java
protected boolean processKeyEvents(String[] values) { if (actionMap == null) return false; if (log.isDebugEnabled()) log.debug("processKeyEvents " + Arrays.asList(values)); boolean arm = false; for (String value : values) { final Action action = actionMap.get(value); if (action != null) { if (actionEvents == null) actionEvents = new HashMap<Action, ActionEvent>(); actionEvents.put(action, new ActionEvent(this, 0, value)); arm = true;/* w w w .j a v a 2 s . co m*/ } } if (arm) SForm.addArmedComponent((LowLevelEventListener) this); return arm; }
From source file:org.apache.log4j.chainsaw.LogUI.java
/** * Using the current thread, calls the registed Shutdown action's * actionPerformed(...) method./*from w ww . j a v a 2 s. com*/ * */ private void performShutdownAction() { MessageCenter.getInstance().getLogger().debug("Calling the shutdown Action. Goodbye!"); shutdownAction.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "Shutting Down")); }