Ok, I followed your lead and tried both 1. repaired spelling of integer. Still 
failed 2. Tried Jesse's version. That failed too 
@Persist
@InitialValue('ognl:2')
public abstract int getTableSize();
public abstract void setTableSize(int tableSize); The select comes up with 
initial selected '1' highlighted blue I navigate and select '4' Post occurs 
select comes up with initial selected '1'  Then it highlights to blue Cannot 
get this binding to stick. I attached the sources if that helps... might it be 
this configuration of RenderBlock and Block... 
 
Hoping to resume.. thanks for your time.Best regards 
Ken in nashua
 
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate.  Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline
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.EventListener;
import org.apache.tapestry.annotations.InitialValue;
import org.apache.tapestry.annotations.InjectObject;
import org.apache.tapestry.annotations.InjectScript;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.annotations.Persist;
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;
import org.trails.util.IntegerPropertySelectionModel;

/**
 * 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 Integer[] tableSizeIntegerOptions = new Integer[]
	{ new Integer("1"), new Integer("2"), new Integer("3"), new Integer("4"), new Integer("5"), new Integer("10"),
	        new Integer("25"), new Integer("50"), new Integer("100"), new Integer("500"), new Integer("1000"),
	        new Integer("2500"), new Integer("5000"), new Integer("10000"), new Integer("25000"), new Integer("50000") };

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

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

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

	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
	 */
	@Persist
	@InitialValue("ognl:2")
	public abstract int getTableSize();
	public abstract void setTableSize(int tableSize);

	@Persist
	@InitialValue("ognl:5")
	public abstract int getPagingSpan();
	public abstract void setPagingSpan(int pagingSpan);

	protected void finishLoad()
	{
		super.finishLoad();

		// parameter initialization, alternative to parameter annotation
		// defaultValue
		// setTableSize("2");
		// setPagingSpan("5");
	}

	/**
	 * 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 IntegerPropertySelectionModel(tableSizeIntegerOptions);
			tableSizeModel = new StringPropertySelectionModel(tableSizeStringOptions);
		}

		return tableSizeModel;
	}

	public IPropertySelectionModel getPagingSpanModel()
	{
		if (pagingSpanModel == null)
		{
			pagingSpanModel = new IntegerPropertySelectionModel(pagingSpanIntegerOptions);
			pagingSpanModel = new StringPropertySelectionModel(pagingSpanStringOptions);
		}

		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;
	}

	@EventListener(events = { "onChange" }, targets = { "tableSizeSelect" }, submitForm = "galleryForm", async = false)
	public void tableChangeListener(IRequestCycle cycle)
	{
	}

	@EventListener(events = { "onChange" }, targets = { "pagingSpanSelect" }, submitForm = "galleryForm", async = false)
	public void pagingSpanListener(IRequestCycle cycle)
	{
	}
}
<!DOCTYPE component-specification PUBLIC "-//Apache Software 
Foundation//Tapestry Specification 4.1//EN" 
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_1.dtd";>
<component-specification class="org.trails.demo.components.Gallery"
                                                 allow-body="yes"
                                                 
allow-informal-parameters="yes">
        <component id="tableSizeSelect" type="PropertySelection">
                <!-- <binding name="value" value="tableSize"/> -->
                <binding name="model" value="tableSizeModel"/>
                <binding name="onchange" 
value="literal:tapestry.form.submit(this.form)"/>
        </component>

        <component id="pagingSpanSelect" type="PropertySelection">
                <!-- <binding name="value" value="pagingSpan"/> -->
                <binding name="model" value="pagingSpanModel"/>
                <binding name="onchange" 
value="literal:tapestry.form.submit(this.form)"/>
        </component>

</component-specification>
<?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>
	<!-- Method Parameter Bindings -->
	<input-symbol key="component" class="org.trails.demo.components.Gallery" required="yes" />
	<input-symbol key="tableSize" required="no" />
	<input-symbol key="pagingSpan" required="no" />

	<!-- Instance Variables -->
	<let key="widget" unique="yes">${component.clientId}</let>
	<let key="galleryForm">document.forms[0]</let>
	<let key="numColumns" unique="yes">inlineNumColumns</let>

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

		function setSelected(theList, theValue) {
			for (var i = 0; i &lt; theList.length; i++) {
				if ( theList[i].text == theValue) {
				  theList[i].selected = true;
				  break;
				}
			}
		}

		function initGallery() {
			debugger;
			var imageWidth = 160;
			var contentBox = dojo.html.getContentBox(${galleryForm});
			${numColumns} = Math.floor(contentBox.width / imageWidth);

			var dojoWidget = dojo.widget.getWidgetById("${component.clientId}");

			var tableSizeSelectedIndex = document.forms[0].tableSizeSelect.selectedIndex;
			document.forms[0].tableSizeSelect[tableSizeSelectedIndex].selected = false;
			setSelected (document.forms[0].tableSizeSelect.options, '${tableSize}');

			var pagingSpanSelectedIndex = document.forms[0].pagingSpanSelect.selectedIndex;
			document.forms[0].pagingSpanSelect[pagingSpanSelectedIndex].selected = false;
			setSelected (document.forms[0].pagingSpanSelect.options, '${pagingSpan}');

			var divBlock = document.createElement("div");
			divBlock.appendChild(document.createTextNode("Loading..."));
			var contentDom = document.forms[0].document.getElementById("galleryContent");
			contentDom.appendChild(divBlock);
		}
	</body>

	<initialization>
		initGallery();
	</initialization>
</script>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to