Example usage for javax.swing JOptionPane PLAIN_MESSAGE

List of usage examples for javax.swing JOptionPane PLAIN_MESSAGE

Introduction

In this page you can find the example usage for javax.swing JOptionPane PLAIN_MESSAGE.

Prototype

int PLAIN_MESSAGE

To view the source code for javax.swing JOptionPane PLAIN_MESSAGE.

Click Source Link

Document

No icon is used.

Usage

From source file:com.igormaznitsa.sciareto.ui.MainFrame.java

private void menuAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAboutActionPerformed
    JOptionPane.showMessageDialog(Main.getApplicationFrame(), new AboutPanel(), "About",
            JOptionPane.PLAIN_MESSAGE);
}

From source file:com.vgi.mafscaling.OpenLoop.java

protected void loadLogFile() {
    fileChooser.setMultiSelectionEnabled(true);
    if (JFileChooser.APPROVE_OPTION != fileChooser.showOpenDialog(this))
        return;//from w w w .j  a  va2 s  .  com
    boolean isPolSet = polfTable.isSet();
    File[] files = fileChooser.getSelectedFiles();
    for (File file : files) {
        BufferedReader br = null;
        ArrayDeque<String[]> buffer = new ArrayDeque<String[]>();
        try {
            br = new BufferedReader(new FileReader(file.getAbsoluteFile()));
            String line = br.readLine();
            if (line != null) {
                String[] elements = line.split("(\\s*)?,(\\s*)?", -1);
                getColumnsFilters(elements, false);

                boolean resetColumns = false;
                if (logThtlAngleColIdx >= 0 || logAfLearningColIdx >= 0 || logAfCorrectionColIdx >= 0
                        || logMafvColIdx >= 0 || logAfrColIdx >= 0 || logRpmColIdx >= 0 || logLoadColIdx >= 0
                        || logCommandedAfrCol >= 0) {
                    if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
                            "Would you like to reset column names or filter values?", "Columns/Filters Reset",
                            JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE))
                        resetColumns = true;
                }

                if (resetColumns || logThtlAngleColIdx < 0 || logAfLearningColIdx < 0
                        || logAfCorrectionColIdx < 0 || logMafvColIdx < 0 || logAfrColIdx < 0
                        || logRpmColIdx < 0 || logLoadColIdx < 0 || (logCommandedAfrCol < 0 && !isPolSet)) {
                    ColumnsFiltersSelection selectionWindow = new OLColumnsFiltersSelection(isPolSet);
                    if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements, isPolSet))
                        return;
                }

                String[] flds;
                String[] afrflds;
                boolean wotFlag = true;
                boolean foundWot = false;
                double throttle;
                double stft;
                double ltft;
                double afr;
                double rpm;
                double load;
                double mafv;
                double cmdafr = 0;
                double afrErr = 0;
                int skipRowCount = 0;
                int row = 0;
                int i = 0;
                int j = 0;
                for (; i < runTables.length; ++i) {
                    if (runTables[i].getValueAt(0, 0).toString().isEmpty())
                        break;
                }
                if (i == runTables.length)
                    return;
                setCursor(new Cursor(Cursor.WAIT_CURSOR));
                for (int k = 0; k <= afrRowOffset && line != null; ++k) {
                    line = br.readLine();
                    if (line != null)
                        buffer.addFirst(line.split(",", -1));
                }
                while (line != null && buffer.size() > afrRowOffset) {
                    afrflds = buffer.getFirst();
                    flds = buffer.removeLast();
                    line = br.readLine();
                    if (line != null)
                        buffer.addFirst(line.split(",", -1));

                    try {
                        throttle = Double.valueOf(flds[logThtlAngleColIdx]);
                        if (row == 0 && throttle < 99)
                            wotFlag = false;
                        if (throttle < wotPoint) {
                            if (wotFlag == true) {
                                wotFlag = false;
                                skipRowCount = 0;
                                j -= 1;
                                while (j > 0 && skipRowCount < skipRowsOnTransition) {
                                    runTables[i].setValueAt("", j, 0);
                                    runTables[i].setValueAt("", j, 1);
                                    runTables[i].setValueAt("", j, 2);
                                    skipRowCount += 1;
                                    j -= 1;
                                }
                                skipRowCount = 0;
                            }
                        } else {
                            if (wotFlag == false) {
                                wotFlag = true;
                                skipRowCount = 0;
                                if (foundWot) {
                                    i += 1;
                                    if (i == runTables.length)
                                        return;
                                }
                                if (row > 0)
                                    j = 0;
                            }
                            if (skipRowCount >= skipRowsOnTransition) {
                                mafv = Double.valueOf(flds[logMafvColIdx]);
                                if (minMafV <= mafv) {
                                    foundWot = true;
                                    stft = Double.valueOf(flds[logAfCorrectionColIdx]);
                                    ltft = Double.valueOf(flds[logAfLearningColIdx]);
                                    afr = Double.valueOf(afrflds[logAfrColIdx]);
                                    rpm = Double.valueOf(flds[logRpmColIdx]);
                                    load = Double.valueOf(flds[logLoadColIdx]);

                                    afr = afr / ((100.0 - (ltft + stft)) / 100.0);

                                    if (logCommandedAfrCol >= 0)
                                        cmdafr = Double.valueOf(flds[logCommandedAfrCol]);
                                    else if (isPolSet)
                                        cmdafr = Utils.calculateCommandedAfr(rpm, load, minWotEnrichment,
                                                polfTable);
                                    else {
                                        JOptionPane.showMessageDialog(null,
                                                "Please set either \"Commanded AFR\" column or \"Primary Open Loop Fueling\" table",
                                                "Error", JOptionPane.ERROR_MESSAGE);
                                        return;
                                    }

                                    afrErr = (afr - cmdafr) / cmdafr * 100.0;
                                    if (Math.abs(afrErr) <= afrErrPrct) {
                                        Utils.ensureRowCount(j + 1, runTables[i]);
                                        runTables[i].setValueAt(rpm, j, 0);
                                        runTables[i].setValueAt(mafv, j, 1);
                                        runTables[i].setValueAt(afrErr, j, 2);
                                        j += 1;
                                    }
                                }
                            }
                            skipRowCount += 1;
                        }
                    } catch (NumberFormatException e) {
                        logger.error(e);
                        JOptionPane.showMessageDialog(null,
                                "Error parsing number at " + file.getName() + " line " + (row + 1) + ": " + e,
                                "Error processing file", JOptionPane.ERROR_MESSAGE);
                        return;
                    }
                    row += 1;
                }

                if (!foundWot) {
                    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                    JOptionPane.showMessageDialog(null, "Sorry, no WOT pulls were found in the log file",
                            "No WOT data", JOptionPane.INFORMATION_MESSAGE);
                }
            }
        } catch (Exception e) {
            logger.error(e);
            JOptionPane.showMessageDialog(null, e, "Error opening file", JOptionPane.ERROR_MESSAGE);
        } finally {
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    logger.error(e);
                }
            }
        }
    }
}

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;/*from w  ww  .  j a  v  a  2 s.  co  m*/
    }

    // /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:course_generator.param.frmEditCurve.java

/**
 * Add a new curve to the curve list/*w w w .  jav  a2 s .c  o m*/
 */
protected void AddCurve() {
    if (!bEditMode) {

        JPanel panel = new JPanel(new GridLayout(0, 1));
        panel.add(new JLabel(bundle.getString("frmEditCurve.AddCurvePanel.name.text")));
        JTextField tfName = new JTextField("");
        panel.add(tfName);
        int result = JOptionPane.showConfirmDialog(this, panel,
                bundle.getString("frmEditCurve.AddCurvePanel.title"), JOptionPane.OK_CANCEL_OPTION,
                JOptionPane.PLAIN_MESSAGE);
        if ((result == JOptionPane.OK_OPTION) && (!tfName.getText().isEmpty())) {
            if (Utils.FileExist(Utils.GetHomeDir() + "/" + CgConst.CG_DIR + "/" + tfName.getText() + ".par")) {
                JOptionPane.showMessageDialog(this,
                        bundle.getString("frmEditCurve.AddCurvePanelPanel.fileexist"));
                return;
            }

            //-- Add the 2 extrem points to the list and sort the list (not really necessary...)
            param = new ParamData();
            param.name = tfName.getText();
            param.data.add(new CgParam(-50.0, 0));
            param.data.add(new CgParam(50.0, 0));
            Collections.sort(param.data);

            //-- Update
            tablemodel.setParam(param);

            Old_Paramfile = Paramfile;
            Paramfile = param.name;

            bEditMode = true;
            ChangeEditStatus();
            RefreshView();
        }
    }
}

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;/*  ww  w .  j  av a  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());
    }
}

From source file:com.ftb2om2.view.MultiplePane.java

private void createOsuFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createOsuFileActionPerformed
    Converter converter;//from  w  ww.ja  va2  s  . c  o m
    Reader reader = null;
    Writer writer = null;

    switch (jComboBox1.getSelectedIndex()) {
    case 0:
        reader = new FtbAirReader();
        break;
    case 1:
        reader = new FtbOldReader();
        break;
    }

    switch (jComboBox2.getSelectedIndex()) {
    case 0:
        writer = new OsuManiaV14Writer();
    }
    converter = new Converter(reader, writer);

    Metadata metadata = new Metadata(mP3TagsPane1.getTitleField(), mP3TagsPane1.getUnicodeTitleField(),
            mP3TagsPane1.getArtistField(), mP3TagsPane1.getUnicodeArtistField(), mP3TagsPane1.getCreatorField(),
            mP3TagsPane1.getSourceField());

    DefaultTableModel model = (DefaultTableModel) difficultyTable.getModel();
    List<List<Object>> data = model.getDataVector();

    Boolean valid = true;

    for (List row : data) {
        if (row.get(2).toString().isEmpty() && valid == true) {
            JOptionPane.showMessageDialog(jPanel6,
                    "Difficulty " + row.get(1).toString() + " Has no output name!", "Error",
                    JOptionPane.ERROR_MESSAGE);
            valid = false;
        }
    }

    if (valid) {
        try {
            List<Difficulty> difficulties = new LinkedList<>();
            Zipper zipper = new Zipper();
            for (List row : data) {
                converter.convert(row.get(1).toString(), outputFolder.getText(), row.get(2).toString(),
                        Integer.parseInt(hitsoundVolume.getValue().toString()), metadata);

                difficulties.add(new Difficulty(row.get(2).toString(), row.get(2).toString()));
            }
            zipper.createOSZ(audioFieldMulti.getText(), outputFolder.getText(), difficulties);

            JOptionPane.showMessageDialog(jPanel6, "Difficulties created succesfully!", "Success!",
                    JOptionPane.PLAIN_MESSAGE);
        } catch (IOException e) {
            handleError(e);
        }
    }
}

From source file:com.codejumble.opentube.Main.java

/**
 * Opens a small dialog showing some info about OpenTube
 *
 * @param evt Swing event/*  ww  w  . j ava2  s. c om*/
 */
private void aboutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutItemActionPerformed
    JOptionPane.showMessageDialog(this, "OpenTube v" + SOFTWARE_VERSION + "\nVisit www.codejumble.com",
            "About OpenTube", JOptionPane.PLAIN_MESSAGE);
}

From source file:pi.bestdeal.gui.InterfacePrincipale.java

private void Update_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Update_ButtonActionPerformed
    DealDAO dealdao = DealDAO.getInstance();
    Modifier_Ajouter modaj = new Modifier_Ajouter();
    Deal abc = new Deal();
    Deal deal = new Deal();
    int idd = (int) jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 0);
    List<Deal> listdeal = dealdao
            .displayDealById((int) jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 0));
    for (Deal a : listdeal) {
        abc = a;// w  w  w  .jav  a2s  . c  o  m
    }
    modaj.txtTitre.setText(abc.getTitreDeal_Deal());
    modaj.txtDesc.setText(abc.getDescDeal_Deal());
    modaj.txtPrix.setText(abc.getPrixDeal_Deal().toString());
    modaj.txtValidation.setText(String.valueOf(abc.getNbrAchatValidation()));
    modaj.jdateDebut.setDate(abc.getDateDebutDeal_Deal());
    modaj.jdateFin.setDate(abc.getDateFinDeal_Deal());
    if (abc.isStatutDeal() == true) {
        modaj.jCheckBox1.setSelected(true);
    } else {
        modaj.jCheckBox1.setSelected(false);
    }
    if (abc.getEtatDeal_Deal().toString().equals("Pass")) {
        modaj.jComboBox1.setSelectedIndex(0);
    }
    if (abc.getEtatDeal_Deal().toString().equals("Courant")) {
        modaj.jComboBox1.setSelectedIndex(1);
    }
    if (abc.getEtatDeal_Deal().toString().equals("Comming")) {
        modaj.jComboBox1.setSelectedIndex(2);
    }

    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("High-Tech")) {
        modaj.ComboCategorie.setSelectedIndex(0);
    }
    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("Bricolage")) {
        modaj.ComboCategorie.setSelectedIndex(1);
    }
    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("Bijouterie")) {
        modaj.ComboCategorie.setSelectedIndex(2);
    }
    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("Vacances&Sorties")) {
        modaj.ComboCategorie.setSelectedIndex(3);
    }

    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("Beaut")) {
        modaj.ComboCategorie.setSelectedIndex(4);
    }
    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("Accessoires&Vtements")) {
        modaj.ComboCategorie.setSelectedIndex(5);
    }
    if (abc.getCategorie_Deal().toString().equalsIgnoreCase("Divers")) {
        modaj.ComboCategorie.setSelectedIndex(6);
    }
    abc.setEtatDeal_Deal(modaj.jComboBox1.getSelectedItem().toString());
    int result = JOptionPane.showConfirmDialog(null, modaj, "Test", JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.PLAIN_MESSAGE);
    if (result == JOptionPane.OK_OPTION) {

        deal.setTitreDeal_Deal(modaj.txtTitre.getText());
        Vendeur vendeur = new Vendeur();
        VendeurDAO daov = VendeurDAO.getInstance();
        for (Vendeur a : daov.displayvendeurByNom(modaj.jList1.getSelectedValue().toString())) {
            vendeur = a;
        }
        deal.setIdDeal_Deal(idd);
        deal.setDescDeal_Deal(modaj.txtDesc.getText());
        deal.setPrixDeal_Deal(Double.valueOf(modaj.txtPrix.getText()));
        deal.setNbrAchatValidation(Integer.valueOf(modaj.txtValidation.getText()));
        deal.setNbrAchatActuelDeal_Deal(0);
        deal.setNbrAffichage_Deal(0);
        deal.setEtatDeal_Deal(modaj.jComboBox1.getSelectedItem().toString());
        java.util.Date d1 = modaj.jdateDebut.getCalendar().getTime();
        java.sql.Date sqlDate = new java.sql.Date(d1.getTime());
        java.util.Date d2 = modaj.jdateFin.getCalendar().getTime();
        java.sql.Date sqlDate2 = new java.sql.Date(d2.getTime());
        deal.setDateDebutDeal_Deal(sqlDate);
        deal.setDateFinDeal_Deal(sqlDate2);
        deal.setCategorie_Deal(modaj.ComboCategorie.getSelectedItem().toString());

        deal.setIdVendeur_Deal(vendeur.getIdVendeur());
        if (modaj.jCheckBox1.isSelected()) {
            deal.setStatutDeal_Deal(true);
        } else {
            deal.setStatutDeal_Deal(false);
        }
        int f = dealdao.updateDeal(deal);
        if (f == 1) {
            JOptionPane.showMessageDialog(null, "Deal modifi");

            DealTableModel mymodel = new DealTableModel(list.displayDeal());
            jTable1.setModel(mymodel);
            jTable1.removeColumn(jTable1.getColumn("ID"));
            jTable1.removeColumn(jTable1.getColumn("Description"));
            jTable1.removeColumn(jTable1.getColumn("Achat Actuel"));
            jTable1.removeColumn(jTable1.getColumn("Etat"));
            jTable1.removeColumn(jTable1.getColumn("Statut"));
            jTable1.removeColumn(jTable1.getColumn("Nombre d'Affichage"));
            jTable1.removeColumn(jTable1.getColumn("Vendeur"));
            jTable1.getColumnModel().setColumnMargin(20);
            if (!list.displayDeal().isEmpty()) {
                jTable1.setRowSelectionInterval(0, 0);
            }
        }
    } else {
        System.out.println("Cancelled");
    }

}

From source file:com.sshtools.appframework.ui.SshToolsApplication.java

/**
 * Show an 'About' dialog/*www.  ja va  2s . c  o m*/
 */
public void showAbout(Component parent) {
    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);
    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);
    JLabel v = new JLabel("Version " + getApplicationVersion());
    v.setFont(v.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER);
    MultilineLabel x = new MultilineLabel(getAboutLicenseDetails());
    x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    x.setFont(x.getFont().deriveFont(12f));
    UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER);
    MultilineLabel c = new MultilineLabel(getExpiryInfo());
    c.setFont(c.getFont().deriveFont(10f));
    UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER);
    final JLabel h = new JLabel(getAboutURL());
    h.setForeground(Color.blue);
    h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10));
    h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    h.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            try {
                BrowserLauncher.openURL(getAboutURL());
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
    UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER);
    JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon());
}

From source file:edu.harvard.i2b2.previousquery.QueryPreviousRunsPanel.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equalsIgnoreCase("Rename ...")) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent();
        QueryMasterData ndata = (QueryMasterData) node.getUserObject();
        Object inputValue = JOptionPane.showInputDialog(this, "Rename this query to: ", "Rename Query Dialog",
                JOptionPane.PLAIN_MESSAGE, null, null,
                ndata.name().substring(0, ndata.name().lastIndexOf("[") - 1));

        if (inputValue != null) {
            String newQueryName = (String) inputValue;
            String requestXml = ndata.writeRenameQueryXML(newQueryName);
            lastRequestMessage = requestXml;

            setCursor(new Cursor(Cursor.WAIT_CURSOR));

            String response = QueryListNamesClient.sendQueryRequestREST(requestXml);
            if (response.equalsIgnoreCase("CellDown")) {
                final JPanel parent = this;
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        JOptionPane.showMessageDialog(parent,
                                "Trouble with connection to the remote server, "
                                        + "this is often a network error, please try again",
                                "Network Error", JOptionPane.INFORMATION_MESSAGE);
                    }//from  w  w w.  jav a 2 s . c o  m
                });
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                return;
            }
            lastResponseMessage = response;

            if (response != null) {
                JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil();

                try {
                    JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response);
                    ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue();
                    StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus();
                    String status = statusType.getType();

                    if (status.equalsIgnoreCase("DONE")) {
                        ndata.name(newQueryName + " [" + ndata.userId() + "]");
                        node.setUserObject(ndata);
                        //DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();

                        jTree1.repaint();
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    } else if (e.getActionCommand().equalsIgnoreCase("Delete")) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent();
        QueryMasterData ndata = (QueryMasterData) node.getUserObject();
        Object selectedValue = JOptionPane.showConfirmDialog(this, "Delete Query \"" + ndata.name() + "\"?",
                "Delete Query Dialog", JOptionPane.YES_NO_OPTION);
        if (selectedValue.equals(JOptionPane.YES_OPTION)) {
            System.out.println("delete " + ndata.name());
            String requestXml = ndata.writeDeleteQueryXML();
            lastRequestMessage = requestXml;
            //System.out.println(requestXml);

            setCursor(new Cursor(Cursor.WAIT_CURSOR));

            String response = QueryListNamesClient.sendQueryRequestREST(requestXml);
            if (response.equalsIgnoreCase("CellDown")) {
                final JPanel parent = this;
                java.awt.EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        JOptionPane.showMessageDialog(parent,
                                "Trouble with connection to the remote server, "
                                        + "this is often a network error, please try again",
                                "Network Error", JOptionPane.INFORMATION_MESSAGE);
                    }
                });
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                return;
            }
            lastResponseMessage = response;

            if (response != null) {
                JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil();

                try {
                    JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response);
                    ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue();
                    StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus();
                    String status = statusType.getType();

                    if (status.equalsIgnoreCase("DONE")) {
                        treeModel.removeNodeFromParent(node);

                        //jTree1.repaint();
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    } else if (e.getActionCommand().equalsIgnoreCase("Refresh All")) {
        String status = loadPreviousQueries(false);
        if (status.equalsIgnoreCase("")) {
            reset(200, false);
        } else if (status.equalsIgnoreCase("CellDown")) {
            final JPanel parent = this;
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    JOptionPane.showMessageDialog(parent,
                            "Trouble with connection to the remote server, "
                                    + "this is often a network error, please try again",
                            "Network Error", JOptionPane.INFORMATION_MESSAGE);
                }
            });
        }
    }
}