use of org.pentaho.di.ui.core.events.dialog.SelectionAdapterOptions in project pentaho-kettle by pentaho.
the class JobEntryMssqlBulkLoadDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
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, "JobMssqlBulkLoad.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);
// Filename line
wlName = new Label(wGeneralComp, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// ///////////////////////////////
// START OF ConnectionGroup GROUP///
// /////////////////////////////////
wConnectionGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wConnectionGroup);
wConnectionGroup.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.ConnectionGroup.Group.Label"));
FormLayout ConnectionGroupLayout = new FormLayout();
ConnectionGroupLayout.marginWidth = 10;
ConnectionGroupLayout.marginHeight = 10;
wConnectionGroup.setLayout(ConnectionGroupLayout);
// Connection line
wConnection = addConnectionLine(wConnectionGroup, wName, middle, margin);
if (jobEntry.getDatabase() == null && jobMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
// Schema name line
wlSchemaname = new Label(wConnectionGroup, SWT.RIGHT);
wlSchemaname.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Schemaname.Label"));
props.setLook(wlSchemaname);
fdlSchemaname = new FormData();
fdlSchemaname.left = new FormAttachment(0, 0);
fdlSchemaname.right = new FormAttachment(middle, 0);
fdlSchemaname.top = new FormAttachment(wConnection, margin);
wlSchemaname.setLayoutData(fdlSchemaname);
wSchemaname = new TextVar(jobMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSchemaname);
wSchemaname.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Schemaname.Tooltip"));
wSchemaname.addModifyListener(lsMod);
fdSchemaname = new FormData();
fdSchemaname.left = new FormAttachment(middle, 0);
fdSchemaname.top = new FormAttachment(wConnection, margin);
fdSchemaname.right = new FormAttachment(100, 0);
wSchemaname.setLayoutData(fdSchemaname);
// Table name line
wlTablename = new Label(wConnectionGroup, SWT.RIGHT);
wlTablename.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Tablename.Label"));
props.setLook(wlTablename);
fdlTablename = new FormData();
fdlTablename.left = new FormAttachment(0, 0);
fdlTablename.right = new FormAttachment(middle, 0);
fdlTablename.top = new FormAttachment(wSchemaname, margin);
wlTablename.setLayoutData(fdlTablename);
wbTable = new Button(wConnectionGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
FormData fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wSchemaname, margin / 2);
wbTable.setLayoutData(fdbTable);
wbTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getTableName();
}
});
wTablename = new TextVar(jobMeta, wConnectionGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTablename);
wTablename.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Tablename.Tooltip"));
wTablename.addModifyListener(lsMod);
fdTablename = new FormData();
fdTablename.left = new FormAttachment(middle, 0);
fdTablename.top = new FormAttachment(wSchemaname, margin);
fdTablename.right = new FormAttachment(wbTable, -margin);
wTablename.setLayoutData(fdTablename);
// Truncate table
wlTruncate = new Label(wConnectionGroup, SWT.RIGHT);
wlTruncate.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Truncate.Label"));
props.setLook(wlTruncate);
fdlTruncate = new FormData();
fdlTruncate.left = new FormAttachment(0, 0);
fdlTruncate.top = new FormAttachment(wTablename, margin);
fdlTruncate.right = new FormAttachment(middle, -margin);
wlTruncate.setLayoutData(fdlTruncate);
wTruncate = new Button(wConnectionGroup, SWT.CHECK);
props.setLook(wTruncate);
wTruncate.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Truncate.Tooltip"));
fdTruncate = new FormData();
fdTruncate.left = new FormAttachment(middle, 0);
fdTruncate.top = new FormAttachment(wTablename, margin);
fdTruncate.right = new FormAttachment(100, 0);
wTruncate.setLayoutData(fdTruncate);
wTruncate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, margin);
fdConnectionGroup.top = new FormAttachment(wName, margin);
fdConnectionGroup.right = new FormAttachment(100, -margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// ///////////////////////////////////////////////////////////
// / END OF ConnectionGroup GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF DataFileGroup GROUP///
// ///////////////////////////////
wDataFileGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wDataFileGroup);
wDataFileGroup.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.DataFileGroup.Group.Label"));
FormLayout DataFileGroupLayout = new FormLayout();
DataFileGroupLayout.marginWidth = 10;
DataFileGroupLayout.marginHeight = 10;
wDataFileGroup.setLayout(DataFileGroupLayout);
// Filename line
wlFilename = new Label(wDataFileGroup, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wConnectionGroup, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(wDataFileGroup, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wConnectionGroup, 0);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(jobMeta, wDataFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Filename.Tooltip"));
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(wConnectionGroup, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapterFileDialogTextVar(log, wFilename, jobMeta, new SelectionAdapterOptions(SelectionOperation.FILE, new FilterType[] { FilterType.TXT, FilterType.CSV, FilterType.DAT, FilterType.ALL }, FilterType.TXT, new ProviderFilterType[] { ProviderFilterType.LOCAL })));
// Data file type
wlDataFiletype = new Label(wDataFileGroup, SWT.RIGHT);
wlDataFiletype.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.DataFiletype.Label"));
props.setLook(wlDataFiletype);
fdlDataFiletype = new FormData();
fdlDataFiletype.left = new FormAttachment(0, 0);
fdlDataFiletype.right = new FormAttachment(middle, 0);
fdlDataFiletype.top = new FormAttachment(wFilename, margin);
wlDataFiletype.setLayoutData(fdlDataFiletype);
wDataFiletype = new CCombo(wDataFileGroup, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wDataFiletype.add("char");
wDataFiletype.add("native");
wDataFiletype.add("widechar");
wDataFiletype.add("widenative");
// +1: starts at -1
wDataFiletype.select(0);
props.setLook(wDataFiletype);
fdDataFiletype = new FormData();
fdDataFiletype.left = new FormAttachment(middle, 0);
fdDataFiletype.top = new FormAttachment(wFilename, margin);
fdDataFiletype.right = new FormAttachment(100, 0);
wDataFiletype.setLayoutData(fdDataFiletype);
wDataFiletype.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setDataType();
}
});
fdDataFileGroup = new FormData();
fdDataFileGroup.left = new FormAttachment(0, margin);
fdDataFileGroup.top = new FormAttachment(wConnectionGroup, margin);
fdDataFileGroup.right = new FormAttachment(100, -margin);
wDataFileGroup.setLayoutData(fdDataFileGroup);
// ///////////////////////////////////////////////////////////
// / END OF DataFileGroup GROUP
// ///////////////////////////////////////////////////////////
// FieldTerminator
wlFieldTerminator = new Label(wGeneralComp, SWT.RIGHT);
wlFieldTerminator.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FieldTerminator.Label"));
props.setLook(wlFieldTerminator);
fdlFieldTerminator = new FormData();
fdlFieldTerminator.left = new FormAttachment(0, 0);
fdlFieldTerminator.right = new FormAttachment(middle, 0);
fdlFieldTerminator.top = new FormAttachment(wDataFileGroup, 3 * margin);
wlFieldTerminator.setLayoutData(fdlFieldTerminator);
wFieldTerminator = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFieldTerminator);
wFieldTerminator.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FieldTerminator.Tooltip"));
wFieldTerminator.addModifyListener(lsMod);
fdFieldTerminator = new FormData();
fdFieldTerminator.left = new FormAttachment(middle, 0);
fdFieldTerminator.top = new FormAttachment(wDataFileGroup, 3 * margin);
fdFieldTerminator.right = new FormAttachment(100, 0);
wFieldTerminator.setLayoutData(fdFieldTerminator);
// Line terminated
wlLineterminated = new Label(wGeneralComp, SWT.RIGHT);
wlLineterminated.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Lineterminated.Label"));
props.setLook(wlLineterminated);
fdlLineterminated = new FormData();
fdlLineterminated.left = new FormAttachment(0, 0);
fdlLineterminated.right = new FormAttachment(middle, 0);
fdlLineterminated.top = new FormAttachment(wFieldTerminator, margin);
wlLineterminated.setLayoutData(fdlLineterminated);
wLineterminated = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLineterminated);
wLineterminated.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Lineterminated.Tooltip"));
wLineterminated.addModifyListener(lsMod);
fdLineterminated = new FormData();
fdLineterminated.left = new FormAttachment(middle, 0);
fdLineterminated.top = new FormAttachment(wFieldTerminator, margin);
fdLineterminated.right = new FormAttachment(100, 0);
wLineterminated.setLayoutData(fdLineterminated);
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(500, -margin);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ////////////////////////
// END OF GENERAL TAB ///
// ////////////////////////
// ////////////////////////////////////
// START OF Advanced TAB ///
// ///////////////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Tab.Advanced.Label"));
FormLayout AdvancedLayout = new FormLayout();
AdvancedLayout.marginWidth = 3;
AdvancedLayout.marginHeight = 3;
wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdvancedComp);
wAdvancedComp.setLayout(AdvancedLayout);
// CodePage
wlCodePage = new Label(wAdvancedComp, SWT.RIGHT);
wlCodePage.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.CodePage.Label"));
props.setLook(wlCodePage);
fdlCodePage = new FormData();
fdlCodePage.left = new FormAttachment(0, 0);
fdlCodePage.right = new FormAttachment(middle, 0);
fdlCodePage.top = new FormAttachment(0, margin);
wlCodePage.setLayoutData(fdlCodePage);
wCodePage = new CCombo(wAdvancedComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wCodePage.add("ACP");
wCodePage.add("OEM");
wCodePage.add("RAW");
wCodePage.add(BaseMessages.getString(PKG, "JobMssqlBulkLoad.CodePage.Specific"));
// +1: starts at -1
wCodePage.select(0);
props.setLook(wCodePage);
fdCodePage = new FormData();
fdCodePage.left = new FormAttachment(middle, 0);
fdCodePage.top = new FormAttachment(0, margin);
fdCodePage.right = new FormAttachment(100, 0);
wCodePage.setLayoutData(fdCodePage);
wCodePage.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setCodeType();
}
});
// Specific CodePage
wlSpecificCodePage = new Label(wAdvancedComp, SWT.RIGHT);
wlSpecificCodePage.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.SpecificCodePage.Label"));
props.setLook(wlSpecificCodePage);
fdlSpecificCodePage = new FormData();
fdlSpecificCodePage.left = new FormAttachment(0, 0);
fdlSpecificCodePage.right = new FormAttachment(middle, 0);
fdlSpecificCodePage.top = new FormAttachment(wCodePage, margin);
wlSpecificCodePage.setLayoutData(fdlSpecificCodePage);
wSpecificCodePage = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSpecificCodePage);
wSpecificCodePage.addModifyListener(lsMod);
fdSpecificCodePage = new FormData();
fdSpecificCodePage.left = new FormAttachment(middle, 0);
fdSpecificCodePage.top = new FormAttachment(wCodePage, margin);
fdSpecificCodePage.right = new FormAttachment(100, 0);
wSpecificCodePage.setLayoutData(fdSpecificCodePage);
// FormatFilename line
wlFormatFilename = new Label(wAdvancedComp, SWT.RIGHT);
wlFormatFilename.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FormatFilename.Label"));
props.setLook(wlFormatFilename);
fdlFormatFilename = new FormData();
fdlFormatFilename.left = new FormAttachment(0, 0);
fdlFormatFilename.top = new FormAttachment(wSpecificCodePage, margin);
fdlFormatFilename.right = new FormAttachment(middle, -margin);
wlFormatFilename.setLayoutData(fdlFormatFilename);
wbFormatFilename = new Button(wAdvancedComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbFormatFilename);
wbFormatFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFormatFilename = new FormData();
fdbFormatFilename.right = new FormAttachment(100, 0);
fdbFormatFilename.top = new FormAttachment(wSpecificCodePage, 0);
wbFormatFilename.setLayoutData(fdbFormatFilename);
wFormatFilename = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFormatFilename);
wFormatFilename.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FormatFilename.Tooltip"));
wFormatFilename.addModifyListener(lsMod);
fdFormatFilename = new FormData();
fdFormatFilename.left = new FormAttachment(middle, 0);
fdFormatFilename.top = new FormAttachment(wSpecificCodePage, margin);
fdFormatFilename.right = new FormAttachment(wbFormatFilename, -margin);
wFormatFilename.setLayoutData(fdFormatFilename);
// Whenever something changes, set the tooltip to the expanded version:
wFormatFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFormatFilename.setToolTipText(jobMeta.environmentSubstitute(wFormatFilename.getText()));
}
});
wbFormatFilename.addSelectionListener(new SelectionAdapterFileDialogTextVar(log, wFormatFilename, jobMeta, new SelectionAdapterOptions(SelectionOperation.FILE, new FilterType[] { FilterType.TXT, FilterType.CSV, FilterType.ALL }, FilterType.TXT, new ProviderFilterType[] { ProviderFilterType.LOCAL })));
// Fire Triggers?
wlFireTriggers = new Label(wAdvancedComp, SWT.RIGHT);
wlFireTriggers.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FireTriggers.Label"));
props.setLook(wlFireTriggers);
fdlFireTriggers = new FormData();
fdlFireTriggers.left = new FormAttachment(0, 0);
fdlFireTriggers.top = new FormAttachment(wFormatFilename, margin);
fdlFireTriggers.right = new FormAttachment(middle, -margin);
wlFireTriggers.setLayoutData(fdlFireTriggers);
wFireTriggers = new Button(wAdvancedComp, SWT.CHECK);
props.setLook(wFireTriggers);
wFireTriggers.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FireTriggers.Tooltip"));
fdFireTriggers = new FormData();
fdFireTriggers.left = new FormAttachment(middle, 0);
fdFireTriggers.top = new FormAttachment(wFormatFilename, margin);
fdFireTriggers.right = new FormAttachment(100, 0);
wFireTriggers.setLayoutData(fdFireTriggers);
wFireTriggers.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// CHECK CONSTRAINTS
wlCheckConstraints = new Label(wAdvancedComp, SWT.RIGHT);
wlCheckConstraints.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.CheckConstraints.Label"));
props.setLook(wlCheckConstraints);
fdlCheckConstraints = new FormData();
fdlCheckConstraints.left = new FormAttachment(0, 0);
fdlCheckConstraints.top = new FormAttachment(wFireTriggers, margin);
fdlCheckConstraints.right = new FormAttachment(middle, -margin);
wlCheckConstraints.setLayoutData(fdlCheckConstraints);
wCheckConstraints = new Button(wAdvancedComp, SWT.CHECK);
props.setLook(wCheckConstraints);
wCheckConstraints.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.CheckConstraints.Tooltip"));
fdCheckConstraints = new FormData();
fdCheckConstraints.left = new FormAttachment(middle, 0);
fdCheckConstraints.top = new FormAttachment(wFireTriggers, margin);
fdCheckConstraints.right = new FormAttachment(100, 0);
wCheckConstraints.setLayoutData(fdCheckConstraints);
wCheckConstraints.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Keep Nulls
wlKeepNulls = new Label(wAdvancedComp, SWT.RIGHT);
wlKeepNulls.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.KeepNulls.Label"));
props.setLook(wlKeepNulls);
fdlKeepNulls = new FormData();
fdlKeepNulls.left = new FormAttachment(0, 0);
fdlKeepNulls.top = new FormAttachment(wCheckConstraints, margin);
fdlKeepNulls.right = new FormAttachment(middle, -margin);
wlKeepNulls.setLayoutData(fdlKeepNulls);
wKeepNulls = new Button(wAdvancedComp, SWT.CHECK);
props.setLook(wKeepNulls);
wKeepNulls.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.KeepNulls.Tooltip"));
fdKeepNulls = new FormData();
fdKeepNulls.left = new FormAttachment(middle, 0);
fdKeepNulls.top = new FormAttachment(wCheckConstraints, margin);
fdKeepNulls.right = new FormAttachment(100, 0);
wKeepNulls.setLayoutData(fdKeepNulls);
wKeepNulls.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Keep Identity
wlKeepIdentity = new Label(wAdvancedComp, SWT.RIGHT);
wlKeepIdentity.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.KeepIdentity.Label"));
props.setLook(wlKeepIdentity);
fdlKeepIdentity = new FormData();
fdlKeepIdentity.left = new FormAttachment(0, 0);
fdlKeepIdentity.top = new FormAttachment(wKeepNulls, margin);
fdlKeepIdentity.right = new FormAttachment(middle, -margin);
wlKeepIdentity.setLayoutData(fdlKeepIdentity);
wKeepIdentity = new Button(wAdvancedComp, SWT.CHECK);
props.setLook(wKeepIdentity);
wKeepIdentity.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.KeepIdentity.Tooltip"));
fdKeepIdentity = new FormData();
fdKeepIdentity.left = new FormAttachment(middle, 0);
fdKeepIdentity.top = new FormAttachment(wKeepNulls, margin);
fdKeepIdentity.right = new FormAttachment(100, 0);
wKeepIdentity.setLayoutData(fdKeepIdentity);
wKeepIdentity.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// TABBLOCK
wlTablock = new Label(wAdvancedComp, SWT.RIGHT);
wlTablock.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Tablock.Label"));
props.setLook(wlTablock);
fdlTablock = new FormData();
fdlTablock.left = new FormAttachment(0, 0);
fdlTablock.top = new FormAttachment(wKeepIdentity, margin);
fdlTablock.right = new FormAttachment(middle, -margin);
wlTablock.setLayoutData(fdlTablock);
wTablock = new Button(wAdvancedComp, SWT.CHECK);
props.setLook(wTablock);
wTablock.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.Tablock.Tooltip"));
fdTablock = new FormData();
fdTablock.left = new FormAttachment(middle, 0);
fdTablock.top = new FormAttachment(wKeepIdentity, margin);
fdTablock.right = new FormAttachment(100, 0);
wTablock.setLayoutData(fdTablock);
wTablock.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Start file
wlStartFile = new Label(wAdvancedComp, SWT.RIGHT);
wlStartFile.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.StartFile.Label"));
props.setLook(wlStartFile);
fdlStartFile = new FormData();
fdlStartFile.left = new FormAttachment(0, 0);
fdlStartFile.right = new FormAttachment(middle, 0);
fdlStartFile.top = new FormAttachment(wTablock, margin);
wlStartFile.setLayoutData(fdlStartFile);
wStartFile = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wStartFile);
wStartFile.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.StartFile.Tooltip"));
wStartFile.addModifyListener(lsMod);
fdStartFile = new FormData();
fdStartFile.left = new FormAttachment(middle, 0);
fdStartFile.top = new FormAttachment(wTablock, margin);
fdStartFile.right = new FormAttachment(100, 0);
wStartFile.setLayoutData(fdStartFile);
// End file
wlEndFile = new Label(wAdvancedComp, SWT.RIGHT);
wlEndFile.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.EndFile.Label"));
props.setLook(wlEndFile);
fdlEndFile = new FormData();
fdlEndFile.left = new FormAttachment(0, 0);
fdlEndFile.right = new FormAttachment(middle, 0);
fdlEndFile.top = new FormAttachment(wStartFile, margin);
wlEndFile.setLayoutData(fdlEndFile);
wEndFile = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEndFile);
wEndFile.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.EndFile.Tooltip"));
wEndFile.addModifyListener(lsMod);
fdEndFile = new FormData();
fdEndFile.left = new FormAttachment(middle, 0);
fdEndFile.top = new FormAttachment(wStartFile, margin);
fdEndFile.right = new FormAttachment(100, 0);
wEndFile.setLayoutData(fdEndFile);
// Specifies how the data in the data file is sorted
wlOrderBy = new Label(wAdvancedComp, SWT.RIGHT);
wlOrderBy.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.OrderBy.Label"));
props.setLook(wlOrderBy);
fdlOrderBy = new FormData();
fdlOrderBy.left = new FormAttachment(0, 0);
fdlOrderBy.right = new FormAttachment(middle, 0);
fdlOrderBy.top = new FormAttachment(wEndFile, margin);
wlOrderBy.setLayoutData(fdlOrderBy);
wbOrderBy = new Button(wAdvancedComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbOrderBy);
wbOrderBy.setText(BaseMessages.getString(PKG, "System.Button.Edit"));
FormData fdbListattribut = new FormData();
fdbListattribut.right = new FormAttachment(100, 0);
fdbListattribut.top = new FormAttachment(wEndFile, margin);
wbOrderBy.setLayoutData(fdbListattribut);
wbOrderBy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getListColumns();
}
});
wOrderBy = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wOrderBy);
wOrderBy.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.OrderBy.Tooltip"));
wOrderBy.addModifyListener(lsMod);
fdOrderBy = new FormData();
fdOrderBy.left = new FormAttachment(middle, 0);
fdOrderBy.top = new FormAttachment(wEndFile, margin);
fdOrderBy.right = new FormAttachment(wbOrderBy, -margin);
wOrderBy.setLayoutData(fdOrderBy);
// Order Direction
wlOrderDirection = new Label(wAdvancedComp, SWT.RIGHT);
wlOrderDirection.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.OrderDirection.Label"));
props.setLook(wlOrderDirection);
fdlOrderDirection = new FormData();
fdlOrderDirection.left = new FormAttachment(0, 0);
fdlOrderDirection.right = new FormAttachment(middle, 0);
fdlOrderDirection.top = new FormAttachment(wOrderBy, margin);
wlOrderDirection.setLayoutData(fdlOrderDirection);
wOrderDirection = new CCombo(wAdvancedComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wOrderDirection.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.OrderDirectionAsc.Label"));
wOrderDirection.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.OrderDirectionDesc.Label"));
// +1: starts at -1
wOrderDirection.select(0);
props.setLook(wOrderDirection);
fdOrderDirection = new FormData();
fdOrderDirection.left = new FormAttachment(middle, 0);
fdOrderDirection.top = new FormAttachment(wOrderBy, margin);
fdOrderDirection.right = new FormAttachment(100, 0);
wOrderDirection.setLayoutData(fdOrderDirection);
// ErrorFilename line
wlErrorFilename = new Label(wAdvancedComp, SWT.RIGHT);
wlErrorFilename.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.ErrorFilename.Label"));
props.setLook(wlErrorFilename);
fdlErrorFilename = new FormData();
fdlErrorFilename.left = new FormAttachment(0, 0);
fdlErrorFilename.top = new FormAttachment(wOrderDirection, margin);
fdlErrorFilename.right = new FormAttachment(middle, -margin);
wlErrorFilename.setLayoutData(fdlErrorFilename);
wbErrorFilename = new Button(wAdvancedComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbErrorFilename);
wbErrorFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbErrorFilename = new FormData();
fdbErrorFilename.right = new FormAttachment(100, 0);
fdbErrorFilename.top = new FormAttachment(wOrderDirection, 0);
wbErrorFilename.setLayoutData(fdbErrorFilename);
wErrorFilename = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wErrorFilename);
wErrorFilename.addModifyListener(lsMod);
wErrorFilename.setToolTipText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.ErrorFilename.Tooltip"));
fdErrorFilename = new FormData();
fdErrorFilename.left = new FormAttachment(middle, 0);
fdErrorFilename.top = new FormAttachment(wOrderDirection, margin);
fdErrorFilename.right = new FormAttachment(wbErrorFilename, -margin);
wErrorFilename.setLayoutData(fdErrorFilename);
// Whenever something changes, set the tooltip to the expanded version:
wErrorFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wErrorFilename.setToolTipText(jobMeta.environmentSubstitute(wErrorFilename.getText()));
}
});
wbErrorFilename.addSelectionListener(new SelectionAdapterFileDialogTextVar(log, wErrorFilename, jobMeta, new SelectionAdapterOptions(SelectionOperation.SAVE_TO, new FilterType[] { FilterType.TXT, FilterType.CSV, FilterType.ALL }, FilterType.TXT, new ProviderFilterType[] { ProviderFilterType.LOCAL })));
// Add Date time
wlAddDateTime = new Label(wAdvancedComp, SWT.RIGHT);
wlAddDateTime.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.AddDateTime.Label"));
props.setLook(wlAddDateTime);
fdlAddDateTime = new FormData();
fdlAddDateTime.left = new FormAttachment(0, 0);
fdlAddDateTime.top = new FormAttachment(wErrorFilename, margin);
fdlAddDateTime.right = new FormAttachment(middle, -margin);
wlAddDateTime.setLayoutData(fdlAddDateTime);
wAddDateTime = new Button(wAdvancedComp, SWT.CHECK);
props.setLook(wAddDateTime);
wAddDateTime.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.AddDateTime.Tooltip"));
fdAddDateTime = new FormData();
fdAddDateTime.left = new FormAttachment(middle, 0);
fdAddDateTime.top = new FormAttachment(wErrorFilename, margin);
fdAddDateTime.right = new FormAttachment(100, 0);
wAddDateTime.setLayoutData(fdAddDateTime);
wAddDateTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Maximum errors allowed
wlMaxErrors = new Label(wAdvancedComp, SWT.RIGHT);
wlMaxErrors.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.MaxErrors.Label"));
props.setLook(wlMaxErrors);
fdlMaxErrors = new FormData();
fdlMaxErrors.left = new FormAttachment(0, 0);
fdlMaxErrors.right = new FormAttachment(middle, 0);
fdlMaxErrors.top = new FormAttachment(wAddDateTime, margin);
wlMaxErrors.setLayoutData(fdlMaxErrors);
wMaxErrors = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMaxErrors);
wlMaxErrors.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.MaxErrors.Tooltip"));
wMaxErrors.addModifyListener(lsMod);
fdMaxErrors = new FormData();
fdMaxErrors.left = new FormAttachment(middle, 0);
fdMaxErrors.top = new FormAttachment(wAddDateTime, margin);
fdMaxErrors.right = new FormAttachment(100, 0);
wMaxErrors.setLayoutData(fdMaxErrors);
// Batch Size
wlBatchSize = new Label(wAdvancedComp, SWT.RIGHT);
wlBatchSize.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.BatchSize.Label"));
props.setLook(wlBatchSize);
fdlBatchSize = new FormData();
fdlBatchSize.left = new FormAttachment(0, 0);
fdlBatchSize.right = new FormAttachment(middle, 0);
fdlBatchSize.top = new FormAttachment(wMaxErrors, margin);
wlBatchSize.setLayoutData(fdlBatchSize);
wBatchSize = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBatchSize);
wBatchSize.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.BatchSize.Tooltip"));
wBatchSize.addModifyListener(lsMod);
fdBatchSize = new FormData();
fdBatchSize.left = new FormAttachment(middle, 0);
fdBatchSize.top = new FormAttachment(wMaxErrors, margin);
fdBatchSize.right = new FormAttachment(100, 0);
wBatchSize.setLayoutData(fdBatchSize);
// Rows per Batch
wlRowsPerBatch = new Label(wAdvancedComp, SWT.RIGHT);
wlRowsPerBatch.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.RowsPerBatch.Label"));
props.setLook(wlRowsPerBatch);
fdlRowsPerBatch = new FormData();
fdlRowsPerBatch.left = new FormAttachment(0, 0);
fdlRowsPerBatch.right = new FormAttachment(middle, 0);
fdlRowsPerBatch.top = new FormAttachment(wBatchSize, margin);
wlRowsPerBatch.setLayoutData(fdlRowsPerBatch);
wRowsPerBatch = new TextVar(jobMeta, wAdvancedComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wRowsPerBatch);
wRowsPerBatch.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.RowsPerBatch.Label"));
wRowsPerBatch.addModifyListener(lsMod);
fdRowsPerBatch = new FormData();
fdRowsPerBatch.left = new FormAttachment(middle, 0);
fdRowsPerBatch.top = new FormAttachment(wBatchSize, margin);
fdRowsPerBatch.right = new FormAttachment(100, 0);
wRowsPerBatch.setLayoutData(fdRowsPerBatch);
// fileresult grouping?
// ////////////////////////
// START OF FILE RESULT GROUP///
// /
wFileResult = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wFileResult);
wFileResult.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.FileResult.Group.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wFileResult.setLayout(groupLayout);
// Add file to result
wlAddFileToResult = new Label(wFileResult, SWT.RIGHT);
wlAddFileToResult.setText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.AddFileToResult.Label"));
props.setLook(wlAddFileToResult);
fdlAddFileToResult = new FormData();
fdlAddFileToResult.left = new FormAttachment(0, 0);
fdlAddFileToResult.top = new FormAttachment(wRowsPerBatch, margin);
fdlAddFileToResult.right = new FormAttachment(middle, -margin);
wlAddFileToResult.setLayoutData(fdlAddFileToResult);
wAddFileToResult = new Button(wFileResult, SWT.CHECK);
props.setLook(wAddFileToResult);
wAddFileToResult.setToolTipText(BaseMessages.getString(PKG, "JobMssqlBulkLoad.AddFileToResult.Tooltip"));
fdAddFileToResult = new FormData();
fdAddFileToResult.left = new FormAttachment(middle, 0);
fdAddFileToResult.top = new FormAttachment(wRowsPerBatch, margin);
fdAddFileToResult.right = new FormAttachment(100, 0);
wAddFileToResult.setLayoutData(fdAddFileToResult);
wAddFileToResult.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
fdFileResult = new FormData();
fdFileResult.left = new FormAttachment(0, margin);
fdFileResult.top = new FormAttachment(wRowsPerBatch, margin);
fdFileResult.right = new FormAttachment(100, -margin);
wFileResult.setLayoutData(fdFileResult);
// ///////////////////////////////////////////////////////////
// / END OF FilesResult GROUP
// ///////////////////////////////////////////////////////////
fdAdvancedComp = new FormData();
fdAdvancedComp.left = new FormAttachment(0, 0);
fdAdvancedComp.top = new FormAttachment(0, 0);
fdAdvancedComp.right = new FormAttachment(100, 0);
fdAdvancedComp.bottom = new FormAttachment(500, -margin);
wAdvancedComp.setLayoutData(fdAdvancedComp);
wAdvancedComp.layout();
wAdvancedTab.setControl(wAdvancedComp);
props.setLook(wAdvancedComp);
// ////////////////////////
// END OF Advanced TAB ///
// ////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// 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();
}
};
wName.addSelectionListener(lsDef);
wTablename.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setDataType();
setCodeType();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobMssqlBulkLoadDialogSize");
wTabFolder.setSelection(0);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.events.dialog.SelectionAdapterOptions in project pentaho-kettle by pentaho.
the class TextFileOutputDialog 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();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(getDialogTitle());
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
wTabFolder.setSimple(false);
// ////////////////////////
// START OF FILE TAB///
// /
wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileTab.TabTitle"));
Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
// Filename line
wlFilename = new Label(wFileComp, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(0, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(0, 0);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(0, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
Control topControl = addAdditionalComponentIfNeed(middle, margin, wFileComp, wFilename);
// Output to servlet (browser, ws)
//
wlServletOutput = new Label(wFileComp, SWT.RIGHT);
wlServletOutput.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ServletOutput.Label"));
props.setLook(wlServletOutput);
fdlServletOutput = new FormData();
fdlServletOutput.left = new FormAttachment(0, 0);
fdlServletOutput.top = new FormAttachment(topControl, margin);
fdlServletOutput.right = new FormAttachment(middle, -margin);
wlServletOutput.setLayoutData(fdlServletOutput);
wServletOutput = new Button(wFileComp, SWT.CHECK);
wServletOutput.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.ServletOutput.Tooltip"));
props.setLook(wServletOutput);
fdServletOutput = new FormData();
fdServletOutput.left = new FormAttachment(middle, 0);
fdServletOutput.top = new FormAttachment(topControl, margin);
fdServletOutput.right = new FormAttachment(100, 0);
wServletOutput.setLayoutData(fdServletOutput);
wServletOutput.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setFlagsServletOption();
}
});
// Create Parent Folder
wlCreateParentFolder = new Label(wFileComp, SWT.RIGHT);
wlCreateParentFolder.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.CreateParentFolder.Label"));
props.setLook(wlCreateParentFolder);
fdlCreateParentFolder = new FormData();
fdlCreateParentFolder.left = new FormAttachment(0, 0);
fdlCreateParentFolder.top = new FormAttachment(wServletOutput, margin);
fdlCreateParentFolder.right = new FormAttachment(middle, -margin);
wlCreateParentFolder.setLayoutData(fdlCreateParentFolder);
wCreateParentFolder = new Button(wFileComp, SWT.CHECK);
wCreateParentFolder.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.CreateParentFolder.Tooltip"));
props.setLook(wCreateParentFolder);
fdCreateParentFolder = new FormData();
fdCreateParentFolder.left = new FormAttachment(middle, 0);
fdCreateParentFolder.top = new FormAttachment(wServletOutput, margin);
fdCreateParentFolder.right = new FormAttachment(100, 0);
wCreateParentFolder.setLayoutData(fdCreateParentFolder);
wCreateParentFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Open new File at Init
wlDoNotOpenNewFileInit = new Label(wFileComp, SWT.RIGHT);
wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DoNotOpenNewFileInit.Label"));
props.setLook(wlDoNotOpenNewFileInit);
fdlDoNotOpenNewFileInit = new FormData();
fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0);
fdlDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
fdlDoNotOpenNewFileInit.right = new FormAttachment(middle, -margin);
wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit);
wDoNotOpenNewFileInit = new Button(wFileComp, SWT.CHECK);
wDoNotOpenNewFileInit.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.DoNotOpenNewFileInit.Tooltip"));
props.setLook(wDoNotOpenNewFileInit);
fdDoNotOpenNewFileInit = new FormData();
fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0);
fdDoNotOpenNewFileInit.top = new FormAttachment(wCreateParentFolder, margin);
fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0);
wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit);
wDoNotOpenNewFileInit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
/* next Lines */
// FileNameInField line
wlFileNameInField = new Label(wFileComp, SWT.RIGHT);
wlFileNameInField.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileNameInField.Label"));
props.setLook(wlFileNameInField);
fdlFileNameInField = new FormData();
fdlFileNameInField.left = new FormAttachment(0, 0);
fdlFileNameInField.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
fdlFileNameInField.right = new FormAttachment(middle, -margin);
wlFileNameInField.setLayoutData(fdlFileNameInField);
wFileNameInField = new Button(wFileComp, SWT.CHECK);
props.setLook(wFileNameInField);
fdFileNameInField = new FormData();
fdFileNameInField.left = new FormAttachment(middle, 0);
fdFileNameInField.top = new FormAttachment(wDoNotOpenNewFileInit, margin);
fdFileNameInField.right = new FormAttachment(100, 0);
wFileNameInField.setLayoutData(fdFileNameInField);
wFileNameInField.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
activeFileNameField();
}
});
// FileNameField Line
wlFileNameField = new Label(wFileComp, SWT.RIGHT);
wlFileNameField.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FileNameField.Label"));
props.setLook(wlFileNameField);
fdlFileNameField = new FormData();
fdlFileNameField.left = new FormAttachment(0, 0);
fdlFileNameField.right = new FormAttachment(middle, -margin);
fdlFileNameField.top = new FormAttachment(wFileNameInField, margin);
wlFileNameField.setLayoutData(fdlFileNameField);
wFileNameField = new ComboVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFileNameField);
wFileNameField.addModifyListener(lsMod);
fdFileNameField = new FormData();
fdFileNameField.left = new FormAttachment(middle, 0);
fdFileNameField.top = new FormAttachment(wFileNameInField, margin);
fdFileNameField.right = new FormAttachment(100, 0);
wFileNameField.setLayoutData(fdFileNameField);
wFileNameField.setEnabled(false);
wFileNameField.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();
}
});
/* End */
// Extension line
wlExtension = new Label(wFileComp, SWT.RIGHT);
wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
props.setLook(wlExtension);
fdlExtension = new FormData();
fdlExtension.left = new FormAttachment(0, 0);
fdlExtension.top = new FormAttachment(wFileNameField, margin);
fdlExtension.right = new FormAttachment(middle, -margin);
wlExtension.setLayoutData(fdlExtension);
wExtension = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wExtension.setText("");
props.setLook(wExtension);
wExtension.addModifyListener(lsMod);
fdExtension = new FormData();
fdExtension.left = new FormAttachment(middle, 0);
fdExtension.top = new FormAttachment(wFileNameField, margin);
fdExtension.right = new FormAttachment(100, 0);
wExtension.setLayoutData(fdExtension);
// Create multi-part file?
wlAddStepnr = new Label(wFileComp, SWT.RIGHT);
wlAddStepnr.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddStepnr.Label"));
props.setLook(wlAddStepnr);
fdlAddStepnr = new FormData();
fdlAddStepnr.left = new FormAttachment(0, 0);
fdlAddStepnr.top = new FormAttachment(wExtension, margin);
fdlAddStepnr.right = new FormAttachment(middle, -margin);
wlAddStepnr.setLayoutData(fdlAddStepnr);
wAddStepnr = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddStepnr);
fdAddStepnr = new FormData();
fdAddStepnr.left = new FormAttachment(middle, 0);
fdAddStepnr.top = new FormAttachment(wExtension, margin);
fdAddStepnr.right = new FormAttachment(100, 0);
wAddStepnr.setLayoutData(fdAddStepnr);
wAddStepnr.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddPartnr = new Label(wFileComp, SWT.RIGHT);
wlAddPartnr.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddPartnr.Label"));
props.setLook(wlAddPartnr);
fdlAddPartnr = new FormData();
fdlAddPartnr.left = new FormAttachment(0, 0);
fdlAddPartnr.top = new FormAttachment(wAddStepnr, margin);
fdlAddPartnr.right = new FormAttachment(middle, -margin);
wlAddPartnr.setLayoutData(fdlAddPartnr);
wAddPartnr = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddPartnr);
fdAddPartnr = new FormData();
fdAddPartnr.left = new FormAttachment(middle, 0);
fdAddPartnr.top = new FormAttachment(wAddStepnr, margin);
fdAddPartnr.right = new FormAttachment(100, 0);
wAddPartnr.setLayoutData(fdAddPartnr);
wAddPartnr.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddDate = new Label(wFileComp, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wAddPartnr, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddDate);
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, 0);
fdAddDate.top = new FormAttachment(wAddPartnr, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Create multi-part file?
wlAddTime = new Label(wFileComp, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(wFileComp, SWT.CHECK);
props.setLook(wAddTime);
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, 0);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wFileComp, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.SpecifyFormat.Label"));
props.setLook(wlSpecifyFormat);
fdlSpecifyFormat = new FormData();
fdlSpecifyFormat.left = new FormAttachment(0, 0);
fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
wSpecifyFormat = new Button(wFileComp, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, 0);
fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdSpecifyFormat.right = new FormAttachment(100, 0);
wSpecifyFormat.setLayoutData(fdSpecifyFormat);
wSpecifyFormat.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setDateTimeFormat();
}
});
// DateTimeFormat
wlDateTimeFormat = new Label(wFileComp, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DateTimeFormat.Label"));
props.setLook(wlDateTimeFormat);
fdlDateTimeFormat = new FormData();
fdlDateTimeFormat.left = new FormAttachment(0, 0);
fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
wDateTimeFormat = new CCombo(wFileComp, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, 0);
fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdDateTimeFormat.right = new FormAttachment(100, 0);
wDateTimeFormat.setLayoutData(fdDateTimeFormat);
String[] dats = Const.getDateFormats();
for (int x = 0; x < dats.length; x++) {
wDateTimeFormat.add(dats[x]);
}
wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbShowFiles);
wbShowFiles.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ShowFiles.Button"));
fdbShowFiles = new FormData();
fdbShowFiles.left = new FormAttachment(middle, 0);
fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 2);
wbShowFiles.setLayoutData(fdbShowFiles);
wbShowFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TextFileOutputMeta tfoi = new TextFileOutputMeta();
saveInfoInMeta(tfoi);
String[] files = tfoi.getFiles(transMeta);
if (files != null && files.length > 0) {
EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "TextFileOutputDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "TextFileOutputDialog.SelectOutputFiles.DialogMessage"));
esd.setViewOnly();
esd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TextFileOutputDialog.NoFilesFound.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
mb.open();
}
}
});
// Add File to the result files name
wlAddToResult = new Label(wFileComp, SWT.RIGHT);
wlAddToResult.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddFileToResult.Label"));
props.setLook(wlAddToResult);
fdlAddToResult = new FormData();
fdlAddToResult.left = new FormAttachment(0, 0);
fdlAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
fdlAddToResult.right = new FormAttachment(middle, -margin);
wlAddToResult.setLayoutData(fdlAddToResult);
wAddToResult = new Button(wFileComp, SWT.CHECK);
wAddToResult.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.AddFileToResult.Tooltip"));
props.setLook(wAddToResult);
fdAddToResult = new FormData();
fdAddToResult.left = new FormAttachment(middle, 0);
fdAddToResult.top = new FormAttachment(wbShowFiles, 2 * margin);
fdAddToResult.right = new FormAttachment(100, 0);
wAddToResult.setLayoutData(fdAddToResult);
SelectionAdapter lsSelR = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
input.setChanged();
}
};
wAddToResult.addSelectionListener(lsSelR);
fdFileComp = new FormData();
fdFileComp.left = new FormAttachment(0, 0);
fdFileComp.top = new FormAttachment(0, 0);
fdFileComp.right = new FormAttachment(100, 0);
fdFileComp.bottom = new FormAttachment(100, 0);
wFileComp.setLayoutData(fdFileComp);
wFileComp.layout();
wFileTab.setControl(wFileComp);
// ///////////////////////////////////////////////////////////
// / END OF FILE TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.ContentTab.TabTitle"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// Append to end of file?
wlAppend = new Label(wContentComp, SWT.RIGHT);
wlAppend.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Append.Label"));
props.setLook(wlAppend);
fdlAppend = new FormData();
fdlAppend.left = new FormAttachment(0, 0);
fdlAppend.top = new FormAttachment(0, 0);
fdlAppend.right = new FormAttachment(middle, -margin);
wlAppend.setLayoutData(fdlAppend);
wAppend = new Button(wContentComp, SWT.CHECK);
props.setLook(wAppend);
fdAppend = new FormData();
fdAppend.left = new FormAttachment(middle, 0);
fdAppend.top = new FormAttachment(0, 0);
fdAppend.right = new FormAttachment(100, 0);
wAppend.setLayoutData(fdAppend);
wAppend.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
private void headerDisabling() {
wHeader.setSelection(false);
wHeader.setEnabled(!wAppend.getSelection());
}
});
wlSeparator = new Label(wContentComp, SWT.RIGHT);
wlSeparator.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Separator.Label"));
props.setLook(wlSeparator);
fdlSeparator = new FormData();
fdlSeparator.left = new FormAttachment(0, 0);
fdlSeparator.top = new FormAttachment(wAppend, margin);
fdlSeparator.right = new FormAttachment(middle, -margin);
wlSeparator.setLayoutData(fdlSeparator);
wbSeparator = new Button(wContentComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSeparator);
wbSeparator.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Separator.Button"));
fdbSeparator = new FormData();
fdbSeparator.right = new FormAttachment(100, 0);
fdbSeparator.top = new FormAttachment(wAppend, 0);
wbSeparator.setLayoutData(fdbSeparator);
wbSeparator.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
// wSeparator.insert("\t");
wSeparator.getTextWidget().insert("\t");
}
});
wSeparator = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSeparator);
wSeparator.addModifyListener(lsMod);
fdSeparator = new FormData();
fdSeparator.left = new FormAttachment(middle, 0);
fdSeparator.top = new FormAttachment(wAppend, margin);
fdSeparator.right = new FormAttachment(wbSeparator, -margin);
wSeparator.setLayoutData(fdSeparator);
// Enclosure line...
wlEnclosure = new Label(wContentComp, SWT.RIGHT);
wlEnclosure.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Enclosure.Label"));
props.setLook(wlEnclosure);
fdlEnclosure = new FormData();
fdlEnclosure.left = new FormAttachment(0, 0);
fdlEnclosure.top = new FormAttachment(wSeparator, margin);
fdlEnclosure.right = new FormAttachment(middle, -margin);
wlEnclosure.setLayoutData(fdlEnclosure);
wEnclosure = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEnclosure);
wEnclosure.addModifyListener(lsMod);
fdEnclosure = new FormData();
fdEnclosure.left = new FormAttachment(middle, 0);
fdEnclosure.top = new FormAttachment(wSeparator, margin);
fdEnclosure.right = new FormAttachment(100, 0);
wEnclosure.setLayoutData(fdEnclosure);
wlEnclForced = new Label(wContentComp, SWT.RIGHT);
wlEnclForced.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.EnclForced.Label"));
props.setLook(wlEnclForced);
fdlEnclForced = new FormData();
fdlEnclForced.left = new FormAttachment(0, 0);
fdlEnclForced.top = new FormAttachment(wEnclosure, margin);
fdlEnclForced.right = new FormAttachment(middle, -margin);
wlEnclForced.setLayoutData(fdlEnclForced);
wEnclForced = new Button(wContentComp, SWT.CHECK);
props.setLook(wEnclForced);
fdEnclForced = new FormData();
fdEnclForced.left = new FormAttachment(middle, 0);
fdEnclForced.top = new FormAttachment(wEnclosure, margin);
fdEnclForced.right = new FormAttachment(100, 0);
wEnclForced.setLayoutData(fdEnclForced);
wEnclForced.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlDisableEnclosureFix = new Label(wContentComp, SWT.RIGHT);
wlDisableEnclosureFix.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.DisableEnclosureFix.Label"));
props.setLook(wlDisableEnclosureFix);
fdlDisableEnclosureFix = new FormData();
fdlDisableEnclosureFix.left = new FormAttachment(0, 0);
fdlDisableEnclosureFix.top = new FormAttachment(wEnclForced, margin);
fdlDisableEnclosureFix.right = new FormAttachment(middle, -margin);
wlDisableEnclosureFix.setLayoutData(fdlDisableEnclosureFix);
wDisableEnclosureFix = new Button(wContentComp, SWT.CHECK);
props.setLook(wDisableEnclosureFix);
fdDisableEnclosureFix = new FormData();
fdDisableEnclosureFix.left = new FormAttachment(middle, 0);
fdDisableEnclosureFix.top = new FormAttachment(wEnclForced, margin);
fdDisableEnclosureFix.right = new FormAttachment(100, 0);
wDisableEnclosureFix.setLayoutData(fdDisableEnclosureFix);
wDisableEnclosureFix.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlHeader = new Label(wContentComp, SWT.RIGHT);
wlHeader.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Header.Label"));
props.setLook(wlHeader);
fdlHeader = new FormData();
fdlHeader.left = new FormAttachment(0, 0);
fdlHeader.top = new FormAttachment(wDisableEnclosureFix, margin);
fdlHeader.right = new FormAttachment(middle, -margin);
wlHeader.setLayoutData(fdlHeader);
wHeader = new Button(wContentComp, SWT.CHECK);
props.setLook(wHeader);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(middle, 0);
fdHeader.top = new FormAttachment(wDisableEnclosureFix, margin);
fdHeader.right = new FormAttachment(100, 0);
wHeader.setLayoutData(fdHeader);
wHeader.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFooter = new Label(wContentComp, SWT.RIGHT);
wlFooter.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Footer.Label"));
props.setLook(wlFooter);
fdlFooter = new FormData();
fdlFooter.left = new FormAttachment(0, 0);
fdlFooter.top = new FormAttachment(wHeader, margin);
fdlFooter.right = new FormAttachment(middle, -margin);
wlFooter.setLayoutData(fdlFooter);
wFooter = new Button(wContentComp, SWT.CHECK);
props.setLook(wFooter);
fdFooter = new FormData();
fdFooter.left = new FormAttachment(middle, 0);
fdFooter.top = new FormAttachment(wHeader, margin);
fdFooter.right = new FormAttachment(100, 0);
wFooter.setLayoutData(fdFooter);
wFooter.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFormat = new Label(wContentComp, SWT.RIGHT);
wlFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Format.Label"));
props.setLook(wlFormat);
fdlFormat = new FormData();
fdlFormat.left = new FormAttachment(0, 0);
fdlFormat.top = new FormAttachment(wFooter, margin);
fdlFormat.right = new FormAttachment(middle, -margin);
wlFormat.setLayoutData(fdlFormat);
wFormat = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wFormat.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Format.Label"));
props.setLook(wFormat);
for (int i = 0; i < TextFileOutputMeta.formatMapperLineTerminator.length; i++) {
// add e.g. TextFileOutputDialog.Format.DOS, .UNIX, .CR, .None
wFormat.add(BaseMessages.getString(PKG, "TextFileOutputDialog.Format." + TextFileOutputMeta.formatMapperLineTerminator[i]));
}
wFormat.select(0);
wFormat.addModifyListener(lsMod);
fdFormat = new FormData();
fdFormat.left = new FormAttachment(middle, 0);
fdFormat.top = new FormAttachment(wFooter, margin);
fdFormat.right = new FormAttachment(100, 0);
wFormat.setLayoutData(fdFormat);
wlCompression = new Label(wContentComp, SWT.RIGHT);
wlCompression.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Compression.Label"));
props.setLook(wlCompression);
fdlCompression = new FormData();
fdlCompression.left = new FormAttachment(0, 0);
fdlCompression.top = new FormAttachment(wFormat, margin);
fdlCompression.right = new FormAttachment(middle, -margin);
wlCompression.setLayoutData(fdlCompression);
wCompression = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wCompression.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Compression.Label"));
props.setLook(wCompression);
wCompression.setItems(CompressionProviderFactory.getInstance().getCompressionProviderNames());
wCompression.addModifyListener(lsMod);
fdCompression = new FormData();
fdCompression.left = new FormAttachment(middle, 0);
fdCompression.top = new FormAttachment(wFormat, margin);
fdCompression.right = new FormAttachment(100, 0);
wCompression.setLayoutData(fdCompression);
wlEncoding = new Label(wContentComp, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Encoding.Label"));
props.setLook(wlEncoding);
fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wCompression, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
wEncoding.setEditable(true);
props.setLook(wEncoding);
wEncoding.addModifyListener(lsMod);
fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.top = new FormAttachment(wCompression, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addFocusListener(new FocusListener() {
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
}
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
setEncodings();
shell.setCursor(null);
busy.dispose();
}
});
wlPad = new Label(wContentComp, SWT.RIGHT);
wlPad.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.Pad.Label"));
props.setLook(wlPad);
fdlPad = new FormData();
fdlPad.left = new FormAttachment(0, 0);
fdlPad.top = new FormAttachment(wEncoding, margin);
fdlPad.right = new FormAttachment(middle, -margin);
wlPad.setLayoutData(fdlPad);
wPad = new Button(wContentComp, SWT.CHECK);
props.setLook(wPad);
fdPad = new FormData();
fdPad.left = new FormAttachment(middle, 0);
fdPad.top = new FormAttachment(wEncoding, margin);
fdPad.right = new FormAttachment(100, 0);
wPad.setLayoutData(fdPad);
wPad.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlFastDump = new Label(wContentComp, SWT.RIGHT);
wlFastDump.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FastDump.Label"));
props.setLook(wlFastDump);
fdlFastDump = new FormData();
fdlFastDump.left = new FormAttachment(0, 0);
fdlFastDump.top = new FormAttachment(wPad, margin);
fdlFastDump.right = new FormAttachment(middle, -margin);
wlFastDump.setLayoutData(fdlFastDump);
wFastDump = new Button(wContentComp, SWT.CHECK);
props.setLook(wFastDump);
fdFastDump = new FormData();
fdFastDump.left = new FormAttachment(middle, 0);
fdFastDump.top = new FormAttachment(wPad, margin);
fdFastDump.right = new FormAttachment(100, 0);
wFastDump.setLayoutData(fdFastDump);
wFastDump.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
wlSplitEvery = new Label(wContentComp, SWT.RIGHT);
wlSplitEvery.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.SplitEvery.Label"));
props.setLook(wlSplitEvery);
fdlSplitEvery = new FormData();
fdlSplitEvery.left = new FormAttachment(0, 0);
fdlSplitEvery.top = new FormAttachment(wFastDump, margin);
fdlSplitEvery.right = new FormAttachment(middle, -margin);
wlSplitEvery.setLayoutData(fdlSplitEvery);
wSplitEvery = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSplitEvery);
wSplitEvery.addModifyListener(lsMod);
fdSplitEvery = new FormData();
fdSplitEvery.left = new FormAttachment(middle, 0);
fdSplitEvery.top = new FormAttachment(wFastDump, margin);
fdSplitEvery.right = new FormAttachment(100, 0);
wSplitEvery.setLayoutData(fdSplitEvery);
// Bruise:
wlEndedLine = new Label(wContentComp, SWT.RIGHT);
wlEndedLine.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.EndedLine.Label"));
props.setLook(wlEndedLine);
fdlEndedLine = new FormData();
fdlEndedLine.left = new FormAttachment(0, 0);
fdlEndedLine.top = new FormAttachment(wSplitEvery, margin);
fdlEndedLine.right = new FormAttachment(middle, -margin);
wlEndedLine.setLayoutData(fdlEndedLine);
wEndedLine = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wEndedLine);
wEndedLine.addModifyListener(lsMod);
fdEndedLine = new FormData();
fdEndedLine.left = new FormAttachment(middle, 0);
fdEndedLine.top = new FormAttachment(wSplitEvery, margin);
fdEndedLine.right = new FormAttachment(100, 0);
wEndedLine.setLayoutData(fdEndedLine);
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(fdContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.FieldsTab.TabTitle"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = Const.FORM_MARGIN;
fieldsLayout.marginHeight = Const.FORM_MARGIN;
Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
props.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
wGet.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.GetFields"));
wMinWidth = new Button(wFieldsComp, SWT.PUSH);
wMinWidth.setText(BaseMessages.getString(PKG, "TextFileOutputDialog.MinWidth.Button"));
wMinWidth.setToolTipText(BaseMessages.getString(PKG, "TextFileOutputDialog.MinWidth.Tooltip"));
wMinWidth.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
});
setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
final int FieldsCols = 10;
final int FieldsRows = input.getOutputFields().length;
// Prepare a list of possible formats...
String[] nums = Const.getNumberFormats();
int totsize = dats.length + nums.length;
String[] formats = new String[totsize];
for (int x = 0; x < dats.length; x++) {
formats[x] = dats[x];
}
for (int x = 0; x < nums.length; x++) {
formats[dats.length + x] = nums[x];
}
colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
colinf[1] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames());
colinf[2] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats);
colinf[3] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.LengthColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[4] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.PrecisionColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[5] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.CurrencyColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[6] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.DecimalColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[7] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.GroupColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[8] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.TrimTypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaString.trimTypeDesc, true);
colinf[9] = new ColumnInfo(BaseMessages.getString(PKG, "TextFileOutputDialog.NullColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
wFields = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wGet, -margin);
wFields.setLayoutData(fdFields);
//
// Search the fields in the background
final Runnable runnable = new Runnable() {
public void run() {
StepMeta stepMeta = transMeta.findStep(stepname);
if (stepMeta != null) {
try {
RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
}
setComboBoxes();
} catch (KettleException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
}
};
new Thread(runnable).start();
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsMinWidth = new Listener() {
public void handleEvent(Event e) {
setMinimalWidth();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wMinWidth.addListener(SWT.Selection, lsMinWidth);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wFilename.addSelectionListener(lsDef);
wSeparator.addSelectionListener(lsDef);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapterFileDialogTextVar(log, wFilename, transMeta, new SelectionAdapterOptions(SelectionOperation.SAVE_TO_FILE_FOLDER, new FilterType[] { FilterType.TXT, FilterType.CSV, FilterType.ALL }, FilterType.TXT)));
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
lsResize = new Listener() {
public void handleEvent(Event event) {
Point size = shell.getSize();
wFields.setSize(size.x - 10, size.y - 50);
wFields.table.setSize(size.x - 10, size.y - 50);
wFields.redraw();
}
};
shell.addListener(SWT.Resize, lsResize);
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData();
activeFileNameField();
enableParentFolder();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations