Re: Excluding properties if 0 or null
OK, how to do that? To make some function of type BeanModel with parameters of an Object, and inside it to write if function that if that object holds 0 or null value( by getField() function) to add to the bean model that field(property) and to return that bean model. Is that what you had on your mind? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-to-be-shown-in-tml-tp5717193p5717291.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: Excluding properties if 0 or null
OK, I have made following for my class public static boolean notNullNorZero(Number n){ return n == null || n.intValue() == 0; } and called it in my tml file t:if id=notNullNorZero(MyClass) /t:if and it displays me an error : Coercion from my that object to type java.lang.Number( via Object -- String, String --- Double) failed. How to fix it? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-to-be-shown-in-tml-tp5717193p5717255.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: Excluding properties if 0 or null
Yes, I understand that, but could I go through the class( all of it's properties ), not through one single property? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-to-be-shown-in-tml-tp5717193p5717258.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: Excluding properties if 0 or null
I could pass Number ... n but because I have so many vars, I am not sure if that's the best way of handling it. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-to-be-shown-in-tml-tp5717193p5717260.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: Excluding properties if 0 or null
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: Excluding properties if 0 or null
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
Excluding properties if 0 or null
Hi, Lets say I have one component and in it following // Numbers.java @Property @Parameter private double number1; @Property @Parameter private double number2; @Property @Parameter private double number3; //Number.tml t:label for=number1/ t:textfield t:id=number1 size=3/ t:label for=number2/ t:textfield t:id=number2 size=3/ t:label for=number3/ t:textfield t:id=number3 size=3/ Now what I want here is for my component to render only values that are not null or 0. I was thinking to implement some sort of if method in which I will call object Number( which will contain all three numbers, and going one by one by search and excluding if one is 0 or null. I would like your opinion about it, ie is there any more simply way to do that. Thanks in advance. t:label for=number1/ t:textfield t:id=number1 size=3/ -- View this message in context: http://tapestry.1045711.n5.nabble.com/Excluding-properties-if-0-or-null-tp5717193.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: Calling specific object
Thank you mr. Howard. :) It worked exactly how I wanted it to work. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Calling-specific-object-tp5717114p5717130.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
Calling specific object
Hi, I have two entities which extends entity called Article. Now I call article and I want based on what type of object is it to call properties for that specific object. How should I get this? Should I use some sort of t:if test=returnWhatTypeIsiT/t:if in tml and checking what type it is by public Object returnWhatTypeIsiT(Article article) { // fruit is declared as Fruit fruit; if(article.equals(fruit)){ return fruit; else if(article.equals(vegetable)){ return vegetable; } else { return null; } } I would like your opinion about this, or some guidance how is best way to solve this problem. Thanks in advance. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Calling-specific-object-tp5717114.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
Mixing parameters from component and page
I have one component named PartofAddition.java and in it I have the following public class PartOfAddition{ @Property private int number; @Property private int picture; public int getNumber() { return number; } public int getPicture() { return picture; } } //PartOfAddition.tml div class=section div class=post_numberlabel${message:number}: /labelinput t:type=int t:id=number t:validate=required size=4/input/div div class=post_numberlabel${message:picture}: /labelinput t:type=TextField t:id=picture t:validate=required size=4/input/div and page in which I try to call this component and along with some of the fields declared in it and in PartOfAddition file, to compute some method. public class ComputeAddition.java @InjectComponent private PartOfAddition partOfAddition; @Parameter private int number2; public int computeIt(){ *//return addition of the two numbers, one from this page, and another from the component PartOfAddition* } I have no idea how to implement this bolded. Any help is greatly appreciated. Thanks in advance. } -- View this message in context: http://tapestry.1045711.n5.nabble.com/Mixing-parameters-from-component-and-page-tp5717094.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: Gallery for each article using hibernate
Thanks for the answers. I have chosen to go for LanceJava's solution, but kcollasi code is very helpful and has contributed me greatly for better understanding how Tapestry works. :) -- View this message in context: http://tapestry.1045711.n5.nabble.com/Gallery-for-each-article-using-hibernate-tp5716817p5716993.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
Raty component
I want to implement raty component and bound it to the existing DB. I have seen raty component of the JQUERY project and seems to be OK, however no demo is presented anywhere, and I can't figure out how does it correctly work. http://tapestry5-jquery.com/mixins/docsraty http://tapestry5-jquery.com/mixins/docsraty Anyone has deal with this before? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Raty-component-tp5716994.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
Gallery for each article using hibernate
Hi! I want to implement gallery for each article using hibernate, and how many images per article should it have is not mandatory set by some value? I am here for your opinion what is the best way to implement it, so any help is greatly appreciated. Thanks in advance. :) -- View this message in context: http://tapestry.1045711.n5.nabble.com/Gallery-for-each-article-using-hibernate-tp5716817.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