package jadex.tools.debugger.common;
import jadex.base.gui.plugin.IControlCenter;
import jadex.bridge.IComponentIdentifier;
import jadex.bridge.IExternalAccess;
import jadex.commons.IBreakpointPanel;
import jadex.commons.SGUI;
import jadex.rules.state.IOAVState;
import jadex.rules.state.OAVJavaType;
import jadex.rules.state.javaimpl.OAVStateFactory;
import jadex.rules.tools.stateviewer.OAVPanel;
import jadex.tools.debugger.IDebuggerPanel;
import jadex.tools.help.SHelp;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.UIDefaults;
/**
* A generic debugger panel that can display
* arbitrary java objects.
*/
public class ObjectInspectorDebuggerPanel implements IDebuggerPanel
{
//-------- constants --------
/**
* The image icons.
*/
protected static final UIDefaults icons = new UIDefaults(new Object[]{
"contents", SGUI.makeIcon(SHelp.class, "/jadex/tools/common/images/bug_small.png")
});
//-------- attributes --------
/** The gui component. */
protected JComponent oavpanel;
//-------- IDebuggerPanel methods --------
/**
* Called to initialize the panel.
* Called on the swing thread.
* @param jcc The jcc.
* @param bpp The breakpoint panel.
* @param id The component identifier.
* @param access The external access of the component.
*/
public void init(IControlCenter jcc, IBreakpointPanel bpp, IComponentIdentifier name, IExternalAccess access)
{
IOAVState dummystate = OAVStateFactory.createOAVState(OAVJavaType.java_type_model);
dummystate.addJavaRootObject(access);
this.oavpanel = new OAVPanel(dummystate);
}
/**
* The title of the panel (name of the tab).
* @return The tab title.
*/
public String getTitle()
{
return "Object Inspector";
}
/**
* The icon of the panel.
* @return The icon (or null, if none).
*/
public Icon getIcon()
{
return icons.getIcon("contents");
}
/**
* The component to be shown in the gui.
* @return The component to be displayed.
*/
public JComponent getComponent()
{
return oavpanel;
}
/**
* The tooltip text of the panel, if any.
* @return The tooltip text, or null.
*/
public String getTooltipText()
{
return "Show the object contents";
}
}