Example usage for javax.swing JOptionPane WARNING_MESSAGE

List of usage examples for javax.swing JOptionPane WARNING_MESSAGE

Introduction

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

Prototype

int WARNING_MESSAGE

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

Click Source Link

Document

Used for warning messages.

Usage

From source file:de.bfs.radon.omsimulation.gui.OMPanelData.java

/**
 * Initialises the interface of the data panel.
 *//*from  ww  w  . j a v a2 s  .c om*/
protected void initialize() {
    setLayout(null);

    lblExportChartTo = new JLabel("Export chart to ...");
    lblExportChartTo.setBounds(436, 479, 144, 14);
    lblExportChartTo.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblExportChartTo.setVisible(false);
    add(lblExportChartTo);

    btnCsv = new JButton("CSV");
    btnCsv.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.csv", "csv"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String csv;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("csv")) {
                    csv = "";
                } else {
                    csv = ".csv";
                }
                String csvPath = file.getAbsolutePath() + csv;
                OMRoom selectedRoom = (OMRoom) comboBoxRooms.getSelectedItem();
                double[] selectedValues = selectedRoom.getValues();
                File csvFile = new File(csvPath);
                try {
                    FileWriter logWriter = new FileWriter(csvFile);
                    BufferedWriter csvOutput = new BufferedWriter(logWriter);
                    csvOutput.write("\"ID\";\"" + selectedRoom.getId() + "\"");
                    csvOutput.newLine();
                    for (int i = 0; i < selectedValues.length; i++) {
                        csvOutput.write("\"" + i + "\";\"" + (int) selectedValues[i] + "\"");
                        csvOutput.newLine();
                    }
                    JOptionPane.showMessageDialog(null, "CSV saved successfully!\n" + csvPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                    csvOutput.close();
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write CSV. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write CSV. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnCsv.setBounds(590, 475, 70, 23);
    btnCsv.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnCsv.setVisible(false);
    add(btnCsv);

    btnPdf = new JButton("PDF");
    btnPdf.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.pdf", "pdf"));
            fileDialog.showSaveDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String pdf;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("pdf")) {
                    pdf = "";
                } else {
                    pdf = ".pdf";
                }
                String pdfPath = file.getAbsolutePath() + pdf;
                OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                String title = building.getName();
                OMRoom selectedRoom = (OMRoom) comboBoxRooms.getSelectedItem();
                JFreeChart chart = OMCharts.createRoomChart(title, selectedRoom, false);
                int height = (int) PageSize.A4.getWidth();
                int width = (int) PageSize.A4.getHeight();
                try {
                    OMExports.exportPdf(pdfPath, chart, width, height, new DefaultFontMapper(), title);
                    JOptionPane.showMessageDialog(null, "PDF saved successfully!\n" + pdfPath, "Success",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                            "Failed to write PDF. Please check permissions!\n" + ioe.getMessage(), "Failed",
                            JOptionPane.ERROR_MESSAGE);
                    ioe.printStackTrace();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Failed to write PDF. Please check the file path!",
                        "Failed", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
    btnPdf.setBounds(670, 475, 70, 23);
    btnPdf.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnPdf.setVisible(false);
    add(btnPdf);

    lblSelectProject = new JLabel("Select Project");
    lblSelectProject.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectProject.setBounds(10, 65, 132, 14);
    add(lblSelectProject);

    lblSelectRoom = new JLabel("Select Room");
    lblSelectRoom.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectRoom.setBounds(10, 94, 132, 14);
    add(lblSelectRoom);

    panelData = new JPanel();
    panelData.setBounds(10, 118, 730, 347);
    add(panelData);

    btnRefresh = new JButton("Load");
    btnRefresh.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (txtOmbFile.getText() != null && !txtOmbFile.getText().equals("")
                    && !txtOmbFile.getText().equals(" ")) {
                txtOmbFile.setBackground(Color.WHITE);
                String ombPath = txtOmbFile.getText();
                String omb;
                String[] tmpFileName = ombPath.split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("omb")) {
                    omb = "";
                } else {
                    omb = ".omb";
                }
                txtOmbFile.setText(ombPath + omb);
                setOmbFile(ombPath + omb);
                File ombFile = new File(ombPath + omb);
                if (ombFile.exists()) {
                    txtOmbFile.setBackground(Color.WHITE);
                    btnRefresh.setEnabled(false);
                    comboBoxProjects.setEnabled(false);
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    btnPdf.setVisible(false);
                    btnCsv.setVisible(false);
                    lblExportChartTo.setVisible(false);
                    progressBar.setVisible(true);
                    progressBar.setStringPainted(true);
                    progressBar.setIndeterminate(true);
                    refreshProjectsTask = new RefreshProjects();
                    refreshProjectsTask.execute();
                } else {
                    txtOmbFile.setBackground(new Color(255, 222, 222, 128));
                    JOptionPane.showMessageDialog(null, "OMB-file not found, please check the file path!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                }
            } else {
                txtOmbFile.setBackground(new Color(255, 222, 222, 128));
                JOptionPane.showMessageDialog(null, "Please select an OMB-file!", "Warning",
                        JOptionPane.WARNING_MESSAGE);
            }
        }
    });
    btnRefresh.setBounds(616, 61, 124, 23);
    add(btnRefresh);

    btnMaximize = new JButton("Fullscreen");
    btnMaximize.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnMaximize.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxRooms.isEnabled()) {
                if (comboBoxRooms.getSelectedItem() != null) {
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    String title = building.getName();
                    OMRoom room = (OMRoom) comboBoxRooms.getSelectedItem();
                    panelRoom = createRoomPanel(title, room, false, false);
                    JFrame chartFrame = new JFrame();
                    JPanel chartPanel = createRoomPanel(title, room, false, true);
                    chartFrame.getContentPane().add(chartPanel);
                    chartFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
                    chartFrame.setBounds(0, 0, (int) dim.getWidth(), (int) dim.getHeight());
                    chartFrame.setTitle("OM Simulation Tool: " + title + ", Room " + room.getId());
                    chartFrame.setResizable(true);
                    chartFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                    chartFrame.setVisible(true);
                }
            }
        }
    });
    btnMaximize.setBounds(10, 475, 124, 23);
    btnMaximize.setVisible(false);
    add(btnMaximize);

    comboBoxProjects = new JComboBox<OMBuilding>();
    comboBoxProjects.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    comboBoxProjects.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            boolean b = false;
            Color c = null;
            if (comboBoxProjects.isEnabled()) {
                if (comboBoxProjects.getSelectedItem() != null) {
                    b = true;
                    c = Color.WHITE;
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    comboBoxRooms.removeAllItems();
                    for (int i = 0; i < building.getRooms().length; i++) {
                        comboBoxRooms.addItem(building.getRooms()[i]);
                    }
                    for (int i = 0; i < building.getCellars().length; i++) {
                        comboBoxRooms.addItem(building.getCellars()[i]);
                    }
                    for (int i = 0; i < building.getMiscs().length; i++) {
                        comboBoxRooms.addItem(building.getMiscs()[i]);
                    }
                } else {
                    b = false;
                    c = null;
                }
            } else {
                b = false;
                c = null;
            }
            lblSelectRoom.setEnabled(b);
            panelData.setEnabled(b);
            btnMaximize.setVisible(b);
            comboBoxRooms.setEnabled(b);
            panelData.setBackground(c);
        }
    });
    comboBoxProjects.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            boolean b = false;
            Color c = null;
            if (comboBoxProjects.isEnabled()) {
                if (comboBoxProjects.getSelectedItem() != null) {
                    b = true;
                    c = Color.WHITE;
                    OMBuilding building = (OMBuilding) comboBoxProjects.getSelectedItem();
                    comboBoxRooms.removeAllItems();
                    for (int i = 0; i < building.getRooms().length; i++) {
                        comboBoxRooms.addItem(building.getRooms()[i]);
                    }
                    for (int i = 0; i < building.getCellars().length; i++) {
                        comboBoxRooms.addItem(building.getCellars()[i]);
                    }
                    for (int i = 0; i < building.getMiscs().length; i++) {
                        comboBoxRooms.addItem(building.getMiscs()[i]);
                    }
                } else {
                    b = false;
                    c = null;
                }
            } else {
                b = false;
                c = null;
            }
            lblSelectRoom.setEnabled(b);
            panelData.setEnabled(b);
            btnMaximize.setVisible(b);
            comboBoxRooms.setEnabled(b);
            panelData.setBackground(c);
        }
    });
    comboBoxProjects.setBounds(152, 61, 454, 22);
    add(comboBoxProjects);

    comboBoxRooms = new JComboBox<OMRoom>();
    comboBoxRooms.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    comboBoxRooms.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (comboBoxRooms.isEnabled()) {
                if (comboBoxRooms.getSelectedItem() != null) {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    remove(panelData);
                    comboBoxRooms.setEnabled(false);
                    refreshChartsTask = new RefreshCharts();
                    refreshChartsTask.execute();
                }
            }
        }
    });
    comboBoxRooms.setBounds(152, 90, 454, 22);
    add(comboBoxRooms);

    progressBar = new JProgressBar();
    progressBar.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    progressBar.setBounds(10, 475, 730, 23);
    progressBar.setVisible(false);
    add(progressBar);

    lblSelectRoom.setEnabled(false);
    panelData.setEnabled(false);
    comboBoxRooms.setEnabled(false);

    lblHelp = new JLabel(
            "Select an OMB-Object file to analyse its data. You can inspect radon concentration for each room.");
    lblHelp.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblHelp.setForeground(Color.GRAY);
    lblHelp.setBounds(10, 10, 730, 14);
    add(lblHelp);

    txtOmbFile = new JTextField();
    txtOmbFile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    txtOmbFile.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            setOmbFile(txtOmbFile.getText());
        }
    });
    txtOmbFile.setBounds(152, 33, 454, 20);
    add(txtOmbFile);
    txtOmbFile.setColumns(10);

    btnBrowse = new JButton("Browse");
    btnBrowse.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    btnBrowse.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            JFileChooser fileDialog = new JFileChooser();
            fileDialog.setFileFilter(new FileNameExtensionFilter("*.omb", "omb"));
            fileDialog.showOpenDialog(getParent());
            final File file = fileDialog.getSelectedFile();
            if (file != null) {
                String omb;
                String[] tmpFileName = file.getAbsolutePath().split("\\.");
                if (tmpFileName[tmpFileName.length - 1].equals("omb")) {
                    omb = "";
                } else {
                    omb = ".omb";
                }
                txtOmbFile.setText(file.getAbsolutePath() + omb);
                setOmbFile(file.getAbsolutePath() + omb);
            }
        }
    });
    btnBrowse.setBounds(616, 32, 124, 23);
    add(btnBrowse);

    lblSelectOmbfile = new JLabel("Select OMB-File");
    lblSelectOmbfile.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11));
    lblSelectOmbfile.setBounds(10, 36, 132, 14);
    add(lblSelectOmbfile);
}

From source file:jatoo.app.App.java

/**
 * Displays a warning message.//from   w  ww.  j a v  a 2s.  c o  m
 * 
 * @param message
 *          the message to display
 */
public void showWarningMessage(final String message) {
    JOptionPane.showMessageDialog(window, message, getTitle(), JOptionPane.WARNING_MESSAGE);
}

From source file:com.tiempometa.muestradatos.JMuestraDatos.java

private void clearTagsMenuItemActionPerformed(ActionEvent e) {
    int response = JOptionPane.showConfirmDialog(this,
            "Seguro que desea borrar todos los tags? Esta operacin no se puede deshacer", "Borrar tags",
            JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
    if (response == JOptionPane.YES_OPTION) {
        try {/*w  w  w .  j av a  2s  . co m*/
            rfidDao.deleteAll();
            JOptionPane.showMessageDialog(this, "Se borraron todos los tags", "Despejar Tags",
                    JOptionPane.PLAIN_MESSAGE);
        } catch (SQLException e1) {
            JOptionPane.showMessageDialog(this, "Error despejando tags " + e1.getMessage(), "Despejar Tags",
                    JOptionPane.ERROR_MESSAGE);
        }
    }
}

From source file:io.github.jeddict.jpa.modeler.properties.convert.OverrideConvertPanel.java

private boolean validateField() {
    //        if (this.converter_EditorPane.getText().trim().length() <= 0 && !disableConversion_CheckBox.isSelected()) {
    //            JOptionPane.showMessageDialog(this, getMessage(OverrideConvertPanel.class, "MSG_Validation"), "Invalid Value", javax.swing.JOptionPane.WARNING_MESSAGE);
    //            return false;
    //        }//from   w  w w  . j  a  v  a2 s. c  om

    if (attribute_ComboBox.isEnabled()
            && this.attribute_ComboBox.getSelectedItem().toString().trim().length() <= 0
            && !disableConversion_CheckBox.isSelected()) {
        JOptionPane.showMessageDialog(this, "Attribute name can't be empty", "Invalid Value",
                javax.swing.JOptionPane.WARNING_MESSAGE);
        return false;
    }

    AtomicBoolean validated = new AtomicBoolean(false);
    importAttributeConverter(converter_EditorPane.getText(), validated, modelerFile);

    return validated.get();
}

From source file:com.sshtools.sshterm.SshTermSessionPanel.java

/**
 *
 *
 * @param event/*from  w ww .  j  a  v a  2  s  . c om*/
 */
public void actionPerformed(ActionEvent event) {
    // Get the name of the action command
    String command = event.getActionCommand();

    if ((stopAction != null) && command.equals(stopAction.getActionCommand())) {
        stopRecording();
    }

    if ((recordAction != null) && command.equals(recordAction.getActionCommand())) {
        //  We need to go back to windowed mode if in full screen mode
        setFullScreenMode(false);

        // Select the file to record to
        JFileChooser fileDialog = new JFileChooser(System.getProperty("user.home"));
        int ret = fileDialog.showSaveDialog(this);

        if (ret == fileDialog.APPROVE_OPTION) {
            recordingFile = fileDialog.getSelectedFile();

            if (recordingFile.exists()
                    && (JOptionPane.showConfirmDialog(this, "File exists. Are you sure?", "File exists",
                            JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION)) {
                return;
            }

            try {
                recordingOutputStream = new FileOutputStream(recordingFile);
                statusBar.setStatusText("Recording to " + recordingFile.getName());
                setAvailableActions();
            } catch (IOException ioe) {
                showExceptionMessage("Error", "Could not open file for recording\n\n" + ioe.getMessage());
            }
        }
    }

    if ((playAction != null) && command.equals(playAction.getActionCommand())) {
        //  We need to go back to windowed mode if in full screen mode
        setFullScreenMode(false);

        // Select the file to record to
        JFileChooser fileDialog = new JFileChooser(System.getProperty("user.home"));
        int ret = fileDialog.showOpenDialog(this);

        if (ret == fileDialog.APPROVE_OPTION) {
            File playingFile = fileDialog.getSelectedFile();
            InputStream in = null;

            try {
                statusBar.setStatusText("Playing from " + playingFile.getName());
                in = new FileInputStream(playingFile);

                byte[] b = null;
                int a = 0;

                while (true) {
                    a = in.available();

                    if (a == -1) {
                        break;
                    }

                    if (a == 0) {
                        a = 1;
                    }

                    b = new byte[a];
                    a = in.read(b);

                    if (a == -1) {
                        break;
                    }

                    //emulation.write(b);
                    emulation.getOutputStream().write(b);
                }

                statusBar.setStatusText("Finished playing " + playingFile.getName());
                setAvailableActions();
            } catch (IOException ioe) {
                statusBar.setStatusText("Error playing " + playingFile.getName());
                showExceptionMessage("Error", "Could not open file for playback\n\n" + ioe.getMessage());
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException ioe) {
                        log.error(ioe);
                    }
                }
            }
        }
    }

    if ((closeAction != null) && command.equals(closeAction.getActionCommand())) {
        closeSession();
    }
}

From source file:livecanvas.mesheditor.MeshEditor.java

private void save(File file) {
    if (!canSave()) {
        return;/* w w  w. j av  a2  s  . co m*/
    }
    if (file == null) {
        FileDialog fd = new FileDialog(JOptionPane.getFrameForComponent(MeshEditor.this), "Save");
        fd.setVisible(true);
        String file_str = fd.getFile();
        if (file_str == null) {
            return;
        }
        file = new File(fd.getDirectory() + "/" + file_str);
    }
    try {
        Layer rootLayer = layersView.getRootLayer();
        for (Layer l : rootLayer.getSubLayersRecursively()) {
            Path path = l.getPath();
            if (path.isFinalized()) {
                Mesh mesh = path.getMesh();
                if (mesh.getControlPointsCount() < 2) {
                    String msg = "At least one mesh has less than 2 control points.\n"
                            + "You may not be able to use it for animation. Do you\n"
                            + "still want to continue?";
                    if (JOptionPane.showConfirmDialog(this, msg, "Warning", JOptionPane.YES_NO_OPTION,
                            JOptionPane.WARNING_MESSAGE) != JOptionPane.YES_OPTION) {
                        return;
                    } else {
                        break;
                    }
                }
            }
        }
        PrintWriter out = new PrintWriter(new FileOutputStream(file));
        JSONObject doc = new JSONObject();
        doc.put("rootLayer", rootLayer.toJSON());
        doc.put("canvas", canvas.toJSON());
        doc.write(out);
        out.close();
    } catch (Exception e1) {
        e1.printStackTrace();
        String msg = "An error occurred while trying to load.";
        JOptionPane.showMessageDialog(JOptionPane.getFrameForComponent(MeshEditor.this), msg, "Error",
                JOptionPane.ERROR_MESSAGE);
    }
    repaint();
}

From source file:ConfigFiles.java

public void loadConfig(String config) {
    try {/*  w w w .  ja v a  2s.  c o  m*/
        String content = RunnerRepository
                .getRemoteFileContent(RunnerRepository.USERHOME + "/twister/config/" + config);
        File theone = new File(RunnerRepository.temp + RunnerRepository.getBar() + "Twister"
                + RunnerRepository.getBar() + "config" + RunnerRepository.getBar() + config);
        try {
            BufferedWriter writer = new BufferedWriter(new FileWriter(theone));
            writer.write(content);
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = null;
        try {
            doc = db.parse(theone);
        } catch (Exception e) {
            System.out.println(theone.getCanonicalPath() + "is corrup or not a valid XML");
        }
        if (doc != null) {
            doc.getDocumentElement().normalize();
            NodeList nodeLst = doc.getElementsByTagName("FileType");
            if (nodeLst.getLength() > 0) {
                Node fstNode = nodeLst.item(0);
                Element fstElmnt = (Element) fstNode;
                NodeList fstNm = fstElmnt.getChildNodes();
                if (fstNm.item(0).getNodeValue().toString().toLowerCase().equals("config")) {
                    FileInputStream in = new FileInputStream(theone);
                    RunnerRepository.uploadRemoteFile(RunnerRepository.USERHOME + "/twister/config/", in,
                            "fwmconfig.xml");
                    RunnerRepository.emptyTestRunnerRepository();
                    RunnerRepository.emptyLogs();
                    File dir = new File(RunnerRepository.getUsersDirectory());
                    String[] children = dir.list();
                    for (int i = 0; i < children.length; i++) {
                        new File(dir, children[i]).delete();
                    }
                    RunnerRepository.parseConfig();
                    RunnerRepository.window.mainpanel.getP2().init(RunnerRepository.applet);
                    RunnerRepository.window.mainpanel.p1.ep.refreshStructure();
                    RunnerRepository.window.mainpanel.p1.lp.refreshStructure();
                    RunnerRepository.window.mainpanel.p4.getDBConfig().refresh();
                    RunnerRepository.window.mainpanel.p4.getGlobals().refresh();
                    RunnerRepository.resetDBConf(RunnerRepository.REMOTEDATABASECONFIGFILE, true);
                    RunnerRepository.resetEmailConf(RunnerRepository.REMOTEEMAILCONFIGFILE, true);
                    RunnerRepository.initializeRPC();
                    RunnerRepository.populatePluginsVariables();
                    tdbfile.setText(RunnerRepository.REMOTEDATABASECONFIGFILE);
                    ttcpath.setText(RunnerRepository.TESTSUITEPATH);
                    libpath.setText(RunnerRepository.REMOTELIBRARY);
                    tMasterXML.setText(RunnerRepository.XMLREMOTEDIR);
                    tUsers.setText(RunnerRepository.REMOTEUSERSDIRECTORY);
                    tepid.setText(RunnerRepository.REMOTEEPIDDIR);
                    tlog.setText(RunnerRepository.LOGSPATH);
                    tsecondarylog.setText(RunnerRepository.SECONDARYLOGSPATH);
                    logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED));
                    if (RunnerRepository.getLogs().size() > 0)
                        trunning.setText(RunnerRepository.getLogs().get(0));
                    trunning.setText(RunnerRepository.getLogs().get(0));
                    tdebug.setText(RunnerRepository.getLogs().get(1));
                    tsummary.setText(RunnerRepository.getLogs().get(2));
                    tinfo.setText(RunnerRepository.getLogs().get(3));
                    tcli.setText(RunnerRepository.getLogs().get(4));
                    tdbfile.setText(RunnerRepository.REMOTEDATABASECONFIGPATH
                            + RunnerRepository.REMOTEDATABASECONFIGFILE);
                    temailfile.setText(
                            RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE);
                    tglobalsfile.setText(RunnerRepository.GLOBALSREMOTEFILE);
                    tSuites.setText(RunnerRepository.PREDEFINEDSUITES);
                    tceport.setText(RunnerRepository.getCentralEnginePort());
                    RunnerRepository.emptySuites();
                    RunnerRepository.window.mainpanel.p4.getTestConfig().tree.refreshStructure();
                    RunnerRepository.window.mainpanel.p4.getTestConfig().cfgedit.reinitialize();
                    RunnerRepository.window.mainpanel.p1.edit(false);
                    RunnerRepository.window.mainpanel.p1.sc.g.setUser(null);
                    RunnerRepository.openProjectFile();
                } else {
                    CustomDialog.showInfo(JOptionPane.WARNING_MESSAGE, ConfigFiles.this, "WARNING",
                            "This is not a config file");
                }
            }
        } else {
            CustomDialog.showInfo(JOptionPane.WARNING_MESSAGE, ConfigFiles.this, "WARNING",
                    "Could not find Config tab");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:de.codesourcery.eve.skills.ui.components.impl.MarketPriceEditorComponent.java

protected boolean checkForOrdersConflictingWithExistingData(MarketLogFile logFile,
        final PriceInfo.Type priceType) {

    // get date of latest price currently known
    MarketFilter filter = new MarketFilterBuilder(priceType, logFile.getRegion()).end();
    final List<PriceInfo> history = fetchPriceInfo(filter, logFile.getInventoryType());

    if (history.isEmpty() || logFile.isEmpty()) {
        return true;
    }/*from w w  w. j a  va  2 s. co  m*/

    EveDate latestHistoryDate = null;
    for (PriceInfo info : history) {
        if (latestHistoryDate == null || info.getTimestamp().compareTo(latestHistoryDate) >= 0) {
            latestHistoryDate = info.getTimestamp();
        }
    }

    // get earliest price timestamp from market log
    final EveDate[] earliestFileDate = new EveDate[1];

    logFile.visit(new IMarketLogVisitor() {

        @Override
        public void visit(MarketLogEntry entry) {

            if (!priceType.matches(entry.getType())) {
                return;
            }

            if (earliestFileDate[0] == null || entry.getIssueDate().compareTo(earliestFileDate[0]) < 0) {
                earliestFileDate[0] = entry.getIssueDate();
            }
        }
    });

    if (earliestFileDate[0] == null) {
        return true;
    }

    // check for overlapping of price data from file
    // with already known prices

    if (earliestFileDate[0].compareTo(latestHistoryDate) <= 0) {

        String typeLabel;
        switch (priceType) {
        case BUY:
            typeLabel = "buy";
            break;
        case SELL:
            typeLabel = "sell";
            break;
        default:
            throw new RuntimeException("Unhandled switch/case");
        }

        final String label = "<HTML><BODY>" + "<BR><BR>" + "WARNING: This market logfile contains " + typeLabel
                + " orders that conflict <BR> with "
                + "data already present in the application's database.<BR><BR>";

        final String[] options = { "Ignore conflicting " + typeLabel + " orders", "Cancel" };

        final int userChoice = JOptionPane.showOptionDialog(null, label,
                "Orders from market log conflict with existing data", JOptionPane.YES_NO_OPTION,
                JOptionPane.WARNING_MESSAGE, null, options, options[0]);

        if (userChoice == 0) {
            final int size = logFile.size();
            final int removedCount = logFile.removeEntriesOlderThan(latestHistoryDate, priceType);

            JOptionPane.showMessageDialog(null, "Removed " + removedCount + " of " + size + " " + typeLabel
                    + " orders total ( left: " + logFile.size() + " )");
        } else {
            return false;
        }
    }
    return true;
}

From source file:de.cebitec.readXplorer.differentialExpression.plot.BaySeqGraphicsTopComponent.java

private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
    ReadXplorerFileChooser fc = new ReadXplorerFileChooser(new String[] { "svg" }, "svg") {
        private static final long serialVersionUID = 1L;

        @Override//from www. j a  v a 2  s . co  m
        public void save(String fileLocation) {
            Path to = FileSystems.getDefault().getPath(fileLocation, "");
            BaySeqAnalysisHandler.Plot selectedPlot = (BaySeqAnalysisHandler.Plot) plotTypeComboBox
                    .getSelectedItem();
            if (selectedPlot == BaySeqAnalysisHandler.Plot.MACD) {
                saveToSVG(fileLocation);
            } else {
                Path from = currentlyDisplayed.toPath();
                try {
                    Path outputFile = Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING);
                    messages.setText("SVG image saved to " + outputFile.toString());
                } catch (IOException ex) {
                    Date currentTimestamp = new Timestamp(Calendar.getInstance().getTime().getTime());
                    Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "{0}: " + ex.getMessage(),
                            currentTimestamp);
                    JOptionPane.showMessageDialog(null, ex.getMessage(), "Could not write to file.",
                            JOptionPane.WARNING_MESSAGE);
                }
            }
        }

        @Override
        public void open(String fileLocation) {
        }
    };
    fc.openFileChooser(ReadXplorerFileChooser.SAVE_DIALOG);
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java

private void abreUrl() {
    String url;/*from  w  ww.j av  a  2s.  c  o  m*/
    url = JOptionPane.showInputDialog(this, GERAL.DIGITE_ENDERECO, "http://");
    PegarPaginaWEB ppw = new PegarPaginaWEB();
    if (url != null) {
        try {
            String codHtml = ppw.getContent(url);
            TxtBuffer.setContentOriginal(codHtml, "0");
            parentFrame.showPainelFerramentaLabelPArq(codHtml);
            EstadoSilvinha.setLinkAtual(url);
        } catch (HttpException e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_NAO_CONECTOU,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        } catch (Exception e1) {
            JOptionPane.showMessageDialog(this, TradPainelAvaliacao.AVISO_VERIFIQUE_URL,
                    TradPainelAvaliacao.AVISO, JOptionPane.WARNING_MESSAGE);
        }
    }
}