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 de.finix.contelligent.client.base.Type;
21: import de.finix.contelligent.client.base.TypeFactory;
22: import de.finix.contelligent.client.base.TypeNotFoundException;
23: import de.finix.contelligent.client.gui.AbstractGUI;
24: import de.finix.contelligent.client.gui.ComponentEditor;
25: import de.finix.contelligent.client.gui.ComponentRenderer;
26: import de.finix.contelligent.client.gui.UnsupportedGUIException;
27: import de.finix.contelligent.client.gui.explorer.ExplorerEditor;
28: import de.finix.contelligent.client.i18n.Resources;
29: import de.finix.contelligent.client.util.ExceptionDialog;
30:
31: public class PagesGUI extends AbstractGUI {
32:
33: private ExplorerEditor navigationPanel = null;
34:
35: private void assureNavigationPanelCreated(boolean editable) {
36: if (navigationPanel == null) {
37: ComponentFilter filter = new ComponentFilter(false);
38: try {
39: filter.addRule(TypeFactory.getInstance().getType(
40: Type.PAGE), true);
41: filter.addRule(TypeFactory.getInstance().getType(
42: Type.PAGES_FOLDER), true);
43: } catch (TypeNotFoundException e) {
44: ExceptionDialog.show(e);
45: }
46: navigationPanel = new ExplorerEditor();
47: navigationPanel.setComponent(getComponent());
48: navigationPanel.setGUI(this );
49: navigationPanel.setView(getView());
50: navigationPanel.setIsRootVisible(true);
51: navigationPanel.setEditable(editable);
52: navigationPanel.setFilter(filter);
53: navigationPanel.init();
54: } else if (navigationPanel.isEditable() != editable) {
55: // only change this, if neccessary as it may take quite some time...
56: navigationPanel.setEditable(editable);
57: }
58: }
59:
60: public boolean isSupported(int type) {
61: return (type == DEFAULT);
62: }
63:
64: public boolean hidesSubcomponents() {
65: return false;
66: }
67:
68: public ComponentEditor getEditor(int type)
69: throws UnsupportedGUIException {
70: throw new UnsupportedGUIException(getComponent());
71: }
72:
73: public ComponentRenderer getRenderer(int type)
74: throws UnsupportedGUIException {
75: if (!isSupported(type)) {
76: throw new UnsupportedGUIException(getComponent());
77: }
78: assureNavigationPanelCreated(false);
79: return navigationPanel;
80: }
81:
82: public String getName() {
83: return Resources.getLocalString("pages_gui");
84: }
85: }
|