svn commit: r14537 - trunk/src/argouml-app/src/org/argouml: i18n uml/reveng uml/reveng/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: thn
Date: 2008-04-30 14:25:08-0700
New Revision: 14537

Added:
   trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java   (contents, props changed)
   trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java   (contents, props changed)
Modified:
   trunk/src/argouml-app/src/org/argouml/i18n/button.properties
   trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java
   trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java

Log:
First step to solve issue #4615 (Reverse engineering should attempt to continue after error):

1. extracting 2 classes from Import.java

2. changed GUI of ProblemDialog (Continue&Abort instead of Cancel)

Modified: trunk/src/argouml-app/src/org/argouml/i18n/button.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/i18n/button.properties?view=diff&rev=14537&p1=trunk/src/argouml-app/src/org/argouml/i18n/button.properties&p2=trunk/src/argouml-app/src/org/argouml/i18n/button.properties&r1=14536&r2=14537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/i18n/button.properties	(original)
+++ trunk/src/argouml-app/src/org/argouml/i18n/button.properties	2008-04-30 14:25:08-0700
@@ -24,6 +24,7 @@
 #
 # Keys in alphabetical order.
 #
+button.abort = Abort
 button.add = Add
 button.add-rule = Add Rule
 button.add-stereo = Add Stereotype
@@ -38,6 +39,7 @@
 button.cancel.mnemonic = C
 button.close = Close
 button.close.mnemonic = C
+button.continue = Continue
 button.copy-to-clipboard = Copy to Clipboard
 button.copy-to-clipboard.mnemonic = O
 button.delete = Delete

Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java?view=diff&rev=14537&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java&r1=14536&r2=14537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/Import.java	2008-04-30 14:25:08-0700
@@ -67,6 +67,7 @@
 import org.argouml.taskmgmt.ProgressEvent;
 import org.argouml.taskmgmt.ProgressMonitor;
 import org.argouml.uml.reveng.java.JavaImport;
+import org.argouml.uml.reveng.ui.ImportStatusScreen;
 import org.argouml.util.SuffixFilter;
 import org.argouml.util.UIUtils;
 import org.tigris.gef.base.Globals;
@@ -123,8 +124,6 @@
     private JDialog dialog;
 
     private ImportStatusScreen iss;
-
-    private StringBuffer problems = new StringBuffer();
     
     private Frame myFrame;
 
@@ -437,7 +436,7 @@
      * parser methods depending on the type of the file.<p>
      */
     public void doFile() {
-        iss = new ImportStatusScreen("Importing", "Splash");
+        iss = new ImportStatusScreen(myFrame, "Importing", "Splash");
         Thread t = new Thread(new Runnable() {
             public void run() {
                 doImport(iss);
@@ -658,259 +657,12 @@
 
     }
 
-
-    /**
-     * A window that shows the progress bar and a cancel button.
-     * As a convenience to callers which may be executing on a thread other
-     * than the Swing event thread, all methods use SwingUtilities.invokeLater()
-     * to make sure that Swing calls happen on the appropriate thread.
-     *
-     * TODO: React on the close button as if the Cancel button was pressed.
-     * 
-     * TODO: Refactor to use a common progress dialog.  There's really no reason
-     * to have our own specific implementation - tfm - 20070201
-     */
-    class ImportStatusScreen extends JDialog implements ProgressMonitor {
-
-        private JButton cancelButton;
-
-        private JLabel progressLabel;
-
-        private JProgressBar progress;
-
-        private boolean cancelled = false;
-
-        /**
-         * The constructor.
-         *
-         * @param title
-         * @param iconName
-         */
-        public ImportStatusScreen(String title, String iconName) {
-            super(myFrame, true);
-            if (title != null) {
-                setTitle(title);
-            }
-            Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
-            getContentPane().setLayout(new BorderLayout(4, 4));
-
-            // Parsing file x of z.
-            JPanel topPanel = new JPanel();
-            progressLabel = new JLabel();
-            progressLabel.setPreferredSize(new Dimension(400, 20));
-            progressLabel.setHorizontalAlignment(SwingConstants.RIGHT);
-            topPanel.add(progressLabel);
-            getContentPane().add(topPanel, BorderLayout.NORTH);
-
-            // progress bar
-            progress = new JProgressBar();
-            progress.setPreferredSize(new Dimension(350, 20));
-            getContentPane().add(progress, BorderLayout.CENTER);
-
-            // stop button
-            cancelButton = new JButton(Translator.localize("button.cancel"));
-            JPanel bottomPanel = new JPanel();
-            bottomPanel.add(cancelButton);
-            getContentPane().add(bottomPanel, BorderLayout.SOUTH);
-            cancelButton.addActionListener(new ActionListener() {
-
-                public void actionPerformed(ActionEvent e) {
-                    cancelled = true;
-
-                }
-
-            });
-
-            pack();
-            Dimension contentPaneSize = getContentPane().getPreferredSize();
-            setLocation(scrSize.width / 2 - contentPaneSize.width / 2,
-                    scrSize.height / 2 - contentPaneSize.height / 2);
-            setResizable(false);
-        }
-
-        public void setMaximumProgress(final int i) {
-            SwingUtilities.invokeLater(new Runnable () {
-                public void run() {
-                    progress.setMaximum(i);
-                    setVisible(true);
-                }
-            });
-        }
-
-        public void updateProgress(final int i) {
-            SwingUtilities.invokeLater(new Runnable () {
-                public void run() {
-                    progress.setValue(i);
-                }
-            });
-        }
-
-        /**
-         * The UID.
-         */
-        private static final long serialVersionUID = -1336242911879462274L;
-
-        /*
-         * @see org.argouml.application.api.ProgressMonitor#close()
-         */
-        public void close() {
-            SwingUtilities.invokeLater(new Runnable () {
-                public void run() {
-                    setVisible(false);
-                    dispose();
-                }
-            });
-        }
-
-        /*
-         * @see org.argouml.application.api.ProgressMonitor#isCanceled()
-         */
-        public boolean isCanceled() {
-            return cancelled;
-        }
-
-        /*
-         * @see org.argouml.application.api.ProgressMonitor#notifyMessage(java.lang.String, java.lang.String, java.lang.String)
-         */
-        public void notifyMessage(String title, String introduction,
-                String message) {
-            // TODO: Create an error dialog or panel in our progress dialog
-            // for now we just use our old style separate error dialog
-            JDialog problemsDialog = new ProblemsDialog(getFrame(), message);
-            problemsDialog.setTitle(title);
-            problemsDialog.setVisible(true);
-            // TODO: Only needed while we have a separate problem dialog
-            // (see above)
-            setVisible(false);
-            dispose();
-        }
-
-        /*
-         * @see org.argouml.application.api.ProgressMonitor#notifyNullAction()
-         */
-        public void notifyNullAction() {
-            String msg = Translator.localize("label.import.empty");
-            notifyMessage(msg, msg, msg);
-        }
-
-        /*
-         * @see org.argouml.application.api.ProgressMonitor#updateMainTask(java.lang.String)
-         */
-        public void updateMainTask(final String name) {
-            SwingUtilities.invokeLater(new Runnable () {
-                public void run() {
-                    setTitle(name);
-                }
-            });
-        }
-
-        /*
-         * @see org.argouml.application.api.ProgressMonitor#updateSubTask(java.lang.String)
-         */
-        public void updateSubTask(final String action) {
-            SwingUtilities.invokeLater(new Runnable () {
-                public void run() {
-                    progressLabel.setText(action);
-                }
-            });
-        }
-
-        /*
-         * @see org.argouml.persistence.ProgressListener#progress(org.argouml.persistence.ProgressEvent)
-         */
-        public void progress(ProgressEvent event) throws InterruptedException {
-            // ignored
-        }
-
-    }
-
-
-    /**
-     * A window that shows the problems occured during import.
-     */
-    class ProblemsDialog extends JDialog implements ActionListener {
-
-        private JButton closeButton;
-        private JLabel northLabel;
-
-        /**
-         * The constructor.
-         */
-        ProblemsDialog() {
-            this(getFrame(), problems.toString());
-        }
-
-        /**
-         * The constructor.
-         */
-        ProblemsDialog(Frame frame, String errors) {
-            super(frame);
-            setResizable(true);
-            setModal(true);
-            setTitle(Translator.localize("dialog.title.import-problems"));
-
-            Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
-            getContentPane().setLayout(new BorderLayout(0, 0));
-
-            // the introducing label
-            northLabel =
-                new JLabel(Translator.localize("label.import-problems"));
-            getContentPane().add(northLabel, BorderLayout.NORTH);
-
-            // the text box containing the problem messages
-            JEditorPane textArea = new JEditorPane();
-            textArea.setText(errors);
-            JPanel centerPanel = new JPanel(new BorderLayout());
-            centerPanel.add(new JScrollPane(textArea));
-            centerPanel.setPreferredSize(new Dimension(600, 200));
-            getContentPane().add(centerPanel);
-
-            // close button
-            closeButton = new JButton(Translator.localize("button.close"));
-            JPanel bottomPanel = new JPanel();
-            bottomPanel.add(closeButton);
-            getContentPane().add(bottomPanel, BorderLayout.SOUTH);
-
-            // listeners
-            closeButton.addActionListener(this);
-            addWindowListener(new WindowAdapter() {
-                public void windowClosing(WindowEvent evt) {
-                    disposeDialog();
-                }
-            });
-
-            pack();
-            Dimension contentPaneSize = getContentPane().getSize();
-            setLocation(scrSize.width / 2 - contentPaneSize.width / 2,
-                    scrSize.height / 2 - contentPaneSize.height / 2);
-        }
-
-        /*
-         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
-         */
-        public void actionPerformed(ActionEvent e) {
-            disposeDialog();
-        }
-
-        private void disposeDialog() {
-            setVisible(false);
-            dispose();
-        }
-
-        /**
-         * The UID.
-         */
-        private static final long serialVersionUID = -9221358976863603143L;
-    }
-
     /**
      * @return Returns the Frame.
      */
     public Frame getFrame() {
         return myFrame;
     }
-
-
 }
 
 /**
@@ -1112,10 +864,8 @@
         }
     }
 
-
     /**
      * The UID.
      */
     private static final long serialVersionUID = -8684620532717336574L;
 }
-

Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java?view=diff&rev=14537&p1=trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java&p2=trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java&r1=14536&r2=14537
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ImportCommon.java	2008-04-30 14:25:08-0700
@@ -50,6 +50,7 @@
 import org.argouml.uml.diagram.static_structure.ClassDiagramGraphModel;

 import org.argouml.uml.diagram.static_structure.layout.ClassdiagramLayouter;

 import org.argouml.uml.reveng.ImportInterface.ImportException;

+import org.argouml.uml.reveng.ui.ImportStatusScreen;

 import org.tigris.gef.base.Globals;

 

 /**

@@ -502,7 +503,7 @@
      *            a ProgressMonitor to both receive progress updates and to be

      *            polled for user requests to cancel.

      */

-    protected void doImport(ProgressMonitor monitor) {

+    protected void doImport(ImportStatusScreen monitor) {

         // Roughly equivalent to and derived from old Import.doFile()

         monitor.setMaximumProgress(MAX_PROGRESS_PREPARE + MAX_PROGRESS_IMPORT);

         int progress = 0;


Added: trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java?view=auto&rev=14537
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ImportStatusScreen.java	2008-04-30 14:25:08-0700
@@ -0,0 +1,205 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.reveng.ui;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+
+import org.argouml.i18n.Translator;
+import org.argouml.taskmgmt.ProgressEvent;
+import org.argouml.taskmgmt.ProgressMonitor;
+
+/**
+ * A window that shows the progress bar and a cancel button.
+ * As a convenience to callers which may be executing on a thread other
+ * than the Swing event thread, all methods use SwingUtilities.invokeLater()
+ * to make sure that Swing calls happen on the appropriate thread.
+ *
+ * TODO: React on the close button as if the Cancel button was pressed.
+ */
+public class ImportStatusScreen extends JDialog implements ProgressMonitor {
+    
+    private Frame parentFrame;
+    private JButton cancelButton;
+    private JLabel progressLabel;
+    private JProgressBar progress;
+    private boolean cancelled = false;
+
+    /**
+     * The constructor.
+     *
+     * @param title
+     * @param iconName
+     */
+    public ImportStatusScreen(Frame frame, String title, String iconName) {
+        super(frame, true);
+        if (title != null) {
+            setTitle(title);
+        }
+        Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
+        getContentPane().setLayout(new BorderLayout(4, 4));
+        parentFrame = frame;
+
+        // Parsing file x of z.
+        JPanel topPanel = new JPanel();
+        progressLabel = new JLabel();
+        progressLabel.setPreferredSize(new Dimension(400, 20));
+        progressLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+        topPanel.add(progressLabel);
+        getContentPane().add(topPanel, BorderLayout.NORTH);
+
+        // progress bar
+        progress = new JProgressBar();
+        progress.setPreferredSize(new Dimension(350, 20));
+        getContentPane().add(progress, BorderLayout.CENTER);
+
+        // stop button
+        cancelButton = new JButton(Translator.localize("button.cancel"));
+        JPanel bottomPanel = new JPanel();
+        bottomPanel.add(cancelButton);
+        getContentPane().add(bottomPanel, BorderLayout.SOUTH);
+        cancelButton.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                cancelled = true;
+
+            }
+
+        });
+
+        pack();
+        Dimension contentPaneSize = getContentPane().getPreferredSize();
+        setLocation(scrSize.width / 2 - contentPaneSize.width / 2,
+                scrSize.height / 2 - contentPaneSize.height / 2);
+        setResizable(false);
+    }
+
+    public void setMaximumProgress(final int i) {
+        SwingUtilities.invokeLater(new Runnable () {
+            public void run() {
+                progress.setMaximum(i);
+                setVisible(true);
+            }
+        });
+    }
+
+    public void updateProgress(final int i) {
+        SwingUtilities.invokeLater(new Runnable () {
+            public void run() {
+                progress.setValue(i);
+            }
+        });
+    }
+
+    /**
+     * The UID.
+     */
+    private static final long serialVersionUID = -1336242911879462274L;
+
+    /*
+     * @see org.argouml.application.api.ProgressMonitor#close()
+     */
+    public void close() {
+        SwingUtilities.invokeLater(new Runnable () {
+            public void run() {
+                setVisible(false);
+                dispose();
+            }
+        });
+    }
+
+    /*
+     * @see org.argouml.application.api.ProgressMonitor#isCanceled()
+     */
+    public boolean isCanceled() {
+        return cancelled;
+    }
+
+    /*
+     * @see org.argouml.application.api.ProgressMonitor#notifyMessage(java.lang.String, java.lang.String, java.lang.String)
+     */
+    public void notifyMessage(String title, String introduction,
+            String message) {
+        // TODO: Create an error dialog or panel in our progress dialog
+        // for now we just use our old style separate error dialog
+        JDialog problemsDialog = new ProblemsDialog(parentFrame, message);
+        problemsDialog.setTitle(title);
+        problemsDialog.setVisible(true);
+        // TODO: Only needed while we have a separate problem dialog
+        // (see above)
+        setVisible(false);
+        dispose();
+    }
+
+    /*
+     * @see org.argouml.application.api.ProgressMonitor#notifyNullAction()
+     */
+    public void notifyNullAction() {
+        String msg = Translator.localize("label.import.empty");
+        notifyMessage(msg, msg, msg);
+    }
+
+    /*
+     * @see org.argouml.application.api.ProgressMonitor#updateMainTask(java.lang.String)
+     */
+    public void updateMainTask(final String name) {
+        SwingUtilities.invokeLater(new Runnable () {
+            public void run() {
+                setTitle(name);
+            }
+        });
+    }
+
+    /*
+     * @see org.argouml.application.api.ProgressMonitor#updateSubTask(java.lang.String)
+     */
+    public void updateSubTask(final String action) {
+        SwingUtilities.invokeLater(new Runnable () {
+            public void run() {
+                progressLabel.setText(action);
+            }
+        });
+    }
+
+    /*
+     * @see org.argouml.persistence.ProgressListener#progress(org.argouml.persistence.ProgressEvent)
+     */
+    public void progress(ProgressEvent event) throws InterruptedException {
+        // ignored
+    }
+
+}

Added: trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java?view=auto&rev=14537
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/ui/ProblemsDialog.java	2008-04-30 14:25:08-0700
@@ -0,0 +1,142 @@
+// $Id$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.reveng.ui;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+//$Id$
+//Copyright (c) 2008 The Regents of the University of California. All
+//Rights Reserved. Permission to use, copy, modify, and distribute this
+//software and its documentation without fee, and without a written
+//agreement is hereby granted, provided that the above copyright notice
+//and this paragraph appear in all copies. This software program and
+//documentation are copyrighted by The Regents of the University of
+//California. The software program and documentation are supplied "AS
+//IS", without any accompanying services from The Regents. The Regents
+//does not warrant that the operation of the program will be
+//uninterrupted or error-free. The end-user understands that the program
+//was developed for research purposes and is advised not to rely
+//exclusively on the program for any reason. IN NO EVENT SHALL THE
+//UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+//SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+//ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+//THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+//SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+//WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+//MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+//PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+//CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+//UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+import org.argouml.i18n.Translator;
+
+/**
+ * A window that shows the problems occurred during import.
+ */
+class ProblemsDialog extends JDialog implements ActionListener {
+
+    private Frame parentFrame;
+    private JButton abortButton;
+    private JButton continueButton;
+    private JLabel northLabel;
+
+    /**
+     * The constructor.
+     */
+    ProblemsDialog(Frame frame, String errors) {
+        super(frame);
+        setResizable(true);
+        setModal(true);
+        setTitle(Translator.localize("dialog.title.import-problems"));
+
+        Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
+        getContentPane().setLayout(new BorderLayout(0, 0));
+
+        // the introducing label
+        northLabel =
+            new JLabel(Translator.localize("label.import-problems"));
+        getContentPane().add(northLabel, BorderLayout.NORTH);
+
+        // the text box containing the problem messages
+        JEditorPane textArea = new JEditorPane();
+        textArea.setText(errors);
+        JPanel centerPanel = new JPanel(new BorderLayout());
+        centerPanel.add(new JScrollPane(textArea));
+        centerPanel.setPreferredSize(new Dimension(600, 200));
+        getContentPane().add(centerPanel);
+
+        // continue and abort buttons
+        continueButton = new JButton(Translator.localize("button.continue"));
+        abortButton = new JButton(Translator.localize("button.abort"));
+        JPanel bottomPanel = new JPanel();
+        bottomPanel.add(continueButton);
+        bottomPanel.add(abortButton);
+        getContentPane().add(bottomPanel, BorderLayout.SOUTH);
+
+        // listeners
+        continueButton.addActionListener(this);
+        abortButton.addActionListener(this);
+        addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent evt) {
+                disposeDialog();
+            }
+        });
+
+        pack();
+        Dimension contentPaneSize = getContentPane().getSize();
+        setLocation(scrSize.width / 2 - contentPaneSize.width / 2,
+                scrSize.height / 2 - contentPaneSize.height / 2);
+    }
+
+    /*
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     */
+    public void actionPerformed(ActionEvent e) {
+        disposeDialog();
+    }
+
+    private void disposeDialog() {
+        setVisible(false);
+        dispose();
+    }
+
+    /**
+     * The UID.
+     */
+    private static final long serialVersionUID = -9221358976863603143L;
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.