OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 174
Line 62... Line 62...
62
 
62
 
63
    public static final String ITEM_RIGHT_CODE = "GROUP_ITEM_SHOW";
63
    public static final String ITEM_RIGHT_CODE = "GROUP_ITEM_SHOW";
64
 
64
 
65
    private final Group group;
65
    private final Group group;
66
    private final int columns = 2;
66
    private final int columns = 2;
67
    private final Map<String, JComponent> labels = new HashMap<String, JComponent>();
67
    private final Map<String, JComponent> labels = new HashMap<>();
68
    private final Map<String, JComponent> editors = new HashMap<String, JComponent>();
68
    private final Map<String, JComponent> editors = new HashMap<>();
69
    private String startTabAfter = null;
69
    private String startTabAfter = null;
70
    private boolean tabGroup;
70
    private boolean tabGroup;
71
    private int tabDepth;
71
    private int tabDepth;
72
    private JTabbedPane pane;
72
    private JTabbedPane pane;
73
    private final List<String> tabsGroupIDs = new ArrayList<String>();
73
    private final List<String> tabsGroupIDs = new ArrayList<String>();
Line 78... Line 78...
78
        this(element, element.getDefaultGroup());
78
        this(element, element.getDefaultGroup());
79
    }
79
    }
80
 
80
 
81
    public GroupSQLComponent(final SQLElement element, final Group group) {
81
    public GroupSQLComponent(final SQLElement element, final Group group) {
82
        super(element);
82
        super(element);
-
 
83
        if (element == null) {
-
 
84
            throw new IllegalArgumentException("null SQLElement");
-
 
85
        }
-
 
86
        if (group == null) {
-
 
87
            throw new IllegalArgumentException("null group (SQLElement : " + element + ")");
-
 
88
        }
83
        this.group = group;
89
        this.group = group;
84
        this.hasAdditionnalFields = this.getElement().getAdditionalFields().size() > 0;
90
        this.hasAdditionnalFields = this.getElement().getAdditionalFields().size() > 0;
85
        this.additionnalFieldsGroup = getAdditionalFieldsGroup(group.getDescendantGroups());
91
        this.additionnalFieldsGroup = getAdditionalFieldsGroup(group.getDescendantGroups());
86
    }
92
    }
87
 
93
 
Line 97... Line 103...
97
    protected final Group getGroup() {
103
    protected final Group getGroup() {
98
        return this.group;
104
        return this.group;
99
    }
105
    }
100
 
106
 
101
    public void startTabGroupAfter(String id) {
107
    public void startTabGroupAfter(String id) {
102
        startTabAfter = id;
108
        this.startTabAfter = id;
103
    }
109
    }
104
 
110
 
105
    @Override
111
    @Override
106
    protected void addViews() {
112
    protected void addViews() {
107
        this.setLayout(new GridBagLayout());
113
        this.setLayout(new GridBagLayout());
Line 153... Line 159...
153
                    c.gridy++;
159
                    c.gridy++;
154
                    c.fill = GridBagConstraints.HORIZONTAL;
160
                    c.fill = GridBagConstraints.HORIZONTAL;
155
                    c.gridx = 0;
161
                    c.gridx = 0;
156
                    c.weightx = 1;
162
                    c.weightx = 1;
157
                    c.gridwidth = 4;
163
                    c.gridwidth = 4;
-
 
164
                    JComponent comp = getLabel(id);
158
                    panel.add(getLabel(id), c);
165
                    panel.add(comp, c);
159
                    c.gridy++;
166
                    c.gridy++;
160
                }
167
                }
161
            }
168
            }
162
            if (this.hasAdditionnalFields) {
169
            if (this.hasAdditionnalFields) {
163
                if ((currentGroup == this.group && this.additionnalFieldsGroup == null) || (currentGroup == this.additionnalFieldsGroup)) {
170
                if ((currentGroup == this.group && this.additionnalFieldsGroup == null) || (currentGroup == this.additionnalFieldsGroup)) {
Line 274... Line 281...
274
                c.gridy++;
281
                c.gridy++;
275
                x = 0;
282
                x = 0;
276
            }
283
            }
277
 
284
 
278
        }
285
        }
279
        if (id.equals(startTabAfter)) {
286
        if (id.equals(this.startTabAfter)) {
280
            if (tabGroup) {
287
            if (this.tabGroup) {
281
                throw new IllegalArgumentException("ID " + id + " already set as tab");
288
                throw new IllegalArgumentException("ID " + id + " already set as tab");
282
            }
289
            }
283
            tabGroup = true;
290
            this.tabGroup = true;
284
            tabDepth = level;
291
            this.tabDepth = level;
285
            pane = new JTabbedPane();
292
            this.pane = new JTabbedPane();
286
            c.gridx = 0;
293
            c.gridx = 0;
287
            c.gridy++;
294
            c.gridy++;
288
            c.weightx = 1;
295
            c.weightx = 1;
289
            c.weighty = 1;
296
            c.weighty = 1;
290
            c.fill = GridBagConstraints.BOTH;
297
            c.fill = GridBagConstraints.BOTH;
291
            c.gridwidth = 4;
298
            c.gridwidth = 4;
292
            panel.add(pane, c);
299
            panel.add(this.pane, c);
293
        }
300
        }
294
 
301
 
295
    }
302
    }
296
 
303
 
297
    public final void setTabEnabledAt(final String groupID, final boolean enabled) {
304
    public final void setTabEnabledAt(final String groupID, final boolean enabled) {