private void getUpdate() { try { Row r = transMeta.getPrevStepFields(stepname); if (r != null) { BaseStepDialog.getFieldsFromPrevious( r, wReturn, 1, new int[] {1, 2}, new int[] {}, -1, -1, null); } } catch (KettleException ke) { new ErrorDialog( shell, Messages.getString("UpdateDialog.FailedToGetFields.DialogTitle"), Messages.getString("UpdateDialog.FailedToGetFields.DialogMessage"), ke); //$NON-NLS-1$ //$NON-NLS-2$ } }
private void get() { try { Row r = transMeta.getPrevStepFields(stepname); if (r != null) { TableItemInsertListener listener = new TableItemInsertListener() { public boolean tableItemInserted(TableItem tableItem, Value v) { tableItem.setText(2, "="); return true; } }; BaseStepDialog.getFieldsFromPrevious( r, wKey, 1, new int[] {1, 3}, new int[] {}, -1, -1, listener); } } catch (KettleException ke) { new ErrorDialog( shell, Messages.getString("UpdateDialog.FailedToGetFields.DialogTitle"), Messages.getString("UpdateDialog.FailedToGetFields.DialogMessage"), ke); //$NON-NLS-1$ //$NON-NLS-2$ } }
public String open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); props.setLook(shell); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(shellText); int length = Const.LENGTH; int margin = Const.MARGIN; // The String line... wlString = new Label(shell, SWT.NONE); wlString.setText(lineText); props.setLook(wlString); fdlString = new FormData(); fdlString.left = new FormAttachment(0, 0); fdlString.top = new FormAttachment(0, margin); wlString.setLayoutData(fdlString); wString = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER); wString.setText(string); props.setLook(wString); fdString = new FormData(); fdString.left = new FormAttachment(0, 0); fdString.top = new FormAttachment(wlString, margin); fdString.right = new FormAttachment(0, length); wString.setLayoutData(fdString); // Some buttons 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, wString); // Add listeners lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wOK.addListener(SWT.Selection, lsOK); wCancel.addListener(SWT.Selection, lsCancel); lsDef = new SelectionAdapter() { public void widgetDefaultSelected(SelectionEvent e) { ok(); } }; wString.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 string; }
public Row open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX); props.setLook(shell); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; if (title == null) title = Messages.getString("SelectRowDialog.Title"); shell.setLayout(formLayout); shell.setText(title); int margin = Const.MARGIN; if (buffer == null || buffer.size() == 0) return null; Row row = (Row) buffer.get(0); int FieldsRows = buffer.size(); ColumnInfo[] colinf = new ColumnInfo[row.size()]; for (int i = 0; i < row.size(); i++) { Value v = row.getValue(i); colinf[i] = new ColumnInfo(v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, false); colinf[i].setToolTip(v.toStringMeta()); colinf[i].setReadOnly(true); } wFields = new TableView( shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, null, props); 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, null); fdFields = new FormData(); fdFields.left = new FormAttachment(0, 0); fdFields.top = new FormAttachment(wlFields, margin); fdFields.right = new FormAttachment(100, 0); fdFields.bottom = new FormAttachment(wOK, -margin); wFields.setLayoutData(fdFields); // Add listeners lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wOK.addListener(SWT.Selection, lsOK); lsCancel = new Listener() { public void handleEvent(Event e) { close(); } }; wCancel.addListener(SWT.Selection, lsCancel); // Detect X or ALT-F4 or something that kills this window... shell.addShellListener( new ShellAdapter() { public void shellClosed(ShellEvent e) { close(); } }); getData(); BaseStepDialog.setSize(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return selection; }
public ArrayList open() { Shell parent = getParent(); Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX); props.setLook(shell); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(Messages.getString("EnterMappingDialog.Title")); int margin = Const.MARGIN; int buttonSpace = 90; // Source table wlSource = new Label(shell, SWT.NONE); wlSource.setText(Messages.getString("EnterMappingDialog.SourceFields.Label")); props.setLook(wlSource); fdlSource = new FormData(); fdlSource.left = new FormAttachment(0, 0); fdlSource.top = new FormAttachment(0, margin); wlSource.setLayoutData(fdlSource); wSource = new List(shell, SWT.SINGLE | SWT.RIGHT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); for (int i = 0; i < sourceList.length; i++) wSource.add(sourceList[i]); props.setLook(wSource); fdSource = new FormData(); fdSource.left = new FormAttachment(0, 0); fdSource.right = new FormAttachment(25, 0); fdSource.top = new FormAttachment(wlSource, margin); fdSource.bottom = new FormAttachment(100, -buttonSpace); wSource.setLayoutData(fdSource); // Automatic target selection wlSourceAuto = new Label(shell, SWT.NONE); wlSourceAuto.setText(Messages.getString("EnterMappingDialog.AutoTargetSelection.Label")); props.setLook(wlSourceAuto); fdlSourceAuto = new FormData(); fdlSourceAuto.left = new FormAttachment(0, 0); fdlSourceAuto.top = new FormAttachment(wSource, margin); wlSourceAuto.setLayoutData(fdlSourceAuto); wSourceAuto = new Button(shell, SWT.CHECK); wSourceAuto.setSelection(true); props.setLook(wSourceAuto); fdSourceAuto = new FormData(); fdSourceAuto.left = new FormAttachment(wlSourceAuto, margin * 2); fdSourceAuto.right = new FormAttachment(25, 0); fdSourceAuto.top = new FormAttachment(wSource, margin); wSourceAuto.setLayoutData(fdSourceAuto); // Hide used source fields? wlSourceHide = new Label(shell, SWT.NONE); wlSourceHide.setText(Messages.getString("EnterMappingDialog.HideUsedSources")); props.setLook(wlSourceHide); fdlSourceHide = new FormData(); fdlSourceHide.left = new FormAttachment(0, 0); fdlSourceHide.top = new FormAttachment(wSourceAuto, margin); wlSourceHide.setLayoutData(fdlSourceHide); wSourceHide = new Button(shell, SWT.CHECK); wSourceHide.setSelection(true); props.setLook(wSourceHide); fdSourceHide = new FormData(); fdSourceHide.left = new FormAttachment(wlSourceHide, margin * 2); fdSourceHide.right = new FormAttachment(25, 0); fdSourceHide.top = new FormAttachment(wSourceAuto, margin); wSourceHide.setLayoutData(fdSourceHide); wSourceHide.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { refreshMappings(); } }); // Target table wlTarget = new Label(shell, SWT.NONE); wlTarget.setText(Messages.getString("EnterMappingDialog.TargetFields.Label")); props.setLook(wlTarget); fdlTarget = new FormData(); fdlTarget.left = new FormAttachment(wSource, margin * 2); fdlTarget.top = new FormAttachment(0, margin); wlTarget.setLayoutData(fdlTarget); wTarget = new List(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); for (int i = 0; i < targetList.length; i++) wTarget.add(targetList[i]); props.setLook(wTarget); fdTarget = new FormData(); fdTarget.left = new FormAttachment(wSource, margin * 2); fdTarget.right = new FormAttachment(50, 0); fdTarget.top = new FormAttachment(wlTarget, margin); fdTarget.bottom = new FormAttachment(100, -buttonSpace); wTarget.setLayoutData(fdTarget); // Automatic target selection wlTargetAuto = new Label(shell, SWT.NONE); wlTargetAuto.setText(Messages.getString("EnterMappingDialog.AutoSourceSelection.Label")); props.setLook(wlTargetAuto); fdlTargetAuto = new FormData(); fdlTargetAuto.left = new FormAttachment(wSource, margin * 2); fdlTargetAuto.top = new FormAttachment(wTarget, margin); wlTargetAuto.setLayoutData(fdlTargetAuto); wTargetAuto = new Button(shell, SWT.CHECK); wTargetAuto.setSelection(false); props.setLook(wTargetAuto); fdTargetAuto = new FormData(); fdTargetAuto.left = new FormAttachment(wlTargetAuto, margin * 2); fdTargetAuto.right = new FormAttachment(50, 0); fdTargetAuto.top = new FormAttachment(wTarget, margin); wTargetAuto.setLayoutData(fdTargetAuto); // Automatic target selection wlTargetHide = new Label(shell, SWT.NONE); wlTargetHide.setText(Messages.getString("EnterMappingDialog.HideUsedTargets")); props.setLook(wlTargetHide); fdlTargetHide = new FormData(); fdlTargetHide.left = new FormAttachment(wSource, margin * 2); fdlTargetHide.top = new FormAttachment(wTargetAuto, margin); wlTargetHide.setLayoutData(fdlTargetHide); wTargetHide = new Button(shell, SWT.CHECK); wTargetHide.setSelection(true); props.setLook(wTargetHide); fdTargetHide = new FormData(); fdTargetHide.left = new FormAttachment(wlTargetHide, margin * 2); fdTargetHide.right = new FormAttachment(50, 0); fdTargetHide.top = new FormAttachment(wTargetAuto, margin); wTargetHide.setLayoutData(fdTargetHide); wTargetHide.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { refreshMappings(); } }); // Add a couple of buttons: wAdd = new Button(shell, SWT.PUSH); fdAdd = new FormData(); wAdd.setText(Messages.getString("EnterMappingDialog.Button.Add")); fdAdd.left = new FormAttachment(wTarget, margin * 2); fdAdd.top = new FormAttachment(wTarget, 0, SWT.CENTER); wAdd.setLayoutData(fdAdd); Listener lsAdd = new Listener() { public void handleEvent(Event e) { add(); } }; wAdd.addListener(SWT.Selection, lsAdd); // Delete a couple of buttons: wDelete = new Button(shell, SWT.PUSH); fdDelete = new FormData(); wDelete.setText(Messages.getString("EnterMappingDialog.Button.Delete")); fdDelete.left = new FormAttachment(wTarget, margin * 2); fdDelete.top = new FormAttachment(wAdd, margin * 2); wDelete.setLayoutData(fdDelete); Listener lsDelete = new Listener() { public void handleEvent(Event e) { delete(); } }; wDelete.addListener(SWT.Selection, lsDelete); // Result table wlResult = new Label(shell, SWT.NONE); wlResult.setText(Messages.getString("EnterMappingDialog.ResultMappings.Label")); props.setLook(wlResult); fdlResult = new FormData(); fdlResult.left = new FormAttachment(wDelete, margin * 2); fdlResult.top = new FormAttachment(0, margin); wlResult.setLayoutData(fdlResult); wResult = new List(shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); for (int i = 0; i < targetList.length; i++) wResult.add(targetList[i]); props.setLook(wResult); fdResult = new FormData(); fdResult.left = new FormAttachment(wDelete, margin * 2); fdResult.right = new FormAttachment(100, 0); fdResult.top = new FormAttachment(wlResult, margin); fdResult.bottom = new FormAttachment(100, -30); wResult.setLayoutData(fdResult); // Some buttons wOK = new Button(shell, SWT.PUSH); wOK.setText(Messages.getString("System.Button.OK")); lsOK = new Listener() { public void handleEvent(Event e) { ok(); } }; wOK.addListener(SWT.Selection, lsOK); // Some buttons wGuess = new Button(shell, SWT.PUSH); wGuess.setText(Messages.getString("EnterMappingDialog.Button.Guess")); lsGuess = new Listener() { public void handleEvent(Event e) { guess(); } }; wGuess.addListener(SWT.Selection, lsGuess); wCancel = new Button(shell, SWT.PUSH); wCancel.setText(Messages.getString("System.Button.Cancel")); lsCancel = new Listener() { public void handleEvent(Event e) { cancel(); } }; wCancel.addListener(SWT.Selection, lsCancel); BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wGuess, wCancel}, margin, null); wSource.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (wSourceAuto.getSelection()) findTarget(); } public void widgetDefaultSelected(SelectionEvent e) { add(); } }); wTarget.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (wTargetAuto.getSelection()) findSource(); } public void widgetDefaultSelected(SelectionEvent e) { add(); } }); // 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 mappings; }
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("JobEval.Title")); int middle = props.getMiddlePct(); int margin = Const.MARGIN; 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")); // at the bottom BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, null); // Filename line wlName = new Label(shell, SWT.NONE); wlName.setText(Messages.getString("JobEval.Jobname.Label")); props.setLook(wlName); fdlName = new FormData(); fdlName.left = new FormAttachment(0, 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); wlPosition = new Label(shell, SWT.NONE); wlPosition.setText(Messages.getString("JobEval.LineNr.Label", "0")); props.setLook(wlPosition); fdlPosition = new FormData(); fdlPosition.left = new FormAttachment(0, 0); fdlPosition.bottom = new FormAttachment(wOK, -margin); wlPosition.setLayoutData(fdlPosition); // Script line wlScript = new Label(shell, SWT.NONE); wlScript.setText(Messages.getString("JobEval.Script.Label")); props.setLook(wlScript); fdlScript = new FormData(); fdlScript.left = new FormAttachment(0, 0); fdlScript.top = new FormAttachment(wName, margin); wlScript.setLayoutData(fdlScript); wScript = new Text(shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); wScript.setText(Messages.getString("JobEval.Script.Default")); props.setLook(wScript, Props.WIDGET_STYLE_FIXED); wScript.addModifyListener(lsMod); fdScript = new FormData(); fdScript.left = new FormAttachment(0, 0); fdScript.top = new FormAttachment(wlScript, margin); fdScript.right = new FormAttachment(100, -5); fdScript.bottom = new FormAttachment(wlPosition, -margin); wScript.setLayoutData(fdScript); // 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(); } }); wScript.addKeyListener( new KeyAdapter() { public void keyReleased(KeyEvent e) { int linenr = wScript.getCaretLineNumber() + 1; wlPosition.setText( Messages.getString("JobEval.LineNr.Label", Integer.toString(linenr))); } }); getData(); BaseStepDialog.setSize(shell, 250, 250, false); shell.open(); props.setDialogSize(shell, "JobEvalDialogSize"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } return jobEntry; }