tableDescParameters.setHeaderVisible(true);
final GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
gridData.widthHint = 245;
tableDescParameters.setLayoutData(gridData);
final TableColumn newColumnTableColumn = new TableColumn(tableDescParameters, SWT.NONE);
newColumnTableColumn.setWidth(122);
newColumnTableColumn.setText("Name");
final TableColumn newColumnTableColumn_1 = new TableColumn(tableDescParameters, SWT.NONE);
newColumnTableColumn_1.setWidth(145);
newColumnTableColumn_1.setText("Value");
final Composite composite_2 = new Composite(textParameterGroup, SWT.NONE);
final GridData gridData_11 = new GridData(GridData.CENTER, GridData.CENTER, false, false);
gridData_11.widthHint = 49;
composite_2.setLayoutData(gridData_11);
composite_2.setLayout(new GridLayout());
butPut = new Button(composite_2, SWT.NONE);
butPut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
addParams();
}
});
final GridData gridData_13 = new GridData(GridData.FILL, GridData.CENTER, false, false);
gridData_13.widthHint = 33;
butPut.setLayoutData(gridData_13);
butPut.setText(">");
butPutAll = new Button(composite_2, SWT.NONE);
butPutAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
for(int i = 0; i < tableDescParameters.getItemCount(); i++) {
paramListener.saveParameter(table,
tableDescParameters.getItem(i).getText(0),
tableDescParameters.getItem(i).getText(1),
(tableDescParameters.getItem(i).getData("parameter_description_de") != null?tableDescParameters.getItem(i).getData("parameter_description_de").toString(): ""),
(tableDescParameters.getItem(i).getData("parameter_description_en") != null?tableDescParameters.getItem(i).getData("parameter_description_en").toString(): ""),
tableDescParameters.getItem(i).getBackground().equals(Options.getRequiredColor() ));
}
tableDescParameters.removeAll();
butApply.setEnabled(false);
}
});
butPutAll.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
butPutAll.setText(">>");
butRemove = new Button(composite_2, SWT.NONE);
butRemove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
removeParams();
}
});
final GridData gridData_12 = new GridData(GridData.FILL, GridData.CENTER, false, false);
gridData_12.widthHint = 29;
butRemove.setLayoutData(gridData_12);
butRemove.setText("<");
butRemoveAll = new Button(composite_2, SWT.NONE);
butRemoveAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
String remItem= null;
ArrayList listOfParams = new ArrayList();
for(int i = 0; i < table.getItemCount();i++){
TableItem item = table.getItem(i);
if(item.getBackground().equals(Options.getRequiredColor())) {
remItem = (remItem!=null?remItem:"") +"\n\t" + item.getText(0);
//merke die Parameter, die nicht gel�scht werden sollen, weil sie required sind
HashMap h = new HashMap();
h.put("name", item.getText(0));
h.put("default_value", (item.getText(1)!=null?item.getText(1):""));
h.put("required", "true");
h.put("parameter_description_de", (item.getData("parameter_description_de")!=null?item.getData("parameter_description_de"):""));
h.put("parameter_description_en", (item.getData("parameter_description_en")!=null?item.getData("parameter_description_en"):""));
listOfParams.add(h);
} else {
TableItem itemDP = new TableItem(tableDescParameters, SWT.NONE);
itemDP.setText(0, item.getText(0));
itemDP.setText(1, item.getText(1));
itemDP.setData("parameter_description_de", item.getData("parameter_description_de"));
itemDP.setData("parameter_description_en", item.getData("parameter_description_en"));
}
}
txtName.setFocus();
paramListener.fillParams(listOfParams, table, true);
if(remItem != null) {
MainWindow.message(jobParameterShell, sos.scheduler.editor.app.Messages.getString("assistent.jobparameter.required") + remItem, SWT.ICON_WARNING | SWT.OK );
}
table.redraw();
table.deselectAll();
tableDescParameters.deselectAll();
}
});
butRemoveAll.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
butRemoveAll.setText("<<");
table = new Table(textParameterGroup, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
table.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(final MouseEvent e) {
removeParams();
}
});
final GridData gridData_1 = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
gridData_1.heightHint = 135;
gridData_1.widthHint = 185;
table.setLayoutData(gridData_1);
table.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
if(butApply.isEnabled()) {
int ok = MainWindow.message(Messages.getString("MainListener.apply_changes"), //$NON-NLS-1$
SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
if (ok == SWT.YES) {
addParam();
return;
}
}
if(table.getSelectionCount() > -1) {
txtName.setText(table.getSelection()[0].getText(0));
txtValue.setText(table.getSelection()[0].getText(1));
txtDescription.setText((table.getSelection()[0].getData("parameter_description_" + Options.getLanguage()) != null? table.getSelection()[0].getData("parameter_description_" + Options.getLanguage()).toString(): "") );
txtName.setFocus();
butApply.setEnabled(false);
}
}
});
table.setLayoutDeferred(true);
table.setLinesVisible(true);
table.setHeaderVisible(true);
final TableColumn colName = new TableColumn(table, SWT.NONE);
colName.setWidth(119);
colName.setText("Name");
final TableColumn colValue = new TableColumn(table, SWT.NONE);
colValue.setWidth(212);
colValue.setText("Value");
txtDescription = new Text(textParameterGroup, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL);
final GridData gridData_2 = new GridData(GridData.FILL, GridData.CENTER, false, false, 5, 1);
gridData_2.heightHint = 108;
txtDescription.setLayoutData(gridData_2);