|
@@ -1,8 +1,6 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.forms.client.components.factories.others; |
3 |
3 |
|
|
4 |
|
- |
import java.io.*; |
5 |
|
- |
|
6 |
4 |
|
import org.litesoft.GWT.client.widgets.nonpublic.*; |
7 |
5 |
|
import org.litesoft.GWT.forms.client.components.*; |
8 |
6 |
|
import org.litesoft.GWT.forms.client.components.factories.*; |
|
@@ -13,17 +11,16 @@ |
13 |
11 |
|
|
14 |
12 |
|
import com.google.gwt.user.client.ui.*; |
15 |
13 |
|
|
16 |
|
- |
public class UiViewWidgetFactory implements FormComponentFactory |
17 |
|
- |
{ |
|
14 |
+ |
import java.io.*; |
|
15 |
+ |
|
|
16 |
+ |
public class UiViewWidgetFactory implements FormComponentFactory { |
18 |
17 |
|
public static final FormComponentFactory INSTANCE = new UiViewWidgetFactory(); |
19 |
18 |
|
|
20 |
19 |
|
public Widget create( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
21 |
|
- |
FormMetaData pFormMetaData, boolean pHasHorizontalPeer ) |
22 |
|
- |
{ |
|
20 |
+ |
FormMetaData pFormMetaData, boolean pHasHorizontalPeer ) { |
23 |
21 |
|
UiAttributeNamedDef zDef = (UiAttributeNamedDef) pUiDef; |
24 |
22 |
|
AttributeMetaData zMD = pFormMetaData.getAttribute( zDef ); |
25 |
|
- |
if ( zMD == null ) |
26 |
|
- |
{ |
|
23 |
+ |
if ( zMD == null ) { |
27 |
24 |
|
throw new IllegalStateException( "Metadata required for a " + zDef ); |
28 |
25 |
|
} |
29 |
26 |
|
return ApplyFont.to( zDef.getFont( zDef.getFontAttributeNames()[0] ), // |
|
@@ -31,117 +28,95 @@ |
31 |
28 |
|
new LabelFormComponent() ).init() ); |
32 |
29 |
|
} |
33 |
30 |
|
|
34 |
|
- |
private static final class MyFormAdapter extends AbstractFormAttributeAdapter |
35 |
|
- |
{ |
|
31 |
+ |
private static final class MyFormAdapter extends AbstractFormAttributeAdapter { |
36 |
32 |
|
public MyFormAdapter( FormInstanceComponentHandler pComponentHandler, // |
37 |
|
- |
AttributeMetaData pMD, IFormComponent pComponent ) |
38 |
|
- |
{ |
|
33 |
+ |
AttributeMetaData pMD, IFormComponent pComponent ) { |
39 |
34 |
|
super( pComponentHandler, pMD, pComponent ); |
40 |
35 |
|
} |
41 |
36 |
|
|
42 |
|
- |
protected Object convertSendableToComponentValue( Serializable pValue ) |
43 |
|
- |
{ |
|
37 |
+ |
protected Object convertSendableToComponentValue( Serializable pValue ) { |
44 |
38 |
|
return pValue; |
45 |
39 |
|
} |
46 |
40 |
|
|
47 |
|
- |
protected String convertComponentValueToString( Object pValue ) |
48 |
|
- |
{ |
|
41 |
+ |
protected String convertComponentValueToString( Object pValue ) { |
49 |
42 |
|
return null; |
50 |
43 |
|
} |
51 |
44 |
|
|
52 |
|
- |
protected Object convertStringToComponentValue( String pValue ) |
53 |
|
- |
{ |
|
45 |
+ |
protected Object convertStringToComponentValue( String pValue ) { |
54 |
46 |
|
return null; |
55 |
47 |
|
} |
56 |
48 |
|
} |
57 |
49 |
|
|
58 |
|
- |
private static final class LabelFormComponent extends Label implements IFormComponent |
59 |
|
- |
{ |
|
50 |
+ |
private static final class LabelFormComponent extends Label implements IFormComponent { |
60 |
51 |
|
private Object mCurrentValue = null; |
61 |
52 |
|
|
62 |
|
- |
public LabelFormComponent() |
63 |
|
- |
{ |
|
53 |
+ |
public LabelFormComponent() { |
64 |
54 |
|
super( "" ); |
65 |
55 |
|
} |
66 |
56 |
|
|
67 |
|
- |
public void relayout() |
68 |
|
- |
{ |
|
57 |
+ |
public void relayout() { |
69 |
58 |
|
Widget parent = getParent(); |
70 |
|
- |
if ( parent instanceof SizeManaged ) |
71 |
|
- |
{ |
|
59 |
+ |
if ( parent instanceof SizeManaged ) { |
72 |
60 |
|
((SizeManaged) parent).relayout(); |
73 |
61 |
|
} |
74 |
62 |
|
} |
75 |
63 |
|
|
76 |
|
- |
public Object getCurrentValue() |
77 |
|
- |
{ |
|
64 |
+ |
public Object getCurrentValue() { |
78 |
65 |
|
return mCurrentValue; |
79 |
66 |
|
} |
80 |
67 |
|
|
81 |
|
- |
public void setCurrentValue( Object pNewValue ) |
82 |
|
- |
{ |
|
68 |
+ |
public void setCurrentValue( Object pNewValue ) { |
83 |
69 |
|
mCurrentValue = pNewValue; |
84 |
70 |
|
String text = (null == mCurrentValue) ? "" : mCurrentValue.toString(); |
85 |
71 |
|
setText( (null == text) ? "" : text ); |
86 |
72 |
|
} |
87 |
73 |
|
|
88 |
|
- |
public boolean setFocus() |
89 |
|
- |
{ |
|
74 |
+ |
public boolean setFocus() { |
90 |
75 |
|
return false; |
91 |
76 |
|
} |
92 |
77 |
|
|
93 |
|
- |
public void setError( String pError ) |
94 |
|
- |
{ |
|
78 |
+ |
public void setError( String pError ) { |
95 |
79 |
|
// No Errors |
96 |
80 |
|
} |
97 |
81 |
|
|
98 |
|
- |
public void setFocused( boolean pFocused ) |
99 |
|
- |
{ |
|
82 |
+ |
public void setFocused( boolean pFocused ) { |
100 |
83 |
|
// No Focus |
101 |
84 |
|
} |
102 |
85 |
|
|
103 |
|
- |
public void setValueChanged( boolean pChanged ) |
104 |
|
- |
{ |
|
86 |
+ |
public void setValueChanged( boolean pChanged ) { |
105 |
87 |
|
// No ValueChanged |
106 |
88 |
|
} |
107 |
89 |
|
|
108 |
|
- |
public boolean isEnabled() |
109 |
|
- |
{ |
|
90 |
+ |
public boolean isEnabled() { |
110 |
91 |
|
return false; |
111 |
92 |
|
} |
112 |
93 |
|
|
113 |
|
- |
public void setEnabled( boolean pEnabled ) |
114 |
|
- |
{ |
|
94 |
+ |
public void setEnabled( boolean pEnabled ) { |
115 |
95 |
|
// No Enableable |
116 |
96 |
|
} |
117 |
97 |
|
|
118 |
|
- |
public void publishAnyPendingChanges() |
119 |
|
- |
{ |
|
98 |
+ |
public void publishAnyPendingChanges() { |
120 |
99 |
|
// No Listeners |
121 |
100 |
|
} |
122 |
101 |
|
|
123 |
|
- |
public IFormComponent addFormComponentListener( Listener pFormComponentListener ) |
124 |
|
- |
{ |
125 |
|
- |
if ( pFormComponentListener != null ) |
126 |
|
- |
{ |
|
102 |
+ |
public IFormComponent addFormComponentListener( Listener pFormComponentListener ) { |
|
103 |
+ |
if ( pFormComponentListener != null ) { |
127 |
104 |
|
pFormComponentListener.add( this ); |
128 |
105 |
|
} |
129 |
106 |
|
// Nothing to listen for... |
130 |
107 |
|
return this; |
131 |
108 |
|
} |
132 |
109 |
|
|
133 |
|
- |
public IFormComponent removeFormComponentListener( Listener pFormComponentListener ) |
134 |
|
- |
{ |
135 |
|
- |
if ( pFormComponentListener != null ) |
136 |
|
- |
{ |
|
110 |
+ |
public IFormComponent removeFormComponentListener( Listener pFormComponentListener ) { |
|
111 |
+ |
if ( pFormComponentListener != null ) { |
137 |
112 |
|
pFormComponentListener.remove( this ); |
138 |
113 |
|
} |
139 |
114 |
|
// Nothing to listen for... |
140 |
115 |
|
return this; |
141 |
116 |
|
} |
142 |
117 |
|
|
143 |
|
- |
@Override public boolean hasError() |
144 |
|
- |
{ |
|
118 |
+ |
@Override |
|
119 |
+ |
public boolean hasError() { |
145 |
120 |
|
return false; |
146 |
121 |
|
} |
147 |
122 |
|
} |