Coverage Report - org.apache.tapestry.dojo.html.Dialog
 
Classes in this File Line Coverage Branch Coverage Complexity
Dialog
0% 
0% 
1.214
 
 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 abstract boolean getFollowScroll();
 41  
     
 42  
     public abstract boolean getCloseOnBackgroundClick();
 43  
     
 44  
     public abstract int getBlockDuration();
 45  
     
 46  
     public abstract int getLifeTime();
 47  
     
 48  
     public abstract String getToggle();
 49  
     
 50  
     public abstract int getToggleDuration();
 51  
     
 52  
     public void show()
 53  
     {
 54  0
         setHidden(false);
 55  0
     }
 56  
 
 57  
     public void hide()
 58  
     {
 59  0
         setHidden(true);
 60  0
     }
 61  
     
 62  
     /**
 63  
      * {@inheritDoc}
 64  
      */
 65  
     public void renderWidget(IMarkupWriter writer, IRequestCycle cycle)
 66  
     {
 67  0
         if (!cycle.isRewinding())
 68  
         {
 69  0
             writer.begin(getTemplateTagName()); // use element specified
 70  0
             renderIdAttribute(writer, cycle); // render id="" client id
 71  0
             renderInformalParameters(writer, cycle);
 72  
         }
 73  
         
 74  0
         renderBody(writer, cycle);
 75  
         
 76  0
         if (!cycle.isRewinding())
 77  0
             writer.end();
 78  
         
 79  0
         if (!cycle.isRewinding())
 80  
         {
 81  0
             JSONObject json = new JSONObject();
 82  0
             json.put("bgColor", getBackgroundColor());
 83  0
             json.put("bgOpacity", getOpacity());
 84  0
             json.put("followScroll", getFollowScroll());
 85  0
             json.put("closeOnBackgroundClick", getCloseOnBackgroundClick());
 86  0
             json.put("blockDuration", getBlockDuration());
 87  0
             json.put("lifeTime", getLifeTime());
 88  0
             json.put("toggle", getToggle());
 89  0
             json.put("toggleDuration", getToggleDuration());
 90  
 
 91  0
             Map parms = new HashMap();
 92  0
             parms.put("component", this);
 93  0
             parms.put("props", json.toString());
 94  
             
 95  0
             getScript().execute(this, cycle, TapestryUtils.getPageRenderSupport(cycle, this), parms);
 96  
         }
 97  0
     }
 98  
         
 99  
     /** injected. */
 100  
     public abstract IScript getScript();
 101  
 }