use of org.pentaho.di.ui.core.widget.ComboVar in project pentaho-kettle by pentaho.
the class TextFileOutputDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
wTabFolder.setSimple(false);
// ////////////////////////
// START OF FILE TAB///
// /
wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileTab.TabTitle"));
Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
// Filename line
wlFilename = new Label(wFileComp, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(0, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(wFileComp, 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(0, 0);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(transMeta, wFileComp, 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(0, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Run this as a command instead?
wlFileIsCommand = new Label(wFileComp, SWT.RIGHT);
wlFileIsCommand.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileIsCommand.Label"));
props.setLook(wlFileIsCommand);
fdlFileIsCommand = new FormData();
fdlFileIsCommand.left = new FormAttachment(0, 0);
fdlFileIsCommand.top = new FormAttachment(wFilename, margin);
fdlFileIsCommand.right = new FormAttachment(middle, -margin);
wlFileIsCommand.setLayoutData(fdlFileIsCommand);
wFileIsCommand = new Button(wFileComp, SWT.CHECK);
props.setLook(wFileIsCommand);
fdFileIsCommand = new FormData();
fdFileIsCommand.left = new FormAttachment(middle, 0);
fdFileIsCommand.top = new FormAttachment(wFilename, margin);
fdFileIsCommand.right = new FormAttachment(100, 0);
wFileIsCommand.setLayoutData(fdFileIsCommand);
wFileIsCommand.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableParentFolder();
}
});
// Output to servlet (browser, ws)
//
wlServletOutput = new Label(wFileComp, SWT.RIGHT);
wlServletOutput.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ServletOutput.Label"));
props.setLook(wlServletOutput);
fdlServletOutput = new FormData();
fdlServletOutput.left = new FormAttachment(0, 0);
fdlServletOutput.top = new FormAttachment(wFileIsCommand, margin);
fdlServletOutput.right = new FormAttachment(middle, -margin);
wlServletOutput.setLayoutData(fdlServletOutput);
wServletOutput = new Button(wFileComp, SWT.CHECK);
wServletOutput.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.ServletOutput.Tooltip"));
props.setLook(wServletOutput);
fdServletOutput = new FormData();
fdServletOutput.left = new FormAttachment(middle, 0);
fdServletOutput.top = new FormAttachment(wFileIsCommand, margin);
fdServletOutput.right = new FormAttachment(100, 0);
wServletOutput.setLayoutData(fdServletOutput);
wServletOutput.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setFlagsServletOption();
}
});
// Create Parent Folder
wlCreateParentFolder = new Label(wFileComp, SWT.RIGHT);
wlCreateParentFolder.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.CreateParentFolder.Label"));
props.setLook(wlCreateParentFolder);
fdlCreateParentFolder = new FormData();
fdlCreateParentFolder.left = new FormAttachment(0, 0);
fdlCreateParentFolder.top = new FormAttachment(wServletOutput, margin);
fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
wCreateParentFolder = new Button(wFileComp, SWT.CHECK);
wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.CreateParentFolder.Tooltip"));
props.setLook(wCreateParentFolder);
fdCreateParentFolder = new FormData();
fdCreateParentFolder.left = new FormAttachment(middle, 0);
fdCreateParentFolder.top = new FormAttachment(wServletOutput, margin);
fdCreateParentFolder.right = new FormAttachment(100, 0);
wCreateParentFolder.setLayoutData(fdCreateParentFolder);
wCreateParentFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Open new File at Init
wlDoNotOpenNewFileInit = new Label(wFileComp, SWT.RIGHT);
wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DoNotOpenNewFileInit.Label"));
props.setLook(wlDoNotOpenNewFileInit);
fdlDoNotOpenNewFileInit = new FormData();
fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0);
fdlDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
fdlDoNotOpenNewFileInit.right = new FormAttachment(middle, -margin);
wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit);
wDoNotOpenNewFileInit = new Button(wFileComp, SWT.CHECK);
wDoNotOpenNewFileInit.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.DoNotOpenNewFileInit.Tooltip"));
props.setLook(wDoNotOpenNewFileInit);
fdDoNotOpenNewFileInit = new FormData();
fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0);
fdDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0);
wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit);
wDoNotOpenNewFileInit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
/* next Lines */
// FileNameInField line
wlFileNameInField = new Label(wFileComp, SWT.RIGHT);
wlFileNameInField.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileNameInField.Label"));
props.setLook(wlFileNameInField);
fdlFileNameInField = new FormData();
fdlFileNameInField.left = new FormAttachment(0, 0);
fdlFileNameInField.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
fdlFileNameInField.right = new FormAttachment(middle, -margin);
wlFileNameInField.setLayoutData(fdlFileNameInField);
wFileNameInField = new Button(wFileComp, SWT.CHECK);
props.setLook(wFileNameInField);
fdFileNameInField = new FormData();
fdFileNameInField.left = new FormAttachment(middle, 0);
fdFileNameInField.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
fdFileNameInField.right = new FormAttachment(100, 0);
wFileNameInField.setLayoutData(fdFileNameInField);
wFileNameInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeFileNameField();
}
});
// FileNameField Line
wlFileNameField = new Label(wFileComp, SWT.RIGHT);
wlFileNameField.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileNameField.Label"));
props.setLook(wlFileNameField);
fdlFileNameField = new FormData();
fdlFileNameField.left = new FormAttachment(0, 0);
fdlFileNameField.right = new FormAttachment(middle, -margin);
fdlFileNameField.top = new FormAttachment(wFileNameInField, margin);
wlFileNameField.setLayoutData(fdlFileNameField);
wFileNameField = new ComboVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFileNameField);
wFileNameField.addModifyListener(lsMod);
fdFileNameField = new FormData();
fdFileNameField.left = new FormAttachment(middle, 0);
fdFileNameField.top = new FormAttachment(wFileNameInField, margin);
fdFileNameField.right = new FormAttachment(100, 0);
wFileNameField.setLayoutData(fdFileNameField);
wFileNameField.setEnabled(false);
wFileNameField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
/* End */
// Extension line
wlExtension = new Label(wFileComp, SWT.RIGHT);
wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlExtension);
fdlExtension = new FormData();
fdlExtension.left = new FormAttachment(0, 0);
fdlExtension.top = new FormAttachment(wFileNameField, margin);
fdlExtension.right = new FormAttachment(middle, -margin);
wlExtension.setLayoutData(fdlExtension);
wExtension = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wExtension.setText("");
props.setLook(wExtension);
wExtension.addModifyListener(lsMod);
fdExtension = new FormData();
fdExtension.left = new FormAttachment(middle, 0);
fdExtension.top = new FormAttachment(wFileNameField, margin);
fdExtension.right = new FormAttachment(100, 0);
wExtension.setLayoutData(fdExtension);
// Create multi-part file?
wlAddStepnr = new Label(wFileComp, SWT.RIGHT);
wlAddStepnr.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddStepnr.Label"));
props.setLook(wlAddStepnr);
fdlAddStepnr = new FormData();
fdlAddStepnr.left = new FormAttachment(0, 0);
fdlAddStepnr.top = new FormAttachment(wExtension, margin);
fdlAddStepnr.right = new FormAttachment(middle, -margin);
wlAddStepnr.setLayoutData(fdlAddStepnr);
wAddStepnr = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddStepnr);
fdAddStepnr = new FormData();
fdAddStepnr.left = new FormAttachment(middle, 0);
fdAddStepnr.top = new FormAttachment(wExtension, margin);
fdAddStepnr.right = new FormAttachment(100, 0);
wAddStepnr.setLayoutData(fdAddStepnr);
wAddStepnr.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddPartnr = new Label(wFileComp, SWT.RIGHT);
wlAddPartnr.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddPartnr.Label"));
props.setLook(wlAddPartnr);
fdlAddPartnr = new FormData();
fdlAddPartnr.left = new FormAttachment(0, 0);
fdlAddPartnr.top = new FormAttachment(wAddStepnr, margin);
fdlAddPartnr.right = new FormAttachment(middle, -margin);
wlAddPartnr.setLayoutData(fdlAddPartnr);
wAddPartnr = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddPartnr);
fdAddPartnr = new FormData();
fdAddPartnr.left = new FormAttachment(middle, 0);
fdAddPartnr.top = new FormAttachment(wAddStepnr, margin);
fdAddPartnr.right = new FormAttachment(100, 0);
wAddPartnr.setLayoutData(fdAddPartnr);
wAddPartnr.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddDate = new Label(wFileComp, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wAddPartnr, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddDate);
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, 0);
fdAddDate.top = new FormAttachment(wAddPartnr, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddTime = new Label(wFileComp, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddTime);
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, 0);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wFileComp, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.SpecifyFormat.Label"));
props.setLook(wlSpecifyFormat);
fdlSpecifyFormat = new FormData();
fdlSpecifyFormat.left = new FormAttachment(0, 0);
fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
wSpecifyFormat = new Button(wFileComp, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, 0);
fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdSpecifyFormat.right = new FormAttachment(100, 0);
wSpecifyFormat.setLayoutData(fdSpecifyFormat);
wSpecifyFormat.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setDateTimeFormat();
}
});
// DateTimeFormat
wlDateTimeFormat = new Label(wFileComp, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DateTimeFormat.Label"));
props.setLook(wlDateTimeFormat);
fdlDateTimeFormat = new FormData();
fdlDateTimeFormat.left = new FormAttachment(0, 0);
fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
wDateTimeFormat = new CCombo(wFileComp, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, 0);
fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdDateTimeFormat.right = new FormAttachment(100, 0);
wDateTimeFormat.setLayoutData(fdDateTimeFormat);
String[] dats = Const.getDateFormats();
for (int x = 0; x < dats.length; x++) {
wDateTimeFormat.add(dats[x]);
}
wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbShowFiles);
wbShowFiles.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ShowFiles.Button"));
fdbShowFiles = new FormData();
fdbShowFiles.left = new FormAttachment(middle, 0);
fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 2);
wbShowFiles.setLayoutData(fdbShowFiles);
wbShowFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TextFileOutputMeta tfoi = new TextFileOutputMeta();
saveInfoInMeta(tfoi);
String[] files = tfoi.getFiles(transMeta);
if (files != null && files.length > 0) {
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "TextFileOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "TextFileOutputDialog.SelectOutputFiles.DialogMessage"));
esd.setViewOnly();
esd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TextFileOutputDialog.NoFilesFound.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
mb.open();
}
}
});
// Add File to the result files name
wlAddToResult = new Label(wFileComp, SWT.RIGHT);
wlAddToResult.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddFileToResult.Label"));
props.setLook(wlAddToResult);
fdlAddToResult = new FormData();
fdlAddToResult.left = new FormAttachment(0, 0);
fdlAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
fdlAddToResult.right = new FormAttachment(middle, -margin);
wlAddToResult.setLayoutData(fdlAddToResult);
wAddToResult = new Button(wFileComp, SWT.CHECK);
wAddToResult.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddFileToResult.Tooltip"));
props.setLook(wAddToResult);
fdAddToResult = new FormData();
fdAddToResult.left = new FormAttachment(middle, 0);
fdAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
fdAddToResult.right = new FormAttachment(100, 0);
wAddToResult.setLayoutData(fdAddToResult);
SelectionAdapter lsSelR = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
};
wAddToResult.addSelectionListener(lsSelR);
fdFileComp = new FormData();
fdFileComp.left = new FormAttachment(0, 0);
fdFileComp.top = new FormAttachment(0, 0);
fdFileComp.right = new FormAttachment(100, 0);
fdFileComp.bottom = new FormAttachment(100, 0);
wFileComp.setLayoutData(fdFileComp);
wFileComp.layout();
wFileTab.setControl(wFileComp);
// ///////////////////////////////////////////////////////////
// / END OF FILE TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// Append to end of file?
wlAppend = new Label(wContentComp, SWT.RIGHT);
wlAppend.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Append.Label"));
props.setLook(wlAppend);
fdlAppend = new FormData();
fdlAppend.left = new FormAttachment(0, 0);
fdlAppend.top = new FormAttachment(0, 0);
fdlAppend.right = new FormAttachment(middle, -margin);
wlAppend.setLayoutData(fdlAppend);
wAppend = new Button(wContentComp, SWT.CHECK);
props.setLook(wAppend);
fdAppend = new FormData();
fdAppend.left = new FormAttachment(middle, 0);
fdAppend.top = new FormAttachment(0, 0);
fdAppend.right = new FormAttachment(100, 0);
wAppend.setLayoutData(fdAppend);
wAppend.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
private void headerDisabling() {
wHeader.setSelection(false);
wHeader.setEnabled(!wAppend.getSelection());
}
});
wlSeparator = new Label(wContentComp, SWT.RIGHT);
wlSeparator.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Separator.Label"));
props.setLook(wlSeparator);
fdlSeparator = new FormData();
fdlSeparator.left = new FormAttachment(0, 0);
fdlSeparator.top = new FormAttachment(wAppend, margin);
fdlSeparator.right = new FormAttachment(middle, -margin);
wlSeparator.setLayoutData(fdlSeparator);
wbSeparator = new Button(wContentComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSeparator);
wbSeparator.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Separator.Button"));
fdbSeparator = new FormData();
fdbSeparator.right = new FormAttachment(100, 0);
fdbSeparator.top = new FormAttachment(wAppend, 0);
wbSeparator.setLayoutData(fdbSeparator);
wbSeparator.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
// wSeparator.insert("\t");
wSeparator.getTextWidget().insert("\t");
}
});
wSeparator = new TextVar(transMeta, wContentComp, 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(wAppend, margin);
fdSeparator.right = new FormAttachment(wbSeparator, -margin);
wSeparator.setLayoutData(fdSeparator);
// Enclosure line...
wlEnclosure = new Label(wContentComp, SWT.RIGHT);
wlEnclosure.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Enclosure.Label"));
props.setLook(wlEnclosure);
fdlEnclosure = new FormData();
fdlEnclosure.left = new FormAttachment(0, 0);
fdlEnclosure.top = new FormAttachment(wSeparator, margin);
fdlEnclosure.right = new FormAttachment(middle, -margin);
wlEnclosure.setLayoutData(fdlEnclosure);
wEnclosure = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEnclosure);
wEnclosure.addModifyListener(lsMod);
fdEnclosure = new FormData();
fdEnclosure.left = new FormAttachment(middle, 0);
fdEnclosure.top = new FormAttachment(wSeparator, margin);
fdEnclosure.right = new FormAttachment(100, 0);
wEnclosure.setLayoutData(fdEnclosure);
wlEnclForced = new Label(wContentComp, SWT.RIGHT);
wlEnclForced.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.EnclForced.Label"));
props.setLook(wlEnclForced);
fdlEnclForced = new FormData();
fdlEnclForced.left = new FormAttachment(0, 0);
fdlEnclForced.top = new FormAttachment(wEnclosure, margin);
fdlEnclForced.right = new FormAttachment(middle, -margin);
wlEnclForced.setLayoutData(fdlEnclForced);
wEnclForced = new Button(wContentComp, SWT.CHECK);
props.setLook(wEnclForced);
fdEnclForced = new FormData();
fdEnclForced.left = new FormAttachment(middle, 0);
fdEnclForced.top = new FormAttachment(wEnclosure, margin);
fdEnclForced.right = new FormAttachment(100, 0);
wEnclForced.setLayoutData(fdEnclForced);
wEnclForced.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlDisableEnclosureFix = new Label(wContentComp, SWT.RIGHT);
wlDisableEnclosureFix.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DisableEnclosureFix.Label"));
props.setLook(wlDisableEnclosureFix);
fdlDisableEnclosureFix = new FormData();
fdlDisableEnclosureFix.left = new FormAttachment(0, 0);
fdlDisableEnclosureFix.top = new FormAttachment(wEnclForced, margin);
fdlDisableEnclosureFix.right = new FormAttachment(middle, -margin);
wlDisableEnclosureFix.setLayoutData(fdlDisableEnclosureFix);
wDisableEnclosureFix = new Button(wContentComp, SWT.CHECK);
props.setLook(wDisableEnclosureFix);
fdDisableEnclosureFix = new FormData();
fdDisableEnclosureFix.left = new FormAttachment(middle, 0);
fdDisableEnclosureFix.top = new FormAttachment(wEnclForced, margin);
fdDisableEnclosureFix.right = new FormAttachment(100, 0);
wDisableEnclosureFix.setLayoutData(fdDisableEnclosureFix);
wDisableEnclosureFix.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlHeader = new Label(wContentComp, SWT.RIGHT);
wlHeader.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Header.Label"));
props.setLook(wlHeader);
fdlHeader = new FormData();
fdlHeader.left = new FormAttachment(0, 0);
fdlHeader.top = new FormAttachment(wDisableEnclosureFix, margin);
fdlHeader.right = new FormAttachment(middle, -margin);
wlHeader.setLayoutData(fdlHeader);
wHeader = new Button(wContentComp, SWT.CHECK);
props.setLook(wHeader);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(middle, 0);
fdHeader.top = new FormAttachment(wDisableEnclosureFix, margin);
fdHeader.right = new FormAttachment(100, 0);
wHeader.setLayoutData(fdHeader);
wHeader.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFooter = new Label(wContentComp, SWT.RIGHT);
wlFooter.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Footer.Label"));
props.setLook(wlFooter);
fdlFooter = new FormData();
fdlFooter.left = new FormAttachment(0, 0);
fdlFooter.top = new FormAttachment(wHeader, margin);
fdlFooter.right = new FormAttachment(middle, -margin);
wlFooter.setLayoutData(fdlFooter);
wFooter = new Button(wContentComp, SWT.CHECK);
props.setLook(wFooter);
fdFooter = new FormData();
fdFooter.left = new FormAttachment(middle, 0);
fdFooter.top = new FormAttachment(wHeader, margin);
fdFooter.right = new FormAttachment(100, 0);
wFooter.setLayoutData(fdFooter);
wFooter.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFormat = new Label(wContentComp, SWT.RIGHT);
wlFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Format.Label"));
props.setLook(wlFormat);
fdlFormat = new FormData();
fdlFormat.left = new FormAttachment(0, 0);
fdlFormat.top = new FormAttachment(wFooter, margin);
fdlFormat.right = new FormAttachment(middle, -margin);
wlFormat.setLayoutData(fdlFormat);
wFormat = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Format.Label"));
props.setLook(wFormat);
for (int i = 0; i < TextFileOutputMeta.formatMapperLineTerminator.length; i++) {
// add e.g. TextFileOutputDialog.Format.DOS, .UNIX, .CR, .None
wFormat.add(BaseMessages.getString(PKG, "TextFileOutputDialog.Format." + TextFileOutputMeta.formatMapperLineTerminator[i]));
}
wFormat.select(0);
wFormat.addModifyListener(lsMod);
fdFormat = new FormData();
fdFormat.left = new FormAttachment(middle, 0);
fdFormat.top = new FormAttachment(wFooter, margin);
fdFormat.right = new FormAttachment(100, 0);
wFormat.setLayoutData(fdFormat);
wlCompression = new Label(wContentComp, SWT.RIGHT);
wlCompression.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Compression.Label"));
props.setLook(wlCompression);
fdlCompression = new FormData();
fdlCompression.left = new FormAttachment(0, 0);
fdlCompression.top = new FormAttachment(wFormat, margin);
fdlCompression.right = new FormAttachment(middle, -margin);
wlCompression.setLayoutData(fdlCompression);
wCompression = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wCompression.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Compression.Label"));
props.setLook(wCompression);
wCompression.setItems(CompressionProviderFactory.getInstance().getCompressionProviderNames());
wCompression.addModifyListener(lsMod);
fdCompression = new FormData();
fdCompression.left = new FormAttachment(middle, 0);
fdCompression.top = new FormAttachment(wFormat, margin);
fdCompression.right = new FormAttachment(100, 0);
wCompression.setLayoutData(fdCompression);
wlEncoding = new Label(wContentComp, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Encoding.Label"));
props.setLook(wlEncoding);
fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wCompression, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wEncoding.setEditable(true);
props.setLook(wEncoding);
wEncoding.addModifyListener(lsMod);
fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.top = new FormAttachment(wCompression, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setEncodings();
shell.setCursor(null);
busy.dispose();
}
});
wlPad = new Label(wContentComp, SWT.RIGHT);
wlPad.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Pad.Label"));
props.setLook(wlPad);
fdlPad = new FormData();
fdlPad.left = new FormAttachment(0, 0);
fdlPad.top = new FormAttachment(wEncoding, margin);
fdlPad.right = new FormAttachment(middle, -margin);
wlPad.setLayoutData(fdlPad);
wPad = new Button(wContentComp, SWT.CHECK);
props.setLook(wPad);
fdPad = new FormData();
fdPad.left = new FormAttachment(middle, 0);
fdPad.top = new FormAttachment(wEncoding, margin);
fdPad.right = new FormAttachment(100, 0);
wPad.setLayoutData(fdPad);
wPad.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFastDump = new Label(wContentComp, SWT.RIGHT);
wlFastDump.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FastDump.Label"));
props.setLook(wlFastDump);
fdlFastDump = new FormData();
fdlFastDump.left = new FormAttachment(0, 0);
fdlFastDump.top = new FormAttachment(wPad, margin);
fdlFastDump.right = new FormAttachment(middle, -margin);
wlFastDump.setLayoutData(fdlFastDump);
wFastDump = new Button(wContentComp, SWT.CHECK);
props.setLook(wFastDump);
fdFastDump = new FormData();
fdFastDump.left = new FormAttachment(middle, 0);
fdFastDump.top = new FormAttachment(wPad, margin);
fdFastDump.right = new FormAttachment(100, 0);
wFastDump.setLayoutData(fdFastDump);
wFastDump.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlSplitEvery = new Label(wContentComp, SWT.RIGHT);
wlSplitEvery.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.SplitEvery.Label"));
props.setLook(wlSplitEvery);
fdlSplitEvery = new FormData();
fdlSplitEvery.left = new FormAttachment(0, 0);
fdlSplitEvery.top = new FormAttachment(wFastDump, margin);
fdlSplitEvery.right = new FormAttachment(middle, -margin);
wlSplitEvery.setLayoutData(fdlSplitEvery);
wSplitEvery = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSplitEvery);
wSplitEvery.addModifyListener(lsMod);
fdSplitEvery = new FormData();
fdSplitEvery.left = new FormAttachment(middle, 0);
fdSplitEvery.top = new FormAttachment(wFastDump, margin);
fdSplitEvery.right = new FormAttachment(100, 0);
wSplitEvery.setLayoutData(fdSplitEvery);
// Bruise:
wlEndedLine = new Label(wContentComp, SWT.RIGHT);
wlEndedLine.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.EndedLine.Label"));
props.setLook(wlEndedLine);
fdlEndedLine = new FormData();
fdlEndedLine.left = new FormAttachment(0, 0);
fdlEndedLine.top = new FormAttachment(wSplitEvery, margin);
fdlEndedLine.right = new FormAttachment(middle, -margin);
wlEndedLine.setLayoutData(fdlEndedLine);
wEndedLine = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEndedLine);
wEndedLine.addModifyListener(lsMod);
fdEndedLine = new FormData();
fdEndedLine.left = new FormAttachment(middle, 0);
fdEndedLine.top = new FormAttachment(wSplitEvery, margin);
fdEndedLine.right = new FormAttachment(100, 0);
wEndedLine.setLayoutData(fdEndedLine);
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(fdContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FieldsTab.TabTitle"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = Const.FORM_MARGIN;
fieldsLayout.marginHeight = Const.FORM_MARGIN;
Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
props.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
wGet.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.GetFields"));
wMinWidth = new Button(wFieldsComp, SWT.PUSH);
wMinWidth.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.MinWidth.Button"));
wMinWidth.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.MinWidth.Tooltip"));
wMinWidth.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
final int FieldsCols = 10;
final int FieldsRows = input.getOutputFields().length;
// Prepare a list of possible formats...
String[] nums = Const.getNumberFormats();
int totsize = dats.length + nums.length;
String[] formats = new String[totsize];
for (int x = 0; x < dats.length; x++) {
formats[x] = dats[x];
}
for (int x = 0; x < nums.length; x++) {
formats[dats.length + x] = nums[x];
}
colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
colinf[1] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames());
colinf[2] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats);
colinf[3] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.LengthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[4] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.PrecisionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[5] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.CurrencyColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[6] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.DecimalColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[7] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.GroupColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[8] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.TrimTypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true);
colinf[9] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.NullColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
wFields = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wGet, -margin);
wFields.setLayoutData(fdFields);
//
// Search the fields in the background
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
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"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsMinWidth = new Listener() {
public void handleEvent(Event e) {
setMinimalWidth();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wMinWidth.addListener(SWT.Selection, lsMinWidth);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wFilename.addSelectionListener(lsDef);
wSeparator.addSelectionListener(lsDef);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.txt", "*.csv", "*" });
if (wFilename.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.CSVFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
String extension = wExtension.getText();
if (extension != null && dialog.getFileName() != null && dialog.getFileName().endsWith("." + extension)) {
// The extension is filled in and matches the end
// of the selected file => Strip off the extension.
String fileName = dialog.getFileName();
wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + fileName.substring(0, fileName.length() - (extension.length() + 1)));
} else {
wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
}
});
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
public void handleEvent(Event event) {
Point size = shell.getSize();
wFields.setSize(size.x - 10, size.y - 50);
wFields.table.setSize(size.x - 10, size.y - 50);
wFields.redraw();
}
};
shell.addListener(SWT.Resize, lsResize);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
activeFileNameField();
enableParentFolder();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.ComboVar in project pentaho-kettle by pentaho.
the class SalesforceDeleteDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsTableMod = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.General.Tab"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ///////////////////////////////
// START OF Connection GROUP //
// ///////////////////////////////
wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wConnectionGroup);
wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.ConnectionGroup.Label"));
FormLayout connectionGroupLayout = new FormLayout();
connectionGroupLayout.marginWidth = 10;
connectionGroupLayout.marginHeight = 10;
wConnectionGroup.setLayout(connectionGroupLayout);
// Webservice URL
wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
fdURL = new FormData();
fdURL.left = new FormAttachment(0, 0);
fdURL.top = new FormAttachment(wStepname, margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// UserName line
wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wURL, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceDeleteDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceDeleteDialog.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test Salesforce connection button
wTest = new Button(wConnectionGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, margin);
fdConnectionGroup.top = new FormAttachment(wStepname, margin);
fdConnectionGroup.right = new FormAttachment(100, -margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// ///////////////////////////////
// END OF Connection GROUP //
// ///////////////////////////////
// ///////////////////////////////
// START OF Settings GROUP //
// ///////////////////////////////
wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.SettingsGroup.Label"));
FormLayout settingGroupLayout = new FormLayout();
settingGroupLayout.marginWidth = 10;
settingGroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(settingGroupLayout);
// Timeout
wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.TimeOut.Label"));
props.setLook(wlTimeOut);
fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.top = new FormAttachment(wSettingsGroup, margin);
fdlTimeOut.right = new FormAttachment(middle, -margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(transMeta, wSettingsGroup, 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(wSettingsGroup, margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Use compression?
wlUseCompression = new Label(wSettingsGroup, SWT.RIGHT);
wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.UseCompression.Label"));
props.setLook(wlUseCompression);
fdlUseCompression = new FormData();
fdlUseCompression.left = new FormAttachment(0, 0);
fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
fdlUseCompression.right = new FormAttachment(middle, -margin);
wlUseCompression.setLayoutData(fdlUseCompression);
wUseCompression = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wUseCompression);
wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.UseCompression.Tooltip"));
fdUseCompression = new FormData();
fdUseCompression.left = new FormAttachment(middle, 0);
fdUseCompression.top = new FormAttachment(wTimeOut, margin);
wUseCompression.setLayoutData(fdUseCompression);
wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
// Rollback all changes on error?
wlRollbackAllChangesOnError = new Label(wSettingsGroup, SWT.RIGHT);
wlRollbackAllChangesOnError.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.RollbackAllChangesOnError.Label"));
props.setLook(wlRollbackAllChangesOnError);
fdlRollbackAllChangesOnError = new FormData();
fdlRollbackAllChangesOnError.left = new FormAttachment(0, 0);
fdlRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
fdlRollbackAllChangesOnError.right = new FormAttachment(middle, -margin);
wlRollbackAllChangesOnError.setLayoutData(fdlRollbackAllChangesOnError);
wRollbackAllChangesOnError = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wRollbackAllChangesOnError);
wRollbackAllChangesOnError.setToolTipText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.RollbackAllChangesOnError.Tooltip"));
fdRollbackAllChangesOnError = new FormData();
fdRollbackAllChangesOnError.left = new FormAttachment(middle, 0);
fdRollbackAllChangesOnError.top = new FormAttachment(wUseCompression, margin);
wRollbackAllChangesOnError.setLayoutData(fdRollbackAllChangesOnError);
wRollbackAllChangesOnError.addSelectionListener(new ComponentSelectionListener(input));
// BatchSize value
wlBatchSize = new Label(wSettingsGroup, SWT.RIGHT);
wlBatchSize.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.Limit.Label"));
props.setLook(wlBatchSize);
fdlBatchSize = new FormData();
fdlBatchSize.left = new FormAttachment(0, 0);
fdlBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
fdlBatchSize.right = new FormAttachment(middle, -margin);
wlBatchSize.setLayoutData(fdlBatchSize);
wBatchSize = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBatchSize);
wBatchSize.addModifyListener(lsMod);
fdBatchSize = new FormData();
fdBatchSize.left = new FormAttachment(middle, 0);
fdBatchSize.top = new FormAttachment(wRollbackAllChangesOnError, margin);
fdBatchSize.right = new FormAttachment(100, 0);
wBatchSize.setLayoutData(fdBatchSize);
// Module
wlModule = new Label(wSettingsGroup, SWT.RIGHT);
wlModule.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.Module.Label"));
props.setLook(wlModule);
fdlModule = new FormData();
fdlModule.left = new FormAttachment(0, 0);
fdlModule.top = new FormAttachment(wBatchSize, margin);
fdlModule.right = new FormAttachment(middle, -margin);
wlModule.setLayoutData(fdlModule);
wModule = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wModule.setEditable(true);
props.setLook(wModule);
wModule.addModifyListener(lsTableMod);
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, 0);
fdModule.top = new FormAttachment(wBatchSize, margin);
fdModule.right = new FormAttachment(100, -margin);
wModule.setLayoutData(fdModule);
wModule.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
getModulesListError = false;
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
// check if the URL and login credentials passed and not just had error
if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
return;
}
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getModulesList();
shell.setCursor(null);
busy.dispose();
}
});
// Salesforce Id Field
wlDeleteField = new Label(wSettingsGroup, SWT.RIGHT);
wlDeleteField.setText(BaseMessages.getString(PKG, "SalesforceDeleteDialog.KeyField.Label"));
props.setLook(wlDeleteField);
fdlDeleteField = new FormData();
fdlDeleteField.left = new FormAttachment(0, 0);
fdlDeleteField.top = new FormAttachment(wModule, margin);
fdlDeleteField.right = new FormAttachment(middle, -margin);
wlDeleteField.setLayoutData(fdlDeleteField);
wDeleteField = new ComboVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wDeleteField.setEditable(true);
props.setLook(wDeleteField);
wDeleteField.addModifyListener(lsMod);
fdDeleteField = new FormData();
fdDeleteField.left = new FormAttachment(middle, 0);
fdDeleteField.top = new FormAttachment(wModule, margin);
fdDeleteField.right = new FormAttachment(100, -margin);
wDeleteField.setLayoutData(fdDeleteField);
wDeleteField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
getPreviousFields();
}
});
fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////
// END OF Settings GROUP //
// ///////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// THE BUTTONS
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"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOK, -margin);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData(input);
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.ComboVar in project pentaho-kettle by pentaho.
the class MQTTConsumerDialog method buildSetup.
@Override
protected void buildSetup(Composite wSetupComp) {
props.setLook(wSetupComp);
FormLayout setupLayout = new FormLayout();
setupLayout.marginHeight = 15;
setupLayout.marginWidth = 15;
wSetupComp.setLayout(setupLayout);
Label wlConnection = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlConnection);
wlConnection.setText(BaseMessages.getString(PKG, "MQTTConsumerDialog.Connection"));
FormData fdlConnection = new FormData();
fdlConnection.left = new FormAttachment(0, 0);
fdlConnection.top = new FormAttachment(0, 0);
fdlConnection.right = new FormAttachment(50, 0);
wlConnection.setLayoutData(fdlConnection);
wConnection = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wConnection);
wConnection.addModifyListener(lsMod);
FormData fdConnection = new FormData();
fdConnection.left = new FormAttachment(0, 0);
fdConnection.right = new FormAttachment(0, 363);
fdConnection.top = new FormAttachment(wlConnection, 5);
wConnection.setLayoutData(fdConnection);
Label wlTopics = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlTopics);
wlTopics.setText(BaseMessages.getString(PKG, "MQTTConsumerDialog.Topics"));
FormData fdlTopics = new FormData();
fdlTopics.left = new FormAttachment(0, 0);
fdlTopics.top = new FormAttachment(wConnection, 10);
fdlTopics.right = new FormAttachment(50, 0);
wlTopics.setLayoutData(fdlTopics);
wQOS = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wQOS);
wQOS.addModifyListener(lsMod);
FormData fdQOS = new FormData();
fdQOS.left = new FormAttachment(0, 0);
fdQOS.bottom = new FormAttachment(100, 0);
fdQOS.width = 135;
wQOS.setLayoutData(fdQOS);
wQOS.add("0");
wQOS.add("1");
wQOS.add("2");
Label wlQOS = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlQOS);
wlQOS.setText(BaseMessages.getString(PKG, "MQTTConsumerDialog.QOS"));
FormData fdlQOS = new FormData();
fdlQOS.left = new FormAttachment(0, 0);
fdlQOS.bottom = new FormAttachment(wQOS, -5);
fdlQOS.right = new FormAttachment(50, 0);
wlQOS.setLayoutData(fdlQOS);
// Put last so it expands with the dialog. Anchoring itself to QOS Label and the Topics Label
buildTopicsTable(wSetupComp, wlTopics, wlQOS);
}
use of org.pentaho.di.ui.core.widget.ComboVar in project pentaho-kettle by pentaho.
the class FuzzyMatchDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setComboBoxesLookup();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
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(BaseMessages.getString(PKG, "FuzzyMatchDialog.General.Tab"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout GeneralLayout = new FormLayout();
GeneralLayout.marginWidth = 3;
GeneralLayout.marginHeight = 3;
wGeneralComp.setLayout(GeneralLayout);
// /////////////////////////////////
// START OF Lookup Fields GROUP
// /////////////////////////////////
wLookupGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wLookupGroup);
wLookupGroup.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.Lookup.Label"));
FormLayout LookupgroupLayout = new FormLayout();
LookupgroupLayout.marginWidth = 10;
LookupgroupLayout.marginHeight = 10;
wLookupGroup.setLayout(LookupgroupLayout);
// Source step line...
wlStep = new Label(wLookupGroup, SWT.RIGHT);
wlStep.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.SourceStep.Label"));
props.setLook(wlStep);
fdlStep = new FormData();
fdlStep.left = new FormAttachment(0, 0);
fdlStep.right = new FormAttachment(middle, -margin);
fdlStep.top = new FormAttachment(wStepname, margin);
wlStep.setLayoutData(fdlStep);
wStep = new CCombo(wLookupGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wStep);
List<StepMeta> steps = transMeta.findPreviousSteps(transMeta.findStep(stepname), true);
for (StepMeta stepMeta : steps) {
wStep.add(stepMeta.getName());
}
wStep.addModifyListener(lsMod);
wStep.addSelectionListener(lsSelection);
fdStep = new FormData();
fdStep.left = new FormAttachment(middle, 0);
fdStep.top = new FormAttachment(wStepname, margin);
fdStep.right = new FormAttachment(100, 0);
wStep.setLayoutData(fdStep);
// LookupField
wlLookupField = new Label(wLookupGroup, SWT.RIGHT);
wlLookupField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.wlLookupField.Label"));
props.setLook(wlLookupField);
fdlLookupField = new FormData();
fdlLookupField.left = new FormAttachment(0, 0);
fdlLookupField.top = new FormAttachment(wStep, margin);
fdlLookupField.right = new FormAttachment(middle, -2 * margin);
wlLookupField.setLayoutData(fdlLookupField);
wLookupField = new ComboVar(transMeta, wLookupGroup, SWT.BORDER | SWT.READ_ONLY);
wLookupField.setEditable(true);
props.setLook(wLookupField);
wLookupField.addModifyListener(lsMod);
fdLookupField = new FormData();
fdLookupField.left = new FormAttachment(middle, 0);
fdLookupField.top = new FormAttachment(wStep, margin);
fdLookupField.right = new FormAttachment(100, -margin);
wLookupField.setLayoutData(fdLookupField);
wLookupField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setLookupField();
}
});
fdLookupGroup = new FormData();
fdLookupGroup.left = new FormAttachment(0, margin);
fdLookupGroup.top = new FormAttachment(wStepname, margin);
fdLookupGroup.right = new FormAttachment(100, -margin);
wLookupGroup.setLayoutData(fdLookupGroup);
// ///////////////////////////////////////////////////////////
// / END OF Lookup GROUP
// ///////////////////////////////////////////////////////////
// /////////////////////////////////
// START OF MainStream Fields GROUP
// /////////////////////////////////
wMainStreamGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMainStreamGroup);
wMainStreamGroup.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.MainStreamGroup.Label"));
FormLayout MainStreamgroupLayout = new FormLayout();
MainStreamgroupLayout.marginWidth = 10;
MainStreamgroupLayout.marginHeight = 10;
wMainStreamGroup.setLayout(MainStreamgroupLayout);
// MainStreamFieldname field
wlMainStreamField = new Label(wMainStreamGroup, SWT.RIGHT);
wlMainStreamField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.wlMainStreamField.Label"));
props.setLook(wlMainStreamField);
fdlMainStreamField = new FormData();
fdlMainStreamField.left = new FormAttachment(0, 0);
fdlMainStreamField.top = new FormAttachment(wLookupGroup, margin);
fdlMainStreamField.right = new FormAttachment(middle, -2 * margin);
wlMainStreamField.setLayoutData(fdlMainStreamField);
wMainStreamField = new ComboVar(transMeta, wMainStreamGroup, SWT.BORDER | SWT.READ_ONLY);
wMainStreamField.setEditable(true);
props.setLook(wMainStreamField);
wMainStreamField.addModifyListener(lsMod);
fdMainStreamField = new FormData();
fdMainStreamField.left = new FormAttachment(middle, 0);
fdMainStreamField.top = new FormAttachment(wLookupGroup, margin);
fdMainStreamField.right = new FormAttachment(100, -margin);
wMainStreamField.setLayoutData(fdMainStreamField);
wMainStreamField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setMainStreamField();
}
});
fdMainStreamGroup = new FormData();
fdMainStreamGroup.left = new FormAttachment(0, margin);
fdMainStreamGroup.top = new FormAttachment(wLookupGroup, margin);
fdMainStreamGroup.right = new FormAttachment(100, -margin);
wMainStreamGroup.setLayoutData(fdMainStreamGroup);
// ///////////////////////////////////////////////////////////
// / END OF MainStream GROUP
// ///////////////////////////////////////////////////////////
// /////////////////////////////////
// START OF Settings Fields GROUP
// /////////////////////////////////
wSettingsGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.SettingsGroup.Label"));
FormLayout SettingsgroupLayout = new FormLayout();
SettingsgroupLayout.marginWidth = 10;
SettingsgroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(SettingsgroupLayout);
// Algorithm
wlAlgorithm = new Label(wSettingsGroup, SWT.RIGHT);
wlAlgorithm.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Algorithm.Label"));
props.setLook(wlAlgorithm);
fdlAlgorithm = new FormData();
fdlAlgorithm.left = new FormAttachment(0, 0);
fdlAlgorithm.right = new FormAttachment(middle, -margin);
fdlAlgorithm.top = new FormAttachment(wMainStreamGroup, margin);
wlAlgorithm.setLayoutData(fdlAlgorithm);
wAlgorithm = new CCombo(wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wAlgorithm);
wAlgorithm.addModifyListener(lsMod);
fdAlgorithm = new FormData();
fdAlgorithm.left = new FormAttachment(middle, 0);
fdAlgorithm.top = new FormAttachment(wMainStreamGroup, margin);
fdAlgorithm.right = new FormAttachment(100, -margin);
wAlgorithm.setLayoutData(fdAlgorithm);
wAlgorithm.setItems(FuzzyMatchMeta.algorithmDesc);
wAlgorithm.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAlgorithm();
}
});
// Is case sensitive
wlcaseSensitive = new Label(wSettingsGroup, SWT.RIGHT);
wlcaseSensitive.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.caseSensitive.Label"));
props.setLook(wlcaseSensitive);
fdlcaseSensitive = new FormData();
fdlcaseSensitive.left = new FormAttachment(0, 0);
fdlcaseSensitive.top = new FormAttachment(wAlgorithm, margin);
fdlcaseSensitive.right = new FormAttachment(middle, -2 * margin);
wlcaseSensitive.setLayoutData(fdlcaseSensitive);
wcaseSensitive = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wcaseSensitive);
wcaseSensitive.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.caseSensitive.Tooltip"));
fdcaseSensitive = new FormData();
fdcaseSensitive.left = new FormAttachment(middle, 0);
fdcaseSensitive.top = new FormAttachment(wAlgorithm, margin);
wcaseSensitive.setLayoutData(fdcaseSensitive);
SelectionAdapter lcaseSensitive = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
};
wcaseSensitive.addSelectionListener(lcaseSensitive);
// Is get closer value
wlgetCloserValue = new Label(wSettingsGroup, SWT.RIGHT);
wlgetCloserValue.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.getCloserValue.Label"));
props.setLook(wlgetCloserValue);
fdlgetCloserValue = new FormData();
fdlgetCloserValue.left = new FormAttachment(0, 0);
fdlgetCloserValue.top = new FormAttachment(wcaseSensitive, margin);
fdlgetCloserValue.right = new FormAttachment(middle, -2 * margin);
wlgetCloserValue.setLayoutData(fdlgetCloserValue);
wgetCloserValue = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wgetCloserValue);
wgetCloserValue.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.getCloserValue.Tooltip"));
fdgetCloserValue = new FormData();
fdgetCloserValue.left = new FormAttachment(middle, 0);
fdgetCloserValue.top = new FormAttachment(wcaseSensitive, margin);
wgetCloserValue.setLayoutData(fdgetCloserValue);
SelectionAdapter lgetCloserValue = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
activegetCloserValue();
input.setChanged();
}
};
wgetCloserValue.addSelectionListener(lgetCloserValue);
wlminValue = new Label(wSettingsGroup, SWT.RIGHT);
wlminValue.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.minValue.Label"));
props.setLook(wlminValue);
fdlminValue = new FormData();
fdlminValue.left = new FormAttachment(0, 0);
fdlminValue.top = new FormAttachment(wgetCloserValue, margin);
fdlminValue.right = new FormAttachment(middle, -margin);
wlminValue.setLayoutData(fdlminValue);
wminValue = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wminValue);
wminValue.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.minValue.Tooltip"));
wminValue.addModifyListener(lsMod);
fdminValue = new FormData();
fdminValue.left = new FormAttachment(middle, 0);
fdminValue.top = new FormAttachment(wgetCloserValue, margin);
fdminValue.right = new FormAttachment(100, 0);
wminValue.setLayoutData(fdminValue);
wlmaxValue = new Label(wSettingsGroup, SWT.RIGHT);
wlmaxValue.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.maxValue.Label"));
props.setLook(wlmaxValue);
fdlmaxValue = new FormData();
fdlmaxValue.left = new FormAttachment(0, 0);
fdlmaxValue.top = new FormAttachment(wminValue, margin);
fdlmaxValue.right = new FormAttachment(middle, -margin);
wlmaxValue.setLayoutData(fdlmaxValue);
wmaxValue = new TextVar(transMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wmaxValue);
wmaxValue.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.maxValue.Tooltip"));
wmaxValue.addModifyListener(lsMod);
fdmaxValue = new FormData();
fdmaxValue.left = new FormAttachment(middle, 0);
fdmaxValue.top = new FormAttachment(wminValue, margin);
fdmaxValue.right = new FormAttachment(100, 0);
wmaxValue.setLayoutData(fdmaxValue);
wlseparator = new Label(wSettingsGroup, SWT.RIGHT);
wlseparator.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.separator.Label"));
props.setLook(wlseparator);
fdlseparator = new FormData();
fdlseparator.left = new FormAttachment(0, 0);
fdlseparator.top = new FormAttachment(wmaxValue, margin);
fdlseparator.right = new FormAttachment(middle, -margin);
wlseparator.setLayoutData(fdlseparator);
wseparator = new TextVar(transMeta, wSettingsGroup, 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(wmaxValue, margin);
fdseparator.right = new FormAttachment(100, 0);
wseparator.setLayoutData(fdseparator);
fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wMainStreamGroup, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////////////////////////////////
// / END OF Settings GROUP
// ///////////////////////////////////////////////////////////
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);
// ///////////////////////////////////////////////////////////
// / END OF General TAB
// ///////////////////////////////////////////////////////////
// THE BUTTONS
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"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
// ////////////////////////
// START OF Fields TAB ///
// ////////////////////////
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Fields.Tab"));
wFieldsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFieldsComp);
FormLayout FieldsLayout = new FormLayout();
FieldsLayout.marginWidth = 3;
FieldsLayout.marginHeight = 3;
wFieldsComp.setLayout(FieldsLayout);
// /////////////////////////////////
// START OF OutputFields Fields GROUP
// /////////////////////////////////
wOutputFieldsGroup = new Group(wFieldsComp, SWT.SHADOW_NONE);
props.setLook(wOutputFieldsGroup);
wOutputFieldsGroup.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.Group.OutputFieldsGroup.Label"));
FormLayout OutputFieldsgroupLayout = new FormLayout();
OutputFieldsgroupLayout.marginWidth = 10;
OutputFieldsgroupLayout.marginHeight = 10;
wOutputFieldsGroup.setLayout(OutputFieldsgroupLayout);
wlmatchField = new Label(wOutputFieldsGroup, SWT.RIGHT);
wlmatchField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.MatchField.Label"));
props.setLook(wlmatchField);
fdlmatchField = new FormData();
fdlmatchField.left = new FormAttachment(0, 0);
fdlmatchField.top = new FormAttachment(wSettingsGroup, margin);
fdlmatchField.right = new FormAttachment(middle, -margin);
wlmatchField.setLayoutData(fdlmatchField);
wmatchField = new TextVar(transMeta, wOutputFieldsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wmatchField);
wmatchField.addModifyListener(lsMod);
fdmatchField = new FormData();
fdmatchField.left = new FormAttachment(middle, 0);
fdmatchField.top = new FormAttachment(wSettingsGroup, margin);
fdmatchField.right = new FormAttachment(100, 0);
wmatchField.setLayoutData(fdmatchField);
wlvalueField = new Label(wOutputFieldsGroup, SWT.RIGHT);
wlvalueField.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.valueField.Label"));
props.setLook(wlvalueField);
fdlvalueField = new FormData();
fdlvalueField.left = new FormAttachment(0, 0);
fdlvalueField.top = new FormAttachment(wmatchField, margin);
fdlvalueField.right = new FormAttachment(middle, -margin);
wlvalueField.setLayoutData(fdlvalueField);
wvalueField = new TextVar(transMeta, wOutputFieldsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wvalueField);
wvalueField.setToolTipText(BaseMessages.getString(PKG, "FuzzyMatchDialog.valueField.Tooltip"));
wvalueField.addModifyListener(lsMod);
fdvalueField = new FormData();
fdvalueField.left = new FormAttachment(middle, 0);
fdvalueField.top = new FormAttachment(wmatchField, margin);
fdvalueField.right = new FormAttachment(100, 0);
wvalueField.setLayoutData(fdvalueField);
fdOutputFieldsGroup = new FormData();
fdOutputFieldsGroup.left = new FormAttachment(0, margin);
fdOutputFieldsGroup.top = new FormAttachment(wSettingsGroup, margin);
fdOutputFieldsGroup.right = new FormAttachment(100, -margin);
wOutputFieldsGroup.setLayoutData(fdOutputFieldsGroup);
// ///////////////////////////////////////////////////////////
// / END OF OutputFields GROUP
// ///////////////////////////////////////////////////////////
// THE UPDATE/INSERT TABLE
wlReturn = new Label(wFieldsComp, SWT.NONE);
wlReturn.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.ReturnFields.Label"));
props.setLook(wlReturn);
fdlReturn = new FormData();
fdlReturn.left = new FormAttachment(0, 0);
fdlReturn.top = new FormAttachment(wOutputFieldsGroup, margin);
wlReturn.setLayoutData(fdlReturn);
wGetLU = new Button(wFieldsComp, SWT.PUSH);
wGetLU.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.GetLookupFields.Button"));
FormData fdlu = new FormData();
fdlu.top = new FormAttachment(wlReturn, margin);
fdlu.right = new FormAttachment(100, 0);
wGetLU.setLayoutData(fdlu);
int UpInsCols = 2;
int UpInsRows = (input.getValue() != null ? input.getValue().length : 1);
ciReturn = new ColumnInfo[UpInsCols];
ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "FuzzyMatchDialog.ColumnInfo.FieldReturn"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "FuzzyMatchDialog.ColumnInfo.NewName"), ColumnInfo.COLUMN_TYPE_TEXT, false);
wReturn = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
fdReturn = new FormData();
fdReturn.left = new FormAttachment(0, 0);
fdReturn.top = new FormAttachment(wlReturn, margin);
fdReturn.right = new FormAttachment(wGetLU, -margin);
fdReturn.bottom = new FormAttachment(100, -3 * margin);
wReturn.setLayoutData(fdReturn);
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
// ///////////////////////////////////////////////////////////
// / END OF Fields TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOK, -margin);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGetLU = new Listener() {
public void handleEvent(Event e) {
getlookup();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
wGetLU.addListener(SWT.Selection, lsGetLU);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
setComboBoxesLookup();
activeAlgorithm();
activegetCloserValue();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.ComboVar in project pentaho-kettle by pentaho.
the class GetSlaveSequenceDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "GetSequenceDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "GetSequenceDialog.StepName.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// Valuename line
wlValuename = new Label(shell, SWT.RIGHT);
wlValuename.setText(BaseMessages.getString(PKG, "GetSequenceDialog.Valuename.Label"));
props.setLook(wlValuename);
FormData fdlValuename = new FormData();
fdlValuename.left = new FormAttachment(0, 0);
fdlValuename.top = new FormAttachment(wStepname, margin);
fdlValuename.right = new FormAttachment(middle, -margin);
wlValuename.setLayoutData(fdlValuename);
wValuename = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wValuename.setText("");
props.setLook(wValuename);
wValuename.addModifyListener(lsMod);
FormData fdValuename = new FormData();
fdValuename.left = new FormAttachment(middle, 0);
fdValuename.top = new FormAttachment(wStepname, margin);
fdValuename.right = new FormAttachment(100, 0);
wValuename.setLayoutData(fdValuename);
// Connection line
//
wlSlaveServer = new Label(shell, SWT.RIGHT);
wlSlaveServer.setText(BaseMessages.getString(PKG, "GetSequenceDialog.SlaveServer.Label"));
props.setLook(wlSlaveServer);
FormData fdlSlaveServer = new FormData();
fdlSlaveServer.left = new FormAttachment(0, 0);
fdlSlaveServer.top = new FormAttachment(wValuename, margin);
fdlSlaveServer.right = new FormAttachment(middle, -margin);
wlSlaveServer.setLayoutData(fdlSlaveServer);
wSlaveServer = new ComboVar(transMeta, shell, SWT.LEFT | SWT.SINGLE | SWT.BORDER);
wSlaveServer.setItems(transMeta.getSlaveServerNames());
FormData fdSlaveServer = new FormData();
fdSlaveServer.left = new FormAttachment(middle, 0);
fdSlaveServer.top = new FormAttachment(wValuename, margin);
fdSlaveServer.right = new FormAttachment(100, 0);
wSlaveServer.setLayoutData(fdSlaveServer);
// Seqname line
wlSeqname = new Label(shell, SWT.RIGHT);
wlSeqname.setText(BaseMessages.getString(PKG, "GetSequenceDialog.Seqname.Label"));
props.setLook(wlSeqname);
FormData fdlSeqname = new FormData();
fdlSeqname.left = new FormAttachment(0, 0);
fdlSeqname.right = new FormAttachment(middle, -margin);
fdlSeqname.top = new FormAttachment(wSlaveServer, margin);
wlSeqname.setLayoutData(fdlSeqname);
wSeqname = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSeqname.setText("");
props.setLook(wSeqname);
wSeqname.addModifyListener(lsMod);
FormData fdSeqname = new FormData();
fdSeqname.left = new FormAttachment(middle, 0);
fdSeqname.top = new FormAttachment(wSlaveServer, margin);
fdSeqname.right = new FormAttachment(100, 0);
wSeqname.setLayoutData(fdSeqname);
// Increment line
wlIncrement = new Label(shell, SWT.RIGHT);
wlIncrement.setText(BaseMessages.getString(PKG, "GetSequenceDialog.Increment.Label"));
props.setLook(wlIncrement);
FormData fdlIncrement = new FormData();
fdlIncrement.left = new FormAttachment(0, 0);
fdlIncrement.right = new FormAttachment(middle, -margin);
fdlIncrement.top = new FormAttachment(wSeqname, margin);
wlIncrement.setLayoutData(fdlIncrement);
wIncrement = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wIncrement.setText("");
props.setLook(wIncrement);
wIncrement.addModifyListener(lsMod);
FormData fdIncrement = new FormData();
fdIncrement.left = new FormAttachment(middle, 0);
fdIncrement.top = new FormAttachment(wSeqname, margin);
fdIncrement.right = new FormAttachment(100, 0);
wIncrement.setLayoutData(fdIncrement);
// THE BUTTONS
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"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wIncrement);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wValuename.addSelectionListener(lsDef);
wSeqname.addSelectionListener(lsDef);
wIncrement.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations