Re: markup question...

2012-10-24 Thread Peter Wendorff

Am 25.10.2012 05:13, schrieb Ken in Nashua:

Folks,

Ok I implement an if component. And upon condition I render some markup...

ESCAPE IT...?
CALL JAVA METHOD...?
SPECIFY DIRECT MARKUP ?

i tried each...

 

 

This would be correct, if...
Well...
Tapestry is not PHP. It is not assembling text together, but forces to 
maintain correct XML syntax (producing HTML in XML flavor, which is 
correct).

Even Tapestry templates (.tml) are and have to be valid XML.

Your code above is not, and that's why you get, while it's correct not 
to escape markup here, you get the exception.


I'm not sure why you need this "atNewRow" test; you didn't explain what 
you want to do; but to create a table, do it in a corresponding loop and 
keep XML syntax intact.


regards
Peter

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



Why variable do not update in a text field

2012-10-24 Thread dinesh707
following are my code parts. So when some one and a mp3URL to some text area,
system will send a ajax request to " onMp3UrlChanged()". Then it will get
the title and set that value into "songName" and refresh the zone. IT
WORKS!. But my problem is later when i change the text in the TextField and
call "uploadToDB()" inside "onSuccess()", then still the output will be last
set value to the "songName". It is not taking the new update from the form. 

WHY? and how to fix it ? 

--- java class ---
@Persist 
@Property
private String songName;

@InjectComponent(value="songName")
private TextField songNameField;

//this is an ajax call
void onMp3UrlChanged() {
mp3Url = request.getParameter("param");
sip = new SongInformationParser(mp3Url);
songName = sip.getTitle();
disabled = false;
ajaxResponseRenderer.addRender("songInfoZone1", songInfoZone1)
}

void uploadToDB(){
System.out.println(songName);
}

--- TML ---










--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Why-variable-do-not-update-in-a-text-field-tp5717217.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



RE: markup question...

2012-10-24 Thread Ken in Nashua

This is producing better results...




 
 


 


 

























but the last  is unwanted and invalid... it dont belong and produces an 
exception unless I put it there

1 element for first row
3 elements for second row
1 element for second row

so the count is being tripped up

Ok will keep slugging it out
  

RE: markup question...

2012-10-24 Thread Ken in Nashua

My table structure should be able to be modeled as such without having to be 
chased by exceptions that tell me I am failing to terminate.




 

 
















  

RE: markup question...

2012-10-24 Thread Ken in Nashua

If I try to instrument my own markup I get chased down by exceptions stating 
that I have failed to terminate my tags... and I end up specifying place holder 
terminator tags to keep the exceptions quiet... while trying to render my own 
true instrumented tags for the functionality I want to achieve

Does this not defeat the ability to instrument our own markup tags ?
  

RE: markup question...

2012-10-24 Thread Ken in Nashua

I know folks suggested a format

SUGGESTED INSPIRE FORMAT (but its hardwired to a single column for the whole 
collection)

looping collection

looping object properties



and that works fine to render the collection and its objects and properties... 
for a single column

but I am trying to implement auto-paging... 

a nearby configurable  component that specifies number of objects per 
row... default=3

so I want to iterate 3 objects and 3 

then specify   a new row

but how can I do this if the markup is hardwired in the above 
SUGGESTED INSPIRE FORMAT format?

so I am left instrumenting the format and counting and outputting the new row 
at a specific condition and time of the rendering.

and thus far its not apparent how due to the limitations and restrictions...

if I violate the 
SUGGESTED INSPIRE FORMAT the framework is forcing me to keep the tags with 
exceptions.
if I try to render from the java... well I havent got what I am looking for yet.

I know what I want.

?
  

RE: markup question...

2012-10-24 Thread Ken in Nashua

Here is whats being rendered in the page source... to give a clue as to the 
inoperable markup

 


 












</tr><tr>


  

markup question...

2012-10-24 Thread Ken in Nashua

Folks,

Ok I implement an if component. And upon condition I render some markup... 

ESCAPE IT...?
CALL JAVA METHOD...?
SPECIFY DIRECT MARKUP ?

i tried each...


   


or


<\\/tr>   




${newTableRow}   


If I could have performed this already I would have.

Are there limitations in the framework that are preventing this simple 
fundamental operation ?

If anyone has a snap dab code snippet solution to this I would love to see it.

Thanks in advance

Ken

 cut here   
org.apache.tapestry5.ioc.internal.OperationExceptionFailure
 parsing template 
classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml: 
The element type "t:If" must be terminated by the matching end-tag 
"".locationclasspath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml,
 line 105100-->101 
102103  
104   
105 106
   

Re: Excluding properties if 0 or null

2012-10-24 Thread o1550762
Thank you mr. Thiago on your reply. How could I do this with objects? For
example if I have object and 4 parameters in it, I want to show only
parameters that are not set to 0, but if are set other than that to show
them? Is it possible?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-to-be-shown-in-tml-tp5717193p5717210.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: Hibernate & springframework.security question

2012-10-24 Thread Thiago H de Paula Figueiredo
On Wed, 24 Oct 2012 22:41:01 -0200, sommeralex  
 wrote:



Hi!


Hi!

I know that this is more a hibernate than a tapestry question, but i am  
not sure if my question is really more hibernate specific, or a standard

problem.


This is a pure Hibernate question as far as I can see.


If i am logged in as User user with session x, but some values of my user
get changed from the outside of a session y my User user in my session x  
has still the "old" values. If i am now persisting my User user from  
session x, the new values from session y are overwritten and are  
therefore lost. I am merging the object via DAO.merge - but it seems  
that hibernate does not know which values are old, and new.


Check the Hibernate documentation about optimistic locking:  
http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/transactions.html.


--
Thiago H. de Paula Figueiredo

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



Re: easiest way to update a value on a DB change?

2012-10-24 Thread Thiago H de Paula Figueiredo
On Wed, 24 Oct 2012 22:14:56 -0200, sommeralex  
 wrote:



thx - sure. forget about this ;-)


:)

I think there are two different issues in your scenario, none related to  
Tapestry:


1) Databases usually don't have any way of notifying changes to anything  
outside them.
2) In web development, at least using HTTP, we don't have any way of  
having a server trading information with clients (server-side push)*  
except during a client doing a request to the server.


* There may be some specification or proposal about this right now, but I  
can't recall any that can be used across different browsers right now, and  
that's why we have Cometd and other packages that use polling (periodical  
requests or keeping a connection open and making many requests before  
closing the connection) to simulate server-side push.


--
Thiago H. de Paula Figueiredo

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



Hibernate & springframework.security question

2012-10-24 Thread sommeralex
Hi!

I know that this is more a hibernate than a tapestry question, but i am not
sure if my question is really more hibernate specific, or a standard
problem. 

If i am logged in as User user with session x, but some values of my user
get changed from the outside of a session y my User user in my session x has
still the "old" values. If i am now persisting my User user from session x,
the new values from session y are overwritten and are therefore lost. I am
merging the object via DAO.merge - but it seems that hibernate does not know
which values are old, and new. 

So the question is, what do i have to do, to ensure that my user object
retrieved from my DB is always uptodate?

merge function:

public T merge(T detachedInstance) {
logger.debug("Merging " + detachedInstance + ".");
try {
Date now = new Date();
detachedInstance.setUpdatedAt(now);
T result = 
getHibernateTemplate().merge(detachedInstance);
return result;
} catch (RuntimeException re) {
logger.error("Merging " + detachedInstance + " 
failed.", re);
throw re;
}
}

This is the way i am getting my user object (but this object is never
updated if i am changing some values of the user directly in the DB - only
if i am login out and in again:

UserService.java

public User getCurrentUser() {
return authenticationHelper.getPrincipal();
}

AuthenticationHelper.java

public User getPrincipal() {
Authentication authentication =
SecurityContextHolder.getContext().getAuthentication();
User user = null;
if (authentication != null) { // is user logged in?
AirwritingUserDetails userDetail = (AirwritingUserDetails)
authentication.getPrincipal();
  user = userDetail.getUser();
}
return user;
}

AirwritingUserDetails.java

public abstract class AirwritingUserDetails extends
org.springframework.security.core.userdetails.User {

private User user;

public AirwritingUserDetails(User user, Collection authorities) {
super(user.getUsername(), user.getPassword(), user.getStatus() 
==
Status.ACTIVE, true, true, true,
authorities);
this.user = user;
}

public User getUser() {
return user;
}

}



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Hibernate-springframework-security-question-tp5717207.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: easiest way to update a value on a DB change?

2012-10-24 Thread Thiago H de Paula Figueiredo
On Wed, 24 Oct 2012 20:09:50 -0200, sommeralex  
 wrote:



Hello!


Hi!


I have a user class with a specific value, in my case a cash value. I am
showing this cash value in a widget via  ${user.cash}. If the user is  
logged in on the server, and the cash is changed for whatever reason, i  
would like to auto update this value. Currently, the user has to  
re-login to get an

updated cash value - sure, this is not what I want.
Is the only possible solution making a periodic zone updater, or is there
something else i could use?


I think you can either use a periodic zone updater (examples from  
JumpStart:  
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/periodicupdatemixin,  
http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/periodicupdate)  
or use something like tapestry-cometd  
(https://github.com/uklance/tapestry-cometd).


--
Thiago H. de Paula Figueiredo

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



Re: [T5.3]Zone parameter of a form null after ajax rendering?

2012-10-24 Thread Alex Kotchnev
Thomas - indeed, the issue w/ tap5-jquery not evaluating the init was a
pretty gnarly one. I ran into it myself, albeit in a somewhat different
context (and unfortunately it didn't ring a bell when I looked at your
questions).

Just as a side note, seeing the flurry of your own responses, sometimes it
take a little bit of time for the mailing list to respond to your concerns,
especially if the issue is not trivial. Thus, it helps to not give up too
quickly and be patient w/ the list.

Cheers,

Alex K

On Wed, Oct 24, 2012 at 3:31 AM, Thomas Cucchietti <
thomas.cucchie...@gmail.com> wrote:

> For information, with the help of people from the tapestry-jquery module,
> the bug has been found.
>
> It was located in the addScripts method of tapestry-jquery.js (v3.3.0) :
> the server reply "inits" wasn't executed.
>
> To resolve it, you can use tapestry-jquery v3.3.3.
>
> 2012/10/23 Thomas Cucchietti 
>
> > I'm really disappointed, but i going to give up as it seems impossible to
> > make it work using Tapestry "mechanics".
> >
> > I think that we have to manage everything using js : input validation /
> > ajax form submission / zone update.
> >
> > For information, my goal was to "simulate" a navigation using a zone
> > wrapped in a dialog component.
> >
> >
> > 2012/10/22 Thomas Cucchietti 
> >
> >> Still impossible to manage to have this zone update using the form
> inside
> >> the zone.
> >>
> >> From the browser console, I can see that the content of the partial
> >> render response contains what is needed for the zone to be updated :
> >>
> >> (...)
> >>  "inits" : [{  "formEventManager" : [{
>  "formId" : "manageForm_13a8936acde",  "validate" : {
>  "submit" : true,"blur" : true  }}  ]},
>{  "linkZone" : [{  "linkId" :
> "manageForm_13a8936acde",  "url" : "/my/page/url.manageform",
>"zoneId" : "zoneToRefresh"}  ],
> >> (...)
> >>
> >> But this doesn't seem to be used.
> >>
> >>
> >> 2012/10/22 Thomas Cucchietti 
> >>
> >>> Hello Thiago,
> >>>
> >>> I did it by setting explicitely the "id" (on top of the "t:id")
> >>> parameter of the form to "manageForm", but it keeps adding some random
> >>> value at the end of this (for example "manageForm_13a88baf8ea").
> >>>
> >>> Something is missing for the clientid to be static?
> >>>
> >>>
> >>> 2012/10/22 Thiago H de Paula Figueiredo 
> >>>
>  Or provide explicit static ids instead of letting them be
> autogenerated
>  by Tapestry.
> 
> 
>  On Mon, 22 Oct 2012 11:45:18 -0200, Thomas Cucchietti <
>  thomas.cucchie...@gmail.com> wrote:
> 
>   I keep on trying a way to get this working.
> >
> > In a previous discussion (see the end of Christian's answer
> > here > +page:1+mid:jbwboaocfw4lkjqj+**state:results<
> http://markmail.org/thread/w6s3jtmwwfw6vfnx#query:+page:1+mid:jbwboaocfw4lkjqj+state:results
> >
> > >),
> >
> > a workaround for the null id could be the use of a HeartBeat to defer
> > the
> > evaluation of the client id value.
> >
> > had someone already given it a go?
> >
> > 2012/10/22 Thomas Cucchietti 
> >
> >  I tried to manually link the zone to the form, but with no success.
> >>
> >> @BeginRender
> >> void fixZoneAjaxSupport() {
> >> Link link = resources.createEventLink("**manualLinkToZone",
> >> null);
> >> clientBehaviorSupport.**linkZone("manageForm",
> >> "zoneToRefresh",
> >> link);
> >> }
> >>
> >>
> >> The "linkzone" in Tapestry.init() is updated and contains :
> >>
> >> {
> >> "linkId" : "manageForm",
> >> "url" : "/my/url/to/page:**manualLinkToZone",
> >> "zoneId" : "zoneToRefresh"
> >> }
> >>
> >> However, as the manageForm has random generated number added to its
> >> client
> >> id, it won't be taken into account...
> >>
> >> Even if I inject the manageForm into my page, as it isn't initially
> >> present in the page but only after a first zone update, it's null
> and
> >> I
> >> have no way to know the exact client id of my form.
> >>
> >> After some additional search (thanks markmail!), it seems that this
> >> clientId will always be uniquefied as the form is contained in the
> >> zone.
> >>
> >> Anybody has a clue on my first mail? or at least on the workaround
> I'm
> >> trying to find?
> >>
> >> Thomas
> >>
> >>
> >> 2012/10/22 Thomas Cucchietti 
> >>
> >>  Hello,
> >>>
> >>> Is the following behavior intended, as it may be a bug ?
> >>>
> >>> With this structure :
> >>>
> >>> 
> >>>
> >>> 
> >>>
> >>> 
> >>>
> >>> 
> >>>
> >>> 
> >>>
> >>> 
> >>> 
> >>>   

Re: Excluding properties if 0 or null

2012-10-24 Thread Thiago H de Paula Figueiredo

On Wed, 24 Oct 2012 10:23:54 -0200, o1550762  wrote:

Hi Thiago! Could you please give me some directions or part of the code  
so that I can start it. I was thinking to implement javascript code  
something like if (element.find("div" === null)) return; but then I am  
not sure if it will render only non null values. So, if I choose to omit  
some field on
purpose in creating an object Number, it should not be render when  
showing that object to the client.


After answering you, I noticed that one want to not render the  
corresponding , right? If yes, just surround your  and  
 with a 


public boolean notNullNorZero(Number value) {
return value == null || value.intValue() == 0;
}

--
Thiago H. de Paula Figueiredo

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



Re: Excluding properties if 0 or null

2012-10-24 Thread o1550762
Hi Thiago! Could you please give me some directions or part of the code so
that I can start it. I was thinking to implement javascript code something
like if (element.find("div" === null)) return; but then I am not sure if it
will render only non null values. So, if I choose to omit some field on
purpose in creating an object Number, it should not be render when showing
that object to the client.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-to-be-shown-in-tml-tp5717193p5717201.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: Problem in Validation using regexp

2012-10-24 Thread dinesh707
index.properties --> Index.properties

This fixed the problem. 






--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Problem-in-Validation-using-regexp-tp5717198p5717199.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Problem in Validation using regexp

2012-10-24 Thread dinesh707
following are my code pars. What am i doing wrong
??---index.tml--index.java---@Persist @Propertyprivate String
lyricsUrl;@InjectComponent(value="lyricsUrl")private TextField
lyricsUrlField;---index.properties---lyricsurl-regexp=\\d{4}(\\-?\\d{4}){3}---Error---ender
queue error in BeginRender[Index:lyricsurl]: Failure reading parameter
'validate' of component Index:lyricsurl: Validator 'regexp' requires a
validation constraint (of type java.util.regex.Pattern) but none was
provided. The constraint may be provided inside the @Validator annotaton on
the property, or in the associated component message catalog as key
'contentForm-lyricsUrl-regexp' or key 'lyricsUrl-regexp'. 



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Problem-in-Validation-using-regexp-tp5717198.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: [T5.3]Zone parameter of a form null after ajax rendering?

2012-10-24 Thread Thomas Cucchietti
For information, with the help of people from the tapestry-jquery module,
the bug has been found.

It was located in the addScripts method of tapestry-jquery.js (v3.3.0) :
the server reply "inits" wasn't executed.

To resolve it, you can use tapestry-jquery v3.3.3.

2012/10/23 Thomas Cucchietti 

> I'm really disappointed, but i going to give up as it seems impossible to
> make it work using Tapestry "mechanics".
>
> I think that we have to manage everything using js : input validation /
> ajax form submission / zone update.
>
> For information, my goal was to "simulate" a navigation using a zone
> wrapped in a dialog component.
>
>
> 2012/10/22 Thomas Cucchietti 
>
>> Still impossible to manage to have this zone update using the form inside
>> the zone.
>>
>> From the browser console, I can see that the content of the partial
>> render response contains what is needed for the zone to be updated :
>>
>> (...)
>>  "inits" : [{  "formEventManager" : [{  "formId" : 
>> "manageForm_13a8936acde",  "validate" : {"submit" : 
>> true,"blur" : true  }}  ]},{  
>> "linkZone" : [{  "linkId" : "manageForm_13a8936acde",
>>   "url" : "/my/page/url.manageform",  "zoneId" : "zoneToRefresh" 
>>}  ],
>> (...)
>>
>> But this doesn't seem to be used.
>>
>>
>> 2012/10/22 Thomas Cucchietti 
>>
>>> Hello Thiago,
>>>
>>> I did it by setting explicitely the "id" (on top of the "t:id")
>>> parameter of the form to "manageForm", but it keeps adding some random
>>> value at the end of this (for example "manageForm_13a88baf8ea").
>>>
>>> Something is missing for the clientid to be static?
>>>
>>>
>>> 2012/10/22 Thiago H de Paula Figueiredo 
>>>
 Or provide explicit static ids instead of letting them be autogenerated
 by Tapestry.


 On Mon, 22 Oct 2012 11:45:18 -0200, Thomas Cucchietti <
 thomas.cucchie...@gmail.com> wrote:

  I keep on trying a way to get this working.
>
> In a previous discussion (see the end of Christian's answer
> here +page:1+mid:jbwboaocfw4lkjqj+**state:results
> >),
>
> a workaround for the null id could be the use of a HeartBeat to defer
> the
> evaluation of the client id value.
>
> had someone already given it a go?
>
> 2012/10/22 Thomas Cucchietti 
>
>  I tried to manually link the zone to the form, but with no success.
>>
>> @BeginRender
>> void fixZoneAjaxSupport() {
>> Link link = resources.createEventLink("**manualLinkToZone",
>> null);
>> clientBehaviorSupport.**linkZone("manageForm",
>> "zoneToRefresh",
>> link);
>> }
>>
>>
>> The "linkzone" in Tapestry.init() is updated and contains :
>>
>> {
>> "linkId" : "manageForm",
>> "url" : "/my/url/to/page:**manualLinkToZone",
>> "zoneId" : "zoneToRefresh"
>> }
>>
>> However, as the manageForm has random generated number added to its
>> client
>> id, it won't be taken into account...
>>
>> Even if I inject the manageForm into my page, as it isn't initially
>> present in the page but only after a first zone update, it's null and
>> I
>> have no way to know the exact client id of my form.
>>
>> After some additional search (thanks markmail!), it seems that this
>> clientId will always be uniquefied as the form is contained in the
>> zone.
>>
>> Anybody has a clue on my first mail? or at least on the workaround I'm
>> trying to find?
>>
>> Thomas
>>
>>
>> 2012/10/22 Thomas Cucchietti 
>>
>>  Hello,
>>>
>>> Is the following behavior intended, as it may be a bug ?
>>>
>>> With this structure :
>>>
>>> 
>>>
>>> 
>>>
>>> 
>>>
>>> 
>>>
>>> 
>>>
>>> 
>>> 
>>> Yes
>>> 
>>> No
>>> 
>>>
>>> 
>>>
>>> 
>>>
>>> (I don't have included the button that refresh the zone the first
>>> time)
>>>
>>> The method getActiveBlock() return the emptyBlock when the page
>>> initially
>>> loads, then it returns the manageBlock once the refresh button is
>>> hit.
>>>
>>> The problem is that the form contained in the manageBlock doesn't
>>> refresh
>>> the zone in Ajax, and reload the whole page instead.
>>>
>>> From what I've searched, it seems that, when the manage block is
>>> rendered, the "zone" parameter of the manageForm is null (see line
>>> 356 of
>>> Form.class, in beginRender method) whereas it should be valued with
>>> t