|
@@ -1,5 +1,6 @@ |
1 |
1 |
|
package com.test.uidesign.client; |
2 |
2 |
|
|
|
3 |
+ |
import com.google.gwt.user.client.*; |
3 |
4 |
|
import org.litesoft.GWT.client.*; |
4 |
5 |
|
import org.litesoft.GWT.client.widgets.*; |
5 |
6 |
|
import org.litesoft.core.simpletypes.temporal.*; |
|
@@ -8,6 +9,9 @@ |
8 |
9 |
|
import com.google.gwt.event.dom.client.*; |
9 |
10 |
|
import com.google.gwt.user.client.ui.Button; |
10 |
11 |
|
import com.google.gwt.user.client.ui.*; |
|
12 |
+ |
import org.litesoft.ui.*; |
|
13 |
+ |
|
|
14 |
+ |
import static org.litesoft.ui.CompassPoint.*; |
11 |
15 |
|
|
12 |
16 |
|
public class UIdesign extends AbstractClientMainAppEntryPoint |
13 |
17 |
|
{ |
|
@@ -18,8 +22,9 @@ |
18 |
22 |
|
// return new PersonalInfoForm(); |
19 |
23 |
|
// return new Button( "Test" ); |
20 |
24 |
|
SizeableHorizontalPanel zPanel = new SizeableHorizontalPanel().stretchable(); |
21 |
|
- |
zPanel.add( createButtonPanel( zAVP ) ); |
22 |
|
- |
zPanel.add( new Spacer().width( 15 ) ); |
|
25 |
+ |
zPanel.add( new Spacer( 10 ) ); |
|
26 |
+ |
zPanel.add( createButtonPanel(zAVP) ); |
|
27 |
+ |
zPanel.add( new Spacer( 15 ) ); |
23 |
28 |
|
zPanel.add( new SizeableScrollPanel( zAVP ) ); |
24 |
29 |
|
return zPanel; |
25 |
30 |
|
} |
|
@@ -74,6 +79,7 @@ |
74 |
79 |
|
private Widget createButtonPanel( final AccordionVerticalPairPanel pAVP ) |
75 |
80 |
|
{ |
76 |
81 |
|
SizeableVerticalPanel zPanel = new SizeableVerticalPanel().stretchableVertically(); |
|
82 |
+ |
zPanel.add(new Spacer(10)); |
77 |
83 |
|
zPanel.add( new Button( "Clear", new ClickHandler() |
78 |
84 |
|
{ |
79 |
85 |
|
@Override |
|
@@ -82,6 +88,7 @@ |
82 |
88 |
|
pAVP.clear(); |
83 |
89 |
|
} |
84 |
90 |
|
} ) ); |
|
91 |
+ |
zPanel.add(new Spacer(4)); |
85 |
92 |
|
zPanel.add( new Button( "Add", new ClickHandler() |
86 |
93 |
|
{ |
87 |
94 |
|
@Override |
|
@@ -90,6 +97,10 @@ |
90 |
97 |
|
pAVP.add( createWidgetPair( pAVP ) ); |
91 |
98 |
|
} |
92 |
99 |
|
} ) ); |
|
100 |
+ |
zPanel.add(new Spacer(10)); |
|
101 |
+ |
zPanel.add(new CssInlineImageTestPanel("Add")); |
|
102 |
+ |
zPanel.add(new Spacer(4)); |
|
103 |
+ |
zPanel.add(new CssInlineImageTestPanel("Subtract")); |
93 |
104 |
|
return zPanel; |
94 |
105 |
|
} |
95 |
106 |
|
|
|
@@ -140,4 +151,84 @@ |
140 |
151 |
|
} ); |
141 |
152 |
|
return zButton; |
142 |
153 |
|
} |
|
154 |
+ |
|
|
155 |
+ |
private static class CssInlineImageTestPanel extends Composite |
|
156 |
+ |
{ |
|
157 |
+ |
private Element styleElement; |
|
158 |
+ |
|
|
159 |
+ |
public CssInlineImageTestPanel(String name) |
|
160 |
+ |
{ |
|
161 |
+ |
SimplePanel panel = new SimplePanel(new NcellBorderedWidgets("DataImgButton", new TransparentImage("BgImageCell"), new Spacer(5), new TextCell(name))); |
|
162 |
+ |
styleElement = panel.getElement(); |
|
163 |
+ |
HorizontalPanel wrapper = new HorizontalPanel(); |
|
164 |
+ |
wrapper.add(panel); |
|
165 |
+ |
wrapper.setStyleName("Test"+name); |
|
166 |
+ |
initWidget(wrapper); |
|
167 |
+ |
} |
|
168 |
+ |
|
|
169 |
+ |
@Override |
|
170 |
+ |
protected Element getStyleElement() |
|
171 |
+ |
{ |
|
172 |
+ |
return styleElement; |
|
173 |
+ |
} |
|
174 |
+ |
|
|
175 |
+ |
private static class TextCell extends Label |
|
176 |
+ |
{ |
|
177 |
+ |
public TextCell(String text) |
|
178 |
+ |
{ |
|
179 |
+ |
super(text); |
|
180 |
+ |
setStyleName("TextCell"); |
|
181 |
+ |
} |
|
182 |
+ |
} |
|
183 |
+ |
|
|
184 |
+ |
private static class NcellBorderedWidgets extends Composite |
|
185 |
+ |
{ |
|
186 |
+ |
public NcellBorderedWidgets(String cssClassName, Widget... centerWidgets) |
|
187 |
+ |
{ |
|
188 |
+ |
String id = HTMLPanel.createUniqueId(); |
|
189 |
+ |
StringBuilder sb = new StringBuilder("<table cellpadding='0' cellspacing='0'>"); |
|
190 |
+ |
addRow(sb, NW, N, NE); |
|
191 |
+ |
addRow(sb,W, center, id, E); |
|
192 |
+ |
addRow(sb,SW, S, SE); |
|
193 |
+ |
sb.append("</table>"); |
|
194 |
+ |
HTMLPanel panel = new HTMLPanel(sb.toString()); |
|
195 |
+ |
initWidget(panel); |
|
196 |
+ |
panel.add(createCenterWidget(centerWidgets), id); |
|
197 |
+ |
setStyleName(cssClassName); |
|
198 |
+ |
} |
|
199 |
+ |
|
|
200 |
+ |
private void addRow(StringBuilder sb, CompassPoint... cps) { |
|
201 |
+ |
sb.append("<tr>"); |
|
202 |
+ |
for (CompassPoint cp : cps) { |
|
203 |
+ |
addCell(sb, cp); |
|
204 |
+ |
} |
|
205 |
+ |
sb.append("</tr>"); |
|
206 |
+ |
} |
|
207 |
+ |
|
|
208 |
+ |
private void addRow(StringBuilder sb, CompassPoint w, CompassPoint center, String id, CompassPoint e) { |
|
209 |
+ |
sb.append("<tr>"); |
|
210 |
+ |
addCell(sb, w); |
|
211 |
+ |
addCell(sb, center, id); |
|
212 |
+ |
addCell(sb, e); |
|
213 |
+ |
sb.append("</tr>"); |
|
214 |
+ |
} |
|
215 |
+ |
|
|
216 |
+ |
private void addCell(StringBuilder sb, CompassPoint cp) { |
|
217 |
+ |
sb.append("<td class='CP_").append(cp.name()).append("'><img src='").append(TransparentImage.URL).append("'></td>"); |
|
218 |
+ |
} |
|
219 |
+ |
|
|
220 |
+ |
private void addCell(StringBuilder sb, CompassPoint cp, String id) { |
|
221 |
+ |
sb.append("<td class='CP_").append(cp.name()).append("' id='").append(id).append("'></td>"); |
|
222 |
+ |
} |
|
223 |
+ |
|
|
224 |
+ |
private Widget createCenterWidget(Widget[] centerWidgets) { |
|
225 |
+ |
HorizontalPanel panel = new HorizontalPanel(); |
|
226 |
+ |
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); |
|
227 |
+ |
for (Widget widget : centerWidgets) { |
|
228 |
+ |
panel.add(widget); |
|
229 |
+ |
} |
|
230 |
+ |
return panel; |
|
231 |
+ |
} |
|
232 |
+ |
} |
|
233 |
+ |
} |
143 |
234 |
|
} |