use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-cassandra-plugin by pentaho.
the class CassandraInputDialog method preview.
private void preview() {
CassandraInputMeta oneMeta = new CassandraInputMeta();
getInfo(oneMeta);
// Turn off execute for each incoming row (if set). Query is still going to
// be stuffed if the user has specified field replacement (i.e. ?{...}) in
// the query string
oneMeta.setExecuteForEachIncomingRow(false);
if (!checkForUnresolved(oneMeta, BaseMessages.getString(PKG, "CassandraInputDialog.Warning.Message.CassandraQueryContainsUnresolvedVarsFieldSubs.PreviewTitle"))) {
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, m_stepnameText.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraInputDialog.PreviewSize.DialogTitle"), // $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.PreviewSize.DialogMessage"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { m_stepnameText.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 // $NON-NLS-1$
EnterTextDialog(// $NON-NLS-1$
shell, // $NON-NLS-1$
BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), // $NON-NLS-1$
BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, m_stepnameText.getText(), progressDialog.getPreviewRowsMeta(m_stepnameText.getText()), progressDialog.getPreviewRows(m_stepnameText.getText()), loggingText);
prd.open();
}
}
use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.
the class XulDatabaseExplorerController method preview.
public void preview(boolean askLimit) {
if (model.getTable() == null) {
return;
}
try {
PromptCallback theCallback = new PromptCallback();
@SuppressWarnings("unused") boolean execute = true;
int limit = 100;
if (askLimit) {
XulPromptBox thePromptBox = (XulPromptBox) this.document.createElement("promptbox");
thePromptBox.setModalParent(this.dbExplorerDialog.getShell());
thePromptBox.setTitle("Enter Max Rows");
thePromptBox.setMessage("Max Rows:");
thePromptBox.addDialogCallback(theCallback);
thePromptBox.open();
execute = theCallback.getLimit() != -1;
limit = theCallback.getLimit();
}
// if (execute) {
// XulPreviewRowsDialog thePreviewRowsDialog = new XulPreviewRowsDialog(this.shell, SWT.NONE,
// this.model.getDatabaseMeta(), this.model.getTable(), theCallback.getLimit());
// thePreviewRowsDialog.open();
// }
GetPreviewTableProgressDialog pd = new GetPreviewTableProgressDialog(this.dbExplorerDialog.getShell(), this.model.getDatabaseMeta(), model.getSchema(), model.getTable(), limit);
List<Object[]> rows = pd.open();
if (rows != null) {
if (rows.size() > 0) {
PreviewRowsDialog prd = new PreviewRowsDialog(this.dbExplorerDialog.getShell(), this.model.getDatabaseMeta(), SWT.None, this.model.getTable(), pd.getRowMeta(), rows);
prd.open();
} else {
MessageBox mb = new MessageBox(this.dbExplorerDialog.getShell(), SWT.ICON_INFORMATION | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "DatabaseExplorerDialog.NoRows.Message"));
mb.setText(BaseMessages.getString(PKG, "DatabaseExplorerDialog.NoRows.Title"));
mb.open();
}
}
} catch (Exception e) {
LogChannel.GENERAL.logError("Error previewing rows", e);
}
}
use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.
the class XulDatabaseExplorerController method dataProfile.
public void dataProfile() {
if (model.getTable() == null) {
return;
}
Shell dbShell = (Shell) dbExplorerDialog.getRootObject();
try {
TransProfileFactory profileFactory = new TransProfileFactory(this.model.getDatabaseMeta(), getSchemaAndTable(this.model));
TransMeta transMeta = profileFactory.generateTransformation(new LoggingObject(model.getTable()));
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(dbShell, transMeta, new String[] { TransProfileFactory.RESULT_STEP_NAME }, new int[] { 25000 });
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(dbShell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
PreviewRowsDialog prd = new PreviewRowsDialog(dbShell, transMeta, SWT.NONE, TransProfileFactory.RESULT_STEP_NAME, progressDialog.getPreviewRowsMeta(TransProfileFactory.RESULT_STEP_NAME), progressDialog.getPreviewRows(TransProfileFactory.RESULT_STEP_NAME), loggingText);
prd.open();
}
} catch (Exception e) {
new ErrorDialog(this.dbExplorerDialog.getShell(), BaseMessages.getString(PKG, "DatabaseExplorerDialog.UnexpectedProfilingError.Title"), BaseMessages.getString(PKG, "DatabaseExplorerDialog.UnexpectedProfilingError.Message"), e);
}
}
use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.
the class DataOverrideHandler method showFeatureList.
public void showFeatureList() {
Shell parent = getShell();
DatabaseMeta dbinfo = new DatabaseMeta();
getInfo(dbinfo);
try {
java.util.List<RowMetaAndData> buffer = dbinfo.getFeatureSummary();
if (buffer.size() > 0) {
RowMetaInterface rowMeta = buffer.get(0).getRowMeta();
java.util.List<Object[]> rowData = new ArrayList<Object[]>();
for (RowMetaAndData row : buffer) {
rowData.add(row.getData());
}
PreviewRowsDialog prd = new PreviewRowsDialog(parent, dbinfo, SWT.NONE, null, rowMeta, rowData);
prd.setTitleMessage(BaseMessages.getString(PKG, "DatabaseDialog.FeatureList.title"), BaseMessages.getString(PKG, "DatabaseDialog.FeatureList.title"));
prd.open();
}
} catch (Exception e) {
new ErrorDialog(parent, BaseMessages.getString(PKG, "DatabaseDialog.FeatureListError.title"), BaseMessages.getString(PKG, "DatabaseDialog.FeatureListError.description"), e);
}
}
use of org.pentaho.di.ui.core.dialog.PreviewRowsDialog in project pentaho-kettle by pentaho.
the class ParGzipCsvInputDialog method preview.
// Preview the data
private void preview() {
// Create the XML input step
ParGzipCsvInputMeta oneMeta = new ParGzipCsvInputMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "ParGzipCsvInputDialog.PreviewSize.DialogTitle"), BaseMessages.getString(PKG, "ParGzipCsvInputDialog.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();
}
}
Aggregations