use of org.apache.hop.core.Props in project hop by apache.
the class RegexEvalDialog method open.
@Override
public String open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = e -> input.setChanged();
SelectionListener lsSel = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent 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, "RegexEvalDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = props.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());
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
setButtonPositions(new Button[] { wOk, wCancel }, margin, null);
// Filename line
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG, "RegexEvalDialog.TransformName.Label"));
props.setLook(wlTransformName);
fdlTransformName = new FormData();
fdlTransformName.left = new FormAttachment(0, 0);
fdlTransformName.right = new FormAttachment(middle, -margin);
fdlTransformName.top = new FormAttachment(0, margin);
wlTransformName.setLayoutData(fdlTransformName);
wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wTransformName.setText(transformName);
props.setLook(wTransformName);
wTransformName.addModifyListener(lsMod);
fdTransformName = new FormData();
fdTransformName.left = new FormAttachment(middle, 0);
fdTransformName.top = new FormAttachment(0, margin);
fdTransformName.right = new FormAttachment(100, 0);
wTransformName.setLayoutData(fdTransformName);
SashForm wSash = new SashForm(shell, SWT.VERTICAL);
CTabFolder wTabFolder = new CTabFolder(wSash, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "RegexEvalDialog.GeneralTab.TabTitle"));
Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// Transform Settings grouping?
// ////////////////////////
// START OF Transform Settings GROUP
//
Group wTransformSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wTransformSettings);
wTransformSettings.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Group.TransformSettings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wTransformSettings.setLayout(groupLayout);
// fieldevaluate
Label wlfieldevaluate = new Label(wTransformSettings, SWT.RIGHT);
wlfieldevaluate.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Matcher.Label"));
props.setLook(wlfieldevaluate);
FormData fdlfieldevaluate = new FormData();
fdlfieldevaluate.left = new FormAttachment(0, 0);
fdlfieldevaluate.top = new FormAttachment(wTransformName, margin);
fdlfieldevaluate.right = new FormAttachment(middle, -margin);
wlfieldevaluate.setLayoutData(fdlfieldevaluate);
wFieldEvaluate = new CCombo(wTransformSettings, SWT.BORDER | SWT.READ_ONLY);
wFieldEvaluate.setEditable(true);
props.setLook(wFieldEvaluate);
wFieldEvaluate.addModifyListener(lsMod);
FormData fdfieldevaluate = new FormData();
fdfieldevaluate.left = new FormAttachment(middle, margin);
fdfieldevaluate.top = new FormAttachment(wTransformName, margin);
fdfieldevaluate.right = new FormAttachment(100, -margin);
wFieldEvaluate.setLayoutData(fdfieldevaluate);
wFieldEvaluate.addSelectionListener(lsSel);
wFieldEvaluate.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
}
@Override
public void focusGained(FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getPreviousFields();
shell.setCursor(null);
busy.dispose();
}
});
// Output Fieldame
wResultField = new LabelTextVar(variables, wTransformSettings, BaseMessages.getString(PKG, "RegexEvalDialog.ResultField.Label"), BaseMessages.getString(PKG, "RegexEvalDialog.ResultField.Tooltip"));
props.setLook(wResultField);
wResultField.addModifyListener(lsMod);
FormData fdResultField = new FormData();
fdResultField.left = new FormAttachment(0, 0);
fdResultField.top = new FormAttachment(wFieldEvaluate, margin);
fdResultField.right = new FormAttachment(100, 0);
wResultField.setLayoutData(fdResultField);
// Allow capture groups?
Label wlAllowCaptureGroups = new Label(wTransformSettings, SWT.RIGHT);
wlAllowCaptureGroups.setText(BaseMessages.getString(PKG, "RegexEvalDialog.AllowCaptureGroups.Label"));
props.setLook(wlAllowCaptureGroups);
FormData fdlAllowCaptureGroups = new FormData();
fdlAllowCaptureGroups.left = new FormAttachment(0, 0);
fdlAllowCaptureGroups.top = new FormAttachment(wResultField, margin);
fdlAllowCaptureGroups.right = new FormAttachment(middle, -margin);
wlAllowCaptureGroups.setLayoutData(fdlAllowCaptureGroups);
wAllowCaptureGroups = new Button(wTransformSettings, SWT.CHECK);
wAllowCaptureGroups.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.AllowCaptureGroups.Tooltip"));
props.setLook(wAllowCaptureGroups);
FormData fdAllowCaptureGroups = new FormData();
fdAllowCaptureGroups.left = new FormAttachment(middle, margin);
fdAllowCaptureGroups.top = new FormAttachment(wlAllowCaptureGroups, 0, SWT.CENTER);
fdAllowCaptureGroups.right = new FormAttachment(100, 0);
wAllowCaptureGroups.setLayoutData(fdAllowCaptureGroups);
wAllowCaptureGroups.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setFieldsEnabledStatus();
input.setChanged();
}
});
// Replace fields?
wlReplaceFields = new Label(wTransformSettings, SWT.RIGHT);
wlReplaceFields.setText(BaseMessages.getString(PKG, "RegexEvalDialog.ReplaceFields.Label"));
props.setLook(wlReplaceFields);
FormData fdlReplaceFields = new FormData();
fdlReplaceFields.left = new FormAttachment(0, 0);
fdlReplaceFields.top = new FormAttachment(wAllowCaptureGroups, margin);
fdlReplaceFields.right = new FormAttachment(middle, -margin);
wlReplaceFields.setLayoutData(fdlReplaceFields);
wReplaceFields = new Button(wTransformSettings, SWT.CHECK);
wReplaceFields.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.ReplaceFields.Tooltip"));
props.setLook(wReplaceFields);
FormData fdReplaceFields = new FormData();
fdReplaceFields.left = new FormAttachment(middle, margin);
fdReplaceFields.top = new FormAttachment(wlReplaceFields, 0, SWT.CENTER);
fdReplaceFields.right = new FormAttachment(100, 0);
wReplaceFields.setLayoutData(fdReplaceFields);
wReplaceFields.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// settings layout
FormData fdTransformSettings = new FormData();
fdTransformSettings.left = new FormAttachment(0, margin);
fdTransformSettings.top = new FormAttachment(wTransformName, margin);
fdTransformSettings.right = new FormAttachment(100, -margin);
wTransformSettings.setLayoutData(fdTransformSettings);
// ///////////////////////////////////////////////////////////
// / END OF TRANSFORM SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// Script line
Label wlScript = new Label(wGeneralComp, SWT.NONE);
wlScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Javascript.Label"));
props.setLook(wlScript);
FormData fdlScript = new FormData();
fdlScript.left = new FormAttachment(0, 0);
fdlScript.top = new FormAttachment(wTransformSettings, margin);
wlScript.setLayoutData(fdlScript);
Button wbTestRegExScript = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestRegExScript);
wbTestRegExScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.TestScript.Label"));
FormData fdbTestRegExScript = new FormData();
fdbTestRegExScript.right = new FormAttachment(100, -margin);
fdbTestRegExScript.top = new FormAttachment(wTransformSettings, margin);
wbTestRegExScript.setLayoutData(fdbTestRegExScript);
wbTestRegExScript.addListener(SWT.Selection, e -> testRegExScript());
// Variable substitution?
Label wlUseVar = new Label(wGeneralComp, SWT.NONE);
wlUseVar.setText(BaseMessages.getString(PKG, "RegexEvalDialog.UseVar.Label"));
props.setLook(wlUseVar);
FormData fdlUseVar = new FormData();
fdlUseVar.left = new FormAttachment(0, margin);
fdlUseVar.bottom = new FormAttachment(100, 0);
wlUseVar.setLayoutData(fdlUseVar);
wUseVar = new Button(wGeneralComp, SWT.CHECK);
wUseVar.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.UseVar.Tooltip"));
props.setLook(wUseVar);
FormData fdUseVar = new FormData();
fdUseVar.left = new FormAttachment(wlUseVar, margin);
fdUseVar.top = new FormAttachment(wlUseVar, 0, SWT.CENTER);
wUseVar.setLayoutData(fdUseVar);
wUseVar.addSelectionListener(lsSel);
Composite wBottom = new Composite(wSash, SWT.NONE);
props.setLook(wBottom);
wScript = new StyledTextComp(variables, wGeneralComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
wScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Script.Label"));
props.setLook(wScript, Props.WIDGET_STYLE_FIXED);
wScript.addModifyListener(lsMod);
FormData fdScript = new FormData();
fdScript.left = new FormAttachment(0, 0);
fdScript.top = new FormAttachment(wbTestRegExScript, margin);
fdScript.right = new FormAttachment(100, -10);
fdScript.bottom = new FormAttachment(wUseVar, -2 * margin);
wScript.setLayoutData(fdScript);
FormLayout bottomLayout = new FormLayout();
bottomLayout.marginWidth = Const.FORM_MARGIN;
bottomLayout.marginHeight = Const.FORM_MARGIN;
wBottom.setLayout(bottomLayout);
Label wSeparator = new Label(wBottom, SWT.SEPARATOR | SWT.HORIZONTAL);
FormData fdSeparator = new FormData();
fdSeparator.left = new FormAttachment(0, 0);
fdSeparator.right = new FormAttachment(100, 0);
fdSeparator.top = new FormAttachment(0, -margin + 2);
wSeparator.setLayoutData(fdSeparator);
wlFields = new Label(wBottom, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Fields.Label"));
wlFields.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Fields.Tooltip"));
props.setLook(wlFields);
FormData fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wSeparator, 0);
wlFields.setLayoutData(fdlFields);
final int fieldsRows = input.getFieldName().length;
ColumnInfo[] columnInfo = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.NewField"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Length"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Precision"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Format"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Group"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Decimal"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Currency"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.Nullif"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.IfNull"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "RegexEvalDialog.ColumnInfo.TrimType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true) };
wFields = new TableView(variables, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columnInfo, fieldsRows, lsMod, props);
FormData 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(100, 0);
wFields.setLayoutData(fdFields);
FormData fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
CTabItem wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "RegexEvalDialog.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);
// Transform RegexSettings grouping?
// ////////////////////////
// START OF RegexSettings GROUP
//
Group wRegexSettings = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wRegexSettings);
wRegexSettings.setText("Regex Settings");
FormLayout regexLayout = new FormLayout();
regexLayout.marginWidth = 10;
regexLayout.marginHeight = 10;
wRegexSettings.setLayout(regexLayout);
// Canon_Eq?
Label wlCanonEq = new Label(wRegexSettings, SWT.RIGHT);
wlCanonEq.setText(BaseMessages.getString(PKG, "RegexEvalDialog.CanonEq.Label"));
props.setLook(wlCanonEq);
FormData fdlCanonEq = new FormData();
fdlCanonEq.left = new FormAttachment(0, 0);
fdlCanonEq.top = new FormAttachment(wTransformSettings, margin);
fdlCanonEq.right = new FormAttachment(middle, -margin);
wlCanonEq.setLayoutData(fdlCanonEq);
wCanonEq = new Button(wRegexSettings, SWT.CHECK);
wCanonEq.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.CanonEq.Tooltip"));
props.setLook(wCanonEq);
FormData fdCanonEq = new FormData();
fdCanonEq.left = new FormAttachment(middle, 0);
fdCanonEq.top = new FormAttachment(wlCanonEq, 0, SWT.CENTER);
fdCanonEq.right = new FormAttachment(100, 0);
wCanonEq.setLayoutData(fdCanonEq);
wCanonEq.addSelectionListener(lsSel);
// CASE_INSENSITIVE?
Label wlCaseInsensitive = new Label(wRegexSettings, SWT.RIGHT);
wlCaseInsensitive.setText(BaseMessages.getString(PKG, "RegexEvalDialog.CaseInsensitive.Label"));
props.setLook(wlCaseInsensitive);
FormData fdlCaseInsensitive = new FormData();
fdlCaseInsensitive.left = new FormAttachment(0, 0);
fdlCaseInsensitive.top = new FormAttachment(wCanonEq, margin);
fdlCaseInsensitive.right = new FormAttachment(middle, -margin);
wlCaseInsensitive.setLayoutData(fdlCaseInsensitive);
wCaseInsensitive = new Button(wRegexSettings, SWT.CHECK);
wCaseInsensitive.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.CaseInsensitive.Tooltip"));
props.setLook(wCaseInsensitive);
FormData fdCaseInsensitive = new FormData();
fdCaseInsensitive.left = new FormAttachment(middle, 0);
fdCaseInsensitive.top = new FormAttachment(wlCaseInsensitive, 0, SWT.CENTER);
fdCaseInsensitive.right = new FormAttachment(100, 0);
wCaseInsensitive.setLayoutData(fdCaseInsensitive);
wCaseInsensitive.addSelectionListener(lsSel);
// COMMENT?
Label wlComment = new Label(wRegexSettings, SWT.RIGHT);
wlComment.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Comment.Label"));
props.setLook(wlComment);
FormData fdlComment = new FormData();
fdlComment.left = new FormAttachment(0, 0);
fdlComment.top = new FormAttachment(wCaseInsensitive, margin);
fdlComment.right = new FormAttachment(middle, -margin);
wlComment.setLayoutData(fdlComment);
wComment = new Button(wRegexSettings, SWT.CHECK);
wComment.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Comment.Tooltip"));
props.setLook(wComment);
FormData fdComment = new FormData();
fdComment.left = new FormAttachment(middle, 0);
fdComment.top = new FormAttachment(wlComment, 0, SWT.CENTER);
fdComment.right = new FormAttachment(100, 0);
wComment.setLayoutData(fdComment);
wComment.addSelectionListener(lsSel);
// DOTALL?
Label wlDotAll = new Label(wRegexSettings, SWT.RIGHT);
wlDotAll.setText(BaseMessages.getString(PKG, "RegexEvalDialog.DotAll.Label"));
props.setLook(wlDotAll);
FormData fdlDotAll = new FormData();
fdlDotAll.left = new FormAttachment(0, 0);
fdlDotAll.top = new FormAttachment(wComment, margin);
fdlDotAll.right = new FormAttachment(middle, -margin);
wlDotAll.setLayoutData(fdlDotAll);
wDotAll = new Button(wRegexSettings, SWT.CHECK);
wDotAll.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.DotAll.Tooltip"));
props.setLook(wDotAll);
FormData fdDotAll = new FormData();
fdDotAll.left = new FormAttachment(middle, 0);
fdDotAll.top = new FormAttachment(wlDotAll, 0, SWT.CENTER);
fdDotAll.right = new FormAttachment(100, 0);
wDotAll.setLayoutData(fdDotAll);
wDotAll.addSelectionListener(lsSel);
// MULTILINE?
Label wlMultiline = new Label(wRegexSettings, SWT.RIGHT);
wlMultiline.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Multiline.Label"));
props.setLook(wlMultiline);
FormData fdlMultiline = new FormData();
fdlMultiline.left = new FormAttachment(0, 0);
fdlMultiline.top = new FormAttachment(wDotAll, margin);
fdlMultiline.right = new FormAttachment(middle, -margin);
wlMultiline.setLayoutData(fdlMultiline);
wMultiline = new Button(wRegexSettings, SWT.CHECK);
wMultiline.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Multiline.Tooltip"));
props.setLook(wMultiline);
FormData fdMultiline = new FormData();
fdMultiline.left = new FormAttachment(middle, 0);
fdMultiline.top = new FormAttachment(wlMultiline, 0, SWT.CENTER);
fdMultiline.right = new FormAttachment(100, 0);
wMultiline.setLayoutData(fdMultiline);
wMultiline.addSelectionListener(lsSel);
// UNICODE?
Label wlUnicode = new Label(wRegexSettings, SWT.RIGHT);
wlUnicode.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Unicode.Label"));
props.setLook(wlUnicode);
FormData fdlUnicode = new FormData();
fdlUnicode.left = new FormAttachment(0, 0);
fdlUnicode.top = new FormAttachment(wMultiline, margin);
fdlUnicode.right = new FormAttachment(middle, -margin);
wlUnicode.setLayoutData(fdlUnicode);
wUnicode = new Button(wRegexSettings, SWT.CHECK);
wUnicode.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Unicode.Tooltip"));
props.setLook(wUnicode);
FormData fdUnicode = new FormData();
fdUnicode.left = new FormAttachment(middle, 0);
fdUnicode.top = new FormAttachment(wlUnicode, 0, SWT.CENTER);
fdUnicode.right = new FormAttachment(100, 0);
wUnicode.setLayoutData(fdUnicode);
wUnicode.addSelectionListener(lsSel);
// UNIX?
Label wlUnix = new Label(wRegexSettings, SWT.RIGHT);
wlUnix.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Unix.Label"));
props.setLook(wlUnix);
FormData fdlUnix = new FormData();
fdlUnix.left = new FormAttachment(0, 0);
fdlUnix.top = new FormAttachment(wUnicode, margin);
fdlUnix.right = new FormAttachment(middle, -margin);
wlUnix.setLayoutData(fdlUnix);
wUnix = new Button(wRegexSettings, SWT.CHECK);
wUnix.setToolTipText(BaseMessages.getString(PKG, "RegexEvalDialog.Unix.Tooltip"));
props.setLook(wUnix);
FormData fdUnix = new FormData();
fdUnix.left = new FormAttachment(middle, 0);
fdUnix.top = new FormAttachment(wlUnix, 0, SWT.CENTER);
fdUnix.right = new FormAttachment(100, 0);
wUnix.setLayoutData(fdUnix);
wUnix.addSelectionListener(lsSel);
FormData fdRegexSettings = new FormData();
fdRegexSettings.left = new FormAttachment(0, margin);
fdRegexSettings.top = new FormAttachment(wTransformSettings, margin);
fdRegexSettings.right = new FormAttachment(100, -margin);
wRegexSettings.setLayoutData(fdRegexSettings);
// ///////////////////////////////////////////////////////////
// / END OF RegexSettings 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(wContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
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(100, 0);
wTabFolder.setLayoutData(fdTabFolder);
FormData fdBottom = new FormData();
fdBottom.left = new FormAttachment(0, 0);
fdBottom.top = new FormAttachment(0, 0);
fdBottom.right = new FormAttachment(100, 0);
fdBottom.bottom = new FormAttachment(100, 0);
wBottom.setLayoutData(fdBottom);
FormData fdSash = new FormData();
fdSash.left = new FormAttachment(0, 0);
fdSash.top = new FormAttachment(wTransformName, 0);
fdSash.right = new FormAttachment(100, 0);
fdSash.bottom = new FormAttachment(wOk, -margin);
wSash.setLayoutData(fdSash);
wSash.setWeights(60, 40);
// Add listeners
wTabFolder.setSelection(0);
getData();
setFieldsEnabledStatus();
input.setChanged(changed);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformName;
}
use of org.apache.hop.core.Props in project hop by apache.
the class ActionHttpDialog method open.
@Override
public IAction open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
props.setLook(shell);
WorkflowDialog.setShellImage(shell, action);
ModifyListener lsMod = e -> action.setChanged();
changed = action.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "ActionHTTP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Buttons go at the very bottom
//
Button wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOk.addListener(SWT.Selection, e -> ok());
Button wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
// Action name line
Label wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "ActionHTTP.Name.Label"));
props.setLook(wlName);
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
FormData fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "ActionHTTP.Tab.General.Label"));
Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// URL line
wlURL = new Label(wGeneralComp, SWT.RIGHT);
wlURL.setText(BaseMessages.getString(PKG, "ActionHTTP.URL.Label"));
props.setLook(wlURL);
FormData fdlURL = new FormData();
fdlURL.left = new FormAttachment(0, 0);
fdlURL.top = new FormAttachment(wName, 2 * margin);
fdlURL.right = new FormAttachment(middle, -margin);
wlURL.setLayoutData(fdlURL);
wURL = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionHTTP.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
FormData fdURL = new FormData();
fdURL.left = new FormAttachment(middle, 0);
fdURL.top = new FormAttachment(wName, 2 * margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// RunEveryRow line
Label wlRunEveryRow = new Label(wGeneralComp, SWT.RIGHT);
wlRunEveryRow.setText(BaseMessages.getString(PKG, "ActionHTTP.RunForEveryRow.Label"));
props.setLook(wlRunEveryRow);
FormData fdlRunEveryRow = new FormData();
fdlRunEveryRow.left = new FormAttachment(0, 0);
fdlRunEveryRow.top = new FormAttachment(wURL, margin);
fdlRunEveryRow.right = new FormAttachment(middle, -margin);
wlRunEveryRow.setLayoutData(fdlRunEveryRow);
wRunEveryRow = new Button(wGeneralComp, SWT.CHECK);
wRunEveryRow.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.RunForEveryRow.Tooltip"));
props.setLook(wRunEveryRow);
FormData fdRunEveryRow = new FormData();
fdRunEveryRow.left = new FormAttachment(middle, 0);
fdRunEveryRow.top = new FormAttachment(wlRunEveryRow, 0, SWT.CENTER);
fdRunEveryRow.right = new FormAttachment(100, 0);
wRunEveryRow.setLayoutData(fdRunEveryRow);
wRunEveryRow.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setFlags();
}
});
// FieldURL line
wlFieldURL = new Label(wGeneralComp, SWT.RIGHT);
wlFieldURL.setText(BaseMessages.getString(PKG, "ActionHTTP.InputField.Label"));
props.setLook(wlFieldURL);
FormData fdlFieldURL = new FormData();
fdlFieldURL.left = new FormAttachment(0, 0);
fdlFieldURL.top = new FormAttachment(wlRunEveryRow, 2 * margin);
fdlFieldURL.right = new FormAttachment(middle, -margin);
wlFieldURL.setLayoutData(fdlFieldURL);
wFieldURL = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFieldURL);
wFieldURL.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.InputField.Tooltip"));
wFieldURL.addModifyListener(lsMod);
FormData fdFieldURL = new FormData();
fdFieldURL.left = new FormAttachment(middle, 0);
fdFieldURL.top = new FormAttachment(wlRunEveryRow, 2 * margin);
fdFieldURL.right = new FormAttachment(100, 0);
wFieldURL.setLayoutData(fdFieldURL);
// FieldUpload line
wlFieldUpload = new Label(wGeneralComp, SWT.RIGHT);
wlFieldUpload.setText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldUpload.Label"));
props.setLook(wlFieldUpload);
FormData fdlFieldUpload = new FormData();
fdlFieldUpload.left = new FormAttachment(0, 0);
fdlFieldUpload.top = new FormAttachment(wFieldURL, margin);
fdlFieldUpload.right = new FormAttachment(middle, -margin);
wlFieldUpload.setLayoutData(fdlFieldUpload);
wFieldUpload = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFieldUpload);
wFieldUpload.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldUpload.Tooltip"));
wFieldUpload.addModifyListener(lsMod);
FormData fdFieldUpload = new FormData();
fdFieldUpload.left = new FormAttachment(middle, 0);
fdFieldUpload.top = new FormAttachment(wFieldURL, margin);
fdFieldUpload.right = new FormAttachment(100, 0);
wFieldUpload.setLayoutData(fdFieldUpload);
// FieldTarget line
wlFieldTarget = new Label(wGeneralComp, SWT.RIGHT);
wlFieldTarget.setText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldDest.Label"));
props.setLook(wlFieldTarget);
FormData fdlFieldTarget = new FormData();
fdlFieldTarget.left = new FormAttachment(0, 0);
fdlFieldTarget.top = new FormAttachment(wFieldUpload, margin);
fdlFieldTarget.right = new FormAttachment(middle, -margin);
wlFieldTarget.setLayoutData(fdlFieldTarget);
wFieldTarget = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFieldTarget);
wFieldTarget.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldDest.Tooltip"));
wFieldTarget.addModifyListener(lsMod);
FormData fdFieldTarget = new FormData();
fdFieldTarget.left = new FormAttachment(middle, 0);
fdFieldTarget.top = new FormAttachment(wFieldUpload, margin);
fdFieldTarget.right = new FormAttachment(100, 0);
wFieldTarget.setLayoutData(fdFieldTarget);
// ////////////////////////
// START OF AuthenticationGROUP///
// /
Group wAuthentication = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAuthentication);
wAuthentication.setText(BaseMessages.getString(PKG, "ActionHTTP.Authentication.Group.Label"));
FormLayout authenticationgroupLayout = new FormLayout();
authenticationgroupLayout.marginWidth = 10;
authenticationgroupLayout.marginHeight = 10;
wAuthentication.setLayout(authenticationgroupLayout);
// UserName line
Label wlUserName = new Label(wAuthentication, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadUser.Label"));
props.setLook(wlUserName);
FormData fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wFieldTarget, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.UploadUser.Tooltip"));
wUserName.addModifyListener(lsMod);
FormData fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wFieldTarget, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
Label wlPassword = new Label(wAuthentication, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadPassword.Label"));
props.setLook(wlPassword);
FormData fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.UploadPassword.Tooltip"));
wPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// ProxyServer line
Label wlProxyServer = new Label(wAuthentication, SWT.RIGHT);
wlProxyServer.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyHost.Label"));
props.setLook(wlProxyServer);
FormData fdlProxyServer = new FormData();
fdlProxyServer.left = new FormAttachment(0, 0);
fdlProxyServer.top = new FormAttachment(wPassword, 3 * margin);
fdlProxyServer.right = new FormAttachment(middle, -margin);
wlProxyServer.setLayoutData(fdlProxyServer);
wProxyServer = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wProxyServer);
wProxyServer.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.ProxyHost.Tooltip"));
wProxyServer.addModifyListener(lsMod);
FormData fdProxyServer = new FormData();
fdProxyServer.left = new FormAttachment(middle, 0);
fdProxyServer.top = new FormAttachment(wPassword, 3 * margin);
fdProxyServer.right = new FormAttachment(100, 0);
wProxyServer.setLayoutData(fdProxyServer);
// ProxyPort line
Label wlProxyPort = new Label(wAuthentication, SWT.RIGHT);
wlProxyPort.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyPort.Label"));
props.setLook(wlProxyPort);
FormData fdlProxyPort = new FormData();
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.top = new FormAttachment(wProxyServer, margin);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlProxyPort.setLayoutData(fdlProxyPort);
wProxyPort = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wProxyPort);
wProxyPort.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.ProxyPort.Tooltip"));
wProxyPort.addModifyListener(lsMod);
FormData fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(middle, 0);
fdProxyPort.top = new FormAttachment(wProxyServer, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// IgnoreHosts line
Label wlNonProxyHosts = new Label(wAuthentication, SWT.RIGHT);
wlNonProxyHosts.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyIgnoreRegexp.Label"));
props.setLook(wlNonProxyHosts);
FormData fdlNonProxyHosts = new FormData();
fdlNonProxyHosts.left = new FormAttachment(0, 0);
fdlNonProxyHosts.top = new FormAttachment(wProxyPort, margin);
fdlNonProxyHosts.right = new FormAttachment(middle, -margin);
wlNonProxyHosts.setLayoutData(fdlNonProxyHosts);
wNonProxyHosts = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wNonProxyHosts);
wNonProxyHosts.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.ProxyIgnoreRegexp.Tooltip"));
wNonProxyHosts.addModifyListener(lsMod);
FormData fdNonProxyHosts = new FormData();
fdNonProxyHosts.left = new FormAttachment(middle, 0);
fdNonProxyHosts.top = new FormAttachment(wProxyPort, margin);
fdNonProxyHosts.right = new FormAttachment(100, 0);
wNonProxyHosts.setLayoutData(fdNonProxyHosts);
FormData fdAuthentication = new FormData();
fdAuthentication.left = new FormAttachment(0, margin);
fdAuthentication.top = new FormAttachment(wFieldTarget, margin);
fdAuthentication.right = new FormAttachment(100, -margin);
wAuthentication.setLayoutData(fdAuthentication);
// ///////////////////////////////////////////////////////////
// / END OF AuthenticationGROUP GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF UpLoadFileGROUP///
// /
Group wUpLoadFile = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wUpLoadFile);
wUpLoadFile.setText(BaseMessages.getString(PKG, "ActionHTTP.UpLoadFile.Group.Label"));
FormLayout upLoadFilegroupLayout = new FormLayout();
upLoadFilegroupLayout.marginWidth = 10;
upLoadFilegroupLayout.marginHeight = 10;
wUpLoadFile.setLayout(upLoadFilegroupLayout);
// UploadFile line
wlUploadFile = new Label(wUpLoadFile, SWT.RIGHT);
wlUploadFile.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadFile.Label"));
props.setLook(wlUploadFile);
FormData fdlUploadFile = new FormData();
fdlUploadFile.left = new FormAttachment(0, 0);
fdlUploadFile.top = new FormAttachment(wAuthentication, margin);
fdlUploadFile.right = new FormAttachment(middle, -margin);
wlUploadFile.setLayoutData(fdlUploadFile);
wbUploadFile = new Button(wUpLoadFile, SWT.PUSH | SWT.CENTER);
props.setLook(wbUploadFile);
wbUploadFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
FormData fdbUploadFile = new FormData();
fdbUploadFile.right = new FormAttachment(100, 0);
fdbUploadFile.top = new FormAttachment(wAuthentication, margin);
wbUploadFile.setLayoutData(fdbUploadFile);
wUploadFile = new TextVar(variables, wUpLoadFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUploadFile);
wUploadFile.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.UploadFile.Tooltip"));
wUploadFile.addModifyListener(lsMod);
FormData fdUploadFile = new FormData();
fdUploadFile.left = new FormAttachment(middle, 0);
fdUploadFile.top = new FormAttachment(wAuthentication, margin);
fdUploadFile.right = new FormAttachment(wbUploadFile, -margin);
wUploadFile.setLayoutData(fdUploadFile);
// Whenever something changes, set the tooltip to the expanded version:
wUploadFile.addModifyListener(e -> wUploadFile.setToolTipText(variables.resolve(wUploadFile.getText())));
wbUploadFile.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wUploadFile, variables, new String[] { "*" }, FILETYPES, true));
FormData fdUpLoadFile = new FormData();
fdUpLoadFile.left = new FormAttachment(0, margin);
fdUpLoadFile.top = new FormAttachment(wAuthentication, margin);
fdUpLoadFile.right = new FormAttachment(100, -margin);
wUpLoadFile.setLayoutData(fdUpLoadFile);
// ///////////////////////////////////////////////////////////
// / END OF UpLoadFileGROUP GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF TargetFileGroupGROUP///
// /
Group wTargetFileGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wTargetFileGroup);
wTargetFileGroup.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileGroup.Group.Label"));
FormLayout targetFileGroupgroupLayout = new FormLayout();
targetFileGroupgroupLayout.marginWidth = 10;
targetFileGroupgroupLayout.marginHeight = 10;
wTargetFileGroup.setLayout(targetFileGroupgroupLayout);
// TargetFile line
wlTargetFile = new Label(wTargetFileGroup, SWT.RIGHT);
wlTargetFile.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFile.Label"));
props.setLook(wlTargetFile);
FormData fdlTargetFile = new FormData();
fdlTargetFile.left = new FormAttachment(0, 0);
fdlTargetFile.top = new FormAttachment(wUploadFile, margin);
fdlTargetFile.right = new FormAttachment(middle, -margin);
wlTargetFile.setLayoutData(fdlTargetFile);
wbTargetFile = new Button(wTargetFileGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbTargetFile);
wbTargetFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
FormData fdbTargetFile = new FormData();
fdbTargetFile.right = new FormAttachment(100, 0);
fdbTargetFile.top = new FormAttachment(wUploadFile, margin);
wbTargetFile.setLayoutData(fdbTargetFile);
wTargetFile = new TextVar(variables, wTargetFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTargetFile);
wTargetFile.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFile.Tooltip"));
wTargetFile.addModifyListener(lsMod);
FormData fdTargetFile = new FormData();
fdTargetFile.left = new FormAttachment(middle, 0);
fdTargetFile.top = new FormAttachment(wUploadFile, margin);
fdTargetFile.right = new FormAttachment(wbTargetFile, -margin);
wTargetFile.setLayoutData(fdTargetFile);
wbTargetFile.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wTargetFile, variables, new String[] { "*" }, FILETYPES, true));
// Append line
wlAppend = new Label(wTargetFileGroup, SWT.RIGHT);
wlAppend.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileAppend.Label"));
props.setLook(wlAppend);
FormData fdlAppend = new FormData();
fdlAppend.left = new FormAttachment(0, 0);
fdlAppend.top = new FormAttachment(wTargetFile, margin);
fdlAppend.right = new FormAttachment(middle, -margin);
wlAppend.setLayoutData(fdlAppend);
wAppend = new Button(wTargetFileGroup, SWT.CHECK);
props.setLook(wAppend);
wAppend.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileAppend.Tooltip"));
FormData fdAppend = new FormData();
fdAppend.left = new FormAttachment(middle, 0);
fdAppend.top = new FormAttachment(wlAppend, 0, SWT.CENTER);
fdAppend.right = new FormAttachment(100, 0);
wAppend.setLayoutData(fdAppend);
// DateTimeAdded line
wlDateTimeAdded = new Label(wTargetFileGroup, SWT.RIGHT);
wlDateTimeAdded.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFilenameAddDate.Label"));
props.setLook(wlDateTimeAdded);
FormData fdlDateTimeAdded = new FormData();
fdlDateTimeAdded.left = new FormAttachment(0, 0);
fdlDateTimeAdded.top = new FormAttachment(wlAppend, 2 * margin);
fdlDateTimeAdded.right = new FormAttachment(middle, -margin);
wlDateTimeAdded.setLayoutData(fdlDateTimeAdded);
wDateTimeAdded = new Button(wTargetFileGroup, SWT.CHECK);
props.setLook(wDateTimeAdded);
wDateTimeAdded.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFilenameAddDate.Tooltip"));
FormData fdDateTimeAdded = new FormData();
fdDateTimeAdded.left = new FormAttachment(middle, 0);
fdDateTimeAdded.top = new FormAttachment(wlDateTimeAdded, 0, SWT.CENTER);
fdDateTimeAdded.right = new FormAttachment(100, 0);
wDateTimeAdded.setLayoutData(fdDateTimeAdded);
wDateTimeAdded.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setFlags();
}
});
// TargetExt line
wlTargetExt = new Label(wTargetFileGroup, SWT.RIGHT);
wlTargetExt.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileExt.Label"));
props.setLook(wlTargetExt);
FormData fdlTargetExt = new FormData();
fdlTargetExt.left = new FormAttachment(0, 0);
fdlTargetExt.top = new FormAttachment(wlDateTimeAdded, 2 * margin);
fdlTargetExt.right = new FormAttachment(middle, -margin);
wlTargetExt.setLayoutData(fdlTargetExt);
wTargetExt = new TextVar(variables, wTargetFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTargetExt);
wTargetExt.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileExt.Tooltip"));
wTargetExt.addModifyListener(lsMod);
FormData fdTargetExt = new FormData();
fdTargetExt.left = new FormAttachment(middle, 0);
fdTargetExt.top = new FormAttachment(wlTargetExt, 0, SWT.CENTER);
fdTargetExt.right = new FormAttachment(100, 0);
wTargetExt.setLayoutData(fdTargetExt);
// Add filenames to result filenames...
Label wlAddFilenameToResult = new Label(wTargetFileGroup, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "ActionHTTP.AddFilenameToResult.Label"));
props.setLook(wlAddFilenameToResult);
FormData fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wTargetExt, margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wTargetFileGroup, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.AddFilenameToResult.Tooltip"));
props.setLook(wAddFilenameToResult);
FormData fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, 0);
fdAddFilenameToResult.top = new FormAttachment(wlAddFilenameToResult, 0, SWT.CENTER);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
FormData fdTargetFileGroup = new FormData();
fdTargetFileGroup.left = new FormAttachment(0, margin);
fdTargetFileGroup.top = new FormAttachment(wUpLoadFile, margin);
fdTargetFileGroup.right = new FormAttachment(100, -margin);
wTargetFileGroup.setLayoutData(fdTargetFileGroup);
// ///////////////////////////////////////////////////////////
// / END OF TargetFileGroupGROUP GROUP
// ///////////////////////////////////////////////////////////
FormData fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wName, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Headers TAB ///
// ////////////////////////
CTabItem wHeadersTab = new CTabItem(wTabFolder, SWT.NONE);
wHeadersTab.setText(BaseMessages.getString(PKG, "ActionHTTP.Tab.Headers.Label"));
Composite wHeadersComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wHeadersComp);
FormLayout headersLayout = new FormLayout();
headersLayout.marginWidth = 3;
headersLayout.marginHeight = 3;
wHeadersComp.setLayout(headersLayout);
int rows = action.getHeaderName() == null ? 1 : (action.getHeaderName().length == 0 ? 0 : action.getHeaderName().length);
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ActionHTTP.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, HttpProtocol.getRequestHeaders(), false), new ColumnInfo(BaseMessages.getString(PKG, "ActionHTTP.ColumnInfo.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[0].setUsingVariables(true);
colinf[1].setUsingVariables(true);
wHeaders = new TableView(variables, wHeadersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, rows, lsMod, props);
FormData fdHeaders = new FormData();
fdHeaders.left = new FormAttachment(0, margin);
fdHeaders.top = new FormAttachment(wName, margin);
fdHeaders.right = new FormAttachment(100, -margin);
fdHeaders.bottom = new FormAttachment(100, -margin);
wHeaders.setLayoutData(fdHeaders);
FormData fdHeadersComp = new FormData();
fdHeadersComp.left = new FormAttachment(0, 0);
fdHeadersComp.top = new FormAttachment(0, 0);
fdHeadersComp.right = new FormAttachment(100, 0);
fdHeadersComp.bottom = new FormAttachment(100, 0);
wHeadersComp.setLayoutData(fdHeadersComp);
wHeadersComp.layout();
wHeadersTab.setControl(wHeadersComp);
// ///////////////////////////////////////////////////////////
// / END OF Headers TAB
// ///////////////////////////////////////////////////////////
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
wTabFolder.setLayoutData(fdTabFolder);
getData();
wTabFolder.setSelection(0);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return action;
}
use of org.apache.hop.core.Props in project hop by apache.
the class DatabaseJoinDialog method open.
@Override
public String open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = e -> input.setChanged();
backupChanged = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = props.getMargin();
// TransformName line
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.TransformName.Label"));
props.setLook(wlTransformName);
fdlTransformName = new FormData();
fdlTransformName.left = new FormAttachment(0, 0);
fdlTransformName.right = new FormAttachment(middle, -margin);
fdlTransformName.top = new FormAttachment(0, margin);
wlTransformName.setLayoutData(fdlTransformName);
wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wTransformName.setText(transformName);
props.setLook(wTransformName);
wTransformName.addModifyListener(lsMod);
fdTransformName = new FormData();
fdTransformName.left = new FormAttachment(middle, 0);
fdTransformName.top = new FormAttachment(0, margin);
fdTransformName.right = new FormAttachment(100, 0);
wTransformName.setLayoutData(fdTransformName);
// Connection line
DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
wConnection = addConnectionLine(shell, wTransformName, databaseMeta, lsMod);
// SQL editor...
Label wlSql = new Label(shell, SWT.NONE);
wlSql.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.SQL.Label"));
props.setLook(wlSql);
FormData fdlSql = new FormData();
fdlSql.left = new FormAttachment(0, 0);
fdlSql.top = new FormAttachment(wConnection, margin * 2);
wlSql.setLayoutData(fdlSql);
wSql = new StyledTextComp(variables, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
props.setLook(wSql, Props.WIDGET_STYLE_FIXED);
wSql.addModifyListener(lsMod);
FormData fdSql = new FormData();
fdSql.left = new FormAttachment(0, 0);
fdSql.top = new FormAttachment(wlSql, margin);
fdSql.right = new FormAttachment(100, -2 * margin);
fdSql.bottom = new FormAttachment(60, 0);
wSql.setLayoutData(fdSql);
wSql.addModifyListener(arg0 -> setPosition());
wSql.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wSql.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wSql.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
wlPosition = new Label(shell, SWT.NONE);
props.setLook(wlPosition);
FormData fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(0, 0);
fdlPosition.top = new FormAttachment(wSql, margin);
fdlPosition.right = new FormAttachment(100, 0);
wlPosition.setLayoutData(fdlPosition);
// Limit the number of lines returns
Label wlLimit = new Label(shell, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Limit.Label"));
props.setLook(wlLimit);
FormData fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.right = new FormAttachment(middle, -margin);
fdlLimit.top = new FormAttachment(wlPosition, margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
FormData fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.right = new FormAttachment(100, 0);
fdLimit.top = new FormAttachment(wlPosition, margin);
wLimit.setLayoutData(fdLimit);
// Outer join?
Label wlOuter = new Label(shell, SWT.RIGHT);
wlOuter.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Outerjoin.Label"));
wlOuter.setToolTipText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Outerjoin.Tooltip"));
props.setLook(wlOuter);
FormData fdlOuter = new FormData();
fdlOuter.left = new FormAttachment(0, 0);
fdlOuter.right = new FormAttachment(middle, -margin);
fdlOuter.top = new FormAttachment(wLimit, margin);
wlOuter.setLayoutData(fdlOuter);
wOuter = new Button(shell, SWT.CHECK);
props.setLook(wOuter);
wOuter.setToolTipText(wlOuter.getToolTipText());
FormData fdOuter = new FormData();
fdOuter.left = new FormAttachment(middle, 0);
fdOuter.top = new FormAttachment(wlOuter, 0, SWT.CENTER);
wOuter.setLayoutData(fdOuter);
wOuter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// useVars ?
Label wluseVars = new Label(shell, SWT.RIGHT);
wluseVars.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.useVarsjoin.Label"));
wluseVars.setToolTipText(BaseMessages.getString(PKG, "DatabaseJoinDialog.useVarsjoin.Tooltip"));
props.setLook(wluseVars);
FormData fdluseVars = new FormData();
fdluseVars.left = new FormAttachment(0, 0);
fdluseVars.right = new FormAttachment(middle, -margin);
fdluseVars.top = new FormAttachment(wOuter, margin);
wluseVars.setLayoutData(fdluseVars);
wUseVars = new Button(shell, SWT.CHECK);
props.setLook(wUseVars);
wUseVars.setToolTipText(wluseVars.getToolTipText());
FormData fduseVars = new FormData();
fduseVars.left = new FormAttachment(middle, 0);
fduseVars.top = new FormAttachment(wluseVars, 0, SWT.CENTER);
wUseVars.setLayoutData(fduseVars);
wUseVars.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// THE BUTTONS
wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
Button wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.GetFields.Button"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOk, wGet, wCancel }, margin, null);
// The parameters
Label wlParam = new Label(shell, SWT.NONE);
wlParam.setText(BaseMessages.getString(PKG, "DatabaseJoinDialog.Param.Label"));
props.setLook(wlParam);
FormData fdlParam = new FormData();
fdlParam.left = new FormAttachment(0, 0);
fdlParam.top = new FormAttachment(wUseVars, margin);
wlParam.setLayoutData(fdlParam);
int nrKeyCols = 2;
int nrKeyRows = (input.getParameters() != null ? input.getParameters().size() : 1);
ciKey = new ColumnInfo[nrKeyCols];
ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseJoinDialog.ColumnInfo.ParameterFieldname"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[1] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseJoinDialog.ColumnInfo.ParameterType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames());
wParam = new TableView(variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
FormData fdParam = new FormData();
fdParam.left = new FormAttachment(0, 0);
fdParam.top = new FormAttachment(wlParam, margin);
fdParam.right = new FormAttachment(100, 0);
fdParam.bottom = new FormAttachment(wOk, -2 * margin);
wParam.setLayoutData(fdParam);
//
// Search the fields in the background
final Runnable runnable = () -> {
TransformMeta transformMeta = pipelineMeta.findTransform(transformName);
if (transformMeta != null) {
try {
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), i);
}
setComboBoxes();
} catch (HopException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
};
new Thread(runnable).start();
// Add listeners
wOk.addListener(SWT.Selection, e -> ok());
wGet.addListener(SWT.Selection, e -> get());
wCancel.addListener(SWT.Selection, e -> cancel());
getData();
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformName;
}
use of org.apache.hop.core.Props in project hop by apache.
the class JsonOutputDialog method open.
@Override
public String open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = 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, "JsonOutputDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName"));
props.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);
props.setLook(wTransformName);
wTransformName.addModifyListener(lsMod);
fdTransformName = new FormData();
fdTransformName.left = new FormAttachment(middle, 0);
fdTransformName.top = new FormAttachment(0, margin);
fdTransformName.right = new FormAttachment(100, 0);
wTransformName.setLayoutData(fdTransformName);
// Buttons at the bottom
//
wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOk.addListener(SWT.Selection, e -> ok());
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
setButtonPositions(new Button[] { wOk, wCancel }, margin, null);
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF General TAB///
// /
CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JsonOutputDialog.GeneralTab.TabTitle"));
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 20;
Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
wGeneralComp.setLayout(generalLayout);
// Operation
wlOperation = new Label(wGeneralComp, SWT.RIGHT);
wlOperation.setText(BaseMessages.getString(PKG, "JsonOutputDialog.Operation.Label"));
props.setLook(wlOperation);
FormData fdlOperation = new FormData();
fdlOperation.left = new FormAttachment(0, 0);
fdlOperation.right = new FormAttachment(middle, -margin);
fdlOperation.top = new FormAttachment(wlBlocName, margin);
wlOperation.setLayoutData(fdlOperation);
wOperation = new CCombo(wGeneralComp, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wOperation);
wOperation.addModifyListener(lsMod);
FormData fdOperation = new FormData();
fdOperation.left = new FormAttachment(middle, 0);
fdOperation.top = new FormAttachment(wlBlocName, margin);
fdOperation.right = new FormAttachment(100, -margin);
wOperation.setLayoutData(fdOperation);
wOperation.setItems(JsonOutputMeta.operationTypeDesc);
wOperation.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateOperation();
}
});
createSettingsGroup(lsMod, middle, margin, wGeneralComp);
createFilenameGroup(lsMod, middle, margin, wGeneralComp);
FormData fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wTransformName, margin);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF General TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// START OF Key Configuration TAB///
// ///////////////////////////////////////////////////////////
CTabItem wKeyConfigTab = new CTabItem(wTabFolder, SWT.NONE);
wKeyConfigTab.setText(BaseMessages.getString(PKG, "JsonOutputDialog.KeyConfigTab.TabTitle"));
FormLayout keyConfigLayout = new FormLayout();
keyConfigLayout.marginWidth = 3;
keyConfigLayout.marginHeight = 3;
Composite wKeyConfigComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wKeyConfigComp);
final int keyFieldsRows = input.getKeyFields().length;
keyColInf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JsonOutputDialog.Fieldname.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "JsonOutputDialog.ElementName.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
keyColInf[1].setUsingVariables(true);
wKeyFields = new TableView(variables, wKeyConfigComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, keyColInf, keyFieldsRows, lsMod, props);
FormData fdKeyFields = new FormData();
fdKeyFields.left = new FormAttachment(0, 0);
fdKeyFields.top = new FormAttachment(0, 0);
fdKeyFields.right = new FormAttachment(100, 0);
fdKeyFields.bottom = new FormAttachment(100, 0);
wKeyFields.setLayoutData(fdKeyFields);
wKeyConfigComp.setLayout(keyConfigLayout);
wKeyConfigComp.layout();
wKeyConfigTab.setControl(wKeyConfigComp);
// ///////////////////////////////////////////////////////////
// END OF Key Configuration TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Fields tab...
// ///////////////////////////////////////////////////////////
CTabItem wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "JsonOutputDialog.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, "JsonOutputDialog.Get.Button"));
wGet.setToolTipText(BaseMessages.getString(PKG, "JsonOutputDialog.Get.Tooltip"));
setButtonPositions(new Button[] { wGet }, margin, null);
final int fieldsRows = input.getOutputFields().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JsonOutputDialog.Fieldname.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "JsonOutputDialog.ElementName.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JsonOutputDialog.JSONFragment.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true), new ColumnInfo(BaseMessages.getString(PKG, "JsonOutputDialog.RemoveIfBlank.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
colinf[1].setUsingVariables(true);
wFields = new TableView(variables, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, fieldsRows, lsMod, 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);
// ///////////////////////////////////////////////////////////
// START OF Additional Fields Configuration TAB///
// ///////////////////////////////////////////////////////////
CTabItem wAdditionalFieldsConfigTab = new CTabItem(wTabFolder, SWT.NONE);
wAdditionalFieldsConfigTab.setText(BaseMessages.getString(PKG, "JsonOutputDialog.AdditionalFieldsConfigTab.TabTitle"));
FormLayout additionalFieldsConfigLayout = new FormLayout();
additionalFieldsConfigLayout.marginWidth = 3;
additionalFieldsConfigLayout.marginHeight = 3;
Composite wAdditionalFieldsConfigComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdditionalFieldsConfigComp);
// JSON Size field
Label wlJSONSizeFieldname = new Label(wAdditionalFieldsConfigComp, SWT.RIGHT);
wlJSONSizeFieldname.setText(BaseMessages.getString(PKG, "JsonOutputDialog.JSONSize.Label"));
props.setLook(wlJSONSizeFieldname);
FormData fdlJSONSizeFieldname = new FormData();
fdlJSONSizeFieldname.left = new FormAttachment(0, 0);
fdlJSONSizeFieldname.right = new FormAttachment(middle, -margin);
fdlJSONSizeFieldname.top = new FormAttachment(wlBlocName, margin);
wlJSONSizeFieldname.setLayoutData(fdlJSONSizeFieldname);
wJSONSizeFieldname = new TextVar(variables, wAdditionalFieldsConfigComp, SWT.BORDER | SWT.READ_ONLY);
wJSONSizeFieldname.setEditable(true);
props.setLook(wJSONSizeFieldname);
wJSONSizeFieldname.addModifyListener(lsMod);
FormData fdJSONSizeFieldname = new FormData();
fdJSONSizeFieldname.left = new FormAttachment(middle, 0);
fdJSONSizeFieldname.top = new FormAttachment(wBlocName, margin);
fdJSONSizeFieldname.right = new FormAttachment(100, 0);
wJSONSizeFieldname.setLayoutData(fdJSONSizeFieldname);
wAdditionalFieldsConfigComp.setLayout(additionalFieldsConfigLayout);
wAdditionalFieldsConfigComp.layout();
wAdditionalFieldsConfigTab.setControl(wAdditionalFieldsConfigComp);
// ///////////////////////////////////////////////////////////
// END OF Additional Fields Configuration TAB
// ///////////////////////////////////////////////////////////
//
// Search the fields in the background
final Runnable runnable = () -> {
TransformMeta transformMeta = pipelineMeta.findTransform(transformName);
if (transformMeta != null) {
try {
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setFieldListComboBoxes();
} catch (HopException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
};
new Thread(runnable).start();
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);
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);
wGet.addListener(SWT.Selection, e -> get());
lsResize = 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);
getData();
updateOperation();
input.setChanged(changed);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformName;
}
use of org.apache.hop.core.Props in project hop by apache.
the class SalesforceInputDialog method open.
@Override
public String open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = e -> input.setChanged();
SelectionListener checkBoxModifyListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent 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, "SalesforceInputDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// TransformName line
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG, "System.Label.TransformName"));
props.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);
props.setLook(wTransformName);
wTransformName.addModifyListener(lsMod);
fdTransformName = new FormData();
fdTransformName.left = new FormAttachment(middle, 0);
fdTransformName.top = new FormAttachment(0, margin);
fdTransformName.right = new FormAttachment(100, 0);
wTransformName.setLayoutData(fdTransformName);
// THE 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, "SalesforceInputDialog.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);
// The tabfolder in between the name and the buttons...
//
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
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);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
CTabItem wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.File.Tab"));
Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
// ////////////////////////
// START CONNECTION GROUP
Group wConnectionGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ConnectionGroup.Label"));
FormLayout fconnLayout = new FormLayout();
fconnLayout.marginWidth = 3;
fconnLayout.marginHeight = 3;
wConnectionGroup.setLayout(fconnLayout);
props.setLook(wConnectionGroup);
// Webservice URL
wURL = new LabelTextVar(variables, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
FormData fdURL = new FormData();
fdURL.left = new FormAttachment(0, 0);
fdURL.top = new FormAttachment(0, margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// UserName line
wUserName = new LabelTextVar(variables, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
FormData fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wURL, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(variables, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test Salesforce connection button
Button wTest = new Button(wConnectionGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Label"));
props.setLook(wTest);
FormData fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
FormData fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, 0);
fdConnectionGroup.right = new FormAttachment(100, 0);
fdConnectionGroup.top = new FormAttachment(0, margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// END CONNECTION GROUP
// ////////////////////////
// ////////////////////////
// START SETTINGS GROUP
Group wSettingsGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.HttpAuthGroup.Label"));
FormLayout fsettingsLayout = new FormLayout();
fsettingsLayout.marginWidth = 3;
fsettingsLayout.marginHeight = 3;
wSettingsGroup.setLayout(fsettingsLayout);
props.setLook(wSettingsGroup);
Label wlSpecifyQuery = new Label(wSettingsGroup, SWT.RIGHT);
wlSpecifyQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Label"));
props.setLook(wlSpecifyQuery);
FormData fdlSpecifyQuery = new FormData();
fdlSpecifyQuery.left = new FormAttachment(0, 0);
fdlSpecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
fdlSpecifyQuery.right = new FormAttachment(middle, -margin);
wlSpecifyQuery.setLayoutData(fdlSpecifyQuery);
wSpecifyQuery = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wSpecifyQuery);
wSpecifyQuery.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Tooltip"));
FormData fdSpecifyQuery = new FormData();
fdSpecifyQuery.left = new FormAttachment(middle, 0);
fdSpecifyQuery.top = new FormAttachment(wlSpecifyQuery, 0, SWT.CENTER);
wSpecifyQuery.setLayoutData(fdSpecifyQuery);
wSpecifyQuery.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableQuery();
input.setChanged();
}
});
// Module
wlModule = new Label(wSettingsGroup, SWT.RIGHT);
wlModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Module.Label"));
props.setLook(wlModule);
FormData fdlModule = new FormData();
fdlModule.left = new FormAttachment(0, 0);
fdlModule.top = new FormAttachment(wlSpecifyQuery, 2 * margin);
fdlModule.right = new FormAttachment(middle, -margin);
wlModule.setLayoutData(fdlModule);
wModule = new ComboVar(variables, wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
wModule.setEditable(true);
props.setLook(wModule);
wModule.addModifyListener(lsMod);
FormData fdModule = new FormData();
fdModule.left = new FormAttachment(middle, margin);
fdModule.top = new FormAttachment(wlModule, 0, SWT.CENTER);
fdModule.right = new FormAttachment(100, -margin);
wModule.setLayoutData(fdModule);
wModule.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
getModulesListError = false;
}
@Override
public void focusGained(FocusEvent e) {
// check if the URL and login credentials passed and not just had error
if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
return;
}
getModulesList();
}
});
wlPosition = new Label(wSettingsGroup, SWT.NONE);
props.setLook(wlPosition);
FormData fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(middle, 0);
fdlPosition.right = new FormAttachment(100, 0);
fdlPosition.bottom = new FormAttachment(100, -margin);
wlPosition.setLayoutData(fdlPosition);
// condition
wlCondition = new Label(wSettingsGroup, SWT.RIGHT);
wlCondition.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Label"));
props.setLook(wlCondition);
FormData fdlCondition = new FormData();
fdlCondition.left = new FormAttachment(0, -margin);
fdlCondition.top = new FormAttachment(wModule, margin);
fdlCondition.right = new FormAttachment(middle, -margin);
wlCondition.setLayoutData(fdlCondition);
wCondition = new StyledTextComp(variables, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
wCondition.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Tooltip"));
props.setLook(wCondition, Props.WIDGET_STYLE_FIXED);
wCondition.addModifyListener(lsMod);
FormData fdCondition = new FormData();
fdCondition.left = new FormAttachment(middle, margin);
fdCondition.top = new FormAttachment(wModule, margin);
fdCondition.right = new FormAttachment(100, -margin);
fdCondition.bottom = new FormAttachment(wlPosition, -margin);
wCondition.setLayoutData(fdCondition);
wCondition.addModifyListener(e -> {
setQueryToolTip();
setPosition();
});
wCondition.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wCondition.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wCondition.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Query
wlQuery = new Label(wSettingsGroup, SWT.RIGHT);
wlQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Query.Label"));
props.setLook(wlQuery);
FormData fdlQuery = new FormData();
fdlQuery.left = new FormAttachment(0, -margin);
fdlQuery.top = new FormAttachment(wlSpecifyQuery, 2 * margin);
fdlQuery.right = new FormAttachment(middle, -margin);
wlQuery.setLayoutData(fdlQuery);
wQuery = new StyledTextComp(variables, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
props.setLook(wQuery, Props.WIDGET_STYLE_FIXED);
wQuery.addModifyListener(lsMod);
FormData fdQuery = new FormData();
fdQuery.left = new FormAttachment(middle, 0);
fdQuery.top = new FormAttachment(wlSpecifyQuery, 2 * margin);
fdQuery.right = new FormAttachment(100, -margin);
fdQuery.bottom = new FormAttachment(wlPosition, -margin);
wQuery.setLayoutData(fdQuery);
wQuery.addModifyListener(arg0 -> setQueryToolTip());
wQuery.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wQuery.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wQuery.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
FormData fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, 0);
fdSettingsGroup.right = new FormAttachment(100, 0);
fdSettingsGroup.bottom = new FormAttachment(100, 0);
fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// END SETTINGS GROUP
// ////////////////////////
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
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
CTabItem wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Content.Tab"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// ///////////////////////////////
// START OF Advanced GROUP //
// ///////////////////////////////
Group wAdvancedGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedGroup);
wAdvancedGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.AdvancedGroup.Label"));
FormLayout advancedgroupLayout = new FormLayout();
advancedgroupLayout.marginWidth = 10;
advancedgroupLayout.marginHeight = 10;
wAdvancedGroup.setLayout(advancedgroupLayout);
// RecordsFilter
wlRecordsFilter = new Label(wAdvancedGroup, SWT.RIGHT);
wlRecordsFilter.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.RecordsFilter.Label"));
props.setLook(wlRecordsFilter);
FormData fdlRecordsFilter = new FormData();
fdlRecordsFilter.left = new FormAttachment(0, 0);
fdlRecordsFilter.right = new FormAttachment(middle, -margin);
fdlRecordsFilter.top = new FormAttachment(0, 2 * margin);
wlRecordsFilter.setLayoutData(fdlRecordsFilter);
wRecordsFilter = new CCombo(wAdvancedGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wRecordsFilter);
wRecordsFilter.addModifyListener(lsMod);
FormData fdRecordsFilter = new FormData();
fdRecordsFilter.left = new FormAttachment(middle, 0);
fdRecordsFilter.top = new FormAttachment(0, 2 * margin);
fdRecordsFilter.right = new FormAttachment(100, -margin);
wRecordsFilter.setLayoutData(fdRecordsFilter);
wRecordsFilter.setItems(SalesforceConnectionUtils.recordsFilterDesc);
wRecordsFilter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateRecordsFilter();
}
});
// Query All?
wlQueryAll = new Label(wAdvancedGroup, SWT.RIGHT);
wlQueryAll.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Label"));
props.setLook(wlQueryAll);
FormData fdlQueryAll = new FormData();
fdlQueryAll.left = new FormAttachment(0, 0);
fdlQueryAll.top = new FormAttachment(wRecordsFilter, margin);
fdlQueryAll.right = new FormAttachment(middle, -margin);
wlQueryAll.setLayoutData(fdlQueryAll);
wQueryAll = new Button(wAdvancedGroup, SWT.CHECK);
wQueryAll.addSelectionListener(checkBoxModifyListener);
props.setLook(wQueryAll);
wQueryAll.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Tooltip"));
FormData fdQueryAll = new FormData();
fdQueryAll.left = new FormAttachment(middle, 0);
fdQueryAll.top = new FormAttachment(wlQueryAll, 0, SWT.CENTER);
wQueryAll.setLayoutData(fdQueryAll);
wQueryAll.addSelectionListener(new ComponentSelectionListener(input));
open = new Button(wAdvancedGroup, SWT.PUSH);
open.setImage(GuiResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wQueryAll, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
dialog.setImage(GuiResource.getInstance().getImageHop());
dialog.setLayout(new GridLayout(3, false));
final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
new Label(dialog, SWT.NONE);
new Label(dialog, SWT.NONE);
Button ok = new Button(dialog, SWT.PUSH);
ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
ok.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wReadFrom.setText(calendar.getYear() + "-" + ((calendar.getMonth() + 1) < 10 ? "0" + (calendar.getMonth() + 1) : (calendar.getMonth() + 1)) + "-" + (calendar.getDay() < 10 ? "0" + calendar.getDay() : calendar.getDay()) + " " + (time.getHours() < 10 ? "0" + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wAdvancedGroup, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Label"));
props.setLook(wlReadFrom);
FormData fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wQueryAll, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(variables, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
FormData fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wQueryAll, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wAdvancedGroup, SWT.PUSH);
opento.setImage(GuiResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
FormData fdlButtonto = new FormData();
fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
fdlButtonto.right = new FormAttachment(100, 0);
opento.setLayoutData(fdlButtonto);
opento.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
dialogto.setImage(GuiResource.getInstance().getImageHop());
dialogto.setLayout(new GridLayout(3, false));
final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
new Label(dialogto, SWT.NONE);
new Label(dialogto, SWT.NONE);
Button okto = new Button(dialogto, SWT.PUSH);
okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
okto.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wReadTo.setText(calendarto.getYear() + "-" + ((calendarto.getMonth() + 1) < 10 ? "0" + (calendarto.getMonth() + 1) : (calendarto.getMonth() + 1)) + "-" + (calendarto.getDay() < 10 ? "0" + calendarto.getDay() : calendarto.getDay()) + " " + (timeto.getHours() < 10 ? "0" + timeto.getHours() : timeto.getHours()) + ":" + (timeto.getMinutes() < 10 ? "0" + timeto.getMinutes() : timeto.getMinutes()) + ":" + (timeto.getSeconds() < 10 ? "0" + timeto.getSeconds() : timeto.getSeconds()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wAdvancedGroup, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Label"));
props.setLook(wlReadTo);
FormData fdlReadTo = new FormData();
fdlReadTo.left = new FormAttachment(0, 0);
fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdlReadTo.right = new FormAttachment(middle, -margin);
wlReadTo.setLayoutData(fdlReadTo);
wReadTo = new TextVar(variables, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Tooltip"));
props.setLook(wReadTo);
wReadTo.addModifyListener(lsMod);
FormData fdReadTo = new FormData();
fdReadTo.left = new FormAttachment(middle, 0);
fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdReadTo.right = new FormAttachment(opento, -margin);
wReadTo.setLayoutData(fdReadTo);
FormData fdAdvancedGroup = new FormData();
fdAdvancedGroup.left = new FormAttachment(0, margin);
fdAdvancedGroup.top = new FormAttachment(0, 2 * margin);
fdAdvancedGroup.right = new FormAttachment(100, -margin);
wAdvancedGroup.setLayoutData(fdAdvancedGroup);
// ///////////////////////////////////////////////////////////
// / END OF Advanced GROUP
// ///////////////////////////////////////////////////////////
// ///////////////////////////////
// START OF Additional Fields GROUP //
// ///////////////////////////////
Group wAdditionalFields = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdditionalFields);
wAdditionalFields.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.wAdditionalFields.Label"));
FormLayout additionalFieldsgroupLayout = new FormLayout();
additionalFieldsgroupLayout.marginWidth = 10;
additionalFieldsgroupLayout.marginHeight = 10;
wAdditionalFields.setLayout(additionalFieldsgroupLayout);
// Add Salesforce URL in the output stream ?
Label wlInclURL = new Label(wAdditionalFields, SWT.RIGHT);
wlInclURL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Label"));
props.setLook(wlInclURL);
FormData fdlInclURL = new FormData();
fdlInclURL.left = new FormAttachment(0, 0);
fdlInclURL.top = new FormAttachment(wAdvancedGroup, margin);
fdlInclURL.right = new FormAttachment(middle, -margin);
wlInclURL.setLayoutData(fdlInclURL);
wInclURL = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclURL);
wInclURL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Tooltip"));
FormData fdInclURL = new FormData();
fdInclURL.left = new FormAttachment(middle, 0);
fdInclURL.top = new FormAttachment(wlInclURL, 0, SWT.CENTER);
wInclURL.setLayoutData(fdInclURL);
wInclURL.addSelectionListener(checkBoxModifyListener);
wInclURL.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclTargetURL();
input.setChanged();
}
});
wlInclURLField = new Label(wAdditionalFields, SWT.LEFT);
wlInclURLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURLField.Label"));
props.setLook(wlInclURLField);
FormData fdlInclURLField = new FormData();
fdlInclURLField.left = new FormAttachment(wInclURL, margin);
fdlInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
wlInclURLField.setLayoutData(fdlInclURLField);
wInclURLField = new TextVar(variables, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclURLField);
wInclURLField.addModifyListener(lsMod);
FormData fdInclURLField = new FormData();
fdInclURLField.left = new FormAttachment(wlInclURLField, margin);
fdInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
fdInclURLField.right = new FormAttachment(100, 0);
wInclURLField.setLayoutData(fdInclURLField);
// Add module in the output stream ?
wlInclModule = new Label(wAdditionalFields, SWT.RIGHT);
wlInclModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Label"));
props.setLook(wlInclModule);
FormData fdlInclModule = new FormData();
fdlInclModule.left = new FormAttachment(0, 0);
fdlInclModule.top = new FormAttachment(wInclURLField, margin);
fdlInclModule.right = new FormAttachment(middle, -margin);
wlInclModule.setLayoutData(fdlInclModule);
wInclModule = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclModule);
wInclModule.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Tooltip"));
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, 0);
fdModule.top = new FormAttachment(wlInclModule, 0, SWT.CENTER);
wInclModule.setLayoutData(fdModule);
wInclModule.addSelectionListener(checkBoxModifyListener);
wInclModule.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclModule();
input.setChanged();
}
});
wlInclModuleField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclModuleField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModuleField.Label"));
props.setLook(wlInclModuleField);
FormData fdlInclModuleField = new FormData();
fdlInclModuleField.left = new FormAttachment(wInclModule, margin);
fdlInclModuleField.top = new FormAttachment(wInclURLField, margin);
wlInclModuleField.setLayoutData(fdlInclModuleField);
wInclModuleField = new TextVar(variables, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclModuleField);
wInclModuleField.addModifyListener(lsMod);
FormData fdInclModuleField = new FormData();
fdInclModuleField.left = new FormAttachment(wlInclModuleField, margin);
fdInclModuleField.top = new FormAttachment(wInclURLField, margin);
fdInclModuleField.right = new FormAttachment(100, 0);
wInclModuleField.setLayoutData(fdInclModuleField);
// Add SQL in the output stream ?
Label wlInclSQL = new Label(wAdditionalFields, SWT.RIGHT);
wlInclSQL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Label"));
props.setLook(wlInclSQL);
FormData fdlInclSQL = new FormData();
fdlInclSQL.left = new FormAttachment(0, 0);
fdlInclSQL.top = new FormAttachment(wInclModuleField, margin);
fdlInclSQL.right = new FormAttachment(middle, -margin);
wlInclSQL.setLayoutData(fdlInclSQL);
wInclSQL = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclSQL);
wInclSQL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Tooltip"));
FormData fdInclSQL = new FormData();
fdInclSQL.left = new FormAttachment(middle, 0);
fdInclSQL.top = new FormAttachment(wlInclSQL, 0, SWT.CENTER);
wInclSQL.setLayoutData(fdInclSQL);
wInclSQL.addSelectionListener(checkBoxModifyListener);
wInclSQL.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclSQL();
input.setChanged();
}
});
wlInclSQLField = new Label(wAdditionalFields, SWT.LEFT);
wlInclSQLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQLField.Label"));
props.setLook(wlInclSQLField);
FormData fdlInclSQLField = new FormData();
fdlInclSQLField.left = new FormAttachment(wInclSQL, margin);
fdlInclSQLField.top = new FormAttachment(wInclModuleField, margin);
wlInclSQLField.setLayoutData(fdlInclSQLField);
wInclSQLField = new TextVar(variables, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclSQLField);
wInclSQLField.addModifyListener(lsMod);
FormData fdInclSQLField = new FormData();
fdInclSQLField.left = new FormAttachment(wlInclSQLField, margin);
fdInclSQLField.top = new FormAttachment(wInclModuleField, margin);
fdInclSQLField.right = new FormAttachment(100, 0);
wInclSQLField.setLayoutData(fdInclSQLField);
// Add Timestamp in the output stream ?
Label wlInclTimestamp = new Label(wAdditionalFields, SWT.RIGHT);
wlInclTimestamp.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Label"));
props.setLook(wlInclTimestamp);
FormData fdlInclTimestamp = new FormData();
fdlInclTimestamp.left = new FormAttachment(0, 0);
fdlInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
fdlInclTimestamp.right = new FormAttachment(middle, -margin);
wlInclTimestamp.setLayoutData(fdlInclTimestamp);
wInclTimestamp = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclTimestamp);
wInclTimestamp.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Tooltip"));
FormData fdInclTimestamp = new FormData();
fdInclTimestamp.left = new FormAttachment(middle, 0);
fdInclTimestamp.top = new FormAttachment(wlInclTimestamp, 0, SWT.CENTER);
wInclTimestamp.setLayoutData(fdInclTimestamp);
wInclTimestamp.addSelectionListener(checkBoxModifyListener);
wInclTimestamp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclTimestamp();
input.setChanged();
}
});
wlInclTimestampField = new Label(wAdditionalFields, SWT.LEFT);
wlInclTimestampField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestampField.Label"));
props.setLook(wlInclTimestampField);
FormData fdlInclTimestampField = new FormData();
fdlInclTimestampField.left = new FormAttachment(wInclTimestamp, margin);
fdlInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
wlInclTimestampField.setLayoutData(fdlInclTimestampField);
wInclTimestampField = new TextVar(variables, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclTimestampField);
wInclTimestampField.addModifyListener(lsMod);
FormData fdInclTimestampField = new FormData();
fdInclTimestampField.left = new FormAttachment(wlInclTimestampField, margin);
fdInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
fdInclTimestampField.right = new FormAttachment(100, 0);
wInclTimestampField.setLayoutData(fdInclTimestampField);
// Include Rownum in output stream?
Label wlInclRownum = new Label(wAdditionalFields, SWT.RIGHT);
wlInclRownum.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Label"));
props.setLook(wlInclRownum);
FormData fdlInclRownum = new FormData();
fdlInclRownum.left = new FormAttachment(0, 0);
fdlInclRownum.top = new FormAttachment(wInclTimestampField, margin);
fdlInclRownum.right = new FormAttachment(middle, -margin);
wlInclRownum.setLayoutData(fdlInclRownum);
wInclRownum = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclRownum);
wInclRownum.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.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(checkBoxModifyListener);
wInclRownum.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclRownum();
input.setChanged();
}
});
wlInclRownumField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclRownumField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownumField.Label"));
props.setLook(wlInclRownumField);
FormData fdlInclRownumField = new FormData();
fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
fdlInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
wlInclRownumField.setLayoutData(fdlInclRownumField);
wInclRownumField = new TextVar(variables, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclRownumField);
wInclRownumField.addModifyListener(lsMod);
FormData fdInclRownumField = new FormData();
fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
fdInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
fdInclRownumField.right = new FormAttachment(100, 0);
wInclRownumField.setLayoutData(fdInclRownumField);
// Include DeletionDate in output stream?
wlInclDeletionDate = new Label(wAdditionalFields, SWT.RIGHT);
wlInclDeletionDate.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Label"));
props.setLook(wlInclDeletionDate);
FormData fdlInclDeletionDate = new FormData();
fdlInclDeletionDate.left = new FormAttachment(0, 0);
fdlInclDeletionDate.top = new FormAttachment(wInclRownumField, margin);
fdlInclDeletionDate.right = new FormAttachment(middle, -margin);
wlInclDeletionDate.setLayoutData(fdlInclDeletionDate);
wInclDeletionDate = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclDeletionDate);
wInclDeletionDate.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Tooltip"));
FormData fdDeletionDate = new FormData();
fdDeletionDate.left = new FormAttachment(middle, 0);
fdDeletionDate.top = new FormAttachment(wlInclDeletionDate, 0, SWT.CENTER);
wInclDeletionDate.setLayoutData(fdDeletionDate);
wInclDeletionDate.addSelectionListener(checkBoxModifyListener);
wInclDeletionDate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclDeletionDate();
input.setChanged();
}
});
wlInclDeletionDateField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclDeletionDateField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDateField.Label"));
props.setLook(wlInclDeletionDateField);
FormData fdlInclDeletionDateField = new FormData();
fdlInclDeletionDateField.left = new FormAttachment(wInclDeletionDate, margin);
fdlInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
wlInclDeletionDateField.setLayoutData(fdlInclDeletionDateField);
wInclDeletionDateField = new TextVar(variables, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclDeletionDateField);
wInclDeletionDateField.addModifyListener(lsMod);
FormData fdInclDeletionDateField = new FormData();
fdInclDeletionDateField.left = new FormAttachment(wlInclDeletionDateField, margin);
fdInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
fdInclDeletionDateField.right = new FormAttachment(100, 0);
wInclDeletionDateField.setLayoutData(fdInclDeletionDateField);
FormData fdAdditionalFields = new FormData();
fdAdditionalFields.left = new FormAttachment(0, margin);
fdAdditionalFields.top = new FormAttachment(wAdvancedGroup, margin);
fdAdditionalFields.right = new FormAttachment(100, -margin);
wAdditionalFields.setLayoutData(fdAdditionalFields);
// ///////////////////////////////////////////////////////////
// / END OF Additional Fields GROUP
// ///////////////////////////////////////////////////////////
// Timeout
Label wlTimeOut = new Label(wContentComp, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TimeOut.Label"));
props.setLook(wlTimeOut);
FormData fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
fdlTimeOut.right = new FormAttachment(middle, -margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(variables, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
FormData fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(middle, 0);
fdTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Use compression?
Label wlUseCompression = new Label(wContentComp, SWT.RIGHT);
wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Label"));
props.setLook(wlUseCompression);
FormData fdlUseCompression = new FormData();
fdlUseCompression.left = new FormAttachment(0, 0);
fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
fdlUseCompression.right = new FormAttachment(middle, -margin);
wlUseCompression.setLayoutData(fdlUseCompression);
wUseCompression = new Button(wContentComp, SWT.CHECK);
wUseCompression.addSelectionListener(checkBoxModifyListener);
props.setLook(wUseCompression);
wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Tooltip"));
FormData fdUseCompression = new FormData();
fdUseCompression.left = new FormAttachment(middle, 0);
fdUseCompression.top = new FormAttachment(wlUseCompression, 0, SWT.CENTER);
wUseCompression.setLayoutData(fdUseCompression);
wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
// Limit rows
Label wlLimit = new Label(wContentComp, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Limit.Label"));
props.setLook(wlLimit);
FormData fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wUseCompression, margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new TextVar(variables, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
FormData fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wUseCompression, margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
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.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Fields.Tab"));
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, "SalesforceInputDialog.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().length;
columns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.IsIdLookup.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 3), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, SalesforceInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
columns[0].setUsingVariables(true);
columns[0].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column.Tooltip"));
columns[1].setUsingVariables(true);
columns[1].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column.Tooltip"));
columns[2].setReadOnly(true);
wFields = new TableView(variables, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, columns, FieldsRows, lsMod, 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);
// Add listeners
wGet.addListener(SWT.Selection, e -> {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
get();
shell.setCursor(null);
busy.dispose();
input.setChanged();
});
wTest.addListener(SWT.Selection, e -> test());
wTabFolder.setSelection(0);
getData(input);
setEnableInclTargetURL();
setEnableInclSQL();
setEnableInclTimestamp();
setEnableInclModule();
setEnableInclRownum();
setEnableInclDeletionDate();
setEnableQuery();
input.setChanged(changed);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformName;
}
Aggregations