Exemplo n.º 1
0
 public Component getTreeCellRendererComponent(
     JTree tree,
     Object value,
     boolean sel,
     boolean expanded,
     boolean leaf,
     int row,
     boolean hasFocus) {
   renderer.setForeground(Color.BLACK);
   renderer.setText(value.toString());
   if (sel) {
     renderer.setOpaque(true);
   } else {
     renderer.setOpaque(false);
   }
   if (leaf) {
     return (makeComponent((JIDStatus) value));
   }
   if (value instanceof PrimaryJIDStatus) {
     PrimaryJIDStatus ps = (PrimaryJIDStatus) value;
     JIDStatus jidsStatus = ps.getJIDPrimaryStatus();
     if (ps.hasMultiple()) {
       if (onlineTree) {
         if (ps.multipleJIDstatusOnline()) {
           renderer.setForeground(new Color(0, 0, 190));
         }
         return makeComponent(jidsStatus);
       }
       if (ps.isAJIDstatusOffline()) { // if offline tree and a jidStatus in primary is offline
         // show
         renderer.setIcon(StatusIcons.getImageIcon("multiple"));
       }
       return renderer;
     }
     return makeComponent(jidsStatus);
   } else if (value instanceof JIDStatusGroup) {
     JIDStatusGroup group = (JIDStatusGroup) value;
     if (onlineTree) {
       renderer.setText(group.toString() + " (" + group.getOnlines() + ")");
     }
     if (expanded) {
       renderer.setIcon(StatusIcons.getImageIcon("arrowDown"));
     } else {
       renderer.setIcon(StatusIcons.getImageIcon("arrowUp"));
     }
   }
   return renderer;
 }
Exemplo n.º 2
0
 private void maybeShowGroupPopup(MouseEvent e, JIDStatusGroup jidStatusGroup) {
   if (e.isPopupTrigger()) {
     currentJIDStatusGroup = jidStatusGroup;
     currentGroup = jidStatusGroup.getName();
     groupPopupMenu.show(e.getComponent(), e.getX(), e.getY());
   }
 }