use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class KettlePropertiesFileDialog method open.
public Map<String, String> open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
shell.setImage(GUIResource.getInstance().getImageTransGraph());
props.setLook(shell);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Title"));
int margin = Const.MARGIN;
// Message line
//
wlFields = new Label(shell, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Message"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(0, margin);
wlFields.setLayoutData(fdlFields);
int FieldsRows = 0;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Name.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Value.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "KettlePropertiesFileDialog.Description.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
colinf[2].setDisabledListener(new FieldDisabledListener() {
public boolean isFieldDisabled(int rowNr) {
return false;
}
});
wFields = new TableView(Variables.getADefaultVariableSpace(), shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, null, props);
wFields.setReadonly(false);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, 30);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, -50);
wFields.setLayoutData(fdFields);
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, wFields);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return kettleProperties;
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class SQLStatementsDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
red = display.getSystemColor(SWT.COLOR_RED);
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
props.setLook(shell);
shell.setImage(GUIResource.getInstance().getImageConnection());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SQLStatementDialog.Title"));
int margin = Const.MARGIN;
int FieldsCols = 4;
int FieldsRows = stats.size();
ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "SQLStatementDialog.TableCol.Stepname"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
colinf[1] = new ColumnInfo(BaseMessages.getString(PKG, "SQLStatementDialog.TableCol.Connection"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
colinf[2] = new ColumnInfo(BaseMessages.getString(PKG, "SQLStatementDialog.TableCol.SQL"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
colinf[3] = new ColumnInfo(BaseMessages.getString(PKG, "SQLStatementDialog.TableCol.Error"), ColumnInfo.COLUMN_TYPE_TEXT, false, true);
wFields = new TableView(variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, // read-only
true, null, 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(100, -50);
wFields.setLayoutData(fdFields);
wClose = new Button(shell, SWT.PUSH);
wClose.setText(BaseMessages.getString(PKG, "System.Button.Close"));
fdClose = new FormData();
fdClose.left = new FormAttachment(25, 0);
fdClose.bottom = new FormAttachment(100, 0);
wClose.setLayoutData(fdClose);
wView = new Button(shell, SWT.PUSH);
wView.setText(BaseMessages.getString(PKG, "SQLStatementDialog.Button.ViewSQL"));
fdView = new FormData();
fdView.left = new FormAttachment(wClose, margin);
fdView.bottom = new FormAttachment(100, 0);
wView.setLayoutData(fdView);
wExec = new Button(shell, SWT.PUSH);
wExec.setText(BaseMessages.getString(PKG, "SQLStatementDialog.Button.ExecSQL"));
fdExec = new FormData();
fdExec.left = new FormAttachment(wView, margin);
fdExec.bottom = new FormAttachment(100, 0);
wExec.setLayoutData(fdExec);
wEdit = new Button(shell, SWT.PUSH);
wEdit.setText(BaseMessages.getString(PKG, "SQLStatementDialog.Button.EditStep"));
fdEdit = new FormData();
fdEdit.left = new FormAttachment(wExec, margin);
fdEdit.bottom = new FormAttachment(100, 0);
wEdit.setLayoutData(fdEdit);
// Add listeners
lsClose = new Listener() {
public void handleEvent(Event e) {
close();
}
};
lsView = new Listener() {
public void handleEvent(Event e) {
view();
}
};
lsExec = new Listener() {
public void handleEvent(Event e) {
exec();
}
};
lsEdit = new Listener() {
public void handleEvent(Event e) {
edit();
}
};
wClose.addListener(SWT.Selection, lsClose);
wView.addListener(SWT.Selection, lsView);
wExec.addListener(SWT.Selection, lsExec);
wEdit.addListener(SWT.Selection, lsEdit);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
close();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class SelectRowDialog method open.
public RowMetaAndData open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
props.setLook(shell);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
if (title == null) {
title = BaseMessages.getString(PKG, "SelectRowDialog.Title");
}
shell.setLayout(formLayout);
shell.setImage(GUIResource.getInstance().getImageTransGraph());
shell.setText(title);
int margin = Const.MARGIN;
//
if (buffer == null || buffer.size() == 0) {
return null;
}
rowMeta = buffer.get(0).getRowMeta();
int FieldsRows = buffer.size();
ColumnInfo[] colinf = new ColumnInfo[rowMeta.size()];
for (int i = 0; i < rowMeta.size(); i++) {
ValueMetaInterface v = rowMeta.getValueMeta(i);
colinf[i] = new ColumnInfo(v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[i].setToolTip(v.toStringMeta());
colinf[i].setReadOnly(true);
}
wFields = new TableView(variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, null, props);
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, null);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wOK, -margin);
wFields.setLayoutData(fdFields);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wOK.addListener(SWT.Selection, lsOK);
lsCancel = new Listener() {
public void handleEvent(Event e) {
close();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
close();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return selection;
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class Translator method addGrid.
private void addGrid() {
Composite composite = new Composite(sashform, SWT.NONE);
props.setLook(composite);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
composite.setLayout(formLayout);
wReload = new Button(composite, SWT.NONE);
wReload.setText(" &Reload ");
wLocale = new Button(composite, SWT.NONE);
wLocale.setText(" &Select locale ");
wClose = new Button(composite, SWT.NONE);
wClose.setText(" &Close ");
wVerify = new Button(composite, SWT.CHECK);
wVerify.setText("&Verify usage");
// Check it!
wVerify.setSelection(true);
wUsed = new Button(composite, SWT.CHECK);
wUsed.setText("&Remove used keys");
// Check it!
wUsed.setSelection(false);
wAvailable = new Button(composite, SWT.CHECK);
wAvailable.setText("&Check key against other locale");
// Check it!
wAvailable.setSelection(true);
BaseStepDialog.positionBottomButtons(composite, new Button[] { wReload, wLocale, wClose, wVerify, wUsed, wAvailable }, Const.MARGIN, null);
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo("Locale", ColumnInfo.COLUMN_TYPE_TEXT, true), new ColumnInfo("Package", ColumnInfo.COLUMN_TYPE_TEXT, true), new ColumnInfo("Class", ColumnInfo.COLUMN_TYPE_TEXT, true), new ColumnInfo("Key", ColumnInfo.COLUMN_TYPE_TEXT, true), new ColumnInfo("Value", ColumnInfo.COLUMN_TYPE_TEXT, true), new ColumnInfo("Used?", ColumnInfo.COLUMN_TYPE_TEXT, true), new ColumnInfo("Not available in", ColumnInfo.COLUMN_TYPE_TEXT, true) };
wGrid = new TableView(Variables.getADefaultVariableSpace(), composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0, null, PropsUI.getInstance());
FormData fdGrid = new FormData();
fdGrid.left = new FormAttachment(0, 0);
fdGrid.top = new FormAttachment(0, 0);
fdGrid.right = new FormAttachment(100, 0);
fdGrid.bottom = new FormAttachment(wReload, -Const.MARGIN * 3);
wGrid.setLayoutData(fdGrid);
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class JobEntryEvalFilesMetricsDialog 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, "JobEvalFilesMetrics.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
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, "JobEvalFilesMetrics.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);
// SETTINGS grouping?
// ////////////////////////
// START OF SETTINGS GROUP
//
wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSettings);
wSettings.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Settings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wSettings.setLayout(groupLayout);
// SourceFiles
wlSourceFiles = new Label(wSettings, SWT.RIGHT);
wlSourceFiles.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.SourceFiles.Label"));
props.setLook(wlSourceFiles);
fdlSourceFiles = new FormData();
fdlSourceFiles.left = new FormAttachment(0, 0);
fdlSourceFiles.right = new FormAttachment(middle, -margin);
fdlSourceFiles.top = new FormAttachment(wName, margin);
wlSourceFiles.setLayoutData(fdlSourceFiles);
wSourceFiles = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSourceFiles.setItems(JobEntryEvalFilesMetrics.SourceFilesDesc);
// +1: starts at -1
wSourceFiles.select(0);
props.setLook(wSourceFiles);
fdSourceFiles = new FormData();
fdSourceFiles.left = new FormAttachment(middle, 0);
fdSourceFiles.top = new FormAttachment(wName, margin);
fdSourceFiles.right = new FormAttachment(100, 0);
wSourceFiles.setLayoutData(fdSourceFiles);
wSourceFiles.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
RefreshSourceFiles();
}
});
// ResultFilenamesWildcard
wlResultFilenamesWildcard = new Label(wSettings, SWT.RIGHT);
wlResultFilenamesWildcard.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFilenamesWildcard.Label"));
props.setLook(wlResultFilenamesWildcard);
fdlResultFilenamesWildcard = new FormData();
fdlResultFilenamesWildcard.left = new FormAttachment(0, 0);
fdlResultFilenamesWildcard.top = new FormAttachment(wSourceFiles, margin);
fdlResultFilenamesWildcard.right = new FormAttachment(middle, -margin);
wlResultFilenamesWildcard.setLayoutData(fdlResultFilenamesWildcard);
wResultFilenamesWildcard = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFilenamesWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFilenamesWildcard.Tooltip"));
props.setLook(wResultFilenamesWildcard);
wResultFilenamesWildcard.addModifyListener(lsMod);
fdResultFilenamesWildcard = new FormData();
fdResultFilenamesWildcard.left = new FormAttachment(middle, 0);
fdResultFilenamesWildcard.top = new FormAttachment(wSourceFiles, margin);
fdResultFilenamesWildcard.right = new FormAttachment(100, -margin);
wResultFilenamesWildcard.setLayoutData(fdResultFilenamesWildcard);
// ResultFieldFile
wlResultFieldFile = new Label(wSettings, SWT.RIGHT);
wlResultFieldFile.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFieldFile.Label"));
props.setLook(wlResultFieldFile);
fdlResultFieldFile = new FormData();
fdlResultFieldFile.left = new FormAttachment(0, 0);
fdlResultFieldFile.top = new FormAttachment(wResultFilenamesWildcard, margin);
fdlResultFieldFile.right = new FormAttachment(middle, -margin);
wlResultFieldFile.setLayoutData(fdlResultFieldFile);
wResultFieldFile = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFieldFile.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.ResultFieldFile.Tooltip"));
props.setLook(wResultFieldFile);
wResultFieldFile.addModifyListener(lsMod);
fdResultFieldFile = new FormData();
fdResultFieldFile.left = new FormAttachment(middle, 0);
fdResultFieldFile.top = new FormAttachment(wResultFilenamesWildcard, margin);
fdResultFieldFile.right = new FormAttachment(100, -margin);
wResultFieldFile.setLayoutData(fdResultFieldFile);
// ResultFieldWildcard
wlResultFieldWildcard = new Label(wSettings, SWT.RIGHT);
wlResultFieldWildcard.setText(BaseMessages.getString(PKG, "JobEvalWildcardsMetrics.ResultFieldWildcard.Label"));
props.setLook(wlResultFieldWildcard);
fdlResultFieldWildcard = new FormData();
fdlResultFieldWildcard.left = new FormAttachment(0, 0);
fdlResultFieldWildcard.top = new FormAttachment(wResultFieldFile, margin);
fdlResultFieldWildcard.right = new FormAttachment(middle, -margin);
wlResultFieldWildcard.setLayoutData(fdlResultFieldWildcard);
wResultFieldWildcard = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFieldWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalWildcardsMetrics.ResultFieldWildcard.Tooltip"));
props.setLook(wResultFieldWildcard);
wResultFieldWildcard.addModifyListener(lsMod);
fdResultFieldWildcard = new FormData();
fdResultFieldWildcard.left = new FormAttachment(middle, 0);
fdResultFieldWildcard.top = new FormAttachment(wResultFieldFile, margin);
fdResultFieldWildcard.right = new FormAttachment(100, -margin);
wResultFieldWildcard.setLayoutData(fdResultFieldWildcard);
// ResultFieldIncludeSubFolders
wlResultFieldIncludeSubFolders = new Label(wSettings, SWT.RIGHT);
wlResultFieldIncludeSubFolders.setText(BaseMessages.getString(PKG, "JobEvalIncludeSubFolderssMetrics.ResultFieldIncludeSubFolders.Label"));
props.setLook(wlResultFieldIncludeSubFolders);
fdlResultFieldIncludeSubFolders = new FormData();
fdlResultFieldIncludeSubFolders.left = new FormAttachment(0, 0);
fdlResultFieldIncludeSubFolders.top = new FormAttachment(wResultFieldWildcard, margin);
fdlResultFieldIncludeSubFolders.right = new FormAttachment(middle, -margin);
wlResultFieldIncludeSubFolders.setLayoutData(fdlResultFieldIncludeSubFolders);
wResultFieldIncludeSubFolders = new TextVar(jobMeta, wSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wResultFieldIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobEvalIncludeSubFolderssMetrics.ResultFieldIncludeSubFolders.Tooltip"));
props.setLook(wResultFieldIncludeSubFolders);
wResultFieldIncludeSubFolders.addModifyListener(lsMod);
fdResultFieldIncludeSubFolders = new FormData();
fdResultFieldIncludeSubFolders.left = new FormAttachment(middle, 0);
fdResultFieldIncludeSubFolders.top = new FormAttachment(wResultFieldWildcard, margin);
fdResultFieldIncludeSubFolders.right = new FormAttachment(100, -margin);
wResultFieldIncludeSubFolders.setLayoutData(fdResultFieldIncludeSubFolders);
// EvaluationType
wlEvaluationType = new Label(wSettings, SWT.RIGHT);
wlEvaluationType.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.EvaluationType.Label"));
props.setLook(wlEvaluationType);
fdlEvaluationType = new FormData();
fdlEvaluationType.left = new FormAttachment(0, 0);
fdlEvaluationType.right = new FormAttachment(middle, -margin);
fdlEvaluationType.top = new FormAttachment(wResultFieldIncludeSubFolders, margin);
wlEvaluationType.setLayoutData(fdlEvaluationType);
wEvaluationType = new CCombo(wSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wEvaluationType.setItems(JobEntryEvalFilesMetrics.EvaluationTypeDesc);
// +1: starts at -1
wEvaluationType.select(0);
props.setLook(wEvaluationType);
fdEvaluationType = new FormData();
fdEvaluationType.left = new FormAttachment(middle, 0);
fdEvaluationType.top = new FormAttachment(wResultFieldIncludeSubFolders, margin);
fdEvaluationType.right = new FormAttachment(100, 0);
wEvaluationType.setLayoutData(fdEvaluationType);
wEvaluationType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
RefreshSize();
jobEntry.setChanged();
}
});
fdSettings = new FormData();
fdSettings.left = new FormAttachment(0, margin);
fdSettings.top = new FormAttachment(wName, margin);
fdSettings.right = new FormAttachment(100, -margin);
wSettings.setLayoutData(fdSettings);
// ///////////////////////////////////////////////////////////
// / END OF SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// SourceFileFolder line
wlSourceFileFolder = new Label(wGeneralComp, SWT.RIGHT);
wlSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SourceFileFolder.Label"));
props.setLook(wlSourceFileFolder);
fdlSourceFileFolder = new FormData();
fdlSourceFileFolder.left = new FormAttachment(0, 0);
fdlSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
fdlSourceFileFolder.right = new FormAttachment(middle, -margin);
wlSourceFileFolder.setLayoutData(fdlSourceFileFolder);
// Browse Source folders button ...
wbSourceDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSourceDirectory);
wbSourceDirectory.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.BrowseFolders.Label"));
fdbSourceDirectory = new FormData();
fdbSourceDirectory.right = new FormAttachment(100, 0);
fdbSourceDirectory.top = new FormAttachment(wSettings, margin);
wbSourceDirectory.setLayoutData(fdbSourceDirectory);
wbSourceDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wSourceFileFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wSourceFileFolder.setText(dir);
}
}
});
// Browse Source files button ...
wbSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbSourceFileFolder);
wbSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.BrowseFiles.Label"));
fdbSourceFileFolder = new FormData();
fdbSourceFileFolder.right = new FormAttachment(wbSourceDirectory, -margin);
fdbSourceFileFolder.top = new FormAttachment(wSettings, margin);
wbSourceFileFolder.setLayoutData(fdbSourceFileFolder);
// Browse Destination file add button ...
wbaSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbaSourceFileFolder);
wbaSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameAdd.Button"));
fdbaSourceFileFolder = new FormData();
fdbaSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -margin);
fdbaSourceFileFolder.top = new FormAttachment(wSettings, margin);
wbaSourceFileFolder.setLayoutData(fdbaSourceFileFolder);
wSourceFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SourceFileFolder.Tooltip"));
props.setLook(wSourceFileFolder);
wSourceFileFolder.addModifyListener(lsMod);
fdSourceFileFolder = new FormData();
fdSourceFileFolder.left = new FormAttachment(middle, 0);
fdSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
fdSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -55);
wSourceFileFolder.setLayoutData(fdSourceFileFolder);
// Whenever something changes, set the tooltip to the expanded version:
wSourceFileFolder.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wSourceFileFolder.setToolTipText(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
}
});
wbSourceFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*" });
if (wSourceFileFolder.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wSourceFileFolder.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// Buttons to the right of the screen...
wbdSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbdSourceFileFolder);
wbdSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameDelete.Button"));
wbdSourceFileFolder.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameDelete.Tooltip"));
fdbdSourceFileFolder = new FormData();
fdbdSourceFileFolder.right = new FormAttachment(100, 0);
fdbdSourceFileFolder.top = new FormAttachment(wSourceFileFolder, 40);
wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder);
wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
props.setLook(wbeSourceFileFolder);
wbeSourceFileFolder.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.FilenameEdit.Button"));
fdbeSourceFileFolder = new FormData();
fdbeSourceFileFolder.right = new FormAttachment(100, 0);
fdbeSourceFileFolder.left = new FormAttachment(wbdSourceFileFolder, 0, SWT.LEFT);
fdbeSourceFileFolder.top = new FormAttachment(wbdSourceFileFolder, margin);
wbeSourceFileFolder.setLayoutData(fdbeSourceFileFolder);
// Wildcard
wlWildcard = new Label(wGeneralComp, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Wildcard.Label"));
props.setLook(wlWildcard);
fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wSourceFileFolder, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wWildcard.setToolTipText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wSourceFileFolder, margin);
fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55);
wWildcard.setLayoutData(fdWildcard);
wlFields = new Label(wGeneralComp, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.right = new FormAttachment(middle, -margin);
fdlFields.top = new FormAttachment(wWildcard, margin);
wlFields.setLayoutData(fdlFields);
int rows = jobEntry.getSourceFileFolder() == null ? 1 : (jobEntry.getSourceFileFolder().length == 0 ? 0 : jobEntry.getSourceFileFolder().length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.SourceFileFolder.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.IncludeSubDirs.Label"), ColumnInfo.COLUMN_TYPE_CCOMBO, JobEntryEvalFilesMetrics.IncludeSubFoldersDesc) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.SourceFileFolder.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Fields.Wildcard.Tooltip"));
wFields = new TableView(jobMeta, wGeneralComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(wbeSourceFileFolder, -margin);
fdFields.bottom = new FormAttachment(100, -margin);
wFields.setLayoutData(fdFields);
// RefreshArgFromPrevious();
// Add the file to the list of files...
SelectionAdapter selA = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
wFields.add(new String[] { wSourceFileFolder.getText(), wWildcard.getText() });
wSourceFileFolder.setText("");
wWildcard.setText("");
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
};
wbaSourceFileFolder.addSelectionListener(selA);
wSourceFileFolder.addSelectionListener(selA);
// Delete files from the list of files...
wbdSourceFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
int[] idx = wFields.getSelectionIndices();
wFields.remove(idx);
wFields.removeEmptyRows();
wFields.setRowNums();
}
});
// Edit the selected file & remove from the list...
wbeSourceFileFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
int idx = wFields.getSelectionIndex();
if (idx >= 0) {
String[] string = wFields.getItem(idx);
wSourceFileFolder.setText(string[0]);
wWildcard.setText(string[1]);
wFields.remove(idx);
}
wFields.removeEmptyRows();
wFields.setRowNums();
}
});
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////////////////
// START OF ADVANCED TAB ///
// ///////////////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.Tab.Advanced.Label"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdvancedComp);
wAdvancedComp.setLayout(contentLayout);
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "JobEvalFilesMetrics.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Scale
wlScale = new Label(wSuccessOn, SWT.RIGHT);
wlScale.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.Scale.Label"));
props.setLook(wlScale);
fdlScale = new FormData();
fdlScale.left = new FormAttachment(0, 0);
fdlScale.right = new FormAttachment(middle, -margin);
fdlScale.top = new FormAttachment(0, margin);
wlScale.setLayoutData(fdlScale);
wScale = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wScale.setItems(JobEntryEvalFilesMetrics.scaleDesc);
// +1: starts at -1
wScale.select(0);
props.setLook(wScale);
fdScale = new FormData();
fdScale.left = new FormAttachment(middle, 0);
fdScale.top = new FormAttachment(0, margin);
fdScale.right = new FormAttachment(100, 0);
wScale.setLayoutData(fdScale);
wScale.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Success number Condition
wlSuccessNumberCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessNumberCondition.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.SuccessCondition.Label"));
props.setLook(wlSuccessNumberCondition);
fdlSuccessNumberCondition = new FormData();
fdlSuccessNumberCondition.left = new FormAttachment(0, 0);
fdlSuccessNumberCondition.right = new FormAttachment(middle, -margin);
fdlSuccessNumberCondition.top = new FormAttachment(wScale, margin);
wlSuccessNumberCondition.setLayoutData(fdlSuccessNumberCondition);
wSuccessNumberCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessNumberCondition.setItems(JobEntrySimpleEval.successNumberConditionDesc);
// +1: starts at -1
wSuccessNumberCondition.select(0);
props.setLook(wSuccessNumberCondition);
fdSuccessNumberCondition = new FormData();
fdSuccessNumberCondition.left = new FormAttachment(middle, 0);
fdSuccessNumberCondition.top = new FormAttachment(wScale, margin);
fdSuccessNumberCondition.right = new FormAttachment(100, 0);
wSuccessNumberCondition.setLayoutData(fdSuccessNumberCondition);
wSuccessNumberCondition.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refresh();
jobEntry.setChanged();
}
});
// Compare with value
wlCompareValue = new Label(wSuccessOn, SWT.RIGHT);
wlCompareValue.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.CompareValue.Label"));
props.setLook(wlCompareValue);
fdlCompareValue = new FormData();
fdlCompareValue.left = new FormAttachment(0, 0);
fdlCompareValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdlCompareValue.right = new FormAttachment(middle, -margin);
wlCompareValue.setLayoutData(fdlCompareValue);
wCompareValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.CompareValue.Tooltip"));
props.setLook(wCompareValue);
wCompareValue.addModifyListener(lsMod);
fdCompareValue = new FormData();
fdCompareValue.left = new FormAttachment(middle, 0);
fdCompareValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdCompareValue.right = new FormAttachment(100, -margin);
wCompareValue.setLayoutData(fdCompareValue);
// Min value
wlMinValue = new Label(wSuccessOn, SWT.RIGHT);
wlMinValue.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MinValue.Label"));
props.setLook(wlMinValue);
fdlMinValue = new FormData();
fdlMinValue.left = new FormAttachment(0, 0);
fdlMinValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdlMinValue.right = new FormAttachment(middle, -margin);
wlMinValue.setLayoutData(fdlMinValue);
wMinValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MinValue.Tooltip"));
props.setLook(wMinValue);
wMinValue.addModifyListener(lsMod);
fdMinValue = new FormData();
fdMinValue.left = new FormAttachment(middle, 0);
fdMinValue.top = new FormAttachment(wSuccessNumberCondition, margin);
fdMinValue.right = new FormAttachment(100, -margin);
wMinValue.setLayoutData(fdMinValue);
// Maximum value
wlMaxValue = new Label(wSuccessOn, SWT.RIGHT);
wlMaxValue.setText(BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MaxValue.Label"));
props.setLook(wlMaxValue);
fdlMaxValue = new FormData();
fdlMaxValue.left = new FormAttachment(0, 0);
fdlMaxValue.top = new FormAttachment(wMinValue, margin);
fdlMaxValue.right = new FormAttachment(middle, -margin);
wlMaxValue.setLayoutData(fdlMaxValue);
wMaxValue = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobEvalFilesMetricsDialog.MaxValue.Tooltip"));
props.setLook(wMaxValue);
wMaxValue.addModifyListener(lsMod);
fdMaxValue = new FormData();
fdMaxValue.left = new FormAttachment(middle, 0);
fdMaxValue.top = new FormAttachment(wMinValue, margin);
fdMaxValue.right = new FormAttachment(100, -margin);
wMaxValue.setLayoutData(fdMaxValue);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(0, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON 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(100, 0);
wAdvancedComp.setLayoutData(wAdvancedComp);
wAdvancedComp.layout();
wAdvancedTab.setControl(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);
wSourceFileFolder.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
refresh();
RefreshSize();
RefreshSourceFiles();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations