You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nhhockeyplayer nashua <nh...@hotmail.com> on 2015/01/23 16:08:09 UTC
Folks,
I wrote code and it fails now.
My event handler refuses to be triggered.
I have tried everything.
Can someone take a look at this code? The demo is at http://psinh.ddns.net:9011/psi/home
Best regards
and thanks... KEN
Pages have properties Components have parameters. The page that houses this Gallery has persistent properties for VALUE.
Gallery.TML
<td width="10%" align="center" nowrap="NOWRAP">
<t:Label for="itemsPerPageSelect">Items Per Page</t:Label>
<select t:type="Select" t:id="itemsPerPageSelect" t:clientId="itemsPerPageSelect" id="itemsPerPageSelect"
t:model="literal:5,10,15,25,50,100,250,500,1000,5000,10000"
t:value="itemsPerPage"
onchange="galleryForm.submit()"
/>
</td>
Gallery.JAVA
@Component(id = "itemsPerPageSelect", parameters = { "value=itemsPerPage", "clientId=itemsPerPageSelect" } )
private Select itemsPerPageSelect; // this event never gets called
@OnEvent(value = EventConstants.VALUE_CHANGED, component = "itemsPerPageSelect")
public Object onActionFromItemsPerPageSelect(Integer value)
{
logger.debug("In onValueChangedItemsPerPageSelect : "); // ok pagination logic omitted return homePage;
}
Re:
Posted by Chris Poulsen <ma...@nesluop.dk>.
I think my first suggestion would have worked if you had actually wrapped
the select in a t:zone and not a <zone> tag and removed the argument from
the handler... as i wrote there is no need to work with hidden submits etc.
it works right out of the box, with dead simple code.
On Sat, Jan 24, 2015 at 1:33 PM, nhhockeyplayer nashua <
nhhockeyplayer@hotmail.com> wrote:
> Thanks Geoff,
>
> I finally got a breakpoint using zones. Cant say too much for the OnEvent
> annotations anymore. My code lived before inducing a javascript submit
> without submit button but to make this fly I had to add the invisible
> submit button just like your filterSubmit and emulate a click() on change.
>
> Much appreciated.
>
> nasty Slowwwww though... feel free to check it out
> http://psinh.ddns.net:9011/psi/home
>
>
>
> <td width="10%" align="center" nowrap="NOWRAP">
> <t:Label for="itemsPerPageSelect">Items Per Page</t:Label>
> <t:zone t:id="itemsPerPageSelectZone">
> <t:select
> t:id="itemsPerPageSelect"
> t:model="literal:5,10,15,25,50,100,250,500,1000,5000,10000"
> t:value="itemsPerPage"
> onchange="document.getElementById('gallerySubmit').click()"
> secure="never"
> zone="itemsPerPageSelectZone"
> />
> </t:zone>
> </td>
> <td width="10%" align="center" nowrap="NOWRAP">
> <t:Label for="tableColumnsSelect">Table Columns</t:Label>
> <t:zone t:id="tableColumnsSelectZone">
> <t:select
> t:id="tableColumnsSelect"
> model="literal:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,25,50,100"
> value="tableColumns"
> onchange="document.getElementById('gallerySubmit').click()"
> secure="never"
> zone="tableColumnsSelectZone"
> />
> </t:zone>
> </td>
>
> @InjectComponent
> private Zone itemsPerPageSelectZone;
> public void onValueChangedFromItemsPerPageSelect()
> {
> if (itemsPerPage < tableColumns)
> {
> tableColumns = itemsPerPage;
> } else
> {
> int i = cursor + itemsPerPage;
> while (i > (collection.size() - Math.min(collection.size(),
> itemsPerPage + tableColumns)))
> {
> i--;
> }
> cursor = (i);
> }
> }
>
> @InjectComponent
> private Zone tableColumnsSelectZone;
> public void onValueChangedFromTableColumnsSelect()
> {
> onValueChangedFromItemsPerPageSelect();
> }
>
RE:
Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Thanks Geoff,
I finally got a breakpoint using zones. Cant say too much for the OnEvent annotations anymore. My code lived before inducing a javascript submit without submit button but to make this fly I had to add the invisible submit button just like your filterSubmit and emulate a click() on change.
Much appreciated.
nasty Slowwwww though... feel free to check it out http://psinh.ddns.net:9011/psi/home
<td width="10%" align="center" nowrap="NOWRAP">
<t:Label for="itemsPerPageSelect">Items Per Page</t:Label>
<t:zone t:id="itemsPerPageSelectZone">
<t:select
t:id="itemsPerPageSelect"
t:model="literal:5,10,15,25,50,100,250,500,1000,5000,10000"
t:value="itemsPerPage"
onchange="document.getElementById('gallerySubmit').click()" secure="never"
zone="itemsPerPageSelectZone"
/>
</t:zone>
</td>
<td width="10%" align="center" nowrap="NOWRAP">
<t:Label for="tableColumnsSelect">Table Columns</t:Label>
<t:zone t:id="tableColumnsSelectZone">
<t:select
t:id="tableColumnsSelect"
model="literal:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,25,50,100"
value="tableColumns"
onchange="document.getElementById('gallerySubmit').click()" secure="never"
zone="tableColumnsSelectZone"
/>
</t:zone>
</td>
@InjectComponent
private Zone itemsPerPageSelectZone;
public void onValueChangedFromItemsPerPageSelect()
{
if (itemsPerPage < tableColumns)
{
tableColumns = itemsPerPage;
} else
{
int i = cursor + itemsPerPage;
while (i > (collection.size() - Math.min(collection.size(), itemsPerPage + tableColumns)))
{
i--;
}
cursor = (i);
}
}
@InjectComponent
private Zone tableColumnsSelectZone;
public void onValueChangedFromTableColumnsSelect()
{
onValueChangedFromItemsPerPageSelect();
}
Re:
Posted by Geoff Callender <ge...@gmail.com>.
One of these should help you:
http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/filteredgrid
http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/select1
Geoff
On 24 Jan 2015, at 11:55 am, nhhockeyplayer nashua <nh...@hotmail.com> wrote:
> Thanks Chris,
>
> sorry about the code formats... eclipse editors.
>
> I never felt removing the parameter would help because these handlers ARENT THEY SUPPOSE TO PROVIDE THE CHANGED VALUE?
>
> and the other handler (there are two selects itemsPerPage and tableSize) wasnt being vcalled while it had no parameter either.
>
> I removed the parameter though and it still didnt work.
>
> I cant see enough under the hood to know why these select handers are not being called.
>
> I did layout proper semantics though
>
> its just a gallery component sitting on a home page
> pages have properties components have parameters (i keep repeating that in my head)
>
> http://psinh.ddns.net:9011/psi/home
>
> the markup is there
>
> wel i'm blue in the face not sure what to do
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE:
Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Thanks Chris,
sorry about the code formats... eclipse editors.
I never felt removing the parameter would help because these handlers ARENT THEY SUPPOSE TO PROVIDE THE CHANGED VALUE?
and the other handler (there are two selects itemsPerPage and tableSize) wasnt being vcalled while it had no parameter either.
I removed the parameter though and it still didnt work.
I cant see enough under the hood to know why these select handers are not being called.
I did layout proper semantics though
its just a gallery component sitting on a home page
pages have properties components have parameters (i keep repeating that in my head)
http://psinh.ddns.net:9011/psi/home
the markup is there
wel i'm blue in the face not sure what to do
Re:
Posted by Chris Poulsen <ma...@nesluop.dk>.
your pasted code is a mess. But from what I can see your attempt to
implement my suggestion was almost correct... except that you had an
argument in your change handler:
was:
onActionFromItemsPerPageSelect(Integer value)
should be:
onActionFromItemsPerPageSelect() [the property bound to the value of
the select component has the newly selected value when this is triggered]
On Fri, Jan 23, 2015 at 11:18 PM, nhhockeyplayer nashua <
nhhockeyplayer@hotmail.com> wrote:
> the docs only reflect s <select> on a page
> not a <select> on a component
> My page is Home.JAVA
> @Persist @Property private Integer itemsPerPage;
> My Component is Gallery.JAVA @Property @Parameter(required =
> true, value="literal:25", cache=true) private Integer itemsPerPage;
> I go by the theory that paged have properties and components have
> parameters
> Havent I done sufficient enough to at least get an event generated and a
> breakpoint?
> Home.tml <t:form t:id="galleryForm"
> t:context="collectionType"> <t:Gallery
> collectionType="collectionType"
> itemsPerPage="itemsPerPage"
> tableColumns="tableColumns"
> cursor="cursor"> </t:Gallery>
> </t:form>
> Gallery.java @Component(id = "itemsPerPageSelect", parameters = {
> "value=itemsPerPage", "clientId=itemsPerPageSelect" }) private
> Select itemsPerPageSelect; @OnEvent(value =
> EventConstants.VALUE_CHANGED, component = "itemsPerPageSelect")
> public Object onActionFromItemsPerPageSelect(Integer value) {
> logger.debug("In onValueChangedItemsPerPageSelect : ");
> if (itemsPerPage < tableColumns) {
> tableColumns = itemsPerPage; } else {
> /** * Use case, items is larger than columns,
> need to back cursor off * if in endzone
> */ int i = cursor + itemsPerPage;
> while (i > (collection.size() - Math.min(collection.size(),
> itemsPerPage + tableColumns))) {
> i--; } cursor = (i);
> } return homePage; }
> @Component(id = "tableColumnsSelect", parameters = {
> "value=tableColumns", "clientId=tableColumnsSelect" }) private
> Select tableColumnsSelect;
> @OnEvent(value = EventConstants.VALUE_CHANGED, component =
> "tableColumnsSelect") public Object
> onChangeFromTableColumnsSelect() { logger.info("In
> tableColumnsChangeListener : ");
> onActionFromItemsPerPageSelect(itemsPerPage); return homePage;
> }
> public Object galleryFormSubmit() {
> logger.info("In galleryFormSubmit : ");
> return homePage; }
>
>
>
>
RE:
Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
the docs only reflect s <select> on a page
not a <select> on a component
My page is Home.JAVA
@Persist @Property private Integer itemsPerPage;
My Component is Gallery.JAVA @Property @Parameter(required = true, value="literal:25", cache=true) private Integer itemsPerPage;
I go by the theory that paged have properties and components have parameters
Havent I done sufficient enough to at least get an event generated and a breakpoint?
Home.tml <t:form t:id="galleryForm" t:context="collectionType"> <t:Gallery collectionType="collectionType" itemsPerPage="itemsPerPage" tableColumns="tableColumns" cursor="cursor"> </t:Gallery> </t:form>
Gallery.java @Component(id = "itemsPerPageSelect", parameters = { "value=itemsPerPage", "clientId=itemsPerPageSelect" }) private Select itemsPerPageSelect; @OnEvent(value = EventConstants.VALUE_CHANGED, component = "itemsPerPageSelect") public Object onActionFromItemsPerPageSelect(Integer value) { logger.debug("In onValueChangedItemsPerPageSelect : "); if (itemsPerPage < tableColumns) { tableColumns = itemsPerPage; } else { /** * Use case, items is larger than columns, need to back cursor off * if in endzone */ int i = cursor + itemsPerPage; while (i > (collection.size() - Math.min(collection.size(), itemsPerPage + tableColumns))) { i--; } cursor = (i); } return homePage; }
@Component(id = "tableColumnsSelect", parameters = { "value=tableColumns", "clientId=tableColumnsSelect" }) private Select tableColumnsSelect;
@OnEvent(value = EventConstants.VALUE_CHANGED, component = "tableColumnsSelect") public Object onChangeFromTableColumnsSelect() { logger.info("In tableColumnsChangeListener : "); onActionFromItemsPerPageSelect(itemsPerPage); return homePage; }
public Object galleryFormSubmit() { logger.info("In galleryFormSubmit : ");
return homePage; }
RE:
Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
I dont want to add a submit button because its not natural for a gallery with a select
thats why I put the
onchange="galleryForm.submit()"
because when I omit that nothing gets triggered to this code for anything
The gallery needs to redraw but no event is being triggered and persistent properties are locked down
any further ideas are very much appreciated... I have spent a long time on this onecant shake it out
Ken
RE:
Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Thanks Chris,
I rigged it up as you stated... no luck... cant get a breakpoint to hit and the properties values keep getting punched back to their original defaults. no change is being induced with this code
Gallery.TML
<td width="10%" align="center" nowrap="NOWRAP"> <t:Label for="itemsPerPageSelect">Items Per Page</t:Label> <zone> <select t:type="Select" t:id="itemsPerPageSelect" t:clientId="itemsPerPageSelect" id="itemsPerPageSelect" t:model="literal:5,10,15,25,50,100,250,500,1000,5000,10000" t:value="itemsPerPage" ensureClientIdUnique="true" zone="^" /> </zone></td></td>
Gallery.JAVA
@Component(id = "itemsPerPageSelect", parameters ={ "value=itemsPerPage", "clientId=itemsPerPageSelect" })private Select itemsPerPageSelect;
@OnEvent(value = EventConstants.VALUE_CHANGED, component = "itemsPerPageSelect")public Object onActionFromItemsPerPageSelect(Integer value){ logger.debug("In onValueChangedItemsPerPageSelect : ");
if (itemsPerPage < tableColumns) { tableColumns = itemsPerPage; } else { /** * Use case, items is larger than columns, need to back cursor off * if in endzone */ int i = cursor + itemsPerPage; while (i > (collection.size() - Math.min(collection.size(), itemsPerPage + tableColumns))) { i--; } cursor = (i); } return homePage;}
Re:
Posted by Chris Poulsen <ma...@nesluop.dk>.
dont mess around with the form manually - you cannot submit it using that
function - instead wrap the select in a zone and specify zone="^" on the
select.
HTH
--
Chris
On Fri, Jan 23, 2015 at 4:08 PM, nhhockeyplayer nashua <
nhhockeyplayer@hotmail.com> wrote:
> Folks,
>
> I wrote code and it fails now.
>
> My event handler refuses to be triggered.
>
> I have tried everything.
>
> Can someone take a look at this code? The demo is at
> http://psinh.ddns.net:9011/psi/home
>
> Best regards
> and thanks... KEN
>
> Pages have properties Components have parameters. The page that houses
> this Gallery has persistent properties for VALUE.
>
> Gallery.TML
>
> <td width="10%" align="center" nowrap="NOWRAP">
> <t:Label for="itemsPerPageSelect">Items Per Page</t:Label>
> <select t:type="Select" t:id="itemsPerPageSelect"
> t:clientId="itemsPerPageSelect" id="itemsPerPageSelect"
> t:model="literal:5,10,15,25,50,100,250,500,1000,5000,10000"
> t:value="itemsPerPage"
> onchange="galleryForm.submit()"
> />
> </td>
>
> Gallery.JAVA
>
> @Component(id = "itemsPerPageSelect", parameters = {
> "value=itemsPerPage", "clientId=itemsPerPageSelect" } )
> private Select itemsPerPageSelect; // this event never gets called
> @OnEvent(value = EventConstants.VALUE_CHANGED, component =
> "itemsPerPageSelect")
> public Object onActionFromItemsPerPageSelect(Integer value)
> {
> logger.debug("In onValueChangedItemsPerPageSelect : "); // ok
> pagination logic omitted return homePage;
> }
>
>