You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken nashua <nh...@hotmail.com> on 2007/09/05 16:54:21 UTC

JSON - contentbox dimensions on render within request cycle

Folks,

I have my tapestry script oriented now and rendering beautiful javascript 
from within my @Head derivative (custom head component). I am pleased with 
these framework features.

One of the methods in my custom head is header (ie. getHeader()) and this is 
just a background image placed in the top portion of the page utilizing app 
fuses css-framework (header, content, footer) I am just populating those 
div's with imagery.

But I have a problem with populating this header image. On condition it is 
smaller than the content box it does not stretch and I am not about to 
oversize it for automatic reduced scaling.

So now I use JSON and Tapestry Script.

Here is my problem...
PROBLEM: During the render cycle I need to determine what the actual width 
of the content box is and populate that to my javascript in order to resize 
my image to that content box width.

Here is my question...
QUESTION: Which interface method should I override and which part of the 
request cycle (if any) should I attempt to interrogate in order to properly 
gather the correct content box dimensions that the response will render?

I am also curious about which of these I should attempt to exercise and what 
their content may be.

Customhead.JAVA (renders nice now... I need real time scaling)
	public abstract IRender getDelegate();
	public abstract IRender getAjaxDelegate();

	@Override
	public void renderComponent(IJSONWriter writer, IRequestCycle cycle)

	@Override
	protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)

Any direction here is appreciated.

thanks

Below is my current proto for SCRIPT.

Customhead.script
================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script PUBLIC
	"-//Apache Software Foundation//Tapestry Script Specification 4.0//EN"
	"http://jakarta.apache.org/tapestry/dtd/Script_4_0.dtd">

<script>
	<!-- E-Frastructure inputs from @Script in the template -->
	<input-symbol key="component" class="org.trails.demo.AdminLayout" 
required="no"/>

	<body>
		<unique>
			dojo.require("tapestry.widget.Widget");
			dojo.require("dojo.widget.*");
			dojo.require("dojo.html");
		</unique>


		function scaleHeader() {
			var elementId = 'header';
			var headerElement = document.getElementById(elementId);

			var cb = dojo.html.getContentBox(headerElement);
			var cb = dojo.html.getPaddingBox(headerElement);
			var bb = dojo.html.getBorderBox(headerElement);
			var mb = dojo.html.getMarginBox(headerElement);
		}
	</body>

	<initialization>
		window.onload = scaleHeader();
	</initialization>
</script>

_________________________________________________________________
Share your special parenting moments! 
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org