001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.client.gui;
019:
020: import java.util.List;
021: import java.util.Map;
022:
023: import javax.swing.ImageIcon;
024:
025: import de.finix.contelligent.client.base.ContelligentComponent;
026: import de.finix.contelligent.client.base.category.ContelligentCategory;
027: import de.finix.contelligent.client.base.resource.ContelligentResource;
028:
029: /**
030: * Implement this interface if you want to provide a GUI for a special component
031: * type. Use this GUI to get associated editor, renderer and view
032: */
033: public interface GUI {
034:
035: final static int CONTENT = 0;
036:
037: final static int TEMPLATE = 1;
038:
039: /**
040: * The <code>DEFAULT</code> GUI should provide a GUI that fits into a
041: * large editor pane.
042: *
043: */
044: final static int DEFAULT = 0;
045:
046: /**
047: * The <code>TABLE</code> GUI should provide a GUI that can live inside a
048: * table.
049: *
050: */
051: final static int TABLE = 1;
052:
053: /**
054: * init can be used to do initializations as it is called when a new GUI is
055: * constructed
056: */
057: public void init();
058:
059: /**
060: * This method can be called to determine if this gui hides the
061: * subcomponents of the component that will be the edit root. A gui for
062: * large containers for example hides the subcomponents by providing a
063: * search form.
064: *
065: * @return a <code>boolean</code> value that indicates wether
066: * subcomponents should be hidden.
067: */
068: public boolean hidesSubcomponents();
069:
070: /**
071: * Return an editor for this type of editing if supported, otherwise throw
072: * an exception.
073: *
074: * @param type
075: * specifies what kind of context the editor is for:
076: * {@link #DEFAULT} or {@link #TABLE}
077: */
078: public ComponentEditor getEditor(int type)
079: throws UnsupportedGUIException;
080:
081: /**
082: * Return a renderer for this type of rendering if supported, otherwise
083: * throw an exception.
084: *
085: * @param type
086: * specifies what kind of context the renderer is for:
087: * {@link #DEFAULT} or {@link #TABLE}
088: */
089: public ComponentRenderer getRenderer(int type)
090: throws UnsupportedGUIException;
091:
092: /**
093: * Check whether this type of renderering and editing is supported
094: *
095: * @param type
096: * specifies what kind of context the renderer is for:
097: * {@link #DEFAULT} or {@link #TABLE}
098: */
099: public boolean isSupported(int type);
100:
101: public void setView(View view);
102:
103: public View getView();
104:
105: public void setConfiguration(String configuration);
106:
107: public String getConfiguration();
108:
109: public GUIConfigurationEditor getGUIConfigurationEditor();
110:
111: public void setComponent(ContelligentComponent component);
112:
113: public ContelligentComponent getComponent();
114:
115: /**
116: * Returns the name of this gui.
117: */
118: public String getName();
119:
120: /**
121: * Returns the icon of this gui.
122: */
123: public ImageIcon getIcon();
124:
125: // FIXME: All category sensitive stuff should be removed or moved to a
126: // category sensitive gui / rule-gui ?!?
127: public boolean isCategorySensitive();
128:
129: public void setResourceCategoryMap(Map categoryMap);
130:
131: public Map getResourceCategoryMap();
132:
133: public void setResourceMode(int resourceMode); // TEMPLATE or CONTENT
134:
135: public int getResourceMode();
136:
137: public boolean isResourceDefined();
138:
139: public boolean isResourceInherited();
140:
141: public void setResource(ContelligentResource resource);
142:
143: public ContelligentResource getResource();
144:
145: public Map getResourceMap();
146:
147: public String getResourceIdentifier();
148:
149: public List getDefaultedCategoryNames();
150:
151: public String getFallbackResourceIdentifier();
152:
153: public boolean isResourceSupported();
154:
155: public String getUnsupportedCategory();
156:
157: public String getUnsupportedCategoryValue();
158:
159: public List<ContelligentCategory> getSensitiveCategories();
160:
161: public void setCategories(List<ContelligentCategory> categories);
162: }
|