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.widget;
19:
20: import java.util.List;
21: import java.util.Vector;
22:
23: import de.finix.contelligent.client.base.ComponentFactory;
24: import de.finix.contelligent.client.base.ComponentNotFoundException;
25: import de.finix.contelligent.client.gui.AbstractGUIWithCommonRendererAndEditor;
26: import de.finix.contelligent.client.gui.ComponentEditor;
27: import de.finix.contelligent.client.gui.composed.MixedTableEditor;
28: import de.finix.contelligent.client.gui.composed.MixedTableModel;
29: import de.finix.contelligent.client.i18n.Resources;
30: import de.finix.contelligent.client.util.TextUtil;
31:
32: public class HTMLListboxGUI extends
33: AbstractGUIWithCommonRendererAndEditor {
34:
35: private final static String MULTIPLE = "multiple";
36:
37: private final static String SIZE = "size";
38:
39: private final static String OPTIONS = "options";
40:
41: private final static String VALUES = "values";
42:
43: private final static String PARAM_ASSOC = "paramAssoc";
44:
45: protected ComponentEditor createEditor(boolean editable) {
46: List rows = new Vector();
47: // optional :
48: try {
49: rows.add(ComponentFactory.getInstance().getComponent(
50: getComponent().getPath() + "/" + VALUES));
51: } catch (ComponentNotFoundException e) {
52: // ignore exception in case of optional components
53: }
54: try {
55: rows.add(ComponentFactory.getInstance().getComponent(
56: getComponent().getPath() + "/" + OPTIONS));
57: } catch (ComponentNotFoundException e) {
58: }
59: try {
60: rows.add(ComponentFactory.getInstance().getComponent(
61: getComponent().getPath() + "/" + PARAM_ASSOC));
62: } catch (ComponentNotFoundException e) {
63: }
64:
65: // required :
66: rows.add(getComponent().getProperty(MULTIPLE));
67: rows.add(getComponent().getProperty(SIZE));
68:
69: MixedTableEditor editor = new MixedTableEditor();
70: editor.setComponent(getComponent());
71: editor.setGUI(this );
72: editor.setView(getView());
73: editor.setRows(rows);
74: editor.setEditable(editable);
75: editor.setMode(MixedTableModel.TABLE);
76: editor.init();
77: return editor;
78: }
79:
80: public boolean isSupported(int type) {
81: return (type == DEFAULT);
82: }
83:
84: public boolean hidesSubcomponents() {
85: return true;
86: }
87:
88: public String getName() {
89: if (getComponent().getName().length() > 0) {
90: return TextUtil.toUpper(getComponent().getName());
91: } else {
92: return "[" + Resources.getLocalString("no_name") + "]";
93: }
94: }
95:
96: }
|