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());
}
}
}
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;
}
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());
}
}
}
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());
}
}
}
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();
}
Aggregations