1 |
1 |
package org.txm.annotation.urs.view;
|
2 |
2 |
|
3 |
3 |
import java.util.ArrayList;
|
|
4 |
import java.util.HashMap;
|
4 |
5 |
import java.util.LinkedHashMap;
|
5 |
6 |
|
6 |
7 |
import org.eclipse.osgi.util.NLS;
|
7 |
8 |
import org.eclipse.swt.SWT;
|
|
9 |
import org.eclipse.swt.custom.ScrolledComposite;
|
8 |
10 |
import org.eclipse.swt.events.DisposeEvent;
|
9 |
11 |
import org.eclipse.swt.events.DisposeListener;
|
10 |
12 |
import org.eclipse.swt.events.SelectionEvent;
|
... | ... | |
17 |
19 |
import org.eclipse.swt.widgets.Composite;
|
18 |
20 |
import org.eclipse.swt.widgets.Control;
|
19 |
21 |
import org.eclipse.swt.widgets.Display;
|
|
22 |
import org.eclipse.swt.widgets.Label;
|
20 |
23 |
import org.eclipse.swt.widgets.ToolBar;
|
21 |
24 |
import org.eclipse.swt.widgets.ToolItem;
|
22 |
25 |
import org.eclipse.ui.IWorkbenchPage;
|
... | ... | |
26 |
29 |
import org.txm.annotation.urs.URSCorpora;
|
27 |
30 |
import org.txm.annotation.urs.toolbar.URSAnnotationToolbar;
|
28 |
31 |
import org.txm.rcp.IImageKeys;
|
|
32 |
import org.txm.rcp.swt.GLComposite;
|
29 |
33 |
import org.txm.utils.logger.Log;
|
30 |
34 |
|
31 |
35 |
import visuAnalec.Message;
|
... | ... | |
85 |
89 |
private org.txm.searchengine.cqp.corpus.CQPCorpus corpus;
|
86 |
90 |
|
87 |
91 |
private ToolItem applyButton;
|
|
92 |
|
|
93 |
private ScrolledComposite sc1;
|
|
94 |
|
|
95 |
private GridLayout glayoutFields;
|
88 |
96 |
|
89 |
97 |
// private KeyListener allControlsKeyListener;
|
90 |
98 |
|
... | ... | |
209 |
217 |
public void widgetDefaultSelected(SelectionEvent e) { }
|
210 |
218 |
});
|
211 |
219 |
|
|
220 |
sc1 = new ScrolledComposite(parent, SWT.V_SCROLL);
|
|
221 |
GridLayout glayout = new GridLayout(1, true);
|
|
222 |
glayout.marginBottom = glayout.marginTop = glayout.marginHeight = glayout.verticalSpacing = 0;
|
|
223 |
sc1.setLayout(glayout);
|
|
224 |
sc1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
|
225 |
sc1.setExpandHorizontal(true);
|
|
226 |
sc1.setExpandVertical(true);
|
|
227 |
sc1.setMinSize(0, 120);
|
212 |
228 |
|
213 |
|
fields = new Composite(parent, SWT.NONE);
|
|
229 |
fields = new Composite(sc1, SWT.NONE);
|
214 |
230 |
GridData fields_gdata = new GridData(GridData.FILL, GridData.FILL, true, true);
|
215 |
231 |
fields.setLayoutData(fields_gdata);
|
216 |
|
fields.setLayout(new RowLayout());
|
|
232 |
glayoutFields = new GridLayout();
|
|
233 |
glayoutFields.numColumns = 1;
|
|
234 |
fields.setLayout(glayoutFields);
|
|
235 |
sc1.setContent(fields);
|
|
236 |
fields.addListener( SWT.Resize, event -> {
|
|
237 |
sc1.setMinSize(fields.computeSize(sc1.getParent().getSize().x, SWT.DEFAULT));
|
|
238 |
} );
|
217 |
239 |
this.setPartName("Element");
|
218 |
240 |
|
219 |
241 |
// GridDatas to use when a new field is added
|
... | ... | |
292 |
314 |
//if (this.element == null || (!this.element.getType().equals(newElement.getType()))) { // no need to rebuild the widgets
|
293 |
315 |
//clear(); // remove all previous widgets
|
294 |
316 |
String[][] props = vue.getChamps(newElement.getClass(), newElement.getType());
|
|
317 |
HashMap<String, Integer> niveaux = vue.getNiveauxChampsAVoir(newElement.getClass(), newElement.getType());
|
|
318 |
HashMap<String, Integer> ordres = vue.getPositionsChampsAVoir(newElement.getClass(), newElement.getType());
|
|
319 |
int ncol = 0;
|
|
320 |
int nline = props.length;
|
295 |
321 |
for (int l = 0 ; l < props.length ; l++) {
|
|
322 |
if (ncol < props[l].length) ncol = props[l].length;
|
|
323 |
|
|
324 |
}
|
|
325 |
for (int l = 0 ; l < nline ; l++) {
|
|
326 |
|
|
327 |
Composite lineComposite = new Composite(fields, SWT.NONE);
|
|
328 |
//lineComposite.getLayout().numColumns = props[l].length;
|
|
329 |
lineComposite.setLayout(new RowLayout());
|
|
330 |
lineComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
|
|
331 |
|
296 |
332 |
for (String p : props[l]) { // the first is the prop names
|
|
333 |
|
297 |
334 |
PropertyField c = null;
|
298 |
335 |
if (textWidgets.containsKey(p)) {
|
299 |
336 |
c = textWidgets.get(p);
|
300 |
337 |
} else {
|
301 |
|
c = new PropertyField(fields, SWT.NONE, p, this);
|
|
338 |
c = new PropertyField(lineComposite, SWT.NONE, p, this);
|
302 |
339 |
|
303 |
340 |
c.setLayoutData(cData);
|
304 |
341 |
c.setLayout(new GridLayout(2, false));
|
... | ... | |
307 |
344 |
|
308 |
345 |
c.setItems(c, newElement);
|
309 |
346 |
}
|
|
347 |
|
310 |
348 |
}
|
311 |
349 |
|
|
350 |
//glayoutFields.numColumns = ncol;
|
312 |
351 |
fields.layout();
|
313 |
352 |
fields.getParent().layout();
|
314 |
353 |
|