Revision 501 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.main/src/main/java/org/gvsig/tools/main/dynobject/DynObjectComponentAction.java

View differences:

DynObjectComponentAction.java
45 45
import org.gvsig.tools.swing.api.ToolsSwingLocator;
46 46
import org.gvsig.tools.swing.api.dynobject.DynObjectSwingManager;
47 47
import org.gvsig.tools.swing.api.dynobject.JDynObjectComponent;
48
import org.gvsig.tools.swing.api.dynobject.dynfield.JDynComponent;
48 49

  
49 50
/**
50 51
 * Action used to show the DynObject components panel
......
63 64

  
64 65
    private JDynObjectComponent dynObjectView;
65 66

  
67
    private String dynObjectID;
68

  
66 69
    /**
67 70
     * @see MainAction#MainAction(JTabbedPane)
68 71
     */
69
    public DynObjectComponentAction(JTabbedPane tabbedPane) {
70
        super("DynObject", tabbedPane);
72
    public DynObjectComponentAction(JTabbedPane tabbedPane, String dynObjectID) {
73
        super(dynObjectID + "Action", tabbedPane);
74
        this.dynObjectID= dynObjectID;
71 75
        putValue(SHORT_DESCRIPTION, "DynObject viewer components");
72
        registerDynObjects();
73 76
    }
74 77

  
75 78
    @Override
76 79
    protected JComponent createComponent() {
77 80
        JPanel mainPane = new JPanel(new BorderLayout());
78
        dynObjectView = getDynObjectView();
81
        dynObjectView = getDynObjectView(dynObjectID);
79 82
        if (dynObjectView == null)
80 83
            return mainPane;
81 84

  
......
102 105
    /**
103 106
     * @return
104 107
     */
105
    private JDynObjectComponent getDynObjectView() {
108
    private JDynObjectComponent getDynObjectView(String dynObjectID) {
106 109
        if (dynObjectView != null)
107 110
            return dynObjectView;
108 111
        try {
109 112
            TestDynObject testDynObject =
110
                (TestDynObject) dynManager.get("Test");
113
                (TestDynObject) dynManager.get(dynObjectID);
111 114
            this.dynObjectView =
112 115
                swingManager.createJDynObjectComponent(testDynObject
113 116
                    .createDynObject(), testDynObject.createDynModel());
......
135 138
        frame.setVisible(true);
136 139
    }
137 140

  
138
    public void registerDynObjects() {
141
    private JDynObjectComponent getDynObjectView() {
142
        return this.getDynObjectView(dynObjectID);
143
    }
144

  
145
    public static void registerDynObjects() {
139 146
        TestDynObject.registerDynObject();
140 147
        Address.registerDynObject();
141 148
    }

Also available in: Unified diff