in plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputDialog.java [178:1020]
public String open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
PropsUi.setLook(shell);
setShellImage(shell, input);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = PropsUi.getFormMargin();
formLayout.marginHeight = PropsUi.getFormMargin();
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "PropertyInputDialog.DialogTitle"));
middle = props.getMiddlePct();
margin = PropsUi.getMargin();
// Buttons at the bottom
wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOk.addListener(SWT.Selection, e -> ok());
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Button.PreviewRows"));
wPreview.addListener(SWT.Selection, e -> preview());
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
setButtonPositions(new Button[] {wOk, wPreview, wCancel}, margin, null);
// TransformName line
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG, "System.TransformName.Label"));
wlTransformName.setToolTipText(BaseMessages.getString(PKG, "System.TransformName.Tooltip"));
PropsUi.setLook(wlTransformName);
fdlTransformName = new FormData();
fdlTransformName.left = new FormAttachment(0, 0);
fdlTransformName.top = new FormAttachment(0, margin);
fdlTransformName.right = new FormAttachment(middle, -margin);
wlTransformName.setLayoutData(fdlTransformName);
wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wTransformName.setText(transformName);
PropsUi.setLook(wTransformName);
fdTransformName = new FormData();
fdTransformName.left = new FormAttachment(middle, 0);
fdTransformName.top = new FormAttachment(0, margin);
fdTransformName.right = new FormAttachment(100, 0);
wTransformName.setLayoutData(fdTransformName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
PropsUi.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
CTabItem wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setFont(GuiResource.getInstance().getFontDefault());
wFileTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.File.Tab"));
Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
PropsUi.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
// ///////////////////////////////
// START OF Origin files GROUP //
// ///////////////////////////////
Group wOriginFiles = new Group(wFileComp, SWT.SHADOW_NONE);
PropsUi.setLook(wOriginFiles);
wOriginFiles.setText(BaseMessages.getString(PKG, "PropertyInputDialog.wOriginFiles.Label"));
FormLayout originFilesGroupLayout = new FormLayout();
originFilesGroupLayout.marginWidth = 10;
originFilesGroupLayout.marginHeight = 10;
wOriginFiles.setLayout(originFilesGroupLayout);
// Is Filename defined in a Field
Label wlFileField = new Label(wOriginFiles, SWT.RIGHT);
wlFileField.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FileField.Label"));
PropsUi.setLook(wlFileField);
FormData fdlFileField = new FormData();
fdlFileField.left = new FormAttachment(0, 0);
fdlFileField.top = new FormAttachment(0, margin);
fdlFileField.right = new FormAttachment(middle, -margin);
wlFileField.setLayoutData(fdlFileField);
wFileField = new Button(wOriginFiles, SWT.CHECK);
PropsUi.setLook(wFileField);
wFileField.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.FileField.Tooltip"));
FormData fdFileField = new FormData();
fdFileField.left = new FormAttachment(middle, margin);
fdFileField.top = new FormAttachment(wlFileField, 0, SWT.CENTER);
wFileField.setLayoutData(fdFileField);
wFileField.addListener(SWT.Selection, e -> activateFileField());
// Filename field
wlFilenameField = new Label(wOriginFiles, SWT.RIGHT);
wlFilenameField.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.wlFilenameField.Label"));
PropsUi.setLook(wlFilenameField);
FormData fdlFilenameField = new FormData();
fdlFilenameField.left = new FormAttachment(0, 0);
fdlFilenameField.top = new FormAttachment(wFileField, margin);
fdlFilenameField.right = new FormAttachment(middle, -margin);
wlFilenameField.setLayoutData(fdlFilenameField);
wFilenameField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
wFilenameField.setEditable(true);
PropsUi.setLook(wFilenameField);
FormData fdFilenameField = new FormData();
fdFilenameField.left = new FormAttachment(middle, margin);
fdFilenameField.top = new FormAttachment(wFileField, margin);
fdFilenameField.right = new FormAttachment(100, -margin);
wFilenameField.setLayoutData(fdFilenameField);
wFilenameField.addListener(SWT.FocusIn, e -> setFileField());
FormData fdOriginFiles = new FormData();
fdOriginFiles.left = new FormAttachment(0, margin);
fdOriginFiles.top = new FormAttachment(wFilenameList, margin);
fdOriginFiles.right = new FormAttachment(100, -margin);
wOriginFiles.setLayoutData(fdOriginFiles);
// ///////////////////////////////////////////////////////////
// / END OF Origin files GROUP
// ///////////////////////////////////////////////////////////
middle = middle / 2;
// Filename line
wlFilename = new Label(wFileComp, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Filename.Label"));
PropsUi.setLook(wlFilename);
FormData fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wOriginFiles, 2 * margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbbFilename);
wbbFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameBrowse.Button"));
wbbFilename.setToolTipText(
BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
FormData fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
wbbFilename.setLayoutData(fdbFilename);
wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbaFilename);
wbaFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameAdd.Button"));
wbaFilename.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.FilenameAdd.Tooltip"));
FormData fdbaFilename = new FormData();
fdbaFilename.right = new FormAttachment(wbbFilename, -margin);
fdbaFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
wbaFilename.setLayoutData(fdbaFilename);
wFilename = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wFilename);
FormData fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.right = new FormAttachment(wbaFilename, -margin);
fdFilename.top = new FormAttachment(wlFilename, 0, SWT.CENTER);
wFilename.setLayoutData(fdFilename);
wlFileMask = new Label(wFileComp, SWT.RIGHT);
wlFileMask.setText(BaseMessages.getString(PKG, "PropertyInputDialog.RegExp.Label"));
PropsUi.setLook(wlFileMask);
FormData fdlFileMask = new FormData();
fdlFileMask.left = new FormAttachment(0, 0);
fdlFileMask.top = new FormAttachment(wFilename, margin);
fdlFileMask.right = new FormAttachment(middle, -margin);
wlFileMask.setLayoutData(fdlFileMask);
wFileMask = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wFileMask);
FormData fdFileMask = new FormData();
fdFileMask.left = new FormAttachment(middle, 0);
fdFileMask.top = new FormAttachment(wlFileMask, 0, SWT.CENTER);
fdFileMask.right = new FormAttachment(wbaFilename, -margin);
wFileMask.setLayoutData(fdFileMask);
wlExcludeFileMask = new Label(wFileComp, SWT.RIGHT);
wlExcludeFileMask.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.ExcludeFileMask.Label"));
PropsUi.setLook(wlExcludeFileMask);
FormData fdlExcludeFileMask = new FormData();
fdlExcludeFileMask.left = new FormAttachment(0, 0);
fdlExcludeFileMask.top = new FormAttachment(wFileMask, margin);
fdlExcludeFileMask.right = new FormAttachment(middle, -margin);
wlExcludeFileMask.setLayoutData(fdlExcludeFileMask);
wExcludeFileMask = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wExcludeFileMask);
FormData fdExcludeFileMask = new FormData();
fdExcludeFileMask.left = new FormAttachment(middle, 0);
fdExcludeFileMask.top = new FormAttachment(wlExcludeFileMask, 0, SWT.CENTER);
fdExcludeFileMask.right = new FormAttachment(wFilename, 0, SWT.RIGHT);
wExcludeFileMask.setLayoutData(fdExcludeFileMask);
// Filename list line
wlFilenameList = new Label(wFileComp, SWT.RIGHT);
wlFilenameList.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameList.Label"));
PropsUi.setLook(wlFilenameList);
FormData fdlFilenameList = new FormData();
fdlFilenameList.left = new FormAttachment(0, 0);
fdlFilenameList.top = new FormAttachment(wExcludeFileMask, margin);
fdlFilenameList.right = new FormAttachment(middle, -margin);
wlFilenameList.setLayoutData(fdlFilenameList);
// Buttons to the right of the screen...
wbdFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbdFilename);
wbdFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameRemove.Button"));
wbdFilename.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.FilenameRemove.Tooltip"));
FormData fdbdFilename = new FormData();
fdbdFilename.right = new FormAttachment(100, 0);
fdbdFilename.top = new FormAttachment(wExcludeFileMask, margin);
wbdFilename.setLayoutData(fdbdFilename);
wbeFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbeFilename);
wbeFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FilenameEdit.Button"));
wbeFilename.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.FilenameEdit.Tooltip"));
FormData fdbeFilename = new FormData();
fdbeFilename.right = new FormAttachment(100, 0);
fdbeFilename.left = new FormAttachment(wbdFilename, 0, SWT.LEFT);
fdbeFilename.top = new FormAttachment(wbdFilename, margin);
wbeFilename.setLayoutData(fdbeFilename);
wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbShowFiles);
wbShowFiles.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ShowFiles.Button"));
FormData fdbShowFiles = new FormData();
fdbShowFiles.left = new FormAttachment(middle, 0);
fdbShowFiles.bottom = new FormAttachment(100, 0);
wbShowFiles.setLayoutData(fdbShowFiles);
ColumnInfo[] colinfo = new ColumnInfo[5];
colinfo[0] =
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.Files.Filename.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false);
colinfo[1] =
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.Files.Wildcard.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false);
colinfo[2] =
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.Files.ExcludeWildcard.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false);
colinfo[3] =
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.Required.Column"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
YES_NO_COMBO);
colinfo[4] =
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.IncludeSubDirs.Column"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
YES_NO_COMBO);
colinfo[0].setUsingVariables(true);
colinfo[1].setUsingVariables(true);
colinfo[1].setToolTip(
BaseMessages.getString(PKG, "PropertyInputDialog.Files.Wildcard.Tooltip"));
colinfo[2].setUsingVariables(true);
colinfo[2].setToolTip(
BaseMessages.getString(PKG, "PropertyInputDialog.Files.ExcludeWildcard.Tooltip"));
colinfo[3].setToolTip(BaseMessages.getString(PKG, "PropertyInputDialog.Required.Tooltip"));
colinfo[4].setToolTip(
BaseMessages.getString(PKG, "PropertyInputDialog.IncludeSubDirs.Tooltip"));
wFilenameList =
new TableView(
variables,
wFileComp,
SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER,
colinfo,
2,
null,
props);
PropsUi.setLook(wFilenameList);
FormData fdFilenameList = new FormData();
fdFilenameList.left = new FormAttachment(middle, 0);
fdFilenameList.right = new FormAttachment(wbdFilename, -margin);
fdFilenameList.top = new FormAttachment(wExcludeFileMask, margin);
fdFilenameList.bottom = new FormAttachment(wbShowFiles, -margin);
wFilenameList.setLayoutData(fdFilenameList);
FormData 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
// ///////////////////////////////////////////////////////////
middle = props.getMiddlePct();
// ////////////////////////
// START OF CONTENT TAB///
// /
CTabItem wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setFont(GuiResource.getInstance().getFontDefault());
wContentTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Content.Tab"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
PropsUi.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// ///////////////////////////////
// START OF SettingsGroup GROUP //
// ///////////////////////////////
Group wSettingsGroup = new Group(wContentComp, SWT.SHADOW_NONE);
PropsUi.setLook(wSettingsGroup);
wSettingsGroup.setText(BaseMessages.getString(PKG, "PropertyInputDialog.SettingsGroup.Label"));
FormLayout settingsGroupLayout = new FormLayout();
settingsGroupLayout.marginWidth = 10;
settingsGroupLayout.marginHeight = 10;
wSettingsGroup.setLayout(settingsGroupLayout);
Label wlFileType = new Label(wSettingsGroup, SWT.RIGHT);
wlFileType.setText(BaseMessages.getString(PKG, "PropertyInputDialog.FileType.Label"));
PropsUi.setLook(wlFileType);
FormData fdlFileType = new FormData();
fdlFileType.left = new FormAttachment(0, 0);
fdlFileType.top = new FormAttachment(0, margin);
fdlFileType.right = new FormAttachment(middle, -margin);
wlFileType.setLayoutData(fdlFileType);
wFileType = new CCombo(wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
wFileType.setEditable(true);
wFileType.setItems(ResultFile.FileType.getDescriptions());
PropsUi.setLook(wFileType);
FormData fdFileType = new FormData();
fdFileType.left = new FormAttachment(middle, 0);
fdFileType.top = new FormAttachment(0, margin);
fdFileType.right = new FormAttachment(100, 0);
wFileType.setLayoutData(fdFileType);
wFileType.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setFileType();
}
});
wlEncoding = new Label(wSettingsGroup, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Encoding.Label"));
PropsUi.setLook(wlEncoding);
FormData fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wFileType, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new ComboVar(variables, wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
wEncoding.setEditable(true);
PropsUi.setLook(wEncoding);
FormData fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.top = new FormAttachment(wFileType, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addListener(SWT.FocusIn, e -> setEncodings());
wlSection = new Label(wSettingsGroup, SWT.RIGHT);
wlSection.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Section.Label"));
PropsUi.setLook(wlSection);
FormData fdlSection = new FormData();
fdlSection.left = new FormAttachment(0, 0);
fdlSection.top = new FormAttachment(wEncoding, margin);
fdlSection.right = new FormAttachment(middle, -margin);
wlSection.setLayoutData(fdlSection);
wbbSection = new Button(wSettingsGroup, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbbSection);
wbbSection.setText(BaseMessages.getString(PKG, "PropertyInputDialog.SectionBrowse.Button"));
FormData fdbSection = new FormData();
fdbSection.right = new FormAttachment(100, 0);
fdbSection.top = new FormAttachment(wEncoding, margin);
wbbSection.setLayoutData(fdbSection);
wbbSection.addListener(SWT.Selection, e -> getSections());
wSection = new TextVar(variables, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSection.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.Section.Tooltip"));
PropsUi.setLook(wSection);
FormData fdSection = new FormData();
fdSection.left = new FormAttachment(middle, 0);
fdSection.top = new FormAttachment(wEncoding, margin);
fdSection.right = new FormAttachment(wbbSection, -margin);
wSection.setLayoutData(fdSection);
wlLimit = new Label(wSettingsGroup, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Limit.Label"));
PropsUi.setLook(wlLimit);
FormData fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wbbSection, margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new Text(wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wLimit);
FormData fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wbbSection, margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
Label wlResolveValueVariable = new Label(wSettingsGroup, SWT.RIGHT);
wlResolveValueVariable.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.resolveValueVariable.Label"));
PropsUi.setLook(wlResolveValueVariable);
FormData fdlResolveValueVariable = new FormData();
fdlResolveValueVariable.left = new FormAttachment(0, 0);
fdlResolveValueVariable.top = new FormAttachment(wLimit, margin);
fdlResolveValueVariable.right = new FormAttachment(middle, -margin);
wlResolveValueVariable.setLayoutData(fdlResolveValueVariable);
wResolveValueVariable = new Button(wSettingsGroup, SWT.CHECK);
PropsUi.setLook(wResolveValueVariable);
wResolveValueVariable.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.resolveValueVariable.Tooltip"));
FormData fdResolveValueVariable = new FormData();
fdResolveValueVariable.left = new FormAttachment(middle, 0);
fdResolveValueVariable.top = new FormAttachment(wlResolveValueVariable, 0, SWT.CENTER);
wResolveValueVariable.setLayoutData(fdResolveValueVariable);
wResolveValueVariable.addSelectionListener(new ComponentSelectionListener(input));
FormData fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, margin);
fdSettingsGroup.top = new FormAttachment(wResolveValueVariable, margin);
fdSettingsGroup.right = new FormAttachment(100, -margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// ///////////////////////////////////////////////////////////
// / END OF SettingsGroup GROUP
// ///////////////////////////////////////////////////////////
// /////////////////////////////////
// START OF Additional Fields GROUP
// /////////////////////////////////
Group wAdditionalGroup = new Group(wContentComp, SWT.SHADOW_NONE);
PropsUi.setLook(wAdditionalGroup);
wAdditionalGroup.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.Group.AdditionalGroup.Label"));
FormLayout additionalGroupLayout = new FormLayout();
additionalGroupLayout.marginWidth = 10;
additionalGroupLayout.marginHeight = 10;
wAdditionalGroup.setLayout(additionalGroupLayout);
wlInclFilename = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclFilename.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclFilename.Label"));
PropsUi.setLook(wlInclFilename);
FormData fdlInclFilename = new FormData();
fdlInclFilename.left = new FormAttachment(0, 0);
fdlInclFilename.top = new FormAttachment(wSettingsGroup, margin);
fdlInclFilename.right = new FormAttachment(middle, -margin);
wlInclFilename.setLayoutData(fdlInclFilename);
wInclFilename = new Button(wAdditionalGroup, SWT.CHECK);
PropsUi.setLook(wInclFilename);
wInclFilename.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclFilename.Tooltip"));
FormData fdInclFilename = new FormData();
fdInclFilename.left = new FormAttachment(middle, 0);
fdInclFilename.top = new FormAttachment(wlInclFilename, 0, SWT.CENTER);
wInclFilename.setLayoutData(fdInclFilename);
wInclFilename.addSelectionListener(new ComponentSelectionListener(input));
wlInclFilenameField = new Label(wAdditionalGroup, SWT.LEFT);
wlInclFilenameField.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclFilenameField.Label"));
PropsUi.setLook(wlInclFilenameField);
FormData fdlInclFilenameField = new FormData();
fdlInclFilenameField.left = new FormAttachment(wInclFilename, margin);
fdlInclFilenameField.top = new FormAttachment(wSettingsGroup, margin);
wlInclFilenameField.setLayoutData(fdlInclFilenameField);
wInclFilenameField =
new TextVar(variables, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wInclFilenameField);
FormData fdInclFilenameField = new FormData();
fdInclFilenameField.left = new FormAttachment(wlInclFilenameField, margin);
fdInclFilenameField.top = new FormAttachment(wSettingsGroup, margin);
fdInclFilenameField.right = new FormAttachment(100, 0);
wInclFilenameField.setLayoutData(fdInclFilenameField);
Label wlInclRowNum = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclRowNum.setText(BaseMessages.getString(PKG, "PropertyInputDialog.InclRowNum.Label"));
PropsUi.setLook(wlInclRowNum);
FormData 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(wAdditionalGroup, SWT.CHECK);
PropsUi.setLook(wInclRowNum);
wInclRowNum.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclRowNum.Tooltip"));
FormData fdRowNum = new FormData();
fdRowNum.left = new FormAttachment(middle, 0);
fdRowNum.top = new FormAttachment(wlInclRowNum, 0, SWT.CENTER);
wInclRowNum.setLayoutData(fdRowNum);
wInclRowNum.addSelectionListener(new ComponentSelectionListener(input));
wlInclRowNumField = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclRowNumField.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclRowNumField.Label"));
PropsUi.setLook(wlInclRowNumField);
FormData fdlInclRowNumField = new FormData();
fdlInclRowNumField.left = new FormAttachment(wInclRowNum, margin);
fdlInclRowNumField.top = new FormAttachment(wInclFilenameField, margin);
wlInclRowNumField.setLayoutData(fdlInclRowNumField);
wInclRowNumField = new TextVar(variables, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wInclRowNumField);
FormData fdInclRowNumField = new FormData();
fdInclRowNumField.left = new FormAttachment(wlInclRowNumField, margin);
fdInclRowNumField.top = new FormAttachment(wInclFilenameField, margin);
fdInclRowNumField.right = new FormAttachment(100, 0);
wInclRowNumField.setLayoutData(fdInclRowNumField);
wResetRowNum = new Button(wAdditionalGroup, SWT.CHECK);
PropsUi.setLook(wResetRowNum);
wResetRowNum.setText(BaseMessages.getString(PKG, "PropertyInputDialog.ResetRowNum.Label"));
wResetRowNum.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.ResetRowNum.Tooltip"));
fdRowNum = new FormData();
fdRowNum.left = new FormAttachment(wlInclRowNum, margin);
fdRowNum.top = new FormAttachment(wInclRowNumField, margin);
wResetRowNum.setLayoutData(fdRowNum);
wResetRowNum.addSelectionListener(new ComponentSelectionListener(input));
wlInclIniSection = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclIniSection.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclIniSection.Label"));
PropsUi.setLook(wlInclIniSection);
FormData fdlInclIniSection = new FormData();
fdlInclIniSection.left = new FormAttachment(0, 0);
fdlInclIniSection.top = new FormAttachment(wResetRowNum, margin);
fdlInclIniSection.right = new FormAttachment(middle, -margin);
wlInclIniSection.setLayoutData(fdlInclIniSection);
wInclIniSection = new Button(wAdditionalGroup, SWT.CHECK);
PropsUi.setLook(wInclIniSection);
wInclIniSection.setToolTipText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclIniSection.Tooltip"));
fdRowNum = new FormData();
fdRowNum.left = new FormAttachment(middle, 0);
fdRowNum.top = new FormAttachment(wlInclIniSection, 0, SWT.CENTER);
wInclIniSection.setLayoutData(fdRowNum);
wInclIniSection.addSelectionListener(new ComponentSelectionListener(input));
wlInclIniSectionField = new Label(wAdditionalGroup, SWT.RIGHT);
wlInclIniSectionField.setText(
BaseMessages.getString(PKG, "PropertyInputDialog.InclIniSectionField.Label"));
PropsUi.setLook(wlInclIniSectionField);
FormData fdlInclIniSectionField = new FormData();
fdlInclIniSectionField.left = new FormAttachment(wInclIniSection, margin);
fdlInclIniSectionField.top = new FormAttachment(wResetRowNum, margin);
wlInclIniSectionField.setLayoutData(fdlInclIniSectionField);
wInclIniSectionField =
new TextVar(variables, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wInclIniSectionField);
FormData fdInclIniSectionField = new FormData();
fdInclIniSectionField.left = new FormAttachment(wlInclIniSectionField, margin);
fdInclIniSectionField.top = new FormAttachment(wResetRowNum, margin);
fdInclIniSectionField.right = new FormAttachment(100, 0);
wInclIniSectionField.setLayoutData(fdInclIniSectionField);
FormData fdAdditionalGroup = new FormData();
fdAdditionalGroup.left = new FormAttachment(0, margin);
fdAdditionalGroup.top = new FormAttachment(wSettingsGroup, margin);
fdAdditionalGroup.right = new FormAttachment(100, -margin);
wAdditionalGroup.setLayoutData(fdAdditionalGroup);
// ///////////////////////////////////////////////////////////
// / END OF DESTINATION ADDRESS GROUP
// ///////////////////////////////////////////////////////////
// ///////////////////////////////
// START OF AddFileResult GROUP //
// ///////////////////////////////
Group wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
PropsUi.setLook(wAddFileResult);
wAddFileResult.setText(BaseMessages.getString(PKG, "PropertyInputDialog.wAddFileResult.Label"));
FormLayout addFileResultGroupLayout = new FormLayout();
addFileResultGroupLayout.marginWidth = 10;
addFileResultGroupLayout.marginHeight = 10;
wAddFileResult.setLayout(addFileResultGroupLayout);
Label wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
wlAddResult.setText(BaseMessages.getString(PKG, "PropertyInputDialog.AddResult.Label"));
PropsUi.setLook(wlAddResult);
FormData fdlAddResult = new FormData();
fdlAddResult.left = new FormAttachment(0, 0);
fdlAddResult.top = new FormAttachment(wAdditionalGroup, margin);
fdlAddResult.right = new FormAttachment(middle, -margin);
wlAddResult.setLayoutData(fdlAddResult);
wAddResult = new Button(wAddFileResult, SWT.CHECK);
PropsUi.setLook(wAddResult);
wAddResult.setToolTipText(BaseMessages.getString(PKG, "PropertyInputDialog.AddResult.Tooltip"));
FormData fdAddResult = new FormData();
fdAddResult.left = new FormAttachment(middle, 0);
fdAddResult.top = new FormAttachment(wlAddResult, 0, SWT.CENTER);
wAddResult.setLayoutData(fdAddResult);
wAddResult.addSelectionListener(new ComponentSelectionListener(input));
FormData fdAddFileResult = new FormData();
fdAddFileResult.left = new FormAttachment(0, margin);
fdAddFileResult.top = new FormAttachment(wAdditionalGroup, margin);
fdAddFileResult.right = new FormAttachment(100, -margin);
wAddFileResult.setLayoutData(fdAddFileResult);
// ///////////////////////////////////////////////////////////
// / END OF AddFileResult GROUP
// ///////////////////////////////////////////////////////////
FormData fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(fdContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
CTabItem wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setFont(GuiResource.getInstance().getFontDefault());
wFieldsTab.setText(BaseMessages.getString(PKG, "PropertyInputDialog.Fields.Tab"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = PropsUi.getFormMargin();
fieldsLayout.marginHeight = PropsUi.getFormMargin();
Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
PropsUi.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "PropertyInputDialog.GetFields.Button"));
fdGet = new FormData();
fdGet.left = new FormAttachment(50, 0);
fdGet.bottom = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int FieldsRows = input.getInputFields().size();
ColumnInfo[] colinf =
new ColumnInfo[] {
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Name.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Attribute.Column"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
PropertyInputMeta.KeyValue.getCodes(),
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Type.Column"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
ValueMetaFactory.getValueMetaNames(),
true),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Format.Column"),
ColumnInfo.COLUMN_TYPE_FORMAT,
3),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Length.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Precision.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Currency.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Decimal.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Group.Column"),
ColumnInfo.COLUMN_TYPE_TEXT,
false),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.TrimType.Column"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
IValueMeta.TrimType.getDescriptions(),
true),
new ColumnInfo(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Repeat.Column"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
new String[] {
BaseMessages.getString(PKG, CONST_SYSTEM_COMBO_YES),
BaseMessages.getString(PKG, CONST_SYSTEM_COMBO_NO)
},
true),
};
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Name.Column.Tooltip"));
colinf[1].setToolTip(
BaseMessages.getString(PKG, "PropertyInputDialog.FieldsTable.Attribute.Column.Tooltip"));
wFields =
new TableView(
variables,
wFieldsComp,
SWT.FULL_SELECTION | SWT.MULTI,
colinf,
FieldsRows,
null,
props);
FormData 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);
FormData 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);
addAdditionalFieldsTab();
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wTransformName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
wGet.addListener(SWT.Selection, e -> get());
// Add the file to the list of files...
Listener selA =
e -> {
wFilenameList.add(
wFilename.getText(),
wFileMask.getText(),
wExcludeFileMask.getText(),
PropertyInputMeta.RequiredFilesCode[0],
PropertyInputMeta.RequiredFilesCode[0]);
wFilename.setText("");
wFileMask.setText("");
wExcludeFileMask.setText("");
wFilenameList.removeEmptyRows();
wFilenameList.setRowNums();
wFilenameList.optWidth(true);
};
wbaFilename.addListener(SWT.Selection, selA);
wFilename.addListener(SWT.Selection, selA);
// Delete files from the list of files...
wbdFilename.addListener(
SWT.Selection,
e -> {
int[] idx = wFilenameList.getSelectionIndices();
wFilenameList.remove(idx);
wFilenameList.removeEmptyRows();
wFilenameList.setRowNums();
});
// Edit the selected file & remove from the list...
wbeFilename.addListener(
SWT.Selection,
e -> {
int idx = wFilenameList.getSelectionIndex();
if (idx >= 0) {
String[] string = wFilenameList.getItem(idx);
wFilename.setText(string[0]);
wFileMask.setText(string[1]);
wExcludeFileMask.setText(string[2]);
wFilenameList.remove(idx);
}
wFilenameList.removeEmptyRows();
wFilenameList.setRowNums();
});
// Show the files that are selected at this time...
wbShowFiles.addListener(SWT.Selection, e -> showInputFiles());
// Enable/disable the right fields to allow a filename to be added to each row...
wInclFilename.addListener(SWT.Selection, e -> setIncludeFilename());
// Enable/disable the right fields to allow a filename to be added to each row...
wInclIniSection.addListener(SWT.Selection, e -> setIncludeSection());
// Enable/disable the right fields to allow a row number to be added to each row...
wInclRowNum.addListener(SWT.Selection, e -> setIncludeRowNum());
// Whenever something changes, set the tooltip to the expanded version of the filename:
wFilename.addModifyListener(e -> wFilename.setToolTipText(""));
// Listen to the Browse... button
wbbFilename.addListener(SWT.Selection, e -> browseFiles());
wTabFolder.setSelection(0);
getData(input);
setFileType();
input.setChanged(changed);
activateFileField();
wFields.optWidth(true);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformName;
}