6 |
|
|
7 |
import org.eclipse.draw2d.Panel; |
import org.eclipse.draw2d.Panel; |
8 |
import org.eclipse.jface.viewers.TableViewer; |
import org.eclipse.jface.viewers.TableViewer; |
|
import org.eclipse.jface.window.ApplicationWindow; |
|
9 |
import org.eclipse.jface.wizard.WizardPage; |
import org.eclipse.jface.wizard.WizardPage; |
10 |
import org.eclipse.swt.SWT; |
import org.eclipse.swt.SWT; |
11 |
|
|
13 |
import org.eclipse.swt.events.SelectionEvent; |
import org.eclipse.swt.events.SelectionEvent; |
14 |
import org.eclipse.swt.layout.GridData; |
import org.eclipse.swt.layout.GridData; |
15 |
import org.eclipse.swt.layout.GridLayout; |
import org.eclipse.swt.layout.GridLayout; |
|
import org.eclipse.swt.layout.RowLayout; |
|
16 |
import org.eclipse.swt.widgets.Button; |
import org.eclipse.swt.widgets.Button; |
17 |
import org.eclipse.swt.widgets.Composite; |
import org.eclipse.swt.widgets.Composite; |
18 |
import org.eclipse.swt.widgets.Control; |
import org.eclipse.swt.widgets.Event; |
|
import org.eclipse.swt.widgets.Display; |
|
|
import org.eclipse.swt.widgets.FileDialog; |
|
19 |
import org.eclipse.swt.widgets.Label; |
import org.eclipse.swt.widgets.Label; |
20 |
import org.eclipse.swt.widgets.Shell; |
import org.eclipse.swt.widgets.Listener; |
21 |
import org.eclipse.swt.widgets.Table; |
import org.eclipse.swt.widgets.Table; |
22 |
import org.eclipse.swt.widgets.TableColumn; |
import org.eclipse.swt.widgets.TableColumn; |
23 |
|
import org.eclipse.swt.widgets.TableItem; |
24 |
import org.eclipse.swt.widgets.Text; |
import org.eclipse.swt.widgets.Text; |
25 |
|
|
26 |
class ValueDataSelectedPage extends WizardPage |
class ValueDataSelectedPage extends WizardPage |
33 |
* private Button dr; |
* private Button dr; |
34 |
*/ |
*/ |
35 |
|
|
36 |
private Table input, valueData; |
public Table input, valueData; |
37 |
|
|
38 |
|
private TableViewer tableViewer; |
39 |
|
|
40 |
private Button add, add2; |
private Button add, add2; |
41 |
|
|
42 |
private Panel panel; |
private Panel panel; |
43 |
|
|
44 |
private Label dv, dc; |
private Label dv, dc; |
45 |
|
|
46 |
private Text dvT, dcT; |
private Text dvT, dcT; |
47 |
|
|
48 |
|
ProcessData pd = new ProcessData(); |
49 |
|
|
50 |
/** |
/** |
51 |
* ComplaintsPage constructor |
* ComplaintsPage constructor |
55 |
super("ValuedataSelectPage"); |
super("ValuedataSelectPage"); |
56 |
setTitle("Value data Select"); |
setTitle("Value data Select"); |
57 |
setDescription("Please input the data values "); |
setDescription("Please input the data values "); |
58 |
setPageComplete(true); |
setPageComplete(false); |
59 |
} |
} |
60 |
|
|
61 |
/** |
/** |
62 |
* Creates the page controls |
* Creates the page controls |
63 |
*/ |
*/ |
64 |
public void createControl(Composite parent) |
public void createControl(Composite parent) |
65 |
{ |
{ |
66 |
Composite composite = new Composite(parent, SWT.NONE); |
Composite composite = new Composite(parent, SWT.NONE); |
67 |
composite.setLayout(new GridLayout(3,false)); |
composite.setLayout(new GridLayout(3,false)); |
68 |
LinkedList entries = new LinkedList(); |
LinkedList entries = new LinkedList(); |
69 |
|
|
70 |
input = new Table(composite, SWT.NONE); |
input = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); |
71 |
input.setLayoutData(new GridData(GridData.FILL_VERTICAL |
input.setLayoutData(new GridData(GridData.FILL_VERTICAL |
72 |
| GridData.FILL_HORIZONTAL)); |
| GridData.FILL_HORIZONTAL)); |
73 |
new TableColumn(input, SWT.NULL).setText(" Input "); |
new TableColumn(input, SWT.NULL).setText(" Input "); |
74 |
input.setHeaderVisible(true); |
input.setHeaderVisible(true); |
75 |
input.setLinesVisible(true); |
input.setLinesVisible(true); |
76 |
for (int i = 0, n = input.getColumnCount(); i < n; i++) |
for (int i=0; i<12; i++) { |
77 |
input.getColumn(i).pack(); |
TableItem item = new TableItem (input, SWT.NONE); |
78 |
|
item.setText ("Item " + i); |
79 |
|
|
80 |
|
} |
81 |
|
input.addListener (SWT.Selection, new Listener () { |
82 |
|
public void handleEvent (Event event) { |
83 |
|
String string = event.detail == SWT.CHECK ? "Checked" : "Selected"; |
84 |
|
System.out.println (event.item + " " + string); |
85 |
|
|
86 |
|
if (event.detail == SWT.CHECK){ |
87 |
|
event.item.setData("checked"); |
88 |
|
} |
89 |
|
} |
90 |
|
}); |
91 |
|
for (int i = 0, n = input.getColumnCount(); i < n; i++) |
92 |
|
input.getColumn(i).pack(); |
93 |
Composite composite1 = new Composite(composite, SWT.NONE); |
Composite composite1 = new Composite(composite, SWT.NONE); |
94 |
composite1.setLayout(new GridLayout(1,false)); |
composite1.setLayout(new GridLayout(1,false)); |
95 |
add = new Button(composite1, SWT.RIGHT); |
add = new Button(composite1, SWT.RIGHT); |
96 |
add.setText("Add->"); |
add.setText("Add->"); |
97 |
|
add.addSelectionListener(new SelectionAdapter() { |
98 |
|
public void widgetSelected(SelectionEvent e) { |
99 |
|
int i = input.getItemCount(); |
100 |
|
System.out.println("ItemCount" + i); |
101 |
|
while(i!=0){ |
102 |
|
if((input.getItem(i-1).getData()!=null)&&(input.getItem(i-1).getData().equals("checked"))){ |
103 |
|
|
104 |
|
TableItem item = new TableItem (valueData, SWT.NULL); |
105 |
|
item.setText (0, input.getItem(i-1).getText()); |
106 |
|
input.remove(i-1); |
107 |
|
} |
108 |
|
i--; |
109 |
|
} |
110 |
|
|
111 |
|
|
112 |
|
if (input.getItemCount() != i){ |
113 |
|
setPageComplete(true); |
114 |
|
} |
115 |
|
else{setPageComplete(false);} |
116 |
|
} |
117 |
|
}); |
118 |
add2 = new Button(composite1,SWT.RIGHT); |
add2 = new Button(composite1,SWT.RIGHT); |
119 |
add2.setText("<-Add"); |
add2.setText("<-Add"); |
120 |
valueData = new Table(composite, SWT.RIGHT); |
|
121 |
|
valueData = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); |
122 |
|
|
123 |
// Set up the table |
// Set up the table |
124 |
valueData.setLayoutData(new GridData(GridData.FILL_VERTICAL |
valueData.setLayoutData(new GridData(GridData.FILL_VERTICAL |
125 |
| GridData.FILL_HORIZONTAL)); |
| GridData.FILL_HORIZONTAL)); |
126 |
TableColumn vd = new TableColumn(valueData, SWT.CENTER); |
TableColumn vd = new TableColumn(valueData, SWT.CENTER); |
127 |
vd.setText(" ValueData "); |
vd.setText(" ValueData "); |
128 |
valueData.showColumn(vd); |
valueData.showColumn(vd); |
129 |
valueData.setHeaderVisible(true); |
valueData.setHeaderVisible(true); |
130 |
valueData.setLinesVisible(true); |
valueData.setLinesVisible(true); |
|
|
|
131 |
for (int i = 0, n = valueData.getColumnCount(); i < n; i++) |
for (int i = 0, n = valueData.getColumnCount(); i < n; i++) |
132 |
valueData.getColumn(i).pack(); |
valueData.getColumn(i).pack(); |
133 |
|
valueData.addListener (SWT.Selection, new Listener () { |
134 |
/** |
public void handleEvent (Event event) { |
135 |
* |
String string = event.detail == SWT.CHECK ? "Checked" : "Selected"; |
136 |
* End |
System.out.println (event.item + " " + string); |
137 |
* |
if (event.detail == SWT.CHECK){ |
138 |
*/ |
event.item.setData("checked"); |
139 |
|
} |
140 |
|
} |
141 |
|
}); |
142 |
|
add2.addSelectionListener(new SelectionAdapter() { |
143 |
|
public void widgetSelected(SelectionEvent e) { |
144 |
|
int i = valueData.getItemCount(); |
145 |
|
System.out.println("ItemCount" + i); |
146 |
|
while(i!=0){ |
147 |
|
if((valueData.getItem(i-1).getData()!=null)&&(valueData.getItem(i-1).getData().equals("checked"))){ |
148 |
|
|
149 |
|
TableItem item = new TableItem (input, SWT.NULL); |
150 |
|
item.setText (0, valueData.getItem(i-1).getText()); |
151 |
|
valueData.remove(i-1); |
152 |
|
} |
153 |
|
i--; |
154 |
|
} |
155 |
|
} |
156 |
|
}); |
157 |
|
|
158 |
setControl(composite); |
setControl(composite); |
159 |
} |
} |
|
|
|
160 |
} |
} |