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

jadex.bdi.examples.shop.CustomerViewerPanel Maven / Gradle / Ivy

Go to download

The Jadex BDI applications package contain several example applications, benchmarks and testcases using BDI agents.

The newest version!
package jadex.bdi.examples.shop;

import jadex.base.gui.componentviewer.AbstractComponentViewerPanel;
import jadex.base.gui.plugin.IControlCenter;
import jadex.bdi.runtime.IBDIExternalAccess;
import jadex.bridge.IExternalAccess;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import jadex.commons.future.IResultListener;

import javax.swing.JComponent;
import javax.swing.JPanel;

/**
 *  Panel for the customer view.
 */
public class CustomerViewerPanel extends AbstractComponentViewerPanel
{
	//-------- attributes --------
	
	/** The panel. */
	protected JPanel panel;
	
	//-------- methods --------
	
	/**
	 *  Called once to initialize the panel.
	 *  Called on the swing thread.
	 *  @param jcc	The jcc.
	 * 	@param component The component.
	 */
	public IFuture init(IControlCenter jcc, final IExternalAccess component)
	{
		final Future ret = new Future();
		super.init(jcc, component).addResultListener(new IResultListener()
		{
			public void resultAvailable(Void result)
			{
				panel = new CustomerPanel((IBDIExternalAccess)component);
				ret.setResult(result);
			}
			
			public void exceptionOccurred(Exception exception)
			{
				ret.setException(exception);
			}
		});
		return ret;
	}
	
	/**
	 *  The component to be shown in the gui.
	 *  @return	The component to be displayed.
	 */
	public JComponent getComponent()
	{
		return panel;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy