Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/KeyHole/src/org/litesoft/aokeyhole/swing/namevaluecomponents/AbstractNamedDocumentFieldComponent.java

Diff revisions: vs.
  @@ -1,52 +1,52 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.aokeyhole.swing.namevaluecomponents;
3 -
4 - import org.litesoft.aokeyhole.swing.*;
5 - import org.litesoft.aokeyhole.toolkit.*;
6 -
7 - import javax.swing.*;
8 - import javax.swing.text.*;
9 -
10 - public abstract class AbstractNamedDocumentFieldComponent extends SimpleNamedComponent {
11 - protected AbstractNamedDocumentFieldComponent( NameValueComponentParams pParams ) {
12 - super( pParams );
13 - }
14 -
15 - @Override
16 - protected JComponent createCenterContent() {
17 - JTextComponent field = createJTextComponent();
18 - mInputComponent = field;
19 - field.getDocument().addDocumentListener( new DocumentChangeListener( this ) );
20 - return field;
21 - }
22 -
23 - abstract protected JTextComponent createJTextComponent();
24 -
25 - @Override
26 - protected Object mutateChangeTo( Object pLastValue, Object pCurValue ) {
27 - pCurValue = super.mutateChangeTo( pLastValue, pCurValue );
28 - return (pCurValue != null) ? pCurValue : "";
29 - }
30 -
31 - protected JTextComponent getJTextComponent() {
32 - return (JTextComponent) mInputComponent;
33 - }
34 -
35 - @Override
36 - public Object getComponentValue() {
37 - return getCompText();
38 - }
39 -
40 - protected String getCompText() {
41 - return getJTextComponent().getText();
42 - }
43 -
44 - protected void setCompText( String pText ) {
45 - getJTextComponent().setText( pText );
46 - }
47 -
48 - @Override
49 - public void setComponentValue( Object pValue ) {
50 - setCompText( toString( pValue ) );
51 - }
52 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.aokeyhole.swing.namevaluecomponents;
3 +
4 + import org.litesoft.aokeyhole.swing.*;
5 + import org.litesoft.aokeyhole.toolkit.*;
6 +
7 + import javax.swing.*;
8 + import javax.swing.text.*;
9 +
10 + public abstract class AbstractNamedDocumentFieldComponent extends SimpleNamedComponent {
11 + protected AbstractNamedDocumentFieldComponent( NameValueComponentParams pParams ) {
12 + super( pParams );
13 + }
14 +
15 + @Override
16 + protected JComponent createCenterContent() {
17 + JTextComponent field = createJTextComponent();
18 + mInputComponent = field;
19 + field.getDocument().addDocumentListener( new DocumentChangeListener( this ) );
20 + return field;
21 + }
22 +
23 + abstract protected JTextComponent createJTextComponent();
24 +
25 + @Override
26 + protected Object mutateChangeTo( Object pLastValue, Object pCurValue ) {
27 + pCurValue = super.mutateChangeTo( pLastValue, pCurValue );
28 + return (pCurValue != null) ? pCurValue : "";
29 + }
30 +
31 + protected JTextComponent getJTextComponent() {
32 + return (JTextComponent) mInputComponent;
33 + }
34 +
35 + @Override
36 + public Object getComponentValue() {
37 + return getCompText();
38 + }
39 +
40 + protected String getCompText() {
41 + return getJTextComponent().getText();
42 + }
43 +
44 + protected void setCompText( String pText ) {
45 + getJTextComponent().setText( pText );
46 + }
47 +
48 + @Override
49 + public void setComponentValue( Object pValue ) {
50 + setCompText( toString( pValue ) );
51 + }
52 + }