more clarification... 
alert(document.forms.tableSizeSelect.value);
${theWidget.tableSize} = document.forms.tableSizeSelect.value; why is the above 
assignment not possible?  Inside the widget I have tableSize declared as a 
Parameter.
This poses a dereferencing dilemma as ${theWidget.tableSize}  seems to not be 
the way to dereference a property on a component. Can someone elaborate on the 
proper way? Does it need to be binded to a dom element? If so please elaborate.
Best regards Ken in nashua


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: RE: Output variables in Tapestry 
Script - 4.1.3Date: Thu, 1 Nov 2007 09:56:30 -0400


Someruntime output...  <input-symbol key='theWidget' 
class='org.trails.demo.components.Gallery' required='yes'/> <input-symbol 
key='theTableSize' required='yes'/> <let 
key='galleryForm'>document.forms[0]</let> <let 
key='galleryFormId'>document.forms[0].id</let> <let key='tableWidth' 
unique='yes'>${theWidget.tableWidth}</let> <let key='tableSize' 
unique='yes'>${theWidget.tableSize}</let> <let key='tWidget' 
unique='yes'>${theWidget}</let>this   alert(${galleryForm});   
alert(${galleryFormId});   alert('${theWidget.clientId}');   
alert('${theWidget}');   alert('${tWidget}');   alert('${tableSize}');transates 
to   alert(document.forms[0]);   alert(document.forms[0].id);   
alert('galleryWidget');   alert('[EMAIL PROTECTED]/galleryWidget]');   
alert('[EMAIL PROTECTED]/galleryWidget]');   alert(2_0); what is 2_0 ?  How do 
we get to the tableSize value to the property of the component?Best regards Ken 
in nashua


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: RE: Output variables in Tapestry 
Script - 4.1.3Date: Thu, 1 Nov 2007 09:48:29 -0400

Attached is the modules in question... My tableSize parameter is specified in 
Home.html along with the component. I am able to dereference the form and 
get/set the value of the select component. I guess I want to get the value of 
the select and assign it to the ognl property of my component. I need to do the 
same onChange. Your feedback is appreciated.Best regards Ken in nashua


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: RE: Output variables in Tapestry 
Script - 4.1.3Date: Thu, 1 Nov 2007 09:23:40 -0400

correction...>BUT document.forms.${myFormName} produces undefined at the above 
works... But if I have a DIV or SPAN above in a containing html file I am 
unable to assign a name to it or dereference it in the document object. 
clarification on how to dereference and assign output data to these is 
appreciated.Best regards Ken in nashua


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Output variables in Tapestry Script 
- 4.1.3Date: Thu, 1 Nov 2007 09:11:58 -0400

Folks, I am using simple div/span... no form. When I attempt to index an 
element is showing undefined. 1. document.forms[0] produces my form alright and 
it has a name     BUT document.forms.${myFormName} produces undefined at      
runtime ? Why the lapse ? myFormname equates to the      actual form name    
EVEN this fails... document.forms['${myFormName}'] as      undefined 2. 
Assignment to <span name='sams as id' show up blank in debugger ? This prevents 
me from accessing is using DOM notation. Jesse/Andy... can you assess/advise 
the usability of this script? The docs are too scarse on outputs and the 
example code in the docs is out of context. How are we suppose to assign values 
to a dom element (which I am mapping to an abstract ognl component method 
parameter) when accessing/subscripting/dereferencing these in script body is 
not even possible? <input-symbol...<let key='... There is no ability to 
de-reference variables beyond these thereafter. The docs state this is all 
powerful and usable but I oanly see inputs working... I need to manipulate 
outputs by setting values to parameters/values in the DOM space... (or setting 
properties in the OGNL space) within my script.Can someone give a comprehensive 
snippet that shows an authentic assignment within a script to assign to both 
parameters/values in the DOM space and setting properties in the OGNL space? I 
am trying to pioneer some fertile ground here and happy to produce a new widget 
for public consumption based on your framework. Thanks in advance...Best 
regards Ken in nashua

Peek-a-boo FREE Tricks & Treats for You! Get 'em! 

Peek-a-boo FREE Tricks & Treats for You! Get 'em! 

Windows Live Hotmail and Microsoft Office Outlook – together at last. Get it 
now! 

Peek-a-boo FREE Tricks & Treats for You! Get 'em! 
_________________________________________________________________
Boo! Scare away worms, viruses and so much more! Try Windows Live OneCare!
http://onecare.live.com/standard/en-us/purchase/trial.aspx?s_cid=wl_hotmailnews
package org.trails.demo.components;

import java.util.Collection;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.IAsset;
import org.apache.tapestry.IPage;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IScript;
import org.apache.tapestry.annotations.ComponentClass;
import org.apache.tapestry.annotations.InjectObject;
import org.apache.tapestry.annotations.InjectScript;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.form.StringPropertySelectionModel;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.dao.DataAccessException;
import org.trails.component.TrailsComponent;
import org.trails.component.blob.BlobDownloadService;
import org.trails.component.blob.TrailsBlobAsset;
import org.trails.demo.Listing;
import org.trails.descriptor.DescriptorService;
import org.trails.page.EditPage;
import org.trails.persistence.HibernatePersistenceService;

/**
 * This guy (tapestry/dojo/json/script oriented widget) renders a gallery.
 *
 * Script is facilitated to operate/persist auto-paging.
 *
 * @author kenneth.colassi [EMAIL PROTECTED]
 *
 */
@ComponentClass(allowBody = true, allowInformalParameters = true)
public abstract class Gallery extends TrailsComponent
{
	private static final Log LOG = LogFactory.getLog(Gallery.class);

	private static final String[] tableSizeOptions = new String[] { new Integer("1").toString(), new Integer("2").toString(),
			new Integer("3").toString(), new Integer("4").toString(), new Integer("5").toString(), new Integer("10").toString(), new Integer("25").toString(),
			new Integer("50").toString(), new Integer("100").toString(), new Integer("500").toString(), new Integer("1000").toString(), new Integer("2500").toString(),
			new Integer("5000").toString(), new Integer("10000").toString(), new Integer("25000").toString(), new Integer("50000").toString() };

	private static final String[] pagingSpanOptions = new String[] { new Integer("5").toString(), new Integer("10").toString(),
			new Integer("15").toString(), new Integer("20").toString(), new Integer("25").toString() };

	private IPropertySelectionModel tableSizeModel = null;

	private IPropertySelectionModel pagingSpanModel = null;

	private Collection collection = null;

	/**
	 * E-Frastructure and Services
	 */
	@InjectObject("spring:persistenceService")
	public abstract HibernatePersistenceService getHibernatePersistenceService();

	@InjectObject("spring:descriptorService")
	public abstract DescriptorService getDescriptorService();

	@InjectObject("service:trails.core.BlobService")
	public abstract BlobDownloadService getDownloadService();

	@Parameter(required = true)
	public abstract Class getCollectionType();
	public abstract void setCollectionType(Class collectionType);

	/**
	 * PropertySelection Support
	 */
	@Parameter(required = false, cache = true, defaultValue = "2")
	public abstract Integer getTableSize();
	public abstract void setTableSize(Integer tableSize);

	@Parameter(required = false, cache = true, defaultValue = "2")
	public abstract Integer getTableWidth();
	public abstract void setTableWidth(Integer tableSize);

	@Parameter(required = false, cache = true, defaultValue = "5")
	public abstract Integer getPagingSpan();
	public abstract void setPagingSpan(Integer pagingSpan);

	/**
	 * FOR component Collection Iterator support
	 */
	@Parameter(required = false)
	public abstract int getStartRow();
	public abstract void setStartRow(int startRow);

	public abstract Object getCurrentObject();
	public abstract void setCurrentObject(Object CurrentObject);

	public abstract int getIndex();
	public abstract void setIndex(int index);

	/**
	 * Typically injected via jwc - readonly, yes that means no setter
	 */
	@InjectScript("Gallery.script")
	public abstract IScript getScript();

	public Collection getCollection()
	{
		return collection;
	}

	public void setCollection(Collection collection)
	{
		this.collection = collection;
	}

	public Collection loadCollection(Class collectionClass) throws DataAccessException
	{
		DetachedCriteria criteria = DetachedCriteria.forClass(collectionClass);
		// criteria.add(Restrictions.eq("id", 1));
		return getHibernatePersistenceService().getInstances(collectionClass, criteria);
	}

	public IPropertySelectionModel getTableSizeModel()
	{
		if (tableSizeModel == null)
			tableSizeModel = new StringPropertySelectionModel(tableSizeOptions);

		return tableSizeModel;
	}

	public IPropertySelectionModel getPagingSpanModel()
	{
		if (pagingSpanModel == null)
			pagingSpanModel = new StringPropertySelectionModel(pagingSpanOptions);

		return pagingSpanModel;
	}

	@Override
	protected void prepareForRender(IRequestCycle cycle)
	{
		super.prepareForRender(cycle);

		setCollection(loadCollection(getCollectionType()));

		/*
		 * if ( getTableSize() == null ) setTableSize (tableSizeOptions[0]); if (
		 * getPagingSpan() == null ) setPagingSpan (pagingSpanOptions[0]);
		 */
	}

	public IAsset getPhotoAsset()
	{
		Listing listing = (Listing) getCurrentObject();
		String contentType = listing.getPhoto().getContentType();
		String fileName = listing.getPhoto().getFileName();

		return new TrailsBlobAsset(getDownloadService(), getCollectionType().getName(), listing.getId().toString(),
				"photo", contentType, fileName);
	}

	public IPage page(Integer number)
	{
		EditPage editPage = null;
		return editPage;
	}

	public IPage onFormSubmit(IRequestCycle cycle)
	{
		IPage page = cycle.getPage();

		return page;
	}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to