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

jadex.base.gui.filetree.RefreshSubtreeAction Maven / Gradle / Ivy

There is a newer version: 2.4
Show newest version
package jadex.base.gui.filetree;

import jadex.base.gui.asynctree.ITreeNode;
import jadex.commons.gui.SGUI;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.JTree;
import javax.swing.UIDefaults;
import javax.swing.tree.TreePath;

/**
 *  The refresh subtree action.
 */
public class RefreshSubtreeAction extends AbstractAction
{
	//-------- constants --------

	/** The image icons. */
	protected static final UIDefaults icons = new UIDefaults(new Object[]
	{
		"refresh_tree", SGUI.makeIcon(FileTreePanel.class, "/jadex/base/gui/images/refresh_tree.png"),
	});
	
	//-------- attributes --------

	/** The tree. */
	protected JTree tree;
	
	//-------- constructors --------

	/**
	 *  Create a new action.
	 */
	public RefreshSubtreeAction(JTree tree)
	{
		this("Refresh subtree", icons.getIcon("refresh_tree"), tree);
	}
	
	/**
	 *  Create a new action.
	 */
	public RefreshSubtreeAction(String name, Icon icon, JTree tree)
	{
		super(name, icon);
		this.tree = tree;
	}
	
	//-------- methods --------

	/**
	 *  Called when the action is performed.
	 */
	public void actionPerformed(ActionEvent e)
	{
		TreePath[]	paths	= tree.getSelectionPaths();
		for(int i=0; paths!=null && i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy