package jas2.swingstudio.adaptor;
import jas2.swingstudio.*;
import jas2.jds.interfaces.CutInterface;
import java.awt.event.*;
import jas2.util.ObjectFactory;
import javax.swing.*;
public class CutTreeAdaptor extends TreeAdaptor
{
public void onDoubleClick()
{
CutInterface peer = (CutInterface) getAssociatedObject();
String type = peer.getCutType();
try
{
Class c = Class.forName("jas2.cuts."+ type +"CutAdjustmentDialog");
// if no exception...
CutAdjustmentDialog dialog = (CutAdjustmentDialog) new ObjectFactory(c).create(peer, peer.getProperties());
dialog.show();
}
catch (Exception e)
{
JavaAnalysisStudio.getApp().error("Exception", e);
}
}
public void onSelect()
{
Object o = getAssociatedObject();
JavaAnalysisStudio.getApp().setMessage(o.toString());
}
protected JPopupMenu getPopupMenu()
{
if (menu == null)
menu = new CutPopup();
menu.m_adaptor = this;
return menu;
}
private static class CutPopup extends JPopupMenu implements ActionListener
{
CutPopup()
{
final JMenuItem item = new JMenuItem("Set Properties...");
item.addActionListener(this);
add(item);
}
public void actionPerformed(ActionEvent e)
{
m_adaptor.onDoubleClick();
}
CutTreeAdaptor m_adaptor;
}
static private CutPopup menu = null;
}
Ads help maintain this website.