use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class ExpandedContentManagerTest method testShowTransformationBrowserh.
@Test
public void testShowTransformationBrowserh() {
TransGraph transGraphMock = mock(TransGraph.class);
Control control1 = mock(Control.class);
Control control2 = mock(Control.class);
Browser browser = mock(Browser.class);
SashForm sash = mock(SashForm.class);
when(sash.getWeights()).thenReturn(new int[] { 277, 722 });
Composite comp1 = mock(Composite.class);
Composite comp2 = mock(Composite.class);
Composite comp3 = mock(Composite.class);
Composite comp4 = mock(Composite.class);
when(browser.getParent()).thenReturn(comp1);
when(comp1.getParent()).thenReturn(comp2);
when(comp2.getParent()).thenReturn(comp3);
when(comp3.getParent()).thenReturn(sash);
when(comp4.getParent()).thenReturn(sash);
Control[] children = new Control[] { control1, control2, browser };
when(transGraphMock.getChildren()).thenReturn(children);
ExpandedContentManager.createExpandedContent(transGraphMock, "");
verify(browser).setUrl("");
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class GraphTest method testRightClickAlreadySelected.
@Test
public void testRightClickAlreadySelected() {
TransGraph graph = mock(TransGraph.class);
StepMeta meta1 = mock(StepMeta.class);
StepMeta meta2 = mock(StepMeta.class);
wireSelected(meta1, meta2);
List<StepMeta> selected = new ArrayList<>(2);
meta1.setSelected(true);
meta2.setSelected(true);
selected.add(meta1);
selected.add(meta2);
doCallRealMethod().when(graph).doRightClickSelection(meta1, selected);
graph.doRightClickSelection(meta1, selected);
assertEquals(2, selected.size());
assertTrue(selected.contains(meta1));
assertTrue(selected.contains(meta2));
assertTrue(meta1.isSelected() && meta2.isSelected());
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method redoAction.
public void redoAction(UndoInterface undoInterface) {
if (undoInterface == null) {
return;
}
TransAction ta = undoInterface.nextUndo();
if (ta == null) {
return;
}
// something changed: change the menu
setUndoMenu(undoInterface);
if (undoInterface instanceof TransMeta) {
delegates.trans.redoTransformationAction((TransMeta) undoInterface, ta);
if (ta.getType() == TransAction.TYPE_ACTION_DELETE_HOP) {
// something changed: change the menu
setUndoMenu(undoInterface);
ta = undoInterface.viewNextUndo();
if (ta != null && ta.getType() == TransAction.TYPE_ACTION_DELETE_STEP) {
ta = undoInterface.nextUndo();
delegates.trans.redoTransformationAction((TransMeta) undoInterface, ta);
}
}
}
if (undoInterface instanceof JobMeta) {
delegates.jobs.redoJobAction((JobMeta) undoInterface, ta);
if (ta.getType() == TransAction.TYPE_ACTION_DELETE_JOB_HOP) {
// something changed: change the menu
setUndoMenu(undoInterface);
ta = undoInterface.viewNextUndo();
if (ta != null && ta.getType() == TransAction.TYPE_ACTION_DELETE_JOB_ENTRY) {
ta = undoInterface.nextUndo();
delegates.jobs.redoJobAction((JobMeta) undoInterface, ta);
}
}
}
// Put what we redo in focus
if (undoInterface instanceof TransMeta) {
TransGraph transGraph = delegates.trans.findTransGraphOfTransformation((TransMeta) undoInterface);
transGraph.forceFocus();
}
if (undoInterface instanceof JobMeta) {
JobGraph jobGraph = delegates.jobs.findJobGraphOfJob((JobMeta) undoInterface);
jobGraph.forceFocus();
}
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method showExecutionResults.
public void showExecutionResults() {
TransGraph transGraph = getActiveTransGraph();
if (transGraph != null) {
transGraph.showExecutionResults();
enableMenus();
} else {
JobGraph jobGraph = getActiveJobGraph();
if (jobGraph != null) {
jobGraph.showExecutionResults();
enableMenus();
}
}
}
use of org.pentaho.di.ui.spoon.trans.TransGraph in project pentaho-kettle by pentaho.
the class Spoon method showLastImpactAnalyses.
public void showLastImpactAnalyses(TransMeta transMeta) {
if (transMeta == null) {
return;
}
TransGraph transGraph = delegates.trans.findTransGraphOfTransformation(transMeta);
if (transGraph == null) {
return;
}
List<Object[]> rows = new ArrayList<>();
RowMetaInterface rowMeta = null;
for (int i = 0; i < transGraph.getImpact().size(); i++) {
DatabaseImpact ii = transGraph.getImpact().get(i);
RowMetaAndData row = ii.getRow();
rowMeta = row.getRowMeta();
rows.add(row.getData());
}
if (rows.size() > 0) {
// Display all the rows...
PreviewRowsDialog prd = new PreviewRowsDialog(shell, Variables.getADefaultVariableSpace(), SWT.NONE, "-", rowMeta, rows);
prd.setTitleMessage(// "Result of analyses:"
BaseMessages.getString(PKG, "Spoon.Dialog.ImpactAnalyses.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ImpactAnalyses.Message"));
prd.open();
} else {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
if (transGraph.isImpactFinished()) {
// "As far as I can tell, this transformation has no impact on any database."
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.TransformationNoImpactOnDatabase.Message"));
} else {
// "Please run the impact analyses first on this transformation."
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.RunImpactAnalysesFirst.Message"));
}
// Impact
mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.ImpactAnalyses.Title"));
mb.open();
}
}
Aggregations