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 javax.swing.ImageIcon;
23:
24: import de.finix.contelligent.client.gui.AbstractGUIWithCommonRendererAndEditor;
25: import de.finix.contelligent.client.gui.ComponentEditor;
26: import de.finix.contelligent.client.gui.explorer.ExplorerEditor;
27: import de.finix.contelligent.client.i18n.Resources;
28:
29: /**
30: * Available to the end user as "RestrictedTree". (We cant rename the classes
31: * themselves since old configuration data might refer to them)
32: *
33: * Options are: Restricted mode (only the most basic actions available, hides subcomponents)
34: */
35:
36: public class DirectoryGUI extends
37: AbstractGUIWithCommonRendererAndEditor {
38:
39: protected ComponentEditor createEditor(boolean editable) {
40: ComponentFilter filter = new ComponentFilter(true);
41: DirectoryEditor editor = new DirectoryEditor();
42: editor.setComponent(getComponent());
43: editor.setView(getView());
44: ExplorerEditor explorerEditor = new ExplorerEditor();
45: explorerEditor.setComponent(getComponent());
46: explorerEditor.setView(getView());
47: explorerEditor.setEditable(true);
48: explorerEditor.setPreviewEditListener(true);
49: explorerEditor.setGuiContainer(editor);
50: explorerEditor.setPathSelectionManager(editor);
51: explorerEditor.setBrowseMode(ExplorerEditor.TREE_VIEW);
52: explorerEditor.setMode(ExplorerEditor.RESTRICTED_MODE);
53: explorerEditor.setFilter(filter);
54: explorerEditor.setDragAndDropActions(DnDConstants.ACTION_COPY
55: | DnDConstants.ACTION_LINK | DnDConstants.ACTION_MOVE);
56: explorerEditor.setIsRootVisible(true);
57: explorerEditor.init();
58: editor.setSelectionPanel(explorerEditor);
59: editor.init();
60: explorerEditor.initialSelect();
61: return editor;
62: }
63:
64: public boolean isSupported(int type) {
65: return (type == DEFAULT);
66: }
67:
68: public boolean hidesSubcomponents() {
69: return false;
70: }
71:
72: public String getName() {
73: return Resources.getLocalString("directory_gui");
74: }
75:
76: public ImageIcon getIcon() {
77: return Resources.treeGUI;
78: }
79: }
|