package jas2.swingstudio;
import jas2.util.tree.*;
import jas2.job.*;
import jas2.plugin.*;
import javax.swing.JPopupMenu;
public class TreeAdaptor extends JASCommandProcessor
{
void setAdaptorSite(TreeAdaptorSite node)
{
this.node = node;
init();
}
/**
* Override this method to perform initialization.
* Called after the object is created and attached to
* its AdaptorSite.
*/
protected void init()
{
}
/**
* Called when a node is updated, normally as a result
* of the flags changing.
*/
protected void updateNode(int flags)
{
}
// this method is kind of a hack: the eventsourcefolderTreeAdaptor needs to tell the
// ComboModel which TreeNode represents the current event source, and it uses the return
// value of this method, which is a TreeNode
protected TreeAdaptorSite getAdaptorSite()
{
return node;
}
public PluginContext getPluginContext()
{
return node.getPluginContext();
}
public Object getAssociatedObject()
{
return node.getAssociatedObject();
}
public TreeItem getTreeItem()
{
return node.getTreeItem();
}
public Job getJob()
{
return node.getJob();
}
public String getName()
{
return node.getName();
}
protected JPopupMenu getPopupMenu() // override to have popup menu
{
return null;
}
/**
* Override if cell should be editable (rename support)
*/
protected boolean isEditable()
{
return false;
}
/**
* Override to notified of (and possible veto) rename operations
* @param newName the proposed result of renaming
* @return false to veto the rename operation
*/
protected boolean stopEditing(String newName)
{
return true;
}
/**
* Call this to programatically start an edit (rename) operation
*/
protected void startEditing()
{
node.startEditing();
}
private TreeAdaptorSite node;
}
Ads help maintain this website.