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