use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class RegexEvalDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
SelectionListener lsSel = new SelectionAdapter() {
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 = Const.MARGIN;
// Filename line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wSash = new SashForm(shell, SWT.VERTICAL);
wTabFolder = new CTabFolder(wSash, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "RegexEvalDialog.GeneralTab.TabTitle"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// Step Settings grouping?
// ////////////////////////
// START OF Step Settings GROUP
//
wStepSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wStepSettings);
wStepSettings.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Group.StepSettings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wStepSettings.setLayout(groupLayout);
// fieldevaluate
wlfieldevaluate = new Label(wStepSettings, SWT.RIGHT);
wlfieldevaluate.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Matcher.Label"));
props.setLook(wlfieldevaluate);
fdlfieldevaluate = new FormData();
fdlfieldevaluate.left = new FormAttachment(0, 0);
fdlfieldevaluate.top = new FormAttachment(wStepname, margin);
fdlfieldevaluate.right = new FormAttachment(middle, -margin);
wlfieldevaluate.setLayoutData(fdlfieldevaluate);
wfieldevaluate = new CCombo(wStepSettings, SWT.BORDER | SWT.READ_ONLY);
wfieldevaluate.setEditable(true);
props.setLook(wfieldevaluate);
wfieldevaluate.addModifyListener(lsMod);
fdfieldevaluate = new FormData();
fdfieldevaluate.left = new FormAttachment(middle, margin);
fdfieldevaluate.top = new FormAttachment(wStepname, margin);
fdfieldevaluate.right = new FormAttachment(100, -margin);
wfieldevaluate.setLayoutData(fdfieldevaluate);
wfieldevaluate.addSelectionListener(lsSel);
wfieldevaluate.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getPreviousFields();
shell.setCursor(null);
busy.dispose();
}
});
// Output Fieldame
wResultField = new LabelTextVar(transMeta, wStepSettings, BaseMessages.getString(PKG, "RegexEvalDialog.ResultField.Label"), BaseMessages.getString(PKG, "RegexEvalDialog.ResultField.Tooltip"));
props.setLook(wResultField);
wResultField.addModifyListener(lsMod);
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?
wlAllowCaptureGroups = new Label(wStepSettings, 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(wStepSettings, 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(wResultField, margin);
fdAllowCaptureGroups.right = new FormAttachment(100, 0);
wAllowCaptureGroups.setLayoutData(fdAllowCaptureGroups);
wAllowCaptureGroups.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setFieldsEnabledStatus();
input.setChanged();
}
});
// Replace fields?
wlReplaceFields = new Label(wStepSettings, 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(wStepSettings, 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(wAllowCaptureGroups, margin);
fdReplaceFields.right = new FormAttachment(100, 0);
wReplaceFields.setLayoutData(fdReplaceFields);
wReplaceFields.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// settings layout
fdStepSettings = new FormData();
fdStepSettings.left = new FormAttachment(0, margin);
fdStepSettings.top = new FormAttachment(wStepname, margin);
fdStepSettings.right = new FormAttachment(100, -margin);
wStepSettings.setLayoutData(fdStepSettings);
// ///////////////////////////////////////////////////////////
// / END OF STEP SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// Script line
wlScript = new Label(wGeneralComp, SWT.NONE);
wlScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.Javascript.Label"));
props.setLook(wlScript);
fdlScript = new FormData();
fdlScript.left = new FormAttachment(0, 0);
fdlScript.top = new FormAttachment(wStepSettings, margin);
wlScript.setLayoutData(fdlScript);
wbTestRegExScript = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestRegExScript);
wbTestRegExScript.setText(BaseMessages.getString(PKG, "RegexEvalDialog.TestScript.Label"));
fdbTestRegExScript = new FormData();
fdbTestRegExScript.right = new FormAttachment(100, -margin);
fdbTestRegExScript.top = new FormAttachment(wStepSettings, margin);
wbTestRegExScript.setLayoutData(fdbTestRegExScript);
wScript = new StyledTextComp(transMeta, 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);
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(100, -25);
wScript.setLayoutData(fdScript);
// SelectionAdapter lsVar = VariableButtonListenerFactory.getSelectionAdapter(shell, wScript);
// wScript.addKeyListener(TextVar.getControlSpaceKeyListener(wScript, lsVar));
// Variable substitution?
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.top = new FormAttachment(wScript, margin);
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(wScript, margin);
wUseVar.setLayoutData(fdUseVar);
wUseVar.addSelectionListener(lsSel);
wBottom = new Composite(wSash, SWT.NONE);
props.setLook(wBottom);
FormLayout bottomLayout = new FormLayout();
bottomLayout.marginWidth = Const.FORM_MARGIN;
bottomLayout.marginHeight = Const.FORM_MARGIN;
wBottom.setLayout(bottomLayout);
wSeparator = new Label(wBottom, SWT.SEPARATOR | SWT.HORIZONTAL);
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);
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(transMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columnInfo, fieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
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///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "RegexEvalDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// Step RegexSettings grouping?
// ////////////////////////
// START OF RegexSettings 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?
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(wStepSettings, 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(wStepSettings, margin);
fdCanonEq.right = new FormAttachment(100, 0);
wCanonEq.setLayoutData(fdCanonEq);
wCanonEq.addSelectionListener(lsSel);
// CASE_INSENSITIVE?
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(wCanonEq, margin);
fdCaseInsensitive.right = new FormAttachment(100, 0);
wCaseInsensitive.setLayoutData(fdCaseInsensitive);
wCaseInsensitive.addSelectionListener(lsSel);
// COMMENT?
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(wCaseInsensitive, margin);
fdComment.right = new FormAttachment(100, 0);
wComment.setLayoutData(fdComment);
wComment.addSelectionListener(lsSel);
// DOTALL?
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(wComment, margin);
fdDotAll.right = new FormAttachment(100, 0);
wDotAll.setLayoutData(fdDotAll);
wDotAll.addSelectionListener(lsSel);
// MULTILINE?
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(wDotAll, margin);
fdMultiline.right = new FormAttachment(100, 0);
wMultiline.setLayoutData(fdMultiline);
wMultiline.addSelectionListener(lsSel);
// UNICODE?
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(wMultiline, margin);
fdUnicode.right = new FormAttachment(100, 0);
wUnicode.setLayoutData(fdUnicode);
wUnicode.addSelectionListener(lsSel);
// UNIX?
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(wUnicode, margin);
fdUnix.right = new FormAttachment(100, 0);
wUnix.setLayoutData(fdUnix);
wUnix.addSelectionListener(lsSel);
fdRegexSettings = new FormData();
fdRegexSettings.left = new FormAttachment(0, margin);
fdRegexSettings.top = new FormAttachment(wStepSettings, margin);
fdRegexSettings.right = new FormAttachment(100, -margin);
wRegexSettings.setLayoutData(fdRegexSettings);
// ///////////////////////////////////////////////////////////
// / END OF RegexSettings GROUP
// ///////////////////////////////////////////////////////////
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(wContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
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);
fdSash = new FormData();
fdSash.left = new FormAttachment(0, 0);
fdSash.top = new FormAttachment(wStepname, 0);
fdSash.right = new FormAttachment(100, 0);
fdSash.bottom = new FormAttachment(100, -50);
wSash.setLayoutData(fdSash);
wSash.setWeights(new int[] { 60, 40 });
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
lsbTestRegExScript = new Listener() {
public void handleEvent(Event e) {
testRegExScript();
}
};
wbTestRegExScript.addListener(SWT.Selection, lsbTestRegExScript);
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
setFieldsEnabledStatus();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class DatabaseLookupDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsConnectionMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
setTableFieldCombo();
}
};
ModifyListener lsTableMod = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
input.setChanged();
setTableFieldCombo();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setTableFieldCombo();
}
};
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, "DatabaseLookupDialog.shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// Connection line
wConnection = addConnectionLine(shell, wStepname, middle, margin);
if (input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsConnectionMod);
wConnection.addSelectionListener(lsSelection);
// Schema line...
wlSchema = new Label(shell, SWT.RIGHT);
wlSchema.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.TargetSchema.Label"));
props.setLook(wlSchema);
fdlSchema = new FormData();
fdlSchema.left = new FormAttachment(0, 0);
fdlSchema.right = new FormAttachment(middle, -margin);
fdlSchema.top = new FormAttachment(wConnection, margin * 2);
wlSchema.setLayoutData(fdlSchema);
wbSchema = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbSchema);
wbSchema.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbSchema = new FormData();
fdbSchema.top = new FormAttachment(wConnection, 2 * margin);
fdbSchema.right = new FormAttachment(100, 0);
wbSchema.setLayoutData(fdbSchema);
wSchema = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSchema);
wSchema.addModifyListener(lsTableMod);
fdSchema = new FormData();
fdSchema.left = new FormAttachment(middle, 0);
fdSchema.top = new FormAttachment(wConnection, margin * 2);
fdSchema.right = new FormAttachment(wbSchema, -margin);
wSchema.setLayoutData(fdSchema);
// Table line...
wlTable = new Label(shell, SWT.RIGHT);
wlTable.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Lookuptable.Label"));
props.setLook(wlTable);
fdlTable = new FormData();
fdlTable.left = new FormAttachment(0, 0);
fdlTable.right = new FormAttachment(middle, -margin);
fdlTable.top = new FormAttachment(wbSchema, margin);
wlTable.setLayoutData(fdlTable);
wbTable = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Browse.Button"));
fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wbSchema, margin);
wbTable.setLayoutData(fdbTable);
wTable = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTable);
wTable.addModifyListener(lsTableMod);
fdTable = new FormData();
fdTable.left = new FormAttachment(middle, 0);
fdTable.top = new FormAttachment(wbSchema, margin);
fdTable.right = new FormAttachment(wbTable, -margin);
wTable.setLayoutData(fdTable);
// Cache?
wlCache = new Label(shell, SWT.RIGHT);
wlCache.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Cache.Label"));
props.setLook(wlCache);
fdlCache = new FormData();
fdlCache.left = new FormAttachment(0, 0);
fdlCache.right = new FormAttachment(middle, -margin);
fdlCache.top = new FormAttachment(wTable, margin);
wlCache.setLayoutData(fdlCache);
wCache = new Button(shell, SWT.CHECK);
props.setLook(wCache);
fdCache = new FormData();
fdCache.left = new FormAttachment(middle, 0);
fdCache.top = new FormAttachment(wTable, margin);
wCache.setLayoutData(fdCache);
wCache.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableFields();
}
});
// Cache size line
wlCachesize = new Label(shell, SWT.RIGHT);
wlCachesize.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Cachesize.Label"));
props.setLook(wlCachesize);
wlCachesize.setEnabled(input.isCached());
fdlCachesize = new FormData();
fdlCachesize.left = new FormAttachment(0, 0);
fdlCachesize.right = new FormAttachment(middle, -margin);
fdlCachesize.top = new FormAttachment(wCache, margin);
wlCachesize.setLayoutData(fdlCachesize);
wCachesize = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wCachesize);
wCachesize.setEnabled(input.isCached());
wCachesize.addModifyListener(lsMod);
fdCachesize = new FormData();
fdCachesize.left = new FormAttachment(middle, 0);
fdCachesize.right = new FormAttachment(100, 0);
fdCachesize.top = new FormAttachment(wCache, margin);
wCachesize.setLayoutData(fdCachesize);
// Cache : Load all?
wlCacheLoadAll = new Label(shell, SWT.RIGHT);
wlCacheLoadAll.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.CacheLoadAll.Label"));
props.setLook(wlCacheLoadAll);
fdlCacheLoadAll = new FormData();
fdlCacheLoadAll.left = new FormAttachment(0, 0);
fdlCacheLoadAll.right = new FormAttachment(middle, -margin);
fdlCacheLoadAll.top = new FormAttachment(wCachesize, margin);
wlCacheLoadAll.setLayoutData(fdlCacheLoadAll);
wCacheLoadAll = new Button(shell, SWT.CHECK);
props.setLook(wCacheLoadAll);
fdCacheLoadAll = new FormData();
fdCacheLoadAll.left = new FormAttachment(middle, 0);
fdCacheLoadAll.top = new FormAttachment(wCachesize, margin);
wCacheLoadAll.setLayoutData(fdCacheLoadAll);
wCacheLoadAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableFields();
}
});
wlKey = new Label(shell, SWT.NONE);
wlKey.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Keys.Label"));
props.setLook(wlKey);
fdlKey = new FormData();
fdlKey.left = new FormAttachment(0, 0);
fdlKey.top = new FormAttachment(wCacheLoadAll, margin);
wlKey.setLayoutData(fdlKey);
int nrKeyCols = 4;
int nrKeyRows = (input.getStreamKeyField1() != null ? input.getStreamKeyField1().length : 1);
ColumnInfo[] ciKey = new ColumnInfo[nrKeyCols];
ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Tablefield"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[1] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Comparator"), ColumnInfo.COLUMN_TYPE_CCOMBO, DatabaseLookupMeta.conditionStrings);
ciKey[2] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Field1"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[3] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Field2"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
tableFieldColumns.add(ciKey[0]);
fieldColumns.add(ciKey[2]);
fieldColumns.add(ciKey[3]);
wKey = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
fdKey = new FormData();
fdKey.left = new FormAttachment(0, 0);
fdKey.top = new FormAttachment(wlKey, margin);
fdKey.right = new FormAttachment(100, 0);
fdKey.bottom = new FormAttachment(wlKey, 250);
wKey.setLayoutData(fdKey);
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.GetFields.Button"));
wGetLU = new Button(shell, SWT.PUSH);
wGetLU.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.GetLookupFields.Button"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel, wGet, wGetLU }, margin, null);
// OderBy line
wlOrderBy = new Label(shell, SWT.RIGHT);
wlOrderBy.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Orderby.Label"));
props.setLook(wlOrderBy);
fdlOrderBy = new FormData();
fdlOrderBy.left = new FormAttachment(0, 0);
fdlOrderBy.right = new FormAttachment(middle, -margin);
fdlOrderBy.bottom = new FormAttachment(wOK, -2 * margin);
wlOrderBy.setLayoutData(fdlOrderBy);
wOrderBy = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wOrderBy);
fdOrderBy = new FormData();
fdOrderBy.left = new FormAttachment(middle, 0);
fdOrderBy.bottom = new FormAttachment(wOK, -2 * margin);
fdOrderBy.right = new FormAttachment(100, 0);
wOrderBy.setLayoutData(fdOrderBy);
wOrderBy.addModifyListener(lsMod);
// FailMultiple?
wlFailMultiple = new Label(shell, SWT.RIGHT);
wlFailMultiple.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.FailMultiple.Label"));
props.setLook(wlFailMultiple);
fdlFailMultiple = new FormData();
fdlFailMultiple.left = new FormAttachment(0, 0);
fdlFailMultiple.right = new FormAttachment(middle, -margin);
fdlFailMultiple.bottom = new FormAttachment(wOrderBy, -margin);
wlFailMultiple.setLayoutData(fdlFailMultiple);
wFailMultiple = new Button(shell, SWT.CHECK);
props.setLook(wFailMultiple);
fdFailMultiple = new FormData();
fdFailMultiple.left = new FormAttachment(middle, 0);
fdFailMultiple.bottom = new FormAttachment(wOrderBy, -margin);
wFailMultiple.setLayoutData(fdFailMultiple);
wFailMultiple.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableFields();
}
});
// EatRows?
wlEatRows = new Label(shell, SWT.RIGHT);
wlEatRows.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.EatRows.Label"));
props.setLook(wlEatRows);
fdlEatRows = new FormData();
fdlEatRows.left = new FormAttachment(0, 0);
fdlEatRows.right = new FormAttachment(middle, -margin);
fdlEatRows.bottom = new FormAttachment(wFailMultiple, -margin);
wlEatRows.setLayoutData(fdlEatRows);
wEatRows = new Button(shell, SWT.CHECK);
props.setLook(wEatRows);
fdEatRows = new FormData();
fdEatRows.left = new FormAttachment(middle, 0);
fdEatRows.bottom = new FormAttachment(wFailMultiple, -margin);
wEatRows.setLayoutData(fdEatRows);
wEatRows.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
enableFields();
}
});
// THE UPDATE/INSERT TABLE
wlReturn = new Label(shell, SWT.NONE);
wlReturn.setText(BaseMessages.getString(PKG, "DatabaseLookupDialog.Return.Label"));
props.setLook(wlReturn);
fdlReturn = new FormData();
fdlReturn.left = new FormAttachment(0, 0);
fdlReturn.top = new FormAttachment(wKey, margin);
wlReturn.setLayoutData(fdlReturn);
int UpInsCols = 4;
int UpInsRows = (input.getReturnValueField() != null ? input.getReturnValueField().length : 1);
ColumnInfo[] ciReturn = new ColumnInfo[UpInsCols];
ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false);
ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Newname"), ColumnInfo.COLUMN_TYPE_TEXT, false);
ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Default"), ColumnInfo.COLUMN_TYPE_TEXT, false);
ciReturn[3] = new ColumnInfo(BaseMessages.getString(PKG, "DatabaseLookupDialog.ColumnInfo.Type"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames());
tableFieldColumns.add(ciReturn[0]);
wReturn = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
fdReturn = new FormData();
fdReturn.left = new FormAttachment(0, 0);
fdReturn.top = new FormAttachment(wlReturn, margin);
fdReturn.right = new FormAttachment(100, 0);
fdReturn.bottom = new FormAttachment(wEatRows, -margin);
wReturn.setLayoutData(fdReturn);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsGetLU = new Listener() {
public void handleEvent(Event e) {
getlookup();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wGetLU.addListener(SWT.Selection, lsGetLU);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wTable.addSelectionListener(lsDef);
wOrderBy.addSelectionListener(lsDef);
wCachesize.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wbSchema.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getSchemaNames();
}
});
wbTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getTableName();
}
});
shell.pack();
shell.setMinimumSize(shell.getSize());
getData();
input.setChanged(backupChanged);
setComboValues();
setTableFieldCombo();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class DeleteDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
ModifyListener lsTableMod = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
input.setChanged();
setTableFieldCombo();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setTableFieldCombo();
}
};
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, "DeleteDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "DeleteDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// Connection line
wConnection = addConnectionLine(shell, wStepname, middle, margin);
if (input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
wConnection.addSelectionListener(lsSelection);
// Schema line...
wlSchema = new Label(shell, SWT.RIGHT);
wlSchema.setText(BaseMessages.getString(PKG, "DeleteDialog.TargetSchema.Label"));
props.setLook(wlSchema);
fdlSchema = new FormData();
fdlSchema.left = new FormAttachment(0, 0);
fdlSchema.right = new FormAttachment(middle, -margin);
fdlSchema.top = new FormAttachment(wConnection, margin * 2);
wlSchema.setLayoutData(fdlSchema);
wbSchema = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbSchema);
wbSchema.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbSchema = new FormData();
fdbSchema.top = new FormAttachment(wConnection, 2 * margin);
fdbSchema.right = new FormAttachment(100, 0);
wbSchema.setLayoutData(fdbSchema);
wSchema = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSchema);
wSchema.addModifyListener(lsTableMod);
fdSchema = new FormData();
fdSchema.left = new FormAttachment(middle, 0);
fdSchema.top = new FormAttachment(wConnection, margin * 2);
fdSchema.right = new FormAttachment(wbSchema, -margin);
wSchema.setLayoutData(fdSchema);
// Table line...
wlTable = new Label(shell, SWT.RIGHT);
wlTable.setText(BaseMessages.getString(PKG, "DeleteDialog.TargetTable.Label"));
props.setLook(wlTable);
fdlTable = new FormData();
fdlTable.left = new FormAttachment(0, 0);
fdlTable.right = new FormAttachment(middle, -margin);
fdlTable.top = new FormAttachment(wbSchema, margin);
wlTable.setLayoutData(fdlTable);
wbTable = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, "DeleteDialog.Browse.Button"));
fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wbSchema, margin);
wbTable.setLayoutData(fdbTable);
wTable = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTable);
wTable.addModifyListener(lsTableMod);
fdTable = new FormData();
fdTable.left = new FormAttachment(middle, 0);
fdTable.top = new FormAttachment(wbSchema, margin);
fdTable.right = new FormAttachment(wbTable, -margin);
wTable.setLayoutData(fdTable);
// Commit line
wlCommit = new Label(shell, SWT.RIGHT);
wlCommit.setText(BaseMessages.getString(PKG, "DeleteDialog.Commit.Label"));
props.setLook(wlCommit);
fdlCommit = new FormData();
fdlCommit.left = new FormAttachment(0, 0);
fdlCommit.top = new FormAttachment(wTable, margin);
fdlCommit.right = new FormAttachment(middle, -margin);
wlCommit.setLayoutData(fdlCommit);
wCommit = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wCommit);
wCommit.addModifyListener(lsMod);
fdCommit = new FormData();
fdCommit.left = new FormAttachment(middle, 0);
fdCommit.top = new FormAttachment(wTable, margin);
fdCommit.right = new FormAttachment(100, 0);
wCommit.setLayoutData(fdCommit);
wlKey = new Label(shell, SWT.NONE);
wlKey.setText(BaseMessages.getString(PKG, "DeleteDialog.Key.Label"));
props.setLook(wlKey);
fdlKey = new FormData();
fdlKey.left = new FormAttachment(0, 0);
fdlKey.top = new FormAttachment(wCommit, margin);
wlKey.setLayoutData(fdlKey);
int nrKeyCols = 4;
int nrKeyRows = (input.getKeyStream() != null ? input.getKeyStream().length : 1);
ciKey = new ColumnInfo[nrKeyCols];
ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "DeleteDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[1] = new ColumnInfo(BaseMessages.getString(PKG, "DeleteDialog.ColumnInfo.Comparator"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "=", "<>", "<", "<=", ">", ">=", "LIKE", "BETWEEN", "IS NULL", "IS NOT NULL" });
ciKey[2] = new ColumnInfo(BaseMessages.getString(PKG, "DeleteDialog.ColumnInfo.StreamField1"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[3] = new ColumnInfo(BaseMessages.getString(PKG, "DeleteDialog.ColumnInfo.StreamField2"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
tableFieldColumns.add(ciKey[0]);
wKey = new TableView(transMeta, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "DeleteDialog.GetFields.Button"));
fdGet = new FormData();
fdGet.right = new FormAttachment(100, 0);
fdGet.top = new FormAttachment(wlKey, margin);
wGet.setLayoutData(fdGet);
fdKey = new FormData();
fdKey.left = new FormAttachment(0, 0);
fdKey.top = new FormAttachment(wlKey, margin);
fdKey.right = new FormAttachment(wGet, -margin);
fdKey.bottom = new FormAttachment(100, -30);
wKey.setLayoutData(fdKey);
//
// Search the fields in the background
//
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), i);
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, null);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wSchema.addSelectionListener(lsDef);
wTable.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wbSchema.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getSchemaNames();
}
});
wbTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getTableName();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
setTableFieldCombo();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class MailInputDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
closeMailConnection();
input.setChanged();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
closeMailConnection();
}
};
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, "MailInputdialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "MailInputdialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "MailInput.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "MailInput.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(0, 2 * margin);
fdlServerName.right = new FormAttachment(middle, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(0, 2 * margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// USE connection with SSL
wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
wlUseSSL.setText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Label"));
props.setLook(wlUseSSL);
fdlUseSSL = new FormData();
fdlUseSSL.left = new FormAttachment(0, 0);
fdlUseSSL.top = new FormAttachment(wServerName, margin);
fdlUseSSL.right = new FormAttachment(middle, -margin);
wlUseSSL.setLayoutData(fdlUseSSL);
wUseSSL = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseSSL);
fdUseSSL = new FormData();
wUseSSL.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Tooltip"));
fdUseSSL.left = new FormAttachment(middle, 0);
fdUseSSL.top = new FormAttachment(wServerName, margin);
fdUseSSL.right = new FormAttachment(100, 0);
wUseSSL.setLayoutData(fdUseSSL);
wUseSSL.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
closeMailConnection();
refreshPort(true);
}
});
// port
wlPort = new Label(wServerSettings, SWT.RIGHT);
wlPort.setText(BaseMessages.getString(PKG, "MailInput.SSLPort.Label"));
props.setLook(wlPort);
fdlPort = new FormData();
fdlPort.left = new FormAttachment(0, 0);
fdlPort.top = new FormAttachment(wUseSSL, margin);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
wPort.setToolTipText(BaseMessages.getString(PKG, "MailInput.SSLPort.Tooltip"));
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(middle, 0);
fdPort.top = new FormAttachment(wUseSSL, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "MailInput.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wPort, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "MailInput.Username.Tooltip"));
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "MailInput.Password.Label"));
props.setLook(wlPassword);
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(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// USE proxy
wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
wlUseProxy.setText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Label"));
props.setLook(wlUseProxy);
fdlUseProxy = new FormData();
fdlUseProxy.left = new FormAttachment(0, 0);
fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdlUseProxy.right = new FormAttachment(middle, -margin);
wlUseProxy.setLayoutData(fdlUseProxy);
wUseProxy = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseProxy);
fdUseProxy = new FormData();
wUseProxy.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Tooltip"));
fdUseProxy.left = new FormAttachment(middle, 0);
fdUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdUseProxy.right = new FormAttachment(100, 0);
wUseProxy.setLayoutData(fdUseProxy);
wUseProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setUserProxy();
input.setChanged();
}
});
// ProxyUsername line
wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
wlProxyUsername.setText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Label"));
wProxyUsername = new TextVar(transMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Tooltip"));
wProxyUsername.addModifyListener(lsMod);
addLabelInputPairBelow(wlProxyUsername, wProxyUsername, wUseProxy);
// Use Batch label/checkbox
Label wlUseBatch = new Label(wServerSettings, SWT.RIGHT);
wlUseBatch.setText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Label"));
wUseBatch = new Button(wServerSettings, SWT.CHECK);
wUseBatch.setToolTipText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Tooltip"));
wUseBatch.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setBatchSettingsEnabled();
}
});
addLabelInputPairBelow(wlUseBatch, wUseBatch, wProxyUsername);
// ignore field errors
wlIgnoreFieldErrors = new Label(wServerSettings, SWT.RIGHT);
wlIgnoreFieldErrors.setText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Label"));
wIgnoreFieldErrors = new Button(wServerSettings, SWT.CHECK);
wIgnoreFieldErrors.setToolTipText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Tooltip"));
addLabelInputPairBelow(wlIgnoreFieldErrors, wIgnoreFieldErrors, wUseBatch);
// Protocol
wlProtocol = new Label(wServerSettings, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "MailInput.Protocol.Label"));
wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wProtocol.setItems(MailConnectionMeta.protocolCodes);
wProtocol.select(0);
wProtocol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refreshProtocol(true);
}
});
addLabelInputPairBelow(wlProtocol, wProtocol, wIgnoreFieldErrors);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "MailInput.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wProtocol, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wProtocol, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wStepname, 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 SETTINGS TAB ///
// ////////////////////////
wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
wSettingsTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Pop.Label"));
wSettingsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSettingsComp);
FormLayout PopLayout = new FormLayout();
PopLayout.marginWidth = 3;
PopLayout.marginHeight = 3;
wSettingsComp.setLayout(PopLayout);
// Message: for POP3, only INBOX folder is available!
wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
wlPOP3Message.setText(BaseMessages.getString(PKG, "MailInput.POP3Message.Label"));
props.setLook(wlPOP3Message);
fdlPOP3Message = new FormData();
fdlPOP3Message.left = new FormAttachment(0, margin);
fdlPOP3Message.top = new FormAttachment(0, 3 * margin);
wlPOP3Message.setLayoutData(fdlPOP3Message);
wlPOP3Message.setForeground(GUIResource.getInstance().getColorOrange());
// ////////////////////////
// START OF POP3 Settings GROUP///
// /
wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wPOP3Settings);
wPOP3Settings.setText(BaseMessages.getString(PKG, "MailInput.POP3Settings.Group.Label"));
FormLayout POP3SettingsgroupLayout = new FormLayout();
POP3SettingsgroupLayout.marginWidth = 10;
POP3SettingsgroupLayout.marginHeight = 10;
wPOP3Settings.setLayout(POP3SettingsgroupLayout);
// List of mails of retrieve
wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
wlListmails.setText(BaseMessages.getString(PKG, "MailInput.Listmails.Label"));
props.setLook(wlListmails);
fdlListmails = new FormData();
fdlListmails.left = new FormAttachment(0, 0);
fdlListmails.right = new FormAttachment(middle, 0);
fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
wlListmails.setLayoutData(fdlListmails);
wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveAllMails.Label"));
// [PDI-7241] pop3 does not support retrive unread option
// wListmails.add( BaseMessages.getString( PKG, "MailInput.RetrieveUnreadMails.Label" ) );
wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveFirstMails.Label"));
// +1: starts at -1
wListmails.select(0);
props.setLook(wListmails);
fdListmails = new FormData();
fdListmails.left = new FormAttachment(middle, 0);
fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdListmails.right = new FormAttachment(100, 0);
wListmails.setLayoutData(fdListmails);
wListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
chooseListMails();
}
});
// Retrieve the first ... mails
wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
wlFirstmails.setText(BaseMessages.getString(PKG, "MailInput.Firstmails.Label"));
props.setLook(wlFirstmails);
fdlFirstmails = new FormData();
fdlFirstmails.left = new FormAttachment(0, 0);
fdlFirstmails.right = new FormAttachment(middle, -margin);
fdlFirstmails.top = new FormAttachment(wListmails, margin);
wlFirstmails.setLayoutData(fdlFirstmails);
wFirstmails = new TextVar(transMeta, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFirstmails);
wFirstmails.addModifyListener(lsMod);
fdFirstmails = new FormData();
fdFirstmails.left = new FormAttachment(middle, 0);
fdFirstmails.top = new FormAttachment(wListmails, margin);
fdFirstmails.right = new FormAttachment(100, 0);
wFirstmails.setLayoutData(fdFirstmails);
fdPOP3Settings = new FormData();
fdPOP3Settings.left = new FormAttachment(0, margin);
fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdPOP3Settings.right = new FormAttachment(100, -margin);
wPOP3Settings.setLayoutData(fdPOP3Settings);
// ///////////////////////////////////////////////////////////
// / END OF POP3 SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF IMAP Settings GROUP///
// /
wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wIMAPSettings);
wIMAPSettings.setText(BaseMessages.getString(PKG, "MailInput.IMAPSettings.Groupp.Label"));
FormLayout IMAPSettingsgroupLayout = new FormLayout();
IMAPSettingsgroupLayout.marginWidth = 10;
IMAPSettingsgroupLayout.marginHeight = 10;
wIMAPSettings.setLayout(IMAPSettingsgroupLayout);
// Is folder name defined in a Field
wldynamicFolder = new Label(wIMAPSettings, SWT.RIGHT);
wldynamicFolder.setText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Label"));
props.setLook(wldynamicFolder);
fdldynamicFolder = new FormData();
fdldynamicFolder.left = new FormAttachment(0, 0);
fdldynamicFolder.top = new FormAttachment(0, margin);
fdldynamicFolder.right = new FormAttachment(middle, -margin);
wldynamicFolder.setLayoutData(fdldynamicFolder);
wdynamicFolder = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wdynamicFolder);
wdynamicFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Tooltip"));
fddynamicFolder = new FormData();
fddynamicFolder.left = new FormAttachment(middle, 0);
fddynamicFolder.top = new FormAttachment(0, margin);
wdynamicFolder.setLayoutData(fddynamicFolder);
SelectionAdapter lsxmlstream = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
activedynamicFolder();
input.setChanged();
}
};
wdynamicFolder.addSelectionListener(lsxmlstream);
// Folder field
wlFolderField = new Label(wIMAPSettings, SWT.RIGHT);
wlFolderField.setText(BaseMessages.getString(PKG, "MailInput.wlFolderField.Label"));
props.setLook(wlFolderField);
fdlFolderField = new FormData();
fdlFolderField.left = new FormAttachment(0, 0);
fdlFolderField.top = new FormAttachment(wdynamicFolder, margin);
fdlFolderField.right = new FormAttachment(middle, -margin);
wlFolderField.setLayoutData(fdlFolderField);
wFolderField = new CCombo(wIMAPSettings, SWT.BORDER | SWT.READ_ONLY);
wFolderField.setEditable(true);
props.setLook(wFolderField);
wFolderField.addModifyListener(lsMod);
fdFolderField = new FormData();
fdFolderField.left = new FormAttachment(middle, 0);
fdFolderField.top = new FormAttachment(wdynamicFolder, margin);
fdFolderField.right = new FormAttachment(100, -margin);
wFolderField.setLayoutData(fdFolderField);
wFolderField.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
setFolderField();
}
});
// SelectFolder button
wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectFolder.setImage(GUIResource.getInstance().getImageBol());
wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Label"));
props.setLook(wSelectFolder);
fdSelectFolder = new FormData();
wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Tooltip"));
fdSelectFolder.top = new FormAttachment(wFolderField, margin);
fdSelectFolder.right = new FormAttachment(100, 0);
wSelectFolder.setLayoutData(fdSelectFolder);
// TestIMAPFolder button
wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Label"));
props.setLook(wTestIMAPFolder);
fdTestIMAPFolder = new FormData();
wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Tooltip"));
fdTestIMAPFolder.top = new FormAttachment(wFolderField, margin);
fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
// IMAPFolder line
wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Label"));
props.setLook(wlIMAPFolder);
fdlIMAPFolder = new FormData();
fdlIMAPFolder.left = new FormAttachment(0, 0);
fdlIMAPFolder.top = new FormAttachment(wFolderField, margin);
fdlIMAPFolder.right = new FormAttachment(middle, -margin);
wlIMAPFolder.setLayoutData(fdlIMAPFolder);
wIMAPFolder = new TextVar(transMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFolder);
wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Tooltip"));
wIMAPFolder.addModifyListener(lsMod);
fdIMAPFolder = new FormData();
fdIMAPFolder.left = new FormAttachment(middle, 0);
fdIMAPFolder.top = new FormAttachment(wFolderField, margin);
fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
wIMAPFolder.setLayoutData(fdIMAPFolder);
// Include subfolders?
wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Label"));
props.setLook(wlIncludeSubFolders);
fdlIncludeSubFolders = new FormData();
fdlIncludeSubFolders.left = new FormAttachment(0, 0);
fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wIncludeSubFolders);
fdIncludeSubFolders = new FormData();
wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Tooltip"));
fdIncludeSubFolders.left = new FormAttachment(middle, 0);
fdIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdIncludeSubFolders.right = new FormAttachment(100, 0);
wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
wIncludeSubFolders.addSelectionListener(lsSelection);
// List of mails of retrieve
wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPListmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPListmails.Label"));
props.setLook(wlIMAPListmails);
fdlIMAPListmails = new FormData();
fdlIMAPListmails.left = new FormAttachment(0, 0);
fdlIMAPListmails.right = new FormAttachment(middle, -margin);
fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
wlIMAPListmails.setLayoutData(fdlIMAPListmails);
wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
// +1: starts at -1
wIMAPListmails.select(0);
props.setLook(wIMAPListmails);
fdIMAPListmails = new FormData();
fdIMAPListmails.left = new FormAttachment(middle, 0);
fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
fdIMAPListmails.right = new FormAttachment(100, 0);
wIMAPListmails.setLayoutData(fdIMAPListmails);
wIMAPListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// ChooseIMAPListmails();
}
});
// Retrieve the first ... mails
wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPFirstmails.Label"));
props.setLook(wlIMAPFirstmails);
fdlIMAPFirstmails = new FormData();
fdlIMAPFirstmails.left = new FormAttachment(0, 0);
fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
wIMAPFirstmails = new TextVar(transMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFirstmails);
wIMAPFirstmails.addModifyListener(lsMod);
fdIMAPFirstmails = new FormData();
fdIMAPFirstmails.left = new FormAttachment(middle, 0);
fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
fdIMAPFirstmails.right = new FormAttachment(100, 0);
wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
fdIMAPSettings = new FormData();
fdIMAPSettings.left = new FormAttachment(0, margin);
fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
fdIMAPSettings.right = new FormAttachment(100, -margin);
wIMAPSettings.setLayoutData(fdIMAPSettings);
// ///////////////////////////////////////////////////////////
// / END OF IMAP SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////////////
// START OF Batch Settings GROUP///
//
wBatchSettingsGroup = createGroup(wSettingsComp, wIMAPSettings, BaseMessages.getString(PKG, "MailInputDialog.BatchSettingsGroup.Label"));
// Batch size
Label wlBatchSize = new Label(wBatchSettingsGroup, SWT.RIGHT);
wlBatchSize.setText(BaseMessages.getString(PKG, "MailInputDialog.BatchSize.Label"));
wBatchSize = new Text(wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
addLabelInputPairBelow(wlBatchSize, wBatchSize, wBatchSettingsGroup);
// Starting message
Label wlStartMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
wlStartMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.StartMessage.Label"));
wStartMessage = new TextVar(transMeta, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
addLabelInputPairBelow(wlStartMessage, wStartMessage, wBatchSize);
// Last message
Label wlEndMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
wlEndMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.EndMessage.Label"));
wEndMessage = new TextVar(transMeta, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
addLabelInputPairBelow(wlEndMessage, wEndMessage, wStartMessage);
//
// / END OF Batch Settings GROUP
// ///////////////////////////////
fdSettingsComp = new FormData();
fdSettingsComp.left = new FormAttachment(0, 0);
fdSettingsComp.top = new FormAttachment(wStepname, 0);
fdSettingsComp.right = new FormAttachment(100, 0);
fdSettingsComp.bottom = new FormAttachment(100, 0);
wSettingsComp.setLayoutData(fdSettingsComp);
wSettingsComp.layout();
wSettingsTab.setControl(wSettingsComp);
props.setLook(wSettingsComp);
// ///////////////////////////////////////////////////////////
// / END OF Pop TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF SEARCH TAB ///
// ////////////////////////
wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
wSearchTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Search.Label"));
wSearchComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSearchComp);
FormLayout searchLayout = new FormLayout();
searchLayout.marginWidth = 3;
searchLayout.marginHeight = 3;
wSearchComp.setLayout(searchLayout);
// ////////////////////////
// START OF HEADER ROUP///
// /
wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wHeader);
wHeader.setText(BaseMessages.getString(PKG, "MailInput.Header.Group.Label"));
FormLayout HeadergroupLayout = new FormLayout();
HeadergroupLayout.marginWidth = 10;
HeadergroupLayout.marginHeight = 10;
wHeader.setLayout(HeadergroupLayout);
wNegateSender = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSender);
fdNegateSender = new FormData();
wNegateSender.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSender.Tooltip"));
fdNegateSender.top = new FormAttachment(0, margin);
fdNegateSender.right = new FormAttachment(100, -margin);
wNegateSender.setLayoutData(fdNegateSender);
// From line
wlSender = new Label(wHeader, SWT.RIGHT);
wlSender.setText(BaseMessages.getString(PKG, "MailInput.wSender.Label"));
props.setLook(wlSender);
fdlSender = new FormData();
fdlSender.left = new FormAttachment(0, 0);
fdlSender.top = new FormAttachment(0, margin);
fdlSender.right = new FormAttachment(middle, -margin);
wlSender.setLayoutData(fdlSender);
wSender = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSender);
wSender.addModifyListener(lsMod);
fdSender = new FormData();
fdSender.left = new FormAttachment(middle, 0);
fdSender.top = new FormAttachment(0, margin);
fdSender.right = new FormAttachment(wNegateSender, -margin);
wSender.setLayoutData(fdSender);
wNegateReceipient = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateReceipient);
fdNegateReceipient = new FormData();
wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceipient.Tooltip"));
fdNegateReceipient.top = new FormAttachment(wSender, margin);
fdNegateReceipient.right = new FormAttachment(100, -margin);
wNegateReceipient.setLayoutData(fdNegateReceipient);
// Receipient line
wlReceipient = new Label(wHeader, SWT.RIGHT);
wlReceipient.setText(BaseMessages.getString(PKG, "MailInput.Receipient.Label"));
props.setLook(wlReceipient);
fdlReceipient = new FormData();
fdlReceipient.left = new FormAttachment(0, 0);
fdlReceipient.top = new FormAttachment(wSender, margin);
fdlReceipient.right = new FormAttachment(middle, -margin);
wlReceipient.setLayoutData(fdlReceipient);
wReceipient = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wReceipient);
wReceipient.addModifyListener(lsMod);
fdReceipient = new FormData();
fdReceipient.left = new FormAttachment(middle, 0);
fdReceipient.top = new FormAttachment(wSender, margin);
fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
wReceipient.setLayoutData(fdReceipient);
wNegateSubject = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSubject);
fdNegateSubject = new FormData();
wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSubject.Tooltip"));
fdNegateSubject.top = new FormAttachment(wReceipient, margin);
fdNegateSubject.right = new FormAttachment(100, -margin);
wNegateSubject.setLayoutData(fdNegateSubject);
// Subject line
wlSubject = new Label(wHeader, SWT.RIGHT);
wlSubject.setText(BaseMessages.getString(PKG, "MailInput.Subject.Label"));
props.setLook(wlSubject);
fdlSubject = new FormData();
fdlSubject.left = new FormAttachment(0, 0);
fdlSubject.top = new FormAttachment(wReceipient, margin);
fdlSubject.right = new FormAttachment(middle, -margin);
wlSubject.setLayoutData(fdlSubject);
wSubject = new TextVar(transMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSubject);
wSubject.addModifyListener(lsMod);
fdSubject = new FormData();
fdSubject.left = new FormAttachment(middle, 0);
fdSubject.top = new FormAttachment(wReceipient, margin);
fdSubject.right = new FormAttachment(wNegateSubject, -margin);
wSubject.setLayoutData(fdSubject);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(0, margin);
fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
fdHeader.right = new FormAttachment(100, -margin);
wHeader.setLayoutData(fdHeader);
// ///////////////////////////////////////////////////////////
// / END OF HEADER GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF RECEIVED DATE ROUP///
// /
wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wReceivedDate);
wReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ReceivedDate.Group.Label"));
FormLayout ReceivedDategroupLayout = new FormLayout();
ReceivedDategroupLayout.marginWidth = 10;
ReceivedDategroupLayout.marginHeight = 10;
wReceivedDate.setLayout(ReceivedDategroupLayout);
wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
props.setLook(wNegateReceivedDate);
fdNegateReceivedDate = new FormData();
wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceivedDate.Tooltip"));
fdNegateReceivedDate.top = new FormAttachment(wHeader, margin);
fdNegateReceivedDate.right = new FormAttachment(100, -margin);
wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
// Received Date Condition
wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ConditionOnReceivedDate.Label"));
props.setLook(wlConditionOnReceivedDate);
fdlConditionOnReceivedDate = new FormData();
fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
fdlConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
// +1: starts at -1
wConditionOnReceivedDate.select(0);
props.setLook(wConditionOnReceivedDate);
fdConditionOnReceivedDate = new FormData();
fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
fdConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
conditionReceivedDate();
input.setChanged();
}
});
open = new Button(wReceivedDate, SWT.PUSH);
open.setImage(GUIResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "MailInput.SelectDate"));
dialog.setImage(GUIResource.getInstance().getImageSpoon());
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() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendar.getYear());
cal.set(Calendar.MONTH, calendar.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
cal.set(Calendar.HOUR_OF_DAY, time.getHours());
cal.set(Calendar.MINUTE, time.getMinutes());
cal.set(Calendar.SECOND, time.getSeconds());
wReadFrom.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Label"));
props.setLook(wlReadFrom);
fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(transMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wReceivedDate, SWT.PUSH);
opento.setImage(GUIResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "MailInput.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() {
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "MailInput.SelectDate"));
dialogto.setImage(GUIResource.getInstance().getImageSpoon());
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() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendarto.getYear());
cal.set(Calendar.MONTH, calendarto.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
cal.set(Calendar.MINUTE, timeto.getMinutes());
cal.set(Calendar.SECOND, timeto.getSeconds());
wReadTo.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "MailInput.ReadTo.Label"));
props.setLook(wlReadTo);
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(transMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadTo.Tooltip"));
props.setLook(wReadTo);
wReadTo.addModifyListener(lsMod);
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);
fdReceivedDate = new FormData();
fdReceivedDate.left = new FormAttachment(0, margin);
fdReceivedDate.top = new FormAttachment(wHeader, margin);
fdReceivedDate.right = new FormAttachment(100, -margin);
wReceivedDate.setLayoutData(fdReceivedDate);
// ///////////////////////////////////////////////////////////
// / END OF RECEIVED DATE GROUP
// ///////////////////////////////////////////////////////////
wlLimit = new Label(wSearchComp, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "MailInput.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new Text(wSearchComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
fdSearchComp = new FormData();
fdSearchComp.left = new FormAttachment(0, 0);
fdSearchComp.top = new FormAttachment(wStepname, 0);
fdSearchComp.right = new FormAttachment(100, 0);
fdSearchComp.bottom = new FormAttachment(100, 0);
wSearchComp.setLayoutData(fdSearchComp);
wSearchComp.layout();
wSearchTab.setControl(wSearchComp);
props.setLook(wSearchComp);
// ////////////////////////////////
// / END OF SEARCH TAB
// ////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "MailInputdialog.Fields.Tab"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = Const.FORM_MARGIN;
fieldsLayout.marginHeight = Const.FORM_MARGIN;
wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
props.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "MailInputdialog.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;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, MailInputField.ColumnDesc, true) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column.Tooltip"));
colinf[1].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column.Tooltip"));
wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wGet, -margin);
wFields.setLayoutData(fdFields);
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "MailInputDialog.Preview"));
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
lsGet = new Listener() {
public void handleEvent(Event e) {
getFields();
}
};
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
public void handleEvent(Event e) {
preview();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wTest.addListener(SWT.Selection, lsTest);
wPreview.addListener(SWT.Selection, lsPreview);
wGet.addListener(SWT.Selection, lsGet);
lsTestIMAPFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(transMeta.environmentSubstitute(wIMAPFolder.getText()));
}
};
wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
lsSelectFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wIMAPFolder);
}
};
wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
wStepname.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setUserProxy();
chooseListMails();
refreshProtocol(false);
conditionReceivedDate();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class JobHistoryDelegate method addJobHistory.
public void addJobHistory() {
//
if (jobGraph.extraViewComposite == null || jobGraph.extraViewComposite.isDisposed()) {
jobGraph.addExtraView();
} else {
if (jobHistoryTab != null && !jobHistoryTab.isDisposed()) {
// just set this one active and get out...
//
jobGraph.extraViewTabFolder.setSelection(jobHistoryTab);
return;
}
}
jobMeta = jobGraph.getManagedObject();
// Add a tab to display the logging history tables...
//
jobHistoryTab = new CTabItem(jobGraph.extraViewTabFolder, SWT.NONE);
jobHistoryTab.setImage(GUIResource.getInstance().getImageShowHistory());
jobHistoryTab.setText(BaseMessages.getString(PKG, "Spoon.TransGraph.HistoryTab.Name"));
// Create a composite, slam everything on there like it was in the history tab.
//
jobHistoryComposite = new Composite(jobGraph.extraViewTabFolder, SWT.NONE);
jobHistoryComposite.setLayout(new FormLayout());
spoon.props.setLook(jobHistoryComposite);
addToolBar();
Control toolbarControl = (Control) toolbar.getManagedObject();
toolbarControl.setLayoutData(new FormData());
FormData fd = new FormData();
// First one in the left top corner
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
toolbarControl.setLayoutData(fd);
toolbarControl.setParent(jobHistoryComposite);
addLogTableTabs();
tabFolder.setSelection(0);
tabFolder.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
setMoreRows(true);
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
}
});
jobHistoryComposite.pack();
jobHistoryTab.setControl(jobHistoryComposite);
jobGraph.extraViewTabFolder.setSelection(jobHistoryTab);
if (!Props.getInstance().disableInitialExecutionHistory()) {
refreshAllHistory();
}
}
Aggregations