1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.gwtwidgets.client.ui;
18
19 import org.gwtwidgets.client.style.BorderStyle;
20 import org.gwtwidgets.client.style.Color;
21 import org.gwtwidgets.client.style.BorderStyle.BorderStyleConstant;
22 import com.google.gwt.user.client.DOM;
23
24
25 public class ImageButtonFactory
26 {
27 private Color backgroundOnColor = Color.NONE;
28 private Color backgroundOffColor = Color.NONE;
29
30 private Color borderOnColor = Color.BLACK;
31 private Color borderOffColor = Color.NONE;
32
33 private int borderOnWidth = 1;
34 private int borderOffWidth = 0;
35
36 private BorderStyleConstant borderOnStyle = BorderStyle.BORDER_STYLE_SOLID;
37 private BorderStyleConstant borderOffStyle = BorderStyle.BORDER_STYLE_NONE;
38 private int marginLeft;
39 private int marginRight;
40 private int marginTop;
41 private int marginBottom;
42
43
44
45 public ToggleButton createToggleButton (String url, int width, int height)
46 {
47 ToggleButton result = new ToggleButton(url, width, height);
48 result.setBackgroundOnColor(backgroundOnColor);
49 result.setBackgroundOffColor(backgroundOffColor);
50
51 result.setBorderOnColor(borderOnColor);
52 result.setBorderOffColor(borderOffColor);
53
54 result.setBorderOnWidth(borderOnWidth);
55 result.setBorderOffWidth(borderOffWidth);
56
57 result.setBorderOnStyle(borderOnStyle);
58 result.setBorderOffStyle(borderOffStyle);
59
60 result.setOn(false);
61 result.setColors();
62
63 return result;
64 }
65
66 public ImageButton createImageButton (String url, int width, int height)
67 {
68 ImageButton result = new ImageButton(url, width, height);
69 result.setBackgroundOnColor(backgroundOnColor);
70 result.setBackgroundOffColor(backgroundOffColor);
71
72 result.setBorderOnColor(borderOnColor);
73 result.setBorderOffColor(borderOffColor);
74
75 result.setBorderOnWidth(borderOnWidth);
76 result.setBorderOffWidth(borderOffWidth);
77
78 result.setBorderOnStyle(borderOnStyle);
79 result.setBorderOffStyle(borderOffStyle);
80
81 DOM.setStyleAttribute(result.getElement(), "marginLeft", marginLeft + "px");
82 DOM.setStyleAttribute(result.getElement(), "marginRight", marginRight + "px");
83 DOM.setStyleAttribute(result.getElement(), "marginTop", marginTop + "px");
84 DOM.setStyleAttribute(result.getElement(), "marginBotom", marginBottom + "px");
85
86 result.setColors();
87
88 return result;
89 }
90
91
92 /***
93 * This method is under consideration for removal,
94 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
95 */
96 public Color getBackgroundOffColor ()
97 {
98 return backgroundOffColor;
99 }
100
101 /***
102 * This method is under consideration for removal,
103 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
104 */
105 public void setBackgroundOffColor (Color backgroundOffColor)
106 {
107 this.backgroundOffColor = backgroundOffColor;
108 }
109
110 /***
111 * This method is under consideration for removal,
112 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
113 */
114 public Color getBackgroundOnColor ()
115 {
116 return backgroundOnColor;
117 }
118
119 /***
120 * This method is under consideration for removal,
121 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
122 */
123 public void setBackgroundOnColor (Color backgroundOnColor)
124 {
125 this.backgroundOnColor = backgroundOnColor;
126 }
127
128 /***
129 * This method is under consideration for removal,
130 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
131 */
132 public Color getBorderOffColor ()
133 {
134 return borderOffColor;
135 }
136
137 /***
138 * This method is under consideration for removal,
139 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
140 */
141 public void setBorderOffColor (Color borderOffColor)
142 {
143 this.borderOffColor = borderOffColor;
144 }
145
146 /***
147 * This method is under consideration for removal,
148 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
149 */
150 public BorderStyleConstant getBorderOffStyle ()
151 {
152 return borderOffStyle;
153 }
154
155 /***
156 * This method is under consideration for removal,
157 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
158 */
159 public void setBorderOffStyle (BorderStyleConstant borderOffStyle)
160 {
161 this.borderOffStyle = borderOffStyle;
162 }
163
164 /***
165 * This method is under consideration for removal,
166 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
167 */
168 public int getBorderOffWidth ()
169 {
170 return borderOffWidth;
171 }
172
173 /***
174 * This method is under consideration for removal,
175 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
176 */
177 public void setBorderOffWidth (int borderOffWidth)
178 {
179 this.borderOffWidth = borderOffWidth;
180 }
181
182 /***
183 * This method is under consideration for removal,
184 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
185 */
186 public Color getBorderOnColor ()
187 {
188 return borderOnColor;
189 }
190
191 /***
192 * This method is under consideration for removal,
193 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
194 */
195 public void setBorderOnColor (Color borderOnColor)
196 {
197 this.borderOnColor = borderOnColor;
198 }
199
200 /***
201 * This method is under consideration for removal,
202 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
203 */
204 public BorderStyleConstant getBorderOnStyle ()
205 {
206 return borderOnStyle;
207 }
208
209 /***
210 * This method is under consideration for removal,
211 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
212 */
213 public void setBorderOnStyle (BorderStyleConstant borderOnStyle)
214 {
215 this.borderOnStyle = borderOnStyle;
216 }
217
218 /***
219 * This method is under consideration for removal,
220 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
221 */
222 public int getBorderOnWidth ()
223 {
224 return borderOnWidth;
225 }
226
227 /***
228 * This method is under consideration for removal,
229 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
230 */
231 public void setBorderOnWidth (int borderOnWidth)
232 {
233 this.borderOnWidth = borderOnWidth;
234 }
235
236 /***
237 * This method is under consideration for removal,
238 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
239 */
240 public void setMargin (int px)
241 {
242 marginLeft = px;
243 marginRight = px;
244 marginTop = px;
245 marginBottom = px;
246 }
247
248 /***
249 * This method is under consideration for removal,
250 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
251 */
252 public void setHorizontalMargin (int px)
253 {
254 marginLeft = px;
255 marginRight = px;
256 }
257
258 /***
259 * This method is under consideration for removal,
260 * if you have an opion please comment on http://gwtwidgets.blogspot.com.
261 */
262 public void setVerticalMargin (int px)
263 {
264 marginTop = px;
265 marginBottom = px;
266 }
267 }