source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/ModelsTabComposite.java @ 192

Last change on this file since 192 was 192, checked in by sherbold, 13 years ago

Work on the SWT GUI prototype. The prototype is still incomplete and should not be used.

  • Property svn:mime-type set to text/plain
File size: 2.0 KB
Line 
1package de.ugoe.cs.eventbench.swt;
2
3import org.eclipse.swt.SWT;
4import org.eclipse.swt.widgets.Composite;
5import org.eclipse.swt.widgets.Button;
6import org.eclipse.swt.widgets.List;
7import org.eclipse.swt.layout.GridLayout;
8import org.eclipse.swt.layout.GridData;
9
10import de.ugoe.cs.eventbench.data.GlobalDataContainer;
11import org.eclipse.swt.events.SelectionAdapter;
12import org.eclipse.swt.events.SelectionEvent;
13
14public 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}
Note: See TracBrowser for help on using the repository browser.