use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class MySQLBulkLoaderDialog method getUpdate.
private void getUpdate() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.getType() == ValueMetaInterface.TYPE_DATE) {
// The default is : format is OK for dates, see if this sticks later on...
//
tableItem.setText(3, "Y");
} else {
// default is OK too...
tableItem.setText(3, "Y");
}
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wReturn, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "MySQLBulkLoaderDialog.FailedToGetFields.DialogMessage"), ke);
}
}
use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class OraBulkLoaderDialog method getUpdate.
private void getUpdate() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.getType() == ValueMetaInterface.TYPE_DATE) {
// The default is date mask.
tableItem.setText(3, BaseMessages.getString(PKG, "OraBulkLoaderDialog.DateMask.Label"));
} else {
tableItem.setText(3, "");
}
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wReturn, 1, new int[] { 1, 2 }, new int[] {}, -1, -1, listener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "OraBulkLoaderDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "OraBulkLoaderDialog.FailedToGetFields.DialogMessage"), ke);
}
}
use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class PentahoReportingOutputDialog method get.
private void get() {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
// See if we need to boot the reporting engine. Since this takes time we do it in the background...
//
Runnable runnable = new Runnable() {
@Override
public void run() {
PentahoReportingOutput.performPentahoReportingBoot(log, input.getClass());
}
};
Thread thread = new Thread(runnable);
thread.start();
try {
// Browse for a PRPT...
//
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setText(BaseMessages.getString(PKG, "PentahoReportingOutputDialog.ExtractParameters.FileDialog"));
dialog.setFilterExtensions(new String[] { "*.prpt;*.PRPT", "*" });
if (lastFilename != null) {
dialog.setFileName(lastFilename);
}
dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "PentahoReportingOutputDialog.PentahoReportingFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
if (dialog.open() == null) {
return;
}
thread.join();
String sourceFilename = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
lastFilename = sourceFilename;
shell.setCursor(busy);
// Load the master report...
//
MasterReport report = PentahoReportingOutput.loadMasterReport(sourceFilename);
// Extract the definitions...
//
ReportParameterDefinition definition = report.getParameterDefinition();
RowMetaInterface r = new RowMeta();
for (int i = 0; i < definition.getParameterCount(); i++) {
ParameterDefinitionEntry entry = definition.getParameterDefinition(i);
ValueMetaInterface valueMeta = new ValueMetaString(entry.getName());
valueMeta.setComments(getParameterDefinitionEntryTypeDescription(entry));
r.addValueMeta(valueMeta);
}
shell.setCursor(null);
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, new TableItemInsertListener() {
@Override
public boolean tableItemInserted(TableItem item, ValueMetaInterface valueMeta) {
item.setText(2, valueMeta.getComments());
return true;
}
});
} catch (Exception e) {
shell.setCursor(null);
new ErrorDialog(shell, BaseMessages.getString(PKG, "PentahoReportingOutputDialog.ErrorReadingParameters.Title"), BaseMessages.getString(PKG, "PentahoReportingOutputDialog.ErrorReadingParameters.Message"), e);
} finally {
shell.setCursor(null);
busy.dispose();
}
}
use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class SortRowsDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener insertListener = new TableItemInsertListener() {
@Override
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
tableItem.setText(2, BaseMessages.getString(PKG, "System.Combo.Yes"));
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, insertListener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), ke);
}
}
use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class StringCutDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.getType() == ValueMetaInterface.TYPE_STRING) {
// Only process strings
return true;
} else {
return false;
}
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, listener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "StringCutDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "StringCutDialog.FailedToGetFields.DialogMessage"), ke);
}
}
Aggregations