|
@@ -1,31 +1,13 @@ |
1 |
1 |
|
package com.temp.client.foundation.widget.dialog; |
2 |
2 |
|
|
3 |
|
- |
import com.temp.client.foundation.handler.DialogClose; |
4 |
|
- |
import com.temp.client.foundation.util.CommonElementHelper; |
5 |
|
- |
import com.temp.client.foundation.util.UtilsGwt; |
6 |
|
- |
import com.temp.client.foundation.widget.NamedHtmlLabel; |
7 |
|
- |
import com.temp.client.foundation.widget.NamedImageButton; |
8 |
|
- |
import com.temp.client.foundation.widget.OurSimplePanel; |
9 |
|
- |
import com.temp.client.foundation.widget.OurWidgetConstrainer; |
10 |
|
- |
import com.temp.client.foundation.widget.Spacer; |
11 |
|
- |
import com.temp.shared.utils.CollectionsUtils; |
12 |
|
- |
import com.temp.shared.utils.ObjectUtils; |
13 |
|
- |
import com.temp.shared.utils.SafeHtmlizer; |
14 |
|
- |
import com.temp.shared.utils.StringUtils; |
15 |
|
- |
import org.litesoft.core.util.TemplateSource; |
16 |
|
- |
|
17 |
|
- |
import com.google.gwt.event.dom.client.ClickEvent; |
18 |
|
- |
import com.google.gwt.event.dom.client.ClickHandler; |
19 |
|
- |
import com.google.gwt.user.client.ui.ButtonBase; |
20 |
|
- |
import com.google.gwt.user.client.ui.Composite; |
21 |
|
- |
import com.google.gwt.user.client.ui.DialogBox; |
22 |
|
- |
import com.google.gwt.user.client.ui.HTMLPanel; |
23 |
|
- |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
24 |
|
- |
import com.google.gwt.user.client.ui.HasVerticalAlignment; |
25 |
|
- |
import com.google.gwt.user.client.ui.HorizontalPanel; |
26 |
|
- |
import com.google.gwt.user.client.ui.Image; |
27 |
|
- |
import com.google.gwt.user.client.ui.VerticalPanel; |
28 |
|
- |
import com.google.gwt.user.client.ui.Widget; |
|
3 |
+ |
import org.litesoft.core.util.*; |
|
4 |
+ |
|
|
5 |
+ |
import com.google.gwt.event.dom.client.*; |
|
6 |
+ |
import com.google.gwt.user.client.ui.*; |
|
7 |
+ |
import com.temp.client.foundation.handler.*; |
|
8 |
+ |
import com.temp.client.foundation.util.*; |
|
9 |
+ |
import com.temp.client.foundation.widget.*; |
|
10 |
+ |
import com.temp.shared.utils.*; |
29 |
11 |
|
|
30 |
12 |
|
public class SEDIDialogBox { |
31 |
13 |
|
protected interface BodySource { |
|
@@ -47,40 +29,40 @@ |
47 |
29 |
|
|
48 |
30 |
|
protected final ClickHandler hideClickHandler = new ClickHandler() { |
49 |
31 |
|
@Override |
50 |
|
- |
public void onClick(ClickEvent event) { |
|
32 |
+ |
public void onClick( ClickEvent event ) { |
51 |
33 |
|
hide(); |
52 |
34 |
|
} |
53 |
35 |
|
}; |
54 |
36 |
|
|
55 |
|
- |
public SEDIDialogBox(String iconUrl, Integer contentWidth, String title) { |
|
37 |
+ |
public SEDIDialogBox( String iconUrl, Integer contentWidth, String title ) { |
56 |
38 |
|
this.iconUrl = iconUrl; |
57 |
39 |
|
this.contentWidth = contentWidth; |
58 |
|
- |
this.title = StringUtils.noEmpty(title); |
59 |
|
- |
this.ourClassName = ObjectUtils.getSimpleClassName(this); |
|
40 |
+ |
this.title = StringUtils.noEmpty( title ); |
|
41 |
+ |
this.ourClassName = ObjectUtils.getSimpleClassName( this ); |
60 |
42 |
|
|
61 |
|
- |
titleBarCenterPanel.add(new Spacer().size("1px")); |
|
43 |
+ |
titleBarCenterPanel.add( new Spacer().size( "1px" ) ); |
62 |
44 |
|
|
63 |
|
- |
dialogBox.addStyleName("SEDIDialogBox"); |
|
45 |
+ |
dialogBox.addStyleName( "SEDIDialogBox" ); |
64 |
46 |
|
|
65 |
|
- |
dialogBox.setAnimationEnabled(true); |
66 |
|
- |
dialogBox.setGlassEnabled(true); |
|
47 |
+ |
dialogBox.setAnimationEnabled( true ); |
|
48 |
+ |
dialogBox.setGlassEnabled( true ); |
67 |
49 |
|
} |
68 |
50 |
|
|
69 |
51 |
|
/** |
70 |
52 |
|
* add a style "classname", and allow chaining calls. |
71 |
53 |
|
* |
72 |
|
- |
* @param style |
73 |
|
- |
* "classname" |
|
54 |
+ |
* @param style "classname" |
|
55 |
+ |
* |
74 |
56 |
|
* @return this |
75 |
57 |
|
*/ |
76 |
|
- |
public SEDIDialogBox style(String style) { |
77 |
|
- |
if (null != (style = StringUtils.noEmpty(style))) { |
78 |
|
- |
dialogBox.addStyleName(style); |
|
58 |
+ |
public SEDIDialogBox style( String style ) { |
|
59 |
+ |
if ( null != (style = StringUtils.noEmpty( style )) ) { |
|
60 |
+ |
dialogBox.addStyleName( style ); |
79 |
61 |
|
} |
80 |
62 |
|
return this; |
81 |
63 |
|
} |
82 |
64 |
|
|
83 |
|
- |
public SEDIDialogBox setCloseListener(DialogClose closeListener) { |
|
65 |
+ |
public SEDIDialogBox setCloseListener( DialogClose closeListener ) { |
84 |
66 |
|
this.closeListener = closeListener; |
85 |
67 |
|
return this; |
86 |
68 |
|
} |
|
@@ -90,14 +72,14 @@ |
90 |
72 |
|
} |
91 |
73 |
|
|
92 |
74 |
|
public void show() { |
93 |
|
- |
if (!isShowing()) { |
94 |
|
- |
if (!widgetBuilt) { |
95 |
|
- |
Widget fullDialogContent = buildFullContentWidgetForDialogBox(bodySource.createBody()); |
|
75 |
+ |
if ( !isShowing() ) { |
|
76 |
+ |
if ( !widgetBuilt ) { |
|
77 |
+ |
Widget fullDialogContent = buildFullContentWidgetForDialogBox( bodySource.createBody() ); |
96 |
78 |
|
widgetBuilt = true; |
97 |
|
- |
dialogBox.setWidget(new OurSimplePanel(fullDialogContent).style("SEDIDialogBoxContent")); |
98 |
|
- |
if (!classInjected) { |
|
79 |
+ |
dialogBox.setWidget( new OurSimplePanel( fullDialogContent ).style( "SEDIDialogBoxContent" ) ); |
|
80 |
+ |
if ( !classInjected ) { |
99 |
81 |
|
classInjected = true; |
100 |
|
- |
CommonElementHelper.findElementWithTagNameUpDOM(fullDialogContent.getElement(), CommonElementHelper.TABLE).addClassName(ourClassName); |
|
82 |
+ |
CommonElementHelper.findElementWithTagNameUpDOM( fullDialogContent.getElement(), CommonElementHelper.TABLE ).addClassName( ourClassName ); |
101 |
83 |
|
} |
102 |
84 |
|
dialogBox.center(); |
103 |
85 |
|
} |
|
@@ -109,132 +91,132 @@ |
109 |
91 |
|
DialogClose listener = closeListener; |
110 |
92 |
|
closeListener = null; |
111 |
93 |
|
dialogBox.hide(); |
112 |
|
- |
if (listener != null) { |
|
94 |
+ |
if ( listener != null ) { |
113 |
95 |
|
try { |
114 |
96 |
|
listener.closed(); |
115 |
|
- |
} catch (RuntimeException whatever) { |
|
97 |
+ |
} |
|
98 |
+ |
catch ( RuntimeException whatever ) { |
116 |
99 |
|
// Protecting the UI from ... |
117 |
100 |
|
} |
118 |
101 |
|
} |
119 |
102 |
|
} |
120 |
103 |
|
|
121 |
|
- |
protected void setBodySource(BodySource bodySource) { |
|
104 |
+ |
protected void setBodySource( BodySource bodySource ) { |
122 |
105 |
|
widgetBuilt = false; |
123 |
106 |
|
this.bodySource = bodySource; |
124 |
107 |
|
} |
125 |
108 |
|
|
126 |
|
- |
protected void setBody(final String[] bodyTextBlocksAboveControlButtons, final ButtonBase... bottomControlButtons) { |
127 |
|
- |
setBodySource(new BodySource() { |
|
109 |
+ |
protected void setBody( final String[] bodyTextBlocksAboveControlButtons, final ButtonBase... bottomControlButtons ) { |
|
110 |
+ |
setBodySource( new BodySource() { |
128 |
111 |
|
@Override |
129 |
112 |
|
public Widget createBody() { |
130 |
|
- |
return createBodyWidget(addLines(createVerticalContentPanel(), bodyTextBlocksAboveControlButtons), bottomControlButtons); |
|
113 |
+ |
return createBodyWidget( addLines( createVerticalContentPanel(), bodyTextBlocksAboveControlButtons ), bottomControlButtons ); |
131 |
114 |
|
} |
132 |
|
- |
}); |
|
115 |
+ |
} ); |
133 |
116 |
|
} |
134 |
117 |
|
|
135 |
|
- |
protected void setBody(final Widget bodyAboveControlButtons, final ButtonBase... bottomControlButtons) { |
136 |
|
- |
setBodySource(new BodySource() { |
|
118 |
+ |
protected void setBody( final Widget bodyAboveControlButtons, final ButtonBase... bottomControlButtons ) { |
|
119 |
+ |
setBodySource( new BodySource() { |
137 |
120 |
|
@Override |
138 |
121 |
|
public Widget createBody() { |
139 |
|
- |
return createBodyWidget(bodyAboveControlButtons, bottomControlButtons); |
|
122 |
+ |
return createBodyWidget( bodyAboveControlButtons, bottomControlButtons ); |
140 |
123 |
|
} |
141 |
|
- |
}); |
|
124 |
+ |
} ); |
142 |
125 |
|
} |
143 |
126 |
|
|
144 |
|
- |
protected void setBody(final Widget body) { |
145 |
|
- |
setBodySource(new BodySource() { |
|
127 |
+ |
protected void setBody( final Widget body ) { |
|
128 |
+ |
setBodySource( new BodySource() { |
146 |
129 |
|
@Override |
147 |
130 |
|
public Widget createBody() { |
148 |
131 |
|
return body; |
149 |
132 |
|
} |
150 |
|
- |
}); |
|
133 |
+ |
} ); |
151 |
134 |
|
} |
152 |
135 |
|
|
153 |
136 |
|
/** |
154 |
137 |
|
* Build the Full Content Widget for the DialogBox by adding the TitleBar |
155 |
138 |
|
* above the bodyWidget. |
156 |
139 |
|
* |
157 |
|
- |
* @param bodyWidget |
158 |
|
- |
* to be added below the TitleBar |
|
140 |
+ |
* @param bodyWidget to be added below the TitleBar |
159 |
141 |
|
* |
160 |
142 |
|
* @return a Vertical Panel with all the widgets that make up the Full |
161 |
|
- |
* Content Widget for the DialogBox. |
|
143 |
+ |
* Content Widget for the DialogBox. |
162 |
144 |
|
*/ |
163 |
|
- |
protected VerticalPanel buildFullContentWidgetForDialogBox(Widget bodyWidget) { |
|
145 |
+ |
protected VerticalPanel buildFullContentWidgetForDialogBox( Widget bodyWidget ) { |
164 |
146 |
|
VerticalPanel panel = new VerticalPanel(); |
165 |
147 |
|
Widget titleBar = createTitleBar(); |
166 |
|
- |
addWidget(panel, titleBar); |
167 |
|
- |
if ((titleBar != null) && (bodyWidget != null)) { |
168 |
|
- |
addTitleBodySpacer(panel); |
|
148 |
+ |
addWidget( panel, titleBar ); |
|
149 |
+ |
if ( (titleBar != null) && (bodyWidget != null) ) { |
|
150 |
+ |
addTitleBodySpacer( panel ); |
169 |
151 |
|
} |
170 |
|
- |
addBoxedContent(panel, bodyWidget); |
|
152 |
+ |
addBoxedContent( panel, bodyWidget ); |
171 |
153 |
|
return panel; |
172 |
154 |
|
} |
173 |
155 |
|
|
174 |
|
- |
protected void addBoxedContent(VerticalPanel panel, Widget widget) { |
175 |
|
- |
if (widget != null) { |
176 |
|
- |
panel.add(new OurSimplePanel(widget).style("SEDIDialogBoxSpecificContent")); |
177 |
|
- |
CommonElementHelper.findElementWithTagNameUpDOM(widget.getElement(), CommonElementHelper.TD).addClassName(ourClassName + "Content"); |
|
156 |
+ |
protected void addBoxedContent( VerticalPanel panel, Widget widget ) { |
|
157 |
+ |
if ( widget != null ) { |
|
158 |
+ |
panel.add( new OurSimplePanel( widget ).style( "SEDIDialogBoxSpecificContent" ) ); |
|
159 |
+ |
CommonElementHelper.findElementWithTagNameUpDOM( widget.getElement(), CommonElementHelper.TD ).addClassName( ourClassName + "Content" ); |
178 |
160 |
|
} |
179 |
161 |
|
} |
180 |
162 |
|
|
181 |
|
- |
protected void addTitleBodySpacer(VerticalPanel panel) { |
182 |
|
- |
addWidget(panel, new Spacer().style("dialogTitleBodySpacer")); |
|
163 |
+ |
protected void addTitleBodySpacer( VerticalPanel panel ) { |
|
164 |
+ |
addWidget( panel, new Spacer().style( "dialogTitleBodySpacer" ) ); |
183 |
165 |
|
} |
184 |
166 |
|
|
185 |
|
- |
protected void addWidget(VerticalPanel panel, Widget widget) { |
186 |
|
- |
if (widget != null) { |
187 |
|
- |
panel.add(widget); |
|
167 |
+ |
protected void addWidget( VerticalPanel panel, Widget widget ) { |
|
168 |
+ |
if ( widget != null ) { |
|
169 |
+ |
panel.add( widget ); |
188 |
170 |
|
} |
189 |
171 |
|
} |
190 |
172 |
|
|
191 |
173 |
|
protected Widget createTitleBar() { |
192 |
|
- |
NamedHtmlLabel label = new NamedHtmlLabel(SafeHtmlizer.getInstance().noEmpty1stLine(title)).style("SEDIDialogBoxTitle"); |
|
174 |
+ |
NamedHtmlLabel label = new NamedHtmlLabel( SafeHtmlizer.getInstance().noEmpty1stLine( title ) ).style( "SEDIDialogBoxTitle" ); |
193 |
175 |
|
ButtonBase button = createXButton(); |
194 |
|
- |
Widget right = (button == null) ? new Spacer().size("1px") : UtilsGwt.horizontal(new Spacer().height("1px").width("10px"), button); |
195 |
|
- |
return new TitleBar(createIconLabelPanel(label), titleBarCenterPanel, right).style("SEDIDialogBoxTitlePanel"); |
|
176 |
+ |
Widget right = (button == null) ? new Spacer().size( "1px" ) : UtilsGwt.horizontal( new Spacer().height( "1px" ).width( "10px" ), button ); |
|
177 |
+ |
return new TitleBar( createIconLabelPanel( label ), titleBarCenterPanel, right ).style( "SEDIDialogBoxTitlePanel" ); |
196 |
178 |
|
} |
197 |
179 |
|
|
198 |
180 |
|
protected NamedImageButton createXButton() { |
199 |
|
- |
return new NamedImageButton("x", hideClickHandler).style("SEDIDialogBoxXButton"); |
|
181 |
+ |
return new NamedImageButton( "x", hideClickHandler ).style( "SEDIDialogBoxXButton" ); |
200 |
182 |
|
} |
201 |
183 |
|
|
202 |
|
- |
protected Widget createIconLabelPanel(Widget label) { |
203 |
|
- |
if (iconUrl == null) { |
|
184 |
+ |
protected Widget createIconLabelPanel( Widget label ) { |
|
185 |
+ |
if ( iconUrl == null ) { |
204 |
186 |
|
return label; |
205 |
187 |
|
} |
206 |
188 |
|
HorizontalPanel panel = new HorizontalPanel(); |
207 |
|
- |
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); |
208 |
|
- |
panel.add(new Image(iconUrl)); |
209 |
|
- |
panel.add(new Spacer().width("5px")); |
210 |
|
- |
panel.add(label); |
|
189 |
+ |
panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE ); |
|
190 |
+ |
panel.add( new Image( iconUrl ) ); |
|
191 |
+ |
panel.add( new Spacer().width( "5px" ) ); |
|
192 |
+ |
panel.add( label ); |
211 |
193 |
|
return panel; |
212 |
194 |
|
} |
213 |
195 |
|
|
214 |
|
- |
protected Widget center(Widget widget) { |
215 |
|
- |
if (widget == null) { |
|
196 |
+ |
protected Widget center( Widget widget ) { |
|
197 |
+ |
if ( widget == null ) { |
216 |
198 |
|
return null; |
217 |
199 |
|
} |
218 |
200 |
|
HorizontalPanel panel = new HorizontalPanel(); |
219 |
|
- |
panel.setWidth("100%"); |
220 |
|
- |
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); |
221 |
|
- |
panel.add(widget); |
|
201 |
+ |
panel.setWidth( "100%" ); |
|
202 |
+ |
panel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); |
|
203 |
+ |
panel.add( widget ); |
222 |
204 |
|
return panel; |
223 |
205 |
|
} |
224 |
206 |
|
|
225 |
|
- |
protected Widget createButtons(ButtonBase[] bottomControlButtons) { |
226 |
|
- |
if (CollectionsUtils.isEmpty(bottomControlButtons)) { |
|
207 |
+ |
protected Widget createButtons( ButtonBase[] bottomControlButtons ) { |
|
208 |
+ |
if ( CollectionsUtils.isEmpty( bottomControlButtons ) ) { |
227 |
209 |
|
return null; |
228 |
210 |
|
} |
229 |
211 |
|
HorizontalPanel panel = new HorizontalPanel(); |
230 |
|
- |
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); |
231 |
|
- |
panel.add(new Spacer().width("5px")); |
232 |
|
- |
if (bottomControlButtons != null) { |
233 |
|
- |
for (ButtonBase button : bottomControlButtons) { |
234 |
|
- |
if (button != null) { |
235 |
|
- |
panel.add(button); |
|
212 |
+ |
panel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE ); |
|
213 |
+ |
panel.add( new Spacer().width( "5px" ) ); |
|
214 |
+ |
if ( bottomControlButtons != null ) { |
|
215 |
+ |
for ( ButtonBase button : bottomControlButtons ) { |
|
216 |
+ |
if ( button != null ) { |
|
217 |
+ |
panel.add( button ); |
236 |
218 |
|
} |
237 |
|
- |
panel.add(new Spacer().width("5px")); |
|
219 |
+ |
panel.add( new Spacer().width( "5px" ) ); |
238 |
220 |
|
} |
239 |
221 |
|
} |
240 |
222 |
|
return panel; |
|
@@ -242,84 +224,83 @@ |
242 |
224 |
|
|
243 |
225 |
|
protected VerticalPanel createVerticalContentPanel() { |
244 |
226 |
|
VerticalPanel panel = new VerticalPanel(); |
245 |
|
- |
if (contentWidth != null) { |
246 |
|
- |
panel.setWidth(contentWidth + "px"); |
|
227 |
+ |
if ( contentWidth != null ) { |
|
228 |
+ |
panel.setWidth( contentWidth + "px" ); |
247 |
229 |
|
} |
248 |
230 |
|
return panel; |
249 |
231 |
|
} |
250 |
232 |
|
|
251 |
|
- |
protected VerticalPanel addLines(VerticalPanel panel, String[] bodyTextBlocksAboveControlButtons) { |
252 |
|
- |
if (bodyTextBlocksAboveControlButtons != null) { |
253 |
|
- |
for (String block : bodyTextBlocksAboveControlButtons) { |
254 |
|
- |
Widget widget = makeLabel(block); |
255 |
|
- |
if (centerAllContent) { |
256 |
|
- |
widget = center(new OurWidgetConstrainer(widget)); |
|
233 |
+ |
protected VerticalPanel addLines( VerticalPanel panel, String[] bodyTextBlocksAboveControlButtons ) { |
|
234 |
+ |
if ( bodyTextBlocksAboveControlButtons != null ) { |
|
235 |
+ |
for ( String block : bodyTextBlocksAboveControlButtons ) { |
|
236 |
+ |
Widget widget = makeLabel( block ); |
|
237 |
+ |
if ( centerAllContent ) { |
|
238 |
+ |
widget = center( new OurWidgetConstrainer( widget ) ); |
257 |
239 |
|
} |
258 |
|
- |
addWithSpacing(panel, widget); |
|
240 |
+ |
addWithSpacing( panel, widget ); |
259 |
241 |
|
} |
260 |
242 |
|
} |
261 |
243 |
|
return panel; |
262 |
244 |
|
} |
263 |
245 |
|
|
264 |
|
- |
protected Widget makeLabel(String block) { |
265 |
|
- |
block = StringUtils.replaceAll(block, TemplateSource.SPACE_SUBSTITUTION_ID, ' '); |
266 |
|
- |
return new NamedHtmlLabel(SafeHtmlizer.getInstance().noEmpty(block, 93)).style("SEDIDialogBoxText"); |
|
246 |
+ |
protected Widget makeLabel( String block ) { |
|
247 |
+ |
block = StringUtils.replaceAll( block, TemplateSource.SPACE_SUBSTITUTION_ID, ' ' ); |
|
248 |
+ |
return new NamedHtmlLabel( SafeHtmlizer.getInstance().noEmpty( block, 93 ) ).style( "SEDIDialogBoxText" ); |
267 |
249 |
|
} |
268 |
250 |
|
|
269 |
|
- |
protected VerticalPanel addWithSpacing(VerticalPanel panel, Widget widget) { |
270 |
|
- |
if (widget != null) { |
271 |
|
- |
if (panel.getWidgetCount() != 0) { |
272 |
|
- |
panel.add(new Spacer().style("dialogInterLineSpacer")); |
|
251 |
+ |
protected VerticalPanel addWithSpacing( VerticalPanel panel, Widget widget ) { |
|
252 |
+ |
if ( widget != null ) { |
|
253 |
+ |
if ( panel.getWidgetCount() != 0 ) { |
|
254 |
+ |
panel.add( new Spacer().style( "dialogInterLineSpacer" ) ); |
273 |
255 |
|
} |
274 |
|
- |
panel.add(widget); |
|
256 |
+ |
panel.add( widget ); |
275 |
257 |
|
} |
276 |
258 |
|
return panel; |
277 |
259 |
|
} |
278 |
260 |
|
|
279 |
|
- |
protected Widget createBodyWidget(Widget bodyAboveControlButtons, ButtonBase... bottomControlButtons) { |
280 |
|
- |
Widget centeredButtons = center(createButtons(bottomControlButtons)); |
281 |
|
- |
if (centeredButtons == null) { |
|
261 |
+ |
protected Widget createBodyWidget( Widget bodyAboveControlButtons, ButtonBase... bottomControlButtons ) { |
|
262 |
+ |
Widget centeredButtons = center( createButtons( bottomControlButtons ) ); |
|
263 |
+ |
if ( centeredButtons == null ) { |
282 |
264 |
|
return bodyAboveControlButtons; |
283 |
265 |
|
} |
284 |
266 |
|
VerticalPanel panel; |
285 |
|
- |
if (bodyAboveControlButtons instanceof VerticalPanel) { |
|
267 |
+ |
if ( bodyAboveControlButtons instanceof VerticalPanel ) { |
286 |
268 |
|
panel = (VerticalPanel) bodyAboveControlButtons; |
287 |
269 |
|
} else { |
288 |
270 |
|
panel = createVerticalContentPanel(); |
289 |
|
- |
panel.add(bodyAboveControlButtons); |
|
271 |
+ |
panel.add( bodyAboveControlButtons ); |
290 |
272 |
|
} |
291 |
|
- |
return addWithSpacing(panel, centeredButtons); |
|
273 |
+ |
return addWithSpacing( panel, centeredButtons ); |
292 |
274 |
|
} |
293 |
275 |
|
|
294 |
276 |
|
public class TitleBar extends Composite { |
295 |
277 |
|
|
296 |
|
- |
public TitleBar(Widget left, Widget center, Widget right) { |
|
278 |
+ |
public TitleBar( Widget left, Widget center, Widget right ) { |
297 |
279 |
|
String Id = HTMLPanel.createUniqueId(); |
298 |
280 |
|
String leftId = "left-" + Id; |
299 |
281 |
|
String centerId = "center-" + Id; |
300 |
282 |
|
String rightId = "right-" + Id; |
301 |
|
- |
HTMLPanel htmlPanel = new HTMLPanel("<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr>" + // |
302 |
|
- |
"<td id='" + leftId + "' align='left' valign='middle'></td>" + // |
303 |
|
- |
"<td id='" + centerId + "' align='left' valign='middle'></td>" + // |
304 |
|
- |
"<td id='" + rightId + "' align='right' valign='middle'></td>" + // |
305 |
|
- |
"</tr></table>"); |
306 |
|
- |
htmlPanel.add(deNull(left), leftId); |
307 |
|
- |
htmlPanel.add(deNull(center), centerId); |
308 |
|
- |
htmlPanel.add(deNull(right), rightId); |
309 |
|
- |
initWidget(htmlPanel); |
|
283 |
+ |
HTMLPanel htmlPanel = new HTMLPanel( "<table border=0 cellpadding=0 cellspacing=0 width='100%'><tr>" + // |
|
284 |
+ |
"<td id='" + leftId + "' align='left' valign='middle'></td>" + // |
|
285 |
+ |
"<td id='" + centerId + "' align='left' valign='middle'></td>" + // |
|
286 |
+ |
"<td id='" + rightId + "' align='right' valign='middle'></td>" + // |
|
287 |
+ |
"</tr></table>" ); |
|
288 |
+ |
htmlPanel.add( deNull( left ), leftId ); |
|
289 |
+ |
htmlPanel.add( deNull( center ), centerId ); |
|
290 |
+ |
htmlPanel.add( deNull( right ), rightId ); |
|
291 |
+ |
initWidget( htmlPanel ); |
310 |
292 |
|
} |
311 |
293 |
|
|
312 |
|
- |
public TitleBar style(String className) { |
313 |
|
- |
addStyleName(className); |
|
294 |
+ |
public TitleBar style( String className ) { |
|
295 |
+ |
addStyleName( className ); |
314 |
296 |
|
return this; |
315 |
297 |
|
} |
316 |
298 |
|
|
317 |
|
- |
private Widget deNull(Widget widget) { |
318 |
|
- |
if (widget == null) { |
319 |
|
- |
widget = new Spacer("1px", "1px"); |
|
299 |
+ |
private Widget deNull( Widget widget ) { |
|
300 |
+ |
if ( widget == null ) { |
|
301 |
+ |
widget = new Spacer( "1px", "1px" ); |
320 |
302 |
|
} |
321 |
303 |
|
return widget; |
322 |
304 |
|
} |
323 |
305 |
|
} |
324 |
|
- |
|
325 |
306 |
|
} |