Search in sources :

Example 6 with TreeNode

use of org.pentaho.di.ui.core.widget.tree.TreeNode in project pentaho-kettle by pentaho.

the class StepsFolderProvider method refresh.

@Override
public void refresh(AbstractMeta meta, TreeNode treeNode, String filter) {
    TransMeta transMeta = (TransMeta) meta;
    for (int i = 0; i < transMeta.nrSteps(); i++) {
        StepMeta stepMeta = transMeta.getStep(i);
        if (stepMeta.isMissing()) {
            continue;
        }
        PluginInterface stepPlugin = PluginRegistry.getInstance().findPluginWithId(StepPluginType.class, stepMeta.getStepID());
        if (!filterMatch(stepMeta.getName(), filter)) {
            continue;
        }
        Image stepIcon = GUIResource.getInstance().getImagesStepsSmall().get(stepPlugin.getIds()[0]);
        if (stepIcon == null) {
            stepIcon = GUIResource.getInstance().getImageFolder();
        }
        TreeNode childTreeNode = createTreeNode(treeNode, stepMeta.getName(), stepIcon);
        childTreeNode.setData("StepId", stepMeta.getStepID());
        if (stepMeta.isShared()) {
            childTreeNode.setFont(GUIResource.getInstance().getFontBold());
        }
        if (!stepMeta.isDrawn()) {
            childTreeNode.setForeground(GUIResource.getInstance().getColorDarkGray());
        }
    }
}
Also used : TreeNode(org.pentaho.di.ui.core.widget.tree.TreeNode) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) TransMeta(org.pentaho.di.trans.TransMeta) Image(org.eclipse.swt.graphics.Image) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 7 with TreeNode

use of org.pentaho.di.ui.core.widget.tree.TreeNode in project pentaho-kettle by pentaho.

the class TreeFolderProvider method createTreeNode.

public TreeNode createTreeNode(TreeNode parent, String text, Image image) {
    TreeNode childTreeNode = new TreeNode();
    childTreeNode.setLabel(text);
    childTreeNode.setImage(image);
    parent.addChild(childTreeNode);
    return childTreeNode;
}
Also used : TreeNode(org.pentaho.di.ui.core.widget.tree.TreeNode)

Example 8 with TreeNode

use of org.pentaho.di.ui.core.widget.tree.TreeNode in project pentaho-kettle by pentaho.

the class DBConnectionFolderProvider method refresh.

@Override
public void refresh(AbstractMeta meta, TreeNode treeNode, String filter) {
    DatabasesCollector collector = new DatabasesCollector(meta, spoon.getRepository());
    try {
        try {
            collector.collectDatabases();
        } catch (KettleException e) {
            if (e.getCause() instanceof KettleRepositoryLostException) {
                Spoon.getInstance().handleRepositoryLost((KettleRepositoryLostException) e.getCause());
                collector = new DatabasesCollector(meta, null);
                collector.collectDatabases();
            } else {
                throw e;
            }
        }
    } catch (KettleException e) {
        new ErrorDialog(Spoon.getInstance().getShell(), BaseMessages.getString(PKG, "Spoon.ErrorDialog.Title"), BaseMessages.getString(PKG, "Spoon.ErrorDialog.ErrorFetchingFromRepo.DbConnections"), e);
    }
    for (String dbName : collector.getDatabaseNames()) {
        if (!filterMatch(dbName, filter)) {
            continue;
        }
        DatabaseMeta databaseMeta = collector.getMetaFor(dbName);
        TreeNode childTreeNode = createTreeNode(treeNode, databaseMeta.getDisplayName(), guiResource.getImageConnectionTree());
        if (databaseMeta.isShared()) {
            childTreeNode.setFont(guiResource.getFontBold());
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) DatabasesCollector(org.pentaho.di.ui.spoon.DatabasesCollector) TreeNode(org.pentaho.di.ui.core.widget.tree.TreeNode) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleRepositoryLostException(org.pentaho.di.repository.KettleRepositoryLostException) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 9 with TreeNode

use of org.pentaho.di.ui.core.widget.tree.TreeNode in project pentaho-kettle by pentaho.

the class SlavesFolderProvider method refresh.

@Override
public void refresh(AbstractMeta meta, TreeNode treeNode, String filter) {
    List<SlaveServer> servers = meta.getSlaveServers();
    servers.sort((s1, s2) -> String.CASE_INSENSITIVE_ORDER.compare(s1.getName(), s2.getName()));
    for (SlaveServer slaveServer : servers) {
        if (!filterMatch(slaveServer.getName(), filter)) {
            continue;
        }
        TreeNode childTreeNode = createTreeNode(treeNode, slaveServer.getName(), guiResource.getImageSlaveTree());
        if (slaveServer.isShared()) {
            childTreeNode.setFont(guiResource.getFontBold());
        }
    }
}
Also used : TreeNode(org.pentaho.di.ui.core.widget.tree.TreeNode) SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 10 with TreeNode

use of org.pentaho.di.ui.core.widget.tree.TreeNode in project pentaho-kettle by pentaho.

the class SpoonRefreshDbConnectionsSubtreeTest method setUp.

@Before
public void setUp() throws Exception {
    GUIResource guiResource = mock(GUIResource.class);
    Spoon spoon = mock(Spoon.class);
    dbConnectionFolderProvider = new DBConnectionFolderProvider(guiResource, spoon);
    treeNode = new TreeNode();
}
Also used : GUIResource(org.pentaho.di.ui.core.gui.GUIResource) TreeNode(org.pentaho.di.ui.core.widget.tree.TreeNode) DBConnectionFolderProvider(org.pentaho.di.ui.spoon.tree.provider.DBConnectionFolderProvider) Before(org.junit.Before)

Aggregations

TreeNode (org.pentaho.di.ui.core.widget.tree.TreeNode)13 GUIResource (org.pentaho.di.ui.core.gui.GUIResource)6 Before (org.junit.Before)5 KettleException (org.pentaho.di.core.exception.KettleException)2 TransMeta (org.pentaho.di.trans.TransMeta)2 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)2 Image (org.eclipse.swt.graphics.Image)1 SlaveServer (org.pentaho.di.cluster.SlaveServer)1 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)1 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)1 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)1 PartitionSchema (org.pentaho.di.partition.PartitionSchema)1 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 DatabasesCollector (org.pentaho.di.ui.spoon.DatabasesCollector)1 ClustersFolderProvider (org.pentaho.di.ui.spoon.tree.provider.ClustersFolderProvider)1 DBConnectionFolderProvider (org.pentaho.di.ui.spoon.tree.provider.DBConnectionFolderProvider)1 HopsFolderProvider (org.pentaho.di.ui.spoon.tree.provider.HopsFolderProvider)1 PartitionsFolderProvider (org.pentaho.di.ui.spoon.tree.provider.PartitionsFolderProvider)1 SlavesFolderProvider (org.pentaho.di.ui.spoon.tree.provider.SlavesFolderProvider)1