[Schmitzm-commits] r220 - trunk/src/skrueger/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jul 14 11:41:32 CEST 2009


Author: alfonx
Date: 2009-07-14 11:41:31 +0200 (Tue, 14 Jul 2009)
New Revision: 220

Modified:
   trunk/src/skrueger/swing/TranslationEditJPanel.java
Log:
* Improved the JavaDoc comments

Modified: trunk/src/skrueger/swing/TranslationEditJPanel.java
===================================================================
--- trunk/src/skrueger/swing/TranslationEditJPanel.java	2009-07-14 09:28:36 UTC (rev 219)
+++ trunk/src/skrueger/swing/TranslationEditJPanel.java	2009-07-14 09:41:31 UTC (rev 220)
@@ -16,36 +16,52 @@
 import skrueger.i8n.Translation;
 
 /**
- * A {@link JPanel} that asks the user for translation of several strings 
+ * A {@link JPanel} that asks the user for the translations of a String in
+ * several languages. Use {@link TranslationAskJDialog} to display.<br/>
+ * The class does not implement any backup/clong strategies. The
+ * {@link Translation} object is manipulated directly.<br/>
+ * {@link TranslationEditJPanel}s. {@link TranslationAskJDialog} implements a
+ * transparent Apply/Cancel logic.
+ * 
  * @author Stefan Alfons Krüger
- *
  */
 public class TranslationEditJPanel extends JPanel {
-	static final protected Logger LOGGER = Logger.getLogger(TranslationEditJPanel.class);
-	
+	static final protected Logger LOGGER = Logger
+			.getLogger(TranslationEditJPanel.class);
+
 	private final List<String> languages;
 	private JPanel translationGrid;
 	private Translation trans;
 
+	/**
+	 * Creates a {@link JPanel} that asks the user for the translation of a
+	 * String in several languages
+	 */
 	public TranslationEditJPanel(Translation trans, List<String> languages_) {
 		this(null, trans, languages_);
 	}
 
+	/**
+	 * Creates a {@link JPanel} that asks the user for the translation of a
+	 * String in several languages and additionally puts a {@link JLabel} with a
+	 * question at the {@link JPanel}'s first row.
+	 */
 	public TranslationEditJPanel(String question, Translation trans,
 			List<String> languages_) {
 		super(new BorderLayout());
-		
-		if (trans == null) trans = new Translation();
 
+		if (trans == null)
+			trans = new Translation();
+
 		this.trans = trans;
 		this.languages = languages_;
-		
+
 		add(getTranslationGrid(), BorderLayout.CENTER);
 
 		if (question != null) {
 			JLabel questionLable = new JLabel(question);
-			questionLable.setBorder(BorderFactory.createEmptyBorder(
-					6, 6, 6, 6));
+			questionLable
+					.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
 			add(questionLable, BorderLayout.NORTH);
 		}
 	}
@@ -63,8 +79,8 @@
 
 				TranslationJTextField langTextField = new TranslationJTextField(
 						trans, langId);
-				// Setting a size 
-				langTextField.setPreferredSize( new Dimension(360,22));
+				// Setting a size
+				langTextField.setPreferredSize(new Dimension(360, 22));
 				langDesc.setLabelFor(langTextField);
 				translationGrid.add(langDesc);
 				translationGrid.add(langTextField);
@@ -80,107 +96,9 @@
 		return translationGrid;
 	}
 
-//	/**
-//	 * Merges a few {@link TranslationEditJPanel}s and shows them together..
-//	 * So far this is working on the Translation object directly, Cancel not possible.
-//	 * @param translationEditJPanel
-//	 * 
-//	 * @deprecated Use {@link TranslationAskJDialog}
-//	 */
-//	public static void ask(Frame parentFrame, final TranslationEditJPanel... translationEditJPanels) {
-//		dialog = new JDialog(parentFrame);
-//	//	backup( translationEditJPanels );
-//		showDialog(dialog, translationEditJPanels);
-//	}
-//
-//	
-//	/**
-//	 * Merges a few {@link TranslationEditJPanel}s and shows them together..
-//	 * So far this is working on the Translation object directly, Cancel not possible.
-//	 * @param translationEditJPanel
-//
-//	 * @deprecated User {@link TranslationAskJDialog}	 * 
-//	 */
-//	public static void ask(Window parentWindow, TranslationEditJPanel... translationEditJPanels) {
-//		dialog = new JDialog(parentWindow);
-//	//	backup( translationEditJPanels );
-//		showDialog(dialog, translationEditJPanels);
-//	}
-//	
-//	/**
-//	 * Merges a few {@link TranslationEditJPanel}s and shows them together..
-//	 * So far this is working on the Translation object directly, Cancel not possible.
-//	 * @param translationEditJPanel
-//	 * 
-//	 * 	 * @deprecated User {@link TranslationAskJDialog}
-//	 */
-//	public static void ask(JDialog parentDialog, TranslationEditJPanel... translationEditJPanels) {
-//		dialog = new JDialog(parentDialog);
-//	//	backup( translationEditJPanels );
-//		showDialog(dialog, translationEditJPanels);
-//	}
-//	
-//	
-//	/**
-//	 * 	 * @deprecated User {@link TranslationAskJDialog}
-//	 * @param d
-//	 * @param translationEditJPanels 
-//	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-//	 */
-//	public static void showDialog(JDialog d, JComponent... translationEditJPanels) {
-//		dialog = d;
-//		dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
-//		SwingUtil.centerFrameOnScreen(dialog);
-//		Box box = Box.createVerticalBox();
-//		for (JComponent panel : translationEditJPanels) {
-//			box.add(panel);
-//		}
-//		JPanel cp = new JPanel( new BorderLayout());
-//		cp.add( box, BorderLayout.CENTER);
-//		cp.add( getButtons(), BorderLayout.SOUTH  );
-//		dialog.setContentPane(cp);
-//		
-//		// dialog.getRootPane().setDefaultButton(okButton);
-//		
-//		dialog.setTitle("Please translate"); //i8n
-//		dialog.setModal(true);
-//		dialog.pack();
-//		dialog.setVisible(true);
-//	}
-//
-//	/**
-//	 * @deprecated Use TranslationAskJDialog
-//	 * @return 
-//	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons Kr&uuml;ger</a>
-//	 */
-//	private static JComponent getButtons() {
-//		JPanel jPanel = new JPanel();
-//		if (okButton == null) {
-//			okButton = new OkButton(new AbstractAction("enter") {
-//	            public void actionPerformed(ActionEvent evt) {
-//	            	firePropertyChange(PROPERTY_APPLY_AND_CLOSE, null, null);
-//	            	dialog.dispose();
-//	            }
-//	        } );
-//		}
-//		jPanel.add(okButton);
-//
-//		if (cancelButton == null) {
-//			cancelButton = new CancelButton(new AbstractAction("") {
-//	            public void actionPerformed(ActionEvent evt) {
-//	            	// restore();
-//	            	firePropertyChange(PROPERTY_CANCEL_AND_CLOSE, null, null);
-//	            	dialog.dispose();
-//	            }
-//	        } );
-//		}
-//		jPanel.add(okButton);
-//
-//		return jPanel;
-//	}
-	
 	/**
-	 * @return The {@link Translation} that this {@link TranslationEditJPanel} deals with.
+	 * @return The {@link Translation} that this {@link TranslationEditJPanel}
+	 *         deals with.
 	 */
 	public Translation getTranslation() {
 		return trans;



More information about the Schmitzm-commits mailing list