dumm2.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
dumm2.setVisible(false);
dumm2.setEnabled(false);
dumm2.setText("Remove Order File Source");
tNodes = new Table(gNodes, SWT.FULL_SELECTION | SWT.BORDER);
tNodes.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
//test
//cNextState.setVisible(true);
//txtStateText.setVisible(false);
selectNodes();
}
});
tNodes.setLinesVisible(true);
tNodes.setHeaderVisible(true);
final GridData gridData4 = new GridData(GridData.CENTER, GridData.FILL, true, true, 5, 4);
gridData4.heightHint = 112;
tNodes.setLayoutData(gridData4);
final TableColumn tableColumn3 = new TableColumn(tNodes, SWT.NONE);
tableColumn3.setWidth(90);
tableColumn3.setText("State");
final TableColumn newColumnTableColumn_3 = new TableColumn(tNodes, SWT.NONE);
newColumnTableColumn_3.setWidth(100);
newColumnTableColumn_3.setText("Node");
final TableColumn tableColumn4 = new TableColumn(tNodes, SWT.NONE);
tableColumn4.setWidth(200);
tableColumn4.setText("Job/Dir");
final TableColumn tableColumn5 = new TableColumn(tNodes, SWT.NONE);
tableColumn5.setWidth(90);
tableColumn5.setText("Next State");
final TableColumn tableColumn6 = new TableColumn(tNodes, SWT.NONE);
tableColumn6.setWidth(90);
tableColumn6.setText("Error State");
final TableColumn newColumnTableColumn_4 = new TableColumn(tNodes, SWT.NONE);
newColumnTableColumn_4.setWidth(100);
newColumnTableColumn_4.setText("On Error");
final Composite composite_1 = new Composite(gNodes, SWT.NONE);
composite_1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
final GridLayout gridLayout_5 = new GridLayout();
gridLayout_5.marginWidth = 0;
gridLayout_5.marginHeight = 0;
gridLayout_5.numColumns = 3;
composite_1.setLayout(gridLayout_5);
butUp = new Button(composite_1, SWT.NONE);
butUp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (tNodes.getSelectionCount() > 0) {
int index = tNodes.getSelectionIndex();
if(index > 0) {
listener.changeUp(tNodes, true, bFullNode.getSelection() || bEndNode.getSelection(), tState.getText(), cJob.getText(), tDelay.getText(), cNextState.getText(), cErrorState.getText(),bRemoveFile.getSelection(),tMoveTo.getText(), index, reorderButton.getSelection());
selectNodes();
}
}
}
});
butUp.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_up.gif"));
butDown = new Button(composite_1, SWT.NONE);
butDown.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (tNodes.getSelectionCount() > 0) {
int index = tNodes.getSelectionIndex();
if(index == tNodes.getItemCount()-1) {
//System.out.println("Datensatz ist bereits ganz unten.");
} else if(index >= 0) {
listener.changeUp(tNodes, false, bFullNode.getSelection() || bEndNode.getSelection(), tState.getText(), cJob.getText(), tDelay.getText(), cNextState.getText(), cErrorState.getText(),bRemoveFile.getSelection(),tMoveTo.getText(), index, reorderButton.getSelection());
selectNodes();
}
}
}
});
butDown.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
butDown.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_down.gif"));
reorderButton = new Button(composite_1, SWT.CHECK);
reorderButton.setSelection(true);
reorderButton.setText("Reorder");
/*final Button butIUp = new Button(composite_1, SWT.NONE);
butIUp.setLayoutData(new GridData());
butIUp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (tNodes.getSelectionCount() > 0) {
int index = tNodes.getSelectionIndex();
if(index > 0) {
listener.changeInsertUp(tNodes,
true,
bFullNode.getSelection() || bEndNode.getSelection(),
tState.getText(),
cJob.getText(),
tDelay.getText(),
cNextState.getText(),
cErrorState.getText(),
bRemoveFile.getSelection(),
tMoveTo.getText(),
index);
selectNodes();
}
}
}
});
butIUp.setText("iup");
*/
butDetailsJob = new Button(gNodes, SWT.NONE);
butDetailsJob.setEnabled(false);
butDetailsJob.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if(tNodes.getSelectionCount() > 0) {
showDetails(tNodes.getSelection()[0].getText(0), cJob.getText());
//tNodes.deselectAll();
//selectNodes();
//butDetailsJob.setEnabled(false);
checkParameter = true;
}
}
});
butDetailsJob.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false));
butDetailsJob.setText("Parameter");
butDetailsJob.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
if(checkParameter) {
listener.fillChain(tNodes);
checkParameter = false;
}
}
});
butAddMissingNodes = new Button(gNodes, SWT.NONE);
butAddMissingNodes.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
try {
if(tNodes.getSelectionCount() > 0) {
TableItem item = tNodes.getSelection()[0];
if(!listener.checkForState(item.getText(3))) {
listener.selectNode(null);
listener.applyNode(true, item.getText(3), "", "", "", "", false,"", "");
}
if(!listener.checkForState(item.getText(4))) {
listener.selectNode(null);
listener.applyNode(true, item.getText(4), "", "", "", "", false,"", "");
}
listener.fillChain(tNodes);
bApplyNode.setEnabled(false);
bRemoveNode.setEnabled(false);
listener.selectNode(null);
fillNode(true);
enableNode(false);
//listener.applyNode(bFullNode.getSelection() || bEndNode.getSelection(), tState.getText(), cJob.getText(), tDelay.getText(), cNextState.getText(), cErrorState.getText(),bRemoveFile.getSelection(),tMoveTo.getText(), cOnError.getText());
}
} catch (Exception ex) {
try {
new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() , ex);
} catch(Exception ee) {
//tu nichts
}
}
}
});
butAddMissingNodes.setEnabled(false);
butAddMissingNodes.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
butAddMissingNodes.setText("Add Missing Nodes");
bRemoveNode = new Button(gNodes, SWT.NONE);
bRemoveNode.setEnabled(false);
bRemoveNode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (tNodes.getSelectionCount() > 0) {
int c = MainWindow.message(getShell(), "Do you want remove the job node from this job chain?", SWT.ICON_QUESTION | SWT.YES | SWT.NO );
if(c != SWT.YES)
return;
int index = tNodes.getSelectionIndex();
listener.deleteNode(tNodes);
tNodes.remove(index);
if (index >= tNodes.getItemCount())
index--;
boolean empty = tNodes.getItemCount() == 0;
fillNode(empty);
enableNode(!empty);
bRemoveNode.setEnabled(!empty);
if (!empty) {
tNodes.select(index);
listener.selectNode(tNodes);
} else {
listener.selectNode(null);
}
}
}
});
bRemoveNode.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false));
bRemoveNode.setText("Remove Node");
gFileOrderSource = new Group(jobChainGroup, SWT.NONE);
final GridData gridData_10 = new GridData(GridData.FILL, GridData.CENTER, true, false);
gridData_10.heightHint = 169;
gFileOrderSource.setLayoutData(gridData_10);
gFileOrderSource.setText("File Order Source");
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.marginTop = 5;
gridLayout_1.marginBottom = 5;
gridLayout_1.numColumns = 5;
gFileOrderSource.setLayout(gridLayout_1);
final Label directoryLabel = new Label(gFileOrderSource, SWT.NONE);
directoryLabel.setFont(SWTResourceManager.getFont("", 8, SWT.NONE));
directoryLabel.setText("Directory");
tDirectory = new Text(gFileOrderSource, SWT.BORDER);
tDirectory.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tDirectory.selectAll();
}
});
tDirectory.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
bApplyFileOrderSource.setEnabled(isValidSource());
if (bApplyFileOrderSource.getEnabled())
getShell().setDefaultButton(bApplyFileOrderSource);
}
});
tDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
}
});
tDirectory.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
final Label delay_after_errorLabel = new Label(gFileOrderSource, SWT.NONE);
delay_after_errorLabel.setText("Delay after error");
tDelayAfterError = new Text(gFileOrderSource, SWT.BORDER);
tDelayAfterError.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tDelayAfterError.selectAll();
}
});
tDelayAfterError.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
bApplyFileOrderSource.setEnabled(isValidSource());
if (bApplyFileOrderSource.getEnabled())
getShell().setDefaultButton(bApplyFileOrderSource);
}
});
tDelayAfterError.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
bApplyFileOrderSource = new Button(gFileOrderSource, SWT.NONE);
bApplyFileOrderSource.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
applyFileOrderSource();
}
});
bApplyFileOrderSource.setEnabled(false);
bApplyFileOrderSource.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
bApplyFileOrderSource.setText("Apply File Order Source");
final Label regexLabel = new Label(gFileOrderSource, SWT.NONE);
regexLabel.setFont(SWTResourceManager.getFont("", 8, SWT.NONE));
regexLabel.setText("Regex");
tRegex = new Text(gFileOrderSource, SWT.BORDER);
tRegex.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tRegex.selectAll();
}
});
tRegex.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
bApplyFileOrderSource.setEnabled(isValidSource());
if (bApplyFileOrderSource.getEnabled())
getShell().setDefaultButton(bApplyFileOrderSource);
}
});
tRegex.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
final Label repeatLabel = new Label(gFileOrderSource, SWT.NONE);
repeatLabel.setText("Repeat");
tRepeat = new Text(gFileOrderSource, SWT.BORDER);
tRepeat.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tRepeat.selectAll();
}
});
tRepeat.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
bApplyFileOrderSource.setEnabled(isValidSource());
if (bApplyFileOrderSource.getEnabled())
getShell().setDefaultButton(bApplyFileOrderSource);
}
});
tRepeat.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
new Label(gFileOrderSource, SWT.NONE);
final Label maxLabel = new Label(gFileOrderSource, SWT.NONE);
maxLabel.setText("Max");
tMax = new Text(gFileOrderSource, SWT.BORDER);
tMax.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tMax.selectAll();
}
});
tMax.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
bApplyFileOrderSource.setEnabled(isValidSource());
if (bApplyFileOrderSource.getEnabled())
getShell().setDefaultButton(bApplyFileOrderSource);
}
});
tMax.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
final Label stateLabel = new Label(gFileOrderSource, SWT.NONE);
stateLabel.setText("Next state");
tNextState = new Text(gFileOrderSource, SWT.BORDER);
tNextState.addFocusListener(new FocusAdapter() {
public void focusGained(final FocusEvent e) {
tNextState.selectAll();
}
});
tNextState.addModifyListener(new ModifyListener() {
public void modifyText(final ModifyEvent e) {
bApplyFileOrderSource.setEnabled(isValidSource());
if (bApplyFileOrderSource.getEnabled())
getShell().setDefaultButton(bApplyFileOrderSource);
}
});
tNextState.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
tFileOrderSource = new Table(gFileOrderSource, SWT.BORDER);
tFileOrderSource.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
if (tFileOrderSource.getSelectionCount() > 0) {
listener.selectFileOrderSource(tFileOrderSource);
bApplyFileOrderSource.setEnabled(false);