|
|||||||||||||||||||
| 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 | |||||||||||||||
| Desktop.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 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/07
|
|
| 7 |
*/
|
|
| 8 |
package org.asyrinx.brownie.tapestry.components.layer;
|
|
| 9 |
|
|
| 10 |
import org.apache.tapestry.ApplicationRuntimeException;
|
|
| 11 |
import org.apache.tapestry.IMarkupWriter;
|
|
| 12 |
import org.apache.tapestry.IRequestCycle;
|
|
| 13 |
|
|
| 14 |
/**
|
|
| 15 |
* @author akima
|
|
| 16 |
*/
|
|
| 17 |
public abstract class Desktop extends AbstractLayerComponent { |
|
| 18 |
|
|
| 19 |
/**
|
|
| 20 |
* @param scriptName
|
|
| 21 |
*/
|
|
| 22 | 0 |
public Desktop() {
|
| 23 | 0 |
super("Desktop.script"); |
| 24 | 0 |
this.setLeft("0"); |
| 25 | 0 |
this.setTop(null); |
| 26 | 0 |
this.setWidth("400"); |
| 27 | 0 |
this.setHeight("300"); |
| 28 | 0 |
this.setBackGroundColor("#339966"); |
| 29 |
} |
|
| 30 |
|
|
| 31 |
public static final String ATTRIBUTE_NOW_RENDERING = Desktop.class |
|
| 32 |
.getName() |
|
| 33 |
+ ".rendering";
|
|
| 34 |
|
|
| 35 | 0 |
public static Desktop get(IRequestCycle cycle) { |
| 36 | 0 |
return (Desktop) cycle.getAttribute(ATTRIBUTE_NOW_RENDERING);
|
| 37 |
} |
|
| 38 |
|
|
| 39 |
/**
|
|
| 40 |
* @see org.asyrinx.brownie.tapestry.script.AbstractScriptComponent#checkBeforeRender(org.apache.tapestry.IMarkupWriter,
|
|
| 41 |
* org.apache.tapestry.IRequestCycle)
|
|
| 42 |
*/
|
|
| 43 | 0 |
protected void checkBeforeRender(IMarkupWriter writer, IRequestCycle cycle) { |
| 44 | 0 |
if (cycle.getAttribute(ATTRIBUTE_NOW_RENDERING) != null) |
| 45 | 0 |
throw new ApplicationRuntimeException("Desktop may not nest", this, |
| 46 |
null, null); |
|
| 47 |
} |
|
| 48 |
|
|
| 49 |
/**
|
|
| 50 |
*
|
|
| 51 |
* @see org.apache.tapestry.AbstractComponent#renderComponent(org.apache.tapestry.IMarkupWriter,
|
|
| 52 |
* org.apache.tapestry.IRequestCycle)
|
|
| 53 |
*/
|
|
| 54 | 0 |
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { |
| 55 | 0 |
checkBeforeRender(writer, cycle); |
| 56 | 0 |
cycle.setAttribute(ATTRIBUTE_NOW_RENDERING, this);
|
| 57 | 0 |
try {
|
| 58 | 0 |
this.scriptWriter.execute(cycle);
|
| 59 |
|
|
| 60 | 0 |
final IMarkupWriter nested = writer.getNestedWriter(); |
| 61 | 0 |
renderBody(nested, cycle); |
| 62 |
|
|
| 63 |
// Start the div tag.
|
|
| 64 | 0 |
writer.println(); |
| 65 | 0 |
writer.begin("div");
|
| 66 | 0 |
writer.attribute("id", getStyleId());
|
| 67 | 0 |
writer.attribute("style", toStyleValue());
|
| 68 | 0 |
renderInformalParameters(writer, cycle); |
| 69 | 0 |
writer.println(); |
| 70 |
// Close the nested writer, which dumps its buffered content
|
|
| 71 |
// into its parent.
|
|
| 72 | 0 |
nested.close(); |
| 73 | 0 |
writer.end(); // <div>
|
| 74 |
|
|
| 75 |
} finally {
|
|
| 76 | 0 |
cycle.removeAttribute(ATTRIBUTE_NOW_RENDERING); |
| 77 |
} |
|
| 78 |
} |
|
| 79 |
|
|
| 80 |
} |
|
||||||||||