01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.impl;
14:
15: import java.awt.Component;
16:
17: import com.eviware.soapui.model.ModelItem;
18: import com.eviware.soapui.model.PanelBuilder;
19: import com.eviware.soapui.support.components.JPropertiesTable;
20: import com.eviware.soapui.ui.desktop.DesktopPanel;
21:
22: /**
23: * Empty PanelBuilder implementation for extension.
24: *
25: * @author Ole.Matzura
26: */
27:
28: public class EmptyPanelBuilder<T extends ModelItem> implements
29: PanelBuilder<T> {
30: private static final EmptyPanelBuilder instance = new EmptyPanelBuilder();
31:
32: public static EmptyPanelBuilder get() {
33: return instance;
34: }
35:
36: public Component buildOverviewPanel(T modelItem) {
37: String caption = "Properties";
38: if (modelItem.getClass().getSimpleName().startsWith("Wsdl")) {
39: caption = modelItem.getClass().getSimpleName().substring(4);
40:
41: if (caption.endsWith("TestStep"))
42: caption = caption.substring(0, caption.length() - 8);
43:
44: caption += " Properties";
45: }
46:
47: return buildDefaultProperties(modelItem, caption);
48: }
49:
50: protected JPropertiesTable<T> buildDefaultProperties(T modelItem,
51: String caption) {
52: JPropertiesTable<T> table = new JPropertiesTable<T>(caption,
53: modelItem);
54:
55: table.addProperty("Name", "name", true);
56: table.addProperty("Description", "description", true);
57:
58: table.setPropertyObject(modelItem);
59:
60: return table;
61: }
62:
63: public boolean hasOverviewPanel() {
64: return true;
65: }
66:
67: public boolean hasDesktopPanel() {
68: return false;
69: }
70:
71: public DesktopPanel buildDesktopPanel(T modelItem) {
72: return null;
73: }
74: }
|