Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package jadex.bdi.planlib;
  
 
 import java.util.List;
 
Default panel for viewing BDI agents that include viewable capabilities.
 
 {
 	//-------- constants --------
 	
The constant for the agent optional viewerclass.
 
 	public static final String PROPERTY_AGENTVIEWERCLASS = "bdiviewerpanel.agentviewerclass";

The constant for the agent optional viewerclass.
 
 	public static final String PROPERTY_INCLUDESUBCAPABILITIES = "bdiviewerpanel.includesubcapabilities";
 	
 	//-------- attributes --------
 	
The panel.
 
 	protected JPanel panel;
 	
 	//-------- methods --------
 	
Called once to initialize the panel. Called on the swing thread.

Parameters:
jcc The jcc.
component The component.
 
 	public IFuture init(final IControlCenter jccIExternalAccess component)
 	{
 		final Future ret = new Future();
 		
 		this. = new JPanel(new BorderLayout());
 		
 		// Init interface is asynchronous but super implementation is not.
 		IFuture	futsuper.init(jcccomponent);
 		assert fut.isDone();
 		
 		component.scheduleStep(new IComponentStep()
 		{
 			@XMLClassname("createPanels")
 			{
 				if(subcapnames==null)
 				{
 					subcapnames = (String[])scope.getSubcapabilityNames();
 				}
 				createPanels(scopesubcapnamesret);
 				return null;
 			}
 		});
 		
 		return ret;
 	}

Create the panels.
 
 	protected void createPanels(IBDIInternalAccess scopeString[] subcapnamesFuture ret)
 	{
 		final List panels = new ArrayList();
 		
 			subcapnames.length+1, truenew DelegationResultListener(ret)
 		{
 			public void customResultAvailable(Object result)
 			{
 //				if(subpanels.size()==1)
 //				{
 //					Object[] tmp = (Object[])subpanels.get(0);
 //					add(((IComponentViewerPanel)tmp[1]).getComponent(), BorderLayout.CENTER);
 //				}
 //				else if(subpanels.size()>1)
				{
					JTabbedPane tp = new JTabbedPane();
					for(int i=0; i<panels.size(); i++)
					{
						Object[] tmp = (Object[])panels.get(i);
					}
				}
				super.customResultAvailable(result);
			}	
		});
		// Agent panel.
		if(clname!=null)
		{
			try
			{
				Class clazz	= SReflect.classForName(clnamescope.getClassLoader());
				panels.add(new Object[]{"agent"panel});
			}
			catch(Exception e)
			{
			}
		}
		else
		{
			lis.exceptionOccurred(new RuntimeException("No viewerclass: "+clname));
		}
		// Capability panels.
		if(subcapnames!=null)
		{
			for(int i=0; i<subcapnames.lengthi++)
			{
				ICapability subcap = (ICapability)scope.getSubcapability(subcapnames[i]);
				Class clazz = clid instanceof Class? (Class)clidclid instanceof String? SReflect.classForName0((String)clidsubcap.getClassLoader()): null;
				try
				{
					panels.add(new Object[]{subcapnames[i], panel});
				}
				catch(Exception e)
				{
				}
			}
		}
	}

The id used for mapping properties. / public String getId() { return "default_bdi_viewer_panel";
The component to be shown in the gui.

Returns:
The component to be displayed.
	{
		return ;
	}
New to GrepCode? Check out our FAQ X