|
@@ -1,15 +1,16 @@ |
1 |
1 |
|
package com.test.uidesign.client; |
2 |
2 |
|
|
3 |
|
- |
import com.google.gwt.event.dom.client.*; |
4 |
|
- |
import com.google.gwt.user.client.*; |
5 |
|
- |
import com.google.gwt.user.client.ui.Button; |
6 |
|
- |
import com.google.gwt.user.client.ui.*; |
7 |
3 |
|
import org.litesoft.GWT.client.*; |
8 |
4 |
|
import org.litesoft.GWT.client.widgets.*; |
9 |
5 |
|
import org.litesoft.commonfoundation.typeutils.*; |
10 |
6 |
|
import org.litesoft.commonfoundation.typeutils.gregorian.*; |
11 |
7 |
|
import org.litesoft.ui.*; |
12 |
8 |
|
|
|
9 |
+ |
import com.google.gwt.event.dom.client.*; |
|
10 |
+ |
import com.google.gwt.user.client.*; |
|
11 |
+ |
import com.google.gwt.user.client.ui.Button; |
|
12 |
+ |
import com.google.gwt.user.client.ui.*; |
|
13 |
+ |
|
13 |
14 |
|
import static org.litesoft.ui.CompassPoint.*; |
14 |
15 |
|
|
15 |
16 |
|
public class UIdesign extends AbstractClientMainAppEntryPoint { |
|
@@ -26,11 +27,11 @@ |
26 |
27 |
|
// zPanel.add(new Spacer(15)); |
27 |
28 |
|
// zPanel.add(createButtonPanel(zAVP)); |
28 |
29 |
|
// return new SizeableSimplePanel(zPanel).stretchable().style("MainPageIndent"); |
29 |
|
- |
return new SizeableSimplePanel(new PersonalInfoForm()).stretchable().style("MainPageIndent"); |
|
30 |
+ |
return new SizeableSimplePanel( new PersonalInfoForm() ).stretchable().style( "MainPageIndent" ); |
30 |
31 |
|
} |
31 |
32 |
|
|
32 |
33 |
|
public UIdesign() { |
33 |
|
- |
super(new AppNames("UIdesign")); |
|
34 |
+ |
super( new AppNames( "UIdesign" ) ); |
34 |
35 |
|
} |
35 |
36 |
|
|
36 |
37 |
|
@Override |
|
@@ -39,108 +40,109 @@ |
39 |
40 |
|
|
40 |
41 |
|
replaceAppPanel(); |
41 |
42 |
|
|
42 |
|
- |
WindowSizingPanel.setContent(createMainWidget()); |
|
43 |
+ |
WindowSizingPanel.setContent( createMainWidget() ); |
43 |
44 |
|
|
44 |
|
- |
System.err.println(new UtilDateAdaptor() + " | Application Client Ready"); |
|
45 |
+ |
System.err.println( new UtilDateAdaptor() + " | Application Client Ready" ); |
45 |
46 |
|
} |
46 |
47 |
|
|
47 |
|
- |
private static Widget createSubordinateWidget(int pRows) { |
48 |
|
- |
if (pRows == 0) { |
|
48 |
+ |
private static Widget createSubordinateWidget( int pRows ) { |
|
49 |
+ |
if ( pRows == 0 ) { |
49 |
50 |
|
return null; |
50 |
51 |
|
} |
51 |
52 |
|
VerticalPanel zPanel = new VerticalPanel(); |
52 |
|
- |
for (; pRows > 0; pRows--) { |
53 |
|
- |
zPanel.add(createSubordinateRow(pRows)); |
|
53 |
+ |
for (; pRows > 0; pRows-- ) { |
|
54 |
+ |
zPanel.add( createSubordinateRow( pRows ) ); |
54 |
55 |
|
} |
55 |
56 |
|
return zPanel; |
56 |
57 |
|
} |
57 |
58 |
|
|
58 |
|
- |
private static Widget createSubordinateRow(int pRows) { |
|
59 |
+ |
private static Widget createSubordinateRow( int pRows ) { |
59 |
60 |
|
HorizontalPanel zPanel = new HorizontalPanel(); |
60 |
|
- |
zPanel.add(new Spacer().width(15)); |
61 |
|
- |
zPanel.add(new Label( Strings.dupChars( '*', pRows ))); |
62 |
|
- |
zPanel.add(new Spacer().width(15)); |
|
61 |
+ |
zPanel.add( new Spacer().width( 15 ) ); |
|
62 |
+ |
zPanel.add( new Label( Strings.dupChars( '*', pRows ) ) ); |
|
63 |
+ |
zPanel.add( new Spacer().width( 15 ) ); |
63 |
64 |
|
return zPanel; |
64 |
65 |
|
} |
65 |
66 |
|
|
66 |
|
- |
private static AccordionVerticalPairPanel.WidgetPair createWidgetPair(AccordionVerticalPairPanel pAVP) { |
|
67 |
+ |
private static AccordionVerticalPairPanel.WidgetPair createWidgetPair( AccordionVerticalPairPanel pAVP ) { |
67 |
68 |
|
int zRows = (int) (System.currentTimeMillis() & 31); |
68 |
|
- |
Widget zSubordinateWidget = createSubordinateWidget(zRows); |
69 |
|
- |
return new AccordionVerticalPairPanel.WidgetPair(createPrimeWidget(pAVP, zRows, zSubordinateWidget), zSubordinateWidget); |
|
69 |
+ |
Widget zSubordinateWidget = createSubordinateWidget( zRows ); |
|
70 |
+ |
return new AccordionVerticalPairPanel.WidgetPair( createPrimeWidget( pAVP, zRows, zSubordinateWidget ), zSubordinateWidget ); |
70 |
71 |
|
} |
71 |
72 |
|
|
72 |
|
- |
private Widget createButtonPanel(final AccordionVerticalPairPanel pAVP) { |
|
73 |
+ |
private Widget createButtonPanel( final AccordionVerticalPairPanel pAVP ) { |
73 |
74 |
|
SizeableHorizontalPanel zPanel = new SizeableHorizontalPanel().stretchableHorizontally(); |
74 |
|
- |
zPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); |
75 |
|
- |
zPanel.add(new Button("Clear", new ClickHandler() { |
|
75 |
+ |
zPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM ); |
|
76 |
+ |
zPanel.add( new Button( "Clear", new ClickHandler() { |
76 |
77 |
|
@Override |
77 |
|
- |
public void onClick(ClickEvent event) { |
|
78 |
+ |
public void onClick( ClickEvent event ) { |
78 |
79 |
|
pAVP.clear(); |
79 |
80 |
|
} |
80 |
|
- |
})); |
81 |
|
- |
zPanel.add(new SizeableSpacer().stretchableHorizontally()); |
82 |
|
- |
zPanel.add(new CssInlineImageTestPanel("Add")); |
83 |
|
- |
zPanel.add(new Spacer(4)); |
84 |
|
- |
zPanel.add(new CssInlineImageTestPanel("Subtract")); |
85 |
|
- |
zPanel.add(new SizeableSpacer().stretchableHorizontally()); |
86 |
|
- |
zPanel.add(new Button("Add", new ClickHandler() { |
|
81 |
+ |
} ) ); |
|
82 |
+ |
zPanel.add( new SizeableSpacer().stretchableHorizontally() ); |
|
83 |
+ |
zPanel.add( new CssInlineImageTestPanel( "Add" ) ); |
|
84 |
+ |
zPanel.add( new Spacer( 4 ) ); |
|
85 |
+ |
zPanel.add( new CssInlineImageTestPanel( "Subtract" ) ); |
|
86 |
+ |
zPanel.add( new SizeableSpacer().stretchableHorizontally() ); |
|
87 |
+ |
zPanel.add( new Button( "Add", new ClickHandler() { |
87 |
88 |
|
@Override |
88 |
|
- |
public void onClick(ClickEvent event) { |
89 |
|
- |
pAVP.add(createWidgetPair(pAVP)); |
|
89 |
+ |
public void onClick( ClickEvent event ) { |
|
90 |
+ |
pAVP.add( createWidgetPair( pAVP ) ); |
90 |
91 |
|
} |
91 |
|
- |
})); |
|
92 |
+ |
} ) ); |
92 |
93 |
|
return zPanel; |
93 |
94 |
|
} |
94 |
95 |
|
|
95 |
|
- |
private static Widget createPrimeWidget(final AccordionVerticalPairPanel pAVP, int pRows, final Widget pSubordinateWidget) { |
|
96 |
+ |
private static Widget createPrimeWidget( final AccordionVerticalPairPanel pAVP, int pRows, final Widget pSubordinateWidget ) { |
96 |
97 |
|
final HorizontalPanel zPanel = new HorizontalPanel(); |
97 |
|
- |
zPanel.add(new Spacer().width(15)); |
98 |
|
- |
zPanel.add(new Button("Remove", new ClickHandler() { |
|
98 |
+ |
zPanel.add( new Spacer().width( 15 ) ); |
|
99 |
+ |
zPanel.add( new Button( "Remove", new ClickHandler() { |
99 |
100 |
|
@Override |
100 |
|
- |
public void onClick(ClickEvent event) { |
101 |
|
- |
int zIndex = (pSubordinateWidget != null) ? pAVP.indexOfSubordinateWidget(pSubordinateWidget) : pAVP.indexOfPrimeWidget(zPanel); |
102 |
|
- |
pAVP.remove(zIndex); |
103 |
|
- |
} |
104 |
|
- |
})); |
105 |
|
- |
zPanel.add(new Spacer().width(5)); |
106 |
|
- |
zPanel.add(new Label("Row: " + pAVP.size())); |
107 |
|
- |
zPanel.add(new Spacer().width(15)); |
108 |
|
- |
if (pSubordinateWidget == null) { |
109 |
|
- |
zPanel.add(new Label("No Details")); |
|
101 |
+ |
public void onClick( ClickEvent event ) { |
|
102 |
+ |
int zIndex = (pSubordinateWidget != null) ? pAVP.indexOfSubordinateWidget( pSubordinateWidget ) : pAVP.indexOfPrimeWidget( zPanel ); |
|
103 |
+ |
pAVP.remove( zIndex ); |
|
104 |
+ |
} |
|
105 |
+ |
} ) ); |
|
106 |
+ |
zPanel.add( new Spacer().width( 5 ) ); |
|
107 |
+ |
zPanel.add( new Label( "Row: " + pAVP.size() ) ); |
|
108 |
+ |
zPanel.add( new Spacer().width( 15 ) ); |
|
109 |
+ |
if ( pSubordinateWidget == null ) { |
|
110 |
+ |
zPanel.add( new Label( "No Details" ) ); |
110 |
111 |
|
} else { |
111 |
|
- |
zPanel.add(new Label("(" + pRows + ")")); |
112 |
|
- |
zPanel.add(new Spacer().width(5)); |
113 |
|
- |
zPanel.add(createShowHideButton(pAVP, pSubordinateWidget)); |
|
112 |
+ |
zPanel.add( new Label( "(" + pRows + ")" ) ); |
|
113 |
+ |
zPanel.add( new Spacer().width( 5 ) ); |
|
114 |
+ |
zPanel.add( createShowHideButton( pAVP, pSubordinateWidget ) ); |
114 |
115 |
|
} |
115 |
|
- |
zPanel.add(new Spacer().width(15)); |
|
116 |
+ |
zPanel.add( new Spacer().width( 15 ) ); |
116 |
117 |
|
|
117 |
118 |
|
return zPanel; |
118 |
119 |
|
} |
119 |
120 |
|
|
120 |
|
- |
private static Button createShowHideButton(final AccordionVerticalPairPanel pAVP, final Widget pSubordinateWidget) { |
121 |
|
- |
final Button zButton = new Button("Details"); |
122 |
|
- |
zButton.addClickHandler(new ClickHandler() { |
|
121 |
+ |
private static Button createShowHideButton( final AccordionVerticalPairPanel pAVP, final Widget pSubordinateWidget ) { |
|
122 |
+ |
final Button zButton = new Button( "Details" ); |
|
123 |
+ |
zButton.addClickHandler( new ClickHandler() { |
123 |
124 |
|
private boolean mShowing; |
124 |
125 |
|
|
125 |
126 |
|
@Override |
126 |
|
- |
public void onClick(ClickEvent event) { |
127 |
|
- |
pAVP.show(pSubordinateWidget, mShowing = !mShowing); |
128 |
|
- |
zButton.setText(mShowing ? "Hide" : "Details"); |
|
127 |
+ |
public void onClick( ClickEvent event ) { |
|
128 |
+ |
pAVP.show( pSubordinateWidget, mShowing = !mShowing ); |
|
129 |
+ |
zButton.setText( mShowing ? "Hide" : "Details" ); |
129 |
130 |
|
} |
130 |
|
- |
}); |
|
131 |
+ |
} ); |
131 |
132 |
|
return zButton; |
132 |
133 |
|
} |
133 |
134 |
|
|
134 |
135 |
|
private static class CssInlineImageTestPanel extends Composite { |
135 |
136 |
|
private Element styleElement; |
136 |
137 |
|
|
137 |
|
- |
public CssInlineImageTestPanel(String name) { |
138 |
|
- |
SimplePanel panel = new SimplePanel(new NcellBorderedWidgets("DataImgButton", new TransparentImage("BgImageCell"), new Spacer(5), new TextCell(name))); |
|
138 |
+ |
public CssInlineImageTestPanel( String name ) { |
|
139 |
+ |
SimplePanel panel = |
|
140 |
+ |
new SimplePanel( new NcellBorderedWidgets( "DataImgButton", new TransparentImage( "BgImageCell" ), new Spacer( 5 ), new TextCell( name ) ) ); |
139 |
141 |
|
styleElement = panel.getElement(); |
140 |
142 |
|
HorizontalPanel wrapper = new HorizontalPanel(); |
141 |
|
- |
wrapper.add(panel); |
142 |
|
- |
wrapper.setStyleName("Test" + name); |
143 |
|
- |
initWidget(wrapper); |
|
143 |
+ |
wrapper.add( panel ); |
|
144 |
+ |
wrapper.setStyleName( "Test" + name ); |
|
145 |
+ |
initWidget( wrapper ); |
144 |
146 |
|
} |
145 |
147 |
|
|
146 |
148 |
|
@Override |
|
@@ -149,55 +151,55 @@ |
149 |
151 |
|
} |
150 |
152 |
|
|
151 |
153 |
|
private static class TextCell extends Label { |
152 |
|
- |
public TextCell(String text) { |
153 |
|
- |
super(text); |
154 |
|
- |
setStyleName("TextCell"); |
|
154 |
+ |
public TextCell( String text ) { |
|
155 |
+ |
super( text ); |
|
156 |
+ |
setStyleName( "TextCell" ); |
155 |
157 |
|
} |
156 |
158 |
|
} |
157 |
159 |
|
|
158 |
160 |
|
private static class NcellBorderedWidgets extends Composite { |
159 |
|
- |
public NcellBorderedWidgets(String cssClassName, Widget... centerWidgets) { |
|
161 |
+ |
public NcellBorderedWidgets( String cssClassName, Widget... centerWidgets ) { |
160 |
162 |
|
String id = HTMLPanel.createUniqueId(); |
161 |
|
- |
StringBuilder sb = new StringBuilder("<table cellpadding='0' cellspacing='0'>"); |
162 |
|
- |
addRow(sb, NW, N, NE); |
163 |
|
- |
addRow(sb, W, center, id, E); |
164 |
|
- |
addRow(sb, SW, S, SE); |
165 |
|
- |
sb.append("</table>"); |
166 |
|
- |
HTMLPanel panel = new HTMLPanel(sb.toString()); |
167 |
|
- |
initWidget(panel); |
168 |
|
- |
panel.add(createCenterWidget(centerWidgets), id); |
169 |
|
- |
setStyleName(cssClassName); |
|
163 |
+ |
StringBuilder sb = new StringBuilder( "<table cellpadding='0' cellspacing='0'>" ); |
|
164 |
+ |
addRow( sb, NW, N, NE ); |
|
165 |
+ |
addRow( sb, W, center, id, E ); |
|
166 |
+ |
addRow( sb, SW, S, SE ); |
|
167 |
+ |
sb.append( "</table>" ); |
|
168 |
+ |
HTMLPanel panel = new HTMLPanel( sb.toString() ); |
|
169 |
+ |
initWidget( panel ); |
|
170 |
+ |
panel.add( createCenterWidget( centerWidgets ), id ); |
|
171 |
+ |
setStyleName( cssClassName ); |
170 |
172 |
|
} |
171 |
173 |
|
|
172 |
|
- |
private void addRow(StringBuilder sb, CompassPoint... cps) { |
173 |
|
- |
sb.append("<tr>"); |
174 |
|
- |
for (CompassPoint cp : cps) { |
175 |
|
- |
addCell(sb, cp); |
|
174 |
+ |
private void addRow( StringBuilder sb, CompassPoint... cps ) { |
|
175 |
+ |
sb.append( "<tr>" ); |
|
176 |
+ |
for ( CompassPoint cp : cps ) { |
|
177 |
+ |
addCell( sb, cp ); |
176 |
178 |
|
} |
177 |
|
- |
sb.append("</tr>"); |
|
179 |
+ |
sb.append( "</tr>" ); |
178 |
180 |
|
} |
179 |
181 |
|
|
180 |
|
- |
private void addRow(StringBuilder sb, CompassPoint w, CompassPoint center, String id, CompassPoint e) { |
181 |
|
- |
sb.append("<tr>"); |
182 |
|
- |
addCell(sb, w); |
183 |
|
- |
addCell(sb, center, id); |
184 |
|
- |
addCell(sb, e); |
185 |
|
- |
sb.append("</tr>"); |
|
182 |
+ |
private void addRow( StringBuilder sb, CompassPoint w, CompassPoint center, String id, CompassPoint e ) { |
|
183 |
+ |
sb.append( "<tr>" ); |
|
184 |
+ |
addCell( sb, w ); |
|
185 |
+ |
addCell( sb, center, id ); |
|
186 |
+ |
addCell( sb, e ); |
|
187 |
+ |
sb.append( "</tr>" ); |
186 |
188 |
|
} |
187 |
189 |
|
|
188 |
|
- |
private void addCell(StringBuilder sb, CompassPoint cp) { |
189 |
|
- |
sb.append("<td class='CP_").append(cp.name()).append("'><img src='").append(TransparentImage.URL).append("'></td>"); |
|
190 |
+ |
private void addCell( StringBuilder sb, CompassPoint cp ) { |
|
191 |
+ |
sb.append( "<td class='CP_" ).append( cp.name() ).append( "'><img src='" ).append( TransparentImage.URL ).append( "'></td>" ); |
190 |
192 |
|
} |
191 |
193 |
|
|
192 |
|
- |
private void addCell(StringBuilder sb, CompassPoint cp, String id) { |
193 |
|
- |
sb.append("<td class='CP_").append(cp.name()).append("' id='").append(id).append("'></td>"); |
|
194 |
+ |
private void addCell( StringBuilder sb, CompassPoint cp, String id ) { |
|
195 |
+ |
sb.append( "<td class='CP_" ).append( cp.name() ).append( "' id='" ).append( id ).append( "'></td>" ); |
194 |
196 |
|
} |
195 |
197 |
|
|
196 |
|
- |
private Widget createCenterWidget(Widget[] centerWidgets) { |
|
198 |
+ |
private Widget createCenterWidget( Widget[] centerWidgets ) { |
197 |
199 |
|
HorizontalPanel panel = new HorizontalPanel(); |
198 |
|
- |
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); |
199 |
|
- |
for (Widget widget : centerWidgets) { |
200 |
|
- |
panel.add(widget); |
|
200 |
+ |
panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE ); |
|
201 |
+ |
for ( Widget widget : centerWidgets ) { |
|
202 |
+ |
panel.add( widget ); |
201 |
203 |
|
} |
202 |
204 |
|
return panel; |
203 |
205 |
|
} |