jadex.base.gui.jtable.ComponentIdentifiersRenderer 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 java.util.Iterator;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import jadex.bridge.IComponentIdentifier;
import jadex.bridge.ITransportComponentIdentifier;
import jadex.commons.SReflect;
/**
* 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 cid;
Iterator it = null;
if(SReflect.isIterable(value))
{
it = SReflect.getIterator(value);
cid = (IComponentIdentifier)it.next();
}
else
{
cid = (IComponentIdentifier)value;
}
String content = cid.getName();
String tooltip = "" + cid.getName() + "";
String[] addresses = cid instanceof ITransportComponentIdentifier ? ((ITransportComponentIdentifier)cid).getAddresses() : null;
for(int i=0; addresses!=null && i" + addresses[i];
}
if(it!=null)
{
while(it.hasNext())
{
cid = (IComponentIdentifier)it.next();
content += ", " + cid.getName();
tooltip += "
" + cid.getName() + "";
addresses = cid instanceof ITransportComponentIdentifier ? ((ITransportComponentIdentifier)cid).getAddresses() : null;
for(int j=0; addresses!=null && j" + addresses[j];
}
}
}
setText(content);
setToolTipText("" + tooltip + "");
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy