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 GPLoadDialog method addLocalHostsTabItem.
private void addLocalHostsTabItem(CTabFolder tabFolder, int margin, ModifyListener lsMod, FocusListener lsFocusLost) {
CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setText(BaseMessages.getString(PKG, "GPLoadDialog.LocalHostsTab.Title"));
Composite wLocalHostsComp = new Composite(tabFolder, SWT.NONE);
props.setLook(wLocalHostsComp);
int middle = props.getMiddlePct();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 3;
formLayout.marginHeight = 3;
wLocalHostsComp.setLayout(formLayout);
// Master Port line...
Label wlLocalhostPort = new Label(wLocalHostsComp, SWT.NONE);
wlLocalhostPort.setText(BaseMessages.getString(PKG, "GPLoadDialog.Port.Label"));
props.setLook(wlLocalhostPort);
FormData fdlLocalhostPort = new FormData();
fdlLocalhostPort.left = new FormAttachment(0, 0);
fdlLocalhostPort.top = new FormAttachment(0, margin * 2);
wlLocalhostPort.setLayoutData(fdlLocalhostPort);
wLocalhostPort = new TextVar(transMeta, wLocalHostsComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLocalhostPort);
wLocalhostPort.addModifyListener(lsMod);
wLocalhostPort.addFocusListener(lsFocusLost);
FormData fdLocalhostPort = new FormData();
fdLocalhostPort.left = new FormAttachment(wlLocalhostPort, margin);
fdLocalhostPort.top = new FormAttachment(0, margin * 2);
fdLocalhostPort.right = new FormAttachment(middle, 0);
wLocalhostPort.setLayoutData(fdLocalhostPort);
wLocalhostPort.addModifyListener(lsMod);
// Local Hosts Label
Label wlLocalHosts = new Label(wLocalHostsComp, SWT.NONE);
wlLocalHosts.setText(BaseMessages.getString(PKG, "GPLoadDialog.LocalHosts.Label"));
props.setLook(wlLocalHosts);
FormData fdlLocalHosts = new FormData();
fdlLocalHosts.left = new FormAttachment(0, 0);
fdlLocalHosts.top = new FormAttachment(wLocalhostPort, margin);
wlLocalHosts.setLayoutData(fdlLocalHosts);
// Local Hosts Table
int LocalHostsColumns = 1;
int LocalHostsRows = (input.getLocalHosts() != null ? input.getLocalHosts().length : 1);
ciLocalHosts = new ColumnInfo[LocalHostsColumns];
ciLocalHosts[0] = new ColumnInfo(BaseMessages.getString(PKG, "GPLoadDialog.ColumnInfo.LocalHosts"), ColumnInfo.COLUMN_TYPE_TEXT, new String[] { "" }, false);
localHostsColumns.add(ciReturn[0]);
wLocalHosts = new TableView(transMeta, wLocalHostsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciLocalHosts, LocalHostsRows, lsMod, props);
FormData fdLocalHostsComp = new FormData();
fdLocalHostsComp.left = new FormAttachment(0, 0);
fdLocalHostsComp.top = new FormAttachment(wlLocalHosts, margin);
fdLocalHostsComp.right = new FormAttachment(75, 0);
fdLocalHostsComp.bottom = new FormAttachment(100, -margin);
wLocalHosts.setLayoutData(fdLocalHostsComp);
wLocalHostsComp.layout();
tabItem.setControl(wLocalHostsComp);
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class GPLoadDialog method addFieldTabItem.
private void addFieldTabItem(CTabFolder tabFolder, int margin, ModifyListener lsMod) {
Label wlLoadAction;
FormData fdFieldsComp;
Button wDoMapping;
FormData fdDoMapping;
// create the fields tab item
CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setText(BaseMessages.getString(PKG, "GPLoadDialog.FieldsTab.Title"));
// Create the composite that the individual controls will be placed in
Composite wFieldsComp = new Composite(tabFolder, SWT.NONE);
props.setLook(wFieldsComp);
FormLayout tabFieldLayout = new FormLayout();
tabFieldLayout.marginWidth = 3;
tabFieldLayout.marginHeight = 3;
wFieldsComp.setLayout(tabFieldLayout);
// Load Action line
wlLoadAction = new Label(wFieldsComp, 0);
wlLoadAction.setText(BaseMessages.getString(PKG, "GPLoadDialog.LoadAction.Label"));
props.setLook(wlLoadAction);
FormData fdlLoadAction = new FormData();
fdlLoadAction.left = new FormAttachment(0, 0);
fdlLoadAction.top = new FormAttachment(0, margin);
wlLoadAction.setLayoutData(fdlLoadAction);
wLoadAction = new CCombo(wFieldsComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLoadAction.add(BaseMessages.getString(PKG, "GPLoadDialog.InsertLoadAction.Label"));
wLoadAction.add(BaseMessages.getString(PKG, "GPLoadDialog.UpdateLoadAction.Label"));
wLoadAction.add(BaseMessages.getString(PKG, "GPLoadDialog.MergeLoadAction.Label"));
// +1: starts at -1
wLoadAction.select(0);
wLoadAction.addModifyListener(lsMod);
props.setLook(wLoadAction);
FormData fdLoadAction = new FormData();
fdLoadAction.left = new FormAttachment(wlLoadAction, margin);
fdLoadAction.top = new FormAttachment(0, margin);
wLoadAction.setLayoutData(fdLoadAction);
wDoMapping = new Button(wFieldsComp, SWT.PUSH);
wDoMapping.setText(BaseMessages.getString(PKG, "GPLoadDialog.EditMapping.Label"));
fdDoMapping = new FormData();
fdDoMapping.top = new FormAttachment(0, margin);
fdDoMapping.right = new FormAttachment(75, 0);
wDoMapping.setLayoutData(fdDoMapping);
Button wGetLU = new Button(wFieldsComp, SWT.PUSH);
wGetLU.setText(BaseMessages.getString(PKG, "GPLoadDialog.GetFields.Label"));
FormData fdGetLU = new FormData();
fdGetLU.top = new FormAttachment(0, margin);
fdGetLU.right = new FormAttachment(wDoMapping, -margin);
wGetLU.setLayoutData(fdGetLU);
wDoMapping.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
generateMappings();
}
});
// The Field Table
int numberOfColumns = 5;
int UpInsRows = (input.getFieldTable() != null ? input.getFieldTable().length : 1);
ciReturn = new ColumnInfo[numberOfColumns];
ciReturn[0] = new ColumnInfo(BaseMessages.getString(PKG, "GPLoadDialog.ColumnInfo.TableField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciReturn[1] = new ColumnInfo(BaseMessages.getString(PKG, "GPLoadDialog.ColumnInfo.StreamField"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false);
ciReturn[2] = new ColumnInfo(BaseMessages.getString(PKG, "GPLoadDialog.ColumnInfo.DateMask"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "", BaseMessages.getString(PKG, "GPLoadDialog.DateMask.Label"), BaseMessages.getString(PKG, "GPLoadDialog.DateTimeMask.Label") }, true);
ciReturn[3] = new ColumnInfo(BaseMessages.getString(PKG, "GPLoadDialog.ColumnInfo.ColumnMatch"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true);
ciReturn[4] = new ColumnInfo(BaseMessages.getString(PKG, "GPLoadDialog.ColumnInfo.ColumnUpdate"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true);
tableFieldColumns.add(ciReturn[0]);
wReturn = new TableView(transMeta, wFieldsComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciReturn, UpInsRows, lsMod, props);
FormData fdReturn = new FormData();
fdReturn.left = new FormAttachment(0, 0);
fdReturn.top = new FormAttachment(wLoadAction, margin);
// (wGetLU, 100);
fdReturn.right = new FormAttachment(75, 0);
fdReturn.bottom = new FormAttachment(100, -2 * margin);
wReturn.setLayoutData(fdReturn);
fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, margin);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldsComp.setLayoutData(fdFieldsComp);
Label wlUpdateCondition = new Label(wFieldsComp, 0);
wlUpdateCondition.setText(BaseMessages.getString(PKG, "GPLoadDialog.UpdateCondition.Label"));
props.setLook(wlUpdateCondition);
FormData fdlUpdateCondition = new FormData();
fdlUpdateCondition.top = new FormAttachment(wDoMapping, margin);
fdlUpdateCondition.left = new FormAttachment(wReturn, margin);
wlUpdateCondition.setLayoutData(fdlUpdateCondition);
wUpdateCondition = new Text(wFieldsComp, SWT.MULTI | SWT.WRAP | SWT.LEFT | SWT.BORDER);
props.setLook(wUpdateCondition);
wUpdateCondition.addModifyListener(lsMod);
FormData fdUpdateCondition = new FormData();
fdUpdateCondition.top = new FormAttachment(wlUpdateCondition, margin);
fdUpdateCondition.left = new FormAttachment(wReturn, margin);
fdUpdateCondition.right = new FormAttachment(100, -margin);
fdUpdateCondition.bottom = new FormAttachment(50, 0);
wUpdateCondition.setLayoutData(fdUpdateCondition);
wFieldsComp.layout();
tabItem.setControl(wFieldsComp);
Listener lsGetLU = new Listener() {
public void handleEvent(Event e) {
getUpdate();
}
};
wGetLU.addListener(SWT.Selection, lsGetLU);
}
use of org.pentaho.di.ui.core.widget.TableView in project pentaho-kettle by pentaho.
the class BlockUntilStepsFinishDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "BlockUntilStepsFinishDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "BlockUntilStepsFinishDialog.Stepname.Label"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.right = new FormAttachment(middle, -margin);
fdlStepname.top = new FormAttachment(0, margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
// Get the previous steps...
setStepNames();
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wGet = new Button(shell, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "BlockUntilStepsFinishDialog.getSteps.Label"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wGet, wCancel }, margin, null);
// Table with fields
wlFields = new Label(shell, SWT.NONE);
wlFields.setText(BaseMessages.getString(PKG, "BlockUntilStepsFinishDialog.Fields.Label"));
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.top = new FormAttachment(wStepname, margin);
wlFields.setLayoutData(fdlFields);
final int FieldsCols = 2;
final int FieldsRows = input.getStepName().length;
ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "BlockUntilStepsFinishDialog.Fieldname.Step"), ColumnInfo.COLUMN_TYPE_CCOMBO, previousSteps, false);
colinf[1] = new ColumnInfo(BaseMessages.getString(PKG, "BlockUntilStepsFinishDialog.Fieldname.CopyNr"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[1].setUsingVariables(true);
wFields = new TableView(transMeta, 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(100, 0);
fdFields.bottom = new FormAttachment(wOK, -2 * margin);
wFields.setLayoutData(fdFields);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsGet = new Listener() {
public void handleEvent(Event e) {
get();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
// Set the shell size, based upon previous time...
setSize();
getData();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
Aggregations