use of org.pentaho.di.ui.core.widget.TableView in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestResults method initTableView.
private TableView initTableView(List<Object[]> rows) {
for (Control control : container.getChildren()) {
control.dispose();
}
TableView tableView = new TableView(transMeta, container, SWT.NONE, rowMetaToColumnInfo(), rows.size(), true, null, PropsUI.getInstance());
tableView.table.setItemCount(0);
return tableView;
}
use of org.pentaho.di.ui.core.widget.TableView in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestResults method load.
public void load(List<Object[]> rows, Listener tableKeyListener) {
TableView tableView = initTableView(rows);
tableView.table.addListener(SWT.KeyDown, tableKeyListener);
for (Object[] rowData : rows) {
TableItem item = new TableItem(tableView.table, SWT.NONE);
applyRowDataToTableItem(rowData, item);
}
tableView.setRowNums();
tableView.setShowingConversionErrorsInline(true);
tableView.optWidth(true);
container.layout();
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class Translator2 method addLists.
private void addLists() {
Composite composite = new Composite(sashform, SWT.NONE);
props.setLook(composite);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = Const.FORM_MARGIN;
formLayout.marginWidth = Const.FORM_MARGIN;
composite.setLayout(formLayout);
wLocale = new List(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
FormData fdLocale = new FormData();
fdLocale.left = new FormAttachment(0, 0);
fdLocale.right = new FormAttachment(100, 0);
fdLocale.top = new FormAttachment(0, 0);
fdLocale.bottom = new FormAttachment(10, 0);
wLocale.setLayoutData(fdLocale);
ColumnInfo[] colinfo = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "i18nDialog.SourceFolder"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "i18nDialog.Packagename"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
wPackages = new TableView(new Variables(), composite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 1, true, null, props);
FormData fdPackages = new FormData();
fdPackages.left = new FormAttachment(0, 0);
fdPackages.right = new FormAttachment(100, 0);
fdPackages.top = new FormAttachment(wLocale, Const.MARGIN);
fdPackages.bottom = new FormAttachment(100, 0);
wPackages.setLayoutData(fdPackages);
wPackages.setSortable(false);
FormData fdComposite = new FormData();
fdComposite.left = new FormAttachment(0, 0);
fdComposite.right = new FormAttachment(100, 0);
fdComposite.top = new FormAttachment(0, 0);
fdComposite.bottom = new FormAttachment(100, 0);
composite.setLayoutData(fdComposite);
// Add a selection listener.
wLocale.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refreshGrid();
}
});
wPackages.table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refreshGrid();
}
});
composite.layout();
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class JobDialog method addParamTab.
private void addParamTab() {
// ////////////////////////
// START OF PARAM TAB
// /
wParamTab = new CTabItem(wTabFolder, SWT.NONE);
wParamTab.setText(BaseMessages.getString(PKG, "JobDialog.ParamTab.Label"));
FormLayout paramLayout = new FormLayout();
paramLayout.marginWidth = Const.MARGIN;
paramLayout.marginHeight = Const.MARGIN;
Composite wParamComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wParamComp);
wParamComp.setLayout(paramLayout);
Label wlFields = new Label(wParamComp, SWT.RIGHT);
wlFields.setText(BaseMessages.getString(PKG, "JobDialog.Parameters.Label"));
props.setLook(wlFields);
FormData fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(0, 0);
wlFields.setLayoutData(fdlFields);
final int FieldsCols = 3;
final int FieldsRows = jobMeta.listParameters().length;
ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.ColumnInfo.Parameter.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[1] = new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.ColumnInfo.Default.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[2] = new ColumnInfo(BaseMessages.getString(PKG, "JobDialog.ColumnInfo.Description.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false);
wParamFields = new TableView(jobMeta, wParamComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
FormData fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, 0);
wParamFields.setLayoutData(fdFields);
FormData fdDepComp = new FormData();
fdDepComp.left = new FormAttachment(0, 0);
fdDepComp.top = new FormAttachment(0, 0);
fdDepComp.right = new FormAttachment(100, 0);
fdDepComp.bottom = new FormAttachment(100, 0);
wParamComp.setLayoutData(fdDepComp);
wParamComp.layout();
wParamTab.setControl(wParamComp);
// ///////////////////////////////////////////////////////////
// / END OF PARAM TAB
// ///////////////////////////////////////////////////////////
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class JobEntryCheckFilesLockedDialog 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, "JobCheckFilesLocked.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.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);
// SETTINGS grouping?
// ////////////////////////
// START OF SETTINGS GROUP
//
wSettings = new Group(shell, SWT.SHADOW_NONE);
props.setLook(wSettings);
wSettings.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.Settings.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wSettings.setLayout(groupLayout);
wlIncludeSubfolders = new Label(wSettings, SWT.RIGHT);
wlIncludeSubfolders.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.IncludeSubfolders.Label"));
props.setLook(wlIncludeSubfolders);
fdlIncludeSubfolders = new FormData();
fdlIncludeSubfolders.left = new FormAttachment(0, 0);
fdlIncludeSubfolders.top = new FormAttachment(wName, margin);
fdlIncludeSubfolders.right = new FormAttachment(middle, -margin);
wlIncludeSubfolders.setLayoutData(fdlIncludeSubfolders);
wIncludeSubfolders = new Button(wSettings, SWT.CHECK);
props.setLook(wIncludeSubfolders);
wIncludeSubfolders.setToolTipText(BaseMessages.getString(PKG, "JobCheckFilesLocked.IncludeSubfolders.Tooltip"));
fdIncludeSubfolders = new FormData();
fdIncludeSubfolders.left = new FormAttachment(middle, 0);
fdIncludeSubfolders.top = new FormAttachment(wName, margin);
fdIncludeSubfolders.right = new FormAttachment(100, 0);
wIncludeSubfolders.setLayoutData(fdIncludeSubfolders);
wIncludeSubfolders.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
wlPrevious = new Label(wSettings, SWT.RIGHT);
wlPrevious.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.Previous.Label"));
props.setLook(wlPrevious);
fdlPrevious = new FormData();
fdlPrevious.left = new FormAttachment(0, 0);
fdlPrevious.top = new FormAttachment(wIncludeSubfolders, margin);
fdlPrevious.right = new FormAttachment(middle, -margin);
wlPrevious.setLayoutData(fdlPrevious);
wPrevious = new Button(wSettings, SWT.CHECK);
props.setLook(wPrevious);
wPrevious.setSelection(jobEntry.argFromPrevious);
wPrevious.setToolTipText(BaseMessages.getString(PKG, "JobCheckFilesLocked.Previous.Tooltip"));
fdPrevious = new FormData();
fdPrevious.left = new FormAttachment(middle, 0);
fdPrevious.top = new FormAttachment(wIncludeSubfolders, margin);
fdPrevious.right = new FormAttachment(100, 0);
wPrevious.setLayoutData(fdPrevious);
wPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setPrevious();
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
// ///////////////////////////////////////////////////////////
// Filename line
wlFilename = new Label(shell, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wSettings, 2 * margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
// Browse Source folders button ...
wbDirectory = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbDirectory);
wbDirectory.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.BrowseFolders.Label"));
fdbDirectory = new FormData();
fdbDirectory.right = new FormAttachment(100, -margin);
fdbDirectory.top = new FormAttachment(wSettings, margin);
wbDirectory.setLayoutData(fdbDirectory);
wbDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wFilename.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wFilename.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
wFilename.setText(dir);
}
}
});
wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.BrowseFiles.Label"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wSettings, margin);
fdbFilename.right = new FormAttachment(wbDirectory, -margin);
wbFilename.setLayoutData(fdbFilename);
wbaFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbaFilename);
wbaFilename.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.FilenameAdd.Button"));
fdbaFilename = new FormData();
fdbaFilename.right = new FormAttachment(wbFilename, -margin);
fdbaFilename.top = new FormAttachment(wSettings, margin);
wbaFilename.setLayoutData(fdbaFilename);
wFilename = new TextVar(jobMeta, shell, 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(wSettings, 2 * margin);
fdFilename.right = new FormAttachment(wbFilename, -55);
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 SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*" });
if (wFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// Filemask
wlFilemask = new Label(shell, SWT.RIGHT);
wlFilemask.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.Wildcard.Label"));
props.setLook(wlFilemask);
fdlFilemask = new FormData();
fdlFilemask.left = new FormAttachment(0, 0);
fdlFilemask.top = new FormAttachment(wFilename, margin);
fdlFilemask.right = new FormAttachment(middle, -margin);
wlFilemask.setLayoutData(fdlFilemask);
wFilemask = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobCheckFilesLocked.Wildcard.Tooltip"));
props.setLook(wFilemask);
wFilemask.addModifyListener(lsMod);
fdFilemask = new FormData();
fdFilemask.left = new FormAttachment(middle, 0);
fdFilemask.top = new FormAttachment(wFilename, margin);
fdFilemask.right = new FormAttachment(wbFilename, -55);
wFilemask.setLayoutData(fdFilemask);
// Buttons to the right of the screen...
wbdFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbdFilename);
wbdFilename.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.FilenameDelete.Button"));
wbdFilename.setToolTipText(BaseMessages.getString(PKG, "JobCheckFilesLocked.FilenameDelete.Tooltip"));
fdbdFilename = new FormData();
fdbdFilename.right = new FormAttachment(100, 0);
fdbdFilename.top = new FormAttachment(wFilemask, 40);
wbdFilename.setLayoutData(fdbdFilename);
wbeFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbeFilename);
wbeFilename.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.FilenameEdit.Button"));
wbeFilename.setToolTipText(BaseMessages.getString(PKG, "JobCheckFilesLocked.FilenameEdit.Tooltip"));
fdbeFilename = new FormData();
fdbeFilename.right = new FormAttachment(100, 0);
fdbeFilename.left = new FormAttachment(wbdFilename, 0, SWT.LEFT);
fdbeFilename.top = new FormAttachment(wbdFilename, margin);
wbeFilename.setLayoutData(fdbeFilename);
wlFields = new Label(shell, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "JobCheckFilesLocked.Fields.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.right = new FormAttachment(middle, -margin);
fdlFields.top = new FormAttachment(wFilemask, margin);
wlFields.setLayoutData(fdlFields);
int rows = jobEntry.arguments == null ? 1 : (jobEntry.arguments.length == 0 ? 0 : jobEntry.arguments.length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobCheckFilesLocked.Fields.Argument.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobCheckFilesLocked.Fields.Wildcard.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "JobCheckFilesLocked.Fields.Column"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "JobCheckFilesLocked.Wildcard.Column"));
wFields = new TableView(jobMeta, shell, 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(wbeFilename, -margin);
fdFields.bottom = new FormAttachment(100, -50);
wFields.setLayoutData(fdFields);
wlFields.setEnabled(!jobEntry.argFromPrevious);
wFields.setEnabled(!jobEntry.argFromPrevious);
// Add the file to the list of files...
SelectionAdapter selA = new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
wFields.add(new String[] { wFilename.getText(), wFilemask.getText() });
wFilename.setText("");
wFilemask.setText("");
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
};
wbaFilename.addSelectionListener(selA);
wFilename.addSelectionListener(selA);
// Delete files from the list of files...
wbdFilename.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...
wbeFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
int idx = wFields.getSelectionIndex();
if (idx >= 0) {
String[] string = wFields.getItem(idx);
wFilename.setText(string[0]);
wFilemask.setText(string[1]);
wFields.remove(idx);
}
wFields.removeEmptyRows();
wFields.setRowNums();
}
});
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
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);
wFilename.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setPrevious();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations