001: package fr.aliacom.form.swt;
002:
003: import java.util.HashMap;
004:
005: import org.apache.log4j.Logger;
006:
007: import fr.aliacom.form.swt.maker.BoxBuilder;
008: import fr.aliacom.form.swt.maker.ButtonBuilder;
009: import fr.aliacom.form.swt.maker.ButtonGroupBuilder;
010: import fr.aliacom.form.swt.maker.CardBuilder;
011: import fr.aliacom.form.swt.maker.CardPanelBuilder;
012: import fr.aliacom.form.swt.maker.CheckBoxRendererBuilder;
013: import fr.aliacom.form.swt.maker.CheckboxBuilder;
014: import fr.aliacom.form.swt.maker.CheckboxEditorBuilder;
015: import fr.aliacom.form.swt.maker.ColumnViewBuilder;
016: import fr.aliacom.form.swt.maker.ComboBoxBuilder;
017: import fr.aliacom.form.swt.maker.FormBuilder;
018: import fr.aliacom.form.swt.maker.GridBuilder;
019: import fr.aliacom.form.swt.maker.GridSeparatorBuilder;
020: import fr.aliacom.form.swt.maker.GroupBuilder;
021: import fr.aliacom.form.swt.maker.IncludeBuilder;
022: import fr.aliacom.form.swt.maker.LabelBuilder;
023: import fr.aliacom.form.swt.maker.LabelRendererBuilder;
024: import fr.aliacom.form.swt.maker.MenuBuilder;
025: import fr.aliacom.form.swt.maker.MenuItemBuilder;
026: import fr.aliacom.form.swt.maker.MenuSeparatorBuilder;
027: import fr.aliacom.form.swt.maker.MenubarBuilder;
028: import fr.aliacom.form.swt.maker.NotImplementedBuilder;
029: import fr.aliacom.form.swt.maker.OutlookBarBuilder;
030: import fr.aliacom.form.swt.maker.PanelBuilder;
031: import fr.aliacom.form.swt.maker.PasswordBuilder;
032: import fr.aliacom.form.swt.maker.ProgressHandlerBuilder;
033: import fr.aliacom.form.swt.maker.PropertyColumnBuilder;
034: import fr.aliacom.form.swt.maker.RadioButtonBuilder;
035: import fr.aliacom.form.swt.maker.SplitterBuilder;
036: import fr.aliacom.form.swt.maker.StyleBuilder;
037: import fr.aliacom.form.swt.maker.TabBuilder;
038: import fr.aliacom.form.swt.maker.TabbedPaneBuilder;
039: import fr.aliacom.form.swt.maker.TableBuilder;
040: import fr.aliacom.form.swt.maker.TextAreaBuilder;
041: import fr.aliacom.form.swt.maker.TextBuilder;
042: import fr.aliacom.form.swt.maker.TextEditorBuilder;
043: import fr.aliacom.form.swt.maker.ToolItemBuilder;
044: import fr.aliacom.form.swt.maker.ToolSeparatorBuilder;
045: import fr.aliacom.form.swt.maker.ToolbarBuilder;
046: import fr.aliacom.form.swt.maker.TreeBuilder;
047: import fr.aliacom.form.swt.maker.TreeNodeBuilder;
048: import fr.aliacom.form.swt.maker.TreeRootBuilder;
049: import fr.aliacom.form.swt.maker.WizardBuilder;
050:
051: /**
052: * @author tom
053: *
054: * (C) 2001, 2002 Thomas Cataldo
055: */
056: public final class BuilderFactory extends HashMap {
057:
058: private Logger log;
059: private NotImplementedBuilder nib;
060:
061: public BuilderFactory() {
062: log = Logger.getLogger(BuilderFactory.class);
063: nib = new NotImplementedBuilder();
064: initialize();
065: }
066:
067: private void initialize() {
068: put("form", new FormBuilder());
069:
070: /* MENU AND TOOLBAR HANDLING */
071: put("menuBar", new MenubarBuilder());
072: put("menu", new MenuBuilder());
073: put("menuItem", new MenuItemBuilder());
074: put("menuSeparator", new MenuSeparatorBuilder());
075: put("toolBar", new ToolbarBuilder());
076: put("toolItem", new ToolItemBuilder());
077: put("toolSeparator", new ToolSeparatorBuilder());
078:
079: /* CONTAINERS AND LAYOUTS */
080: put("panel", new PanelBuilder());
081: put("box", new BoxBuilder());
082: put("gridPanel", new GridBuilder());
083: put("gridSeparator", new GridSeparatorBuilder());
084: put("group", new GroupBuilder());
085: put("tabbedPane", new TabbedPaneBuilder());
086: put("tab", new TabBuilder());
087: put("include", new IncludeBuilder());
088: put("splitter", new SplitterBuilder());
089: put("cardPanel", new CardPanelBuilder());
090: put("card", new CardBuilder());
091: put("buttonGroup", new ButtonGroupBuilder());
092:
093: /* WIDGETS */
094: put("button", new ButtonBuilder());
095: put("label", new LabelBuilder());
096: put("text", new TextBuilder());
097: put("password", new PasswordBuilder());
098: put("checkBox", new CheckboxBuilder());
099: put("textArea", new TextAreaBuilder());
100: put("style", new StyleBuilder());
101: put("comboBox", new ComboBoxBuilder());
102: put("radioButton", new RadioButtonBuilder());
103: put("progressHandler", new ProgressHandlerBuilder());
104: put("wizard", new WizardBuilder());
105:
106: /* TABLE SUPPORT */
107: put("table", new TableBuilder());
108: put("propertyColumn", new PropertyColumnBuilder());
109: put("columnView", new ColumnViewBuilder());
110: put("checkBoxEditor", new CheckboxEditorBuilder());
111: put("checkBoxRenderer", new CheckBoxRendererBuilder());
112: put("textEditor", new TextEditorBuilder());
113: put("labelRenderer", new LabelRendererBuilder());
114:
115: /* TREE SUPPORT */
116: put("tree", new TreeBuilder());
117: put("outlookBar", new OutlookBarBuilder());
118: put("treeRoot", new TreeRootBuilder());
119: put("treeNode", new TreeNodeBuilder());
120:
121: }
122:
123: public SWTBuilder getBuilder(String builderName) {
124: SWTBuilder builder = (SWTBuilder) get(builderName);
125: if (builder == null) {
126: log.error("Not builder for the '" + builderName
127: + "' element.");
128: return nib;
129: }
130: return builder;
131: }
132:
133: }
|