01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.client.gui.link;
19:
20: import javax.swing.ImageIcon;
21:
22: import de.finix.contelligent.client.gui.AbstractGUI;
23: import de.finix.contelligent.client.gui.ComponentEditor;
24: import de.finix.contelligent.client.gui.ComponentRenderer;
25: import de.finix.contelligent.client.gui.UnsupportedGUIException;
26: import de.finix.contelligent.client.i18n.Resources;
27:
28: public class ResolverGUI extends AbstractGUI {
29:
30: private ResolverEditor resolverEditor = null;
31:
32: private void assureEditorCreated(boolean editable, int type) {
33: if (resolverEditor == null) {
34: resolverEditor = new ResolverEditor();
35: resolverEditor.setComponent(getComponent());
36: resolverEditor.setGUI(this );
37: resolverEditor.setView(getView());
38: resolverEditor.setEditable(editable);
39: resolverEditor.setType(type);
40: resolverEditor.init();
41: } else {
42: // only change this, if neccessary as it may take quite some time...
43: if (resolverEditor.isEditable() != editable) {
44: resolverEditor.setEditable(editable);
45: }
46: // only change this, if neccessary as it may take quite some time...
47: if (resolverEditor.getType() != type) {
48: resolverEditor.setType(type);
49: }
50: }
51: }
52:
53: public boolean isSupported(int type) {
54: return (type == DEFAULT || type == TABLE);
55: }
56:
57: public ComponentEditor getEditor(int type)
58: throws UnsupportedGUIException {
59: if (!isSupported(type)) {
60: throw new UnsupportedGUIException(getComponent());
61: }
62: assureEditorCreated(true, type);
63: return resolverEditor;
64: }
65:
66: public ComponentRenderer getRenderer(int type)
67: throws UnsupportedGUIException {
68: if (!isSupported(type)) {
69: throw new UnsupportedGUIException(getComponent());
70: }
71: assureEditorCreated(false, type);
72: return resolverEditor;
73: }
74:
75: public String getName() {
76: return Resources.getLocalString("resolver_gui");
77: }
78:
79: public ImageIcon getIcon() {
80: return Resources.linkGUI;
81: }
82: }
|