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 @ 2010
History | View | Annotate | Download (21.9 KB)
1 |
package org.gvsig.tools.swing.impl; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.Color; |
5 |
import java.awt.Cursor; |
6 |
import java.awt.Dimension; |
7 |
import java.awt.event.ActionEvent; |
8 |
import java.awt.event.ActionListener; |
9 |
import java.awt.image.BufferedImage; |
10 |
import java.awt.image.WritableRaster; |
11 |
import java.beans.PropertyChangeEvent; |
12 |
import java.beans.PropertyChangeListener; |
13 |
import java.io.File; |
14 |
import java.lang.reflect.InvocationTargetException; |
15 |
import java.lang.reflect.Method; |
16 |
import javax.swing.AbstractAction; |
17 |
import javax.swing.AbstractButton; |
18 |
import javax.swing.Action; |
19 |
import javax.swing.ComboBoxModel; |
20 |
import javax.swing.Icon; |
21 |
import javax.swing.ImageIcon; |
22 |
import javax.swing.JButton; |
23 |
import javax.swing.JComboBox; |
24 |
import javax.swing.JComponent; |
25 |
import javax.swing.JLabel; |
26 |
import javax.swing.JList; |
27 |
import javax.swing.JMenuItem; |
28 |
import javax.swing.JPopupMenu; |
29 |
import javax.swing.JScrollPane; |
30 |
import javax.swing.JSlider; |
31 |
import javax.swing.JTabbedPane; |
32 |
import javax.swing.JTextField; |
33 |
import javax.swing.JViewport; |
34 |
import javax.swing.table.TableModel; |
35 |
import javax.swing.text.DefaultEditorKit; |
36 |
import javax.swing.text.JTextComponent; |
37 |
import javax.swing.tree.TreeModel; |
38 |
import org.apache.commons.lang3.StringUtils; |
39 |
import org.gvsig.tools.ToolsLocator; |
40 |
import org.gvsig.tools.bookmarksandhistory.Bookmarks; |
41 |
import org.gvsig.tools.bookmarksandhistory.History; |
42 |
import org.gvsig.tools.i18n.I18nManager; |
43 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
44 |
import org.gvsig.tools.swing.api.ChangeListenerHelper; |
45 |
import org.gvsig.tools.swing.api.ColorChooserController; |
46 |
import org.gvsig.tools.swing.api.CompoundIcon; |
47 |
import org.gvsig.tools.swing.api.DropDown; |
48 |
import org.gvsig.tools.swing.api.FilteredTableModel; |
49 |
import org.gvsig.tools.swing.api.JListWithCheckbox; |
50 |
import org.gvsig.tools.swing.api.SimpleImage; |
51 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
52 |
import org.gvsig.tools.swing.api.ToolsSwingManager; |
53 |
import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController; |
54 |
import org.gvsig.tools.swing.api.pickercontroller.DatePickerController; |
55 |
import org.gvsig.tools.swing.api.pickercontroller.FilePickerController; |
56 |
import org.gvsig.tools.swing.api.pickercontroller.FolderPickerController; |
57 |
import org.gvsig.tools.swing.api.pickercontroller.PickerController; |
58 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
59 |
import org.gvsig.tools.swing.icontheme.IconThemeManager; |
60 |
import org.gvsig.tools.swing.impl.bufferedImage.VirtualBufferedImageHelper; |
61 |
import org.gvsig.tools.swing.impl.bufferedImage.VirtualBufferedImageHelper.VirtualDataBuffer; |
62 |
import org.gvsig.tools.swing.impl.pickercontroller.BytearrayPickerControllerImpl; |
63 |
import org.gvsig.tools.swing.impl.pickercontroller.ColorPickerControllerImpl; |
64 |
import org.gvsig.tools.swing.impl.pickercontroller.DatePickerControllerImpl; |
65 |
import org.gvsig.tools.swing.impl.pickercontroller.FilePickerControllerImpl; |
66 |
import org.gvsig.tools.swing.impl.pickercontroller.FolderPickerControllerImpl; |
67 |
import org.gvsig.tools.swing.api.bookmarkshistory.BookmarksController; |
68 |
import org.gvsig.tools.swing.api.bookmarkshistory.HistoryController; |
69 |
import org.gvsig.tools.swing.impl.bookmarkshistory.DefaultBookmarksController; |
70 |
import org.gvsig.tools.swing.impl.bookmarkshistory.DefaultHistoryController; |
71 |
|
72 |
public class DefaultToolsSwingManager implements ToolsSwingManager { |
73 |
|
74 |
private Dimension maxPhysicalSizeOfBufferedImage; |
75 |
|
76 |
@Override
|
77 |
public ActionListenerSupport createActionListenerSupport() {
|
78 |
return new DefaultActionListenerSupport(); |
79 |
} |
80 |
|
81 |
@Override
|
82 |
public JListWithCheckbox createJListWithCheckbox(JList wrappedList) { |
83 |
return new DefaultJListWithCheckbox(wrappedList); |
84 |
} |
85 |
|
86 |
@Override
|
87 |
public void setTreeModel(JComboBox comboBox, TreeModel aTreeModel) { |
88 |
TreeComboUtils.setTreeModel(comboBox, aTreeModel); |
89 |
} |
90 |
|
91 |
@Override
|
92 |
public ComboBoxModel createComboBoxModel(TreeModel treeModel) { |
93 |
return TreeComboUtils.createComboBoxModel(treeModel);
|
94 |
} |
95 |
|
96 |
@Override
|
97 |
public BufferedImage createBufferedImage(int w, int h, int type) { |
98 |
if (getMaxPhysicalSizeOfBufferedImage().getWidth() < w || getMaxPhysicalSizeOfBufferedImage().getHeight() < h) {
|
99 |
return createVirtualBufferedImage(w, h, type);
|
100 |
} |
101 |
return new BufferedImage(w, h, type); |
102 |
} |
103 |
|
104 |
@Override
|
105 |
public BufferedImage createVirtualBufferedImage(int w, int h, int type) { |
106 |
return VirtualBufferedImageHelper.createVirtualBufferedImage(w, h, type);
|
107 |
} |
108 |
|
109 |
@Override
|
110 |
public BufferedImage copyBufferedImage(BufferedImage img) { |
111 |
WritableRaster sourceRaster = img.getRaster();
|
112 |
|
113 |
BufferedImage newImage;
|
114 |
if (sourceRaster.getDataBuffer() instanceof VirtualDataBuffer) { |
115 |
newImage = VirtualBufferedImageHelper.createVirtualBufferedImage( |
116 |
img.getWidth(), |
117 |
img.getHeight(), |
118 |
img.getSampleModel(), |
119 |
img.getColorModel() |
120 |
); |
121 |
} else {
|
122 |
newImage = createBufferedImage(img.getWidth(), img.getHeight(), img.getType()); |
123 |
} |
124 |
|
125 |
WritableRaster raster = newImage.getRaster();
|
126 |
img.copyData(raster); |
127 |
return newImage;
|
128 |
} |
129 |
|
130 |
@Override
|
131 |
public void setMaxPhysicalSizeOfBufferedImage(Dimension dimension) { |
132 |
this.maxPhysicalSizeOfBufferedImage = dimension;
|
133 |
} |
134 |
|
135 |
@Override
|
136 |
public Dimension getMaxPhysicalSizeOfBufferedImage() { |
137 |
if (this.maxPhysicalSizeOfBufferedImage == null) { |
138 |
this.maxPhysicalSizeOfBufferedImage = new Dimension(2000, 2000); |
139 |
} |
140 |
return this.maxPhysicalSizeOfBufferedImage; |
141 |
} |
142 |
|
143 |
@Override
|
144 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull) { |
145 |
return new DefaultColorChooserController(txtLabel, btnShowDialog, sldAlpha, allowNull); |
146 |
} |
147 |
|
148 |
@Override
|
149 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog) { |
150 |
return new DefaultColorChooserController(txtLabel, btnShowDialog); |
151 |
} |
152 |
|
153 |
@Override
|
154 |
public ColorChooserController createColorChooserController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha) { |
155 |
return new DefaultColorChooserController(txtLabel, btnShowDialog, sldAlpha); |
156 |
} |
157 |
|
158 |
@Override
|
159 |
public Color alphaBlendingWithOpaqueBackground(Color bgColor, Color fgColor) { |
160 |
// https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
|
161 |
Color src = fgColor;
|
162 |
Color dst = bgColor;
|
163 |
|
164 |
// double outa = 1;
|
165 |
double srca = src.getAlpha() / 255.0; |
166 |
double srca_1 = (1 - srca); |
167 |
|
168 |
Color color = new Color( |
169 |
(int) (src.getRed() * srca + dst.getRed() * srca_1) & 0xff, |
170 |
(int) (src.getGreen() * srca + dst.getGreen() * srca_1) & 0xff, |
171 |
(int) (src.getBlue() * srca + dst.getBlue() * srca_1) & 0xff |
172 |
); |
173 |
return color;
|
174 |
} |
175 |
|
176 |
@Override
|
177 |
public Color opaqueColor(Color src) { |
178 |
// https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
|
179 |
double srca = src.getAlpha() / 255.0; |
180 |
double srca_1 = (1 - srca); |
181 |
|
182 |
Color color = new Color( |
183 |
(int) (src.getRed() * srca + 255 * srca_1) & 0xff, |
184 |
(int) (src.getGreen() * srca + 255 * srca_1) & 0xff, |
185 |
(int) (src.getBlue() * srca + 255 * srca_1) & 0xff |
186 |
); |
187 |
return color;
|
188 |
} |
189 |
|
190 |
private Object call(Object obj, String name, Object... params) { |
191 |
Class[] types = null; |
192 |
if (params != null) { |
193 |
types = new Class[params.length]; |
194 |
for (int i = 0; i < params.length; i++) { |
195 |
types[i] = params[i].getClass(); |
196 |
} |
197 |
} |
198 |
Method method;
|
199 |
try {
|
200 |
method = obj.getClass().getMethod(name, types); |
201 |
Object r = method.invoke(obj, params);
|
202 |
return r;
|
203 |
} catch (NoSuchMethodException |
204 |
| SecurityException
|
205 |
| IllegalAccessException
|
206 |
| IllegalArgumentException
|
207 |
| InvocationTargetException ex) {
|
208 |
} |
209 |
return null; |
210 |
} |
211 |
|
212 |
@Override
|
213 |
public void translate(JComponent component) { |
214 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
215 |
String s = (String) call(component, "getText", (Object[]) null); |
216 |
if (!StringUtils.isEmpty(s)) {
|
217 |
call(component, "setText", i18n.getTranslation(s));
|
218 |
} |
219 |
s = (String) call(component, "getToolTipText", (Object[]) null); |
220 |
if (!StringUtils.isEmpty(s)) {
|
221 |
call(component, "setToolTipText", i18n.getTranslation(s));
|
222 |
} |
223 |
} |
224 |
|
225 |
@Override
|
226 |
public void translate(AbstractButton component) { |
227 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
228 |
String s = component.getText();
|
229 |
if (!StringUtils.isEmpty(s)) {
|
230 |
component.setText(i18n.getTranslation(s)); |
231 |
} |
232 |
s = component.getToolTipText(); |
233 |
if (!StringUtils.isEmpty(s)) {
|
234 |
component.setToolTipText(i18n.getTranslation(s)); |
235 |
} |
236 |
} |
237 |
|
238 |
@Override
|
239 |
public void translate(JLabel component) { |
240 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
241 |
String s = component.getText();
|
242 |
if (!StringUtils.isEmpty(s)) {
|
243 |
component.setText(i18n.getTranslation(s)); |
244 |
} |
245 |
s = component.getToolTipText(); |
246 |
if (!StringUtils.isEmpty(s)) {
|
247 |
component.setToolTipText(i18n.getTranslation(s)); |
248 |
} |
249 |
} |
250 |
|
251 |
@Override
|
252 |
public void translate(JTabbedPane component) { |
253 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
254 |
|
255 |
for (int i = 0; i < component.getTabCount(); i++) { |
256 |
String text = component.getTitleAt(i);
|
257 |
if (!StringUtils.isEmpty(text)) {
|
258 |
component.setTitleAt(i, i18n.getTranslation(text)); |
259 |
} |
260 |
text = component.getToolTipTextAt(i); |
261 |
if (!StringUtils.isEmpty(text)) {
|
262 |
component.setToolTipTextAt(i, i18n.getTranslation(text)); |
263 |
} |
264 |
} |
265 |
} |
266 |
|
267 |
@Override
|
268 |
public void setDefaultPopupMenu(final JTextComponent component) { |
269 |
this.setDefaultPopupMenu(component, null); |
270 |
} |
271 |
|
272 |
@Override
|
273 |
public void setDefaultPopupMenu(final JTextComponent component, String title) { |
274 |
JPopupMenu popupMenu = new JPopupMenu(); |
275 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
276 |
|
277 |
Action copyAction = component.getActionMap().get(DefaultEditorKit.copyAction); |
278 |
Action cutAction = component.getActionMap().get(DefaultEditorKit.cutAction); |
279 |
Action pasteAction = component.getActionMap().get(DefaultEditorKit.pasteAction); |
280 |
Action selectAllAction = component.getActionMap().get(DefaultEditorKit.selectAllAction); |
281 |
|
282 |
if (copyAction == null |
283 |
&& cutAction == null
|
284 |
&& pasteAction == null
|
285 |
&& selectAllAction == null) {
|
286 |
copyAction = component.getActionMap().get(i18nManager.getTranslation("copy"));
|
287 |
cutAction = component.getActionMap().get(i18nManager.getTranslation("cut"));
|
288 |
pasteAction = component.getActionMap().get(i18nManager.getTranslation("paste"));
|
289 |
selectAllAction = component.getActionMap().get(i18nManager.getTranslation("SelectAll"));
|
290 |
} else {
|
291 |
copyAction.putValue(Action.NAME, i18nManager.getTranslation("copy")); |
292 |
cutAction.putValue(Action.NAME, i18nManager.getTranslation("cut")); |
293 |
pasteAction.putValue(Action.NAME, i18nManager.getTranslation("paste")); |
294 |
selectAllAction.putValue(Action.NAME, i18nManager.getTranslation("SelectAll")); |
295 |
} |
296 |
|
297 |
final String title2; |
298 |
if (title == null) { |
299 |
title2 = i18nManager.getTranslation("text_editor");
|
300 |
} else {
|
301 |
title2 = title; |
302 |
} |
303 |
Action textEditorAction = new AbstractAction(i18nManager.getTranslation("text_editor")) { |
304 |
@Override
|
305 |
public void actionPerformed(ActionEvent e) { |
306 |
DefaultZoomDialog dialog = new DefaultZoomDialog(component, title2, component.getText());
|
307 |
dialog.setEditable(component.isEditable()); |
308 |
dialog.setAlwaysOnTop(true);
|
309 |
dialog.setVisible(true);
|
310 |
if (component.isEditable() && component.isEnabled()) {
|
311 |
component.setText(dialog.getText()); |
312 |
} |
313 |
} |
314 |
}; |
315 |
final JMenuItem menuCut = new JMenuItem(cutAction); |
316 |
final JMenuItem menuPaste = new JMenuItem(pasteAction); |
317 |
|
318 |
popupMenu.add(textEditorAction); |
319 |
popupMenu.addSeparator(); |
320 |
|
321 |
popupMenu.add(menuCut); |
322 |
popupMenu.add(copyAction); |
323 |
popupMenu.add(menuPaste); |
324 |
popupMenu.add(selectAllAction); |
325 |
|
326 |
if (component.isEnabled() && component.isEditable()) {
|
327 |
menuCut.setEnabled(true);
|
328 |
menuPaste.setEnabled(true);
|
329 |
} else {
|
330 |
menuCut.setEnabled(false);
|
331 |
menuPaste.setEnabled(false);
|
332 |
} |
333 |
component.addPropertyChangeListener(new PropertyChangeListener() { |
334 |
@Override
|
335 |
public void propertyChange(PropertyChangeEvent evt) { |
336 |
if (evt == null) { |
337 |
return;
|
338 |
} |
339 |
if (evt.getPropertyName().equalsIgnoreCase("enabled")) { |
340 |
boolean enabled = component.isEnabled();
|
341 |
menuCut.setEnabled(enabled); |
342 |
menuPaste.setEnabled(enabled); |
343 |
} else if (evt.getPropertyName().equalsIgnoreCase("editable")) { |
344 |
boolean editable = component.isEditable();
|
345 |
menuCut.setEnabled(editable); |
346 |
menuPaste.setEnabled(editable); |
347 |
} |
348 |
} |
349 |
}); |
350 |
component.setComponentPopupMenu(popupMenu); |
351 |
} |
352 |
|
353 |
@Override
|
354 |
public void setDefaultPopupMenu(JComboBox component) { |
355 |
this.setDefaultPopupMenu((JTextComponent) component.getEditor().getEditorComponent(), null); |
356 |
} |
357 |
|
358 |
@Override
|
359 |
public void setDefaultPopupMenu(JComboBox component, String title) { |
360 |
this.setDefaultPopupMenu((JTextComponent) component.getEditor().getEditorComponent(), title); |
361 |
} |
362 |
|
363 |
@Override
|
364 |
public ChangeListenerHelper createChangeListenerHelper() {
|
365 |
DefaultChangeListenerHelper x = new DefaultChangeListenerHelper();
|
366 |
return x;
|
367 |
} |
368 |
|
369 |
@Override
|
370 |
public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha, boolean allowNull) { |
371 |
return new ColorPickerControllerImpl(txtLabel, btnShowDialog, sldAlpha, allowNull); |
372 |
} |
373 |
|
374 |
@Override
|
375 |
public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog) { |
376 |
return new ColorPickerControllerImpl(txtLabel, btnShowDialog); |
377 |
} |
378 |
|
379 |
@Override
|
380 |
public ColorPickerController createColorPickerController(JTextField txtLabel, JButton btnShowDialog, JSlider sldAlpha) { |
381 |
return new ColorPickerControllerImpl(txtLabel, btnShowDialog, sldAlpha); |
382 |
} |
383 |
|
384 |
@Override
|
385 |
public DatePickerController createDatePickerController(JTextField txtDate, JButton btnDate) { |
386 |
return new DatePickerControllerImpl(txtDate, btnDate); |
387 |
} |
388 |
|
389 |
@Override
|
390 |
public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon) { |
391 |
return new FilePickerControllerImpl(txtFile, btnFile, dialogTitle, fileChooserID, initialPath, seticon); |
392 |
} |
393 |
|
394 |
@Override
|
395 |
public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile) { |
396 |
return new FilePickerControllerImpl(txtFile, btnFile); |
397 |
} |
398 |
|
399 |
@Override
|
400 |
public PickerController<byte[]> createByteArrayPickerController(JTextField txtText, JButton btnUpload, JButton btnDownload, String fileChooserID, File initialPath) { |
401 |
return new BytearrayPickerControllerImpl(txtText, btnUpload, btnDownload, fileChooserID, initialPath); |
402 |
} |
403 |
|
404 |
@Override
|
405 |
public PickerController<byte[]> createByteArrayPickerController(JTextField txtText, JButton btnUpload, JButton btnDownload) { |
406 |
return new BytearrayPickerControllerImpl(txtText, btnUpload, btnDownload, null, null); |
407 |
} |
408 |
|
409 |
@Override
|
410 |
public FilePickerController createFilePickerController(JTextField txtFile, JButton btnFile, String dialogTitle) { |
411 |
return new FilePickerControllerImpl(txtFile, btnFile, dialogTitle); |
412 |
} |
413 |
|
414 |
@Override
|
415 |
public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon) { |
416 |
return new FolderPickerControllerImpl(txtFile, btnFile, dialogTitle, fileChooserID, initialPath, seticon); |
417 |
} |
418 |
|
419 |
@Override
|
420 |
public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile) { |
421 |
return new FolderPickerControllerImpl(txtFile, btnFile); |
422 |
} |
423 |
|
424 |
@Override
|
425 |
public FolderPickerController createFolderPickerController(JTextField txtFile, JButton btnFile, String dialogTitle) { |
426 |
return new FolderPickerControllerImpl(txtFile, btnFile, dialogTitle); |
427 |
} |
428 |
|
429 |
@Override
|
430 |
public void removeBorder(JComponent component) { |
431 |
try {
|
432 |
component.setBorder(null);
|
433 |
JComponent p1 = (JComponent) component.getParent(); |
434 |
if (p1 instanceof JViewport) { |
435 |
p1 = (JComponent) component.getParent();
|
436 |
} |
437 |
if (p1 instanceof JScrollPane) { |
438 |
JScrollPane scrollPanel = (JScrollPane) component.getParent(); |
439 |
scrollPanel.setBorder(null);
|
440 |
} |
441 |
} catch (Exception ex) { |
442 |
|
443 |
} |
444 |
} |
445 |
|
446 |
protected ImageIcon getIcon(String name) { |
447 |
IconThemeManager iconThemeManager = ToolsSwingLocator.getIconThemeManager(); |
448 |
IconTheme theme = iconThemeManager.getCurrent(); |
449 |
ImageIcon icon = theme.get(name);
|
450 |
return icon;
|
451 |
} |
452 |
|
453 |
@Override
|
454 |
public void addClearButton(JTextComponent text) { |
455 |
this.addClearButton(text, null); |
456 |
} |
457 |
|
458 |
@Override
|
459 |
public void addClearButton(JComboBox combo) { |
460 |
try {
|
461 |
JTextComponent text = (JTextComponent) combo.getEditor().getEditorComponent(); |
462 |
this.addClearButton(text, null); |
463 |
} catch (Throwable th) { |
464 |
// Si no puede a?adir el boton no hace nada.
|
465 |
} |
466 |
} |
467 |
|
468 |
@Override
|
469 |
public void addClearButton(final JTextComponent text, final ActionListener action) { |
470 |
final JButton btnClear = new JButton(getIcon("picker-cleartext")); |
471 |
btnClear.setBorderPainted(false);
|
472 |
btnClear.setFocusPainted(false);
|
473 |
btnClear.setContentAreaFilled(false);
|
474 |
btnClear.setOpaque(false);
|
475 |
btnClear.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
476 |
if (action == null) { |
477 |
btnClear.addActionListener(new ActionListener() { |
478 |
@Override
|
479 |
public void actionPerformed(ActionEvent e) { |
480 |
text.setText("");
|
481 |
} |
482 |
}); |
483 |
} else {
|
484 |
btnClear.addActionListener(action); |
485 |
} |
486 |
text.setLayout(new BorderLayout()); |
487 |
text.add(btnClear, BorderLayout.EAST);
|
488 |
text.addPropertyChangeListener(new PropertyChangeListener() { |
489 |
@Override
|
490 |
public void propertyChange(PropertyChangeEvent evt) { |
491 |
if (evt == null) { |
492 |
return;
|
493 |
} |
494 |
if (evt.getPropertyName().equalsIgnoreCase("enabled")) { |
495 |
boolean enabled = text.isEnabled();
|
496 |
btnClear.setEnabled(enabled); |
497 |
} else if (evt.getPropertyName().equalsIgnoreCase("editable")) { |
498 |
boolean editable = text.isEditable();
|
499 |
btnClear.setEnabled(editable); |
500 |
} |
501 |
} |
502 |
}); |
503 |
} |
504 |
|
505 |
@Override
|
506 |
public SimpleImage createSimpleImage() {
|
507 |
SimpleImage x = new DefaultSimpleImage();
|
508 |
return x;
|
509 |
} |
510 |
|
511 |
@Override
|
512 |
public SimpleImage createSimpleImage(Object source) { |
513 |
SimpleImage x = new DefaultSimpleImage(source);
|
514 |
return x;
|
515 |
} |
516 |
|
517 |
@Override
|
518 |
public DropDown createDropDown(JComboBox combo) { |
519 |
DropDown c = new DropDownComboBox(combo);
|
520 |
return c;
|
521 |
} |
522 |
|
523 |
@Override
|
524 |
public DropDown createDropDown(JLabel label) { |
525 |
DropDown c = new DropDownLabel(label);
|
526 |
return c;
|
527 |
} |
528 |
|
529 |
@Override
|
530 |
public DropDown createDropDown(AbstractButton button) { |
531 |
DropDown c = new DropDownButton(button);
|
532 |
return c;
|
533 |
} |
534 |
|
535 |
@Override
|
536 |
public DropDown createDropDown(JComponent component) { |
537 |
DropDown c = new DropDownLabel(component);
|
538 |
return c;
|
539 |
} |
540 |
|
541 |
@Override
|
542 |
public CompoundIcon createCompoundIcon(Icon... icons) { |
543 |
DefaultCompoundIcon i = new DefaultCompoundIcon(icons);
|
544 |
return i;
|
545 |
} |
546 |
|
547 |
@Override
|
548 |
public CompoundIcon createCompoundIcon(int orientation, Icon... icons) { |
549 |
DefaultCompoundIcon i = new DefaultCompoundIcon(orientation, icons);
|
550 |
return i;
|
551 |
} |
552 |
|
553 |
@Override
|
554 |
public CompoundIcon createCompoundIcon(int orientation, int gap, Icon... icons) { |
555 |
DefaultCompoundIcon i = new DefaultCompoundIcon(orientation, gap, icons);
|
556 |
return i;
|
557 |
} |
558 |
|
559 |
@Override
|
560 |
public CompoundIcon createCompoundIcon(int orientation, int gap, int alignmentX, int alignmentY, Icon... icons) { |
561 |
DefaultCompoundIcon i = new DefaultCompoundIcon(orientation, gap, alignmentX, alignmentY, icons);
|
562 |
return i;
|
563 |
} |
564 |
|
565 |
@Override
|
566 |
public BookmarksController createBookmarksController(Bookmarks bookmarks, JButton button) { |
567 |
BookmarksController controller; |
568 |
controller = new DefaultBookmarksController(bookmarks, button);
|
569 |
return controller;
|
570 |
} |
571 |
|
572 |
@Override
|
573 |
public HistoryController createHistoryController(History history, JButton button) { |
574 |
DefaultHistoryController controller; |
575 |
controller = new DefaultHistoryController(history, button);
|
576 |
return controller;
|
577 |
} |
578 |
|
579 |
@Override
|
580 |
public FilteredTableModel createFilteredTableModel(TableModel tableModel, int filterColumn) { |
581 |
FilteredTableModelImpl model = new FilteredTableModelImpl(tableModel, filterColumn);
|
582 |
return model;
|
583 |
} |
584 |
|
585 |
} |