Package net.sourceforge.marathon.checklist

Examples of net.sourceforge.marathon.checklist.CheckListDialog


    public CheckList showAndEnterChecklist(File file, final IMarathonRuntime runtime, final JFrame instance) {
        final CheckList checklist;
        try {
            checklist = CheckList.read(new FileInputStream(file));
            CheckListForm checklistForm = new CheckListForm(checklist, Mode.ENTER);
            final CheckListDialog dialog = new CheckListDialog((JFrame) null, checklistForm);

            JButton screenCapture = UIUtils.createScreenCaptureButton();
            screenCapture.addActionListener(new ActionListener() {
                File captureFile = null;

                public void actionPerformed(ActionEvent e) {
                    boolean iconify = false;
                    int state = -1;
                    try {
                        if (instance != null && instance.getState() != JFrame.ICONIFIED) {
                            iconify = true;
                            state = instance.getState();
                        }
                        if (iconify)
                            instance.setState(JFrame.ICONIFIED);
                        dialog.setVisible(false);
                        if (captureFile == null)
                            captureFile = runtime.getScreenCapture();
                        if (captureFile == null) {
                            JOptionPane.showMessageDialog(null, "Could not create a screen capture");
                            return;
                        }
                        try {
                            AnnotateScreenCapture annotate = new AnnotateScreenCapture(captureFile, true);
                            if (annotate.showDialog() == AnnotateScreenCapture.APPROVE_OPTION) {
                                annotate.saveToFile(captureFile);
                                checklist.setCaptureFile(captureFile.getName());
                            }
                        } catch (IOException e1) {
                            e1.printStackTrace();
                        }
                    } finally {
                        if (iconify)
                            instance.setState(state);
                        dialog.setVisible(true);
                    }
                }
            });
            JButton saveButton = UIUtils.createSaveButton();
            saveButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    dialog.dispose();
                }
            });
            dialog.setActionButtons(new JButton[] { screenCapture, saveButton });
            dialog.setVisible(true);
        } catch (Exception e1) {
            JOptionPane.showMessageDialog(null, "Unable to read the checklist file");
            return null;
        }
        addChecklist(checklist);
View Full Code Here


                    final File file = new File(reportDir, fileName);
                    final CheckList checklist;
                    try {
                        checklist = CheckList.read(new FileInputStream(file));
                        CheckListForm checklistForm = new CheckListForm(checklist, Mode.DISPLAY);
                        final CheckListDialog dialog = new CheckListDialog((JFrame) null, checklistForm);

                        JButton screenCapture = null;
                        if (checklist.getCaptureFile() != null) {
                            screenCapture = UIUtils.createScreenCaptureButton();

                            screenCapture.addActionListener(new ActionListener() {
                                File captureFile = new File(file.getParent(), checklist.getCaptureFile());

                                public void actionPerformed(ActionEvent e) {
                                    try {
                                        AnnotateScreenCapture annotate = new AnnotateScreenCapture(captureFile, false);
                                        annotate.showDialog();
                                    } catch (IOException e1) {
                                        e1.printStackTrace();
                                    }
                                }
                            });
                        }
                        JButton doneButton = UIUtils.createDoneButton();
                        doneButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                dialog.dispose();
                            }
                        });
                        if (screenCapture != null)
                            dialog.setActionButtons(new JButton[] { screenCapture, doneButton });
                        else
                            dialog.setActionButtons(new JButton[] { doneButton });
                        dialog.setVisible(true);
                    } catch (Exception e1) {
                        JOptionPane.showMessageDialog(null, "Unable to read the checklist file");
                    }
                    display.resume();
                }
View Full Code Here

TOP

Related Classes of net.sourceforge.marathon.checklist.CheckListDialog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.