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.link;
019:
020: import java.util.List;
021: import java.util.Vector;
022:
023: import javax.swing.ImageIcon;
024:
025: import de.finix.contelligent.client.gui.AbstractGUI;
026: import de.finix.contelligent.client.gui.ComponentEditor;
027: import de.finix.contelligent.client.gui.ComponentRenderer;
028: import de.finix.contelligent.client.gui.UnsupportedGUIException;
029: import de.finix.contelligent.client.i18n.Resources;
030:
031: public class LinkGUI extends AbstractGUI {
032:
033: private LinkEditor linkEditor = null;
034:
035: private void assureEditorCreated(boolean editable, int type) {
036: if (linkEditor == null) {
037: linkEditor = new LinkEditor();
038: linkEditor.setComponent(getComponent());
039: linkEditor.setGUI(this );
040: linkEditor.setView(getView());
041: linkEditor.setEditable(editable);
042: linkEditor.setType(type);
043: linkEditor.init();
044: } else {
045: // only change this, if neccessary as it may take quite some time...
046: if (linkEditor.isEditable() != editable) {
047: linkEditor.setEditable(editable);
048: }
049: // only change this, if neccessary as it may take quite some time...
050: if (linkEditor.getType() != type) {
051: linkEditor.setType(type);
052: }
053: }
054: }
055:
056: public boolean isSupported(int type) {
057: return (type == DEFAULT || type == TABLE);
058: }
059:
060: public ComponentEditor getEditor(int type)
061: throws UnsupportedGUIException {
062: if (!isSupported(type)) {
063: throw new UnsupportedGUIException(getComponent());
064: }
065: assureEditorCreated(true, type);
066: return linkEditor;
067: }
068:
069: public ComponentRenderer getRenderer(int type)
070: throws UnsupportedGUIException {
071: if (!isSupported(type)) {
072: throw new UnsupportedGUIException(getComponent());
073: }
074: assureEditorCreated(false, type);
075: return linkEditor;
076: }
077:
078: public String getName() {
079: return Resources.getLocalString("link_gui");
080: }
081:
082: public ImageIcon getIcon() {
083: return Resources.linkGUI;
084: }
085:
086: public boolean isCategorySensitive() {
087: return false;
088: }
089:
090: public boolean isResourceSupported() {
091: return true;
092: }
093:
094: public List getSensitiveCategories() {
095: return new Vector();
096: }
097:
098: public void setCategories(List categories) {
099: // Links are not category sensitive on the resource level
100: }
101:
102: }
|