} else {
MainWindow.message(shell, sos.scheduler.editor.app.Messages.getString("no_jobdescription"), SWT.ICON_WARNING | SWT.OK );
}
} catch(Exception ex) {
try {
new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + " ;could not open description " + txtJobname.getText() , ex);
} catch(Exception ee) {
//tu nichts
}
System.out.println("..could not open description " + txtJobname.getText() + " " + ex);
}
}
});
butdescription.setText("Description");
}
butShow = new Button(composite, SWT.NONE);
butShow.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
butShow.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
HashMap attr = getJobFromDescription();
JobAssistentImportJobParamsForm defaultParams = new JobAssistentImportJobParamsForm();
ArrayList listOfParams = defaultParams.parseDocuments(txtPath.getText(),"");
attr.put("params", listOfParams);
Element job = null;
if(flagBackUpJob) {
if(assistentType == Editor.JOB_WIZZARD) {
//Starten der Wizzard f�r bestehende Job. Die Einstzellungen im Jobbeschreibungen mergen mit backUpJob wenn assistentype = Editor.Job_Wizzard
Element currJob = (Element)(joblistener.getJob().clone());
job = listener.createJobElement(attr, currJob);
} else {
job = listener.createJobElement(attr);
}
} else {
job = (Element)(jobBackUp.clone());
}
Utils.showClipboard(Utils.getElementAsString(job), shell, false, null, false, null, false);
job.removeChildren("param");
}
});
butShow.setText("Show");
{
butImport = new Button(composite, SWT.NONE);
butImport.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
try {
if(!check()) return;
HashMap h = getJobFromDescription();
if(jobname != null)
jobname.setText(txtJobname.getText());
JobAssistentImportJobParamsForm defaultParams = new JobAssistentImportJobParamsForm();
ArrayList listOfParams = defaultParams.parseDocuments(txtPath.getText(),"required");
h.put("params", listOfParams);
if(assistentType == Editor.JOB_WIZZARD) {
//Starten der Wizzard f�r bestehende Job. Die Einstzellungen im Jobbeschreibungen mergen mit backUpJob wenn assistentype = Editor.Job_Wizzard
Element job = joblistener.getJob();
job = job.setContent(listener.createJobElement(h, joblistener.getJob()).cloneContent());
if(jobForm != null)//diese Zeile l�schen
jobForm.initForm();
if(jobDocForm != null)
jobDocForm.initForm();
} else if(assistentType == Editor.PARAMETER) {
//Starten der Wizzard f�r bestehende Job. Die Einstzellungen im Jobbeschreibungen mergen mit backUpJob wenn assistentype = Editor.Job_Wizzard
//joblistener.getJob().setContent(listener.createJobElement(h, joblistener.getJob()).cloneContent());
Element job = joblistener.getJob();
if(job.getName().equals("job")) {
job = job.setContent(listener.createJobElement(h, joblistener.getJob()).cloneContent());
paramListener.fillParams(tParameter);
} else
paramListener.fillParams(listOfParams, tParameter, false);
} else {
if(listener.existJobname(txtJobname.getText())) {
MainWindow.message(shell, Messages.getString("assistent.error.job_name_exist"), SWT.OK );
txtJobname.setFocus();
return;
}
Element job = null;
if(flagBackUpJob) {
job = listener.createJobElement(h);
} else {
job = joblistener.getJob();
job = job.setContent(jobBackUp.cloneContent());
}
listener.newImportJob(job, assistentType);
if(Options.getPropertyBoolean("editor.job.show.wizard"))
Utils.showClipboard(Utils.getElementAsString(job), shell, false, null, false, null, true);
}
closeDialog = true;
//Event ausl�sen
if(refreshDetailsText != null)
refreshDetailsText.setText("X");
shell.dispose();
} catch (Exception ex) {
try {
new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() , ex);
} catch(Exception ee) {
//tu nichts
}
System.err.print(ex.getMessage());
}
}
});
}
butImport.setText("Finish");
butBack = new Button(composite, SWT.NONE);
butBack.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
JobAssistentTypeForms typeForms = new JobAssistentTypeForms(dom, update);
typeForms.showTypeForms(jobType, jobBackUp, assistentType);
closeDialog = true;
shell.dispose();
}
});
butBack.setText("Back");
butParameters = new Button(composite, SWT.NONE);
butParameters.setFont(SWTResourceManager.getFont("", 8, SWT.BOLD));
butParameters.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
butParameters.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
Utils.startCursor(shell);
if(!check()) return;
HashMap attr = getJobFromDescription();
if(assistentType == Editor.JOB_WIZZARD || assistentType == Editor.JOB) {
Element job = listener.createJobElement(attr, joblistener.getJob());
JobAssistentImportJobParamsForm paramsForm = new JobAssistentImportJobParamsForm(joblistener.get_dom(), joblistener.get_main(), job, assistentType);
paramsForm.setBackUpJob(jobBackUp, jobForm);
paramsForm.setJobForm(jobForm);
paramsForm.showAllImportJobParams(txtPath.getText());
} else if(assistentType == Editor.PARAMETER) {
JobAssistentImportJobParamsForm paramsForm = new JobAssistentImportJobParamsForm(joblistener.get_dom(), joblistener.get_main(), joblistener, tParameter, assistentType);
paramsForm.showAllImportJobParams(txtPath.getText());
} else {
if(assistentType != Editor.JOB_WIZZARD && listener.existJobname(txtJobname.getText())) {
MainWindow.message(shell, Messages.getString("assistent.error.job_name_exist"), SWT.OK );
txtJobname.setFocus();
return;
}
Element job = null;
if(flagBackUpJob) {
if(jobBackUp != null && assistentType != Editor.JOB_WIZZARD) {
int cont = MainWindow.message(shell, sos.scheduler.editor.app.Messages.getString("assistent.discard_changes"), SWT.ICON_QUESTION | SWT.YES |SWT.NO |SWT.CANCEL );
if(cont == SWT.CANCEL) {
return;
}else if(cont != SWT.YES) {
job = joblistener.getJob().setContent(jobBackUp.cloneContent());
}
}
} else {
//der backUpJob wurde nicht ver�ndert
job = joblistener.getJob().setContent(jobBackUp.cloneContent());
}
if(job==null){
job = listener.createJobElement(attr);
}
JobAssistentImportJobParamsForm paramsForm = null;
if(assistentType == Editor.JOB_WIZZARD) {
paramsForm = new JobAssistentImportJobParamsForm(dom, update, joblistener, assistentType);
} else {
paramsForm = new JobAssistentImportJobParamsForm(dom, update, job, assistentType);
}
paramsForm.showAllImportJobParams(txtPath.getText());
if(jobname != null)
paramsForm.setJobname(jobname);
paramsForm.setBackUpJob(jobBackUp, jobForm);
}
closeDialog = true;
Utils.stopCursor(shell);
shell.dispose();
}
});
butParameters.setText("Next");
Utils.createHelpButton(composite, "assistent.import_jobs", shell);
if(assistentType == Editor.JOB) {
this.butImport.setVisible(true);
butParameters.setText("Import Parameters");
}
if(assistentType == Editor.JOB_WIZZARD) {
txtJobname.setEnabled(false);
txtTitle.setEnabled(true);
butShow.setEnabled(true);
butBack.setEnabled(true);
} else if(assistentType == Editor.JOB) {
txtJobname.setEnabled(false);
txtTitle.setEnabled(false);
butShow.setEnabled(false);
butBack.setEnabled(false);
} else if(assistentType == Editor.JOB_CHAINS) {
txtJobname.setEnabled(true);
txtTitle.setEnabled(true);
butShow.setEnabled(true);
butBack.setEnabled(false);
} else {
txtJobname.setEnabled(true);
txtTitle.setEnabled(true);
butShow.setEnabled(true);
butBack.setEnabled(true);
}
if(joblistener != null) {
if(joblistener.getJob().getName().equals("start_job") ||
joblistener.getJob().getName().equals("process") ||
joblistener.getJob().getName().equals("order") ||
joblistener.getJob().getName().equals("config")) {
txtJobname.setEnabled(false);
}
}
java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
shell.setBounds((screen.width - shell.getBounds().width) /2,
(screen.height - shell.getBounds().height) /2,
shell.getBounds().width,
shell.getBounds().height);
final Group jobnamenGroup = new Group(shell, SWT.NONE);
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.marginTop = 5;
gridLayout_1.marginRight = 5;
gridLayout_1.marginLeft = 5;
jobnamenGroup.setLayout(gridLayout_1);
jobnamenGroup.setText("Jobs");
final GridData gridData_3 = new GridData(GridData.FILL, GridData.FILL, true, true);
gridData_3.heightHint = 154;
jobnamenGroup.setLayoutData(gridData_3);
jobnamenGroup.getBounds().height=100;
tree = new Tree(jobnamenGroup, SWT.FULL_SELECTION | SWT.BORDER);
tree.setHeaderVisible(true);
tree.getBounds().height = 100;
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
txtTitle.setText(tree.getSelection()[0].getText(1));
txtPath.setText(tree.getSelection()[0].getText(2));
txtJobname.setFocus();
flagBackUpJob = true;
}
});
final GridData gridData_2 = new GridData(GridData.FILL, GridData.FILL, true, true);
tree.setLayoutData(gridData_2);
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setText("Name");
column1.setWidth(165);
TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
column2.setText("Title");
column2.setWidth(200);
TreeColumn column3 = new TreeColumn(tree, SWT.LEFT);
column3.setText("Filename");
column3.setWidth(209);
try {
createTreeIteam();
} catch (Exception e) {
try {
new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() , e);
} catch(Exception ee) {
//tu nichts
}
System.err.print(e.getMessage());
}
if(joblistener != null) {
selectTree();
}
setToolTipText();
shell.layout();
shell.pack();
shell.open();
} catch(Exception e) {
try {
new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() , e);
} catch(Exception ee) {
//tu nichts
}
System.err.println("error in JobAssistentImportJobsForm.showAllImportJob(): " + e.getMessage());
}