use of org.pentaho.di.ui.core.dialog.EnterNumberDialog in project pentaho-kettle by pentaho.
the class XBaseInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
try {
XBaseInputMeta oneMeta = new XBaseInputMeta();
getInfo(oneMeta);
if (oneMeta.isAcceptingFilenames()) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "XBaseInputDialog.Dialog.SpecifyASampleFile.Message"));
mb.setText(BaseMessages.getString(PKG, "XBaseInputDialog.Dialog.SpecifyASampleFile.Title"));
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "XBaseInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "XBaseInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), e);
}
}
use of org.pentaho.di.ui.core.dialog.EnterNumberDialog in project pentaho-kettle by pentaho.
the class YamlInputDialog method preview.
// Preview the data
private void preview() {
try {
// Create the XML input step
YamlInputMeta oneMeta = new YamlInputMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "YamlInputDialog.NumberRows.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.NumberRows.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
if (!progressDialog.isCancelled()) {
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "YamlInputDialog.ErrorPreviewingData.DialogTitle"), BaseMessages.getString(PKG, "YamlInputDialog.ErrorPreviewingData.DialogMessage"), e);
}
}
use of org.pentaho.di.ui.core.dialog.EnterNumberDialog in project pentaho-kettle by pentaho.
the class TextFileInputDialog method first.
// Get the first x lines
private void first(boolean skipHeaders) {
TextFileInputMeta info = new TextFileInputMeta();
getInfo(info);
try {
if (info.getTextFileList(transMeta).nrOfFiles() > 0) {
String shellText = BaseMessages.getString(PKG, "TextFileInputDialog.LinesToView.DialogTitle");
String lineText = BaseMessages.getString(PKG, "TextFileInputDialog.LinesToView.DialogMessage");
EnterNumberDialog end = new EnterNumberDialog(shell, 100, shellText, lineText);
int nrLines = end.open();
if (nrLines >= 0) {
List<String> linesList = getFirst(nrLines, skipHeaders);
if (linesList != null && linesList.size() > 0) {
String firstlines = "";
for (String aLinesList : linesList) {
firstlines += aLinesList + Const.CR;
}
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "TextFileInputDialog.ContentOfFirstFile.DialogTitle"), (nrLines == 0 ? BaseMessages.getString(PKG, "TextFileInputDialog.ContentOfFirstFile.AllLines.DialogMessage") : BaseMessages.getString(PKG, "TextFileInputDialog.ContentOfFirstFile.NLines.DialogMessage", "" + nrLines)), firstlines, true);
etd.setReadOnly();
etd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.UnableToReadLines.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.UnableToReadLines.DialogTitle"));
mb.open();
}
}
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.NoValidFile.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
mb.open();
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "TextFileInputDialog.ErrorGettingData.DialogMessage"), e);
}
}
use of org.pentaho.di.ui.core.dialog.EnterNumberDialog in project pentaho-kettle by pentaho.
the class TextFileInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
TextFileInputMeta oneMeta = new TextFileInputMeta();
getInfo(oneMeta);
if (oneMeta.isAcceptingFilenames()) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Message"));
mb.setText(BaseMessages.getString(PKG, "TextFileInputDialog.Dialog.SpecifyASampleFile.Title"));
mb.open();
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "TextFileInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
use of org.pentaho.di.ui.core.dialog.EnterNumberDialog in project pentaho-kettle by pentaho.
the class OlapInputDialog method preview.
/**
* Preview the data generated by this step. This generates a transformation using this step & a dummy and previews it.
*/
private void preview() {
// Create the table input reader step...
OlapInputMeta oneMeta = new OlapInputMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "OlapInputDialog.EnterPreviewSize"), BaseMessages.getString(PKG, "OlapDialog.NumberOfRowsToPreview"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
Aggregations