Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 166   Methods: 14
NCLOC: 84   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
AbstractLayerComponent.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * Joey and its relative products are published under the terms
 3   
  * of the Apache Software License.
 4   
  */
 5   
 /*
 6   
  * Created on 2004/01/08
 7   
  */
 8   
 package org.asyrinx.brownie.tapestry.components.layer;
 9   
 
 10   
 import java.util.Map;
 11   
 
 12   
 import org.apache.tapestry.AbstractComponent;
 13   
 import org.apache.tapestry.IRequestCycle;
 14   
 import org.asyrinx.brownie.core.lang.NumberUtils;
 15   
 import org.asyrinx.brownie.core.lang.StringUtils;
 16   
 import org.asyrinx.brownie.tapestry.script.IScriptUser;
 17   
 import org.asyrinx.brownie.tapestry.script.ScriptWriter;
 18   
 
 19   
 /**
 20   
  * @author akima
 21   
  */
 22   
 public abstract class AbstractLayerComponent extends AbstractComponent
 23   
         implements IScriptUser {
 24   
 
 25   
     /**
 26   
      * @param scriptName
 27   
      */
 28  0
     protected AbstractLayerComponent(String scriptName) {
 29  0
         super();
 30  0
         this.scriptWriter = new ScriptWriter(this, scriptName);
 31   
     }
 32   
 
 33   
     protected final ScriptWriter scriptWriter;
 34   
 
 35   
     /**
 36   
      * @see org.asyrinx.brownie.tapestry.script.AbstractScriptComponent#prepareScriptSymbols(java.util.Map,
 37   
      *      org.apache.tapestry.IRequestCycle)
 38   
      */
 39  0
     public void prepareScriptSymbols(Map symbols, IRequestCycle cycle) {
 40   
 
 41  0
         symbols.put("id", getStyleId());
 42  0
         symbols.put("left", new Integer(NumberUtils.toInt(getLeft(), 0)));
 43  0
         symbols.put("top", new Integer(NumberUtils.toInt(getTop(), 0)));
 44  0
         symbols.put("width", new Integer(NumberUtils.toInt(getWidth(), 0)));
 45  0
         symbols.put("height", new Integer(NumberUtils.toInt(getHeight(), 0)));
 46   
     }
 47   
 
 48   
     //            DIV.dsktop {
 49   
     //                LEFT:40px; TOP:100px; WIDTH:600px; HEIGHT:600px; CLIP:rect(0px 600px
 50   
     // 600px 0px); POSITION:absolute; BACKGROUND-COLOR:#339966;
 51   
     // layer-background-color:#339966
 52   
     //            }
 53  0
     public String toStyleValue() {
 54  0
         final StringBuffer result = new StringBuffer();
 55   
         //result.append("DIV.dsktop {");
 56  0
         addParam(result, "LEFT", this.left, "px");
 57  0
         addParam(result, "TOP", this.top, "px");
 58  0
         addParam(result, "WIDTH", this.width, "px");
 59  0
         addParam(result, "HEIGHT", this.height, "px");
 60  0
         if (!StringUtils.isEmpty(getWidth())
 61   
                 && !StringUtils.isEmpty(getHeight())) {
 62  0
             result.append("CLIP:rect(");
 63  0
             result.append("0px ");
 64  0
             result.append(this.width + "px ");
 65  0
             result.append(this.height + "px ");
 66  0
             result.append("0px); ");
 67   
         }
 68  0
         result.append("POSITION:absolute; ");
 69  0
         addParam(result, "BACKGROUND-COLOR", this.backGroundColor, "");
 70  0
         addParam(result, "layer-background-color", this.backGroundColor, "");
 71   
         //result.append("}");
 72  0
         return result.toString();
 73   
     }
 74   
 
 75  0
     private void addParam(StringBuffer buffer, String name, String value,
 76   
             String suffix) {
 77  0
         if (StringUtils.isEmpty(value))
 78  0
             return;
 79  0
         buffer.append(name + ":" + value + suffix + "; ");
 80   
     }
 81   
 
 82   
     abstract public String getStyleId();
 83   
 
 84   
     abstract public void setStyleId(String string);
 85   
 
 86   
     private String left = null;
 87   
 
 88   
     private String top = null;
 89   
 
 90   
     private String width = null;
 91   
 
 92   
     private String height = null;
 93   
 
 94   
     private String backGroundColor = null;
 95   
 
 96   
     /**
 97   
      * @return
 98   
      */
 99  0
     public String getHeight() {
 100  0
         return height;
 101   
     }
 102   
 
 103   
     /**
 104   
      * @return
 105   
      */
 106  0
     public String getLeft() {
 107  0
         return left;
 108   
     }
 109   
 
 110   
     /**
 111   
      * @return
 112   
      */
 113  0
     public String getTop() {
 114  0
         return top;
 115   
     }
 116   
 
 117   
     /**
 118   
      * @return
 119   
      */
 120  0
     public String getWidth() {
 121  0
         return width;
 122   
     }
 123   
 
 124   
     /**
 125   
      * @param string
 126   
      */
 127  0
     public void setHeight(String string) {
 128  0
         height = string;
 129   
     }
 130   
 
 131   
     /**
 132   
      * @param string
 133   
      */
 134  0
     public void setLeft(String string) {
 135  0
         left = string;
 136   
     }
 137   
 
 138   
     /**
 139   
      * @param string
 140   
      */
 141  0
     public void setTop(String string) {
 142  0
         top = string;
 143   
     }
 144   
 
 145   
     /**
 146   
      * @param string
 147   
      */
 148  0
     public void setWidth(String string) {
 149  0
         width = string;
 150   
     }
 151   
 
 152   
     /**
 153   
      * @return
 154   
      */
 155  0
     public String getBackGroundColor() {
 156  0
         return backGroundColor;
 157   
     }
 158   
 
 159   
     /**
 160   
      * @param string
 161   
      */
 162  0
     public void setBackGroundColor(String string) {
 163  0
         backGroundColor = string;
 164   
     }
 165   
 
 166   
 }