use of org.pentaho.di.trans.steps.denormaliser.DenormaliserTargetField in project pentaho-kettle by pentaho.
the class DenormaliserDialog method ok.
private void ok() {
if (Utils.isEmpty(wStepname.getText())) {
return;
}
int sizegroup = wGroup.nrNonEmpty();
int nrfields = wTarget.nrNonEmpty();
input.setKeyField(wKeyField.getText());
input.allocate(sizegroup, nrfields);
for (int i = 0; i < sizegroup; i++) {
TableItem item = wGroup.getNonEmpty(i);
// CHECKSTYLE:Indentation:OFF
input.getGroupField()[i] = item.getText(1);
}
for (int i = 0; i < nrfields; i++) {
DenormaliserTargetField field = new DenormaliserTargetField();
TableItem item = wTarget.getNonEmpty(i);
field.setTargetName(item.getText(1));
field.setFieldName(item.getText(2));
field.setKeyValue(item.getText(3));
field.setTargetType(item.getText(4));
field.setTargetFormat(item.getText(5));
field.setTargetLength(Const.toInt(item.getText(6), -1));
field.setTargetPrecision(Const.toInt(item.getText(7), -1));
field.setTargetCurrencySymbol(item.getText(8));
field.setTargetDecimalSymbol(item.getText(9));
field.setTargetGroupingSymbol(item.getText(10));
field.setTargetNullString(item.getText(11));
field.setTargetAggregationType(item.getText(12));
// CHECKSTYLE:Indentation:OFF
input.getDenormaliserTargetField()[i] = field;
}
stepname = wStepname.getText();
if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y"))) {
MessageDialogWithToggle md = new MessageDialogWithToggle(shell, BaseMessages.getString(PKG, "DenormaliserDialog.Unpivot.DialogTitle"), null, BaseMessages.getString(PKG, "DenormaliserDialog.Unpivot.DialogMessage", Const.CR, Const.CR), MessageDialog.WARNING, new String[] { BaseMessages.getString(PKG, "DenormaliserDialog.WarningMessage.Option.1") }, 0, BaseMessages.getString(PKG, "DenormaliserDialog.WarningMessage.Option.2"), "N".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y")));
MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
md.open();
props.setCustomParameter(STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y");
props.saveProps();
}
dispose();
}
use of org.pentaho.di.trans.steps.denormaliser.DenormaliserTargetField in project pentaho-kettle by pentaho.
the class DenormaliserDialog method getData.
/**
* Copy information from the meta-data input to the dialog fields.
*/
public void getData() {
logDebug(BaseMessages.getString(PKG, "DenormaliserDialog.Log.Getting.KeyInfo"));
if (input.getKeyField() != null) {
wKeyField.setText(input.getKeyField());
}
if (input.getGroupField() != null) {
for (int i = 0; i < input.getGroupField().length; i++) {
TableItem item = wGroup.table.getItem(i);
if (input.getGroupField()[i] != null) {
item.setText(1, input.getGroupField()[i]);
}
}
}
if (input.getDenormaliserTargetField() != null) {
for (int i = 0; i < input.getDenormaliserTargetField().length; i++) {
DenormaliserTargetField field = input.getDenormaliserTargetField()[i];
TableItem item = wTarget.table.getItem(i);
if (field.getTargetName() != null) {
item.setText(1, field.getTargetName());
}
if (field.getFieldName() != null) {
item.setText(2, field.getFieldName());
}
if (field.getKeyValue() != null) {
item.setText(3, field.getKeyValue());
}
if (field.getTargetTypeDesc() != null) {
item.setText(4, field.getTargetTypeDesc());
}
if (field.getTargetFormat() != null) {
item.setText(5, field.getTargetFormat());
}
if (field.getTargetLength() >= 0) {
item.setText(6, "" + field.getTargetLength());
}
if (field.getTargetPrecision() >= 0) {
item.setText(7, "" + field.getTargetPrecision());
}
if (field.getTargetCurrencySymbol() != null) {
item.setText(8, field.getTargetCurrencySymbol());
}
if (field.getTargetDecimalSymbol() != null) {
item.setText(9, field.getTargetDecimalSymbol());
}
if (field.getTargetGroupingSymbol() != null) {
item.setText(10, field.getTargetGroupingSymbol());
}
if (field.getTargetNullString() != null) {
item.setText(11, field.getTargetNullString());
}
if (field.getTargetAggregationType() >= 0) {
item.setText(12, field.getTargetAggregationTypeDescLong());
}
}
}
wGroup.setRowNums();
wGroup.optWidth(true);
wTarget.setRowNums();
wTarget.optWidth(true);
wStepname.selectAll();
wStepname.setFocus();
}
Aggregations