Search in sources :

Example 21 with JobGraph

use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.

the class Spoon method undoAction.

public void undoAction(UndoInterface undoInterface) {
    if (undoInterface == null) {
        return;
    }
    TransAction ta = undoInterface.previousUndo();
    if (ta == null) {
        return;
    }
    // something changed: change the menu
    setUndoMenu(undoInterface);
    if (undoInterface instanceof TransMeta) {
        delegates.trans.undoTransformationAction((TransMeta) undoInterface, ta);
        if (ta.getType() == TransAction.TYPE_ACTION_DELETE_STEP) {
            // something changed: change the menu
            setUndoMenu(undoInterface);
            handleSelectedStepOnUndo((TransMeta) undoInterface);
            ta = undoInterface.viewPreviousUndo();
            if (ta != null && ta.getType() == TransAction.TYPE_ACTION_DELETE_HOP) {
                ta = undoInterface.previousUndo();
                delegates.trans.undoTransformationAction((TransMeta) undoInterface, ta);
            }
        }
    }
    if (undoInterface instanceof JobMeta) {
        delegates.jobs.undoJobAction((JobMeta) undoInterface, ta);
        if (ta.getType() == TransAction.TYPE_ACTION_DELETE_JOB_ENTRY) {
            // something changed: change the menu
            setUndoMenu(undoInterface);
            ta = undoInterface.viewPreviousUndo();
            if (ta != null && ta.getType() == TransAction.TYPE_ACTION_DELETE_JOB_HOP) {
                ta = undoInterface.previousUndo();
                delegates.jobs.undoJobAction((JobMeta) undoInterface, ta);
            }
        }
    }
    // Put what we undo 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 22 with JobGraph

use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.

the class Spoon method zoomOut.

public void zoomOut() {
    TransGraph transGraph = getActiveTransGraph();
    if (transGraph != null) {
        transGraph.zoomOut();
    }
    JobGraph jobGraph = getActiveJobGraph();
    if (jobGraph != null) {
        jobGraph.zoomOut();
    }
}
Also used : JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Example 23 with JobGraph

use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.

the class Spoon method zoom100Percent.

public void zoom100Percent() {
    TransGraph transGraph = getActiveTransGraph();
    if (transGraph != null) {
        transGraph.zoom100Percent();
    }
    JobGraph jobGraph = getActiveJobGraph();
    if (jobGraph != null) {
        jobGraph.zoom100Percent();
    }
}
Also used : JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Example 24 with JobGraph

use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.

the class TransGraph method openMapping.

/**
 * Open the transformation mentioned in the mapping...
 */
public void openMapping(StepMeta stepMeta, int index) {
    try {
        Object referencedMeta = null;
        Trans subTrans = getActiveSubtransformation(this, stepMeta);
        if (subTrans != null && (stepMeta.getStepMetaInterface().getActiveReferencedObjectDescription() == null || index < 0)) {
            TransMeta subTransMeta = subTrans.getTransMeta();
            referencedMeta = subTransMeta;
            Object[] objectArray = new Object[4];
            objectArray[0] = stepMeta;
            objectArray[1] = subTransMeta;
            ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.OpenMapping.id, objectArray);
        } else {
            StepMetaInterface meta = stepMeta.getStepMetaInterface();
            if (!Utils.isEmpty(meta.getReferencedObjectDescriptions())) {
                referencedMeta = meta.loadReferencedObject(index, spoon.rep, spoon.metaStore, transMeta);
            }
        }
        if (referencedMeta == null) {
            return;
        }
        if (referencedMeta instanceof TransMeta) {
            TransMeta mappingMeta = (TransMeta) referencedMeta;
            mappingMeta.clearChanged();
            spoon.addTransGraph(mappingMeta);
            TransGraph subTransGraph = spoon.getActiveTransGraph();
            attachActiveTrans(subTransGraph, this.currentStep);
        }
        if (referencedMeta instanceof JobMeta) {
            JobMeta jobMeta = (JobMeta) referencedMeta;
            jobMeta.clearChanged();
            spoon.addJobGraph(jobMeta);
            JobGraph jobGraph = spoon.getActiveJobGraph();
            attachActiveJob(jobGraph, this.currentStep);
        }
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "TransGraph.Exception.UnableToLoadMapping.Title"), BaseMessages.getString(PKG, "TransGraph.Exception.UnableToLoadMapping.Message"), e);
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransMeta(org.pentaho.di.trans.TransMeta) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) Trans(org.pentaho.di.trans.Trans) XulException(org.pentaho.ui.xul.XulException) InvocationTargetException(java.lang.reflect.InvocationTargetException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 25 with JobGraph

use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.

the class SpoonJobDelegate method addJobGraph.

public void addJobGraph(JobMeta jobMeta) {
    boolean added = addJob(jobMeta);
    if (added) {
        // See if there already is a tab for this graph with the short default name.
        // If there is, set that one to show the location as well.
        // If not, simply add it without
        // If no, add it
        // If yes, select that tab
        // 
        boolean showLocation = false;
        boolean addTab = true;
        String tabName = spoon.delegates.tabs.makeTabName(jobMeta, false);
        TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.JOB_GRAPH);
        if (tabEntry != null) {
            // We change the already loaded job to also show the location.
            // 
            showLocation = true;
            tabEntry.setShowingLocation(true);
            String newTabName = spoon.delegates.tabs.makeTabName(tabEntry.getObject().getMeta(), true);
            tabEntry.getTabItem().setText(newTabName);
            // Try again, including the location of the object...
            // 
            tabName = spoon.delegates.tabs.makeTabName(jobMeta, true);
            tabEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.JOB_GRAPH);
            if (tabEntry != null) {
                // Already loaded, simply select the tab item in question...
                // 
                addTab = false;
            }
        }
        if (addTab) {
            JobGraph jobGraph = new JobGraph(spoon.tabfolder.getSwtTabset(), spoon, jobMeta);
            PropsUI props = PropsUI.getInstance();
            TabItem tabItem = new TabItem(spoon.tabfolder, tabName, tabName, props.getSashWeights());
            String toolTipText = BaseMessages.getString(PKG, "Spoon.TabJob.Tooltip", spoon.delegates.tabs.makeTabName(jobMeta, showLocation));
            if (!Utils.isEmpty(jobMeta.getFilename())) {
                toolTipText += Const.CR + Const.CR + jobMeta.getFilename();
            }
            tabItem.setToolTipText(toolTipText);
            tabItem.setImage(GUIResource.getInstance().getImageJobGraph());
            tabItem.setControl(jobGraph);
            // OK, also see if we need to open a new history window.
            if (jobMeta.getJobLogTable().getDatabaseMeta() != null && !Utils.isEmpty(jobMeta.getJobLogTable().getTableName())) {
                jobGraph.addAllTabs();
                jobGraph.extraViewTabFolder.setSelection(jobGraph.jobHistoryDelegate.getJobHistoryTab());
            }
            String versionLabel = jobMeta.getObjectRevision() == null ? null : jobMeta.getObjectRevision().getName();
            tabEntry = new TabMapEntry(tabItem, jobMeta.getFilename(), jobMeta.getName(), jobMeta.getRepositoryDirectory(), versionLabel, jobGraph, ObjectType.JOB_GRAPH);
            tabEntry.setShowingLocation(showLocation);
            spoon.delegates.tabs.addTab(tabEntry);
        }
        int idx = spoon.tabfolder.indexOf(tabEntry.getTabItem());
        // keep the focus on the graph
        spoon.tabfolder.setSelected(idx);
        spoon.setUndoMenu(jobMeta);
        spoon.enableMenus();
    } else {
        TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(jobMeta);
        if (tabEntry != null) {
            int idx = spoon.tabfolder.indexOf(tabEntry.getTabItem());
            // keep the focus on the graph
            spoon.tabfolder.setSelected(idx);
            // keep the focus on the graph
            spoon.tabfolder.setSelected(idx);
            spoon.setUndoMenu(jobMeta);
            spoon.enableMenus();
        }
    }
}
Also used : TabItem(org.pentaho.xul.swt.tab.TabItem) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) PropsUI(org.pentaho.di.ui.core.PropsUI)

Aggregations

JobGraph (org.pentaho.di.ui.spoon.job.JobGraph)27 TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)15 JobMeta (org.pentaho.di.job.JobMeta)8 TransMeta (org.pentaho.di.trans.TransMeta)6 Test (org.junit.Test)5 TabMapEntry (org.pentaho.di.ui.spoon.TabMapEntry)5 TabItem (org.pentaho.xul.swt.tab.TabItem)5 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)4 KettleException (org.pentaho.di.core.exception.KettleException)4 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)4 FileObject (org.apache.commons.vfs2.FileObject)3 Point (org.pentaho.di.core.gui.Point)3 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)3 AbstractMeta (org.pentaho.di.base.AbstractMeta)2 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)2 TransAction (org.pentaho.di.core.undo.TransAction)2 JobExecutionConfiguration (org.pentaho.di.job.JobExecutionConfiguration)2 PurRepository (org.pentaho.di.repository.pur.PurRepository)2 IAbsSecurityProvider (org.pentaho.di.ui.repository.pur.services.IAbsSecurityProvider)2 Spoon (org.pentaho.di.ui.spoon.Spoon)2