[Schmitzm-commits] r2272 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 6 10:53:00 CET 2013


Author: alfonx
Date: 2013-03-06 10:53:00 +0100 (Wed, 06 Mar 2013)
New Revision: 2272

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java	2013-03-05 20:32:47 UTC (rev 2271)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java	2013-03-06 09:53:00 UTC (rev 2272)
@@ -77,9 +77,8 @@
 	private static final int WIDTH = 460;
 
 	/**
-	 * Initial height for the progress window, in pixels. Increase this value if
-	 * some component (e.g. the "Cancel" button) seems truncated. The current
-	 * value has been tested for Metal look and feel.
+	 * Initial height for the progress window, in pixels. Increase this value if some component (e.g. the "Cancel"
+	 * button) seems truncated. The current value has been tested for Metal look and feel.
 	 */
 	private static final int HEIGHT = 160;
 
@@ -104,8 +103,7 @@
 	private static final int WARNING_MARGIN = 6;
 
 	/**
-	 * The progress window as a {@link JDialog} or a {@link JInternalFrame},
-	 * depending of the parent component.
+	 * The progress window as a {@link JDialog} or a {@link JInternalFrame}, depending of the parent component.
 	 */
 	private final JDialog window;
 
@@ -120,8 +118,7 @@
 	private final JProgressBar progressBar;
 
 	/**
-	 * A description of the undergoing operation. Examples: "Reading header",
-	 * "Reading data", <cite>etc.</cite>
+	 * A description of the undergoing operation. Examples: "Reading header", "Reading data", <cite>etc.</cite>
 	 */
 	private final JLabel description;
 
@@ -131,16 +128,14 @@
 	private final JButton cancelButton;
 
 	/**
-	 * Component where to display warnings. The actual component class is
-	 * {@link JTextArea}. But we declare {@link JComponent} here in order to
-	 * avoid class loading before needed.
+	 * Component where to display warnings. The actual component class is {@link JTextArea}. But we declare
+	 * {@link JComponent} here in order to avoid class loading before needed.
 	 */
 	private JComponent warningArea;
 
 	/**
-	 * The source of the last warning message. Used in order to avoid to repeat
-	 * the source for all subsequent warning messages, if the source didn't
-	 * changed.
+	 * The source of the last warning message. Used in order to avoid to repeat the source for all subsequent warning
+	 * messages, if the source didn't changed.
 	 */
 	private String lastSource;
 
@@ -158,9 +153,8 @@
 	private final HashSet<ActionListener> listeners = new HashSet<ActionListener>();
 
 	/**
-	 * Creates a window for reporting progress. The window will not appears
-	 * immediately. It will appears only when the {@link #started} method will
-	 * be invoked.
+	 * Creates a window for reporting progress. The window will not appears immediately. It will appears only when the
+	 * {@link #started} method will be invoked.
 	 * 
 	 * @param parent
 	 *            The parent component, or {@code null} if none.
@@ -190,8 +184,7 @@
 		window.setBounds((parentSize.width - WIDTH) / 2,
 				(parentSize.height - HEIGHT) / 2, WIDTH, HEIGHT);
 		/*
-		 * Creates the label that is going to display the undergoing operation.
-		 * This label is initially empty.
+		 * Creates the label that is going to display the undergoing operation. This label is initially empty.
 		 */
 		description = new JLabel();
 		description.setHorizontalAlignment(SwingConstants.CENTER);
@@ -234,9 +227,8 @@
 		cancelBox.add(ok);
 		cancelBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
 		/*
-		 * Layout the elements inside the window. An empty border is created in
-		 * order to put some space between the window content and the window
-		 * border.
+		 * Layout the elements inside the window. An empty border is created in order to put some space between the
+		 * window content and the window border.
 		 */
 		final JPanel panel = new JPanel(new GridLayout(2, 1));
 		panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
@@ -261,10 +253,8 @@
 			setDescription(startText);
 	}
 
-
 	/**
-	 * Returns the window title. The default title is "Progress" localized in
-	 * current locale.
+	 * Returns the window title. The default title is "Progress" localized in current locale.
 	 * 
 	 * @return the window title
 	 */
@@ -273,12 +263,11 @@
 		return (String) get(Caller.TITLE);
 	}
 
-	
-	 /**
+	/**
 	 * Set the window title. A {@code null} value reset the default title.
-	 *
+	 * 
 	 * @param title
-	 * the window title
+	 *            the window title
 	 */
 	@Override
 	public void setTitle(String title) {
@@ -305,8 +294,7 @@
 	}
 
 	/**
-	 * Notifies that the operation begins. This method display the windows if it
-	 * was not already visible.
+	 * Notifies that the operation begins. This method display the windows if it was not already visible.
 	 */
 	@Override
 	public void started() {
@@ -336,8 +324,8 @@
 	}
 
 	/**
-	 * Notifies that the operation has finished. The window will disaspears,
-	 * except if it contains warning or exception stack traces.
+	 * Notifies that the operation has finished. The window will disaspears, except if it contains warning or exception
+	 * stack traces.
 	 */
 	@Override
 	public void complete() {
@@ -345,8 +333,7 @@
 	}
 
 	/**
-	 * Releases any resource holds by this window. Invoking this method destroy
-	 * the window.
+	 * Releases any resource holds by this window. Invoking this method destroy the window.
 	 */
 	@Override
 	public void dispose() {
@@ -386,8 +373,8 @@
 	}
 
 	/**
-	 * Display a warning message under the progress bar. The text area for
-	 * warning messages appears only the first time this method is invoked.
+	 * Display a warning message under the progress bar. The text area for warning messages appears only the first time
+	 * this method is invoked.
 	 * 
 	 * @param source
 	 *            DOCUMENT ME
@@ -451,9 +438,8 @@
 	}
 
 	/**
-	 * Returns the s// public void warningOccurred(Exception e) { //
-	 * warningOccurred("asdsad", null, e.getLocalizedMessage() != null ? e //
-	 * .getLocalizedMessage() : e.getMessage()); // cancel // }tring
+	 * Returns the s// public void warningOccurred(Exception e) { // warningOccurred("asdsad", null,
+	 * e.getLocalizedMessage() != null ? e // .getLocalizedMessage() : e.getMessage()); // cancel // }tring
 	 * {@code margin} without the parenthesis (if any).
 	 * 
 	 * @param margin
@@ -472,15 +458,13 @@
 	}
 
 	/**
-	 * Queries one of the components in the progress window. This method doesn't
-	 * need to be invoked from the <cite>Swing</cite> thread.
+	 * Queries one of the components in the progress window. This method doesn't need to be invoked from the
+	 * <cite>Swing</cite> thread.
 	 * 
 	 * @param task
-	 *            // public void warningOccurred(Exception e) { //
-	 *            warningOccurred("asdsad", null, e.getLocalizedMessage() !=
-	 *            null ? e // .getLocalizedMessage() : e.getMessage()); //
-	 *            cancel // } The desired value as one of the
-	 *            {@link Caller#TITLE} or {@link Caller#LABEL} constants.
+	 *            // public void warningOccurred(Exception e) { // warningOccurred("asdsad", null,
+	 *            e.getLocalizedMessage() != null ? e // .getLocalizedMessage() : e.getMessage()); // cancel // } The
+	 *            desired value as one of the {@link Caller#TITLE} or {@link Caller#LABEL} constants.
 	 * @return The value.
 	 */
 	private Object get(final int task) {
@@ -490,12 +474,11 @@
 	}
 
 	/**
-	 * Sets the state of one of the components in the progress window. This
-	 * method doesn't need to be invoked from the <cite>Swing</cite> thread.
+	 * Sets the state of one of the components in the progress window. This method doesn't need to be invoked from the
+	 * <cite>Swing</cite> thread.
 	 * 
 	 * @param task
-	 *            The value to change as one of the {@link Caller#TITLE} or
-	 *            {@link Caller#LABEL} constants.
+	 *            The value to change as one of the {@link Caller#TITLE} or {@link Caller#LABEL} constants.
 	 * @param value
 	 *            The new value.
 	 */
@@ -509,19 +492,16 @@
 	 * Invokes a <cite>Swing</cite> method without arguments.
 	 * 
 	 * @param task
-	 *            The method to invoke: {@link Caller#STARTED} or
-	 *            {@link Caller#DISPOSE}.
+	 *            The method to invoke: {@link Caller#STARTED} or {@link Caller#DISPOSE}.
 	 */
 	private void call(final int task) {
 		EventQueue.invokeLater(new Caller(task));
 	}
 
 	/**
-	 * Task to run in the <cite>Swing</cite> thread. Tasks are identified by a
-	 * numeric constant. The {@code get} operations have negative identifiers
-	 * and are executed by the {@link EventQueue#invokeAndWait} method. The
-	 * {@code set} operations have positive identifiers and are executed by the
-	 * {@link EventQueue#invokeLater} method.
+	 * Task to run in the <cite>Swing</cite> thread. Tasks are identified by a numeric constant. The {@code get}
+	 * operations have negative identifiers and are executed by the {@link EventQueue#invokeAndWait} method. The
+	 * {@code set} operations have positive identifiers and are executed by the {@link EventQueue#invokeLater} method.
 	 * 
 	 * @author Martin Desruisseaux (PMO, IRD)
 	 */
@@ -548,21 +528,19 @@
 		public static final int DISPOSE = 7;
 
 		/**
-		 * The task to execute, as one of the {@link #TITLE}, {@link #LABEL},
-		 * <cite>etc.</cite> constants or their negative counterpart.
+		 * The task to execute, as one of the {@link #TITLE}, {@link #LABEL}, <cite>etc.</cite> constants or their
+		 * negative counterpart.
 		 */
 		private final int task;
 
 		/**
-		 * The value to get (negative value {@link #task}) or set (positive
-		 * value {@link #task}).
+		 * The value to get (negative value {@link #task}) or set (positive value {@link #task}).
 		 */
 		public Object value;
 
 		/**
-		 * Creates an action. {@code task} must be one of {@link #TITLE},
-		 * {@link #LABEL} <cite>etc.</cite> constants or their negative
-		 * counterpart.
+		 * Creates an action. {@code task} must be one of {@link #TITLE}, {@link #LABEL} <cite>etc.</cite> constants or
+		 * their negative counterpart.
 		 * 
 		 * @param task
 		 *            the task key
@@ -613,11 +591,10 @@
 				break; // Need further action below.
 			}
 			}
-			
+
 			/*
-			 * Some of the tasks above requires an action on the window, which
-			 * may be a JDialog or a JInternalFrame. We need to determine the
-			 * window type before to apply the action.
+			 * Some of the tasks above requires an action on the window, which may be a JDialog or a JInternalFrame. We
+			 * need to determine the window type before to apply the action.
 			 */
 			synchronized (AtlasStatusDialog.this) {
 				final JDialog window = AtlasStatusDialog.this.window;
@@ -667,7 +644,7 @@
 				warningArea.append((String) value);
 			}
 		}
-	} 
+	}
 
 	@Override
 	public void startModal() {
@@ -739,7 +716,6 @@
 		setDescription(SwingUtil.R("AtlasStatusDialog.jnlp.progress", filename,
 				percentage));
 
-
 	}
 
 	@Override



More information about the Schmitzm-commits mailing list