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.widget;
019:
020: import java.util.List;
021: import java.util.Vector;
022:
023: import de.finix.contelligent.client.base.ComponentFactory;
024: import de.finix.contelligent.client.base.ComponentNotFoundException;
025: import de.finix.contelligent.client.gui.AbstractGUIWithCommonRendererAndEditor;
026: import de.finix.contelligent.client.gui.ComponentEditor;
027: import de.finix.contelligent.client.gui.composed.MixedTableEditor;
028: import de.finix.contelligent.client.gui.composed.MixedTableModel;
029: import de.finix.contelligent.client.i18n.Resources;
030: import de.finix.contelligent.client.util.ExceptionDialog;
031: import de.finix.contelligent.client.util.TextUtil;
032:
033: public class HTMLSubmitButtonGUI extends
034: AbstractGUIWithCommonRendererAndEditor {
035:
036: private final static String ALIGN = "align";
037:
038: private final static String BORDER = "border";
039:
040: private final static String HEIGHT = "height";
041:
042: private final static String WIDTH = "width";
043:
044: private final static String IMAGE = "img";
045:
046: private final static String PARAM_ASSOC = "paramAssoc";
047:
048: private final static String TEXT = "text";
049:
050: protected ComponentEditor createEditor(boolean editable) {
051: List rows = new Vector();
052: try {
053: try {
054: rows.add(ComponentFactory.getInstance().getComponent(
055: getComponent().getPath() + "/" + TEXT));
056: } catch (ComponentNotFoundException e) {
057: }
058: try {
059: rows.add(ComponentFactory.getInstance().getComponent(
060: getComponent().getPath() + "/" + IMAGE));
061: } catch (ComponentNotFoundException e) {
062: }
063: rows.add(getComponent().getProperty(ALIGN));
064: rows.add(getComponent().getProperty(BORDER));
065: rows.add(getComponent().getProperty(HEIGHT));
066: rows.add(getComponent().getProperty(WIDTH));
067: rows.add(ComponentFactory.getInstance().getComponent(
068: getComponent().getPath() + "/" + PARAM_ASSOC));
069: rows.add(ComponentFactory.getInstance().getComponent(
070: getComponent().getPath() + "/" + PARAM_ASSOC));
071: } catch (ComponentNotFoundException e) {
072: ExceptionDialog.show(e);
073: }
074: MixedTableEditor editor = new MixedTableEditor();
075: editor.setComponent(getComponent());
076: editor.setGUI(this );
077: editor.setView(getView());
078: editor.setRows(rows);
079: editor.setEditable(editable);
080: editor.setMode(MixedTableModel.TABLE);
081: editor.init();
082: return editor;
083: }
084:
085: public boolean isSupported(int type) {
086: return (type == DEFAULT);
087: }
088:
089: public boolean hidesSubcomponents() {
090: return true;
091: }
092:
093: public String getName() {
094: if (getComponent().getName().length() > 0) {
095: return TextUtil.toUpper(getComponent().getName());
096: } else {
097: return ("[" + Resources.getLocalString("no_name") + "]");
098: }
099: }
100:
101: }
|