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.directory;
19:
20: import java.awt.dnd.DnDConstants;
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.gui.explorer.ExplorerEditor;
27: import de.finix.contelligent.client.i18n.Resources;
28:
29: public class LibraryGUI extends AbstractGUI {
30:
31: private ExplorerEditor explorerEditor = null;
32:
33: private void assureNavigationPanelCreated(boolean editable) {
34: if (explorerEditor == null) {
35: ComponentFilter filter = new ComponentFilter(true);
36: explorerEditor = new ExplorerEditor();
37: explorerEditor.setComponent(getComponent());
38: explorerEditor.setBrowseMode(ExplorerEditor.BROWSABLE_VIEW);
39: explorerEditor.setGUI(this );
40: explorerEditor.setView(getView());
41: explorerEditor.setEditable(editable);
42: explorerEditor.setFilter(filter);
43: explorerEditor
44: .setDragAndDropActions(DnDConstants.ACTION_LINK
45: | DnDConstants.ACTION_COPY);
46: explorerEditor.setDropEnabled(false);
47: explorerEditor.init();
48: } else if (explorerEditor.isEditable() != editable) {
49: // only change this, if neccessary as it may take quite some time...
50: explorerEditor.setEditable(editable);
51: }
52: }
53:
54: public boolean isSupported(int type) {
55: return (type == DEFAULT);
56: }
57:
58: public boolean hidesSubcomponents() {
59: return false;
60: }
61:
62: public ComponentEditor getEditor(int type)
63: throws UnsupportedGUIException {
64: throw new UnsupportedGUIException(getComponent());
65: }
66:
67: public ComponentRenderer getRenderer(int type)
68: throws UnsupportedGUIException {
69: if (!isSupported(type)) {
70: throw new UnsupportedGUIException(getComponent());
71: }
72: assureNavigationPanelCreated(false);
73: return explorerEditor;
74: }
75:
76: public String getName() {
77: return Resources.getLocalString("library_gui");
78: }
79: }
|