Revision: 1294
Author: mathiasbr
Date: 2006-08-11 00:18:59 -0700 (Fri, 11 Aug 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1294&view=rev
Log Message:
-----------
add support for password field
setting amount of columns for textfields
Modified Paths:
--------------
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/ComponentFactory.java
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/DefaultComponentFactory.java
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/ComponentFactory.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/ComponentFactory.java
2006-08-09 21:59:59 UTC (rev 1293)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/ComponentFactory.java
2006-08-11 07:18:59 UTC (rev 1294)
@@ -27,6 +27,7 @@
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
+import javax.swing.JPasswordField;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
@@ -278,6 +279,13 @@
public JTextField createTextField();
/**
+ * Create a standard password field using this component factory.
+ *
+ * @return the new password field.
+ */
+ public JPasswordField createPasswordField();
+
+ /**
* Create a text area using this component factory.
*
* @return The new text area.
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/DefaultComponentFactory.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/DefaultComponentFactory.java
2006-08-09 21:59:59 UTC (rev 1293)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/factory/DefaultComponentFactory.java
2006-08-11 07:18:59 UTC (rev 1294)
@@ -33,6 +33,7 @@
import javax.swing.JList;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
+import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
@@ -61,6 +62,7 @@
import org.springframework.richclient.list.LabeledEnumListRenderer;
import org.springframework.richclient.util.Alignment;
import org.springframework.richclient.util.GuiStandardUtils;
+import org.springframework.util.Assert;
import org.springframework.util.comparator.ComparableComparator;
import org.springframework.util.comparator.CompoundComparator;
@@ -88,6 +90,8 @@
private TableFactory tableFactory;
+ private int textFieldColumns = 25;
+
public void setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
this.messages = new MessageSourceAccessor(messageSource);
@@ -323,16 +327,55 @@
comboBox.setEditor(new LabeledEnumComboBoxEditor(messageSource,
comboBox.getEditor()));
}
+ /**
+ * Returns the default column count for new text fields (including
formatted text and password fields)
+ *
+ * @return the default column count. Must not be lower than 0
+ * @see JTextField
+ */
+ public int getTextFieldColumns() {
+ return textFieldColumns;
+ }
+
+ /**
+ * Defines the default column count for new text fields (including
formatted text and password fields)
+ *
+ * @param the default column count. Must not be lower than 0
+ * @see JTextField
+ */
+ public void setTextFieldColumns(int columns) {
+ if (columns < 0)
+ throw new IllegalArgumentException("text field columns must not be
lower than 0. Value was: " + columns);
+ this.textFieldColumns = columns;
+ }
+
public JFormattedTextField
createFormattedTextField(AbstractFormatterFactory formatterFactory) {
- return new PatchedJFormattedTextField(formatterFactory);
+ PatchedJFormattedTextField patchedJFormattedTextField = new
PatchedJFormattedTextField(formatterFactory);
+ configureTextField(patchedJFormattedTextField);
+ return patchedJFormattedTextField;
}
public JTextField createTextField() {
- JTextField tf = new JTextField();
- tf.setColumns(25);
- return tf;
+ JTextField textField = new JTextField();
+ configureTextField(textField);
+ return textField;
}
+ /**
+ * Configures the text field.
+ *
+ * @param textField the field to configure. Must not be null
+ */
+ protected void configureTextField(JTextField textField) {
+ textField.setColumns(getTextFieldColumns());
+ }
+
+ public JPasswordField createPasswordField() {
+ JPasswordField passwordField = new JPasswordField();
+ configureTextField(passwordField);
+ return passwordField;
+ }
+
public JTextArea createTextArea() {
return new JTextArea();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs