jadex.base.gui.jtable.ComponentIdentifierRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-tools-base-swing Show documentation
Show all versions of jadex-tools-base-swing Show documentation
GUI-dependent classes for jadex-tools-base.
package jadex.base.gui.jtable;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import jadex.bridge.IComponentIdentifier;
import jadex.bridge.ITransportComponentIdentifier;
/**
* A renderer for AgentIdentifiers. This class is used to display the receiver
* entry in the table. The receiver is displayed with its addresses.
*/
public class ComponentIdentifierRenderer 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 cid = (IComponentIdentifier)value;
if(cid!=null)
{
setText(cid.getName());
setToolTipText(getTooltipText(cid));
}
return this;
}
public static String getTooltipText(IComponentIdentifier cid)
{
String[] addresses = cid instanceof ITransportComponentIdentifier ? ((ITransportComponentIdentifier)cid).getAddresses() : null;
String tooltip = "" + cid.getName() + "";
if(addresses!=null)
{
for(int i=0; i" + addresses[i];
}
}
tooltip = "" + tooltip + "";
return tooltip;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy