Search in sources :

Example 21 with TransGraph

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("");
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) Browser(org.eclipse.swt.browser.Browser) Test(org.junit.Test)

Example 22 with TransGraph

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());
}
Also used : ArrayList(java.util.ArrayList) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Example 23 with TransGraph

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();
    }
}
Also used : TransAction(org.pentaho.di.core.undo.TransAction) JobMeta(org.pentaho.di.job.JobMeta) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransMeta(org.pentaho.di.trans.TransMeta) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Example 24 with TransGraph

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();
        }
    }
}
Also used : JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Example 25 with TransGraph

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();
    }
}
Also used : DatabaseImpact(org.pentaho.di.trans.DatabaseImpact) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)37 JobGraph (org.pentaho.di.ui.spoon.job.JobGraph)15 TransMeta (org.pentaho.di.trans.TransMeta)10 Test (org.junit.Test)8 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)7 ArrayList (java.util.ArrayList)6 Point (org.pentaho.di.core.gui.Point)6 JobMeta (org.pentaho.di.job.JobMeta)6 StepMeta (org.pentaho.di.trans.step.StepMeta)6 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)5 KettleException (org.pentaho.di.core.exception.KettleException)5 TabMapEntry (org.pentaho.di.ui.spoon.TabMapEntry)5 Browser (org.eclipse.swt.browser.Browser)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 FileObject (org.apache.commons.vfs2.FileObject)3 SashForm (org.eclipse.swt.custom.SashForm)3 Composite (org.eclipse.swt.widgets.Composite)3 MessageBox (org.eclipse.swt.widgets.MessageBox)3 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)3 TabItem (org.pentaho.xul.swt.tab.TabItem)3