use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class InsertUpdateDialog 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) {
tableItem.setText(2, "=");
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wKey, 1, new int[] { 1, 3 }, new int[] {}, -1, -1, listener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "InsertUpdateDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "InsertUpdateDialog.FailedToGetFields.DialogMessage"), ke);
}
}
use of org.pentaho.di.ui.trans.step.TableItemInsertListener in project pentaho-kettle by pentaho.
the class ExcelOutputDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
@Override
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.isNumber()) {
if (v.getLength() > 0) {
int le = v.getLength();
int pr = v.getPrecision();
if (v.getPrecision() <= 0) {
pr = 0;
}
String mask = "";
for (int m = 0; m < le - pr; m++) {
mask += "0";
}
if (pr > 0) {
mask += ".";
}
for (int m = 0; m < pr; m++) {
mask += "0";
}
tableItem.setText(3, mask);
}
}
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] { 2 }, 4, 5, listener);
}
} 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 ExcelWriterStepDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
@Override
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.isNumber()) {
if (v.getLength() > 0) {
int le = v.getLength();
int pr = v.getPrecision();
if (v.getPrecision() <= 0) {
pr = 0;
}
String mask = "";
for (int m = 0; m < le - pr; m++) {
mask += "0";
}
if (pr > 0) {
mask += ".";
}
for (int m = 0; m < pr; m++) {
mask += "0";
}
tableItem.setText(3, mask);
}
}
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1, 5 }, new int[] { 2 }, 0, 0, listener);
}
} 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 XMLOutputDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null && !r.isEmpty()) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.isNumber()) {
if (v.getLength() > 0) {
int le = v.getLength();
int pr = v.getPrecision();
if (v.getPrecision() <= 0) {
pr = 0;
}
String mask = " ";
for (int m = 0; m < le - pr; m++) {
mask += "0";
}
if (pr > 0) {
mask += ".";
}
for (int m = 0; m < pr; m++) {
mask += "0";
}
tableItem.setText(4, mask);
}
}
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] { 4 }, 6, 7, listener);
}
} 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 SalesforceInsertDialog method getUpdate.
private void getUpdate() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
@Override
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
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, "SalesforceInsertDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "SalesforceInsertDialog.FailedToGetFields.DialogMessage"), ke);
}
}
Aggregations