use of org.pentaho.di.ui.core.widget.TextVar 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.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class DimensionLookupDialog 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);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
FocusListener lsConnectionFocus = new FocusAdapter() {
public void focusLost(FocusEvent event) {
input.setChanged();
setTableFieldCombo();
}
};
ModifyListener lsTableMod = new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
input.setChanged();
setTableFieldCombo();
}
};
backupChanged = input.hasChanged();
backupUpdate = input.isUpdate();
backupAutoInc = input.isAutoIncrement();
ci = input.getDatabaseMeta();
GridLayout shellLayout = new GridLayout();
shellLayout.numColumns = 1;
shell.setLayout(shellLayout);
shell.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
Composite sCompParent = new Composite(shell, SWT.NONE);
sCompParent.setLayout(new FillLayout(SWT.VERTICAL));
GridData sCompGridData = new GridData(GridData.FILL_BOTH);
sCompGridData.grabExcessHorizontalSpace = true;
sCompGridData.grabExcessVerticalSpace = true;
sCompParent.setLayoutData(sCompGridData);
sComp = new ScrolledComposite(sCompParent, SWT.V_SCROLL | SWT.H_SCROLL);
sComp.setLayout(new FormLayout());
sComp.setExpandHorizontal(true);
sComp.setExpandVertical(true);
helpComp = new Composite(shell, SWT.NONE);
helpComp.setLayout(new FormLayout());
GridData helpCompData = new GridData();
helpCompData.grabExcessHorizontalSpace = true;
helpCompData.grabExcessVerticalSpace = false;
helpComp.setLayoutData(helpCompData);
setShellImage(shell, input);
comp = new Composite(sComp, SWT.NONE);
props.setLook(comp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
comp.setLayout(fileLayout);
// Stepname line
wlStepname = new Label(comp, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.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(comp, 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);
// Update the dimension?
wlUpdate = new Label(comp, SWT.RIGHT);
wlUpdate.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Update.Label"));
props.setLook(wlUpdate);
FormData fdlUpdate = new FormData();
fdlUpdate.left = new FormAttachment(0, 0);
fdlUpdate.right = new FormAttachment(middle, -margin);
fdlUpdate.top = new FormAttachment(wStepname, margin);
wlUpdate.setLayoutData(fdlUpdate);
wUpdate = new Button(comp, SWT.CHECK);
props.setLook(wUpdate);
FormData fdUpdate = new FormData();
fdUpdate.left = new FormAttachment(middle, 0);
fdUpdate.top = new FormAttachment(wStepname, margin);
fdUpdate.right = new FormAttachment(100, 0);
wUpdate.setLayoutData(fdUpdate);
// Clicking on update changes the options in the update combo boxes!
wUpdate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setUpdate(!input.isUpdate());
input.setChanged();
setFlags();
}
});
// Connection line
wConnection = addConnectionLine(comp, wUpdate, middle, margin);
if (input.getDatabaseMeta() == null && transMeta.nrDatabases() == 1) {
wConnection.select(0);
}
// wConnection.addModifyListener(lsConnectionMod);
// wConnection.addSelectionListener(lsSelection);
wConnection.addFocusListener(lsConnectionFocus);
wConnection.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// We have new content: change ci connection:
ci = transMeta.findDatabase(wConnection.getText());
setFlags();
}
});
// Schema line...
wlSchema = new Label(comp, SWT.RIGHT);
wlSchema.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.TargetSchema.Label"));
props.setLook(wlSchema);
FormData fdlSchema = new FormData();
fdlSchema.left = new FormAttachment(0, 0);
fdlSchema.right = new FormAttachment(middle, -margin);
fdlSchema.top = new FormAttachment(wConnection, margin);
wlSchema.setLayoutData(fdlSchema);
wbSchema = new Button(comp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSchema);
wbSchema.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbSchema = new FormData();
fdbSchema.top = new FormAttachment(wConnection, margin);
fdbSchema.right = new FormAttachment(100, 0);
wbSchema.setLayoutData(fdbSchema);
wSchema = new TextVar(transMeta, comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSchema);
wSchema.addModifyListener(lsTableMod);
FormData fdSchema = new FormData();
fdSchema.left = new FormAttachment(middle, 0);
fdSchema.top = new FormAttachment(wConnection, margin);
fdSchema.right = new FormAttachment(wbSchema, -margin);
wSchema.setLayoutData(fdSchema);
// Table line...
wlTable = new Label(comp, SWT.RIGHT);
wlTable.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.TargeTable.Label"));
props.setLook(wlTable);
FormData 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(comp, SWT.PUSH | SWT.CENTER);
props.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Browse.Button"));
FormData fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wbSchema, margin);
wbTable.setLayoutData(fdbTable);
wTable = new TextVar(transMeta, comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTable);
wTable.addModifyListener(lsTableMod);
FormData fdTable = new FormData();
fdTable.left = new FormAttachment(middle, 0);
fdTable.top = new FormAttachment(wbSchema, margin);
fdTable.right = new FormAttachment(wbTable, 0);
wTable.setLayoutData(fdTable);
// Commit size ...
wlCommit = new Label(comp, SWT.RIGHT);
wlCommit.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Commit.Label"));
props.setLook(wlCommit);
FormData fdlCommit = new FormData();
fdlCommit.left = new FormAttachment(0, 0);
fdlCommit.right = new FormAttachment(middle, -margin);
fdlCommit.top = new FormAttachment(wTable, margin);
wlCommit.setLayoutData(fdlCommit);
wCommit = new Text(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wCommit);
wCommit.addModifyListener(lsMod);
FormData fdCommit = new FormData();
fdCommit.left = new FormAttachment(middle, 0);
fdCommit.top = new FormAttachment(wTable, margin);
fdCommit.right = new FormAttachment(100, 0);
wCommit.setLayoutData(fdCommit);
// Use Cache?
wlUseCache = new Label(comp, SWT.RIGHT);
wlUseCache.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.UseCache.Label"));
props.setLook(wlUseCache);
FormData fdlUseCache = new FormData();
fdlUseCache.left = new FormAttachment(0, 0);
fdlUseCache.right = new FormAttachment(middle, -margin);
fdlUseCache.top = new FormAttachment(wCommit, margin);
wlUseCache.setLayoutData(fdlUseCache);
wUseCache = new Button(comp, SWT.CHECK);
props.setLook(wUseCache);
wUseCache.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
setFlags();
input.setChanged();
}
});
FormData fdUseCache = new FormData();
fdUseCache.left = new FormAttachment(middle, 0);
fdUseCache.top = new FormAttachment(wCommit, margin);
fdUseCache.right = new FormAttachment(100, 0);
wUseCache.setLayoutData(fdUseCache);
// Preload cache?
wlPreloadCache = new Label(comp, SWT.RIGHT);
wlPreloadCache.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.PreloadCache.Label"));
props.setLook(wlPreloadCache);
FormData fdlPreloadCache = new FormData();
fdlPreloadCache.left = new FormAttachment(0, 0);
fdlPreloadCache.right = new FormAttachment(middle, -margin);
fdlPreloadCache.top = new FormAttachment(wUseCache, margin);
wlPreloadCache.setLayoutData(fdlPreloadCache);
wPreloadCache = new Button(comp, SWT.CHECK);
props.setLook(wPreloadCache);
wPreloadCache.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
setFlags();
input.setChanged();
}
});
FormData fdPreloadCache = new FormData();
fdPreloadCache.left = new FormAttachment(middle, 0);
fdPreloadCache.top = new FormAttachment(wUseCache, margin);
fdPreloadCache.right = new FormAttachment(100, 0);
wPreloadCache.setLayoutData(fdPreloadCache);
// Cache size ...
wlCacheSize = new Label(comp, SWT.RIGHT);
wlCacheSize.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.CacheSize.Label"));
props.setLook(wlCacheSize);
FormData fdlCacheSize = new FormData();
fdlCacheSize.left = new FormAttachment(0, 0);
fdlCacheSize.right = new FormAttachment(middle, -margin);
fdlCacheSize.top = new FormAttachment(wPreloadCache, margin);
wlCacheSize.setLayoutData(fdlCacheSize);
wCacheSize = new Text(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wCacheSize);
wCacheSize.addModifyListener(lsMod);
FormData fdCacheSize = new FormData();
fdCacheSize.left = new FormAttachment(middle, 0);
fdCacheSize.top = new FormAttachment(wPreloadCache, margin);
fdCacheSize.right = new FormAttachment(100, 0);
wCacheSize.setLayoutData(fdCacheSize);
wlTkRename = new Label(comp, SWT.RIGHT);
wTabFolder = new CTabFolder(comp, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF KEY TAB ///
// /
wKeyTab = new CTabItem(wTabFolder, SWT.NONE);
wKeyTab.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.KeyTab.CTabItem"));
FormLayout keyLayout = new FormLayout();
keyLayout.marginWidth = 3;
keyLayout.marginHeight = 3;
Composite wKeyComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wKeyComp);
wKeyComp.setLayout(keyLayout);
//
// The Lookup fields: usually the key
//
wlKey = new Label(wKeyComp, SWT.NONE);
wlKey.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.KeyFields.Label"));
props.setLook(wlKey);
FormData fdlKey = new FormData();
fdlKey.left = new FormAttachment(0, 0);
fdlKey.top = new FormAttachment(0, margin);
fdlKey.right = new FormAttachment(100, 0);
wlKey.setLayoutData(fdlKey);
int nrKeyCols = 2;
int nrKeyRows = (input.getKeyStream() != null ? input.getKeyStream().length : 1);
ciKey = new ColumnInfo[nrKeyCols];
ciKey[0] = new ColumnInfo(BaseMessages.getString(PKG, "DimensionLookupDialog.ColumnInfo.DimensionField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciKey[1] = new ColumnInfo(BaseMessages.getString(PKG, "DimensionLookupDialog.ColumnInfo.FieldInStream"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
tableFieldColumns.add(ciKey[0]);
wKey = new TableView(transMeta, wKeyComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciKey, nrKeyRows, lsMod, props);
FormData 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(100, 0);
wKey.setLayoutData(fdKey);
fdKeyComp = new FormData();
fdKeyComp.left = new FormAttachment(0, 0);
fdKeyComp.top = new FormAttachment(0, 0);
fdKeyComp.right = new FormAttachment(100, 0);
fdKeyComp.bottom = new FormAttachment(100, 0);
wKeyComp.setLayoutData(fdKeyComp);
wKeyComp.layout();
wKeyTab.setControl(wKeyComp);
// ///////////////////////////////////////////////////////////
// / END OF KEY TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.FieldsTab.CTabItem.Title"));
Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFieldsComp);
FormLayout fieldsCompLayout = new FormLayout();
fieldsCompLayout.marginWidth = Const.FORM_MARGIN;
fieldsCompLayout.marginHeight = Const.FORM_MARGIN;
wFieldsComp.setLayout(fieldsCompLayout);
// THE UPDATE/INSERT TABLE
wlUpIns = new Label(wFieldsComp, SWT.NONE);
wlUpIns.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.UpdateOrInsertFields.Label"));
props.setLook(wlUpIns);
FormData fdlUpIns = new FormData();
fdlUpIns.left = new FormAttachment(0, 0);
fdlUpIns.top = new FormAttachment(0, margin);
wlUpIns.setLayoutData(fdlUpIns);
int UpInsCols = 3;
int UpInsRows = (input.getFieldStream() != null ? input.getFieldStream().length : 1);
ciUpIns = new ColumnInfo[UpInsCols];
ciUpIns[0] = new ColumnInfo(BaseMessages.getString(PKG, "DimensionLookupDialog.ColumnInfo.DimensionField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciUpIns[1] = new ColumnInfo(BaseMessages.getString(PKG, "DimensionLookupDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciUpIns[2] = new ColumnInfo(BaseMessages.getString(PKG, "DimensionLookupDialog.ColumnInfo.TypeOfDimensionUpdate"), ColumnInfo.COLUMN_TYPE_CCOMBO, input.isUpdate() ? DimensionLookupMeta.typeDesc : DimensionLookupMeta.typeDescLookup);
tableFieldColumns.add(ciUpIns[0]);
wUpIns = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciUpIns, UpInsRows, lsMod, props);
FormData fdUpIns = new FormData();
fdUpIns.left = new FormAttachment(0, 0);
fdUpIns.top = new FormAttachment(wlUpIns, margin);
fdUpIns.right = new FormAttachment(100, 0);
fdUpIns.bottom = new FormAttachment(100, 0);
wUpIns.setLayoutData(fdUpIns);
//
// 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();
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(wCacheSize, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.height = 200;
wTabFolder.setLayoutData(fdTabFolder);
// Technical key field:
wlTk = new Label(comp, SWT.RIGHT);
wlTk.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.TechnicalKeyField.Label"));
props.setLook(wlTk);
FormData fdlTk = new FormData();
fdlTk.left = new FormAttachment(0, 0);
fdlTk.right = new FormAttachment(middle, -margin);
fdlTk.top = new FormAttachment(wTabFolder, 2 * margin);
wlTk.setLayoutData(fdlTk);
wTk = new CCombo(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTk);
wTk.addModifyListener(lsMod);
FormData fdTk = new FormData();
fdTk.left = new FormAttachment(middle, 0);
fdTk.top = new FormAttachment(wTabFolder, 2 * margin);
fdTk.right = new FormAttachment(50 + middle / 2, 0);
wTk.setLayoutData(fdTk);
wTk.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);
getFieldsFromTable();
shell.setCursor(null);
busy.dispose();
}
});
wlTkRename.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.NewName.Label"));
props.setLook(wlTkRename);
FormData fdlTkRename = new FormData();
fdlTkRename.left = new FormAttachment(50 + middle / 2, margin);
fdlTkRename.top = new FormAttachment(wTabFolder, 2 * margin);
wlTkRename.setLayoutData(fdlTkRename);
wTkRename = new Text(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTkRename);
wTkRename.addModifyListener(lsMod);
FormData fdTkRename = new FormData();
fdTkRename.left = new FormAttachment(wlTkRename, margin);
fdTkRename.top = new FormAttachment(wTabFolder, 2 * margin);
fdTkRename.right = new FormAttachment(100, 0);
wTkRename.setLayoutData(fdTkRename);
// //////////////////////////////////////////////////
// The key creation box
// //////////////////////////////////////////////////
gTechGroup = new Group(comp, SWT.SHADOW_ETCHED_IN);
gTechGroup.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.TechGroup.Label"));
GridLayout gridLayout = new GridLayout(3, false);
gTechGroup.setLayout(gridLayout);
FormData fdTechGroup = new FormData();
fdTechGroup.left = new FormAttachment(middle, 0);
fdTechGroup.top = new FormAttachment(wTkRename, 2 * margin);
fdTechGroup.right = new FormAttachment(100, 0);
// the default looks ugly
gTechGroup.setBackground(shell.getBackground());
gTechGroup.setLayoutData(fdTechGroup);
// Use maximum of table + 1
wTableMax = new Button(gTechGroup, SWT.RADIO);
props.setLook(wTableMax);
wTableMax.setSelection(false);
GridData gdTableMax = new GridData();
wTableMax.setLayoutData(gdTableMax);
wTableMax.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.TableMaximum.Tooltip", Const.CR));
wlTableMax = new Label(gTechGroup, SWT.LEFT);
wlTableMax.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.TableMaximum.Label"));
props.setLook(wlTableMax);
GridData gdlTableMax = new GridData(GridData.FILL_BOTH);
gdlTableMax.horizontalSpan = 2;
gdlTableMax.verticalSpan = 1;
wlTableMax.setLayoutData(gdlTableMax);
// Sequence Check Button
wSeqButton = new Button(gTechGroup, SWT.RADIO);
props.setLook(wSeqButton);
wSeqButton.setSelection(false);
GridData gdSeqButton = new GridData();
wSeqButton.setLayoutData(gdSeqButton);
wSeqButton.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.Sequence.Tooltip", Const.CR));
wlSeqButton = new Label(gTechGroup, SWT.LEFT);
wlSeqButton.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Sequence.Label"));
props.setLook(wlSeqButton);
GridData gdlSeqButton = new GridData();
wlSeqButton.setLayoutData(gdlSeqButton);
wSeq = new Text(gTechGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSeq);
wSeq.addModifyListener(lsMod);
GridData gdSeq = new GridData(GridData.FILL_HORIZONTAL);
wSeq.setLayoutData(gdSeq);
wSeq.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent arg0) {
input.setTechKeyCreation(DimensionLookupMeta.CREATION_METHOD_SEQUENCE);
wSeqButton.setSelection(true);
wAutoinc.setSelection(false);
wTableMax.setSelection(false);
}
public void focusLost(FocusEvent arg0) {
}
});
// Use an autoincrement field?
wAutoinc = new Button(gTechGroup, SWT.RADIO);
props.setLook(wAutoinc);
wAutoinc.setSelection(false);
GridData gdAutoinc = new GridData();
wAutoinc.setLayoutData(gdAutoinc);
wAutoinc.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.AutoincButton.Tooltip", Const.CR));
wlAutoinc = new Label(gTechGroup, SWT.LEFT);
wlAutoinc.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Autoincrement.Label"));
props.setLook(wlAutoinc);
GridData gdlAutoinc = new GridData();
wlAutoinc.setLayoutData(gdlAutoinc);
// //////////////////////////////////////////////////
// The key creation box END
// //////////////////////////////////////////////////
// Version key field:
wlVersion = new Label(comp, SWT.RIGHT);
wlVersion.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Version.Label"));
props.setLook(wlVersion);
FormData fdlVersion = new FormData();
fdlVersion.left = new FormAttachment(0, 0);
fdlVersion.right = new FormAttachment(middle, -margin);
fdlVersion.top = new FormAttachment(gTechGroup, 2 * margin);
wlVersion.setLayoutData(fdlVersion);
wVersion = new CCombo(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wVersion);
wVersion.addModifyListener(lsMod);
FormData fdVersion = new FormData();
fdVersion.left = new FormAttachment(middle, 0);
fdVersion.top = new FormAttachment(gTechGroup, 2 * margin);
fdVersion.right = new FormAttachment(100, 0);
wVersion.setLayoutData(fdVersion);
wVersion.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);
getFieldsFromTable();
shell.setCursor(null);
busy.dispose();
}
});
// Datefield line
wlDatefield = new Label(comp, SWT.RIGHT);
wlDatefield.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Datefield.Label"));
props.setLook(wlDatefield);
FormData fdlDatefield = new FormData();
fdlDatefield.left = new FormAttachment(0, 0);
fdlDatefield.right = new FormAttachment(middle, -margin);
fdlDatefield.top = new FormAttachment(wVersion, 2 * margin);
wlDatefield.setLayoutData(fdlDatefield);
wDatefield = new CCombo(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wDatefield);
wDatefield.addModifyListener(lsMod);
FormData fdDatefield = new FormData();
fdDatefield.left = new FormAttachment(middle, 0);
fdDatefield.top = new FormAttachment(wVersion, 2 * margin);
fdDatefield.right = new FormAttachment(100, 0);
wDatefield.setLayoutData(fdDatefield);
wDatefield.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
getFields();
shell.setCursor(null);
busy.dispose();
}
});
// Fromdate line
//
// 0 [wlFromdate] middle [wFromdate] (100-middle)/3 [wlMinyear]
// 2*(100-middle)/3 [wMinyear] 100%
//
wlFromdate = new Label(comp, SWT.RIGHT);
wlFromdate.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Fromdate.Label"));
props.setLook(wlFromdate);
FormData fdlFromdate = new FormData();
fdlFromdate.left = new FormAttachment(0, 0);
fdlFromdate.right = new FormAttachment(middle, -margin);
fdlFromdate.top = new FormAttachment(wDatefield, 2 * margin);
wlFromdate.setLayoutData(fdlFromdate);
wFromdate = new CCombo(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFromdate);
wFromdate.addModifyListener(lsMod);
FormData fdFromdate = new FormData();
fdFromdate.left = new FormAttachment(middle, 0);
fdFromdate.right = new FormAttachment(middle + (100 - middle) / 3, -margin);
fdFromdate.top = new FormAttachment(wDatefield, 2 * margin);
wFromdate.setLayoutData(fdFromdate);
wFromdate.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);
getFieldsFromTable();
shell.setCursor(null);
busy.dispose();
}
});
// Minyear line
wlMinyear = new Label(comp, SWT.RIGHT);
wlMinyear.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Minyear.Label"));
props.setLook(wlMinyear);
FormData fdlMinyear = new FormData();
fdlMinyear.left = new FormAttachment(wFromdate, margin);
fdlMinyear.right = new FormAttachment(middle + 2 * (100 - middle) / 3, -margin);
fdlMinyear.top = new FormAttachment(wDatefield, 2 * margin);
wlMinyear.setLayoutData(fdlMinyear);
wMinyear = new Text(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMinyear);
wMinyear.addModifyListener(lsMod);
FormData fdMinyear = new FormData();
fdMinyear.left = new FormAttachment(wlMinyear, margin);
fdMinyear.right = new FormAttachment(100, 0);
fdMinyear.top = new FormAttachment(wDatefield, 2 * margin);
wMinyear.setLayoutData(fdMinyear);
wMinyear.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.Minyear.ToolTip"));
// Add a line with an option to specify an alternative start date...
//
wlUseAltStartDate = new Label(comp, SWT.RIGHT);
wlUseAltStartDate.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.UseAlternativeStartDate.Label"));
props.setLook(wlUseAltStartDate);
FormData fdlUseAltStartDate = new FormData();
fdlUseAltStartDate.left = new FormAttachment(0, 0);
fdlUseAltStartDate.right = new FormAttachment(middle, -margin);
fdlUseAltStartDate.top = new FormAttachment(wFromdate, margin);
wlUseAltStartDate.setLayoutData(fdlUseAltStartDate);
wUseAltStartDate = new Button(comp, SWT.CHECK);
props.setLook(wUseAltStartDate);
wUseAltStartDate.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.UseAlternativeStartDate.Tooltip", Const.CR));
FormData fdUseAltStartDate = new FormData();
fdUseAltStartDate.left = new FormAttachment(middle, 0);
fdUseAltStartDate.top = new FormAttachment(wFromdate, margin);
wUseAltStartDate.setLayoutData(fdUseAltStartDate);
wUseAltStartDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setFlags();
input.setChanged();
}
});
// The choice...
//
wAltStartDate = new CCombo(comp, SWT.BORDER);
props.setLook(wAltStartDate);
// All options except for "No alternative"...
wAltStartDate.removeAll();
for (int i = 1; i < DimensionLookupMeta.getStartDateAlternativeDescriptions().length; i++) {
wAltStartDate.add(DimensionLookupMeta.getStartDateAlternativeDescriptions()[i]);
}
wAltStartDate.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.AlternativeStartDate.SelectItemDefault"));
wAltStartDate.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.AlternativeStartDate.Tooltip", Const.CR));
FormData fdAltStartDate = new FormData();
fdAltStartDate.left = new FormAttachment(wUseAltStartDate, 2 * margin);
fdAltStartDate.right = new FormAttachment(wUseAltStartDate, 200);
fdAltStartDate.top = new FormAttachment(wFromdate, margin);
wAltStartDate.setLayoutData(fdAltStartDate);
wAltStartDate.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
setFlags();
input.setChanged();
}
});
wAltStartDateField = new CCombo(comp, SWT.SINGLE | SWT.BORDER);
props.setLook(wAltStartDateField);
wAltStartDateField.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.AlternativeStartDateField.Tooltip", Const.CR));
FormData fdAltStartDateField = new FormData();
fdAltStartDateField.left = new FormAttachment(wAltStartDate, 2 * margin);
fdAltStartDateField.right = new FormAttachment(100, 0);
fdAltStartDateField.top = new FormAttachment(wFromdate, margin);
wAltStartDateField.setLayoutData(fdAltStartDateField);
wAltStartDateField.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);
getFieldsFromTable();
shell.setCursor(null);
busy.dispose();
}
});
// Todate line
wlTodate = new Label(comp, SWT.RIGHT);
wlTodate.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Todate.Label"));
props.setLook(wlTodate);
FormData fdlTodate = new FormData();
fdlTodate.left = new FormAttachment(0, 0);
fdlTodate.right = new FormAttachment(middle, -margin);
fdlTodate.top = new FormAttachment(wAltStartDate, margin);
wlTodate.setLayoutData(fdlTodate);
wTodate = new CCombo(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTodate);
wTodate.addModifyListener(lsMod);
FormData fdTodate = new FormData();
fdTodate.left = new FormAttachment(middle, 0);
fdTodate.right = new FormAttachment(middle + (100 - middle) / 3, -margin);
fdTodate.top = new FormAttachment(wAltStartDate, margin);
wTodate.setLayoutData(fdTodate);
wTodate.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);
getFieldsFromTable();
shell.setCursor(null);
busy.dispose();
}
});
// Maxyear line
wlMaxyear = new Label(comp, SWT.RIGHT);
wlMaxyear.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.Maxyear.Label"));
props.setLook(wlMaxyear);
FormData fdlMaxyear = new FormData();
fdlMaxyear.left = new FormAttachment(wTodate, margin);
fdlMaxyear.right = new FormAttachment(middle + 2 * (100 - middle) / 3, -margin);
fdlMaxyear.top = new FormAttachment(wAltStartDate, margin);
wlMaxyear.setLayoutData(fdlMaxyear);
wMaxyear = new Text(comp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMaxyear);
wMaxyear.addModifyListener(lsMod);
FormData fdMaxyear = new FormData();
fdMaxyear.left = new FormAttachment(wlMaxyear, margin);
fdMaxyear.right = new FormAttachment(100, 0);
fdMaxyear.top = new FormAttachment(wAltStartDate, margin);
wMaxyear.setLayoutData(fdMaxyear);
wMaxyear.setToolTipText(BaseMessages.getString(PKG, "DimensionLookupDialog.Maxyear.ToolTip"));
// THE BOTTOM BUTTONS
wOK = new Button(comp, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wGet = new Button(comp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.GetFields.Button"));
wCreate = new Button(comp, SWT.PUSH);
wCreate.setText(BaseMessages.getString(PKG, "DimensionLookupDialog.SQL.Button"));
wCancel = new Button(comp, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel, wGet, wCreate }, margin, wMaxyear);
FormData fdComp = new FormData();
fdComp.left = new FormAttachment(0, 0);
fdComp.top = new FormAttachment(0, 0);
fdComp.right = new FormAttachment(100, 0);
fdComp.bottom = new FormAttachment(100, 0);
comp.setLayoutData(fdComp);
comp.pack();
Rectangle bounds = comp.getBounds();
sComp.setContent(comp);
sComp.setExpandHorizontal(true);
sComp.setExpandVertical(true);
sComp.setMinWidth(bounds.width);
sComp.setMinHeight(bounds.height);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsCreate = new Listener() {
public void handleEvent(Event e) {
create();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wCreate.addListener(SWT.Selection, lsCreate);
wCancel.addListener(SWT.Selection, lsCancel);
setTableMax();
setSequence();
setAutoincUse();
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wSchema.addSelectionListener(lsDef);
wTable.addSelectionListener(lsDef);
wCommit.addSelectionListener(lsDef);
wCacheSize.addSelectionListener(lsDef);
wTk.addSelectionListener(lsDef);
wTkRename.addSelectionListener(lsDef);
wSeq.addSelectionListener(lsDef);
wVersion.addSelectionListener(lsDef);
wDatefield.addSelectionListener(lsDef);
wFromdate.addSelectionListener(lsDef);
wMinyear.addSelectionListener(lsDef);
wTodate.addSelectionListener(lsDef);
wMaxyear.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();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
setTableFieldCombo();
input.setChanged(backupChanged);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class Edi2XmlDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "Edi2Xml.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.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);
// edifact field line
Label wlEdiField = new Label(shell, SWT.RIGHT);
wlEdiField.setText(BaseMessages.getString(PKG, "Edi2Xml.InputField.Label"));
props.setLook(wlEdiField);
FormData fdlEdiField = new FormData();
fdlEdiField.left = new FormAttachment(0, 0);
fdlEdiField.right = new FormAttachment(middle, -margin);
fdlEdiField.top = new FormAttachment(wStepname, margin);
wlEdiField.setLayoutData(fdlEdiField);
wEdiField = new ComboVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wEdiField.setToolTipText(BaseMessages.getString(PKG, "Edi2Xml.InputField.Tooltip"));
props.setLook(wEdiField);
wEdiField.addModifyListener(lsMod);
FormData fdEdiField = new FormData();
fdEdiField.left = new FormAttachment(middle, 0);
fdEdiField.top = new FormAttachment(wStepname, margin);
fdEdiField.right = new FormAttachment(100, 0);
wEdiField.setLayoutData(fdEdiField);
wEdiField.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);
BaseStepDialog.getFieldsFromPrevious(wEdiField, transMeta, stepMeta);
shell.setCursor(null);
busy.dispose();
}
});
// xml output field value
wlXmlField = new Label(shell, SWT.RIGHT);
wlXmlField.setText(BaseMessages.getString(PKG, "Edi2Xml.OutputField.Label"));
props.setLook(wlXmlField);
fdlXmlField = new FormData();
fdlXmlField.left = new FormAttachment(0, 0);
fdlXmlField.right = new FormAttachment(middle, -margin);
fdlXmlField.top = new FormAttachment(wEdiField, margin);
wlXmlField.setLayoutData(fdlXmlField);
wXmlField = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wXmlField);
wXmlField.setToolTipText(BaseMessages.getString(PKG, "Edi2Xml.OutputField.Tooltip"));
wXmlField.addModifyListener(lsMod);
fdXmlField = new FormData();
fdXmlField.left = new FormAttachment(middle, 0);
fdXmlField.right = new FormAttachment(100, 0);
fdXmlField.top = new FormAttachment(wEdiField, margin);
wXmlField.setLayoutData(fdXmlField);
// OK and cancel 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"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wXmlField);
// 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);
wXmlField.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.TextVar 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.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class MappingDialog 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, mappingMeta);
lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
mappingMeta.setChanged();
}
};
changed = mappingMeta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 15;
formLayout.marginHeight = 15;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "MappingDialog.Shell.Title"));
Label wicon = new Label(shell, SWT.RIGHT);
wicon.setImage(getImage());
FormData fdlicon = new FormData();
fdlicon.top = new FormAttachment(0, 0);
fdlicon.right = new FormAttachment(100, 0);
wicon.setLayoutData(fdlicon);
props.setLook(wicon);
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "MappingDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, 0);
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.width = 250;
fdStepname.left = new FormAttachment(0, 0);
fdStepname.top = new FormAttachment(wlStepname, 5);
wStepname.setLayoutData(fdStepname);
Label spacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdSpacer = new FormData();
fdSpacer.left = new FormAttachment(0, 0);
fdSpacer.top = new FormAttachment(wStepname, 15);
fdSpacer.right = new FormAttachment(100, 0);
spacer.setLayoutData(fdSpacer);
wlPath = new Label(shell, SWT.LEFT);
props.setLook(wlPath);
wlPath.setText(BaseMessages.getString(PKG, "MappingDialog.Transformation.Label"));
FormData fdlTransformation = new FormData();
fdlTransformation.left = new FormAttachment(0, 0);
fdlTransformation.top = new FormAttachment(spacer, 20);
fdlTransformation.right = new FormAttachment(50, 0);
wlPath.setLayoutData(fdlTransformation);
wPath = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPath);
FormData fdTransformation = new FormData();
fdTransformation.left = new FormAttachment(0, 0);
fdTransformation.top = new FormAttachment(wlPath, 5);
fdTransformation.width = 350;
wPath.setLayoutData(fdTransformation);
wbBrowse = new Button(shell, SWT.PUSH);
props.setLook(wbBrowse);
wbBrowse.setText(BaseMessages.getString(PKG, "MappingDialog.Browse.Label"));
FormData fdBrowse = new FormData();
fdBrowse.left = new FormAttachment(wPath, 5);
fdBrowse.top = new FormAttachment(wlPath, Const.isOSX() ? 0 : 5);
wbBrowse.setLayoutData(fdBrowse);
wbBrowse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (repository != null) {
selectRepositoryTrans();
} else {
selectFileTrans();
}
}
});
//
// Add a tab folder for the parameters and various input and output
// streams
//
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
wTabFolder.setSimple(false);
wTabFolder.setUnselectedCloseVisible(true);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
FormData fdCancel = new FormData();
fdCancel.right = new FormAttachment(100, 0);
fdCancel.bottom = new FormAttachment(100, 0);
wCancel.setLayoutData(fdCancel);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
FormData fdOk = new FormData();
fdOk.right = new FormAttachment(wCancel, -5);
fdOk.bottom = new FormAttachment(100, 0);
wOK.setLayoutData(fdOk);
Label hSpacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdhSpacer = new FormData();
fdhSpacer.left = new FormAttachment(0, 0);
fdhSpacer.bottom = new FormAttachment(wCancel, -15);
fdhSpacer.right = new FormAttachment(100, 0);
hSpacer.setLayoutData(fdhSpacer);
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wPath, 20);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(hSpacer, -15);
wTabFolder.setLayoutData(fdTabFolder);
// 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);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize(shell, 670, 690);
getData();
mappingMeta.setChanged(changed);
wTabFolder.setSelection(0);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations