/** @wbp.parser.constructor */ public DetailForm( Composite parent_, int style, String jobChainname_, String state_, String orderId, int type_, DetailDom dom_, IDetailUpdate gui_, boolean isLifeElement_, String path_) { super(parent_, style); dom = dom_; gui = gui_; type = type_; jobChainname = jobChainname_; state = state_; _orderId = orderId; w = new WindowsSaver(this.getClass(), getShell(), 643, 600); w.restoreWindowLocation(); initialize(); w.restoreWindowSize(); setToolTipText(); parent = parent_; isLifeElement = isLifeElement_; path = path_; open(); }
private void createGroup() { try { final GridLayout gridLayout_3 = new GridLayout(); gridLayout_3.verticalSpacing = 10; gridLayout_3.marginWidth = 10; gridLayout_3.marginTop = 10; gridLayout_3.marginRight = 10; gridLayout_3.marginLeft = 10; gridLayout_3.marginHeight = 10; gridLayout_3.marginBottom = 10; gridLayout_3.numColumns = 3; final Group composite = JOE_G_DetailForm_MainGroup.Control(new Group(this, SWT.NONE)); composite.addDisposeListener( new DisposeListener() { public void widgetDisposed(final DisposeEvent e) { if (butApply.isEnabled()) { save(); } } }); composite.setLayout(new GridLayout()); final GridData gridData_6 = new GridData(GridData.FILL, GridData.CENTER, true, true, 3, 1); gridData_6.heightHint = 31; composite.setLayoutData(gridData_6); parameterGroup = JOE_G_DetailForm_ParameterGroup.Control(new Group(composite, SWT.NONE)); parameterGroup.setEnabled(false); // parameterGroup.setText("Detail Parameter"); final GridData gridData_3 = new GridData(GridData.FILL, GridData.FILL, true, true); gridData_3.heightHint = 239; parameterGroup.setLayoutData(gridData_3); final GridLayout gridLayout_2 = new GridLayout(); gridLayout_2.numColumns = 6; parameterGroup.setLayout(gridLayout_2); @SuppressWarnings("unused") final Label nameLabel = JOE_L_Name.Control(new Label(parameterGroup, SWT.NONE)); // nameLabel.setText("Name"); txtName = JOE_T_DetailForm_Name.Control(new Text(parameterGroup, SWT.BORDER)); // txtName.addFocusListener(new FocusAdapter() { // public void focusGained(final FocusEvent e) { // txtName.selectAll(); // } // }); txtName.addModifyListener( new ModifyListener() { public void modifyText(final ModifyEvent e) { if (!txtName.getText().equals("") && (tableParams.getSelectionCount() == 0 || (tableParams.getSelectionCount() > 0 && !tableParams .getSelection()[0] .getText(0) .equalsIgnoreCase(txtName.getText())))) { isEditableParam = true; butApplyParam.setEnabled(isEditableParam); txtValue.setEnabled(true); butText.setEnabled(true); paramText.setText(""); txtParamNote.setEnabled(true); } else { butText.setEnabled(false); } } }); txtName.addKeyListener( new KeyAdapter() { public void keyPressed(final KeyEvent e) { if (e.keyCode == SWT.CR && !txtName.getText().equals("")) { addParam(); } } }); txtName.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); txtName.setFocus(); @SuppressWarnings("unused") final Label valueLabel = JOE_L_Value.Control(new Label(parameterGroup, SWT.NONE)); // valueLabel.setText("Value"); txtValue = JOE_T_DetailForm_Value.Control(new Text(parameterGroup, SWT.BORDER)); // txtValue.addFocusListener(new FocusAdapter() { // public void focusGained(final FocusEvent e) { // txtValue.selectAll(); // } // }); txtValue.addKeyListener( new KeyAdapter() { public void keyPressed(final KeyEvent e) { if (e.keyCode == SWT.CR && !txtName.getText().equals("")) { addParam(); } } }); txtValue.addModifyListener( new ModifyListener() { public void modifyText(final ModifyEvent e) { if (!txtName.getText().equals("") && (tableParams.getSelectionCount() == 0 || (tableParams.getSelectionCount() > 0 && !tableParams .getSelection()[0] .getText(1) .equalsIgnoreCase(txtValue.getText())))) { isEditableParam = true; butApplyParam.setEnabled(isEditableParam); if (txtValue.getText().trim().length() > 0) butText.setEnabled(false); else butText.setEnabled(true); } } }); txtValue.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); butText = JOE_B_DetailForm_Text.Control(new Button(parameterGroup, SWT.NONE)); butText.setEnabled(false); butText.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { String ntext = ""; if (tableParams.getSelectionCount() > 0) { TableItem item = tableParams.getSelection()[0]; ntext = item.getText(2); } String text = sos.scheduler.editor.app.Utils.showClipboard(ntext, getShell(), true, ""); if (text != null && !text.trim().equalsIgnoreCase(ntext)) { paramText.setText(text); txtValue.setText(""); txtValue.setEnabled(false); butText.setEnabled(true); addParam(); } else if (text == null) { txtValue.setEnabled(true); butText.setEnabled(true); } else { txtValue.setEnabled(true); butText.setEnabled(false); } butApply.setEnabled(true); } }); // butText.setText("Text"); butApplyParam = JOE_B_DetailForm_ApplyParam.Control(new Button(parameterGroup, SWT.NONE)); butApplyParam.setEnabled(isEditableParam); butApplyParam.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { addParam(); } }); final GridData gridData_9 = new GridData(GridData.FILL, GridData.BEGINNING, false, false); butApplyParam.setLayoutData(gridData_9); // butApplyParam.setText("Apply"); tableParams = JOE_Tbl_DetailForm_Params.Control( new Table(parameterGroup, SWT.FULL_SELECTION | SWT.BORDER)); tableParams.setEnabled(false); tableParams.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { if (tableParams.getSelectionCount() > 0) { TableItem item = tableParams.getSelection()[0]; txtName.setText(item.getText(0)); // param value ist angegeben if (item.getText(1) != null && item.getText(1).trim().length() > 0) { paramText.setText(""); txtValue.setText(item.getText(1)); txtValue.setEnabled(true); butText.setEnabled(false); } // param Textknoten ist angegeben if (item.getText(2) != null && item.getText(2).trim().length() > 0) { paramText.setText(item.getText(2)); txtValue.setText(""); txtValue.setEnabled(false); butText.setEnabled(true); } if (item.getText(1).trim().equals("") && item.getText(2).trim().equals("")) { paramText.setText(""); txtValue.setText(""); txtValue.setEnabled(true); butText.setEnabled(true); } txtParamNote.setText( detailListener.getParamNote(item.getText(0), comboLanguage.getText())); butRemove.setEnabled(true); txtParamNote.setEnabled(true); isEditableParam = false; } else { butRemove.setEnabled(false); } } }); tableParams.setLinesVisible(true); tableParams.setHeaderVisible(true); final GridData gridData_4 = new GridData(GridData.FILL, GridData.FILL, true, true, 5, 7); tableParams.setLayoutData(gridData_4); final TableColumn newColumnTableColumn = JOE_TCl_DetailForm_NameColumn.Control(new TableColumn(tableParams, SWT.NONE)); // newColumnTableColumn.setText("Name"); newColumnTableColumn.setWidth(118); newColumnTableColumn.addControlListener( new ControlAdapter() { public void controlResized(final ControlEvent e) { w.saveTableColumn("tableParams", newColumnTableColumn); } }); w.restoreTableColumn("tableParams", newColumnTableColumn, 118); final TableColumn newColumnTableColumn_1 = JOE_TCl_DetailForm_ValueColumn.Control(new TableColumn(tableParams, SWT.NONE)); // newColumnTableColumn_1.setText("Value"); newColumnTableColumn_1.setWidth(150); newColumnTableColumn_1.addControlListener( new ControlAdapter() { public void controlResized(final ControlEvent e) { w.saveTableColumn("tableParams", newColumnTableColumn_1); } }); w.restoreTableColumn("tableParams", newColumnTableColumn_1, 150); final TableColumn newColumnTableColumn_2 = JOE_TCl_DetailForm_TextColumn.Control(new TableColumn(tableParams, SWT.NONE)); // newColumnTableColumn_2.setText("Text"); newColumnTableColumn_2.setWidth(100); newColumnTableColumn_2.addControlListener( new ControlAdapter() { public void controlResized(final ControlEvent e) { w.saveTableColumn("tableParams", newColumnTableColumn_2); } }); w.restoreTableColumn("tableParams", newColumnTableColumn_2, 100); final Button butNew = JOE_B_DetailForm_New.Control(new Button(parameterGroup, SWT.NONE)); butNew.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { txtName.setText(""); txtValue.setText(""); paramText.setText(""); txtValue.setEnabled(true); paramText.setEnabled(true); tableParams.deselectAll(); txtParamNote.setText(""); } }); butNew.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); // butNew.setText("New"); final Composite composite_2 = JOE_Composite1.Control(new Composite(parameterGroup, SWT.NONE)); final GridData gridData_2_1 = new GridData(GridData.CENTER, GridData.CENTER, false, false); gridData_2_1.heightHint = 67; composite_2.setLayoutData(gridData_2_1); composite_2.setLayout(new GridLayout()); butUp = JOE_B_DetailForm_Up.Control(new Button(composite_2, SWT.NONE)); butUp.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { detailListener.changeUp(tableParams); } }); butUp.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); butUp.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_up.gif")); butDown = JOE_B_DetailForm_Down.Control(new Button(composite_2, SWT.NONE)); butDown.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { detailListener.changeDown(tableParams); } }); butDown.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); butDown.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_down.gif")); final Button parameterButton = JOE_B_DetailForm_Wizard.Control(new Button(parameterGroup, SWT.NONE)); parameterButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { startWizzard(); } }); // parameterButton.setVisible(type != Editor.DETAILS); parameterButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); // parameterButton.setText("Wizard"); butRemove = JOE_B_DetailForm_Remove.Control(new Button(parameterGroup, SWT.NONE)); butRemove.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { if (tableParams.getSelectionCount() > 0) { detailListener.deleteParameter(tableParams, tableParams.getSelectionIndex()); txtParamNote.setText(""); txtName.setText(""); txtValue.setText(""); tableParams.deselectAll(); butRemove.setEnabled(false); txtParamNote.setText(""); isEditableParam = false; butApplyParam.setEnabled(isEditableParam); butApply.setEnabled(isEditable); txtName.setFocus(); if (gui != null) gui.updateParam(); } } }); final GridData gridData_8 = new GridData(GridData.FILL, GridData.BEGINNING, false, true); gridData_8.widthHint = 64; gridData_8.minimumWidth = 50; butRemove.setLayoutData(gridData_8); // butRemove.setText("Remove"); final Button butTemp = JOE_B_DetailForm_TempDocumentation.Control(new Button(parameterGroup, SWT.NONE)); butTemp.setLayoutData(new GridData()); // butTemp.setText("Documentation"); butTemp.setVisible(false); butApply = JOE_B_DetailForm_ApplyDetails.Control(new Button(parameterGroup, SWT.NONE)); butApply.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); butApply.setEnabled(isEditable); FontData fontDatas[] = butApply.getFont().getFontData(); FontData data = fontDatas[0]; butApply.setFont(new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD)); butApply.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { save(); } }); // butApply.setText("Apply Details"); cancelButton = JOE_B_DetailForm_Cancel.Control(new Button(parameterGroup, SWT.NONE)); cancelButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); cancelButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { saveWindowPosAndSize(); if (butApply.getEnabled()) { // int count = MainWindow.message(getShell(), // sos.scheduler.editor.app.Messages.getLabel("detailform.close"), SWT.ICON_WARNING // | SWT.OK int count = MainWindow.message( getShell(), JOE_M_0008.label(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL); if (count != SWT.OK) { return; } } getShell().dispose(); } }); // cancelButton.setText("Cancel"); txtParamNote = JOE_T_DetailForm_JobChainNote.Control( new Text( parameterGroup, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL)); txtParamNote.setEnabled(false); txtParamNote.addVerifyListener( new VerifyListener() { public void verifyText(final VerifyEvent e) { if (e.keyCode == 8 || e.keyCode == 127) { isEditableParam = true; butApplyParam.setEnabled(isEditableParam); } } }); txtParamNote.addModifyListener( new ModifyListener() { public void modifyText(final ModifyEvent e) { changeParameNote(); } }); final GridData gridData_5 = new GridData(GridData.FILL, GridData.FILL, true, true, 5, 3); gridData_5.heightHint = 73; txtParamNote.setLayoutData(gridData_5); comboLanguage = JOE_Cbo_DetailForm_Language.Control(new Combo(parameterGroup, SWT.READ_ONLY)); comboLanguage.setItems(new String[] {"de", "en"}); final GridData gridData_7 = new GridData(GridData.FILL, GridData.BEGINNING, false, true); comboLanguage.setLayoutData(gridData_7); comboLanguage.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { txtJobchainNote.setText(detailListener.getNote(comboLanguage.getText())); if (tableParams.getSelectionCount() > 0) { TableItem item = tableParams.getSelection()[0]; txtParamNote.setText( detailListener.getParamNote(item.getText(0), comboLanguage.getText())); } else if (txtName.getText() != null && txtName.getText().length() > 0) { txtParamNote.setText( detailListener.getParamNote(txtName.getText(), comboLanguage.getText())); } else if (txtParamNote.getText() != null && txtParamNote.getText().length() > 0) { txtParamNote.setText(""); } isEditable = false; isEditableParam = false; // butApply.setEnabled(isEditable); butApplyParam.setEnabled(isEditableParam); butRemove.setEnabled(false); } }); comboLanguage.select(0); butRefreshWizzardNoteParam = JOE_B_DetailForm_RefreshWizardNoteParam.Control(new Text(parameterGroup, SWT.CHECK)); butRefreshWizzardNoteParam.addModifyListener( new ModifyListener() { public void modifyText(final ModifyEvent e) { refreshTable(); } }); butRefreshWizzardNoteParam.setVisible(false); butRefreshWizzardNoteParam.setLayoutData(new GridData()); paramText = JOE_T_DetailForm_Param.Control(new Text(parameterGroup, SWT.BORDER)); paramText.setVisible(false); final GridData gridData_14 = new GridData(GridData.CENTER, GridData.BEGINNING, false, false); gridData_14.widthHint = 27; paramText.setLayoutData(gridData_14); jobChainGroup = JOE_G_DetailForm_NoteGroup.Control(new Group(parameterGroup, SWT.NONE)); jobChainGroup.setEnabled(false); // jobChainGroup.setText("Note"); final GridLayout gridLayout_1 = new GridLayout(); gridLayout_1.numColumns = 2; jobChainGroup.setLayout(gridLayout_1); final GridData gridData = new GridData(GridData.FILL, GridData.FILL, false, false, 6, 1); gridData.horizontalIndent = -1; jobChainGroup.setLayoutData(gridData); txtJobchainNote = JOE_T_DetailForm_JobChainNote.Control( new Text( jobChainGroup, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL)); txtJobchainNote.addModifyListener( new ModifyListener() { public void modifyText(final ModifyEvent e) { if (detailListener != null) { isEditable = true; if (gui != null) gui.updateNote(); detailListener.setNote(txtJobchainNote.getText(), comboLanguage.getText()); butApply.setEnabled(isEditable); } } }); final GridData gridData_2 = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 2); txtJobchainNote.setLayoutData(gridData_2); butXML = JOE_B_DetailForm_XML.Control(new Button(jobChainGroup, SWT.NONE)); butXML.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); butXML.setEnabled(false); butXML.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { try { if (dom != null && dom.isChanged()) { // MainWindow.message("Please save jobchain configuration file before // opening XML Editor.", SWT.ICON_ERROR); MainWindow.message(JOE_M_0020.label(), SWT.ICON_ERROR); return; } if (dom == null && butApply.isEnabled()) { // ungespeichert // int c = MainWindow.message("Should the current values be saved?", SWT.YES // | SWT.NO | SWT.ICON_ERROR); int c = MainWindow.message(JOE_M_0021.label(), SWT.YES | SWT.NO | SWT.ICON_ERROR); if (c == SWT.YES) detailListener.save(); } if (type == Editor.JOB_CHAINS) { DetailXMLEditorDialogForm dialog = new DetailXMLEditorDialogForm( detailListener.getConfigurationFilename(), jobChainname, state, _orderId, type, isLifeElement, path); dialog.showXMLEditor(); getShell().dispose(); } else { if (dom != null && dom.getFilename() != null && dom.getFilename().length() > 0) { DetailXMLEditorDialogForm dialog = new DetailXMLEditorDialogForm(dom, type, isLifeElement, path); dialog.setConfigurationData(confListener, tree, parent); dialog.showXMLEditor(); } else { // MainWindow.message("Please save jobchain configuration file before // opening XML Editor.", SWT.ICON_ERROR); MainWindow.message(JOE_M_0020.label(), SWT.ICON_ERROR); } } } catch (Exception ex) { try { // System.out.println("..error in " + sos.util.SOSClassUtil.getMethodName() // + ": " + ex.getMessage()); System.out.println( JOE_M_0010.params(sos.util.SOSClassUtil.getMethodName(), ex.getMessage())); new ErrorLog(JOE_M_0002.params(sos.util.SOSClassUtil.getMethodName()), ex); } catch (Exception ee) { // tu nichts } } } }); // butXML.setText("Open XML"); butDocumentation = JOE_B_DetailForm_Documentation.Control(new Button(jobChainGroup, SWT.NONE)); butDocumentation.setLayoutData( new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); butDocumentation.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { String filename = null; try { if (type == Editor.JOB_CHAINS) { filename = detailListener.getConfigurationFilename(); } else { if (dom != null) { filename = dom.getFilename(); } } if (filename != null && filename.length() > 0) { File file = new File(filename); if (file.exists()) { // Runtime.getRuntime().exec("cmd /C START iExplore ".concat(filename)); Program prog = Program.findProgram("html"); if (prog != null) { prog.execute(new File(filename).toURL().toString()); } else { String[] split = Options.getBrowserExec( new File(filename).toURL().toString(), Options.getLanguage()); Runtime.getRuntime().exec(split); } } else MainWindow.message(JOE_M_0013.params(file.getCanonicalPath()), SWT.ICON_ERROR); // MainWindow.message("Missing documentation " + file.getCanonicalPath(), // SWT.ICON_ERROR); } else MainWindow.message(JOE_M_0012.label(), SWT.ICON_ERROR); // MainWindow.message("Please save jobchain configuration before opening // documentation.", SWT.ICON_ERROR); } catch (Exception ex) { try { // System.out.println("..could not open file " + filename + " " + // ex.getMessage()); System.out.println( JOE_M_0011.params( sos.util.SOSClassUtil.getMethodName(), filename, ex.getMessage())); new ErrorLog( JOE_M_0011.params( sos.util.SOSClassUtil.getMethodName(), filename, ex.getMessage())); } catch (Exception ee) { // tu nichts } } } }); // butDocumentation.setText("Documentation"); final Label fileLabel = JOE_L_DetailForm_JobDocumentation.Control(new Label(parameterGroup, SWT.NONE)); fileLabel.setLayoutData(new GridData()); // fileLabel.setText("Job Documentation: "); txtParamsFile = JOE_T_DetailForm_ParamsFile.Control(new Text(parameterGroup, SWT.BORDER)); // txtParamsFile.addFocusListener(new FocusAdapter() { // public void focusGained(final FocusEvent e) { // txtParamsFile.selectAll(); // } // }); txtParamsFile.addModifyListener( new ModifyListener() { public void modifyText(final ModifyEvent e) { detailListener.setParamsFileName(txtParamsFile.getText()); if (gui != null) gui.updateNote(); butApply.setEnabled(isEditable); } }); txtParamsFile.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 4, 1)); statusBar = JOE_L_DetailForm_ConfigFile.Control(new Label(composite, SWT.BORDER)); final GridData gridData_11 = new GridData(GridData.FILL, GridData.END, false, false); gridData_11.widthHint = 496; gridData_11.heightHint = 18; statusBar.setLayoutData(gridData_11); // statusBar.setText("Configurations File:"); setToolTipText(); if (type == Editor.JOB_CHAINS) setEnabled_(false); setVisibility(); } catch (Exception e) { try { // new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + "cause: " + // e.toString(), e); new ErrorLog(JOE_M_0010.params(sos.util.SOSClassUtil.getMethodName(), e.toString()), e); } catch (Exception ee) { // tu nichts } } }
private void saveWindowPosAndSize() { w.saveWindow(); }