Coverage Report - org.apache.tapestry.dojo.html.Dialog
 
Classes in this File Line Coverage Branch Coverage Complexity
Dialog
0% 
0% 
1.375
 
 1  
 // Copyright Oct 16, 2006 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 // http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 package org.apache.tapestry.dojo.html;
 15  
 
 16  
 import org.apache.tapestry.IMarkupWriter;
 17  
 import org.apache.tapestry.IRequestCycle;
 18  
 import org.apache.tapestry.IScript;
 19  
 import org.apache.tapestry.TapestryUtils;
 20  
 import org.apache.tapestry.dojo.AbstractWidget;
 21  
 import org.apache.tapestry.json.JSONObject;
 22  
 
 23  
 import java.util.HashMap;
 24  
 import java.util.Map;
 25  
 
 26  
 
 27  
 /**
 28  
  * Implementation of dojo Dialog widget.
 29  
  * 
 30  
  */
 31  0
 public abstract class Dialog extends AbstractWidget
 32  
 {
 33  
     public abstract boolean isHidden();
 34  
     public abstract void setHidden(boolean hidden);
 35  
     
 36  
     public abstract String getBackgroundColor();
 37  
     
 38  
     public abstract float getOpacity();
 39  
     
 40  
     public void show()
 41  
     {
 42  0
         setHidden(false);
 43  0
     }
 44  
 
 45  
     public void hide()
 46  
     {
 47  0
         setHidden(true);
 48  0
     }
 49  
     
 50  
     /**
 51  
      * {@inheritDoc}
 52  
      */
 53  
     public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
 54  
     {
 55  0
         if (!cycle.isRewinding())
 56  
         {
 57  0
             writer.begin(getTemplateTagName()); // use element specified
 58  0
             renderIdAttribute(writer, cycle); // render id="" client id
 59  0
             renderInformalParameters(writer, cycle);
 60  
         }
 61  
         
 62  0
         renderBody(writer, cycle);
 63  
         
 64  0
         if (!cycle.isRewinding())
 65  0
             writer.end();
 66  
         
 67  0
         if (!cycle.isRewinding())
 68  
         {
 69  0
             JSONObject json = new JSONObject();
 70  0
             json.put("bgColor", getBackgroundColor());
 71  0
             json.put("bgOpacity", getOpacity());
 72  
 
 73  0
             Map parms = new HashMap();
 74  0
             parms.put("component", this);
 75  0
             parms.put("props", json.toString());
 76  
             
 77  0
             getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms);
 78  
         }
 79  0
     }
 80  
     
 81  
     /** injected. */
 82  
     public abstract IScript getScript();
 83  
 }