1 | package de.ugoe.cs.eventbench.swt;
|
---|
2 |
|
---|
3 | import org.eclipse.swt.SWT;
|
---|
4 | import org.eclipse.swt.widgets.Composite;
|
---|
5 | import org.eclipse.swt.widgets.Button;
|
---|
6 | import org.eclipse.swt.widgets.List;
|
---|
7 | import org.eclipse.swt.layout.GridLayout;
|
---|
8 | import org.eclipse.swt.layout.GridData;
|
---|
9 |
|
---|
10 | import de.ugoe.cs.eventbench.data.GlobalDataContainer;
|
---|
11 | import org.eclipse.swt.events.SelectionAdapter;
|
---|
12 | import org.eclipse.swt.events.SelectionEvent;
|
---|
13 |
|
---|
14 | public class ModelsTabComposite extends Composite {
|
---|
15 |
|
---|
16 | List modelList;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Create the composite.
|
---|
20 | * @param parent
|
---|
21 | * @param style
|
---|
22 | */
|
---|
23 | public ModelsTabComposite(Composite parent, int style) {
|
---|
24 | super(parent, style);
|
---|
25 | createContents();
|
---|
26 | }
|
---|
27 |
|
---|
28 | private void createContents() {
|
---|
29 | setLayout(new GridLayout(5, false));
|
---|
30 |
|
---|
31 | modelList = new List(this, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
|
---|
32 | modelList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
|
---|
33 |
|
---|
34 | Button btnShow = new Button(this, SWT.NONE);
|
---|
35 | btnShow.setText("Visualize");
|
---|
36 |
|
---|
37 | Button btnDelete_1 = new Button(this, SWT.NONE);
|
---|
38 | btnDelete_1.addSelectionListener(new SelectionAdapter() {
|
---|
39 | @Override
|
---|
40 | public void widgetSelected(SelectionEvent e) {
|
---|
41 | if( SWTHelpers.deleteSelectedFromStorage(modelList) ) {
|
---|
42 | updateModelList();
|
---|
43 | } else {
|
---|
44 | SWTHelpers.noSelectionError(getShell());
|
---|
45 | }
|
---|
46 | }
|
---|
47 | });
|
---|
48 | btnDelete_1.setText("Delete");
|
---|
49 |
|
---|
50 | Button btnGenSequences = new Button(this, SWT.NONE);
|
---|
51 | btnGenSequences.setText("Gen. Sequences");
|
---|
52 |
|
---|
53 | Button btnProperties = new Button(this, SWT.NONE);
|
---|
54 | btnProperties.setText("Properties");
|
---|
55 |
|
---|
56 | Button btnCreateDot = new Button(this, SWT.NONE);
|
---|
57 | btnCreateDot.setText("Create DOT");
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Override
|
---|
61 | protected void checkSubclass() {
|
---|
62 | // Disable the check that prevents subclassing of SWT components
|
---|
63 | }
|
---|
64 |
|
---|
65 | public void updateModelList() {
|
---|
66 | modelList.removeAll();
|
---|
67 | for( String sequencesName : GlobalDataContainer.getInstance().getAllModelNames() ) {
|
---|
68 | modelList.add(sequencesName);
|
---|
69 | }
|
---|
70 | }
|
---|
71 |
|
---|
72 | }
|
---|