Coverage report

  %line %branch
ca.spaz.cron.summary.SimpleSummaryContent
0% 
0% 

 1  
 /*
 2  
  *******************************************************************************
 3  
  * Copyright (c) 2005 Chris Rose and AIMedia
 4  
  * All rights reserved. SimpleSummaryContent and the accompanying materials
 5  
  * are made available under the terms of the Common Public License v1.0
 6  
  * which accompanies this distribution, and is available at
 7  
  * http://www.eclipse.org/legal/cpl-v10.html
 8  
  * 
 9  
  * Contributors:
 10  
  *     Chris Rose
 11  
  *******************************************************************************/
 12  
 package ca.spaz.cron.summary;
 13  
 
 14  
 import java.awt.*;
 15  
 import java.util.*;
 16  
 import java.util.List;
 17  
 
 18  
 import javax.swing.*;
 19  
 
 20  
 import com.aimedia.ui.*;
 21  
 
 22  
 
 23  
 /**
 24  
  * @deprecated No longer needed for UI 
 25  
  * @author Chris Rose
 26  
  */
 27  
 public class SimpleSummaryContent extends JPanel implements IValueListUser {
 28  
 
 29  
         private int columns;
 30  
         private GridBagConstraints gclbl;
 31  
         private GridBagConstraints gcval;
 32  
         private SummaryPanel data;
 33  
         
 34  
         public SimpleSummaryContent(SummaryPanel dataSource) {
 35  0
             super();
 36  0
             this.data = dataSource;
 37  0
             setLayout(new GridBagLayout());
 38  0
             gclbl = new GridBagConstraints();
 39  0
             gcval = new GridBagConstraints();
 40  0
             gclbl.ipadx=4;
 41  0
             gcval.ipadx=4;
 42  0
             gclbl.insets=new Insets(2,2,2,6);
 43  0
             gcval.insets=new Insets(2,2,6,2);
 44  0
             gclbl.anchor=GridBagConstraints.WEST;
 45  0
             gcval.anchor=GridBagConstraints.EAST;
 46  0
             gclbl.weightx=1;
 47  0
             gcval.weightx=0.9;
 48  0
       }
 49  
         
 50  
         /* (non-Javadoc)
 51  
          * @see com.aimedia.ui.IValueListUser#setValueList(java.util.List)
 52  
          */
 53  
         public void setValueList(List valueNames) {
 54  0
             columns = valueNames.size() > 12 ? 3 : 2;
 55  0
             int numlbls = valueNames.size();
 56  0
             int nrows = numlbls / columns;
 57  0
             if ((numlbls % columns) != 0) {
 58  0
                 nrows++;
 59  
             }
 60  0
             int col = 0;
 61  0
             gclbl.gridy = 0;
 62  0
             gcval.gridy = 0;
 63  0
             removeAll();
 64  0
             for (Iterator iter = valueNames.iterator(); iter.hasNext();) {
 65  0
                 String valueName = (String) iter.next();
 66  0
                 JLabel vlbl = new JLabel();
 67  0
                 vlbl.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
 68  0
                 vlbl.setText(data.getValueText(valueName));
 69  0
                 add(makeRLabel(valueName), gclbl);
 70  0
                 add(vlbl, gcval);
 71  0
                 col+=2;
 72  0
                 if (col % (2 * columns) == 0) {
 73  0
                     gcval.gridy++;
 74  0
                     gclbl.gridy++;
 75  
                 }
 76  0
             }
 77  0
             revalidate();
 78  0
         }
 79  
 
 80  
         /**
 81  
          * @param key
 82  
          * @return
 83  
          */
 84  
         private JLabel makeRLabel(String key) {
 85  0
             String ltxt = data.getLabelText(key);
 86  0
             return UIPartFactory.createFieldLabel(ltxt + ":", true);
 87  
         }
 88  
         
 89  
     }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.