[Schmitzm-commits] r2108 - in trunk/schmitzm-core/src/main: java/de/schmitzm/swing java/de/schmitzm/swing/input resources/de/schmitzm/swing/resource/icons/small
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Thu Oct 11 01:20:09 CEST 2012
Author: mojays
Date: 2012-10-11 01:20:08 +0200 (Thu, 11 Oct 2012)
New Revision: 2108
Added:
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/add.png
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_down.png
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_left.png
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_right.png
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_up.png
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/cancel2.png
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/ManualInputOption.java
Log:
- ManualInputOption: new method to change the text field's document, especially to LimitedDocument to limit the input length or style
- new icons
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java 2012-10-09 18:51:53 UTC (rev 2107)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java 2012-10-10 23:20:08 UTC (rev 2108)
@@ -1074,7 +1074,7 @@
List<InputOption<?>> inputOptions = new ArrayList<InputOption<?>>();
BooleanInputOption smtpUsed = new BooleanInputOption(createLabels ? R("SMTPSettings.smtp.used") : null,false);
- InputOption smtpServer = new ManualInputOption.Text(createLabels ? R("SMTPSettings.smtp.serve") : null,false);
+ InputOption smtpServer = new ManualInputOption.Text(createLabels ? R("SMTPSettings.smtp.server") : null,false);
BooleanInputOption authUsed = new BooleanInputOption(createLabels ? R("SMTPSettings.auth") : null);
InputOption authUser = new ManualInputOption.Text(createLabels ? R("SMTPSettings.auth.user") : null,false);
InputOption authPW = new ManualInputOption.PasswordViewable(createLabels ? R("SMTPSettings.auth.pw") : null,false);
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/ManualInputOption.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/ManualInputOption.java 2012-10-09 18:51:53 UTC (rev 2107)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/input/ManualInputOption.java 2012-10-10 23:20:08 UTC (rev 2108)
@@ -37,7 +37,10 @@
import javax.swing.JCheckBox;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
+import javax.swing.text.Document;
+import org.apache.commons.lang.StringUtils;
+
import de.schmitzm.swing.LimitedDocument;
import de.schmitzm.swing.SwingUtil;
@@ -122,9 +125,24 @@
newValue = "";
if (!(newValue instanceof String))
return false;
+ // If document is limited, truncate the new value to proper size
+ // before set it; otherwise the new text field value will be empty!
+ if ( ((JTextField) inpComp).getDocument() instanceof LimitedDocument ) {
+ int limit = ((LimitedDocument)((JTextField) inpComp).getDocument()).getLimit();
+ if ( limit >= 0 )
+ newValue = StringUtils.left((String)newValue, limit);
+ }
((JTextField) inpComp).setText((String) newValue);
return true;
}
+
+ /**
+ * Resets the document of the input field. E.g. to limit the input length.
+ * @see LimitedDocument
+ */
+ public void setDocument(Document doc) {
+ ((JTextField)getInputComponent()).setDocument(doc);
+ }
/**
* Diese Klasse stellt eine Eingabe-Option dar, in der ein beliebigen Text
Added: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/add.png
===================================================================
(Binary files differ)
Property changes on: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/add.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_down.png
===================================================================
(Binary files differ)
Property changes on: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_down.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_left.png
===================================================================
(Binary files differ)
Property changes on: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_left.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_right.png
===================================================================
(Binary files differ)
Property changes on: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_right.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_up.png
===================================================================
(Binary files differ)
Property changes on: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/arrow_up.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/cancel2.png
===================================================================
(Binary files differ)
Property changes on: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/icons/small/cancel2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
More information about the Schmitzm-commits
mailing list