List of usage examples for javax.swing JOptionPane showInputDialog
@SuppressWarnings("deprecation") public static Object showInputDialog(Component parentComponent, Object message, String title, int messageType, Icon icon, Object[] selectionValues, Object initialSelectionValue) throws HeadlessException
From source file:analysis.postRun.PostRunWindow.java
/** * Method which creates a dialogue asking the user to input the name of the log file they wish to view. *//*from ww w . java 2s.c om*/ @SuppressWarnings("unused") private void getFileName() { ImageIcon icon = new ImageIcon(); Object[] possibilities = null; String s = (String) JOptionPane.showInputDialog(MainFrame, "Enter filename of log, looking in folder log.", "Inspect Run", JOptionPane.PLAIN_MESSAGE, icon, possibilities, "log/*.csv"); //If a string was returned, set it as the fileName and call getData. if ((s != null) && (s.length() > 0)) { //System.out.println("Filename entered: " + s); currFile = s; return; } //If you're here, the return value was null/empty. JOptionPane.showMessageDialog(MainFrame, "No filename entered."); }
From source file:dbseer.gui.actions.ExplainChartAction.java
private void savePredicates() { DefaultListModel predicateListModel = panel.getControlPanel().getPredicateListModel(); if (predicateListModel.getSize() == 0) { JOptionPane.showMessageDialog(null, "There are no predicates to save.\nPlease generate predicates first.", "Warning", JOptionPane.WARNING_MESSAGE); return;//from ww w . j av a2s. c om } final StatisticalPackageRunner runner = DBSeerGUI.runner; try { String cause = (String) JOptionPane.showInputDialog(null, "Enter the cause for predicates ", "New Causal Model", JOptionPane.PLAIN_MESSAGE, null, null, "New Causal Model"); if (cause == null || cause.isEmpty()) { JOptionPane.showMessageDialog(null, "Please enter the cause correctly to save the causal model", "Warning", JOptionPane.WARNING_MESSAGE); return; } cause = cause.trim(); if (cause == "" || cause.isEmpty()) { JOptionPane.showMessageDialog(null, "Please enter the cause correctly to save the causal model", "Warning", JOptionPane.WARNING_MESSAGE); return; } String path = cause; String actualPath = causalModelPath + File.separator + cause + ".mat"; boolean exist = false; int idx = 0; File checkFile = new File(actualPath); while (checkFile.exists()) { exist = true; ++idx; actualPath = causalModelPath + File.separator + cause + "-" + idx + ".mat"; checkFile = new File(actualPath); } if (exist) { path = cause + "-" + idx; } runner.eval("createCausalModel('" + causalModelPath + "','" + path + "','" + cause + "', predicates);"); String output = String.format("A causal model with the cause '%s' has been saved as: \n%s", cause, actualPath); JOptionPane.showMessageDialog(null, output, "Information", JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { DBSeerExceptionHandler.handleException(e); } }
From source file:com.diversityarrays.kdxplore.trialmgr.TrialManagerApp.java
@Override public AfterUpdateResult initialiseAppAfterUpdateCheck(AppInitContext initContext) { final AfterUpdateResult[] initResult = new AfterUpdateResult[1]; initResult[0] = AfterUpdateResult.OK; trialExplorerPanel.doPostOpenOperations(); String currentDatabaseUrl = explorerProperties.getCurrentDatabaseUrl(); if (!KdxploreDatabase.LOCAL_DATABASE_URL.equalsIgnoreCase(currentDatabaseUrl)) { clientProvider.setInitialClientUrl(currentDatabaseUrl); }//from www . j a va2 s .c om clientProvider.setInitialClientUsername(explorerProperties.getCurrentDatabaseUsername()); if (currentDatabaseUrl == null) { currentDatabaseUrl = KdxploreDatabase.LOCAL_DATABASE_URL; } Closure<DatabaseDataLoadResult> loadDataErrorCompleteHandler = new Closure<DatabaseDataLoadResult>() { @Override public void execute(DatabaseDataLoadResult result) { Throwable problem = result.cause; if (problem == null) { // If user is logged in it may be to another database // so ensure we don't get confused by shutting down the extant connection. if (clientProvider.isClientAvailable()) { DALClient client = clientProvider.getDALClient(); if (!client.getBaseUrl().equalsIgnoreCase(result.dbUrl)) { clientProvider.logout(); } } String initialTabName = TAB_TRIALS; if (KdxploreConfig.getInstance().getModeList().contains("CIMMYT") && trialExplorerPanel.getTrialCount() <= 0 && traitExplorerPanel.getTraitCount() <= 0) { // This will suggest that the user loads traits first. initialTabName = TAB_TRAITS; // The reason for this in CIMMYT mode is that because the // user isn't able to get the Traits from the database // they really should load the Traits first. // } int index = tabbedPane.indexOfTab(initialTabName); tabbedPane.setSelectedIndex(index); } else { problem.printStackTrace(); messagesPanel.println(problem); Throwable lastCause = null; Throwable cause = problem; while (cause != null) { lastCause = cause; cause = cause.getCause(); } if (lastCause != null) { Shared.Log.e(TAG, "Initialisation Failed", lastCause); //$NON-NLS-1$ } // Replace all extant tabs with the Error tab. for (int tabIndex = tabbedPane.getTabCount(); --tabIndex >= 0;) { tabbedPane.remove(tabIndex); } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); result.cause.printStackTrace(pw); pw.close(); JTextArea ta = new JTextArea(sw.toString()); ta.setEditable(false); tabbedPane.addTab(Msg.TAB_INIT_ERROR(), new JScrollPane(ta)); initResult[0] = AfterUpdateResult.FAIL_IF_ALL; String errmsg = lastCause == null ? "" : lastCause.getMessage(); //$NON-NLS-1$ GuiUtil.errorMessage(TrialManagerApp.this, Msg.ERRMSG_CHECK_MESSSAGES_URL_CAUSE(result.dbUrl, errmsg), OfflineData.LOADING_OFFLINE_REFERENCE_DATA_ERROR()); } } }; List<DatabaseDataStub> databaseStubs = DatabaseDataUtils.collectDatabaseDirectories(userDataFolder, driverType); DatabaseDataStub chosen = null; if (databaseStubs.isEmpty()) { // This is a brand new one. chosen = DatabaseDataStub.create(driverType, userDataFolder, currentDatabaseUrl); // Path dirPath = Paths.get(defaultKdxploreDatabaseLocation.databaseDirectory.getPath()); // boolean isDefaultDatabase = defaultKdxploreDatabaseLocation.databaseDirectory.equals(dirPath.toFile()); // chosen = new DatabaseDataStub(isDefaultDatabase, defaultKdxploreDatabaseLocation.driverType, dirPath, currentDatabaseUrl, null); } else { if (databaseStubs.size() == 1) { chosen = databaseStubs.get(0); } else { DatabaseDataStub[] selectionValues = databaseStubs .toArray(new DatabaseDataStub[databaseStubs.size()]); for (DatabaseDataStub dds : selectionValues) { if (currentDatabaseUrl.equalsIgnoreCase(dds.dburl)) { chosen = dds; break; } } if (chosen == null) { chosen = selectionValues[0]; } Object answer = JOptionPane.showInputDialog(TrialManagerApp.this, Msg.MSG_CHOOSE_DATABASE_TO_OPEN_DEFAULT(chosen.toString()), Msg.TITLE_MULTIPLE_DATABASES_FOUND(), JOptionPane.QUESTION_MESSAGE, null, selectionValues, chosen); if (answer instanceof DatabaseDataStub) { chosen = (DatabaseDataStub) answer; } } } if (chosen == null) { initResult[0] = AfterUpdateResult.FAIL_IF_ALL; // System.exit(0); } else { loadOfflineDataAsync(chosen, loadDataErrorCompleteHandler); trialExplorerPanel.initialiseUploadHandler(offlineData); } return initResult[0]; }
From source file:analysis.postRun.PostRunWindow.java
/** * Method which creates a dialogue asking the user to input the indexes of the log files they wish to compare. */// w w w . jav a2s.c o m private String getFileList() { ImageIcon icon = new ImageIcon(); Object[] possibilities = null; String s = (String) JOptionPane.showInputDialog(MainFrame, "Enter indexes of log files to compare, separated by commas. e.g. '1,2'", "Compare Log Files", JOptionPane.PLAIN_MESSAGE, icon, possibilities, ","); //If a string was returned, set it as the fileName and call getData. if ((s != null) && (s.length() > 0)) { //System.out.println("File indexes entered: " + s); return s; } else { //If you're here, the return value was null/empty. JOptionPane.showMessageDialog(MainFrame, "No filename entered."); return s; } }
From source file:edu.harvard.i2b2.query.ui.QueryTopPanel.java
private void jRunQueryButtonActionPerformed(java.awt.event.ActionEvent evt) { // System.out.println("value set on the slider: "+ jSlider1.getValue()); if (dataModel.isAllPanelEmpty()) { JOptionPane.showMessageDialog(this, "All groups are empty."); return;/*from w w w . ja v a2s. com*/ } if (jRunQueryButton.getText().indexOf("Run Query") < 0) { cancel(); return; } String queryNametmp = jNameTextField.getText(); // if(queryNametmp.equals("") || queryNametmp == null) { queryNametmp = dataModel.getTmpQueryName(); // } Object selectedValue = JOptionPane.showInputDialog(this, "Please supply a name for this query: ", "Query Name Dialog", JOptionPane.PLAIN_MESSAGE, null, null, queryNametmp); if (selectedValue == null) { return; } else { queryNametmp = (String) selectedValue; } dataModel.queryName(queryNametmp); final String queryName = queryNametmp; // System.out.println("Provided query name: " + queryName); ImageIcon buttonIcon = createImageIcon("indicator_18.gif"); this.jRunQueryButton.setIcon(buttonIcon); this.jRunQueryButton.setText(" Cancel "); // final Color defaultcolor = jRunQueryButton.getBackground(); dataModel.specificity(0);// jSlider1.getValue()); // /create result option list from option selections ArrayList<String> optionList = new ArrayList<String>(); if (jGetPatientCountCheckBox.isSelected()) { optionList.add("patient_count_xml"); } if (jGetPatientSetCheckBox.isSelected() || jShowTimelineCheckBox.isSelected()) { optionList.add("patientset"); } final String xmlStr = dataModel.wirteQueryXML(optionList); // parentPanel.lastRequestMessage(xmlStr); parentPanel.setPatientCount(""); parentPanel.setRequestText(xmlStr); parentPanel.setResponseText("Waiting for response ..."); // System.out.println("Query request: "+xmlStr); // jNameTextField.setText(queryName); jNameLabel.setText(" Query Name: " + queryName); queryThread = new Thread() { @Override public void run() { // setCursor(new Cursor(Cursor.WAIT_CURSOR)); response = QueryRequestClient.sendQueryRequestREST(xmlStr); // parentPanel.lastResponseMessage(response); if (response != null) { // response = // response.substring(response.indexOf("<ns2:response"), // response.indexOf("</i2b2:response>")); parentPanel.setResponseText(response); JAXBUtil jaxbUtil = QueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); BodyType bt = messageType.getMessageBody(); MasterInstanceResultResponseType masterInstanceResultResponseType = (MasterInstanceResultResponseType) new JAXBUnWrapHelper() .getObjectByClass(bt.getAny(), MasterInstanceResultResponseType.class); String queryId = null; // ResponseMessageType messageType = // jaxbUtil.unMashallResponseMessageTypeFromString( // response); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); String count = "N/A"; QueryMasterData nameNode = null; if (status.equalsIgnoreCase("DONE")) { String refId = null; try { edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.StatusType cellStatusType = masterInstanceResultResponseType .getStatus(); if (cellStatusType.getCondition().get(0).getType().equalsIgnoreCase("RUNNING")) { JOptionPane.showMessageDialog(parentPanel, "Query is still running, you may check its status later \n" + "in the previous queries view by right clicking on a node\n" + "then selecting refresh all."); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); return; } else if (cellStatusType.getCondition().get(0).getType() .equalsIgnoreCase("ERROR")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); return; } queryId = new Integer( masterInstanceResultResponseType.getQueryMaster().getQueryMasterId()) .toString(); // messageType.getResponseHeader().getInfo(). // getValue(); // System.out.println("Get query id: "+queryId); nameNode = new QueryMasterData(); nameNode.name(queryName); nameNode.visualAttribute("CA"); nameNode.userId(UserInfoBean.getInstance().getUserName()); nameNode.tooltip("A query run by " + nameNode.userId()); nameNode.id(queryId); // nameNode.xmlContent(xmlStr); // /loop thru all the results for (int i = 0; i < masterInstanceResultResponseType.getQueryResultInstance() .size(); i++) { QueryResultInstanceType queryResultInstanceType = masterInstanceResultResponseType .getQueryResultInstance().get(i); if (queryResultInstanceType.getQueryResultType().getName() .equalsIgnoreCase("patientset")) { refId = new Integer(queryResultInstanceType.getResultInstanceId()) .toString(); // System.out.println("Set Ref id: "+ // refId); count = new Integer(queryResultInstanceType.getSetSize()).toString(); } else if (queryResultInstanceType.getQueryResultType().getName() .equalsIgnoreCase("patient_count_xml")) { count = new Integer(queryResultInstanceType.getSetSize()).toString(); QueryResultData resultData = new QueryResultData(); resultData.queryId(queryResultInstanceType.getResultInstanceId()); String xmlDocumentRequestStr = resultData.writeXMLDocumentQueryXML(); System.out.println( "Generated XML document request: " + xmlDocumentRequestStr); // parentPanel.lastRequestMessage( // xmlDocumentRequestStr); response = QueryRequestClient.sendQueryRequestREST(xmlDocumentRequestStr); System.out.println("Generated XML document response: " + response); // parentPanel.lastResponseMessage( // response); } } parentPanel.setPatientCount(count); if (count.equalsIgnoreCase("N/A")) { jSetSizeLabel.setText(" Patient(s) returned: " + count); } else { jSetSizeLabel.setText(" Patient(s) returned: " + count); } } 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."); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); return; } final IWorkbenchPage page = ((QueryPanelInvestigator) parentPanel).parentview .getViewSite().getPage(); ViewPart previousqueryview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.previousquery.views.PreviousQueryView"); ((ICommonMethod) previousqueryview).doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + nameNode.id()); final ArrayList<String> nodeXmls = new ArrayList<String>(); for (int i = 0; i < dataModel.getCurrentPanelCount(); i++) { ArrayList<QueryConceptTreeNodeData> nodelist = dataModel.getTreePanel(i).getItems(); for (int j = 0; j < nodelist.size(); j++) { QueryConceptTreeNodeData nodedata = nodelist.get(j); String termStatus = nodedata.setXmlContent(); if (termStatus.equalsIgnoreCase("error")) { JOptionPane.showMessageDialog(parentPanel, "Response delivered from the remote server could not be understood,\n" + "you may wish to retry your last action."); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); return; } nodeXmls.add(nodedata.xmlContent()); } } if (jShowTimelineCheckBox.isSelected()) { ViewPart explorerview = (ViewPart) page .findView("edu.harvard.i2b2.eclipse.plugins.explorer.views.ExplorerView"); if (explorerview != null) { String str1 = "" + count; String str2 = "-" + refId; ((ICommonMethod) explorerview).doSomething(str1 + str2); ((ICommonMethod) explorerview).doSomething(nodeXmls); } } } else { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); return; } } 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."); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); return; } } // setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); jRunQueryButton.setIcon(null); jRunQueryButton.setText("Run Query"); // jRunQueryButton.setBackground(defaultcolor); } }; try { queryThread.start(); } catch (Exception e) { e.printStackTrace(); parentPanel.setResponseText(e.getMessage()); } }
From source file:datavis.Gui.java
private void button2ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_button2ActionPerformed {//GEN-HEADEREND:event_button2ActionPerformed int station = Integer.parseInt((String) ((String) JOptionPane.showInputDialog(null, "Select a station.", "Web Import", JOptionPane.PLAIN_MESSAGE, null, stations, stations[8])).subSequence(0, 3)); int interval = intervals.get(JOptionPane.showInputDialog(null, "Select sample resolution", "Web Import", JOptionPane.PLAIN_MESSAGE, null, intervals.keySet().toArray(), intervals.keySet().toArray()[5])); JDatePicker sP = new JDateComponentFactory().createJDatePicker(); JDatePicker eP = new JDateComponentFactory().createJDatePicker(); Calendar today = Calendar.getInstance(TimeZone.getTimeZone("UTC")); sP.getModel().setDate(today.get(Calendar.YEAR) - 1, today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH)); sP.getModel().setSelected(true);/* ww w . java 2 s . c o m*/ eP.getModel().setDate(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_MONTH)); eP.getModel().setSelected(true); JPanel panel = new JPanel(); panel.add(new JLabel("Start date")); panel.add((Component) sP); panel.add(new JLabel("End date")); panel.add((Component) eP); JOptionPane.showMessageDialog(null, panel, "Web Import", JOptionPane.PLAIN_MESSAGE); try { dataset = getDataFromServer(station, interval, ((GregorianCalendar) sP.getModel().getValue()).getTime(), ((GregorianCalendar) eP.getModel().getValue()).getTime()); } catch (UnsupportedEncodingException ex) { JOptionPane.showMessageDialog(null, "There was an error retreiving data from the server."); return; } updateGraphs_pieChart(dataset, true); updateGraphs_barGraph(dataset, true); updateGraphs_lineGraph(dataset, true); String sampleTypes[] = dataset.getDropMenu(); jTextArea1.setText(dataset.toString()); jTextArea1.setCaretPosition(0); jTextArea2.setText(dataset.getStationInfo() + displayDevelopers); jTextArea2.setCaretPosition(0); button1.setLabel("Import Existing"); for (int i = 0; i < jComboBox1.getItemCount(); i++) { jComboBox1.remove(i); jComboBox2.remove(i); jComboBox3.remove(i); } for (int i = 0; i < sampleTypes.length; i++) { jComboBox1.addItem(sampleTypes[i]); jComboBox2.addItem(sampleTypes[i]); jComboBox3.addItem(sampleTypes[i]); } }
From source file:fi.hoski.remote.ui.Admin.java
private JMenuItem menuItemBackupEntity() { final String title = TextUtil.getText("BACKUP ENTITY"); JMenuItem backupYearItem = new JMenuItem(title); ActionListener backupYearAction = new ActionListener() { @Override/*from w ww . ja va 2 s. co m*/ public void actionPerformed(ActionEvent e) { Object kind = JOptionPane.showInputDialog(frame, title, "", JOptionPane.OK_CANCEL_OPTION, null, serverProperties.getTables(), null); if (kind != null) { SimpleDateFormat format = new SimpleDateFormat(TSFORMAT); String ts = format.format(new Date()); File file = saveFile(BACKUPDIR, kind + ts + ".ser", ".ser", "Backup"); if (file != null) { int count; try (FileOutputStream fos = new FileOutputStream(file)) { BufferedOutputStream bos = new BufferedOutputStream(fos); ObjectOutputStream oos = new ObjectOutputStream(bos); List<String> list = new ArrayList<String>(); list.add(kind.toString()); count = dss.backup(list, oos); JOptionPane.showMessageDialog(frame, TextUtil.getText("STORED") + " " + count); } catch (IOException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(frame, ex.getMessage()); } } } } }; backupYearAction = createActionListener(frame, backupYearAction); backupYearItem.addActionListener(backupYearAction); return backupYearItem; }
From source file:ffx.ui.MainPanel.java
/** * <p>//from w w w. ja v a2 s. c o m * createKeyFile</p> * * @param system a {@link ffx.ui.FFXSystem} object. * @return a boolean. */ public boolean createKeyFile(FFXSystem system) { String message = new String("Please select a parameter file " + "and a TINKER Key file will be created."); String params = (String) JOptionPane.showInputDialog(this, message, "Parameter File", JOptionPane.QUESTION_MESSAGE, null, keywordPanel.getParamFiles(), null); if (params != null) { if (params.equalsIgnoreCase("Use an existing TINKER Key file")) { JFileChooser fc = resetFileChooser(); fc.setDialogTitle("Choose a KEY File"); fc.setCurrentDirectory(pwd); fc.setSelectedFile(null); fc.setFileFilter(keyFileFilter); int result = fc.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File keyfile = fc.getSelectedFile(); if (keyfile.exists()) { Hashtable<String, Keyword> keywordHash = KeyFilter.open(keyfile); if (keywordHash != null) { system.setKeywords(keywordHash); } else { return false; } system.setKeyFile(keyfile); system.setForceField(null); return true; } } } else { File tempFile = system.getFile(); if (tempFile.getParentFile().canWrite()) { String path = system.getFile().getParent() + File.separatorChar; String keyFileName = system.getName() + ".key"; File keyfile = new File(path + keyFileName); try { FileWriter fw = new FileWriter(keyfile); BufferedWriter bw = new BufferedWriter(fw); bw.write("\n"); bw.write("# Force Field Selection\n"); String tempParm = keywordPanel.getParamPath(params); if (tempParm.indexOf(" ") > 0) { tempParm = "\"" + keywordPanel.getParamPath(params) + "\""; } bw.write("PARAMETERS " + tempParm + "\n"); bw.close(); fw.close(); Hashtable<String, Keyword> keywordHash = KeyFilter.open(keyfile); if (keywordHash != null) { system.setKeywords(keywordHash); } else { return false; } system.setKeyFile(keyfile); system.setForceField(null); return true; } catch (Exception e) { logger.warning("" + e); message = new String("There was an error creating " + keyfile.getAbsolutePath()); JOptionPane.showMessageDialog(this, message); } } else { message = new String( "Could not create a Key file because " + pwd.getAbsolutePath() + " is not writable"); JOptionPane.showMessageDialog(this, message); } } } return false; }
From source file:edu.harvard.i2b2.query.ui.TopPanel.java
private void jRunQueryButtonActionPerformed(java.awt.event.ActionEvent evt) { // System.out.println("value set on the slider: "+ jSlider1.getValue()); if (dataModel.isAllPanelEmpty() && !jGetAllPatientsCheckBox.isSelected()) { JOptionPane.showMessageDialog(this, "All groups are empty."); return;/*w w w .j a v a 2s . c om*/ } // /create result option list from option selections boolean timelinetmp = false;//jShowTimelineCheckBox.isSelected(); ArrayList<String> optionList = jOptionsPanel.getSelectedAnalysis(); //for(int i=0; i<optionList.size(); i++) { // if(optionList.get(i).equalsIgnoreCase("Timeline")) { // timelinetmp = true; // } //} final boolean timeline = jOptionsPanel.isTimelineSelected(); if (optionList.size() == 0) { JOptionPane.showMessageDialog(this, "No analysis is selected."); return; } if (jOptionsPanel.hasMissingInfo) { String message = ""; for (int i = 0; i < jOptionsPanel.missingTypes.size(); i++) { message += " " + jOptionsPanel.missingTypes.get(i); message += "\n"; } log.error("The knowledge on how to run the query is missing for Analysis type(s):\n" + message); JOptionPane.showMessageDialog(this, "The knowledge on how to run the query is missing for Analysis type(s):\n" + message); return; } if (jRunQueryButton.getText().indexOf("Run Query") < 0 && jRunQueryButton.getText().indexOf("Get All") < 0) { cancel(); return; } String queryNametmp = jNameTextField.getText(); if (jGetAllPatientsCheckBox.isSelected()) { queryNametmp = "All Patients"; } else { // if(queryNametmp.equals("") || queryNametmp == null) { queryNametmp = dataModel.getTmpQueryName(); // } Object selectedValue = JOptionPane.showInputDialog(this, "Please supply a name for this query: ", "Query Name Dialog", JOptionPane.PLAIN_MESSAGE, null, null, queryNametmp); if (selectedValue == null) { return; } else { queryNametmp = (String) selectedValue; } } dataModel.queryName(queryNametmp); final String queryName = queryNametmp; // System.out.println("Provided query name: " + queryName); ImageIcon buttonIcon = createImageIcon("indicator_18.gif"); this.jRunQueryButton.setIcon(buttonIcon); this.jRunQueryButton.setText(" Cancel "); // final Color defaultcolor = jRunQueryButton.getBackground(); dataModel.specificity(0); String tmp = ""; if (jGetAllPatientsCheckBox.isSelected()) { tmp = dataModel.wirteAllQueryXML(optionList); } else { tmp = dataModel.wirteQueryXML(optionList); } final String xmlStr = tmp; // parentPanel.lastRequestMessage(xmlStr); parentPanel.setPatientCount(""); parentPanel.setRequestText(xmlStr); parentPanel.setResponseText("Waiting for response ..."); // System.out.println("Query request: "+xmlStr); // jNameTextField.setText(queryName); jNameLabel.setText(" Query Name: " + queryName); queryThread = new Thread() { @Override public void run() { // setCursor(new Cursor(Cursor.WAIT_CURSOR)); response = QueryRequestClient.sendQueryRequestREST(xmlStr); // parentPanel.lastResponseMessage(response); if (response != null) { // response = // response.substring(response.indexOf("<ns2:response"), // response.indexOf("</i2b2:response>")); parentPanel.setResponseText(response); JAXBUtil jaxbUtil = QueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); BodyType bt = messageType.getMessageBody(); MasterInstanceResultResponseType masterInstanceResultResponseType = (MasterInstanceResultResponseType) new JAXBUnWrapHelper() .getObjectByClass(bt.getAny(), MasterInstanceResultResponseType.class); String queryId = null; // ResponseMessageType messageType = // jaxbUtil.unMashallResponseMessageTypeFromString( // response); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); String count = "N/A"; QueryMasterData nameNode = null; QueryInstanceData instanceNode = null; if (status.equalsIgnoreCase("DONE")) { String refId = null; try { edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.StatusType cellStatusType = masterInstanceResultResponseType .getStatus(); if (cellStatusType.getCondition().get(0).getType().equalsIgnoreCase("RUNNING")) { JOptionPane.showMessageDialog(parentPanel, "Query is still running, you may check its status later \n" + "in the previous queries view by right clicking on a node\n" + "then selecting refresh all."); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } else if (cellStatusType.getCondition().get(0).getType() .equalsIgnoreCase("ERROR")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } boolean obfsc = false; queryId = new Integer( masterInstanceResultResponseType.getQueryMaster().getQueryMasterId()) .toString(); // messageType.getResponseHeader().getInfo(). // getValue(); // System.out.println("Get query id: "+queryId); nameNode = new QueryMasterData(); nameNode.name(queryName); nameNode.visualAttribute("CA"); nameNode.userId(UserInfoBean.getInstance().getUserName()); nameNode.tooltip("A query run by " + nameNode.userId()); nameNode.id(queryId); // nameNode.xmlContent(xmlStr); // /loop thru all the results for (int i = 0; i < masterInstanceResultResponseType.getQueryResultInstance() .size(); i++) { QueryResultInstanceType queryResultInstanceType = masterInstanceResultResponseType .getQueryResultInstance().get(i); instanceNode = new QueryInstanceData(); instanceNode.id(queryResultInstanceType.getQueryInstanceId()); if (queryResultInstanceType.getQueryResultType().getName() .equalsIgnoreCase("patientset") || queryResultInstanceType.getQueryResultType().getName() .equalsIgnoreCase("patient_count_xml")) { refId = new Integer(queryResultInstanceType.getResultInstanceId()) .toString(); // System.out.println("Set Ref id: "+ // refId); count = new Integer(queryResultInstanceType.getSetSize()).toString(); if ((queryResultInstanceType.getObfuscateMethod() != null) && (queryResultInstanceType.getObfuscateMethod() .equalsIgnoreCase("OBTOTAL") || queryResultInstanceType.getObfuscateMethod() .equalsIgnoreCase("OBSUBTOTAL"))) { obfsc = true; } } /* * else if (queryResultInstanceType * .getQueryResultType().getName() * .equalsIgnoreCase( * "patient_count_xml")) { count = new * Integer( queryResultInstanceType * .getSetSize()) .toString(); * * QueryResultData resultData = new * QueryResultData(); resultData * .queryId(queryResultInstanceType * .getResultInstanceId()); String * xmlDocumentRequestStr = resultData * .writeXMLDocumentQueryXML(); System.out * . println * ("Generated XML document request: " + * xmlDocumentRequestStr); // * parentPanel.lastRequestMessage( // * xmlDocumentRequestStr); response = * QueryRequestClient * .sendQueryRequestREST * (xmlDocumentRequestStr); System.out * .println * ("Generated XML document response: " + * response); // * parentPanel.lastResponseMessage( // * response); } */ /* * else if (queryResultInstanceType * .getQueryResultType().getName() * .equalsIgnoreCase( * "PATIENT_AGE_COUNT_XML")) { //count = new * Integer( // queryResultInstanceType // * .getSetSize()) // .toString(); * * QueryResultData resultData = new * QueryResultData(); resultData * .queryId(queryResultInstanceType * .getResultInstanceId()); String * xmlDocumentRequestStr = resultData * .writeXMLDocumentQueryXML(); System.out * .println * ("Generated Age XML document request: " + * xmlDocumentRequestStr); // * parentPanel.lastRequestMessage( // * xmlDocumentRequestStr); response = * QueryRequestClient * .sendQueryRequestREST(xmlDocumentRequestStr * ); System.out * .println("Age XML document response: " + * response); // * parentPanel.lastResponseMessage( // * response); } */ } parentPanel.setPatientCount(count); if (count.equalsIgnoreCase("N/A")) { jSetSizeLabel.setText(" Patient(s) returned: " + count); } else { if (obfsc) { jSetSizeLabel.setText(" Patient(s) returned: " + "~" + count); } else { jSetSizeLabel.setText(" Patient(s) returned: " + count); } } } 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."); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } // setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } // jRunQueryButton.setBackground(defaultcolor); final IWorkbenchPage page = ((QueryPanelInvestigator) parentPanel).parentview .getViewSite().getPage(); ViewPart previousqueryview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.previousquery.views.PreviousQueryView"); ((ICommonMethod) previousqueryview).doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + nameNode.id()); final ArrayList<String> nodeXmls = new ArrayList<String>(); for (int i = 0; i < dataModel.getCurrentPanelCount(); i++) { ArrayList<QueryConceptTreeNodeData> nodelist = dataModel.getTreePanel(i).getItems(); for (int j = 0; j < nodelist.size(); j++) { QueryConceptTreeNodeData nodedata = nodelist.get(j); String termStatus = nodedata.setXmlContent(); if (termStatus.equalsIgnoreCase("error")) { JOptionPane.showMessageDialog(parentPanel, "Response delivered from the remote server could not be understood,\n" + "you may wish to retry your last action."); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } nodeXmls.add(nodedata.xmlContent()); } } ViewPart explorerview = null; if (timeline) { try { explorerview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.explorer.views.ExplorerView"); } catch (Exception e) { if (jOptionsPanel.hasGraphicAnalysis()) { ViewPart analysisview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.analysis.views.AnalysisView"); ((ICommonMethod) analysisview) .doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + instanceNode.id()); } } } if (explorerview != null) { //&& timeline){//jShowTimelineCheckBox.isSelected()) { String str1 = "" + count; String str2 = "-" + refId; ((ICommonMethod) explorerview).doSomething(str1 + str2); ((ICommonMethod) explorerview).processQuery(nameNode.id()); // .doSomething(nameNode);//nodeXmls); } if (jOptionsPanel.hasGraphicAnalysis()) { ViewPart analysisview = (ViewPart) page .findView("edu.harvard.i2b2.eclipse.plugins.analysis.views.AnalysisView"); ((ICommonMethod) analysisview).doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + instanceNode.id()); } } else { if (statusType.getValue().startsWith("LOCKEDOUT")) { JOptionPane.showMessageDialog(parentPanel, "Unable to process the query because your account has been locked out,\n" + "please contact your administrator."); // + "you may wish to retry your last action"); } else { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); } jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } } 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."); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } } } }; try { queryThread.start(); } catch (Exception e) { e.printStackTrace(); parentPanel.setResponseText(e.getMessage()); } }
From source file:edu.harvard.i2b2.query.ui.MainPanel.java
private void jRunQueryButtonActionPerformed(java.awt.event.ActionEvent evt) { // System.out.println("value set on the slider: "+ jSlider1.getValue()); if (dataModel.isAllPanelEmpty() && !jGetAllPatientsCheckBox.isSelected()) { JOptionPane.showMessageDialog(this, "All groups are empty."); return;//from w w w . ja va 2 s . c om } // /create result option list from option selections boolean timelinetmp = false;// jShowTimelineCheckBox.isSelected(); ArrayList<String> optionList = jOptionsPanel.getSelectedAnalysis(); // for(int i=0; i<optionList.size(); i++) { // if(optionList.get(i).equalsIgnoreCase("Timeline")) { // timelinetmp = true; // } // } final boolean timeline = jOptionsPanel.isTimelineSelected(); if (optionList.size() == 0) { JOptionPane.showMessageDialog(this, "No analysis is selected."); return; } if (jOptionsPanel.hasMissingInfo) { String message = ""; for (int i = 0; i < jOptionsPanel.missingTypes.size(); i++) { message += " " + jOptionsPanel.missingTypes.get(i); message += "\n"; } log.error("The knowledge on how to run the query is missing for Analysis type(s):\n" + message); JOptionPane.showMessageDialog(this, "The knowledge on how to run the query is missing for Analysis type(s):\n" + message); return; } if (jRunQueryButton.getText().indexOf("Run Query") < 0 && jRunQueryButton.getText().indexOf("Get All") < 0) { cancel(); return; } String queryNametmp = jNameTextField.getText(); if (jGetAllPatientsCheckBox.isSelected()) { queryNametmp = "All Patients"; } else { // if(queryNametmp.equals("") || queryNametmp == null) { queryNametmp = dataModel.getTmpQueryName(); // } Object selectedValue = JOptionPane.showInputDialog(this, "Please supply a name for this query: ", "Query Name Dialog", JOptionPane.PLAIN_MESSAGE, null, null, queryNametmp); if (selectedValue == null) { return; } else { queryNametmp = (String) selectedValue; } } dataModel.queryName(queryNametmp); final String queryName = queryNametmp; // System.out.println("Provided query name: " + queryName); ImageIcon buttonIcon = createImageIcon("indicator_18.gif"); this.jRunQueryButton.setIcon(buttonIcon); this.jRunQueryButton.setText(" Cancel "); // final Color defaultcolor = jRunQueryButton.getBackground(); dataModel.specificity(0); if (jTimingPanel.selectedTimingIndex() == 1) { dataModel.timing("ANY"); } else if (jTimingPanel.selectedTimingIndex() == 2) { dataModel.timing("SAMEVISIT"); } else { dataModel.timing("SAMEINSTANCENUM"); } String tmp = ""; if (jGetAllPatientsCheckBox.isSelected()) { tmp = dataModel.wirteAllQueryXML(optionList); } else { tmp = dataModel.wirteQueryXML(optionList); } final String xmlStr = tmp; // parentPanel.lastRequestMessage(xmlStr); jSetSizeLabel.setText(" Patient(s) returned:"); parentPanel.setPatientCount(""); parentPanel.setRequestText(xmlStr); parentPanel.setResponseText("Waiting for response ..."); // System.out.println("Query request: "+xmlStr); // jNameTextField.setText(queryName); jNameLabel.setText(" Query Name: " + queryName); queryThread = new Thread() { @Override public void run() { // setCursor(new Cursor(Cursor.WAIT_CURSOR)); response = QueryRequestClient.sendQueryRequestREST(xmlStr); // parentPanel.lastResponseMessage(response); if (response != null) { // response = // response.substring(response.indexOf("<ns2:response"), // response.indexOf("</i2b2:response>")); parentPanel.setResponseText(response); JAXBUtil jaxbUtil = QueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); BodyType bt = messageType.getMessageBody(); MasterInstanceResultResponseType masterInstanceResultResponseType = (MasterInstanceResultResponseType) new JAXBUnWrapHelper() .getObjectByClass(bt.getAny(), MasterInstanceResultResponseType.class); if (masterInstanceResultResponseType.getStatus().getCondition().get(0).getType() .equalsIgnoreCase("error")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); jSetSizeLabel.setText(" Patient(s) returned: Error"); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } String queryId = null; // ResponseMessageType messageType = // jaxbUtil.unMashallResponseMessageTypeFromString( // response); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); String count = "N/A"; QueryMasterData nameNode = null; QueryInstanceData instanceNode = null; if (status.equalsIgnoreCase("DONE")) { String refId = null; try { edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.StatusType cellStatusType = masterInstanceResultResponseType .getStatus(); if (cellStatusType.getCondition().get(0).getType().equalsIgnoreCase("RUNNING")) { JOptionPane.showMessageDialog(parentPanel, "Query is still running, you may check its status later \n" + "in the previous queries view by right clicking on a node\n" + "then selecting refresh all."); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } else if (cellStatusType.getCondition().get(0).getType() .equalsIgnoreCase("ERROR")) { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); jRunQueryButton.setIcon(null); jSetSizeLabel.setText(" Patient(s) returned: Error"); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } boolean obfsc = false; queryId = new Integer( masterInstanceResultResponseType.getQueryMaster().getQueryMasterId()) .toString(); // messageType.getResponseHeader().getInfo(). // getValue(); // System.out.println("Get query id: "+queryId); nameNode = new QueryMasterData(); nameNode.name(queryName); nameNode.visualAttribute("CA"); nameNode.userId(UserInfoBean.getInstance().getUserName()); nameNode.tooltip("A query run by " + nameNode.userId()); nameNode.id(queryId); // nameNode.xmlContent(xmlStr); // /loop thru all the results for (int i = 0; i < masterInstanceResultResponseType.getQueryResultInstance() .size(); i++) { QueryResultInstanceType queryResultInstanceType = masterInstanceResultResponseType .getQueryResultInstance().get(i); instanceNode = new QueryInstanceData(); instanceNode.id(queryResultInstanceType.getQueryInstanceId()); //if (queryResultInstanceType //.getQueryResultType().getName() //.equalsIgnoreCase("patientset") //|| queryResultInstanceType //.getQueryResultType() //.getName() //.equalsIgnoreCase( //"patient_count_xml")) { //refId = new Integer( //queryResultInstanceType // .getResultInstanceId()) //.toString(); // System.out.println("Set Ref id: "+ // refId); count = new Integer(queryResultInstanceType.getSetSize()).toString(); if ((queryResultInstanceType.getObfuscateMethod() != null) && (queryResultInstanceType.getObfuscateMethod() .equalsIgnoreCase("OBTOTAL") || queryResultInstanceType.getObfuscateMethod() .equalsIgnoreCase("OBSUBTOTAL"))) { obfsc = true; } //} if (queryResultInstanceType.getQueryResultType().getName() .equalsIgnoreCase("patientset")) { refId = new Integer(queryResultInstanceType.getResultInstanceId()) .toString(); // System.out.println("Set Ref id: "+ // refId); /*count = new Integer( queryResultInstanceType .getSetSize()) .toString(); if ((queryResultInstanceType .getObfuscateMethod() != null) && (queryResultInstanceType .getObfuscateMethod() .equalsIgnoreCase( "OBTOTAL") || queryResultInstanceType .getObfuscateMethod() .equalsIgnoreCase( "OBSUBTOTAL"))) { obfsc = true; }*/ } /* * else if (queryResultInstanceType * .getQueryResultType().getName() * .equalsIgnoreCase( "patient_count_xml")) * { count = new Integer( * queryResultInstanceType .getSetSize()) * .toString(); * * QueryResultData resultData = new * QueryResultData(); resultData * .queryId(queryResultInstanceType * .getResultInstanceId()); String * xmlDocumentRequestStr = resultData * .writeXMLDocumentQueryXML(); System.out . * println * ("Generated XML document request: " + * xmlDocumentRequestStr); // * parentPanel.lastRequestMessage( // * xmlDocumentRequestStr); response = * QueryRequestClient .sendQueryRequestREST * (xmlDocumentRequestStr); System.out * .println * ("Generated XML document response: " + * response); // * parentPanel.lastResponseMessage( // * response); } */ /* * else if (queryResultInstanceType * .getQueryResultType().getName() * .equalsIgnoreCase( * "PATIENT_AGE_COUNT_XML")) { //count = new * Integer( // queryResultInstanceType // * .getSetSize()) // .toString(); * * QueryResultData resultData = new * QueryResultData(); resultData * .queryId(queryResultInstanceType * .getResultInstanceId()); String * xmlDocumentRequestStr = resultData * .writeXMLDocumentQueryXML(); System.out * .println * ("Generated Age XML document request: " + * xmlDocumentRequestStr); // * parentPanel.lastRequestMessage( // * xmlDocumentRequestStr); response = * QueryRequestClient * .sendQueryRequestREST(xmlDocumentRequestStr * ); System.out * .println("Age XML document response: " + * response); // * parentPanel.lastResponseMessage( // * response); } */ } parentPanel.setPatientCount(count); if (count.equalsIgnoreCase("N/A")) { jSetSizeLabel.setText(" Patient(s) returned: " + count); } else { if (obfsc) { jSetSizeLabel.setText(" Patient(s) returned: " + "~" + count); } else { jSetSizeLabel.setText(" Patient(s) returned: " + count); } } } 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."); jSetSizeLabel.setText(" Patient(s) returned: Error"); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } // setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } // jRunQueryButton.setBackground(defaultcolor); final IWorkbenchPage page = ((QueryToolInvestigatorPanel) parentPanel).parentview .getViewSite().getPage(); ViewPart previousqueryview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.previousquery.views.PreviousQueryView"); ((ICommonMethod) previousqueryview).doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + nameNode.id()); /* * final ArrayList<String> nodeXmls = new * ArrayList<String>(); for (int i = 0; i < * dataModel .getCurrentPanelCount(); i++) { * ArrayList<QueryConceptTreeNodeData> nodelist = * dataModel .getTreePanel(i).getItems(); for (int j * = 0; j < nodelist.size(); j++) { * QueryConceptTreeNodeData nodedata = nodelist * .get(j); String termStatus = nodedata * .setXmlContent(); if * (termStatus.equalsIgnoreCase("error")) { * JOptionPane .showMessageDialog( parentPanel, * "Response delivered from the remote server could not be understood,\n" * + "you may wish to retry your last action."); * jRunQueryButton.setIcon(null); if * (jGetAllPatientsCheckBox .isSelected()) { * jRunQueryButton .setText("Get All Patients"); } * else { jRunQueryButton * .setText("Run Query Above"); } return; } * nodeXmls.add(nodedata.xmlContent()); } } */ ViewPart explorerview = null; if (timeline) { try { explorerview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.explorer.views.ExplorerView"); } catch (Exception e) { if (jOptionsPanel.hasGraphicAnalysis()) { ViewPart analysisview = (ViewPart) page.findView( "edu.harvard.i2b2.eclipse.plugins.analysis.views.AnalysisView"); ((ICommonMethod) analysisview) .doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + instanceNode.id()); } } } if (explorerview != null) { // && // timeline){//jShowTimelineCheckBox.isSelected()) // { String str1 = "" + count; String str2 = "-" + refId; ((ICommonMethod) explorerview).doSomething(str1 + str2); ((ICommonMethod) explorerview).processQuery(nameNode.id()); // .doSomething(nameNode);//nodeXmls); } if (jOptionsPanel.hasGraphicAnalysis()) { ViewPart analysisview = (ViewPart) page .findView("edu.harvard.i2b2.eclipse.plugins.analysis.views.AnalysisView"); ((ICommonMethod) analysisview).doSomething(nameNode.name() + " [" + dataModel.getDayString() + "]" + "#i2b2seperater#" + instanceNode.id()); } } else { if (statusType.getValue().startsWith("LOCKEDOUT")) { JOptionPane.showMessageDialog(parentPanel, "Unable to process the query because your account has been locked out,\n" + "please contact your administrator."); // + "you may wish to retry your last action"); } else { JOptionPane.showMessageDialog(parentPanel, "Error message delivered from the remote server, " + "you may wish to retry your last action"); } jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } } 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."); jRunQueryButton.setIcon(null); if (jGetAllPatientsCheckBox.isSelected()) { jRunQueryButton.setText("Get All Patients"); } else { jRunQueryButton.setText("Run Query Above"); } return; } } } }; try { queryThread.start(); } catch (Exception e) { e.printStackTrace(); parentPanel.setResponseText(e.getMessage()); } }