Coverage Report - org.homeunix.thecave.buddi.view.swing.MyAccountTreeNameCellRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
MyAccountTreeNameCellRenderer
53%
7/13
50%
2/4
3
 
 1  
 /*
 2  
  * Created on Aug 5, 2007 by wyatt
 3  
  */
 4  
 package org.homeunix.thecave.buddi.view.swing;
 5  
 
 6  
 import java.awt.Component;
 7  
 
 8  
 import javax.swing.JTree;
 9  
 import javax.swing.tree.DefaultTreeCellRenderer;
 10  
 
 11  
 import org.homeunix.thecave.buddi.model.Account;
 12  
 import org.homeunix.thecave.buddi.model.AccountType;
 13  
 import org.homeunix.thecave.buddi.plugin.api.util.TextFormatter;
 14  
 
 15  3034
 public class MyAccountTreeNameCellRenderer extends DefaultTreeCellRenderer {
 16  
         public static final long serialVersionUID = 0;
 17  
 
 18  
 
 19  
         @Override
 20  
         public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
 21  132
                 super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
 22  
 
 23  132
                 this.setIcon(null);
 24  
                 
 25  132
                 if (value instanceof Account){
 26  0
                         Account a = (Account) value;
 27  0
                         this.setText("<html>" 
 28  
                                         + TextFormatter.getDeletedWrapper(TextFormatter.getFormattedNameForAccount(a), a)
 29  
                                         + "</html>");
 30  0
                 }
 31  132
                 else if (value instanceof AccountType){
 32  0
                         AccountType t = (AccountType) value;
 33  0
                         this.setText("<html>" + TextFormatter.getFormattedNameForType(t) + "</html>");
 34  0
                 }                
 35  
                 else
 36  132
                         this.setText("");
 37  
 
 38  132
                 return this;
 39  
         }
 40  
 }