All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bitronix.tm.gui.ResourcesTreeModel Maven / Gradle / Ivy

There is a newer version: 2.1.4
Show newest version
package bitronix.tm.gui;

import bitronix.tm.TransactionManagerServices;
import bitronix.tm.resource.ResourceLoader;

import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import java.util.Iterator;

/**
 * 

© Bitronix Software

* * @author lorban */ public class ResourcesTreeModel implements TreeModel { private static final String ROOT = "Resource loader"; private ResourceLoader resourceLoader; public ResourcesTreeModel() { resourceLoader = TransactionManagerServices.getResourceLoader(); } public Object getRoot() { return ROOT; } public int getChildCount(Object parent) { if (parent.equals(ROOT)) return resourceLoader.getResources().size(); return 0; } public boolean isLeaf(Object node) { if (node.equals(ROOT)) return false; return true; } public void addTreeModelListener(TreeModelListener l) { //To change body of implemented methods use File | Settings | File Templates. } public void removeTreeModelListener(TreeModelListener l) { //To change body of implemented methods use File | Settings | File Templates. } public Object getChild(Object parent, int index) { if (index < 0) return ROOT; Iterator it = resourceLoader.getResources().entrySet().iterator(); Object result = null; for(int i= -1; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy