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 2012/11/09 02:46:40 UTC

select event handler wont hit breakpoint - quarky runtime came back

Folks,

I have a serious bug in my app. I am not sure what it is but it is elusive and I am seeing intermittent results. To characterize it all I would be typing alot. I will try to keep it simple. I thought it was fixed last week when Howard successfully advised me to use @Persist... which did cause my app to behave properly by persisting a couple select flags... but just yesterday... everything mysteriously went back to coming apart at the seams with nulls during the initialization process and thereon. And nothign works after the app is rendered.

The app is simple... LAYOUT<==HOME<==GALLERY-COMPONENT
The gfallery component is nice and I have it at 85% functional... and hope to publish it for public consumption. I am QA'ing it now.

I have been considering tweaking the following...
page-pooling flags or caching flagsprod versus dev flagtaking the app apart to shake it out
I am not encouraged in the debugger because I am seeing alot of nulls in setupRender... and other early handlers... and then allocated memory on objects.. and then back to nulls... and back and forth... while trying to debug full render cycles.
So I will try to attack this with one piece of this... my two select components...
Can someone see anything wrong with this handler ? I cant get the eclipse debugger to stop at this handler at all... 

Gallery.TML                    <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()"
                        />                    <t:Label for="tableColumnsSelect">Table Columns</t:Label>
                    <select t:type="Select" t:id="tableColumnsSelect" 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="this.form.submit()"
                        />
Gallery.JAVA
    @Component(id = "itemsPerPageSelect", parameters =
    { "value=itemsPerPage", "clientId=itemsPerPageSelect" })
    private Select itemsPerPageSelect;

    @OnEvent(value = EventConstants.VALUE_CHANGED, component = "itemsPerPageSelect")
    public void onActionFromItemsPerPageSelect(Integer value)
    {    }
    @Component
    private Select tableColumnsSelect;

    public Object onValueChangedTableColumnsSelect()
    {
        logger.info("In tableColumnsChangeListener : ");
        onActionFromItemsPerPageSelect(itemsPerPage);
        return homePage;
    }

I am guessing the trouble might have to do with these select components and their usage.

The thread where Howard gave me the advise that got these select components functional is here...
http://www.mail-archive.com/users@tapestry.apache.org/msg64452.html

And the gallery was working awesome... it quit on me yesterday while QA'ing it. I am wondering what happened between now and then that is currently taking the legs out from under this app. I didn't change much... except add a few comments in the TML... and light tweak code changes... nothing major.

I am sifting thru the output markup and what the code has...

But still wondering why my select handlers cannot even get a breakpoint.

And the null values I see within my eventlink auto-paging-button handlers are discouraging too because they are intermittent... but at least I get breakpoints in my eventlink auto-paging-button event handlers.

I am concerned because I am not sure if it is a tapestry but or a semantic coding bug or a page configuration bug... well it seems like a show stopper...

But I am hoping to make some ground on it to I can move on. I am happy to post code too.

Thanks for any insight or suggestions.

Ken

And here is a blip from Home.JAVA

    @Persist
    @Property
    private Integer itemsPerPage;

    @Persist
    @Property
    private Integer tableColumns;

    @Persist
    @Property
    private Integer cursor;

    @SetupRender
    public void setupRender()
    {
        //DevelopmentModeModule moduleDev;
        //ProductionModeModule moduleProd;
        
        if (itemsPerPage == null)
        {
            itemsPerPage = 25;
        }

        if (tableColumns == null)
        {
            tableColumns = 4;
        }        
        if (cursor == null)
        {
            cursor = new Integer ("0");
        }
    }

And the actual Gallery component usage

Home.TML
    <t:form t:id="galleryForm" id="galleryForm" clientValidation="true" >
        <t:errors/>
        
        <t:Gallery t:id="galleryWidget" id="galleryWidget"
            collectionType="coachClass"
            itemsPerPage="itemsPerPage"
            tableColumns="tableColumns"
            cursor="cursor"
            />

    </t:form>
 		 	   		  

Re: select event handler wont hit breakpoint - quarky runtime came back

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 09 Nov 2012 13:55:48 -0200, nhhockeyplayer nashua  
<nh...@hotmail.com> wrote:

>
> Ok so I set my flag in the eclipse preferences VM section
>
> -Dtapestry.production-mode=false
>
> and I get dev mode as expected
>
>  ______                  __             ____
> /_  __/__ ____  ___ ___ / /_______ __  / __/
>  / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \
> /_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
>         /_/                   /___/  5.3.1 (development mode)
>
> 2012-11-09 10:42:56.540:INFO::Started SelectChannelConnector@0.0.0.0:8080
>
>
>
> And when I breakpoint on one of my eventlink handlers... my homePage  
> variable is actually allocated properly... it is no longer null.
>
> I am still trying to conceptually bang what you said into my head... and  
> still trying to understasnd what tapestry is doing or trying to do at  
> this level during the debugger... or how it is making my life easier.

Easy: page, component and mixin classes are transformed by Tapestry. Reads  
and writes to fields of these classes are replaced by method calls. When  
in development mode, the field remains and is updated by Tapestry. When in  
production mode, which isn't supposed to be used when debugging, these  
fields are not updated by Tapestry, as this would be completely useless.

> I understand in PROD mode it is trying to streamline things ?... an  
> doesn't expect you to be in the debugger?

Absolutely no. That's why it's called 'production'. ;) Debugging is  
supposed to be done in the 'development' mode.

> And there is some kind of threadlocal storage being exercised? And a  
> swapping in of state ?

Yes for threadlocal, I don't know what do you mean by swapping of state.  
Since Tapestry 5.2, which doesn't have a page pool anymore, the access to  
fields are replaced by a Map in a ThreadLocal, as just one instance is  
created for each page. In development mode, the fields themselves are  
written, in production no, as concurrent request to the same page would  
interfere with each other).

-- 
Thiago H. de Paula Figueiredo

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


RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by Lance Java <la...@googlemail.com>.
I've been working on a demo gallery component. The gallery uses a table to
display a grid of items with links for next and prev. The GalleryDataSource
ensures that only a page of data is loaded into memory at a time. The
gallery accepts a block parameter to display each item. I've included a demo 
page which displays a grid of images. 

I've not had time to get the whole project onto github yet but here's a gist
with the important files https://gist.github.com/4046654

I'm sure it can point you in the right direction.




--
View this message in context: http://tapestry.1045711.n5.nabble.com/select-event-handler-wont-hit-breakpoint-quarky-runtime-came-back-tp5717846p5717883.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: select event handler wont hit breakpoint - quarky runtime came back

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 09 Nov 2012 14:29:15 -0200, nhhockeyplayer nashua  
<nh...@hotmail.com> wrote:

> Are you suggesting that Integer is not a good type to use for parameters  
> too ?

No. In this case, as null doesn't seem to be valid value for your  
parameters, you can use int without any problems. You can even enforce  
that by adding allowNull=false in the @Parameter annotation.

-- 
Thiago H. de Paula Figueiredo

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


RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by Lance Java <la...@googlemail.com>.
I'm not trying to steal your thunder. My design/CSS skills are pretty rubbish
so chances are it won't look pretty. There have been a few questions on this
list lately regarding a gallery component and I wanted to provide a sample
showing that it was possible to do it without the need for @Persist.

Cheers,
Lance



--
View this message in context: http://tapestry.1045711.n5.nabble.com/select-event-handler-wont-hit-breakpoint-quarky-runtime-came-back-tp5717846p5717908.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
kool... love to spark up some competition...

But my gallery is tynamo...
  |\___/|
 /       \
|    /\__/|
||\  <.><.>
| _     > )
 \   /----
  |   -\/
 /     \

Anything generic I will drop into my prototype package and refer to it.
I have grown fond of my gallery.
Thanks for the help


 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Lance,

Are you suggesting that Integer is not a good type to use for parameters too ? I figured is might be more coercable type to use. But if its thought to be tripping things up I could change it. At first chance I feel I dont want to... because I think it should work.

Thanks

Ken
 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Ok so I set my flag in the eclipse preferences VM section 

-Dtapestry.production-mode=false

and I get dev mode as expected

 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \ 
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3.1 (development mode)

2012-11-09 10:42:56.540:INFO::Started SelectChannelConnector@0.0.0.0:8080



And when I breakpoint on one of my eventlink handlers... my homePage variable is actually allocated properly... it is no longer null.

I am still trying to conceptually bang what you said into my head... and still trying to understasnd what tapestry is doing or trying to do at this level during the debugger... or how it is making my life easier. 

I understand in PROD mode it is trying to streamline things ?... an doesn't expect you to be in the debugger? And there is some kind of threadlocal storage being exercised? And a swapping in of state ?

Well I am still looking at these variables...

back to my suspected finding of a bug...
I dont understand why then if I took out the duplicate delegate block reference the corruption in the app stopped.
Could that be a bug ? delegating to an already delegated block?

thanks again
 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Thanks Lance...

I have been beebopping back and forth between development mode and production mode... trying to observe whats really happening.

For this thread though I been running in PROD mode

 ______                  __             ____
/_  __/__ ____  ___ ___ / /_______ __  / __/
 / / / _ `/ _ \/ -_|_-</ __/ __/ // / /__ \ 
/_/  \_,_/ .__/\__/___/\__/_/  \_, / /____/
        /_/                   /___/  5.3.1


2012-11-09 10:37:55.447:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server


still looking at this...

 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Nice observation Lance... and thats exactly how I modeled the component from the start in the actual component.

Gallery.JAVA
    @Parameter(required = true)
    private Class collectionType;

    @Property
    @Parameter(required = true, cache = true)
    private Integer itemsPerPage;

    @Property
    @Parameter(required = true, cache = true)
    private Integer tableColumns;

    @Property
    @Parameter(required = true, cache = true)
    private int cursor;

The parameters I think you saw are the properties in Home.JAVA

I will review them. But I believe they are modeled properly.

Pages have properties
Components have parameters
 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by Lance Java <la...@googlemail.com>.
As for your problem with debugging. Tapestry transforms your component
classes such that they no longer read/write to member variables in your
class. Instead, getters and setters are generated that are backed by a
thread local.

When running in development mode, tapestry helps out the developer by
mirroring the field values to the component fields to make life easier for
you when debugging. I'm guessing that you are running in production mode.

http://tapestry.apache.org/configuration.html#Configuration-tapestry.productionmode



--
View this message in context: http://tapestry.1045711.n5.nabble.com/select-event-handler-wont-hit-breakpoint-quarky-runtime-came-back-tp5717846p5717854.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by Lance Java <la...@googlemail.com>.
I notice that you are attempting to pass itemsPerPage, tableColumns and
cursor as component parameters but your are not marking them with the
@Parameter annotation.

I think you want to define them as:

    @Parameter("literal:25")
    private int itemsPerPage; 

    @Property("literal:4")
    private int tableColumns; 

    @Property("literal:0")
    private int cursor;

If you need to access these parameters in a template, you will also add a
@Property annotation to them. You will not need to @Persist these component
parameters as tapestry holds the component configuration in it's component
model.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/select-event-handler-wont-hit-breakpoint-quarky-runtime-came-back-tp5717846p5717853.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Well here is my gallery model again... delegates to the 3 blocks

    <table width="100%" border="3" align="center">
        <tr>
            <td>
                <t:Any id="headerSelect">
                    <t:delegate to="autoPagingContent"/>
                </t:Any>
                <t:Any id="galleryContent">
                    <t:delegate to="collectionContent"/>
                </t:Any>
                <t:Any id="footerSelect">
                    <t:delegate to="autoPagingContent"/>
                </t:Any>    
            </td>
        </tr>
    </table>

Notice... footerSelect is delegating to autoPagingContent block
Notice... headerSelect is delegating to autoPagingContent block

This could not be done in T4... and I know that statement is irrelevant and has no effect now.

Is this supported in T5 though ? It seems to run and render... but my webapp gets all whacked up... the selects bounce back to what their initialized values are and nothing sticks and runs as though I never used the @Persist for those select variables.

I am not sure if this is THE problem... I know I would like to see something reliable in the debugger... which I still cant'

Just trying to clean this up ... THANKS


 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
wow check this out...

Ok at the bottom of my Gallery.TML

I have the actual beginning definition of my gallery code...

    <!-- OK here is the definition. It is all referral declaration within <td> -->
    <table width="100%" border="3" align="center">
        <tr>
            <td>
                <t:Any id="headerSelect">
                    <t:delegate to="autoPagingContent"/>
                </t:Any>
                <t:Any id="galleryContent">
                    <t:delegate to="collectionContent"/>
                </t:Any>
                <t:Any id="footerSelect">
                    <t:delegate to="autoPagingContent"/>
                </t:Any>    
            </td>
        </tr>
    </table>

BTW: in T4... you cuold not exercise a duplicate reference to the same block... as I am here in T5 for my auto-paging select's and eventlinks.

So I change it to this...


    <!-- OK here is the definition. It is all referral declaration within <td> -->
    <table width="100%" border="3" align="center">
        <tr>
            <td>
                <t:Any id="footerSelect">
                    <t:delegate to="autoPagingContent"/>
                </t:Any>    
            </td>
        </tr>
    </table>

I removed headerSelect and pagingContent for shits and grins...

And it did impact the runtime... 
1. the select components are keeping their selected value on selection instead of snapping back to what they were initialized to.
2. the event links handlers are executing and modeling digitized event links in between the prev/next event links like it should.

I am not sure what to say about this behavior but I am continuing to try and shake this out.

I will admit... I did introduce a duplicate reference to a block... in order to have auto-paging select/links/buttons at the top of the gallery and at the foot of the gallery.

But I cannot explain all the memory issues.

I am still seeing nulls in the debugger though.



 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
Funny thing about this eventlink handler...

collection is null

but as I step over 

collection.size();

It executes it like its is ok.

But the debugger shows collection == null

???

Is tapestry really doing this behavior ? I would sure like to know a way out of it. I rely on the debugger for everything.

Just looking for something I can put my foot on.
 		 	   		  

RE: select event handler wont hit breakpoint - quarky runtime came back

Posted by nhhockeyplayer nashua <nh...@hotmail.com>.
This is my eventlink handler for firstpage in the gallery

    @InjectPage("Home")
    private Home homePage;

    @Component(parameters =
    { "event=firstPage" })
    private EventLink firstPage;

    public Object onFirstPage()
    {
        logger.info("In onFirstPage : ");

        collection.size();
        cursor = 0;
        return homePage;
    }

After the app runs and renders... the galleryshows objects...

In the eclipse debugger, I his the breakpoint into this handler... but homePage is NULL

?

One would think that all that would be taken care of and done at this point. Maybe ?

Feel free to slam me guys but I am just tryin to find my way this this bug.

It will be nice to find out what is really causing it.

Thanks
Ken