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

jadex.base.gui.jtable.ComponentIdentifiersRenderer Maven / Gradle / Ivy

package jadex.base.gui.jtable;

import jadex.bridge.IComponentIdentifier;
import jadex.commons.SReflect;

import java.awt.Component;
import java.util.Iterator;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;


/**
 * A renderer for AgentIdentifiers. This class is used to display the
 * receivers entry in the table. Each receiver is displayed with its addresses.
 */
public class ComponentIdentifiersRenderer extends DefaultTableCellRenderer
{
	/**
	 * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
	 * Object, boolean, boolean, int, int)
	 */
	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
	{
		super.getTableCellRendererComponent(table, null, isSelected, hasFocus, row, column);
		IComponentIdentifier aid;
		Iterator it = null;
		if(SReflect.isIterable(value))
		{
			it = SReflect.getIterator(value);
			aid = (IComponentIdentifier)it.next();
		}
		else
		{
			aid = (IComponentIdentifier)value;
		}
		
		String content = aid.getName();
		String tooltip = "" + aid.getName() + "";
		String[] addresses = aid.getAddresses();
		for(int i = 0;i";
				addresses = aid.getAddresses();
				for(int j = 0; j < addresses.length; j++)
				{
					tooltip += "
" + addresses[j]; } } } setText(content); setToolTipText("" + tooltip + ""); return this; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy