use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class FixedInputDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, inputMeta);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
inputMeta.setChanged();
}
};
changed = inputMeta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "FixedInputDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Step name line
//
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "FixedInputDialog.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);
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);
Control lastControl = wStepname;
// Filename...
//
// The filename browse button
//
wbbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbbFilename);
wbbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
FormData fdbFilename = new FormData();
fdbFilename.top = new FormAttachment(lastControl, margin);
fdbFilename.right = new FormAttachment(100, 0);
wbbFilename.setLayoutData(fdbFilename);
// The field itself...
//
Label wlFilename = new Label(shell, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "FixedInputDialog.Filename.Label"));
props.setLook(wlFilename);
FormData fdlFilename = new FormData();
fdlFilename.top = new FormAttachment(lastControl, margin);
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wFilename = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
FormData fdFilename = new FormData();
fdFilename.top = new FormAttachment(lastControl, margin);
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.right = new FormAttachment(wbbFilename, -margin);
wFilename.setLayoutData(fdFilename);
lastControl = wFilename;
// delimiter
Label wlLineWidth = new Label(shell, SWT.RIGHT);
wlLineWidth.setText(BaseMessages.getString(PKG, "FixedInputDialog.LineWidth.Label"));
props.setLook(wlLineWidth);
FormData fdlLineWidth = new FormData();
fdlLineWidth.top = new FormAttachment(lastControl, margin);
fdlLineWidth.left = new FormAttachment(0, 0);
fdlLineWidth.right = new FormAttachment(middle, -margin);
wlLineWidth.setLayoutData(fdlLineWidth);
wLineWidth = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLineWidth);
wLineWidth.addModifyListener(lsMod);
FormData fdLineWidth = new FormData();
fdLineWidth.top = new FormAttachment(lastControl, margin);
fdLineWidth.left = new FormAttachment(middle, 0);
fdLineWidth.right = new FormAttachment(100, 0);
wLineWidth.setLayoutData(fdLineWidth);
lastControl = wLineWidth;
// delimiter
Label wlLineFeedPresent = new Label(shell, SWT.RIGHT);
wlLineFeedPresent.setText(BaseMessages.getString(PKG, "FixedInputDialog.LineFeedPresent.Label"));
props.setLook(wlLineFeedPresent);
FormData fdlLineFeedPresent = new FormData();
fdlLineFeedPresent.top = new FormAttachment(lastControl, margin);
fdlLineFeedPresent.left = new FormAttachment(0, 0);
fdlLineFeedPresent.right = new FormAttachment(middle, -margin);
wlLineFeedPresent.setLayoutData(fdlLineFeedPresent);
wLineFeedPresent = new Button(shell, SWT.CHECK);
props.setLook(wLineFeedPresent);
FormData fdLineFeedPresent = new FormData();
fdLineFeedPresent.top = new FormAttachment(lastControl, margin);
fdLineFeedPresent.left = new FormAttachment(middle, 0);
fdLineFeedPresent.right = new FormAttachment(100, 0);
wLineFeedPresent.setLayoutData(fdLineFeedPresent);
lastControl = wLineFeedPresent;
// bufferSize
//
Label wlBufferSize = new Label(shell, SWT.RIGHT);
wlBufferSize.setText(BaseMessages.getString(PKG, "FixedInputDialog.BufferSize.Label"));
props.setLook(wlBufferSize);
FormData fdlBufferSize = new FormData();
fdlBufferSize.top = new FormAttachment(lastControl, margin);
fdlBufferSize.left = new FormAttachment(0, 0);
fdlBufferSize.right = new FormAttachment(middle, -margin);
wlBufferSize.setLayoutData(fdlBufferSize);
wBufferSize = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBufferSize);
wBufferSize.addModifyListener(lsMod);
FormData fdBufferSize = new FormData();
fdBufferSize.top = new FormAttachment(lastControl, margin);
fdBufferSize.left = new FormAttachment(middle, 0);
fdBufferSize.right = new FormAttachment(100, 0);
wBufferSize.setLayoutData(fdBufferSize);
lastControl = wBufferSize;
// performingLazyConversion?
//
Label wlLazyConversion = new Label(shell, SWT.RIGHT);
wlLazyConversion.setText(BaseMessages.getString(PKG, "FixedInputDialog.LazyConversion.Label"));
props.setLook(wlLazyConversion);
FormData fdlLazyConversion = new FormData();
fdlLazyConversion.top = new FormAttachment(lastControl, margin);
fdlLazyConversion.left = new FormAttachment(0, 0);
fdlLazyConversion.right = new FormAttachment(middle, -margin);
wlLazyConversion.setLayoutData(fdlLazyConversion);
wLazyConversion = new Button(shell, SWT.CHECK);
props.setLook(wLazyConversion);
FormData fdLazyConversion = new FormData();
fdLazyConversion.top = new FormAttachment(lastControl, margin);
fdLazyConversion.left = new FormAttachment(middle, 0);
fdLazyConversion.right = new FormAttachment(100, 0);
wLazyConversion.setLayoutData(fdLazyConversion);
lastControl = wLazyConversion;
// header row?
//
Label wlHeaderPresent = new Label(shell, SWT.RIGHT);
wlHeaderPresent.setText(BaseMessages.getString(PKG, "FixedInputDialog.HeaderPresent.Label"));
props.setLook(wlHeaderPresent);
FormData fdlHeaderPresent = new FormData();
fdlHeaderPresent.top = new FormAttachment(lastControl, margin);
fdlHeaderPresent.left = new FormAttachment(0, 0);
fdlHeaderPresent.right = new FormAttachment(middle, -margin);
wlHeaderPresent.setLayoutData(fdlHeaderPresent);
wHeaderPresent = new Button(shell, SWT.CHECK);
props.setLook(wHeaderPresent);
FormData fdHeaderPresent = new FormData();
fdHeaderPresent.top = new FormAttachment(lastControl, margin);
fdHeaderPresent.left = new FormAttachment(middle, 0);
fdHeaderPresent.right = new FormAttachment(100, 0);
wHeaderPresent.setLayoutData(fdHeaderPresent);
lastControl = wHeaderPresent;
// running in parallel?
//
Label wlRunningInParallel = new Label(shell, SWT.RIGHT);
wlRunningInParallel.setText(BaseMessages.getString(PKG, "FixedInputDialog.RunningInParallel.Label"));
props.setLook(wlRunningInParallel);
FormData fdlRunningInParallel = new FormData();
fdlRunningInParallel.top = new FormAttachment(lastControl, margin);
fdlRunningInParallel.left = new FormAttachment(0, 0);
fdlRunningInParallel.right = new FormAttachment(middle, -margin);
wlRunningInParallel.setLayoutData(fdlRunningInParallel);
wRunningInParallel = new Button(shell, SWT.CHECK);
props.setLook(wRunningInParallel);
FormData fdRunningInParallel = new FormData();
fdRunningInParallel.top = new FormAttachment(lastControl, margin);
fdRunningInParallel.left = new FormAttachment(middle, 0);
wRunningInParallel.setLayoutData(fdRunningInParallel);
// The file type...
//
wlFileType = new Label(shell, SWT.RIGHT);
wlFileType.setText(BaseMessages.getString(PKG, "FixedInputDialog.FileType.Label"));
wlFileType.setToolTipText(BaseMessages.getString(PKG, "FixedInputDialog.FileType.ToolTip"));
props.setLook(wlFileType);
FormData fdlFileType = new FormData();
fdlFileType.top = new FormAttachment(lastControl, margin);
fdlFileType.left = new FormAttachment(wRunningInParallel, margin * 2);
wlFileType.setLayoutData(fdlFileType);
wFileType = new CCombo(shell, SWT.BORDER | SWT.READ_ONLY);
wFileType.setToolTipText(BaseMessages.getString(PKG, "FixedInputDialog.FileType.ToolTip"));
props.setLook(wFileType);
wFileType.setItems(FixedInputMeta.fileTypeDesc);
FormData fdFileType = new FormData();
fdFileType.top = new FormAttachment(lastControl, margin);
fdFileType.left = new FormAttachment(wlFileType, margin);
fdFileType.right = new FormAttachment(100, 0);
wFileType.setLayoutData(fdFileType);
lastControl = wFileType;
wRunningInParallel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
enableFields();
}
});
Label wlEncoding = new Label(shell, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "FixedInputDialog.Encoding.Label"));
props.setLook(wlEncoding);
FormData fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(lastControl, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new ComboVar(transMeta, shell, SWT.BORDER | SWT.READ_ONLY);
wEncoding.setEditable(true);
props.setLook(wEncoding);
wEncoding.addModifyListener(lsMod);
FormData fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.top = new FormAttachment(lastControl, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
lastControl = wEncoding;
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();
}
});
wlAddResult = new Label(shell, SWT.RIGHT);
wlAddResult.setText(BaseMessages.getString(PKG, "FixedInputDialog.AddResult.Label"));
props.setLook(wlAddResult);
fdlAddResult = new FormData();
fdlAddResult.left = new FormAttachment(0, 0);
fdlAddResult.top = new FormAttachment(lastControl, margin);
fdlAddResult.right = new FormAttachment(middle, -margin);
wlAddResult.setLayoutData(fdlAddResult);
wAddResult = new Button(shell, SWT.CHECK);
props.setLook(wAddResult);
wAddResult.setToolTipText(BaseMessages.getString(PKG, "FixedInputDialog.AddResult.Tooltip"));
fdAddResult = new FormData();
fdAddResult.left = new FormAttachment(middle, 0);
fdAddResult.top = new FormAttachment(lastControl, margin);
wAddResult.setLayoutData(fdAddResult);
lastControl = wAddResult;
// Some buttons first, so that the dialog scales nicely...
//
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wGet, wPreview, wCancel }, margin, null);
// Fields
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 2), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.WidthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.LengthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.PrecisionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.CurrencyColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.DecimalColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.GroupColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "FixedInputDialog.TrimColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc) };
colinf[2].setComboValuesSelectionListener(new ComboValuesSelectionListener() {
public String[] getComboValues(TableItem tableItem, int rowNr, int colNr) {
String[] comboValues = new String[] {};
int type = ValueMetaFactory.getIdForValueMeta(tableItem.getText(colNr - 1));
switch(type) {
case ValueMetaInterface.TYPE_DATE:
comboValues = Const.getDateFormats();
break;
case ValueMetaInterface.TYPE_INTEGER:
case ValueMetaInterface.TYPE_BIGNUMBER:
case ValueMetaInterface.TYPE_NUMBER:
comboValues = Const.getNumberFormats();
break;
default:
break;
}
return comboValues;
}
});
wFields = new TableView(transMeta, shell, SWT.FULL_SELECTION | SWT.MULTI, colinf, 1, lsMod, props);
FormData fdFields = new FormData();
fdFields.top = new FormAttachment(lastControl, margin * 2);
fdFields.bottom = new FormAttachment(wOK, -margin * 2);
fdFields.left = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
getFixed();
}
};
lsPreview = new Listener() {
public void handleEvent(Event e) {
preview();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wPreview.addListener(SWT.Selection, lsPreview);
wGet.addListener(SWT.Selection, lsGet);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wFilename.addSelectionListener(lsDef);
wLineWidth.addSelectionListener(lsDef);
wBufferSize.addSelectionListener(lsDef);
// Listen to the browse button next to the file name
wbbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.txt", "*" });
if (wFilename.getText() != null) {
String fname = transMeta.environmentSubstitute(wFilename.getText());
dialog.setFileName(fname);
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
wFilename.setText(str);
}
}
});
// 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();
inputMeta.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class ExcelOutputDialog method open.
@Override
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() {
@Override
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, "ExcelOutputDialog.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///
// /
wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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, "ExcelOutputDialog.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);
// Create Parent Folder
wlCreateParentFolder = new Label(wFileComp, SWT.RIGHT);
wlCreateParentFolder.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.CreateParentFolder.Label"));
props.setLook(wlCreateParentFolder);
fdlCreateParentFolder = new FormData();
fdlCreateParentFolder.left = new FormAttachment(0, 0);
fdlCreateParentFolder.top = new FormAttachment(wFilename, margin);
fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
wCreateParentFolder = new Button(wFileComp, SWT.CHECK);
wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.CreateParentFolder.Tooltip"));
props.setLook(wCreateParentFolder);
fdCreateParentFolder = new FormData();
fdCreateParentFolder.left = new FormAttachment(middle, 0);
fdCreateParentFolder.top = new FormAttachment(wFilename, margin);
fdCreateParentFolder.right = new FormAttachment(100, 0);
wCreateParentFolder.setLayoutData(fdCreateParentFolder);
wCreateParentFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Open new File at Init
wlDoNotOpenNewFileInit = new Label(wFileComp, SWT.RIGHT);
wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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, "ExcelOutputDialog.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() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// 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(wDoNotOpenNewFileInit, 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(wDoNotOpenNewFileInit, margin);
fdExtension.right = new FormAttachment(wbFilename, -margin);
wExtension.setLayoutData(fdExtension);
// Create multi-part file?
wlAddStepnr = new Label(wFileComp, SWT.RIGHT);
wlAddStepnr.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddDate = new Label(wFileComp, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wAddStepnr, 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(wAddStepnr, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
// System.out.println("wAddDate.getSelection()="+wAddDate.getSelection());
}
});
// Create multi-part file?
wlAddTime = new Label(wFileComp, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wFileComp, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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, "ExcelOutputDialog.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() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setDateTimeFormat();
}
});
// Prepare a list of possible DateTimeFormats...
String[] dats = Const.getDateFormats();
// DateTimeFormat
wlDateTimeFormat = new Label(wFileComp, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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);
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, "ExcelOutputDialog.ShowFiles.Button"));
fdbShowFiles = new FormData();
fdbShowFiles.left = new FormAttachment(middle, 0);
fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 3);
wbShowFiles.setLayoutData(fdbShowFiles);
wbShowFiles.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ExcelOutputMeta tfoi = new ExcelOutputMeta();
getInfo(tfoi);
String[] files = tfoi.getFiles(transMeta);
if (files != null && files.length > 0) {
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "ExcelOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "ExcelOutputDialog.SelectOutputFiles.DialogMessage"));
esd.setViewOnly();
esd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "ExcelOutputDialog.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, "ExcelOutputDialog.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, "ExcelOutputDialog.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() {
@Override
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, "ExcelOutputDialog.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 checkbox
wlAppend = new Label(wContentComp, SWT.RIGHT);
wlAppend.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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);
wAppend.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Append.Tooltip"));
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() {
@Override
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
});
wlHeader = new Label(wContentComp, SWT.RIGHT);
wlHeader.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Header.Label"));
props.setLook(wlHeader);
fdlHeader = new FormData();
fdlHeader.left = new FormAttachment(0, 0);
fdlHeader.top = new FormAttachment(wAppend, 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(wAppend, margin);
fdHeader.right = new FormAttachment(100, 0);
wHeader.setLayoutData(fdHeader);
wHeader.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFooter = new Label(wContentComp, SWT.RIGHT);
wlFooter.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlEncoding = new Label(wContentComp, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Encoding.Label"));
props.setLook(wlEncoding);
fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wFooter, 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(wFooter, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addFocusListener(new FocusListener() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
@Override
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();
}
});
wlSplitEvery = new Label(wContentComp, SWT.RIGHT);
wlSplitEvery.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.SplitEvery.Label"));
props.setLook(wlSplitEvery);
fdlSplitEvery = new FormData();
fdlSplitEvery.left = new FormAttachment(0, 0);
fdlSplitEvery.top = new FormAttachment(wEncoding, 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(wEncoding, margin);
fdSplitEvery.right = new FormAttachment(100, 0);
wSplitEvery.setLayoutData(fdSplitEvery);
// Sheet name line
wlSheetname = new Label(wContentComp, SWT.RIGHT);
wlSheetname.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Sheetname.Label"));
props.setLook(wlSheetname);
fdlSheetname = new FormData();
fdlSheetname.left = new FormAttachment(0, 0);
fdlSheetname.top = new FormAttachment(wSplitEvery, margin);
fdlSheetname.right = new FormAttachment(middle, -margin);
wlSheetname.setLayoutData(fdlSheetname);
wSheetname = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSheetname.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Sheetname.Tooltip"));
props.setLook(wSheetname);
wSheetname.addModifyListener(lsMod);
fdSheetname = new FormData();
fdSheetname.left = new FormAttachment(middle, 0);
fdSheetname.top = new FormAttachment(wSplitEvery, margin);
fdSheetname.right = new FormAttachment(100, 0);
wSheetname.setLayoutData(fdSheetname);
// Protect Sheet?
wlProtectSheet = new Label(wContentComp, SWT.RIGHT);
wlProtectSheet.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.ProtectSheet.Label"));
props.setLook(wlProtectSheet);
fdlProtectSheet = new FormData();
fdlProtectSheet.left = new FormAttachment(0, 0);
fdlProtectSheet.top = new FormAttachment(wSheetname, margin);
fdlProtectSheet.right = new FormAttachment(middle, -margin);
wlProtectSheet.setLayoutData(fdlProtectSheet);
wProtectSheet = new Button(wContentComp, SWT.CHECK);
props.setLook(wProtectSheet);
fdProtectSheet = new FormData();
fdProtectSheet.left = new FormAttachment(middle, 0);
fdProtectSheet.top = new FormAttachment(wSheetname, margin);
fdProtectSheet.right = new FormAttachment(100, 0);
wProtectSheet.setLayoutData(fdProtectSheet);
wProtectSheet.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
EnablePassword();
}
});
// Password line
wlPassword = new Label(wContentComp, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wProtectSheet, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.Password.Tooltip"));
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wProtectSheet, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// auto size columns?
wlAutoSize = new Label(wContentComp, SWT.RIGHT);
wlAutoSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AutoSize.Label"));
props.setLook(wlAutoSize);
fdlAutoSize = new FormData();
fdlAutoSize.left = new FormAttachment(0, 0);
fdlAutoSize.top = new FormAttachment(wPassword, margin);
fdlAutoSize.right = new FormAttachment(middle, -margin);
wlAutoSize.setLayoutData(fdlAutoSize);
wAutoSize = new Button(wContentComp, SWT.CHECK);
props.setLook(wAutoSize);
wAutoSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.AutoSize.Tooltip"));
fdAutoSize = new FormData();
fdAutoSize.left = new FormAttachment(middle, 0);
fdAutoSize.top = new FormAttachment(wPassword, margin);
fdAutoSize.right = new FormAttachment(100, 0);
wAutoSize.setLayoutData(fdAutoSize);
wAutoSize.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
EnableAutoSize();
}
});
// write null values as blank cells ?
wlNullIsBlank = new Label(wContentComp, SWT.RIGHT);
wlNullIsBlank.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.NullIsBlank.Label"));
props.setLook(wlNullIsBlank);
fdlNullIsBlank = new FormData();
fdlNullIsBlank.left = new FormAttachment(0, 0);
fdlNullIsBlank.top = new FormAttachment(wAutoSize, margin);
fdlNullIsBlank.right = new FormAttachment(middle, -margin);
wlNullIsBlank.setLayoutData(fdlNullIsBlank);
wNullIsBlank = new Button(wContentComp, SWT.CHECK);
props.setLook(wNullIsBlank);
wNullIsBlank.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.NullIsBlank.Tooltip"));
fdNullIsBlank = new FormData();
fdNullIsBlank.left = new FormAttachment(middle, 0);
fdNullIsBlank.top = new FormAttachment(wAutoSize, margin);
fdNullIsBlank.right = new FormAttachment(100, 0);
wNullIsBlank.setLayoutData(fdNullIsBlank);
// use temporary files?
wluseTempFiles = new Label(wContentComp, SWT.RIGHT);
wluseTempFiles.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.useTempFile.Label"));
props.setLook(wluseTempFiles);
fdluseTempFiles = new FormData();
fdluseTempFiles.left = new FormAttachment(0, 0);
fdluseTempFiles.top = new FormAttachment(wNullIsBlank, margin);
fdluseTempFiles.right = new FormAttachment(middle, -margin);
wluseTempFiles.setLayoutData(fdluseTempFiles);
wuseTempFiles = new Button(wContentComp, SWT.CHECK);
props.setLook(wuseTempFiles);
wuseTempFiles.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.useTempFile.Tooltip"));
fduseTempFiles = new FormData();
fduseTempFiles.left = new FormAttachment(middle, 0);
fduseTempFiles.top = new FormAttachment(wNullIsBlank, margin);
fduseTempFiles.right = new FormAttachment(100, 0);
wuseTempFiles.setLayoutData(fduseTempFiles);
wuseTempFiles.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
useTempFile();
}
});
// TempDirectory line
wlTempDirectory = new Label(wContentComp, SWT.RIGHT);
wlTempDirectory.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TempDirectory.Label"));
props.setLook(wlTempDirectory);
fdlTempDirectory = new FormData();
fdlTempDirectory.left = new FormAttachment(0, 0);
fdlTempDirectory.top = new FormAttachment(wuseTempFiles, margin);
fdlTempDirectory.right = new FormAttachment(middle, -margin);
wlTempDirectory.setLayoutData(fdlTempDirectory);
// Select TempDir
wbTempDir = new Button(wContentComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbTempDir);
wbTempDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbTempDir = new FormData();
fdbTempDir.right = new FormAttachment(100, -margin);
fdbTempDir.top = new FormAttachment(wuseTempFiles, margin);
wbTempDir.setLayoutData(fdbTempDir);
wTempDirectory = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wTempDirectory.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.TempDirectory.Tooltip"));
props.setLook(wTempDirectory);
wTempDirectory.addModifyListener(lsMod);
fdTempDirectory = new FormData();
fdTempDirectory.left = new FormAttachment(middle, 0);
fdTempDirectory.top = new FormAttachment(wuseTempFiles, margin);
fdTempDirectory.right = new FormAttachment(wbTempDir, -margin);
wTempDirectory.setLayoutData(fdTempDirectory);
wTempDirectory.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
input.setChanged();
}
});
// ///////////////////////////////
// START OF Template Group GROUP //
// ///////////////////////////////
wTemplateGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wTemplateGroup);
wTemplateGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateGroup.Label"));
FormLayout TemplateGroupgroupLayout = new FormLayout();
TemplateGroupgroupLayout.marginWidth = 10;
TemplateGroupgroupLayout.marginHeight = 10;
wTemplateGroup.setLayout(TemplateGroupgroupLayout);
// Use template
wlTemplate = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplate.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Template.Label"));
props.setLook(wlTemplate);
fdlTemplate = new FormData();
fdlTemplate.left = new FormAttachment(0, 0);
fdlTemplate.top = new FormAttachment(wTempDirectory, margin);
fdlTemplate.right = new FormAttachment(middle, -margin);
wlTemplate.setLayoutData(fdlTemplate);
wTemplate = new Button(wTemplateGroup, SWT.CHECK);
props.setLook(wTemplate);
fdTemplate = new FormData();
fdTemplate.left = new FormAttachment(middle, 0);
fdTemplate.top = new FormAttachment(wTempDirectory, margin);
fdTemplate.right = new FormAttachment(100, 0);
wTemplate.setLayoutData(fdTemplate);
wTemplate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
EnableTemplate();
}
});
// TemplateFilename line
wlTemplateFilename = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplateFilename.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateFilename.Label"));
props.setLook(wlTemplateFilename);
fdlTemplateFilename = new FormData();
fdlTemplateFilename.left = new FormAttachment(0, 0);
fdlTemplateFilename.top = new FormAttachment(wTemplate, margin);
fdlTemplateFilename.right = new FormAttachment(middle, -margin);
wlTemplateFilename.setLayoutData(fdlTemplateFilename);
wbTemplateFilename = new Button(wTemplateGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbTemplateFilename);
wbTemplateFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbTemplateFilename = new FormData();
fdbTemplateFilename.right = new FormAttachment(100, 0);
fdbTemplateFilename.top = new FormAttachment(wTemplate, 0);
wbTemplateFilename.setLayoutData(fdbTemplateFilename);
wTemplateFilename = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTemplateFilename);
wTemplateFilename.addModifyListener(lsMod);
fdTemplateFilename = new FormData();
fdTemplateFilename.left = new FormAttachment(middle, 0);
fdTemplateFilename.top = new FormAttachment(wTemplate, margin);
fdTemplateFilename.right = new FormAttachment(wbTemplateFilename, -margin);
wTemplateFilename.setLayoutData(fdTemplateFilename);
// Template Append
wlTemplateAppend = new Label(wTemplateGroup, SWT.RIGHT);
wlTemplateAppend.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.TemplateAppend.Label"));
props.setLook(wlTemplateAppend);
fdlTemplateAppend = new FormData();
fdlTemplateAppend.left = new FormAttachment(0, 0);
fdlTemplateAppend.top = new FormAttachment(wTemplateFilename, margin);
fdlTemplateAppend.right = new FormAttachment(middle, -margin);
wlTemplateAppend.setLayoutData(fdlTemplateAppend);
wTemplateAppend = new Button(wTemplateGroup, SWT.CHECK);
props.setLook(wTemplateAppend);
fdTemplateAppend = new FormData();
fdTemplateAppend.left = new FormAttachment(middle, 0);
fdTemplateAppend.top = new FormAttachment(wTemplateFilename, margin);
fdTemplateAppend.right = new FormAttachment(100, 0);
wTemplateAppend.setLayoutData(fdTemplateAppend);
wTemplateAppend.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
fdTemplateGroup = new FormData();
fdTemplateGroup.left = new FormAttachment(0, margin);
fdTemplateGroup.top = new FormAttachment(wTempDirectory, margin);
fdTemplateGroup.right = new FormAttachment(100, -margin);
wTemplateGroup.setLayoutData(fdTemplateGroup);
// ///////////////////////////////////////////////////////////
// / END OF Template Group GROUP
// ///////////////////////////////////////////////////////////
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
// ///////////////////////////////////////////////////////////
// Custom tab...
//
wCustomTab = new CTabItem(wTabFolder, SWT.NONE);
wCustomTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.CustomTab.TabTitle"));
FormLayout CustomLayout = new FormLayout();
CustomLayout.marginWidth = Const.FORM_MARGIN;
CustomLayout.marginHeight = Const.FORM_MARGIN;
Composite wCustomComp = new Composite(wTabFolder, SWT.NONE);
wCustomComp.setLayout(CustomLayout);
props.setLook(wCustomComp);
// ///////////////////////////////
// START OF Header Font GROUP //
// ///////////////////////////////
wFontHeaderGroup = new Group(wCustomComp, SWT.SHADOW_NONE);
props.setLook(wFontHeaderGroup);
wFontHeaderGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FontHeaderGroup.Label"));
FormLayout FontHeadergroupLayout = new FormLayout();
FontHeadergroupLayout.marginWidth = 10;
FontHeadergroupLayout.marginHeight = 10;
wFontHeaderGroup.setLayout(FontHeadergroupLayout);
// Header font name
wlHeaderFontName = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontName.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontName.Label"));
props.setLook(wlHeaderFontName);
fdlHeaderFontName = new FormData();
fdlHeaderFontName.left = new FormAttachment(0, 0);
fdlHeaderFontName.top = new FormAttachment(0, margin);
fdlHeaderFontName.right = new FormAttachment(middle, -margin);
wlHeaderFontName.setLayoutData(fdlHeaderFontName);
wHeaderFontName = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
wHeaderFontName.setItems(ExcelOutputMeta.font_name_desc);
props.setLook(wHeaderFontName);
wHeaderFontName.addModifyListener(lsMod);
fdHeaderFontName = new FormData();
fdHeaderFontName.left = new FormAttachment(middle, 0);
fdHeaderFontName.top = new FormAttachment(0, margin);
fdHeaderFontName.right = new FormAttachment(100, 0);
wHeaderFontName.setLayoutData(fdHeaderFontName);
// Header font size
wlHeaderFontSize = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontSize.Label"));
props.setLook(wlHeaderFontSize);
fdlHeaderFontSize = new FormData();
fdlHeaderFontSize.left = new FormAttachment(0, 0);
fdlHeaderFontSize.top = new FormAttachment(wHeaderFontName, margin);
fdlHeaderFontSize.right = new FormAttachment(middle, -margin);
wlHeaderFontSize.setLayoutData(fdlHeaderFontSize);
wHeaderFontSize = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHeaderFontSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontSize.Tooltip"));
props.setLook(wHeaderFontSize);
wHeaderFontSize.addModifyListener(lsMod);
fdHeaderFontSize = new FormData();
fdHeaderFontSize.left = new FormAttachment(middle, 0);
fdHeaderFontSize.top = new FormAttachment(wHeaderFontName, margin);
fdHeaderFontSize.right = new FormAttachment(100, 0);
wHeaderFontSize.setLayoutData(fdHeaderFontSize);
// Header font bold?
wlHeaderFontBold = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontBold.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontBold.Label"));
props.setLook(wlHeaderFontBold);
fdlHeaderFontBold = new FormData();
fdlHeaderFontBold.left = new FormAttachment(0, 0);
fdlHeaderFontBold.top = new FormAttachment(wHeaderFontSize, margin);
fdlHeaderFontBold.right = new FormAttachment(middle, -margin);
wlHeaderFontBold.setLayoutData(fdlHeaderFontBold);
wHeaderFontBold = new Button(wFontHeaderGroup, SWT.CHECK);
props.setLook(wHeaderFontBold);
fdHeaderFontBold = new FormData();
fdHeaderFontBold.left = new FormAttachment(middle, 0);
fdHeaderFontBold.top = new FormAttachment(wHeaderFontSize, margin);
fdHeaderFontBold.right = new FormAttachment(100, 0);
wHeaderFontBold.setLayoutData(fdHeaderFontBold);
wHeaderFontBold.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Header font bold?
wlHeaderFontItalic = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontItalic.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontItalic.Label"));
props.setLook(wlHeaderFontItalic);
fdlHeaderFontItalic = new FormData();
fdlHeaderFontItalic.left = new FormAttachment(0, 0);
fdlHeaderFontItalic.top = new FormAttachment(wHeaderFontBold, margin);
fdlHeaderFontItalic.right = new FormAttachment(middle, -margin);
wlHeaderFontItalic.setLayoutData(fdlHeaderFontItalic);
wHeaderFontItalic = new Button(wFontHeaderGroup, SWT.CHECK);
props.setLook(wHeaderFontItalic);
fdHeaderFontItalic = new FormData();
fdHeaderFontItalic.left = new FormAttachment(middle, 0);
fdHeaderFontItalic.top = new FormAttachment(wHeaderFontBold, margin);
fdHeaderFontItalic.right = new FormAttachment(100, 0);
wHeaderFontItalic.setLayoutData(fdHeaderFontItalic);
wHeaderFontItalic.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Font header uderline?
wlHeaderFontUnderline = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontUnderline.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontUnderline.Label"));
props.setLook(wlHeaderFontUnderline);
fdlHeaderFontUnderline = new FormData();
fdlHeaderFontUnderline.left = new FormAttachment(0, 0);
fdlHeaderFontUnderline.top = new FormAttachment(wHeaderFontItalic, margin);
fdlHeaderFontUnderline.right = new FormAttachment(middle, -margin);
wlHeaderFontUnderline.setLayoutData(fdlHeaderFontUnderline);
wHeaderFontUnderline = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
wHeaderFontUnderline.setItems(ExcelOutputMeta.font_underline_desc);
props.setLook(wHeaderFontUnderline);
wHeaderFontUnderline.addModifyListener(lsMod);
fdHeaderFontUnderline = new FormData();
fdHeaderFontUnderline.left = new FormAttachment(middle, 0);
fdHeaderFontUnderline.top = new FormAttachment(wHeaderFontItalic, margin);
fdHeaderFontUnderline.right = new FormAttachment(100, 0);
wHeaderFontUnderline.setLayoutData(fdHeaderFontUnderline);
// Font header orientation
wlHeaderFontOrientation = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontOrientation.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontOrientation.Label"));
props.setLook(wlHeaderFontOrientation);
fdlHeaderFontOrientation = new FormData();
fdlHeaderFontOrientation.left = new FormAttachment(0, 0);
fdlHeaderFontOrientation.top = new FormAttachment(wHeaderFontUnderline, margin);
fdlHeaderFontOrientation.right = new FormAttachment(middle, -margin);
wlHeaderFontOrientation.setLayoutData(fdlHeaderFontOrientation);
wHeaderFontOrientation = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
wHeaderFontOrientation.setItems(ExcelOutputMeta.font_orientation_desc);
props.setLook(wHeaderFontOrientation);
wHeaderFontOrientation.addModifyListener(lsMod);
fdHeaderFontOrientation = new FormData();
fdHeaderFontOrientation.left = new FormAttachment(middle, 0);
fdHeaderFontOrientation.top = new FormAttachment(wHeaderFontUnderline, margin);
fdHeaderFontOrientation.right = new FormAttachment(100, 0);
wHeaderFontOrientation.setLayoutData(fdHeaderFontOrientation);
// Font header color
wlHeaderFontColor = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderFontColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderFontColor.Label"));
props.setLook(wlHeaderFontColor);
fdlHeaderFontColor = new FormData();
fdlHeaderFontColor.left = new FormAttachment(0, 0);
fdlHeaderFontColor.top = new FormAttachment(wHeaderFontOrientation, margin);
fdlHeaderFontColor.right = new FormAttachment(middle, -margin);
wlHeaderFontColor.setLayoutData(fdlHeaderFontColor);
wHeaderFontColor = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wHeaderFontColor);
fdHeaderFontColor = new FormData();
fdHeaderFontColor.left = new FormAttachment(middle, 0);
fdHeaderFontColor.top = new FormAttachment(wHeaderFontOrientation, margin);
fdHeaderFontColor.right = new FormAttachment(100, 0);
wHeaderFontColor.setLayoutData(fdHeaderFontColor);
wHeaderFontColor.setItems(ExcelOutputMeta.font_color_desc);
// Font header background color
wlHeaderBackGroundColor = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderBackGroundColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderBackGroundColor.Label"));
props.setLook(wlHeaderBackGroundColor);
fdlHeaderBackGroundColor = new FormData();
fdlHeaderBackGroundColor.left = new FormAttachment(0, 0);
fdlHeaderBackGroundColor.top = new FormAttachment(wHeaderFontColor, margin);
fdlHeaderBackGroundColor.right = new FormAttachment(middle, -margin);
wlHeaderBackGroundColor.setLayoutData(fdlHeaderBackGroundColor);
wHeaderBackGroundColor = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wHeaderBackGroundColor);
fdHeaderBackGroundColor = new FormData();
fdHeaderBackGroundColor.left = new FormAttachment(middle, 0);
fdHeaderBackGroundColor.top = new FormAttachment(wHeaderFontColor, margin);
fdHeaderBackGroundColor.right = new FormAttachment(100, 0);
wHeaderBackGroundColor.setLayoutData(fdHeaderBackGroundColor);
wHeaderBackGroundColor.setItems(ExcelOutputMeta.font_color_desc);
// Header font size
wlHeaderRowHeight = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderRowHeight.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderRowHeight.Label"));
props.setLook(wlHeaderRowHeight);
fdlHeaderRowHeight = new FormData();
fdlHeaderRowHeight.left = new FormAttachment(0, 0);
fdlHeaderRowHeight.top = new FormAttachment(wHeaderBackGroundColor, margin);
fdlHeaderRowHeight.right = new FormAttachment(middle, -margin);
wlHeaderRowHeight.setLayoutData(fdlHeaderRowHeight);
wHeaderRowHeight = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wHeaderRowHeight.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderRowHeight.Tooltip"));
props.setLook(wHeaderRowHeight);
wHeaderRowHeight.addModifyListener(lsMod);
fdHeaderRowHeight = new FormData();
fdHeaderRowHeight.left = new FormAttachment(middle, 0);
fdHeaderRowHeight.top = new FormAttachment(wHeaderBackGroundColor, margin);
fdHeaderRowHeight.right = new FormAttachment(100, 0);
wHeaderRowHeight.setLayoutData(fdHeaderRowHeight);
// Header Alignment
wlHeaderAlignment = new Label(wFontHeaderGroup, SWT.RIGHT);
wlHeaderAlignment.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.HeaderAlignment.Label"));
props.setLook(wlHeaderAlignment);
fdlHeaderAlignment = new FormData();
fdlHeaderAlignment.left = new FormAttachment(0, 0);
fdlHeaderAlignment.top = new FormAttachment(wHeaderRowHeight, margin);
fdlHeaderAlignment.right = new FormAttachment(middle, -margin);
wlHeaderAlignment.setLayoutData(fdlHeaderAlignment);
wHeaderAlignment = new CCombo(wFontHeaderGroup, SWT.BORDER | SWT.READ_ONLY);
wHeaderAlignment.setItems(ExcelOutputMeta.font_alignment_desc);
props.setLook(wHeaderAlignment);
wHeaderAlignment.addModifyListener(lsMod);
fdHeaderAlignment = new FormData();
fdHeaderAlignment.left = new FormAttachment(middle, 0);
fdHeaderAlignment.top = new FormAttachment(wHeaderRowHeight, margin);
fdHeaderAlignment.right = new FormAttachment(100, 0);
wHeaderAlignment.setLayoutData(fdHeaderAlignment);
// Select Image
wbImage = new Button(wFontHeaderGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbImage);
wbImage.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.AddImage"));
fdbImage = new FormData();
fdbImage.right = new FormAttachment(100, 0);
fdbImage.top = new FormAttachment(wHeaderAlignment, margin);
wbImage.setLayoutData(fdbImage);
wbImage.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.png", "*.*" });
if (wImage.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wImage.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelOutputDialog.FileType.PNGFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wImage.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
// Image line
wlImage = new Label(wFontHeaderGroup, SWT.RIGHT);
wlImage.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.Image.Label"));
props.setLook(wlImage);
fdlImage = new FormData();
fdlImage.left = new FormAttachment(0, 0);
fdlImage.top = new FormAttachment(wHeaderAlignment, margin);
fdlImage.right = new FormAttachment(middle, -margin);
wlImage.setLayoutData(fdlImage);
wImage = new TextVar(transMeta, wFontHeaderGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wImage);
wImage.addModifyListener(lsMod);
fdImage = new FormData();
fdImage.left = new FormAttachment(middle, 0);
fdImage.top = new FormAttachment(wHeaderAlignment, margin);
fdImage.right = new FormAttachment(wbImage, -margin);
wImage.setLayoutData(fdImage);
fdFontHeaderGroup = new FormData();
fdFontHeaderGroup.left = new FormAttachment(0, margin);
fdFontHeaderGroup.top = new FormAttachment(0, margin);
fdFontHeaderGroup.right = new FormAttachment(100, -margin);
wFontHeaderGroup.setLayoutData(fdFontHeaderGroup);
// ///////////////////////////////////////////////////////////
// / END OF Font Group GROUP
// ///////////////////////////////////////////////////////////
// ///////////////////////////////
// START OF Row Font GROUP //
// ///////////////////////////////
wFontRowGroup = new Group(wCustomComp, SWT.SHADOW_NONE);
props.setLook(wFontRowGroup);
wFontRowGroup.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.FontRowGroup.Label"));
FormLayout FontRowGroupLayout = new FormLayout();
FontRowGroupLayout.marginWidth = 10;
FontRowGroupLayout.marginHeight = 10;
wFontRowGroup.setLayout(FontRowGroupLayout);
// Font Row name
wlRowFontName = new Label(wFontRowGroup, SWT.RIGHT);
wlRowFontName.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontName.Label"));
props.setLook(wlRowFontName);
fdlRowFontName = new FormData();
fdlRowFontName.left = new FormAttachment(0, 0);
fdlRowFontName.top = new FormAttachment(0, margin);
fdlRowFontName.right = new FormAttachment(middle, -margin);
wlRowFontName.setLayoutData(fdlRowFontName);
wRowFontName = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
wRowFontName.setItems(ExcelOutputMeta.font_name_desc);
props.setLook(wRowFontName);
wRowFontName.addModifyListener(lsMod);
fdRowFontName = new FormData();
fdRowFontName.left = new FormAttachment(middle, 0);
fdRowFontName.top = new FormAttachment(0, margin);
fdRowFontName.right = new FormAttachment(100, 0);
wRowFontName.setLayoutData(fdRowFontName);
// Row font size
wlRowFontSize = new Label(wFontRowGroup, SWT.RIGHT);
wlRowFontSize.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontSize.Label"));
props.setLook(wlRowFontSize);
fdlRowFontSize = new FormData();
fdlRowFontSize.left = new FormAttachment(0, 0);
fdlRowFontSize.top = new FormAttachment(wRowFontName, margin);
fdlRowFontSize.right = new FormAttachment(middle, -margin);
wlRowFontSize.setLayoutData(fdlRowFontSize);
wRowFontSize = new TextVar(transMeta, wFontRowGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wRowFontSize.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontSize.Tooltip"));
props.setLook(wRowFontSize);
wRowFontSize.addModifyListener(lsMod);
fdRowFontSize = new FormData();
fdRowFontSize.left = new FormAttachment(middle, 0);
fdRowFontSize.top = new FormAttachment(wRowFontName, margin);
fdRowFontSize.right = new FormAttachment(100, 0);
wRowFontSize.setLayoutData(fdRowFontSize);
// Font Row color
wlRowFontColor = new Label(wFontRowGroup, SWT.RIGHT);
wlRowFontColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowFontColor.Label"));
props.setLook(wlRowFontColor);
fdlRowFontColor = new FormData();
fdlRowFontColor.left = new FormAttachment(0, 0);
fdlRowFontColor.top = new FormAttachment(wRowFontSize, margin);
fdlRowFontColor.right = new FormAttachment(middle, -margin);
wlRowFontColor.setLayoutData(fdlRowFontColor);
wRowFontColor = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wRowFontColor);
fdRowFontColor = new FormData();
fdRowFontColor.left = new FormAttachment(middle, 0);
fdRowFontColor.top = new FormAttachment(wRowFontSize, margin);
fdRowFontColor.right = new FormAttachment(100, 0);
wRowFontColor.setLayoutData(fdRowFontColor);
wRowFontColor.setItems(ExcelOutputMeta.font_color_desc);
// Font Row background color
wlRowBackGroundColor = new Label(wFontRowGroup, SWT.RIGHT);
wlRowBackGroundColor.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.RowBackGroundColor.Label"));
props.setLook(wlRowBackGroundColor);
fdlRowBackGroundColor = new FormData();
fdlRowBackGroundColor.left = new FormAttachment(0, 0);
fdlRowBackGroundColor.top = new FormAttachment(wRowFontColor, margin);
fdlRowBackGroundColor.right = new FormAttachment(middle, -margin);
wlRowBackGroundColor.setLayoutData(fdlRowBackGroundColor);
wRowBackGroundColor = new CCombo(wFontRowGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wRowBackGroundColor);
fdRowBackGroundColor = new FormData();
fdRowBackGroundColor.left = new FormAttachment(middle, 0);
fdRowBackGroundColor.top = new FormAttachment(wRowFontColor, margin);
fdRowBackGroundColor.right = new FormAttachment(100, 0);
wRowBackGroundColor.setLayoutData(fdRowBackGroundColor);
wRowBackGroundColor.setItems(ExcelOutputMeta.font_color_desc);
fdFontRowGroup = new FormData();
fdFontRowGroup.left = new FormAttachment(0, margin);
fdFontRowGroup.top = new FormAttachment(wFontHeaderGroup, margin);
fdFontRowGroup.right = new FormAttachment(100, -margin);
wFontRowGroup.setLayoutData(fdFontRowGroup);
// ///////////////////////////////////////////////////////////
// / END OF Row Font Group
// ///////////////////////////////////////////////////////////
fdCustomComp = new FormData();
fdCustomComp.left = new FormAttachment(0, 0);
fdCustomComp.top = new FormAttachment(0, 0);
fdCustomComp.right = new FormAttachment(100, 0);
fdCustomComp.bottom = new FormAttachment(100, 0);
wCustomComp.setLayoutData(fdCustomComp);
wCustomComp.layout();
wCustomTab.setControl(wCustomComp);
// ///////////////////////////////////////////////////////////
// / END OF customer TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "ExcelOutputDialog.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, "ExcelOutputDialog.MinWidth.Button"));
wMinWidth.setToolTipText(BaseMessages.getString(PKG, "ExcelOutputDialog.MinWidth.Tooltip"));
setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
final int FieldsRows = input.getOutputFields().length;
// Prepare a list of possible formats...
String[] formats = new String[] { // Numbers
"#", "0", "0.00", "#,##0", "#,##0.00", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "$#,##0;($#,##0)", "0%", "0.00%", "0.00E00", "#,##0;(#,##0)", "#,##0;(#,##0)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "#,##0;(#,##0)", "#,##0;(#,##0)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "#,##0.00;(#,##0.00)", "##0.0E0", // Forces text
"@", // Dates
"M/d/yy", "d-MMM-yy", "d-MMM", "MMM-yy", "h:mm a", "h:mm:ss a", "H:mm", "H:mm:ss", "M/d/yy H:mm", "mm:ss", "H:mm:ss", "H:mm:ss" };
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "ExcelOutputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats) };
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() {
@Override
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() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
@Override
public void handleEvent(Event e) {
get();
}
};
lsMinWidth = new Listener() {
@Override
public void handleEvent(Event e) {
setMinimalWidth();
}
};
lsCancel = new Listener() {
@Override
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() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wFilename.addSelectionListener(lsDef);
wTemplateFilename.addSelectionListener(lsDef);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()));
}
});
wTemplateFilename.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
wTemplateFilename.setToolTipText(transMeta.environmentSubstitute(wTemplateFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setFilterExtensions(new String[] { "*.xls", "*.*" });
if (wFilename.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ExcelFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
wbTemplateFilename.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.xls", "*.*" });
if (wTemplateFilename.getText() != null) {
dialog.setFileName(transMeta.environmentSubstitute(wTemplateFilename.getText()));
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.ExcelFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() != null) {
wTemplateFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
}
}
});
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
@Override
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();
setDateTimeFormat();
EnableAutoSize();
useTempFile();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class FieldsChangeSequenceDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
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, "FieldsChangeSequenceDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.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);
// Result line...
wlResult = new Label(shell, SWT.RIGHT);
wlResult.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Result.Label"));
props.setLook(wlResult);
fdlResult = new FormData();
fdlResult.left = new FormAttachment(0, 0);
fdlResult.right = new FormAttachment(middle, -margin);
fdlResult.top = new FormAttachment(wStepname, 2 * margin);
wlResult.setLayoutData(fdlResult);
wResult = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wResult);
wResult.addModifyListener(lsMod);
fdResult = new FormData();
fdResult.left = new FormAttachment(middle, 0);
fdResult.top = new FormAttachment(wStepname, 2 * margin);
fdResult.right = new FormAttachment(100, 0);
wResult.setLayoutData(fdResult);
// Start
wlStart = new Label(shell, SWT.RIGHT);
wlStart.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Start.Label"));
props.setLook(wlStart);
fdlStart = new FormData();
fdlStart.left = new FormAttachment(0, 0);
fdlStart.right = new FormAttachment(middle, -margin);
fdlStart.top = new FormAttachment(wResult, margin);
wlStart.setLayoutData(fdlStart);
wStart = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wStart);
fdStart = new FormData();
fdStart.left = new FormAttachment(middle, 0);
fdStart.top = new FormAttachment(wResult, margin);
fdStart.right = new FormAttachment(100, 0);
wStart.setLayoutData(fdStart);
// Increment
wlIncrement = new Label(shell, SWT.RIGHT);
wlIncrement.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Increment.Label"));
props.setLook(wlIncrement);
fdlIncrement = new FormData();
fdlIncrement.left = new FormAttachment(0, 0);
fdlIncrement.right = new FormAttachment(middle, -margin);
fdlIncrement.top = new FormAttachment(wStart, margin);
wlIncrement.setLayoutData(fdlIncrement);
wIncrement = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIncrement);
fdIncrement = new FormData();
fdIncrement.left = new FormAttachment(middle, 0);
fdIncrement.top = new FormAttachment(wStart, margin);
fdIncrement.right = new FormAttachment(100, 0);
wIncrement.setLayoutData(fdIncrement);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wGet, wCancel }, margin, null);
// Table with fields
wlFields = new Label(shell, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Fields.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wIncrement, margin);
wlFields.setLayoutData(fdlFields);
final int FieldsCols = 1;
final int FieldsRows = input.getFieldName().length;
colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.Fieldname.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
wFields = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wOK, -2 * margin);
wFields.setLayoutData(fdFields);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
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();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
//
// 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);
if (row != null) {
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), new Integer(i));
}
setComboBoxes();
}
// Dislay in red missing field names
Display.getDefault().asyncExec(new Runnable() {
public void run() {
if (!wFields.isDisposed()) {
for (int i = 0; i < wFields.table.getItemCount(); i++) {
TableItem it = wFields.table.getItem(i);
if (!Utils.isEmpty(it.getText(1))) {
if (!inputFields.containsKey(it.getText(1))) {
it.setBackground(GUIResource.getInstance().getColorRed());
}
}
}
}
}
});
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "FieldsChangeSequenceDialog.ErrorGettingPreviousFields", e.getMessage()));
}
}
}
};
new Thread(runnable).start();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class TextFileInputDialog method addContentTab.
private void addContentTab() {
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentSComp = new ScrolledComposite(wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
wContentSComp.setLayout(new FillLayout());
wContentComp = new Composite(wContentSComp, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// Filetype line
wlFiletype = new Label(wContentComp, SWT.RIGHT);
wlFiletype.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Filetype.Label"));
props.setLook(wlFiletype);
fdlFiletype = new FormData();
fdlFiletype.left = new FormAttachment(0, 0);
fdlFiletype.top = new FormAttachment(0, 0);
fdlFiletype.right = new FormAttachment(middle, -margin);
wlFiletype.setLayoutData(fdlFiletype);
wFiletype = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wFiletype.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Filetype.Label"));
props.setLook(wFiletype);
wFiletype.add("CSV");
wFiletype.add("Fixed");
wFiletype.select(0);
wFiletype.addModifyListener(lsMod);
fdFiletype = new FormData();
fdFiletype.left = new FormAttachment(middle, 0);
fdFiletype.top = new FormAttachment(0, 0);
fdFiletype.right = new FormAttachment(100, 0);
wFiletype.setLayoutData(fdFiletype);
wlSeparator = new Label(wContentComp, SWT.RIGHT);
wlSeparator.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Separator.Label"));
props.setLook(wlSeparator);
fdlSeparator = new FormData();
fdlSeparator.left = new FormAttachment(0, 0);
fdlSeparator.top = new FormAttachment(wFiletype, margin);
fdlSeparator.right = new FormAttachment(middle, -margin);
wlSeparator.setLayoutData(fdlSeparator);
wbSeparator = new Button(wContentComp, SWT.PUSH | SWT.CENTER);
wbSeparator.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Delimiter.Button"));
props.setLook(wbSeparator);
fdbSeparator = new FormData();
fdbSeparator.right = new FormAttachment(100, 0);
fdbSeparator.top = new FormAttachment(wFiletype, 0);
wbSeparator.setLayoutData(fdbSeparator);
wSeparator = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSeparator);
wSeparator.addModifyListener(lsMod);
fdSeparator = new FormData();
fdSeparator.top = new FormAttachment(wFiletype, margin);
fdSeparator.left = new FormAttachment(middle, 0);
fdSeparator.right = new FormAttachment(wbSeparator, -margin);
wSeparator.setLayoutData(fdSeparator);
// Enclosure
wlEnclosure = new Label(wContentComp, SWT.RIGHT);
wlEnclosure.setText(BaseMessages.getString(PKG, "TextFileInputDialog.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 Text(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);
// Allow Enclosure breaks checkbox
wlEnclBreaks = new Label(wContentComp, SWT.RIGHT);
wlEnclBreaks.setText(BaseMessages.getString(PKG, "TextFileInputDialog.EnclBreaks.Label"));
props.setLook(wlEnclBreaks);
fdlEnclBreaks = new FormData();
fdlEnclBreaks.left = new FormAttachment(0, 0);
fdlEnclBreaks.top = new FormAttachment(wEnclosure, margin);
fdlEnclBreaks.right = new FormAttachment(middle, -margin);
wlEnclBreaks.setLayoutData(fdlEnclBreaks);
wEnclBreaks = new Button(wContentComp, SWT.CHECK);
props.setLook(wEnclBreaks);
fdEnclBreaks = new FormData();
fdEnclBreaks.left = new FormAttachment(middle, 0);
fdEnclBreaks.top = new FormAttachment(wEnclosure, margin);
wEnclBreaks.setLayoutData(fdEnclBreaks);
// Disable until the logic works...
wlEnclBreaks.setEnabled(false);
wEnclBreaks.setEnabled(false);
// Escape
wlEscape = new Label(wContentComp, SWT.RIGHT);
wlEscape.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Escape.Label"));
props.setLook(wlEscape);
fdlEscape = new FormData();
fdlEscape.left = new FormAttachment(0, 0);
fdlEscape.top = new FormAttachment(wEnclBreaks, margin);
fdlEscape.right = new FormAttachment(middle, -margin);
wlEscape.setLayoutData(fdlEscape);
wEscape = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEscape);
wEscape.addModifyListener(lsMod);
fdEscape = new FormData();
fdEscape.left = new FormAttachment(middle, 0);
fdEscape.top = new FormAttachment(wEnclBreaks, margin);
fdEscape.right = new FormAttachment(100, 0);
wEscape.setLayoutData(fdEscape);
// Header checkbox
wlHeader = new Label(wContentComp, SWT.RIGHT);
wlHeader.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Header.Label"));
props.setLook(wlHeader);
fdlHeader = new FormData();
fdlHeader.left = new FormAttachment(0, 0);
fdlHeader.top = new FormAttachment(wEscape, 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(wEscape, margin);
wHeader.setLayoutData(fdHeader);
// NrHeader
wlNrHeader = new Label(wContentComp, SWT.RIGHT);
wlNrHeader.setText(BaseMessages.getString(PKG, "TextFileInputDialog.NrHeader.Label"));
props.setLook(wlNrHeader);
fdlNrHeader = new FormData();
fdlNrHeader.left = new FormAttachment(wHeader, margin);
fdlNrHeader.top = new FormAttachment(wEscape, margin);
wlNrHeader.setLayoutData(fdlNrHeader);
wNrHeader = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wNrHeader.setTextLimit(3);
props.setLook(wNrHeader);
wNrHeader.addModifyListener(lsMod);
fdNrHeader = new FormData();
fdNrHeader.left = new FormAttachment(wlNrHeader, margin);
fdNrHeader.top = new FormAttachment(wEscape, margin);
fdNrHeader.right = new FormAttachment(100, 0);
wNrHeader.setLayoutData(fdNrHeader);
wlFooter = new Label(wContentComp, SWT.RIGHT);
wlFooter.setText(BaseMessages.getString(PKG, "TextFileInputDialog.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);
wFooter.setLayoutData(fdFooter);
// NrFooter
wlNrFooter = new Label(wContentComp, SWT.RIGHT);
wlNrFooter.setText(BaseMessages.getString(PKG, "TextFileInputDialog.NrFooter.Label"));
props.setLook(wlNrFooter);
fdlNrFooter = new FormData();
fdlNrFooter.left = new FormAttachment(wFooter, margin);
fdlNrFooter.top = new FormAttachment(wHeader, margin);
wlNrFooter.setLayoutData(fdlNrFooter);
wNrFooter = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wNrFooter.setTextLimit(3);
props.setLook(wNrFooter);
wNrFooter.addModifyListener(lsMod);
fdNrFooter = new FormData();
fdNrFooter.left = new FormAttachment(wlNrFooter, margin);
fdNrFooter.top = new FormAttachment(wHeader, margin);
fdNrFooter.right = new FormAttachment(100, 0);
wNrFooter.setLayoutData(fdNrFooter);
// Wraps
wlWraps = new Label(wContentComp, SWT.RIGHT);
wlWraps.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Wraps.Label"));
props.setLook(wlWraps);
fdlWraps = new FormData();
fdlWraps.left = new FormAttachment(0, 0);
fdlWraps.top = new FormAttachment(wFooter, margin);
fdlWraps.right = new FormAttachment(middle, -margin);
wlWraps.setLayoutData(fdlWraps);
wWraps = new Button(wContentComp, SWT.CHECK);
props.setLook(wWraps);
fdWraps = new FormData();
fdWraps.left = new FormAttachment(middle, 0);
fdWraps.top = new FormAttachment(wFooter, margin);
wWraps.setLayoutData(fdWraps);
// NrWraps
wlNrWraps = new Label(wContentComp, SWT.RIGHT);
wlNrWraps.setText(BaseMessages.getString(PKG, "TextFileInputDialog.NrWraps.Label"));
props.setLook(wlNrWraps);
fdlNrWraps = new FormData();
fdlNrWraps.left = new FormAttachment(wWraps, margin);
fdlNrWraps.top = new FormAttachment(wFooter, margin);
wlNrWraps.setLayoutData(fdlNrWraps);
wNrWraps = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wNrWraps.setTextLimit(3);
props.setLook(wNrWraps);
wNrWraps.addModifyListener(lsMod);
fdNrWraps = new FormData();
fdNrWraps.left = new FormAttachment(wlNrWraps, margin);
fdNrWraps.top = new FormAttachment(wFooter, margin);
fdNrWraps.right = new FormAttachment(100, 0);
wNrWraps.setLayoutData(fdNrWraps);
// Pages
wlLayoutPaged = new Label(wContentComp, SWT.RIGHT);
wlLayoutPaged.setText(BaseMessages.getString(PKG, "TextFileInputDialog.LayoutPaged.Label"));
props.setLook(wlLayoutPaged);
fdlLayoutPaged = new FormData();
fdlLayoutPaged.left = new FormAttachment(0, 0);
fdlLayoutPaged.top = new FormAttachment(wWraps, margin);
fdlLayoutPaged.right = new FormAttachment(middle, -margin);
wlLayoutPaged.setLayoutData(fdlLayoutPaged);
wLayoutPaged = new Button(wContentComp, SWT.CHECK);
props.setLook(wLayoutPaged);
fdLayoutPaged = new FormData();
fdLayoutPaged.left = new FormAttachment(middle, 0);
fdLayoutPaged.top = new FormAttachment(wWraps, margin);
wLayoutPaged.setLayoutData(fdLayoutPaged);
// Nr of lines per page
wlNrLinesPerPage = new Label(wContentComp, SWT.RIGHT);
wlNrLinesPerPage.setText(BaseMessages.getString(PKG, "TextFileInputDialog.NrLinesPerPage.Label"));
props.setLook(wlNrLinesPerPage);
fdlNrLinesPerPage = new FormData();
fdlNrLinesPerPage.left = new FormAttachment(wLayoutPaged, margin);
fdlNrLinesPerPage.top = new FormAttachment(wWraps, margin);
wlNrLinesPerPage.setLayoutData(fdlNrLinesPerPage);
wNrLinesPerPage = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wNrLinesPerPage.setTextLimit(3);
props.setLook(wNrLinesPerPage);
wNrLinesPerPage.addModifyListener(lsMod);
fdNrLinesPerPage = new FormData();
fdNrLinesPerPage.left = new FormAttachment(wlNrLinesPerPage, margin);
fdNrLinesPerPage.top = new FormAttachment(wWraps, margin);
fdNrLinesPerPage.right = new FormAttachment(100, 0);
wNrLinesPerPage.setLayoutData(fdNrLinesPerPage);
// NrPages
wlNrLinesDocHeader = new Label(wContentComp, SWT.RIGHT);
wlNrLinesDocHeader.setText(BaseMessages.getString(PKG, "TextFileInputDialog.NrLinesDocHeader.Label"));
props.setLook(wlNrLinesDocHeader);
fdlNrLinesDocHeader = new FormData();
fdlNrLinesDocHeader.left = new FormAttachment(wLayoutPaged, margin);
fdlNrLinesDocHeader.top = new FormAttachment(wNrLinesPerPage, margin);
wlNrLinesDocHeader.setLayoutData(fdlNrLinesDocHeader);
wNrLinesDocHeader = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wNrLinesDocHeader.setTextLimit(3);
props.setLook(wNrLinesDocHeader);
wNrLinesDocHeader.addModifyListener(lsMod);
fdNrLinesDocHeader = new FormData();
fdNrLinesDocHeader.left = new FormAttachment(wlNrLinesPerPage, margin);
fdNrLinesDocHeader.top = new FormAttachment(wNrLinesPerPage, margin);
fdNrLinesDocHeader.right = new FormAttachment(100, 0);
wNrLinesDocHeader.setLayoutData(fdNrLinesDocHeader);
// Compression type (None, Zip or GZip
wlCompression = new Label(wContentComp, SWT.RIGHT);
wlCompression.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Compression.Label"));
props.setLook(wlCompression);
fdlCompression = new FormData();
fdlCompression.left = new FormAttachment(0, 0);
fdlCompression.top = new FormAttachment(wNrLinesDocHeader, margin);
fdlCompression.right = new FormAttachment(middle, -margin);
wlCompression.setLayoutData(fdlCompression);
wCompression = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wCompression.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Compression.Label"));
wCompression.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.Compression.Tooltip"));
props.setLook(wCompression);
wCompression.setItems(CompressionProviderFactory.getInstance().getCompressionProviderNames());
wCompression.addModifyListener(lsMod);
fdCompression = new FormData();
fdCompression.left = new FormAttachment(middle, 0);
fdCompression.top = new FormAttachment(wNrLinesDocHeader, margin);
fdCompression.right = new FormAttachment(100, 0);
wCompression.setLayoutData(fdCompression);
wlNoempty = new Label(wContentComp, SWT.RIGHT);
wlNoempty.setText(BaseMessages.getString(PKG, "TextFileInputDialog.NoEmpty.Label"));
props.setLook(wlNoempty);
fdlNoempty = new FormData();
fdlNoempty.left = new FormAttachment(0, 0);
fdlNoempty.top = new FormAttachment(wCompression, margin);
fdlNoempty.right = new FormAttachment(middle, -margin);
wlNoempty.setLayoutData(fdlNoempty);
wNoempty = new Button(wContentComp, SWT.CHECK);
props.setLook(wNoempty);
wNoempty.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.NoEmpty.Tooltip"));
fdNoempty = new FormData();
fdNoempty.left = new FormAttachment(middle, 0);
fdNoempty.top = new FormAttachment(wCompression, margin);
fdNoempty.right = new FormAttachment(100, 0);
wNoempty.setLayoutData(fdNoempty);
wlInclFilename = new Label(wContentComp, SWT.RIGHT);
wlInclFilename.setText(BaseMessages.getString(PKG, "TextFileInputDialog.InclFilename.Label"));
props.setLook(wlInclFilename);
fdlInclFilename = new FormData();
fdlInclFilename.left = new FormAttachment(0, 0);
fdlInclFilename.top = new FormAttachment(wNoempty, margin);
fdlInclFilename.right = new FormAttachment(middle, -margin);
wlInclFilename.setLayoutData(fdlInclFilename);
wInclFilename = new Button(wContentComp, SWT.CHECK);
props.setLook(wInclFilename);
wInclFilename.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.InclFilename.Tooltip"));
fdInclFilename = new FormData();
fdInclFilename.left = new FormAttachment(middle, 0);
fdInclFilename.top = new FormAttachment(wNoempty, margin);
wInclFilename.setLayoutData(fdInclFilename);
wlInclFilenameField = new Label(wContentComp, SWT.LEFT);
wlInclFilenameField.setText(BaseMessages.getString(PKG, "TextFileInputDialog.InclFilenameField.Label"));
props.setLook(wlInclFilenameField);
fdlInclFilenameField = new FormData();
fdlInclFilenameField.left = new FormAttachment(wInclFilename, margin);
fdlInclFilenameField.top = new FormAttachment(wNoempty, margin);
wlInclFilenameField.setLayoutData(fdlInclFilenameField);
wInclFilenameField = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclFilenameField);
wInclFilenameField.addModifyListener(lsMod);
fdInclFilenameField = new FormData();
fdInclFilenameField.left = new FormAttachment(wlInclFilenameField, margin);
fdInclFilenameField.top = new FormAttachment(wNoempty, margin);
fdInclFilenameField.right = new FormAttachment(100, 0);
wInclFilenameField.setLayoutData(fdInclFilenameField);
wlInclRownum = new Label(wContentComp, SWT.RIGHT);
wlInclRownum.setText(BaseMessages.getString(PKG, "TextFileInputDialog.InclRownum.Label"));
props.setLook(wlInclRownum);
fdlInclRownum = new FormData();
fdlInclRownum.left = new FormAttachment(0, 0);
fdlInclRownum.top = new FormAttachment(wInclFilenameField, margin);
fdlInclRownum.right = new FormAttachment(middle, -margin);
wlInclRownum.setLayoutData(fdlInclRownum);
wInclRownum = new Button(wContentComp, SWT.CHECK);
props.setLook(wInclRownum);
wInclRownum.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.InclRownum.Tooltip"));
fdRownum = new FormData();
fdRownum.left = new FormAttachment(middle, 0);
fdRownum.top = new FormAttachment(wInclFilenameField, margin);
wInclRownum.setLayoutData(fdRownum);
wlInclRownumField = new Label(wContentComp, SWT.RIGHT);
wlInclRownumField.setText(BaseMessages.getString(PKG, "TextFileInputDialog.InclRownumField.Label"));
props.setLook(wlInclRownumField);
fdlInclRownumField = new FormData();
fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
fdlInclRownumField.top = new FormAttachment(wInclFilenameField, margin);
wlInclRownumField.setLayoutData(fdlInclRownumField);
wInclRownumField = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclRownumField);
wInclRownumField.addModifyListener(lsMod);
fdInclRownumField = new FormData();
fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
fdInclRownumField.top = new FormAttachment(wInclFilenameField, margin);
fdInclRownumField.right = new FormAttachment(100, 0);
wInclRownumField.setLayoutData(fdInclRownumField);
wlRownumByFileField = new Label(wContentComp, SWT.RIGHT);
wlRownumByFileField.setText(BaseMessages.getString(PKG, "TextFileInputDialog.RownumByFile.Label"));
props.setLook(wlRownumByFileField);
fdlRownumByFile = new FormData();
fdlRownumByFile.left = new FormAttachment(wInclRownum, margin);
fdlRownumByFile.top = new FormAttachment(wInclRownumField, margin);
wlRownumByFileField.setLayoutData(fdlRownumByFile);
wRownumByFile = new Button(wContentComp, SWT.CHECK);
props.setLook(wRownumByFile);
wRownumByFile.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.RownumByFile.Tooltip"));
fdRownumByFile = new FormData();
fdRownumByFile.left = new FormAttachment(wlRownumByFileField, margin);
fdRownumByFile.top = new FormAttachment(wInclRownumField, margin);
wRownumByFile.setLayoutData(fdRownumByFile);
wlFormat = new Label(wContentComp, SWT.RIGHT);
wlFormat.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Format.Label"));
props.setLook(wlFormat);
fdlFormat = new FormData();
fdlFormat.left = new FormAttachment(0, 0);
fdlFormat.top = new FormAttachment(wRownumByFile, margin * 2);
fdlFormat.right = new FormAttachment(middle, -margin);
wlFormat.setLayoutData(fdlFormat);
wFormat = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wFormat.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Format.Label"));
props.setLook(wFormat);
wFormat.add("DOS");
wFormat.add("Unix");
wFormat.add("mixed");
wFormat.select(0);
wFormat.addModifyListener(lsMod);
fdFormat = new FormData();
fdFormat.left = new FormAttachment(middle, 0);
fdFormat.top = new FormAttachment(wRownumByFile, margin * 2);
fdFormat.right = new FormAttachment(100, 0);
wFormat.setLayoutData(fdFormat);
wlEncoding = new Label(wContentComp, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Encoding.Label"));
props.setLook(wlEncoding);
fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wFormat, 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(wFormat, 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();
}
});
wlLength = new Label(wContentComp, SWT.RIGHT);
wlLength.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Length.Label"));
props.setLook(wlLength);
fdlLength = new FormData();
fdlLength.left = new FormAttachment(0, 0);
fdlLength.top = new FormAttachment(wEncoding, margin);
fdlLength.right = new FormAttachment(middle, -margin);
wlLength.setLayoutData(fdlLength);
wLength = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wLength.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Length.Label"));
props.setLook(wLength);
wLength.add("Characters");
wLength.add("Bytes");
wLength.select(0);
wLength.addModifyListener(lsMod);
fdLength = new FormData();
fdLength.left = new FormAttachment(middle, 0);
fdLength.top = new FormAttachment(wEncoding, margin);
fdLength.right = new FormAttachment(100, 0);
wLength.setLayoutData(fdLength);
wlLimit = new Label(wContentComp, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wLength, margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wLength, margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
// Date Lenient checkbox
wlDateLenient = new Label(wContentComp, SWT.RIGHT);
wlDateLenient.setText(BaseMessages.getString(PKG, "TextFileInputDialog.DateLenient.Label"));
props.setLook(wlDateLenient);
fdlDateLenient = new FormData();
fdlDateLenient.left = new FormAttachment(0, 0);
fdlDateLenient.top = new FormAttachment(wLimit, margin);
fdlDateLenient.right = new FormAttachment(middle, -margin);
wlDateLenient.setLayoutData(fdlDateLenient);
wDateLenient = new Button(wContentComp, SWT.CHECK);
wDateLenient.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.DateLenient.Tooltip"));
props.setLook(wDateLenient);
fdDateLenient = new FormData();
fdDateLenient.left = new FormAttachment(middle, 0);
fdDateLenient.top = new FormAttachment(wLimit, margin);
wDateLenient.setLayoutData(fdDateLenient);
wlDateLocale = new Label(wContentComp, SWT.RIGHT);
wlDateLocale.setText(BaseMessages.getString(PKG, "TextFileInputDialog.DateLocale.Label"));
props.setLook(wlDateLocale);
fdlDateLocale = new FormData();
fdlDateLocale.left = new FormAttachment(0, 0);
fdlDateLocale.top = new FormAttachment(wDateLenient, margin);
fdlDateLocale.right = new FormAttachment(middle, -margin);
wlDateLocale.setLayoutData(fdlDateLocale);
wDateLocale = new CCombo(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wDateLocale.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.DateLocale.Tooltip"));
props.setLook(wDateLocale);
wDateLocale.addModifyListener(lsMod);
fdDateLocale = new FormData();
fdDateLocale.left = new FormAttachment(middle, 0);
fdDateLocale.top = new FormAttachment(wDateLenient, margin);
fdDateLocale.right = new FormAttachment(100, 0);
wDateLocale.setLayoutData(fdDateLocale);
wDateLocale.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);
setLocales();
shell.setCursor(null);
busy.dispose();
}
});
// ///////////////////////////////
// START OF AddFileResult GROUP //
// ///////////////////////////////
wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAddFileResult);
wAddFileResult.setText(BaseMessages.getString(PKG, "TextFileInputDialog.wAddFileResult.Label"));
FormLayout AddFileResultgroupLayout = new FormLayout();
AddFileResultgroupLayout.marginWidth = 10;
AddFileResultgroupLayout.marginHeight = 10;
wAddFileResult.setLayout(AddFileResultgroupLayout);
wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
wlAddResult.setText(BaseMessages.getString(PKG, "TextFileInputDialog.AddResult.Label"));
props.setLook(wlAddResult);
fdlAddResult = new FormData();
fdlAddResult.left = new FormAttachment(0, 0);
fdlAddResult.top = new FormAttachment(wDateLocale, margin);
fdlAddResult.right = new FormAttachment(middle, -margin);
wlAddResult.setLayoutData(fdlAddResult);
wAddResult = new Button(wAddFileResult, SWT.CHECK);
props.setLook(wAddResult);
wAddResult.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.AddResult.Tooltip"));
fdAddResult = new FormData();
fdAddResult.left = new FormAttachment(middle, 0);
fdAddResult.top = new FormAttachment(wDateLocale, margin);
wAddResult.setLayoutData(fdAddResult);
fdAddFileResult = new FormData();
fdAddFileResult.left = new FormAttachment(0, margin);
fdAddFileResult.top = new FormAttachment(wDateLocale, margin);
fdAddFileResult.right = new FormAttachment(100, -margin);
wAddFileResult.setLayoutData(fdAddFileResult);
// ///////////////////////////////////////////////////////////
// / END OF AddFileResult GROUP
// ///////////////////////////////////////////////////////////
wContentComp.pack();
// What's the size:
Rectangle bounds = wContentComp.getBounds();
wContentSComp.setContent(wContentComp);
wContentSComp.setExpandHorizontal(true);
wContentSComp.setExpandVertical(true);
wContentSComp.setMinWidth(bounds.width);
wContentSComp.setMinHeight(bounds.height);
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);
wContentTab.setControl(wContentSComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class TextFileInputDialog method addErrorTab.
private void addErrorTab() {
// ////////////////////////
// START OF ERROR TAB ///
// /
wErrorTab = new CTabItem(wTabFolder, SWT.NONE);
wErrorTab.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorTab.TabTitle"));
wErrorSComp = new ScrolledComposite(wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
wErrorSComp.setLayout(new FillLayout());
FormLayout errorLayout = new FormLayout();
errorLayout.marginWidth = 3;
errorLayout.marginHeight = 3;
wErrorComp = new Composite(wErrorSComp, SWT.NONE);
props.setLook(wErrorComp);
wErrorComp.setLayout(errorLayout);
// ERROR HANDLING...
// ErrorIgnored?
wlErrorIgnored = new Label(wErrorComp, SWT.RIGHT);
wlErrorIgnored.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorIgnored.Label"));
props.setLook(wlErrorIgnored);
fdlErrorIgnored = new FormData();
fdlErrorIgnored.left = new FormAttachment(0, 0);
fdlErrorIgnored.top = new FormAttachment(0, margin);
fdlErrorIgnored.right = new FormAttachment(middle, -margin);
wlErrorIgnored.setLayoutData(fdlErrorIgnored);
wErrorIgnored = new Button(wErrorComp, SWT.CHECK);
props.setLook(wErrorIgnored);
wErrorIgnored.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorIgnored.Tooltip"));
fdErrorIgnored = new FormData();
fdErrorIgnored.left = new FormAttachment(middle, 0);
fdErrorIgnored.top = new FormAttachment(0, margin);
wErrorIgnored.setLayoutData(fdErrorIgnored);
// Skip bad files?
wlSkipBadFiles = new Label(wErrorComp, SWT.RIGHT);
wlSkipBadFiles.setText(BaseMessages.getString(PKG, "TextFileInputDialog.SkipBadFiles.Label"));
props.setLook(wlSkipBadFiles);
fdlSkipBadFiles = new FormData();
fdlSkipBadFiles.left = new FormAttachment(0, 0);
fdlSkipBadFiles.top = new FormAttachment(wErrorIgnored, margin);
fdlSkipBadFiles.right = new FormAttachment(middle, -margin);
wlSkipBadFiles.setLayoutData(fdlSkipBadFiles);
wSkipBadFiles = new Button(wErrorComp, SWT.CHECK);
props.setLook(wSkipBadFiles);
wSkipBadFiles.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.SkipBadFiles.Tooltip"));
fdSkipBadFiles = new FormData();
fdSkipBadFiles.left = new FormAttachment(middle, 0);
fdSkipBadFiles.top = new FormAttachment(wErrorIgnored, margin);
wSkipBadFiles.setLayoutData(fdSkipBadFiles);
// field for rejected file
wlBadFileField = new Label(wErrorComp, SWT.RIGHT);
wlBadFileField.setText(BaseMessages.getString(PKG, "TextFileInputDialog.BadFileField.Label"));
props.setLook(wlBadFileField);
fdlBadFileField = new FormData();
fdlBadFileField.left = new FormAttachment(0, 0);
fdlBadFileField.top = new FormAttachment(wSkipBadFiles, margin);
fdlBadFileField.right = new FormAttachment(middle, -margin);
wlBadFileField.setLayoutData(fdlBadFileField);
wBadFileField = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBadFileField);
wBadFileField.addModifyListener(lsMod);
fdBadFileField = new FormData();
fdBadFileField.left = new FormAttachment(middle, 0);
fdBadFileField.top = new FormAttachment(wSkipBadFiles, margin);
fdBadFileField.right = new FormAttachment(100, 0);
wBadFileField.setLayoutData(fdBadFileField);
// field for file error messsage
wlBadFileMessageField = new Label(wErrorComp, SWT.RIGHT);
wlBadFileMessageField.setText(BaseMessages.getString(PKG, "TextFileInputDialog.BadFileMessageField.Label"));
props.setLook(wlBadFileMessageField);
fdlBadFileMessageField = new FormData();
fdlBadFileMessageField.left = new FormAttachment(0, 0);
fdlBadFileMessageField.top = new FormAttachment(wBadFileField, margin);
fdlBadFileMessageField.right = new FormAttachment(middle, -margin);
wlBadFileMessageField.setLayoutData(fdlBadFileMessageField);
wBadFileMessageField = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBadFileMessageField);
wBadFileMessageField.addModifyListener(lsMod);
fdBadFileMessageField = new FormData();
fdBadFileMessageField.left = new FormAttachment(middle, 0);
fdBadFileMessageField.top = new FormAttachment(wBadFileField, margin);
fdBadFileMessageField.right = new FormAttachment(100, 0);
wBadFileMessageField.setLayoutData(fdBadFileMessageField);
// Skip error lines?
wlSkipErrorLines = new Label(wErrorComp, SWT.RIGHT);
wlSkipErrorLines.setText(BaseMessages.getString(PKG, "TextFileInputDialog.SkipErrorLines.Label"));
props.setLook(wlSkipErrorLines);
fdlSkipErrorLines = new FormData();
fdlSkipErrorLines.left = new FormAttachment(0, 0);
fdlSkipErrorLines.top = new FormAttachment(wBadFileMessageField, margin);
fdlSkipErrorLines.right = new FormAttachment(middle, -margin);
wlSkipErrorLines.setLayoutData(fdlSkipErrorLines);
wSkipErrorLines = new Button(wErrorComp, SWT.CHECK);
props.setLook(wSkipErrorLines);
wSkipErrorLines.setToolTipText(BaseMessages.getString(PKG, "TextFileInputDialog.SkipErrorLines.Tooltip"));
fdSkipErrorLines = new FormData();
fdSkipErrorLines.left = new FormAttachment(middle, 0);
fdSkipErrorLines.top = new FormAttachment(wBadFileMessageField, margin);
wSkipErrorLines.setLayoutData(fdSkipErrorLines);
wlErrorCount = new Label(wErrorComp, SWT.RIGHT);
wlErrorCount.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorCount.Label"));
props.setLook(wlErrorCount);
fdlErrorCount = new FormData();
fdlErrorCount.left = new FormAttachment(0, 0);
fdlErrorCount.top = new FormAttachment(wSkipErrorLines, margin);
fdlErrorCount.right = new FormAttachment(middle, -margin);
wlErrorCount.setLayoutData(fdlErrorCount);
wErrorCount = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wErrorCount);
wErrorCount.addModifyListener(lsMod);
fdErrorCount = new FormData();
fdErrorCount.left = new FormAttachment(middle, 0);
fdErrorCount.top = new FormAttachment(wSkipErrorLines, margin);
fdErrorCount.right = new FormAttachment(100, 0);
wErrorCount.setLayoutData(fdErrorCount);
wlErrorFields = new Label(wErrorComp, SWT.RIGHT);
wlErrorFields.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorFields.Label"));
props.setLook(wlErrorFields);
fdlErrorFields = new FormData();
fdlErrorFields.left = new FormAttachment(0, 0);
fdlErrorFields.top = new FormAttachment(wErrorCount, margin);
fdlErrorFields.right = new FormAttachment(middle, -margin);
wlErrorFields.setLayoutData(fdlErrorFields);
wErrorFields = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wErrorFields);
wErrorFields.addModifyListener(lsMod);
fdErrorFields = new FormData();
fdErrorFields.left = new FormAttachment(middle, 0);
fdErrorFields.top = new FormAttachment(wErrorCount, margin);
fdErrorFields.right = new FormAttachment(100, 0);
wErrorFields.setLayoutData(fdErrorFields);
wlErrorText = new Label(wErrorComp, SWT.RIGHT);
wlErrorText.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorText.Label"));
props.setLook(wlErrorText);
fdlErrorText = new FormData();
fdlErrorText.left = new FormAttachment(0, 0);
fdlErrorText.top = new FormAttachment(wErrorFields, margin);
fdlErrorText.right = new FormAttachment(middle, -margin);
wlErrorText.setLayoutData(fdlErrorText);
wErrorText = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wErrorText);
wErrorText.addModifyListener(lsMod);
fdErrorText = new FormData();
fdErrorText.left = new FormAttachment(middle, 0);
fdErrorText.top = new FormAttachment(wErrorFields, margin);
fdErrorText.right = new FormAttachment(100, 0);
wErrorText.setLayoutData(fdErrorText);
// Bad lines files directory + extension
Control previous = wErrorText;
// BadDestDir line
wlWarnDestDir = new Label(wErrorComp, SWT.RIGHT);
wlWarnDestDir.setText(BaseMessages.getString(PKG, "TextFileInputDialog.WarnDestDir.Label"));
props.setLook(wlWarnDestDir);
fdlWarnDestDir = new FormData();
fdlWarnDestDir.left = new FormAttachment(0, 0);
fdlWarnDestDir.top = new FormAttachment(previous, margin * 4);
fdlWarnDestDir.right = new FormAttachment(middle, -margin);
wlWarnDestDir.setLayoutData(fdlWarnDestDir);
wbbWarnDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbbWarnDestDir);
wbbWarnDestDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
wbbWarnDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForDir"));
fdbBadDestDir = new FormData();
fdbBadDestDir.right = new FormAttachment(100, 0);
fdbBadDestDir.top = new FormAttachment(previous, margin * 4);
wbbWarnDestDir.setLayoutData(fdbBadDestDir);
wWarnExt = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wWarnExt);
wWarnExt.addModifyListener(lsMod);
fdWarnDestExt = new FormData();
fdWarnDestExt.left = new FormAttachment(wbbWarnDestDir, -150);
fdWarnDestExt.right = new FormAttachment(wbbWarnDestDir, -margin);
fdWarnDestExt.top = new FormAttachment(previous, margin * 4);
wWarnExt.setLayoutData(fdWarnDestExt);
wlWarnExt = new Label(wErrorComp, SWT.RIGHT);
wlWarnExt.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlWarnExt);
fdlWarnDestExt = new FormData();
fdlWarnDestExt.top = new FormAttachment(previous, margin * 4);
fdlWarnDestExt.right = new FormAttachment(wWarnExt, -margin);
wlWarnExt.setLayoutData(fdlWarnDestExt);
wWarnDestDir = new TextVar(transMeta, wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wWarnDestDir);
wWarnDestDir.addModifyListener(lsMod);
fdBadDestDir = new FormData();
fdBadDestDir.left = new FormAttachment(middle, 0);
fdBadDestDir.right = new FormAttachment(wlWarnExt, -margin);
fdBadDestDir.top = new FormAttachment(previous, margin * 4);
wWarnDestDir.setLayoutData(fdBadDestDir);
// Listen to the Browse... button
wbbWarnDestDir.addSelectionListener(DirectoryDialogButtonListenerFactory.getSelectionAdapter(shell, wWarnDestDir.getTextWidget()));
// Whenever something changes, set the tooltip to the expanded version of the directory:
wWarnDestDir.addModifyListener(getModifyListenerTooltipText(wWarnDestDir.getTextWidget()));
// Error lines files directory + extension
previous = wWarnDestDir;
// ErrorDestDir line
wlErrorDestDir = new Label(wErrorComp, SWT.RIGHT);
wlErrorDestDir.setText(BaseMessages.getString(PKG, "TextFileInputDialog.ErrorDestDir.Label"));
props.setLook(wlErrorDestDir);
fdlErrorDestDir = new FormData();
fdlErrorDestDir.left = new FormAttachment(0, 0);
fdlErrorDestDir.top = new FormAttachment(previous, margin);
fdlErrorDestDir.right = new FormAttachment(middle, -margin);
wlErrorDestDir.setLayoutData(fdlErrorDestDir);
wbbErrorDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbbErrorDestDir);
wbbErrorDestDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
wbbErrorDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForDir"));
fdbErrorDestDir = new FormData();
fdbErrorDestDir.right = new FormAttachment(100, 0);
fdbErrorDestDir.top = new FormAttachment(previous, margin);
wbbErrorDestDir.setLayoutData(fdbErrorDestDir);
wErrorExt = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wErrorExt);
wErrorExt.addModifyListener(lsMod);
fdErrorDestExt = new FormData();
fdErrorDestExt.left = new FormAttachment(wWarnExt, 0, SWT.LEFT);
fdErrorDestExt.right = new FormAttachment(wWarnExt, 0, SWT.RIGHT);
fdErrorDestExt.top = new FormAttachment(previous, margin);
wErrorExt.setLayoutData(fdErrorDestExt);
wlErrorExt = new Label(wErrorComp, SWT.RIGHT);
wlErrorExt.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlErrorExt);
fdlErrorDestExt = new FormData();
fdlErrorDestExt.top = new FormAttachment(previous, margin);
fdlErrorDestExt.right = new FormAttachment(wErrorExt, -margin);
wlErrorExt.setLayoutData(fdlErrorDestExt);
wErrorDestDir = new TextVar(transMeta, wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wErrorDestDir);
wErrorDestDir.addModifyListener(lsMod);
fdErrorDestDir = new FormData();
fdErrorDestDir.left = new FormAttachment(middle, 0);
fdErrorDestDir.right = new FormAttachment(wlErrorExt, -margin);
fdErrorDestDir.top = new FormAttachment(previous, margin);
wErrorDestDir.setLayoutData(fdErrorDestDir);
// Listen to the Browse... button
wbbErrorDestDir.addSelectionListener(DirectoryDialogButtonListenerFactory.getSelectionAdapter(shell, wErrorDestDir.getTextWidget()));
// Whenever something changes, set the tooltip to the expanded version of the directory:
wErrorDestDir.addModifyListener(getModifyListenerTooltipText(wErrorDestDir.getTextWidget()));
// Data Error lines files directory + extension
previous = wErrorDestDir;
// LineNrDestDir line
wlLineNrDestDir = new Label(wErrorComp, SWT.RIGHT);
wlLineNrDestDir.setText(BaseMessages.getString(PKG, "TextFileInputDialog.LineNrDestDir.Label"));
props.setLook(wlLineNrDestDir);
fdlLineNrDestDir = new FormData();
fdlLineNrDestDir.left = new FormAttachment(0, 0);
fdlLineNrDestDir.top = new FormAttachment(previous, margin);
fdlLineNrDestDir.right = new FormAttachment(middle, -margin);
wlLineNrDestDir.setLayoutData(fdlLineNrDestDir);
wbbLineNrDestDir = new Button(wErrorComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbbLineNrDestDir);
wbbLineNrDestDir.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
wbbLineNrDestDir.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.Browse"));
fdbLineNrDestDir = new FormData();
fdbLineNrDestDir.right = new FormAttachment(100, 0);
fdbLineNrDestDir.top = new FormAttachment(previous, margin);
wbbLineNrDestDir.setLayoutData(fdbLineNrDestDir);
wLineNrExt = new Text(wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLineNrExt);
wLineNrExt.addModifyListener(lsMod);
fdLineNrDestExt = new FormData();
fdLineNrDestExt.left = new FormAttachment(wErrorExt, 0, SWT.LEFT);
fdLineNrDestExt.right = new FormAttachment(wErrorExt, 0, SWT.RIGHT);
fdLineNrDestExt.top = new FormAttachment(previous, margin);
wLineNrExt.setLayoutData(fdLineNrDestExt);
wlLineNrExt = new Label(wErrorComp, SWT.RIGHT);
wlLineNrExt.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlLineNrExt);
fdlLineNrDestExt = new FormData();
fdlLineNrDestExt.top = new FormAttachment(previous, margin);
fdlLineNrDestExt.right = new FormAttachment(wLineNrExt, -margin);
wlLineNrExt.setLayoutData(fdlLineNrDestExt);
wLineNrDestDir = new TextVar(transMeta, wErrorComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLineNrDestDir);
wLineNrDestDir.addModifyListener(lsMod);
fdLineNrDestDir = new FormData();
fdLineNrDestDir.left = new FormAttachment(middle, 0);
fdLineNrDestDir.right = new FormAttachment(wlLineNrExt, -margin);
fdLineNrDestDir.top = new FormAttachment(previous, margin);
wLineNrDestDir.setLayoutData(fdLineNrDestDir);
// Listen to the Browse... button
wbbLineNrDestDir.addSelectionListener(DirectoryDialogButtonListenerFactory.getSelectionAdapter(shell, wLineNrDestDir.getTextWidget()));
// Whenever something changes, set the tooltip to the expanded version of the directory:
wLineNrDestDir.addModifyListener(getModifyListenerTooltipText(wLineNrDestDir.getTextWidget()));
fdErrorComp = new FormData();
fdErrorComp.left = new FormAttachment(0, 0);
fdErrorComp.top = new FormAttachment(0, 0);
fdErrorComp.right = new FormAttachment(100, 0);
fdErrorComp.bottom = new FormAttachment(100, 0);
wErrorComp.setLayoutData(fdErrorComp);
wErrorComp.pack();
// What's the size:
Rectangle bounds = wErrorComp.getBounds();
wErrorSComp.setContent(wErrorComp);
wErrorSComp.setExpandHorizontal(true);
wErrorSComp.setExpandVertical(true);
wErrorSComp.setMinWidth(bounds.width);
wErrorSComp.setMinHeight(bounds.height);
wErrorTab.setControl(wErrorSComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
}
Aggregations