gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.swing / org.gvsig.tools.swing.impl / src / main / java / org / gvsig / tools / swing / impl / DefaultToolsSwingManager.java @ 2639
History | View | Annotate | Download (25.1 KB)
1 |
package org.gvsig.tools.swing.impl; |
---|---|
2 |
|
3 |
import org.gvsig.tools.swing.api.FilteredListModel; |
4 |
import java.awt.Color; |
5 |
import java.awt.Component; |
6 |
import java.awt.Dimension; |
7 |
import java.awt.event.ActionListener; |
8 |
import java.awt.image.BufferedImage; |
9 |
import java.awt.image.WritableRaster; |
10 |
import java.io.File; |
11 |
import java.lang.reflect.InvocationTargetException; |
12 |
import java.lang.reflect.Method; |
13 |
import java.sql.Time; |
14 |
import javax.swing.AbstractButton; |
15 |
import javax.swing.ComboBoxModel; |
16 |
import javax.swing.Icon; |
17 |
import javax.swing.ImageIcon; |
18 |
import javax.swing.JButton; |
19 |
import javax.swing.JComboBox; |
20 |
import javax.swing.JComponent; |
21 |
import javax.swing.JLabel; |
22 |
import javax.swing.JList; |
23 |
import javax.swing.JScrollPane; |
24 |
import javax.swing.JSlider; |
25 |
import javax.swing.JSpinner; |
26 |
import javax.swing.JTabbedPane; |
27 |
import javax.swing.JTable; |
28 |
import javax.swing.JTree; |
29 |
import javax.swing.JViewport; |
30 |
import javax.swing.border.TitledBorder; |
31 |
import javax.swing.table.TableModel; |
32 |
import javax.swing.text.JTextComponent; |
33 |
import javax.swing.tree.TreeModel; |
34 |
import org.apache.commons.lang3.StringUtils; |
35 |
import org.gvsig.tools.ToolsLocator; |
36 |
import org.gvsig.tools.bookmarksandhistory.Bookmarks; |
37 |
import org.gvsig.tools.bookmarksandhistory.History; |
38 |
import org.gvsig.tools.i18n.I18nManager; |
39 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
40 |
import org.gvsig.tools.swing.api.ChangeListenerHelper; |
41 |
import org.gvsig.tools.swing.api.ColorChooserController; |
42 |
import org.gvsig.tools.swing.api.CompoundIcon; |
43 |
import org.gvsig.tools.swing.api.DropDown; |
44 |
import org.gvsig.tools.swing.api.FilteredListController; |
45 |
import org.gvsig.tools.swing.api.FilteredTableModel; |
46 |
import org.gvsig.tools.swing.api.FilteredTreeController; |
47 |
import org.gvsig.tools.swing.api.FilteredTreeModel; |
48 |
import org.gvsig.tools.swing.api.JListWithCheckbox; |
49 |
import org.gvsig.tools.swing.api.JWebBrowser; |
50 |
import org.gvsig.tools.swing.api.JWebBrowserFactory; |
51 |
import org.gvsig.tools.swing.api.MessageBarController; |
52 |
import org.gvsig.tools.swing.api.SimpleImage; |
53 |
import org.gvsig.tools.swing.api.TableColumnAdjuster; |
54 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
55 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
56 |
import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController; |
57 |
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
58 |
import org.gvsig.tools.swing.api.pickercontroller.FilePickerController; |
59 |
import org.gvsig.tools.swing.api.pickercontroller.FolderPickerController; |
60 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
61 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
62 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
63 |
import org.gvsig.tools.swing.impl.bufferedImage.VirtualBufferedImageHelper; |
64 |
import org.gvsig.tools.swing.impl.bufferedImage.VirtualBufferedImageHelper.VirtualDataBuffer; |
65 |
import org.gvsig.tools.swing.impl.pickercontroller.BytearrayPickerControllerImpl; |
66 |
import org.gvsig.tools.swing.impl.pickercontroller.ColorPickerControllerImpl; |
67 |
import org.gvsig.tools.swing.impl.pickercontroller.DatePickerControllerImpl; |
68 |
import org.gvsig.tools.swing.impl.pickercontroller.FilePickerControllerImpl; |
69 |
import org.gvsig.tools.swing.impl.pickercontroller.FolderPickerControllerImpl; |
70 |
import org.gvsig.tools.swing.api.bookmarkshistory.BookmarksController; |
71 |
import org.gvsig.tools.swing.api.bookmarkshistory.HistoryController; |
72 |
import org.gvsig.tools.swing.api.bookmarkshistory.TextFieldWithHistoryAndBookmarkController; |
73 |
import org.gvsig.tools.swing.api.pickercontroller.DataTypePickerController; |
74 |
import org.gvsig.tools.swing.impl.bookmarkshistory.DefaultBookmarksController; |
75 |
import org.gvsig.tools.swing.impl.bookmarkshistory.DefaultHistoryController; |
76 |
import org.gvsig.tools.swing.impl.bookmarkshistory.TextFieldWithHistoryAndBookmarkControllerImpl; |
77 |
import org.gvsig.tools.swing.impl.pickercontroller.DataTypePickerControllerImpl; |
78 |
import org.gvsig.tools.swing.impl.pickercontroller.nullablespinner.NullableSpinnerUtils; |
79 |
|
80 |
@SuppressWarnings("UseSpecificCatch") |
81 |
public class DefaultToolsSwingManager implements ToolsSwingManager { |
82 |
|
83 |
private Dimension maxPhysicalSizeOfBufferedImage; |
84 |
private JWebBrowserFactory webBrowserfactory;
|
85 |
private Color warningBackgroundColor = new Color(255,225,232); |
86 |
|
87 |
@Override
|
88 |
public void setWarningBackgroundColor(Color warningBackgroundColor) { |
89 |
this.warningBackgroundColor = warningBackgroundColor;
|
90 |
} |
91 |
|
92 |
@Override
|
93 |
public Color getWarningBackgroundColor() { |
94 |
return this.warningBackgroundColor; |
95 |
} |
96 |
|
97 |
@Override
|
98 |
public ActionListenerSupport createActionListenerSupport() {
|
99 |
return new DefaultActionListenerSupport(); |
100 |
} |
101 |
|
102 |
@Override
|
103 |
public JListWithCheckbox createJListWithCheckbox(JList wrappedList) { |
104 |
return new DefaultJListWithCheckbox(wrappedList); |
105 |
} |
106 |
|
107 |
@Override
|
108 |
public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel) { |
109 |
TreeComboUtils.setTreeModel(comboBox, aTreeModel); |
110 |
} |
111 |
|
112 |
@Override
|
113 |
public ComboBoxModel createComboBoxModel(TreeModel treeModel) { |
114 |
return TreeComboUtils.createComboBoxModel(treeModel);
|
115 |
} |
116 |
|
117 |
@Override
|
118 |
public BufferedImage createBufferedImage(int w, int h, int type) { |
119 |
if (getMaxPhysicalSizeOfBufferedImage().getWidth() < w || getMaxPhysicalSizeOfBufferedImage().getHeight() < h) {
|
120 |
return createVirtualBufferedImage(w, h, type);
|
121 |
} |
122 |
return new BufferedImage(w, h, type); |
123 |
} |
124 |
|
125 |
@Override
|
126 |
public BufferedImage createVirtualBufferedImage(int w, int h, int type) { |
127 |
return VirtualBufferedImageHelper.createVirtualBufferedImage(w, h, type);
|
128 |
} |
129 |
|
130 |
@Override
|
131 |
public BufferedImage copyBufferedImage(BufferedImage img) { |
132 |
WritableRaster sourceRaster = img.getRaster();
|
133 |
|
134 |
BufferedImage newImage;
|
135 |
if (sourceRaster.getDataBuffer() instanceof VirtualDataBuffer) { |
136 |
newImage = VirtualBufferedImageHelper.createVirtualBufferedImage( |
137 |
img.getWidth(), |
138 |
img.getHeight(), |
139 |
img.getSampleModel(), |
140 |
img.getColorModel() |
141 |
); |
142 |
} else {
|
143 |
newImage = createBufferedImage(img.getWidth(), img.getHeight(), img.getType()); |
144 |
} |
145 |
|
146 |
WritableRaster raster = newImage.getRaster();
|
147 |
img.copyData(raster); |
148 |
return newImage;
|
149 |
} |
150 |
|
151 |
@Override
|
152 |
public void setMaxPhysicalSizeOfBufferedImage(Dimension dimension) { |
153 |
this.maxPhysicalSizeOfBufferedImage = dimension;
|
154 |
} |
155 |
|
156 |
@Override
|
157 |
public Dimension getMaxPhysicalSizeOfBufferedImage() { |
158 |
if (this.maxPhysicalSizeOfBufferedImage == null) { |
159 |
this.maxPhysicalSizeOfBufferedImage = new Dimension(2000, 2000); |
160 |
} |
161 |
return this.maxPhysicalSizeOfBufferedImage; |
162 |
} |
163 |
|
164 |
@Override
|
165 |
public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull) { |
166 |
return new DefaultColorChooserController(txtLabel, btnShowDialog, sldAlpha, allowNull); |
167 |
} |
168 |
|
169 |
@Override
|
170 |
public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog) { |
171 |
return new DefaultColorChooserController(txtLabel, btnShowDialog); |
172 |
} |
173 |
|
174 |
@Override
|
175 |
public ColorChooserController createColorChooserController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha) { |
176 |
return new DefaultColorChooserController(txtLabel, btnShowDialog, sldAlpha); |
177 |
} |
178 |
|
179 |
@Override
|
180 |
public Color alphaBlendingWithOpaqueBackground(Color bgColor, Color fgColor) { |
181 |
// https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
|
182 |
Color src = fgColor;
|
183 |
Color dst = bgColor;
|
184 |
|
185 |
// double outa = 1;
|
186 |
double srca = src.getAlpha() / 255.0; |
187 |
double srca_1 = (1 - srca); |
188 |
|
189 |
Color color = new Color( |
190 |
(int) (src.getRed() * srca + dst.getRed() * srca_1) & 0xff, |
191 |
(int) (src.getGreen() * srca + dst.getGreen() * srca_1) & 0xff, |
192 |
(int) (src.getBlue() * srca + dst.getBlue() * srca_1) & 0xff |
193 |
); |
194 |
return color;
|
195 |
} |
196 |
|
197 |
@Override
|
198 |
public Color opaqueColor(Color src) { |
199 |
// https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
|
200 |
double srca = src.getAlpha() / 255.0; |
201 |
double srca_1 = (1 - srca); |
202 |
|
203 |
Color color = new Color( |
204 |
(int) (src.getRed() * srca + 255 * srca_1) & 0xff, |
205 |
(int) (src.getGreen() * srca + 255 * srca_1) & 0xff, |
206 |
(int) (src.getBlue() * srca + 255 * srca_1) & 0xff |
207 |
); |
208 |
return color;
|
209 |
} |
210 |
|
211 |
private Object call(Object obj, String name, Object... params) { |
212 |
Class[] types = null; |
213 |
if (params != null) { |
214 |
types = new Class[params.length]; |
215 |
for (int i = 0; i < params.length; i++) { |
216 |
types[i] = params[i].getClass(); |
217 |
} |
218 |
} |
219 |
Method method;
|
220 |
try {
|
221 |
method = obj.getClass().getMethod(name, types); |
222 |
Object r = method.invoke(obj, params);
|
223 |
return r;
|
224 |
} catch (NoSuchMethodException |
225 |
| SecurityException
|
226 |
| IllegalAccessException
|
227 |
| IllegalArgumentException
|
228 |
| InvocationTargetException ex) {
|
229 |
} |
230 |
return null; |
231 |
} |
232 |
|
233 |
@Override
|
234 |
public void translate(JComponent component) { |
235 |
this.translate(component,false); |
236 |
} |
237 |
|
238 |
@Override
|
239 |
public void translate(AbstractButton component) { |
240 |
this.translate(component,false); |
241 |
} |
242 |
|
243 |
@Override
|
244 |
public void translate(JLabel component) { |
245 |
this.translate(component,false); |
246 |
} |
247 |
|
248 |
@Override
|
249 |
public void translate(JTabbedPane component) { |
250 |
this.translate(component,false); |
251 |
} |
252 |
|
253 |
@Override
|
254 |
public void translate(JComponent component, boolean wrap) { |
255 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
256 |
String text = (String) call(component, "getText", (Object[]) null); |
257 |
if (!StringUtils.isBlank(text)) {
|
258 |
text = i18n.getTranslation(text); |
259 |
if( wrap ) {
|
260 |
text = toHTML(text); |
261 |
} |
262 |
call(component, "setText", text);
|
263 |
} |
264 |
text = (String) call(component, "getToolTipText", (Object[]) null); |
265 |
if (!StringUtils.isEmpty(text)) {
|
266 |
text = i18n.getTranslation(text); |
267 |
call(component, "setToolTipText", toHTML(text));
|
268 |
} |
269 |
} |
270 |
|
271 |
@Override
|
272 |
public void translate(AbstractButton component, boolean wrap) { |
273 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
274 |
String text= component.getText();
|
275 |
if (!StringUtils.isBlank(text)) {
|
276 |
text = i18n.getTranslation(text); |
277 |
if( wrap ) {
|
278 |
text = toHTML(text); |
279 |
} |
280 |
component.setText(text); |
281 |
} |
282 |
text = component.getToolTipText(); |
283 |
if (!StringUtils.isBlank(text)) {
|
284 |
text = i18n.getTranslation(text); |
285 |
component.setToolTipText(toHTML(text)); |
286 |
} |
287 |
} |
288 |
|
289 |
@Override
|
290 |
public void translate(JLabel component, boolean wrap) { |
291 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
292 |
String text = component.getText();
|
293 |
if (!StringUtils.isBlank(text)) {
|
294 |
text = i18n.getTranslation(text); |
295 |
if( wrap ) {
|
296 |
text = toHTML(text); |
297 |
} |
298 |
component.setText(text); |
299 |
} |
300 |
text = component.getToolTipText(); |
301 |
if (!StringUtils.isBlank(text)) {
|
302 |
text = i18n.getTranslation(text); |
303 |
component.setToolTipText(toHTML(text)); |
304 |
} |
305 |
} |
306 |
|
307 |
@Override
|
308 |
public void translate(JTabbedPane component, boolean wrap) { |
309 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
310 |
|
311 |
for (int i = 0; i < component.getTabCount(); i++) { |
312 |
String text = component.getTitleAt(i);
|
313 |
if (!StringUtils.isBlank(text)) {
|
314 |
text = i18n.getTranslation(text); |
315 |
if( wrap ) {
|
316 |
text = toHTML(text); |
317 |
} |
318 |
component.setTitleAt(i, text); |
319 |
} |
320 |
text = component.getToolTipTextAt(i); |
321 |
if (!StringUtils.isBlank(text)) {
|
322 |
text = i18n.getTranslation(text); |
323 |
component.setToolTipTextAt(i, toHTML(text)); |
324 |
} |
325 |
} |
326 |
} |
327 |
|
328 |
public static String toHTML(String s) { |
329 |
s = StringUtils.replace(s, "\n", "<br>"); |
330 |
s = StringUtils.replace(s, "<html>", ""); |
331 |
s = StringUtils.replace(s, "</html>", ""); |
332 |
s = "<html>"+s+"</html>"; |
333 |
return s;
|
334 |
} |
335 |
|
336 |
@Override
|
337 |
public void setDefaultPopupMenu(final JTextComponent component) { |
338 |
ContextMenuUtils.setDefaultContextMenu(component); |
339 |
} |
340 |
|
341 |
@Override
|
342 |
public void setDefaultPopupMenu(final JTextComponent component, String title) { |
343 |
ContextMenuUtils.setDefaultContextMenu(component, title); |
344 |
} |
345 |
|
346 |
@Override
|
347 |
public void setDefaultPopupMenu(JComboBox component) { |
348 |
ContextMenuUtils.setDefaultContextMenu(component); |
349 |
} |
350 |
|
351 |
@Override
|
352 |
public void setDefaultPopupMenu(JComboBox component, String title) { |
353 |
ContextMenuUtils.setDefaultContextMenu(component, title); |
354 |
} |
355 |
|
356 |
@Override
|
357 |
public ChangeListenerHelper createChangeListenerHelper() {
|
358 |
DefaultChangeListenerHelper x = new DefaultChangeListenerHelper();
|
359 |
return x;
|
360 |
} |
361 |
|
362 |
@Override
|
363 |
public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull) { |
364 |
return new ColorPickerControllerImpl(txtLabel, btnShowDialog, sldAlpha, allowNull); |
365 |
} |
366 |
|
367 |
@Override
|
368 |
public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog) { |
369 |
return new ColorPickerControllerImpl(txtLabel, btnShowDialog); |
370 |
} |
371 |
|
372 |
@Override
|
373 |
public ColorPickerController createColorPickerController(JTextComponent txtLabel, JButton btnShowDialog, JSlider sldAlpha) { |
374 |
return new ColorPickerControllerImpl(txtLabel, btnShowDialog, sldAlpha); |
375 |
} |
376 |
|
377 |
@Override
|
378 |
public DatePickerController createDatePickerController(JTextComponent txtDate, JButton btnDate) { |
379 |
return new DatePickerControllerImpl(txtDate, btnDate); |
380 |
} |
381 |
|
382 |
@Override
|
383 |
public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon) { |
384 |
return new FilePickerControllerImpl(txtFile, btnFile, dialogTitle, fileChooserID, initialPath, seticon); |
385 |
} |
386 |
|
387 |
@Override
|
388 |
public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile) { |
389 |
return new FilePickerControllerImpl(txtFile, btnFile); |
390 |
} |
391 |
|
392 |
@Override
|
393 |
public PickerController<byte[]> createByteArrayPickerController(JTextComponent txtText, JButton btnUpload, JButton btnDownload, String fileChooserID, File initialPath) { |
394 |
return new BytearrayPickerControllerImpl(txtText, btnUpload, btnDownload, fileChooserID, initialPath); |
395 |
} |
396 |
|
397 |
@Override
|
398 |
public PickerController<byte[]> createByteArrayPickerController(JTextComponent txtText, JButton btnUpload, JButton btnDownload) { |
399 |
return new BytearrayPickerControllerImpl(txtText, btnUpload, btnDownload, null, null); |
400 |
} |
401 |
|
402 |
@Override
|
403 |
public FilePickerController createFilePickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle) { |
404 |
return new FilePickerControllerImpl(txtFile, btnFile, dialogTitle); |
405 |
} |
406 |
|
407 |
@Override
|
408 |
public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon) { |
409 |
return new FolderPickerControllerImpl(txtFile, btnFile, dialogTitle, fileChooserID, initialPath, seticon); |
410 |
} |
411 |
|
412 |
@Override
|
413 |
public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile) { |
414 |
return new FolderPickerControllerImpl(txtFile, btnFile); |
415 |
} |
416 |
|
417 |
@Override
|
418 |
public FolderPickerController createFolderPickerController(JTextComponent txtFile, JButton btnFile, String dialogTitle) { |
419 |
return new FolderPickerControllerImpl(txtFile, btnFile, dialogTitle); |
420 |
} |
421 |
|
422 |
@Override
|
423 |
public void removeBorder(JComponent component) { |
424 |
try {
|
425 |
component.setBorder(null);
|
426 |
JComponent p1 = (JComponent) component.getParent(); |
427 |
if (p1 instanceof JViewport) { |
428 |
p1 = (JComponent) component.getParent();
|
429 |
} |
430 |
if (p1 instanceof JScrollPane) { |
431 |
JScrollPane scrollPanel = (JScrollPane) component.getParent(); |
432 |
scrollPanel.setBorder(null);
|
433 |
} |
434 |
} catch (Exception ex) { |
435 |
|
436 |
} |
437 |
} |
438 |
|
439 |
protected ImageIcon getIcon(String name) { |
440 |
IconThemeManager iconThemeManager = ToolsSwingLocator.getIconThemeManager(); |
441 |
IconTheme theme = iconThemeManager.getCurrent(); |
442 |
ImageIcon icon = theme.get(name);
|
443 |
return icon;
|
444 |
} |
445 |
|
446 |
@Override
|
447 |
public void addClearButton(JTextComponent text) { |
448 |
ClearButtonUtils.addClearButton(text, null);
|
449 |
} |
450 |
|
451 |
@Override
|
452 |
public void addClearButton(JComboBox combo) { |
453 |
ClearButtonUtils.addClearButton(combo); |
454 |
} |
455 |
|
456 |
@Override
|
457 |
public void addClearButton(JComboBox combo, ActionListener action) { |
458 |
ClearButtonUtils.addClearButton(combo, action); |
459 |
} |
460 |
|
461 |
|
462 |
|
463 |
@Override
|
464 |
public boolean hasClearButton(final JComboBox combo) { |
465 |
return ClearButtonUtils.hasClearButton(combo);
|
466 |
} |
467 |
|
468 |
@Override
|
469 |
public void removeClearButton(final JComboBox combo) { |
470 |
ClearButtonUtils.removeClearButton(combo); |
471 |
} |
472 |
|
473 |
@Override
|
474 |
public boolean hasClearButton(final JTextComponent text) { |
475 |
return ClearButtonUtils.hasClearButton(text);
|
476 |
} |
477 |
|
478 |
@Override
|
479 |
public void removeClearButton(final JTextComponent text) { |
480 |
ClearButtonUtils.removeClearButton(text); |
481 |
} |
482 |
|
483 |
@Override
|
484 |
public void addClearButton(final JTextComponent text, final ActionListener action) { |
485 |
ClearButtonUtils.addClearButton(text, action); |
486 |
} |
487 |
|
488 |
public String showZoomDialog(Component parent, String title, String text, boolean editable) { |
489 |
DefaultZoomDialog dialog = new DefaultZoomDialog(parent, title, text);
|
490 |
dialog.setEditable(editable); |
491 |
dialog.setAlwaysOnTop(true);
|
492 |
dialog.setVisible(true);
|
493 |
if (editable) {
|
494 |
return dialog.getText();
|
495 |
} |
496 |
return text;
|
497 |
} |
498 |
|
499 |
@Override
|
500 |
public SimpleImage createSimpleImage() {
|
501 |
SimpleImage x = new DefaultSimpleImage();
|
502 |
return x;
|
503 |
} |
504 |
|
505 |
@Override
|
506 |
public SimpleImage createSimpleImage(Object source) { |
507 |
if( source instanceof SimpleImage ) { |
508 |
return (SimpleImage) source;
|
509 |
} |
510 |
SimpleImage x = new DefaultSimpleImage(source);
|
511 |
return x;
|
512 |
} |
513 |
|
514 |
@Override
|
515 |
public DropDown createDropDown(JComboBox combo) { |
516 |
DropDown c = new DropDownComboBox(combo, this.getWarningBackgroundColor()); |
517 |
return c;
|
518 |
} |
519 |
|
520 |
@Override
|
521 |
public DropDown createDropDown(JLabel label) { |
522 |
DropDown c = new DropDownLabel(label, this.getWarningBackgroundColor()); |
523 |
return c;
|
524 |
} |
525 |
|
526 |
@Override
|
527 |
public DropDown createDropDown(AbstractButton button) { |
528 |
DropDown c = new DropDownButton(button, this.getWarningBackgroundColor()); |
529 |
return c;
|
530 |
} |
531 |
|
532 |
@Override
|
533 |
public DropDown createDropDown(JComponent component) { |
534 |
DropDown c = new DropDownLabel(component, this.getWarningBackgroundColor()); |
535 |
return c;
|
536 |
} |
537 |
|
538 |
@Override
|
539 |
public CompoundIcon createCompoundIcon(Icon... icons) { |
540 |
DefaultCompoundIcon i = new DefaultCompoundIcon(icons);
|
541 |
return i;
|
542 |
} |
543 |
|
544 |
@Override
|
545 |
public CompoundIcon createCompoundIcon(int orientation, Icon... icons) { |
546 |
DefaultCompoundIcon i = new DefaultCompoundIcon(orientation, icons);
|
547 |
return i;
|
548 |
} |
549 |
|
550 |
@Override
|
551 |
public CompoundIcon createCompoundIcon(int orientation, int gap, Icon... icons) { |
552 |
DefaultCompoundIcon i = new DefaultCompoundIcon(orientation, gap, icons);
|
553 |
return i;
|
554 |
} |
555 |
|
556 |
@Override
|
557 |
public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons) { |
558 |
DefaultCompoundIcon i = new DefaultCompoundIcon(orientation, gap, alignmentX, alignmentY, icons);
|
559 |
return i;
|
560 |
} |
561 |
|
562 |
@Override
|
563 |
public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button) { |
564 |
BookmarksController controller; |
565 |
controller = new DefaultBookmarksController(bookmarks, button);
|
566 |
return controller;
|
567 |
} |
568 |
|
569 |
@Override
|
570 |
public HistoryController createHistoryController(History history, JButton button) { |
571 |
DefaultHistoryController controller; |
572 |
controller = new DefaultHistoryController(history, button);
|
573 |
return controller;
|
574 |
} |
575 |
|
576 |
public TextFieldWithHistoryAndBookmarkController createTextFieldWithHistoryAndBookmarkController(String name, JTextComponent text, JButton btnApply, JButton btnHistory, JButton btnBookmarks) { |
577 |
TextFieldWithHistoryAndBookmarkControllerImpl controller; |
578 |
controller = new TextFieldWithHistoryAndBookmarkControllerImpl(name, text, btnApply, btnHistory, btnBookmarks);
|
579 |
return controller;
|
580 |
} |
581 |
|
582 |
@Override
|
583 |
public FilteredTableModel createFilteredTableModel(TableModel tableModel, int filterColumn) { |
584 |
FilteredTableModelImpl model = new FilteredTableModelImpl(tableModel, filterColumn);
|
585 |
return model;
|
586 |
} |
587 |
|
588 |
@Override
|
589 |
public JLabel createTitledSeparator(String title, int height, int titlePosition, int titleJustification) { |
590 |
TitledSeparator c = new TitledSeparator(title, height, titlePosition, titleJustification);
|
591 |
return c;
|
592 |
} |
593 |
|
594 |
@Override
|
595 |
public JLabel createTitledSeparator(String title) { |
596 |
TitledSeparator c = new TitledSeparator(
|
597 |
title, |
598 |
2,
|
599 |
TitledBorder.DEFAULT_POSITION,
|
600 |
TitledBorder.DEFAULT_JUSTIFICATION
|
601 |
); |
602 |
return c;
|
603 |
} |
604 |
|
605 |
@Override
|
606 |
public FilteredListModel createFilteredListModel() {
|
607 |
FilteredListModel model = new FilteredListModelImpl(null); |
608 |
return model;
|
609 |
} |
610 |
|
611 |
@Override
|
612 |
public FilteredTreeModel createFilteredTreeModel(JTree tree) { |
613 |
FilteredTreeModel model = new FilteredTreeModelImpl(tree.getModel());
|
614 |
return model;
|
615 |
} |
616 |
|
617 |
@Override
|
618 |
public FilteredListController createFilteredListController(JList list, JTextComponent text, JButton button) { |
619 |
FilteredListController flc = new DefaultFilteredListController(list, text, button);
|
620 |
return flc;
|
621 |
} |
622 |
|
623 |
@Override
|
624 |
public FilteredTreeController createFilteredTreeController(JTree list, JTextComponent text, JButton button) { |
625 |
FilteredTreeController ftc = new DefaultFilteredTreeController(list, text, button);
|
626 |
return ftc;
|
627 |
} |
628 |
|
629 |
@Override
|
630 |
public JWebBrowser createJWebBrowser() {
|
631 |
return this.webBrowserfactory.create(); |
632 |
} |
633 |
|
634 |
@Override
|
635 |
public void registerJWebBrowserFactory(JWebBrowserFactory factory) { |
636 |
this.webBrowserfactory = factory;
|
637 |
} |
638 |
|
639 |
public JWebBrowserFactory getJWebBrowserFactory() {
|
640 |
return this.webBrowserfactory; |
641 |
} |
642 |
|
643 |
@Override
|
644 |
public DataTypePickerController createDataTypePickerController(JComboBox cboDataType, JButton btnDataType, boolean allowNull) { |
645 |
return new DataTypePickerControllerImpl(cboDataType, btnDataType, allowNull); |
646 |
} |
647 |
|
648 |
@Override
|
649 |
public TableColumnAdjuster createTableColumnAdjuster(JTable table) { |
650 |
return TableColumnAdjusterImpl.install(table);
|
651 |
} |
652 |
|
653 |
@Override
|
654 |
public MessageBarController createMessageBarController(JLabel txtLabel, int timeDuration) { |
655 |
return new MessageBarControllerImpl(txtLabel, timeDuration); |
656 |
} |
657 |
|
658 |
@Override
|
659 |
public DropDown createDropDownIcon(JLabel lblNull) { |
660 |
|
661 |
return new DropDownLabelIcon(lblNull, this.getWarningBackgroundColor()); |
662 |
} |
663 |
|
664 |
@Override
|
665 |
public void putInClipboard(String data) { |
666 |
ClipboardMonitor.getMonitor().put(data); |
667 |
} |
668 |
|
669 |
@Override
|
670 |
public String getFromClipboard() { |
671 |
return ClipboardMonitor.getMonitor().getString();
|
672 |
} |
673 |
|
674 |
@Override
|
675 |
public boolean isClipboardEmpty() { |
676 |
return ClipboardMonitor.getMonitor().hasString();
|
677 |
} |
678 |
|
679 |
@Override
|
680 |
public void addClipboardObserver(java.util.Observer observer) { |
681 |
ClipboardMonitor.getMonitor().addObserver(observer); |
682 |
} |
683 |
|
684 |
@Override
|
685 |
public void deleteClipboardObserver(java.util.Observer observer) { |
686 |
ClipboardMonitor.getMonitor().deleteObserver(observer); |
687 |
} |
688 |
|
689 |
@Override
|
690 |
public JSpinner spinnerOfNumber(JSpinner spinner, Number value) { |
691 |
return NullableSpinnerUtils.ofNumber(spinner, value);
|
692 |
} |
693 |
|
694 |
@Override
|
695 |
public JSpinner spinnerOfNumber(JSpinner spinner, Class valueClass) { |
696 |
return NullableSpinnerUtils.ofNumber(spinner, valueClass);
|
697 |
} |
698 |
|
699 |
@Override
|
700 |
public JSpinner spinnerOfIntegers(JSpinner spinner, Integer value, int minimum, int maximum, int stepSize) { |
701 |
return NullableSpinnerUtils.ofIntegers(spinner, value, minimum, maximum, stepSize);
|
702 |
} |
703 |
|
704 |
@Override
|
705 |
public JSpinner spinnerOfTime(JSpinner spinner) { |
706 |
return NullableSpinnerUtils.ofTime(spinner);
|
707 |
} |
708 |
|
709 |
@Override
|
710 |
public JSpinner spinnerOfTime(JSpinner spinner, Time value) { |
711 |
return NullableSpinnerUtils.ofTime(spinner, value);
|
712 |
} |
713 |
|
714 |
|
715 |
|
716 |
} |