List of usage examples for javax.swing JOptionPane NO_OPTION
int NO_OPTION
To view the source code for javax.swing JOptionPane NO_OPTION.
Click Source Link
From source file:org.fhcrc.cpl.viewer.gui.MRMDialog.java
public void menuItemTraceAllFragments_actionPerformed(ActionEvent event) { try {/* w ww . ja va 2s . c om*/ int newTraceAllCode = JOptionPane.showConfirmDialog(this, "Trace over elution curves of ALL fragments?", "Trace All Fragments", JOptionPane.YES_NO_CANCEL_OPTION); if (newTraceAllCode != JOptionPane.YES_OPTION && newTraceAllCode != JOptionPane.NO_OPTION) return; boolean newTraceAll = (newTraceAllCode == JOptionPane.YES_OPTION); if (newTraceAll != _traceAllFragments) { _traceAllFragments = newTraceAll; updateChartsAndFields(false); } _traceAllFragments = newTraceAll; } catch (Exception e) { ApplicationContext.infoMessage("Cannot change 'Trace All' mode: " + e); } }
From source file:org.fhcrc.cpl.viewer.gui.MRMDialog.java
public void menuItemSyncLH_actionPerformed(ActionEvent event) { try {/*from www .ja va2s . co m*/ int newsync = JOptionPane.showConfirmDialog(this, "Synchronize L/H Elution Regions", "Sync Label Elution Regions", JOptionPane.YES_NO_CANCEL_OPTION); if (newsync != JOptionPane.YES_OPTION && newsync != JOptionPane.NO_OPTION) return; boolean newsyncbool = (newsync == JOptionPane.YES_OPTION); _synclh = newsyncbool; } catch (Exception e) { ApplicationContext.infoMessage("Cannot change 'Synchronize L/H' mode: " + e); } }
From source file:edu.harvard.i2b2.query.ui.QueryConceptTreePanel.java
private List getConceptsFromTerm(QueryConceptTreeNodeData data, DefaultMutableTreeNode tmpnode) { // QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject(); try {//ww w.ja v a 2 s .c om GetTermInfoType parentType = new GetTermInfoType(); parentType.setMax(null);//Integer.parseInt(System.getProperty("OntMax"))); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); parentType.setMax(parentPanel.max_child()); parentType.setBlob(true); parentType.setSelf(data.fullname()); GetChildrenResponseMessage msg = new GetChildrenResponseMessage(); StatusType procStatus = null; String response = OntServiceDriver.getTermInfo(parentType, ""); procStatus = msg.processResult(response); int result; if (procStatus.getValue().equals("MAX_EXCEEDED") && tmpnode != null) { result = JOptionPane.showConfirmDialog(parentPanel, "The node has exceeded maximum number of children.\n" + "Do you want to continue?", "Please note ...", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.NO_OPTION) { //DefaultMutableTreeNode tmpnode = data;//(DefaultMutableTreeNode) node.getChildAt(0); QueryConceptTreeNodeData tmpdata = (QueryConceptTreeNodeData) tmpnode.getUserObject(); tmpdata.name("Over maximum number of child nodes"); //procStatus.setType("DONE"); jTree1.repaint(); jTree1.scrollPathToVisible(new TreePath(tmpnode.getPath())); return null; } else { parentType.setMax(null); response = OntServiceDriver.getTermInfo(parentType, ""); procStatus = msg.processResult(response); } } if (!procStatus.getType().equals("DONE")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); return null; } ConceptsType allConcepts = msg.doReadConcepts(); return allConcepts.getConcept(); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(parentPanel, "Response delivered from the remote server could not be understood,\n" + "you may wish to retry your last action."); return null; } }
From source file:edu.harvard.i2b2.query.ui.ConceptTreePanel.java
private List getConceptsFromTerm(QueryConceptTreeNodeData data, DefaultMutableTreeNode tmpnode) { // QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) // node.getUserObject(); try {/* ww w.j av a 2 s . c o m*/ GetTermInfoType parentType = new GetTermInfoType(); parentType.setMax(null);// Integer.parseInt(System.getProperty( // "OntMax"))); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); parentType.setMax(parentPanel.max_child()); parentType.setBlob(true); parentType.setSelf(data.fullname()); GetChildrenResponseMessage msg = new GetChildrenResponseMessage(); StatusType procStatus = null; String response = OntServiceDriver.getTermInfo(parentType, ""); procStatus = msg.processResult(response); int result; if (procStatus.getValue().equals("MAX_EXCEEDED") && tmpnode != null) { result = JOptionPane.showConfirmDialog(parentPanel, "The node has exceeded maximum number of children.\n" + "Do you want to continue?", "Please note ...", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.NO_OPTION) { // DefaultMutableTreeNode tmpnode = // data;//(DefaultMutableTreeNode) node.getChildAt(0); QueryConceptTreeNodeData tmpdata = (QueryConceptTreeNodeData) tmpnode.getUserObject(); tmpdata.name("Over maximum number of child nodes"); // procStatus.setType("DONE"); jTree1.repaint(); jTree1.scrollPathToVisible(new TreePath(tmpnode.getPath())); return null; } else { parentType.setMax(null); response = OntServiceDriver.getTermInfo(parentType, ""); procStatus = msg.processResult(response); } } if (!procStatus.getType().equals("DONE")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); return null; } ConceptsType allConcepts = msg.doReadConcepts(); return allConcepts.getConcept(); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(parentPanel, "Response delivered from the remote server could not be understood,\n" + "you may wish to retry your last action."); return null; } }
From source file:edu.harvard.i2b2.query.ui.QueryConceptTreePanel.java
private List getConceptsFromChildren(QueryConceptTreeNodeData data, DefaultMutableTreeNode tmpnode) { // QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) node.getUserObject(); try {/*ww w. j a v a 2 s .c o m*/ GetChildrenType parentType = new GetChildrenType(); parentType.setMax(null);//Integer.parseInt(System.getProperty("OntMax"))); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); parentType.setMax(parentPanel.max_child()); parentType.setBlob(true); parentType.setParent(data.fullname()); GetChildrenResponseMessage msg = new GetChildrenResponseMessage(); StatusType procStatus = null; String response = OntServiceDriver.getChildren(parentType, ""); procStatus = msg.processResult(response); int result; if (procStatus.getValue().equals("MAX_EXCEEDED") && tmpnode != null) { result = JOptionPane.showConfirmDialog(parentPanel, "The node has exceeded maximum number of children.\n" + "Do you want to continue?", "Please note ...", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.NO_OPTION) { //DefaultMutableTreeNode tmpnode = data;//(DefaultMutableTreeNode) node.getChildAt(0); QueryConceptTreeNodeData tmpdata = (QueryConceptTreeNodeData) tmpnode.getUserObject(); tmpdata.name("Over maximum number of child nodes"); //procStatus.setType("DONE"); jTree1.repaint(); jTree1.scrollPathToVisible(new TreePath(tmpnode.getPath())); return null; } else { parentType.setMax(null); response = OntServiceDriver.getChildren(parentType, ""); procStatus = msg.processResult(response); } } if (!procStatus.getType().equals("DONE")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); return null; } ConceptsType allConcepts = msg.doReadConcepts(); return allConcepts.getConcept(); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(parentPanel, "Response delivered from the remote server could not be understood,\n" + "you may wish to retry your last action."); return null; } }
From source file:edu.uara.gui.tableeditor.ChartGenerationFrame.java
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing // TODO add your handling code here: if (this.cmd_saveChart.isEnabled()) { int option = JOptionPane.showConfirmDialog(this, "Chart has been modified! Do you want to save?", "Warning", JOptionPane.YES_NO_OPTION); switch (option) { case JOptionPane.OK_OPTION: this.saveFigure(); break; case JOptionPane.NO_OPTION: break; }/*from ww w . j ava2 s. c o m*/ } }
From source file:edu.harvard.i2b2.query.ui.ConceptTreePanel.java
private List getConceptsFromChildren(QueryConceptTreeNodeData data, DefaultMutableTreeNode tmpnode) { // QueryConceptTreeNodeData data = (QueryConceptTreeNodeData) // node.getUserObject(); try {//w w w . j a v a2 s . com GetChildrenType parentType = new GetChildrenType(); parentType.setMax(null);// Integer.parseInt(System.getProperty( // "OntMax"))); parentType.setHiddens(Boolean.parseBoolean(System.getProperty("OntHiddens"))); parentType.setSynonyms(Boolean.parseBoolean(System.getProperty("OntSynonyms"))); parentType.setMax(parentPanel.max_child()); parentType.setBlob(true); parentType.setParent(data.fullname()); GetChildrenResponseMessage msg = new GetChildrenResponseMessage(); StatusType procStatus = null; String response = OntServiceDriver.getChildren(parentType, ""); procStatus = msg.processResult(response); int result; if (procStatus.getValue().equals("MAX_EXCEEDED") && tmpnode != null) { result = JOptionPane.showConfirmDialog(parentPanel, "The node has exceeded maximum number of children.\n" + "Do you want to continue?", "Please note ...", JOptionPane.YES_NO_OPTION); if (result == JOptionPane.NO_OPTION) { // DefaultMutableTreeNode tmpnode = // data;//(DefaultMutableTreeNode) node.getChildAt(0); QueryConceptTreeNodeData tmpdata = (QueryConceptTreeNodeData) tmpnode.getUserObject(); tmpdata.name("Over maximum number of child nodes"); // procStatus.setType("DONE"); jTree1.repaint(); jTree1.scrollPathToVisible(new TreePath(tmpnode.getPath())); return null; } else { parentType.setMax(null); response = OntServiceDriver.getChildren(parentType, ""); procStatus = msg.processResult(response); } } if (!procStatus.getType().equals("DONE")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); return null; } ConceptsType allConcepts = msg.doReadConcepts(); return allConcepts.getConcept(); } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(parentPanel, "Response delivered from the remote server could not be understood,\n" + "you may wish to retry your last action."); return null; } }
From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java
private File showSaveDialog(final JFileChooser fc, final File file, final String extension) { fc.setSelectedFile(file);//from ww w . j ava 2s. c om if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File selectedFile = fc.getSelectedFile(); if (!FilenameUtils.getExtension(selectedFile.getName()).equalsIgnoreCase(extension)) { selectedFile = new File(selectedFile.getParentFile(), selectedFile.getName() + "." + extension); } if (selectedFile.exists()) { String msg = String.format("The file '%s' already exists. Overwrite?", selectedFile); switch (JOptionPane.showConfirmDialog(this, msg)) { case JOptionPane.YES_OPTION: return selectedFile; case JOptionPane.NO_OPTION: return showSaveDialog(fc, file, extension); default: return null; } } return selectedFile; } return null; }
From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java
private boolean checkLoadProfileEntityDirty() { if (activeLoadProfileEntityPanel != null && activeLoadProfileEntityPanel.isDirty()) { switch (JOptionPane.showConfirmDialog(AppFrame.this, "Save active curve assignment?")) { case JOptionPane.YES_OPTION: saveLoadProfileEntity(false); return true; case JOptionPane.NO_OPTION: cancelEditingCurveAssignment(); return true; case JOptionPane.CANCEL_OPTION: default:// w ww. j a v a2 s . c o m // don't allow to change tree selection tree.setSelectionPath(activeLeafPath); return false; } } return true; }
From source file:com.mirth.connect.client.ui.ChannelPanel.java
public Channel importChannel(Channel importChannel, boolean showAlerts, boolean refreshStatuses) { boolean overwrite = false; try {/*from ww w.j a va 2 s . c o m*/ String channelName = importChannel.getName(); String tempId = parent.mirthClient.getGuid(); // Check to see that the channel name doesn't already exist. if (!parent.checkChannelName(channelName, tempId)) { if (!parent.alertOption(parent, "Would you like to overwrite the existing channel? Choose 'No' to create a new channel.")) { importChannel.setRevision(0); do { channelName = JOptionPane.showInputDialog(this, "Please enter a new name for the channel.", channelName); if (channelName == null) { return null; } } while (!parent.checkChannelName(channelName, tempId)); importChannel.setName(channelName); setIdAndUpdateLibraries(importChannel, tempId); } else { overwrite = true; for (ChannelStatus channelStatus : channelStatuses.values()) { Channel channel = channelStatus.getChannel(); if (channel.getName().equalsIgnoreCase(channelName)) { // If overwriting, use the old revision number and id importChannel.setRevision(channel.getRevision()); setIdAndUpdateLibraries(importChannel, channel.getId()); } } } } else { // Start the revision number over for a new channel importChannel.setRevision(0); // If the channel name didn't already exist, make sure // the id doesn't exist either. if (!checkChannelId(importChannel.getId())) { setIdAndUpdateLibraries(importChannel, tempId); } } channelStatuses.put(importChannel.getId(), new ChannelStatus(importChannel)); parent.updateChannelTags(false); } catch (ClientException e) { parent.alertThrowable(parent, e); } // Import code templates / libraries if applicable parent.removeInvalidItems(importChannel.getCodeTemplateLibraries(), CodeTemplateLibrary.class); if (!(importChannel instanceof InvalidChannel) && !importChannel.getCodeTemplateLibraries().isEmpty()) { boolean importLibraries; String importChannelCodeTemplateLibraries = Preferences.userNodeForPackage(Mirth.class) .get("importChannelCodeTemplateLibraries", null); if (importChannelCodeTemplateLibraries == null) { JCheckBox alwaysChooseCheckBox = new JCheckBox( "Always choose this option by default in the future (may be changed in the Administrator settings)"); Object[] params = new Object[] { "Channel \"" + importChannel.getName() + "\" has code template libraries included with it. Would you like to import them?", alwaysChooseCheckBox }; int result = JOptionPane.showConfirmDialog(this, params, "Select an Option", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.YES_OPTION || result == JOptionPane.NO_OPTION) { importLibraries = result == JOptionPane.YES_OPTION; if (alwaysChooseCheckBox.isSelected()) { Preferences.userNodeForPackage(Mirth.class).putBoolean("importChannelCodeTemplateLibraries", importLibraries); } } else { return null; } } else { importLibraries = Boolean.parseBoolean(importChannelCodeTemplateLibraries); } if (importLibraries) { CodeTemplateImportDialog dialog = new CodeTemplateImportDialog(parent, importChannel.getCodeTemplateLibraries(), false, true); if (dialog.wasSaved()) { CodeTemplateLibrarySaveResult updateSummary = parent.codeTemplatePanel.attemptUpdate( dialog.getUpdatedLibraries(), new HashMap<String, CodeTemplateLibrary>(), dialog.getUpdatedCodeTemplates(), new HashMap<String, CodeTemplate>(), true, null, null); if (updateSummary == null || updateSummary.isOverrideNeeded() || !updateSummary.isLibrariesSuccess()) { return null; } else { for (CodeTemplateUpdateResult result : updateSummary.getCodeTemplateResults().values()) { if (!result.isSuccess()) { return null; } } } parent.codeTemplatePanel.doRefreshCodeTemplates(); } } importChannel.getCodeTemplateLibraries().clear(); } if (CollectionUtils.isNotEmpty(importChannel.getDependentIds()) || CollectionUtils.isNotEmpty(importChannel.getDependencyIds())) { Set<ChannelDependency> channelDependencies = new HashSet<ChannelDependency>( getCachedChannelDependencies()); if (CollectionUtils.isNotEmpty(importChannel.getDependentIds())) { for (String dependentId : importChannel.getDependentIds()) { if (StringUtils.isNotBlank(dependentId) && !StringUtils.equals(dependentId, importChannel.getId())) { channelDependencies.add(new ChannelDependency(dependentId, importChannel.getId())); } } } if (CollectionUtils.isNotEmpty(importChannel.getDependencyIds())) { for (String dependencyId : importChannel.getDependencyIds()) { if (StringUtils.isNotBlank(dependencyId) && !StringUtils.equals(dependencyId, importChannel.getId())) { channelDependencies.add(new ChannelDependency(importChannel.getId(), dependencyId)); } } } if (!channelDependencies.equals(getCachedChannelDependencies())) { try { parent.mirthClient.setChannelDependencies(channelDependencies); } catch (ClientException e) { parent.alertThrowable(parent, e, "Unable to save channel dependencies."); } } importChannel.clearDependencies(); } // Update resource names parent.updateResourceNames(importChannel); /* * Update the channel if we're overwriting an imported channel, if we're not showing alerts * (dragging/dropping multiple channels), or if we're working with an invalid channel. */ if (overwrite || !showAlerts || importChannel instanceof InvalidChannel) { try { parent.updateChannel(importChannel, overwrite); if (importChannel instanceof InvalidChannel && showAlerts) { InvalidChannel invalidChannel = (InvalidChannel) importChannel; Throwable cause = invalidChannel.getCause(); parent.alertThrowable(parent, cause, "Channel \"" + importChannel.getName() + "\" is invalid. " + getMissingExtensions(invalidChannel) + " Original cause:\n" + cause.getMessage()); } } catch (Exception e) { channelStatuses.remove(importChannel.getId()); parent.updateChannelTags(false); parent.alertThrowable(parent, e); return null; } finally { if (refreshStatuses) { doRefreshChannels(); } } } if (showAlerts) { final Channel importChannelFinal = importChannel; final boolean overwriteFinal = overwrite; /* * MIRTH-2048 - This is a hack to fix the memory access error that only occurs on OS X. * The block of code that edits the channel needs to be invoked later so that the screen * does not change before the drag/drop action of a channel finishes. */ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { parent.editChannel(importChannelFinal); parent.setSaveEnabled(!overwriteFinal); } catch (Exception e) { channelStatuses.remove(importChannelFinal.getId()); parent.updateChannelTags(false); parent.alertError(parent, "Channel had an unknown problem. Channel import aborted."); parent.channelEditPanel = new ChannelSetup(); parent.doShowChannel(); } } }); } return importChannel; }