public JobEntryInterface open() { Shell parent = getParent(); display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); backupChanged = jobEntry.hasChanged(); createElements(); // Detect [X] or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); setActive(); BaseStepDialog.setSize(shell); int width = 750; int height = Const.isWindows() ? 730 : 720; shell.setSize(width, height); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return jobEntry; }
public JobEntryInterface open() { Shell parentShell = getParent(); Display display = parentShell.getDisplay(); shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; String datasets[] = null; AutoPopulate ap = new AutoPopulate(); try { datasets = ap.parseDatasetsRecordsets(this.jobMeta.getJobCopies()); } catch (Exception e) { System.out.println("Error Parsing existing Datasets"); System.out.println(e.toString()); datasets = new String[] {""}; } backupChanged = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText("Limit"); int middle = props.getMiddlePct(); int margin = Const.MARGIN; shell.setLayout(formLayout); shell.setText("Define an ECL Limit"); FormLayout groupLayout = new FormLayout(); groupLayout.marginWidth = 10; groupLayout.marginHeight = 10; // Stepname line Group generalGroup = new Group(shell, SWT.SHADOW_NONE); props.setLook(generalGroup); generalGroup.setText("General Details"); generalGroup.setLayout(groupLayout); FormData generalGroupFormat = new FormData(); generalGroupFormat.top = new FormAttachment(0, margin); generalGroupFormat.width = 400; generalGroupFormat.height = 100; generalGroupFormat.left = new FormAttachment(middle, 0); generalGroup.setLayoutData(generalGroupFormat); jobEntryName = buildText("Job Entry Name", null, lsMod, middle, margin, generalGroup); // All other contols Group limitGroup = new Group(shell, SWT.SHADOW_NONE); props.setLook(limitGroup); limitGroup.setText("Limit Details"); limitGroup.setLayout(groupLayout); FormData limitGroupFormat = new FormData(); limitGroupFormat.top = new FormAttachment(generalGroup, margin); limitGroupFormat.width = 400; limitGroupFormat.height = 300; limitGroupFormat.left = new FormAttachment(middle, 0); limitGroup.setLayoutData(limitGroupFormat); recordsetName = buildText("Result Recordset", null, lsMod, middle, margin, limitGroup); recordset = buildCombo("Recordset", recordsetName, lsMod, middle, margin, limitGroup, datasets); maxRecs = buildText("Maximum Records", recordset, lsMod, middle, margin, limitGroup); errorMessage = buildText("Error Message", maxRecs, lsMod, middle, margin, limitGroup); errorCode = buildText("Error Code", errorMessage, lsMod, middle, margin, limitGroup); // failClause = buildText("FAIL(<clause>)", maxRecs, lsMod, middle, margin, limitGroup); keyed = buildCombo( "KEYED", errorCode, lsMod, middle, margin, limitGroup, new String[] {"false", "true"}); count = buildCombo( "COUNT", keyed, lsMod, middle, margin, limitGroup, new String[] {"false", "true"}); skip = buildCombo( "SKIP", count, lsMod, middle, margin, limitGroup, new String[] {"false", "true"}); // onFailTransform = buildText("ONFAIL(<transform>)", skip, lsMod, middle, margin, limitGroup); wOK = new Button(shell, SWT.PUSH); wOK.setText("OK"); wCancel = new Button(shell, SWT.PUSH); wCancel.setText("Cancel"); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, limitGroup); // Add listeners Listener cancelListener = new Listener() { public void handleEvent(Event e) { cancel(); } }; Listener okListener = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, cancelListener); wOK.addListener(SWT.Selection, okListener); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); if (jobEntry.getName() != null) { jobEntryName.setText(jobEntry.getName()); } if (jobEntry.getRecordsetName() != null) { recordsetName.setText(jobEntry.getRecordsetName()); } if (jobEntry.getRecordset() != null) { recordset.setText(jobEntry.getRecordset()); } if (jobEntry.getMaxRecs() != null) { maxRecs.setText(jobEntry.getMaxRecs()); } // if (jobEntry.getFailClause() != null) { // failClause.setText(jobEntry.getFailClause()); // } if (jobEntry.getErrorCode() != null) { errorCode.setText(jobEntry.getErrorCode()); } if (jobEntry.getErrorMessage() != null) { errorMessage.setText(jobEntry.getErrorMessage()); } if (jobEntry.getKeyedString() != null) { keyed.setText(jobEntry.getKeyedString()); } if (jobEntry.getCountString() != null) { count.setText(jobEntry.getCountString()); } if (jobEntry.getSkipString() != null) { skip.setText(jobEntry.getSkipString()); } // if (jobEntry.getOnFailTransform() != null) { // onFailTransform.setText(jobEntry.getOnFailTransform()); // } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, 0); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, margin); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); // eMail address wMailAddress = new LabelTextVar( jobMeta, shell, BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.MailAddress.Label"), BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.MailAddress.Tooltip")); wMailAddress.addModifyListener(lsMod); fdMailAddress = new FormData(); fdMailAddress.left = new FormAttachment(0, 0); fdMailAddress.top = new FormAttachment(wName, margin); fdMailAddress.right = new FormAttachment(100, 0); wMailAddress.setLayoutData(fdMailAddress); // //////////////////////// // START OF Settings GROUP // //////////////////////// wSettingsGroup = new Group(shell, SWT.SHADOW_NONE); props.setLook(wSettingsGroup); wSettingsGroup.setText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Group.SettingsAddress.Label")); FormLayout SettingsgroupLayout = new FormLayout(); SettingsgroupLayout.marginWidth = 10; SettingsgroupLayout.marginHeight = 10; wSettingsGroup.setLayout(SettingsgroupLayout); // perform SMTP check? wlSMTPCheck = new Label(wSettingsGroup, SWT.RIGHT); wlSMTPCheck.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.SMTPCheck.Label")); props.setLook(wlSMTPCheck); fdlSMTPCheck = new FormData(); fdlSMTPCheck.left = new FormAttachment(0, 0); fdlSMTPCheck.top = new FormAttachment(wMailAddress, margin); fdlSMTPCheck.right = new FormAttachment(middle, -2 * margin); wlSMTPCheck.setLayoutData(fdlSMTPCheck); wSMTPCheck = new Button(wSettingsGroup, SWT.CHECK); props.setLook(wSMTPCheck); wSMTPCheck.setToolTipText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.SMTPCheck.Tooltip")); fdSMTPCheck = new FormData(); fdSMTPCheck.left = new FormAttachment(middle, -margin); fdSMTPCheck.top = new FormAttachment(wMailAddress, margin); wSMTPCheck.setLayoutData(fdSMTPCheck); wSMTPCheck.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { activeSMTPCheck(); } }); // TimeOut fieldname ... wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT); wlTimeOut.setText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.TimeOutField.Label")); props.setLook(wlTimeOut); fdlTimeOut = new FormData(); fdlTimeOut.left = new FormAttachment(0, 0); fdlTimeOut.right = new FormAttachment(middle, -2 * margin); fdlTimeOut.top = new FormAttachment(wSMTPCheck, margin); wlTimeOut.setLayoutData(fdlTimeOut); wTimeOut = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wTimeOut.setToolTipText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.TimeOutField.Tooltip")); props.setLook(wTimeOut); wTimeOut.addModifyListener(lsMod); fdTimeOut = new FormData(); fdTimeOut.left = new FormAttachment(middle, -margin); fdTimeOut.top = new FormAttachment(wSMTPCheck, margin); fdTimeOut.right = new FormAttachment(100, 0); wTimeOut.setLayoutData(fdTimeOut); // eMailSender fieldname ... wleMailSender = new Label(wSettingsGroup, SWT.RIGHT); wleMailSender.setText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.eMailSenderField.Label")); props.setLook(wleMailSender); fdleMailSender = new FormData(); fdleMailSender.left = new FormAttachment(0, 0); fdleMailSender.right = new FormAttachment(middle, -2 * margin); fdleMailSender.top = new FormAttachment(wTimeOut, margin); wleMailSender.setLayoutData(fdleMailSender); weMailSender = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); weMailSender.setToolTipText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.eMailSenderField.Tooltip")); props.setLook(weMailSender); weMailSender.addModifyListener(lsMod); fdeMailSender = new FormData(); fdeMailSender.left = new FormAttachment(middle, -margin); fdeMailSender.top = new FormAttachment(wTimeOut, margin); fdeMailSender.right = new FormAttachment(100, 0); weMailSender.setLayoutData(fdeMailSender); // DefaultSMTP fieldname ... wlDefaultSMTP = new Label(wSettingsGroup, SWT.RIGHT); wlDefaultSMTP.setText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.DefaultSMTPField.Label")); props.setLook(wlDefaultSMTP); fdlDefaultSMTP = new FormData(); fdlDefaultSMTP.left = new FormAttachment(0, 0); fdlDefaultSMTP.right = new FormAttachment(middle, -2 * margin); fdlDefaultSMTP.top = new FormAttachment(weMailSender, margin); wlDefaultSMTP.setLayoutData(fdlDefaultSMTP); wDefaultSMTP = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wDefaultSMTP.setToolTipText( BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.DefaultSMTPField.Tooltip")); props.setLook(wDefaultSMTP); wDefaultSMTP.addModifyListener(lsMod); fdDefaultSMTP = new FormData(); fdDefaultSMTP.left = new FormAttachment(middle, -margin); fdDefaultSMTP.top = new FormAttachment(weMailSender, margin); fdDefaultSMTP.right = new FormAttachment(100, 0); wDefaultSMTP.setLayoutData(fdDefaultSMTP); fdSettingsGroup = new FormData(); fdSettingsGroup.left = new FormAttachment(0, margin); fdSettingsGroup.top = new FormAttachment(wMailAddress, margin); fdSettingsGroup.right = new FormAttachment(100, -margin); wSettingsGroup.setLayoutData(fdSettingsGroup); // /////////////////////////////////////////////////////////// // / END OF Settings GROUP // /////////////////////////////////////////////////////////// wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); // at the bottom BaseStepDialog.positionBottomButtons( shell, new Button[] {wOK, wCancel}, margin, wSettingsGroup); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); activeSMTPCheck(); BaseStepDialog.setSize(shell); shell.open(); props.setDialogSize(shell, "JobSuccessDialogSize"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, -margin); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); wlFields = new Label(shell, SWT.NONE); wlFields.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.Label")); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); // fdlFields.right= new FormAttachment(middle, -margin); fdlFields.top = new FormAttachment(wName, 2 * margin); wlFields.setLayoutData(fdlFields); // Buttons to the right of the screen... wbdSourceFileFolder = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbdSourceFileFolder); wbdSourceFileFolder.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.DeleteEntry")); wbdSourceFileFolder.setToolTipText( BaseMessages.getString(PKG, "JobCheckDbConnections.DeleteSourceFileButton.Label")); fdbdSourceFileFolder = new FormData(); fdbdSourceFileFolder.right = new FormAttachment(100, -margin); fdbdSourceFileFolder.top = new FormAttachment(wlFields, 50); wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder); // Buttons to the right of the screen... wbgetConnections = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbgetConnections); wbgetConnections.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.GetConnections")); wbgetConnections.setToolTipText( BaseMessages.getString(PKG, "JobCheckDbConnections.GetConnections.Tooltip")); fdbgetConnections = new FormData(); fdbgetConnections.right = new FormAttachment(100, -margin); fdbgetConnections.top = new FormAttachment(wlFields, 20); wbgetConnections.setLayoutData(fdbgetConnections); addDatabases(); int rows = jobEntry.connections == null ? 1 : (jobEntry.connections.length == 0 ? 0 : jobEntry.connections.length); final int FieldsRows = rows; ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.Argument.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, connections, false), new ColumnInfo( BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.WaitFor.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo( BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.WaitForTime.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, JobEntryCheckDbConnections.unitTimeDesc, false), }; colinf[0].setToolTip(BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.Column")); colinf[1].setUsingVariables(true); colinf[1].setToolTip(BaseMessages.getString(PKG, "JobCheckDbConnections.WaitFor.ToolTip")); wFields = new TableView( jobMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(wbgetConnections, -margin); fdFields.bottom = new FormAttachment(100, -50); wFields.setLayoutData(fdFields); wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); FormData fd = new FormData(); fd.right = new FormAttachment(50, -10); fd.bottom = new FormAttachment(100, 0); fd.width = 100; wOK.setLayoutData(fd); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); fd = new FormData(); fd.left = new FormAttachment(50, 10); fd.bottom = new FormAttachment(100, 0); fd.width = 100; wCancel.setLayoutData(fd); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wFields); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; // Delete files from the list of files... wbdSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int idx[] = wFields.getSelectionIndices(); wFields.remove(idx); wFields.removeEmptyRows(); wFields.setRowNums(); } }); // get connections... wbgetConnections.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { getDatabases(); } }); wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); BaseStepDialog.setSize(shell); shell.open(); props.setDialogSize(shell, "JobCheckDbConnectionsDialogSize"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, 0); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); // Connection line wConnection = addConnectionLine(shell, wName, middle, margin); if (jobEntry.getDatabase() == null && jobMeta.nrDatabases() == 1) { wConnection.select(0); } wConnection.addModifyListener(lsMod); // Schema name line wlSchemaname = new Label(shell, SWT.RIGHT); wlSchemaname.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Schemaname.Label")); props.setLook(wlSchemaname); fdlSchemaname = new FormData(); fdlSchemaname.left = new FormAttachment(0, 0); fdlSchemaname.right = new FormAttachment(middle, 0); fdlSchemaname.top = new FormAttachment(wConnection, margin); wlSchemaname.setLayoutData(fdlSchemaname); wSchemaname = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wSchemaname); wSchemaname.setToolTipText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Schemaname.Tooltip")); wSchemaname.addModifyListener(lsMod); fdSchemaname = new FormData(); fdSchemaname.left = new FormAttachment(middle, 0); fdSchemaname.top = new FormAttachment(wConnection, margin); fdSchemaname.right = new FormAttachment(100, 0); wSchemaname.setLayoutData(fdSchemaname); // Table name line wlTablename = new Label(shell, SWT.RIGHT); wlTablename.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Tablename.Label")); props.setLook(wlTablename); fdlTablename = new FormData(); fdlTablename.left = new FormAttachment(0, 0); fdlTablename.right = new FormAttachment(middle, 0); fdlTablename.top = new FormAttachment(wSchemaname, margin); wlTablename.setLayoutData(fdlTablename); wbTable = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbTable); wbTable.setText(BaseMessages.getString(PKG, "System.Button.Browse")); FormData fdbTable = new FormData(); fdbTable.right = new FormAttachment(100, 0); fdbTable.top = new FormAttachment(wSchemaname, margin / 2); wbTable.setLayoutData(fdbTable); wbTable.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { getTableName(); } }); wTablename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wTablename); wTablename.addModifyListener(lsMod); fdTablename = new FormData(); fdTablename.left = new FormAttachment(middle, 0); fdTablename.top = new FormAttachment(wSchemaname, margin); fdTablename.right = new FormAttachment(wbTable, -margin); wTablename.setLayoutData(fdTablename); // Filename line wlFilename = new Label(shell, SWT.RIGHT); wlFilename.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Filename.Label")); props.setLook(wlFilename); fdlFilename = new FormData(); fdlFilename.left = new FormAttachment(0, 0); fdlFilename.top = new FormAttachment(wTablename, margin); fdlFilename.right = new FormAttachment(middle, -margin); wlFilename.setLayoutData(fdlFilename); wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbFilename); wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse")); fdbFilename = new FormData(); fdbFilename.right = new FormAttachment(100, 0); fdbFilename.top = new FormAttachment(wTablename, 0); wbFilename.setLayoutData(fdbFilename); wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wFilename); wFilename.addModifyListener(lsMod); fdFilename = new FormData(); fdFilename.left = new FormAttachment(middle, 0); fdFilename.top = new FormAttachment(wTablename, margin); fdFilename.right = new FormAttachment(wbFilename, -margin); wFilename.setLayoutData(fdFilename); // Whenever something changes, set the tooltip to the expanded version: wFilename.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText())); } }); wbFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.txt", "*.csv", "*"}); if (wFilename.getText() != null) { dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText())); } dialog.setFilterNames(FILETYPES); if (dialog.open() != null) { wFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName()); } } }); // Local wlLocalInfile = new Label(shell, SWT.RIGHT); wlLocalInfile.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.LocalInfile.Label")); props.setLook(wlLocalInfile); fdlLocalInfile = new FormData(); fdlLocalInfile.left = new FormAttachment(0, 0); fdlLocalInfile.top = new FormAttachment(wFilename, margin); fdlLocalInfile.right = new FormAttachment(middle, -margin); wlLocalInfile.setLayoutData(fdlLocalInfile); wLocalInfile = new Button(shell, SWT.CHECK); props.setLook(wLocalInfile); wLocalInfile.setToolTipText( BaseMessages.getString(PKG, "JobMysqlBulkLoad.LocalInfile.Tooltip")); fdLocalInfile = new FormData(); fdLocalInfile.left = new FormAttachment(middle, 0); fdLocalInfile.top = new FormAttachment(wFilename, margin); fdLocalInfile.right = new FormAttachment(100, 0); wLocalInfile.setLayoutData(fdLocalInfile); wLocalInfile.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); // Priority wlProrityValue = new Label(shell, SWT.RIGHT); wlProrityValue.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.ProrityValue.Label")); props.setLook(wlProrityValue); fdlProrityValue = new FormData(); fdlProrityValue.left = new FormAttachment(0, 0); fdlProrityValue.right = new FormAttachment(middle, 0); fdlProrityValue.top = new FormAttachment(wLocalInfile, margin); wlProrityValue.setLayoutData(fdlProrityValue); wProrityValue = new CCombo(shell, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wProrityValue.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.NorProrityValue.Label")); wProrityValue.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.LowProrityValue.Label")); wProrityValue.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.ConProrityValue.Label")); wProrityValue.select(0); // +1: starts at -1 props.setLook(wProrityValue); fdProrityValue = new FormData(); fdProrityValue.left = new FormAttachment(middle, 0); fdProrityValue.top = new FormAttachment(wLocalInfile, margin); fdProrityValue.right = new FormAttachment(100, 0); wProrityValue.setLayoutData(fdProrityValue); fdProrityValue = new FormData(); fdProrityValue.left = new FormAttachment(middle, 0); fdProrityValue.top = new FormAttachment(wLocalInfile, margin); fdProrityValue.right = new FormAttachment(100, 0); wProrityValue.setLayoutData(fdProrityValue); // Separator wlSeparator = new Label(shell, SWT.RIGHT); wlSeparator.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Separator.Label")); props.setLook(wlSeparator); fdlSeparator = new FormData(); fdlSeparator.left = new FormAttachment(0, 0); fdlSeparator.right = new FormAttachment(middle, 0); fdlSeparator.top = new FormAttachment(wProrityValue, margin); wlSeparator.setLayoutData(fdlSeparator); wSeparator = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wSeparator); wSeparator.addModifyListener(lsMod); fdSeparator = new FormData(); fdSeparator.left = new FormAttachment(middle, 0); fdSeparator.top = new FormAttachment(wProrityValue, margin); fdSeparator.right = new FormAttachment(100, 0); wSeparator.setLayoutData(fdSeparator); // enclosed wlEnclosed = new Label(shell, SWT.RIGHT); wlEnclosed.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Enclosed.Label")); props.setLook(wlEnclosed); fdlEnclosed = new FormData(); fdlEnclosed.left = new FormAttachment(0, 0); fdlEnclosed.right = new FormAttachment(middle, 0); fdlEnclosed.top = new FormAttachment(wSeparator, margin); wlEnclosed.setLayoutData(fdlEnclosed); wEnclosed = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wEnclosed); wEnclosed.addModifyListener(lsMod); fdEnclosed = new FormData(); fdEnclosed.left = new FormAttachment(middle, 0); fdEnclosed.top = new FormAttachment(wSeparator, margin); fdEnclosed.right = new FormAttachment(100, 0); wEnclosed.setLayoutData(fdEnclosed); // escaped wlEscaped = new Label(shell, SWT.RIGHT); wlEscaped.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Escaped.Label")); props.setLook(wlEscaped); fdlEscaped = new FormData(); fdlEscaped.left = new FormAttachment(0, 0); fdlEscaped.right = new FormAttachment(middle, 0); fdlEscaped.top = new FormAttachment(wEnclosed, margin); wlEscaped.setLayoutData(fdlEscaped); wEscaped = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wEscaped); wEscaped.setToolTipText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Escaped.Tooltip")); wEscaped.addModifyListener(lsMod); fdEscaped = new FormData(); fdEscaped.left = new FormAttachment(middle, 0); fdEscaped.top = new FormAttachment(wEnclosed, margin); fdEscaped.right = new FormAttachment(100, 0); wEscaped.setLayoutData(fdEscaped); // Line started wlLinestarted = new Label(shell, SWT.RIGHT); wlLinestarted.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Linestarted.Label")); props.setLook(wlLinestarted); fdlLinestarted = new FormData(); fdlLinestarted.left = new FormAttachment(0, 0); fdlLinestarted.right = new FormAttachment(middle, 0); fdlLinestarted.top = new FormAttachment(wEscaped, margin); wlLinestarted.setLayoutData(fdlLinestarted); wLinestarted = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wLinestarted); wLinestarted.addModifyListener(lsMod); fdLinestarted = new FormData(); fdLinestarted.left = new FormAttachment(middle, 0); fdLinestarted.top = new FormAttachment(wEscaped, margin); fdLinestarted.right = new FormAttachment(100, 0); wLinestarted.setLayoutData(fdLinestarted); // Line terminated wlLineterminated = new Label(shell, SWT.RIGHT); wlLineterminated.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Lineterminated.Label")); props.setLook(wlLineterminated); fdlLineterminated = new FormData(); fdlLineterminated.left = new FormAttachment(0, 0); fdlLineterminated.right = new FormAttachment(middle, 0); fdlLineterminated.top = new FormAttachment(wLinestarted, margin); wlLineterminated.setLayoutData(fdlLineterminated); wLineterminated = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wLineterminated); wLineterminated.addModifyListener(lsMod); fdLineterminated = new FormData(); fdLineterminated.left = new FormAttachment(middle, 0); fdLineterminated.top = new FormAttachment(wLinestarted, margin); fdLineterminated.right = new FormAttachment(100, 0); wLineterminated.setLayoutData(fdLineterminated); // List of columns to set for wlListattribut = new Label(shell, SWT.RIGHT); wlListattribut.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Listattribut.Label")); props.setLook(wlListattribut); fdlListattribut = new FormData(); fdlListattribut.left = new FormAttachment(0, 0); fdlListattribut.right = new FormAttachment(middle, 0); fdlListattribut.top = new FormAttachment(wLineterminated, margin); wlListattribut.setLayoutData(fdlListattribut); wbListattribut = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbListattribut); wbListattribut.setText(BaseMessages.getString(PKG, "System.Button.Edit")); FormData fdbListattribut = new FormData(); fdbListattribut.right = new FormAttachment(100, 0); fdbListattribut.top = new FormAttachment(wLineterminated, margin); wbListattribut.setLayoutData(fdbListattribut); wbListattribut.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { getListColumns(); } }); wListattribut = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wListattribut); wListattribut.setToolTipText( BaseMessages.getString(PKG, "JobMysqlBulkLoad.Listattribut.Tooltip")); wListattribut.addModifyListener(lsMod); fdListattribut = new FormData(); fdListattribut.left = new FormAttachment(middle, 0); fdListattribut.top = new FormAttachment(wLineterminated, margin); fdListattribut.right = new FormAttachment(wbListattribut, -margin); wListattribut.setLayoutData(fdListattribut); // Replace data wlReplacedata = new Label(shell, SWT.RIGHT); wlReplacedata.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Replacedata.Label")); props.setLook(wlReplacedata); fdlReplacedata = new FormData(); fdlReplacedata.left = new FormAttachment(0, 0); fdlReplacedata.top = new FormAttachment(wListattribut, margin); fdlReplacedata.right = new FormAttachment(middle, -margin); wlReplacedata.setLayoutData(fdlReplacedata); wReplacedata = new Button(shell, SWT.CHECK); props.setLook(wReplacedata); wReplacedata.setToolTipText( BaseMessages.getString(PKG, "JobMysqlBulkLoad.Replacedata.Tooltip")); fdReplacedata = new FormData(); fdReplacedata.left = new FormAttachment(middle, 0); fdReplacedata.top = new FormAttachment(wListattribut, margin); fdReplacedata.right = new FormAttachment(100, 0); wReplacedata.setLayoutData(fdReplacedata); wReplacedata.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); // Nbr of lines to ignore wlIgnorelines = new Label(shell, SWT.RIGHT); wlIgnorelines.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Ignorelines.Label")); props.setLook(wlIgnorelines); fdlIgnorelines = new FormData(); fdlIgnorelines.left = new FormAttachment(0, 0); fdlIgnorelines.right = new FormAttachment(middle, 0); fdlIgnorelines.top = new FormAttachment(wReplacedata, margin); wlIgnorelines.setLayoutData(fdlIgnorelines); wIgnorelines = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wIgnorelines); wIgnorelines.addModifyListener(lsMod); fdIgnorelines = new FormData(); fdIgnorelines.left = new FormAttachment(middle, 0); fdIgnorelines.top = new FormAttachment(wReplacedata, margin); fdIgnorelines.right = new FormAttachment(100, 0); wIgnorelines.setLayoutData(fdIgnorelines); // fileresult grouping? // //////////////////////// // START OF FileResult GROUP/// // / wFileResult = new Group(shell, SWT.SHADOW_NONE); props.setLook(wFileResult); wFileResult.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.FileResult.Group.Label")); FormLayout groupLayout = new FormLayout(); groupLayout.marginWidth = 10; groupLayout.marginHeight = 10; wFileResult.setLayout(groupLayout); // Add file to result wlAddFileToResult = new Label(wFileResult, SWT.RIGHT); wlAddFileToResult.setText( BaseMessages.getString(PKG, "JobMysqlBulkLoad.AddFileToResult.Label")); props.setLook(wlAddFileToResult); fdlAddFileToResult = new FormData(); fdlAddFileToResult.left = new FormAttachment(0, 0); fdlAddFileToResult.top = new FormAttachment(wIgnorelines, margin); fdlAddFileToResult.right = new FormAttachment(middle, -margin); wlAddFileToResult.setLayoutData(fdlAddFileToResult); wAddFileToResult = new Button(wFileResult, SWT.CHECK); props.setLook(wAddFileToResult); wAddFileToResult.setToolTipText( BaseMessages.getString(PKG, "JobMysqlBulkLoad.AddFileToResult.Tooltip")); fdAddFileToResult = new FormData(); fdAddFileToResult.left = new FormAttachment(middle, 0); fdAddFileToResult.top = new FormAttachment(wIgnorelines, margin); fdAddFileToResult.right = new FormAttachment(100, 0); wAddFileToResult.setLayoutData(fdAddFileToResult); wAddFileToResult.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); fdFileResult = new FormData(); fdFileResult.left = new FormAttachment(0, margin); fdFileResult.top = new FormAttachment(wIgnorelines, margin); fdFileResult.right = new FormAttachment(100, -margin); wFileResult.setLayoutData(fdFileResult); // /////////////////////////////////////////////////////////// // / END OF FilesRsult GROUP // /////////////////////////////////////////////////////////// wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); FormData fd = new FormData(); fd.right = new FormAttachment(50, -10); fd.bottom = new FormAttachment(100, 0); fd.width = 100; wOK.setLayoutData(fd); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); fd = new FormData(); fd.left = new FormAttachment(50, 10); fd.bottom = new FormAttachment(100, 0); fd.width = 100; wCancel.setLayoutData(fd); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); wTablename.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); BaseStepDialog.setSize(shell); shell.open(); props.setDialogSize(shell, "JobMysqlBulkLoadDialogSize"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "JobWaitForFile.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(BaseMessages.getString(PKG, "JobWaitForFile.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, -margin); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); // Filename line wlFilename = new Label(shell, SWT.RIGHT); wlFilename.setText(BaseMessages.getString(PKG, "JobWaitForFile.Filename.Label")); props.setLook(wlFilename); fdlFilename = new FormData(); fdlFilename.left = new FormAttachment(0, 0); fdlFilename.top = new FormAttachment(wName, margin); fdlFilename.right = new FormAttachment(middle, -margin); wlFilename.setLayoutData(fdlFilename); wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbFilename); wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse")); fdbFilename = new FormData(); fdbFilename.right = new FormAttachment(100, 0); fdbFilename.top = new FormAttachment(wName, 0); wbFilename.setLayoutData(fdbFilename); wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wFilename); wFilename.addModifyListener(lsMod); fdFilename = new FormData(); fdFilename.left = new FormAttachment(middle, 0); fdFilename.top = new FormAttachment(wName, margin); fdFilename.right = new FormAttachment(wbFilename, -margin); wFilename.setLayoutData(fdFilename); // Whenever something changes, set the tooltip to the expanded version: wFilename.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText())); } }); wbFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*"}); if (wFilename.getText() != null) { dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText())); } dialog.setFilterNames(FILETYPES); if (dialog.open() != null) { wFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName()); } } }); // Maximum timeout wlMaximumTimeout = new Label(shell, SWT.RIGHT); wlMaximumTimeout.setText(BaseMessages.getString(PKG, "JobWaitForFile.MaximumTimeout.Label")); props.setLook(wlMaximumTimeout); fdlMaximumTimeout = new FormData(); fdlMaximumTimeout.left = new FormAttachment(0, 0); fdlMaximumTimeout.top = new FormAttachment(wFilename, margin); fdlMaximumTimeout.right = new FormAttachment(middle, -margin); wlMaximumTimeout.setLayoutData(fdlMaximumTimeout); wMaximumTimeout = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wMaximumTimeout); wMaximumTimeout.setToolTipText( BaseMessages.getString(PKG, "JobWaitForFile.MaximumTimeout.Tooltip")); wMaximumTimeout.addModifyListener(lsMod); fdMaximumTimeout = new FormData(); fdMaximumTimeout.left = new FormAttachment(middle, 0); fdMaximumTimeout.top = new FormAttachment(wFilename, margin); fdMaximumTimeout.right = new FormAttachment(100, 0); wMaximumTimeout.setLayoutData(fdMaximumTimeout); // Cycle time wlCheckCycleTime = new Label(shell, SWT.RIGHT); wlCheckCycleTime.setText(BaseMessages.getString(PKG, "JobWaitForFile.CheckCycleTime.Label")); props.setLook(wlCheckCycleTime); fdlCheckCycleTime = new FormData(); fdlCheckCycleTime.left = new FormAttachment(0, 0); fdlCheckCycleTime.top = new FormAttachment(wMaximumTimeout, margin); fdlCheckCycleTime.right = new FormAttachment(middle, -margin); wlCheckCycleTime.setLayoutData(fdlCheckCycleTime); wCheckCycleTime = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wCheckCycleTime); wCheckCycleTime.setToolTipText( BaseMessages.getString(PKG, "JobWaitForFile.CheckCycleTime.Tooltip")); wCheckCycleTime.addModifyListener(lsMod); fdCheckCycleTime = new FormData(); fdCheckCycleTime.left = new FormAttachment(middle, 0); fdCheckCycleTime.top = new FormAttachment(wMaximumTimeout, margin); fdCheckCycleTime.right = new FormAttachment(100, 0); wCheckCycleTime.setLayoutData(fdCheckCycleTime); // Success on timeout wlSuccesOnTimeout = new Label(shell, SWT.RIGHT); wlSuccesOnTimeout.setText(BaseMessages.getString(PKG, "JobWaitForFile.SuccessOnTimeout.Label")); props.setLook(wlSuccesOnTimeout); fdlSuccesOnTimeout = new FormData(); fdlSuccesOnTimeout.left = new FormAttachment(0, 0); fdlSuccesOnTimeout.top = new FormAttachment(wCheckCycleTime, margin); fdlSuccesOnTimeout.right = new FormAttachment(middle, -margin); wlSuccesOnTimeout.setLayoutData(fdlSuccesOnTimeout); wSuccesOnTimeout = new Button(shell, SWT.CHECK); props.setLook(wSuccesOnTimeout); wSuccesOnTimeout.setToolTipText( BaseMessages.getString(PKG, "JobWaitForFile.SuccessOnTimeout.Tooltip")); fdSuccesOnTimeout = new FormData(); fdSuccesOnTimeout.left = new FormAttachment(middle, 0); fdSuccesOnTimeout.top = new FormAttachment(wCheckCycleTime, margin); fdSuccesOnTimeout.right = new FormAttachment(100, 0); wSuccesOnTimeout.setLayoutData(fdSuccesOnTimeout); wSuccesOnTimeout.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); // Check file size wlFileSizeCheck = new Label(shell, SWT.RIGHT); wlFileSizeCheck.setText(BaseMessages.getString(PKG, "JobWaitForFile.FileSizeCheck.Label")); props.setLook(wlFileSizeCheck); fdlFileSizeCheck = new FormData(); fdlFileSizeCheck.left = new FormAttachment(0, 0); fdlFileSizeCheck.top = new FormAttachment(wSuccesOnTimeout, margin); fdlFileSizeCheck.right = new FormAttachment(middle, -margin); wlFileSizeCheck.setLayoutData(fdlFileSizeCheck); wFileSizeCheck = new Button(shell, SWT.CHECK); props.setLook(wFileSizeCheck); wFileSizeCheck.setToolTipText( BaseMessages.getString(PKG, "JobWaitForFile.FileSizeCheck.Tooltip")); fdFileSizeCheck = new FormData(); fdFileSizeCheck.left = new FormAttachment(middle, 0); fdFileSizeCheck.top = new FormAttachment(wSuccesOnTimeout, margin); fdFileSizeCheck.right = new FormAttachment(100, 0); wFileSizeCheck.setLayoutData(fdFileSizeCheck); wFileSizeCheck.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); // Add filename to result filenames wlAddFilenameResult = new Label(shell, SWT.RIGHT); wlAddFilenameResult.setText( BaseMessages.getString(PKG, "JobWaitForFile.AddFilenameResult.Label")); props.setLook(wlAddFilenameResult); fdlAddFilenameResult = new FormData(); fdlAddFilenameResult.left = new FormAttachment(0, 0); fdlAddFilenameResult.top = new FormAttachment(wFileSizeCheck, margin); fdlAddFilenameResult.right = new FormAttachment(middle, -margin); wlAddFilenameResult.setLayoutData(fdlAddFilenameResult); wAddFilenameResult = new Button(shell, SWT.CHECK); props.setLook(wAddFilenameResult); wAddFilenameResult.setToolTipText( BaseMessages.getString(PKG, "JobWaitForFile.AddFilenameResult.Tooltip")); fdAddFilenameResult = new FormData(); fdAddFilenameResult.left = new FormAttachment(middle, 0); fdAddFilenameResult.top = new FormAttachment(wFileSizeCheck, margin); fdAddFilenameResult.right = new FormAttachment(100, 0); wAddFilenameResult.setLayoutData(fdAddFilenameResult); wAddFilenameResult.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); BaseStepDialog.positionBottomButtons( shell, new Button[] {wOK, wCancel}, margin, wAddFilenameResult); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); wFilename.addSelectionListener(lsDef); wMaximumTimeout.addSelectionListener(lsDef); wCheckCycleTime.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); BaseStepDialog.setSize(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(Messages.getString("JobXMLWellFormed.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(Messages.getString("JobXMLWellFormed.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, -margin); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); wTabFolder = new CTabFolder(shell, SWT.BORDER); props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB); ////////////////////////// // START OF GENERAL TAB /// ////////////////////////// wGeneralTab = new CTabItem(wTabFolder, SWT.NONE); wGeneralTab.setText(Messages.getString("JobXMLWellFormed.Tab.General.Label")); wGeneralComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wGeneralComp); FormLayout generalLayout = new FormLayout(); generalLayout.marginWidth = 3; generalLayout.marginHeight = 3; wGeneralComp.setLayout(generalLayout); // SETTINGS grouping? // //////////////////////// // START OF SETTINGS GROUP // wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE); props.setLook(wSettings); wSettings.setText(Messages.getString("JobXMLWellFormed.Settings.Label")); FormLayout groupLayout = new FormLayout(); groupLayout.marginWidth = 10; groupLayout.marginHeight = 10; wSettings.setLayout(groupLayout); wlIncludeSubfolders = new Label(wSettings, SWT.RIGHT); wlIncludeSubfolders.setText(Messages.getString("JobXMLWellFormed.IncludeSubfolders.Label")); props.setLook(wlIncludeSubfolders); fdlIncludeSubfolders = new FormData(); fdlIncludeSubfolders.left = new FormAttachment(0, 0); fdlIncludeSubfolders.top = new FormAttachment(wName, margin); fdlIncludeSubfolders.right = new FormAttachment(middle, -margin); wlIncludeSubfolders.setLayoutData(fdlIncludeSubfolders); wIncludeSubfolders = new Button(wSettings, SWT.CHECK); props.setLook(wIncludeSubfolders); wIncludeSubfolders.setToolTipText( Messages.getString("JobXMLWellFormed.IncludeSubfolders.Tooltip")); fdIncludeSubfolders = new FormData(); fdIncludeSubfolders.left = new FormAttachment(middle, 0); fdIncludeSubfolders.top = new FormAttachment(wName, margin); fdIncludeSubfolders.right = new FormAttachment(100, 0); wIncludeSubfolders.setLayoutData(fdIncludeSubfolders); wIncludeSubfolders.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { jobEntry.setChanged(); } }); // previous wlPrevious = new Label(wSettings, SWT.RIGHT); wlPrevious.setText(Messages.getString("JobXMLWellFormed.Previous.Label")); props.setLook(wlPrevious); fdlPrevious = new FormData(); fdlPrevious.left = new FormAttachment(0, 0); fdlPrevious.top = new FormAttachment(wIncludeSubfolders, margin); fdlPrevious.right = new FormAttachment(middle, -margin); wlPrevious.setLayoutData(fdlPrevious); wPrevious = new Button(wSettings, SWT.CHECK); props.setLook(wPrevious); wPrevious.setSelection(jobEntry.arg_from_previous); wPrevious.setToolTipText(Messages.getString("JobXMLWellFormed.Previous.Tooltip")); fdPrevious = new FormData(); fdPrevious.left = new FormAttachment(middle, 0); fdPrevious.top = new FormAttachment(wIncludeSubfolders, margin); fdPrevious.right = new FormAttachment(100, 0); wPrevious.setLayoutData(fdPrevious); wPrevious.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { RefreshArgFromPrevious(); } }); fdSettings = new FormData(); fdSettings.left = new FormAttachment(0, margin); fdSettings.top = new FormAttachment(wName, margin); fdSettings.right = new FormAttachment(100, -margin); wSettings.setLayoutData(fdSettings); // /////////////////////////////////////////////////////////// // / END OF SETTINGS GROUP // /////////////////////////////////////////////////////////// // SourceFileFolder line wlSourceFileFolder = new Label(wGeneralComp, SWT.RIGHT); wlSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.SourceFileFolder.Label")); props.setLook(wlSourceFileFolder); fdlSourceFileFolder = new FormData(); fdlSourceFileFolder.left = new FormAttachment(0, 0); fdlSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin); fdlSourceFileFolder.right = new FormAttachment(middle, -margin); wlSourceFileFolder.setLayoutData(fdlSourceFileFolder); // Browse Source folders button ... wbSourceDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbSourceDirectory); wbSourceDirectory.setText(Messages.getString("JobXMLWellFormed.BrowseFolders.Label")); fdbSourceDirectory = new FormData(); fdbSourceDirectory.right = new FormAttachment(100, 0); fdbSourceDirectory.top = new FormAttachment(wSettings, margin); wbSourceDirectory.setLayoutData(fdbSourceDirectory); wbSourceDirectory.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN); if (wSourceFileFolder.getText() != null) { ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceFileFolder.getText())); } // Calling open() will open and run the dialog. // It will return the selected directory, or // null if user cancels String dir = ddialog.open(); if (dir != null) { // Set the text box to the new selection wSourceFileFolder.setText(dir); } } }); // Browse Source files button ... wbSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbSourceFileFolder); wbSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.BrowseFiles.Label")); fdbSourceFileFolder = new FormData(); fdbSourceFileFolder.right = new FormAttachment(wbSourceDirectory, -margin); fdbSourceFileFolder.top = new FormAttachment(wSettings, margin); wbSourceFileFolder.setLayoutData(fdbSourceFileFolder); // Browse Destination file add button ... wbaSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbaSourceFileFolder); wbaSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameAdd.Button")); fdbaSourceFileFolder = new FormData(); fdbaSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -margin); fdbaSourceFileFolder.top = new FormAttachment(wSettings, margin); wbaSourceFileFolder.setLayoutData(fdbaSourceFileFolder); wSourceFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wSourceFileFolder.setToolTipText( Messages.getString("JobXMLWellFormed.SourceFileFolder.Tooltip")); props.setLook(wSourceFileFolder); wSourceFileFolder.addModifyListener(lsMod); fdSourceFileFolder = new FormData(); fdSourceFileFolder.left = new FormAttachment(middle, 0); fdSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin); fdSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -55); wSourceFileFolder.setLayoutData(fdSourceFileFolder); // Whenever something changes, set the tooltip to the expanded version: wSourceFileFolder.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wSourceFileFolder.setToolTipText( jobMeta.environmentSubstitute(wSourceFileFolder.getText())); } }); wbSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.xml;*.XML", "*"}); if (wSourceFileFolder.getText() != null) { dialog.setFileName(jobMeta.environmentSubstitute(wSourceFileFolder.getText())); } dialog.setFilterNames(FILETYPES); if (dialog.open() != null) { wSourceFileFolder.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName()); } } }); // Buttons to the right of the screen... wbdSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbdSourceFileFolder); wbdSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameDelete.Button")); wbdSourceFileFolder.setToolTipText( Messages.getString("JobXMLWellFormed.FilenameDelete.Tooltip")); fdbdSourceFileFolder = new FormData(); fdbdSourceFileFolder.right = new FormAttachment(100, 0); fdbdSourceFileFolder.top = new FormAttachment(wSourceFileFolder, 40); wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder); wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER); props.setLook(wbeSourceFileFolder); wbeSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameEdit.Button")); wbeSourceFileFolder.setToolTipText(Messages.getString("JobXMLWellFormed.FilenameEdit.Tooltip")); fdbeSourceFileFolder = new FormData(); fdbeSourceFileFolder.right = new FormAttachment(100, 0); fdbeSourceFileFolder.left = new FormAttachment(wbdSourceFileFolder, 0, SWT.LEFT); fdbeSourceFileFolder.top = new FormAttachment(wbdSourceFileFolder, margin); wbeSourceFileFolder.setLayoutData(fdbeSourceFileFolder); // Wildcard wlWildcard = new Label(wGeneralComp, SWT.RIGHT); wlWildcard.setText(Messages.getString("JobXMLWellFormed.Wildcard.Label")); props.setLook(wlWildcard); fdlWildcard = new FormData(); fdlWildcard.left = new FormAttachment(0, 0); fdlWildcard.top = new FormAttachment(wSourceFileFolder, margin); fdlWildcard.right = new FormAttachment(middle, -margin); wlWildcard.setLayoutData(fdlWildcard); wWildcard = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wWildcard.setToolTipText(Messages.getString("JobXMLWellFormed.Wildcard.Tooltip")); props.setLook(wWildcard); wWildcard.addModifyListener(lsMod); fdWildcard = new FormData(); fdWildcard.left = new FormAttachment(middle, 0); fdWildcard.top = new FormAttachment(wSourceFileFolder, margin); fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55); wWildcard.setLayoutData(fdWildcard); wlFields = new Label(wGeneralComp, SWT.NONE); wlFields.setText(Messages.getString("JobXMLWellFormed.Fields.Label")); props.setLook(wlFields); fdlFields = new FormData(); fdlFields.left = new FormAttachment(0, 0); fdlFields.right = new FormAttachment(middle, -margin); fdlFields.top = new FormAttachment(wWildcard, margin); wlFields.setLayoutData(fdlFields); int rows = jobEntry.source_filefolder == null ? 1 : (jobEntry.source_filefolder.length == 0 ? 0 : jobEntry.source_filefolder.length); final int FieldsRows = rows; ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo( Messages.getString("JobXMLWellFormed.Fields.SourceFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo( Messages.getString("JobXMLWellFormed.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), }; colinf[0].setUsingVariables(true); colinf[0].setToolTip(Messages.getString("JobXMLWellFormed.Fields.SourceFileFolder.Tooltip")); colinf[1].setUsingVariables(true); colinf[1].setToolTip(Messages.getString("JobXMLWellFormed.Fields.Wildcard.Tooltip")); wFields = new TableView( jobMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(100, -75); fdFields.bottom = new FormAttachment(100, -margin); wFields.setLayoutData(fdFields); RefreshArgFromPrevious(); // Add the file to the list of files... SelectionAdapter selA = new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { wFields.add(new String[] {wSourceFileFolder.getText(), wWildcard.getText()}); wSourceFileFolder.setText(""); wWildcard.setText(""); wFields.removeEmptyRows(); wFields.setRowNums(); wFields.optWidth(true); } }; wbaSourceFileFolder.addSelectionListener(selA); wSourceFileFolder.addSelectionListener(selA); // Delete files from the list of files... wbdSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int idx[] = wFields.getSelectionIndices(); wFields.remove(idx); wFields.removeEmptyRows(); wFields.setRowNums(); } }); // Edit the selected file & remove from the list... wbeSourceFileFolder.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { int idx = wFields.getSelectionIndex(); if (idx >= 0) { String string[] = wFields.getItem(idx); wSourceFileFolder.setText(string[0]); wWildcard.setText(string[1]); wFields.remove(idx); } wFields.removeEmptyRows(); wFields.setRowNums(); } }); fdGeneralComp = new FormData(); fdGeneralComp.left = new FormAttachment(0, 0); fdGeneralComp.top = new FormAttachment(0, 0); fdGeneralComp.right = new FormAttachment(100, 0); fdGeneralComp.bottom = new FormAttachment(100, 0); wGeneralComp.setLayoutData(fdGeneralComp); wGeneralComp.layout(); wGeneralTab.setControl(wGeneralComp); props.setLook(wGeneralComp); ///////////////////////////////////////////////////////////// /// END OF GENERAL TAB ///////////////////////////////////////////////////////////// ////////////////////////////////////// // START OF ADVANCED TAB /// ///////////////////////////////////// wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE); wAdvancedTab.setText(Messages.getString("JobXMLWellFormed.Tab.Advanced.Label")); FormLayout contentLayout = new FormLayout(); contentLayout.marginWidth = 3; contentLayout.marginHeight = 3; wAdvancedComp = new Composite(wTabFolder, SWT.NONE); props.setLook(wAdvancedComp); wAdvancedComp.setLayout(contentLayout); // SuccessOngrouping? // //////////////////////// // START OF SUCCESS ON GROUP/// // / wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE); props.setLook(wSuccessOn); wSuccessOn.setText(Messages.getString("JobXMLWellFormed.SuccessOn.Group.Label")); FormLayout successongroupLayout = new FormLayout(); successongroupLayout.marginWidth = 10; successongroupLayout.marginHeight = 10; wSuccessOn.setLayout(successongroupLayout); // Success Condition wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT); wlSuccessCondition.setText(Messages.getString("JobXMLWellFormed.SuccessCondition.Label")); props.setLook(wlSuccessCondition); fdlSuccessCondition = new FormData(); fdlSuccessCondition.left = new FormAttachment(0, 0); fdlSuccessCondition.right = new FormAttachment(middle, 0); fdlSuccessCondition.top = new FormAttachment(0, margin); wlSuccessCondition.setLayoutData(fdlSuccessCondition); wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wSuccessCondition.add(Messages.getString("JobXMLWellFormed.SuccessWhenAllWorksFine.Label")); wSuccessCondition.add(Messages.getString("JobXMLWellFormed.SuccessWhenAtLeat.Label")); wSuccessCondition.add( Messages.getString("JobXMLWellFormed.SuccessWhenBadFormedLessThan.Label")); wSuccessCondition.select(0); // +1: starts at -1 props.setLook(wSuccessCondition); fdSuccessCondition = new FormData(); fdSuccessCondition.left = new FormAttachment(middle, 0); fdSuccessCondition.top = new FormAttachment(0, margin); fdSuccessCondition.right = new FormAttachment(100, 0); wSuccessCondition.setLayoutData(fdSuccessCondition); wSuccessCondition.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { activeSuccessCondition(); } }); // Success when number of errors less than wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT); wlNrErrorsLessThan.setText(Messages.getString("JobXMLWellFormed.NrBadFormedLessThan.Label")); props.setLook(wlNrErrorsLessThan); fdlNrErrorsLessThan = new FormData(); fdlNrErrorsLessThan.left = new FormAttachment(0, 0); fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin); fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin); wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan); wNrErrorsLessThan = new TextVar( jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, Messages.getString("JobXMLWellFormed.NrBadFormedLessThan.Tooltip")); props.setLook(wNrErrorsLessThan); wNrErrorsLessThan.addModifyListener(lsMod); fdNrErrorsLessThan = new FormData(); fdNrErrorsLessThan.left = new FormAttachment(middle, 0); fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin); fdNrErrorsLessThan.right = new FormAttachment(100, -margin); wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan); fdSuccessOn = new FormData(); fdSuccessOn.left = new FormAttachment(0, margin); fdSuccessOn.top = new FormAttachment(0, margin); fdSuccessOn.right = new FormAttachment(100, -margin); wSuccessOn.setLayoutData(fdSuccessOn); // /////////////////////////////////////////////////////////// // / END OF Success ON GROUP // /////////////////////////////////////////////////////////// // fileresult grouping? // //////////////////////// // START OF LOGGING GROUP/// // / wFileResult = new Group(wAdvancedComp, SWT.SHADOW_NONE); props.setLook(wFileResult); wFileResult.setText(Messages.getString("JobXMLWellFormed.FileResult.Group.Label")); FormLayout fileresultgroupLayout = new FormLayout(); fileresultgroupLayout.marginWidth = 10; fileresultgroupLayout.marginHeight = 10; wFileResult.setLayout(fileresultgroupLayout); // Add Filenames to result filenames? wlAddFilenameToResult = new Label(wFileResult, SWT.RIGHT); wlAddFilenameToResult.setText(Messages.getString("JobXMLWellFormed.AddFilenameToResult.Label")); props.setLook(wlAddFilenameToResult); fdlAddFilenameToResult = new FormData(); fdlAddFilenameToResult.left = new FormAttachment(0, 0); fdlAddFilenameToResult.right = new FormAttachment(middle, 0); fdlAddFilenameToResult.top = new FormAttachment(0, margin); wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult); wAddFilenameToResult = new CCombo(wFileResult, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); wAddFilenameToResult.add(Messages.getString("JobXMLWellFormed.AddAllFilenamesToResult.Label")); wAddFilenameToResult.add( Messages.getString("JobXMLWellFormed.AddOnlyWellFormedFilenames.Label")); wAddFilenameToResult.add( Messages.getString("JobXMLWellFormed.AddOnlyBadFormedFilenames.Label")); wAddFilenameToResult.select(0); // +1: starts at -1 props.setLook(wAddFilenameToResult); fdAddFilenameToResult = new FormData(); fdAddFilenameToResult.left = new FormAttachment(middle, 0); fdAddFilenameToResult.top = new FormAttachment(0, margin); fdAddFilenameToResult.right = new FormAttachment(100, 0); wAddFilenameToResult.setLayoutData(fdAddFilenameToResult); wAddFilenameToResult.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) {} }); fdFileResult = new FormData(); fdFileResult.left = new FormAttachment(0, margin); fdFileResult.top = new FormAttachment(wSuccessOn, margin); fdFileResult.right = new FormAttachment(100, -margin); wFileResult.setLayoutData(fdFileResult); // /////////////////////////////////////////////////////////// // / END OF FilesResult GROUP // /////////////////////////////////////////////////////////// fdAdvancedComp = new FormData(); fdAdvancedComp.left = new FormAttachment(0, 0); fdAdvancedComp.top = new FormAttachment(0, 0); fdAdvancedComp.right = new FormAttachment(100, 0); fdAdvancedComp.bottom = new FormAttachment(100, 0); wAdvancedComp.setLayoutData(wAdvancedComp); wAdvancedComp.layout(); wAdvancedTab.setControl(wAdvancedComp); ///////////////////////////////////////////////////////////// /// END OF ADVANCED TAB ///////////////////////////////////////////////////////////// fdTabFolder = new FormData(); fdTabFolder.left = new FormAttachment(0, 0); fdTabFolder.top = new FormAttachment(wName, margin); fdTabFolder.right = new FormAttachment(100, 0); fdTabFolder.bottom = new FormAttachment(100, -50); wTabFolder.setLayoutData(fdTabFolder); wOK = new Button(shell, SWT.PUSH); wOK.setText(Messages.getString("System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(Messages.getString("System.Button.Cancel")); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wTabFolder); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); wSourceFileFolder.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); activeSuccessCondition(); activeSuccessCondition(); wTabFolder.setSelection(0); BaseStepDialog.setSize(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(PKG, "JobTelnet.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Filename line wlName = new Label(shell, SWT.RIGHT); wlName.setText(BaseMessages.getString(PKG, "JobTelnet.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, -margin); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); // hostname line wlHostname = new Label(shell, SWT.RIGHT); wlHostname.setText(BaseMessages.getString(PKG, "JobTelnet.Hostname.Label")); props.setLook(wlHostname); fdlHostname = new FormData(); fdlHostname.left = new FormAttachment(0, -margin); fdlHostname.top = new FormAttachment(wName, margin); fdlHostname.right = new FormAttachment(middle, -margin); wlHostname.setLayoutData(fdlHostname); wHostname = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wHostname); wHostname.addModifyListener(lsMod); fdHostname = new FormData(); fdHostname.left = new FormAttachment(middle, 0); fdHostname.top = new FormAttachment(wName, margin); fdHostname.right = new FormAttachment(100, 0); wHostname.setLayoutData(fdHostname); // Whenever something changes, set the tooltip to the expanded version: wHostname.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wHostname.setToolTipText(jobMeta.environmentSubstitute(wHostname.getText())); } }); wlPort = new Label(shell, SWT.RIGHT); wlPort.setText(BaseMessages.getString(PKG, "JobTelnet.Port.Label")); props.setLook(wlPort); fdlPort = new FormData(); fdlPort.left = new FormAttachment(0, -margin); fdlPort.right = new FormAttachment(middle, -margin); fdlPort.top = new FormAttachment(wHostname, margin); wlPort.setLayoutData(fdlPort); wPort = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wPort); wPort.addModifyListener(lsMod); fdPort = new FormData(); fdPort.left = new FormAttachment(middle, 0); fdPort.top = new FormAttachment(wHostname, margin); fdPort.right = new FormAttachment(100, 0); wPort.setLayoutData(fdPort); wlTimeOut = new Label(shell, SWT.RIGHT); wlTimeOut.setText(BaseMessages.getString(PKG, "JobTelnet.TimeOut.Label")); props.setLook(wlTimeOut); fdlTimeOut = new FormData(); fdlTimeOut.left = new FormAttachment(0, -margin); fdlTimeOut.right = new FormAttachment(middle, -margin); fdlTimeOut.top = new FormAttachment(wPort, margin); wlTimeOut.setLayoutData(fdlTimeOut); wTimeOut = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wTimeOut); wTimeOut.addModifyListener(lsMod); fdTimeOut = new FormData(); fdTimeOut.left = new FormAttachment(middle, 0); fdTimeOut.top = new FormAttachment(wPort, margin); fdTimeOut.right = new FormAttachment(100, 0); wTimeOut.setLayoutData(fdTimeOut); wOK = new Button(shell, SWT.PUSH); wOK.setText(BaseMessages.getString(PKG, "System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel")); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wTimeOut); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); wHostname.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); BaseStepDialog.setSize(shell); shell.open(); props.setDialogSize(shell, "JobTelnetDialogSize"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }
public JobEntryInterface open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, props.getJobsDialogStyle()); props.setLook(shell); JobDialog.setShellImage(shell, jobEntry); ModifyListener lsMod = new ModifyListener() { public void modifyText(ModifyEvent e) { jobEntry.setChanged(); } }; changed = jobEntry.hasChanged(); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(Messages.getString("JobEntryDTDValidator.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; // Name line wlName = new Label(shell, SWT.RIGHT); wlName.setText(Messages.getString("JobEntryDTDValidator.Name.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 0); fdlName.right = new FormAttachment(middle, -margin); fdlName.top = new FormAttachment(0, margin); wlName.setLayoutData(fdlName); wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wName); wName.addModifyListener(lsMod); fdName = new FormData(); fdName.left = new FormAttachment(middle, 0); fdName.top = new FormAttachment(0, margin); fdName.right = new FormAttachment(100, 0); wName.setLayoutData(fdName); // XML Filename wlxmlFilename = new Label(shell, SWT.RIGHT); wlxmlFilename.setText(Messages.getString("JobEntryDTDValidator.xmlFilename.Label")); props.setLook(wlxmlFilename); fdlxmlFilename = new FormData(); fdlxmlFilename.left = new FormAttachment(0, 0); fdlxmlFilename.top = new FormAttachment(wName, margin); fdlxmlFilename.right = new FormAttachment(middle, -margin); wlxmlFilename.setLayoutData(fdlxmlFilename); wbxmlFilename = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbxmlFilename); wbxmlFilename.setText(Messages.getString("System.Button.Browse")); fdbxmlFilename = new FormData(); fdbxmlFilename.right = new FormAttachment(100, 0); fdbxmlFilename.top = new FormAttachment(wName, 0); wbxmlFilename.setLayoutData(fdbxmlFilename); wxmlFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wxmlFilename); wxmlFilename.addModifyListener(lsMod); fdxmlFilename = new FormData(); fdxmlFilename.left = new FormAttachment(middle, 0); fdxmlFilename.top = new FormAttachment(wName, margin); fdxmlFilename.right = new FormAttachment(wbxmlFilename, -margin); wxmlFilename.setLayoutData(fdxmlFilename); // Whenever something changes, set the tooltip to the expanded version: wxmlFilename.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wxmlFilename.setToolTipText(jobMeta.environmentSubstitute(wxmlFilename.getText())); } }); wbxmlFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.xml;*.XML", "*"}); if (wxmlFilename.getText() != null) { dialog.setFileName(jobMeta.environmentSubstitute(wxmlFilename.getText())); } dialog.setFilterNames(FILETYPES_XML); if (dialog.open() != null) { wxmlFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName()); } } }); // DTD Intern ? wlDTDIntern = new Label(shell, SWT.RIGHT); wlDTDIntern.setText(Messages.getString("JobEntryDTDValidator.DTDIntern.Label")); props.setLook(wlDTDIntern); fdlDTDIntern = new FormData(); fdlDTDIntern.left = new FormAttachment(0, 0); fdlDTDIntern.top = new FormAttachment(wxmlFilename, margin); fdlDTDIntern.right = new FormAttachment(middle, -margin); wlDTDIntern.setLayoutData(fdlDTDIntern); wDTDIntern = new Button(shell, SWT.CHECK); props.setLook(wDTDIntern); wDTDIntern.setToolTipText(Messages.getString("JobEntryDTDValidator.DTDIntern.Tooltip")); fdDTDIntern = new FormData(); fdDTDIntern.left = new FormAttachment(middle, 0); fdDTDIntern.top = new FormAttachment(wxmlFilename, margin); fdDTDIntern.right = new FormAttachment(100, 0); wDTDIntern.setLayoutData(fdDTDIntern); wDTDIntern.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ActiveDTDFilename(); jobEntry.setChanged(); } }); // DTD Filename wldtdFilename = new Label(shell, SWT.RIGHT); wldtdFilename.setText(Messages.getString("JobEntryDTDValidator.DTDFilename.Label")); props.setLook(wldtdFilename); fdldtdFilename = new FormData(); fdldtdFilename.left = new FormAttachment(0, 0); fdldtdFilename.top = new FormAttachment(wDTDIntern, margin); fdldtdFilename.right = new FormAttachment(middle, -margin); wldtdFilename.setLayoutData(fdldtdFilename); wbdtdFilename = new Button(shell, SWT.PUSH | SWT.CENTER); props.setLook(wbdtdFilename); wbdtdFilename.setText(Messages.getString("System.Button.Browse")); fdbdtdFilename = new FormData(); fdbdtdFilename.right = new FormAttachment(100, 0); fdbdtdFilename.top = new FormAttachment(wDTDIntern, 0); wbdtdFilename.setLayoutData(fdbdtdFilename); wdtdFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); props.setLook(wdtdFilename); wdtdFilename.addModifyListener(lsMod); fddtdFilename = new FormData(); fddtdFilename.left = new FormAttachment(middle, 0); fddtdFilename.top = new FormAttachment(wDTDIntern, margin); fddtdFilename.right = new FormAttachment(wbdtdFilename, -margin); wdtdFilename.setLayoutData(fddtdFilename); // Whenever something changes, set the tooltip to the expanded version: wdtdFilename.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { wdtdFilename.setToolTipText(jobMeta.environmentSubstitute(wdtdFilename.getText())); } }); wbdtdFilename.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(shell, SWT.OPEN); dialog.setFilterExtensions(new String[] {"*.dtd;*.DTD", "*"}); if (wdtdFilename.getText() != null) { dialog.setFileName(jobMeta.environmentSubstitute(wdtdFilename.getText())); } dialog.setFilterNames(FILETYPES_DTD); if (dialog.open() != null) { wdtdFilename.setText( dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName()); } } }); wOK = new Button(shell, SWT.PUSH); wOK.setText(Messages.getString("System.Button.OK")); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(Messages.getString("System.Button.Cancel")); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wdtdFilename); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wCancel.addListener(SWT.Selection, lsCancel); wOK.addListener(SWT.Selection, lsOK); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wName.addSelectionListener(lsDef); wxmlFilename.addSelectionListener(lsDef); wdtdFilename.addSelectionListener(lsDef); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { cancel(); } }); getData(); ActiveDTDFilename(); BaseStepDialog.setSize(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }