|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Javadocs and other doubtsHi all,
I finally started to use Trails more seriously and have some small doubts about the documentation and how to do stuff. First of all, whenever I get to something that I think it should be somewhere in Trails, I look in the Javadocs but generally don't get a lot of information from them. Is there any reason why the Javadocs don't have more information on intended use? That is the first place people look for usage information.
I found in the "Trails gotchas" page an old link to the examples in the repository. It points to the 1.0 SNAPSHOT version in http://trails.inspiring.nl/svn/trunk/trails/examples/. It would be nice to update it to point to http://svn.codehaus.org/trails/tags/trails-1.2/examples.
About the "stuff", I'm working on a simple application that creates something similar to an invoice. I have three little problems: - I need to fill-in an incremental invoice number. It should be editable for flexibility, but when creating a new invoice it should be initialized to the current invoice number. How can I set the initial value for a new invoice?
- Each line of the invoice correspond to a product. I need that the unit price of the line be independent of the product, to avoid changing old invoices if a product price changes. Also, it should be editable, to reflect special prices (promotions, etc.). When editing a line, if I change the product, the unit price for the line should change to reflect the current price of the new product. It would be nice to make it work in the browser, using JavaScript. I need to create an edition page to do this, right? How can I get all available products and their prices to be usable with JS? I would add JSON containing the products to the page so I can access them, but I don't understand enough of the Trails "plumbing" to really know how to do it.
- For several object I need to be able to "freeze" some properties. For example, an invoice could have a "status" field. When the status changes to "approved" then no more edition is allowed. Is there a nice and simple way to do this?
Thanks, Hernán |
|
|
RE: Javadocs and other doubts
With regard to the javascript stuff and updates of state to dom elements... the tapestry script ( *.script files) api is an option. JSON I believe might be too steep.
Your components can pass in as parameters ognl state variables to the *.script file and operate on them as such, operate on components in your page based on conditions or states passed in as parameters or create new effects or dom elements... and also do what your asking... set the sensitivity of an element enabled/disabled like your asking. I checked in a Gallery component that uses tapestry script. It is in one of the JIRA's... I found it to be very useful but there remains glitch bugs on layout and geometry mgt when trying to layout new dom elements ontop of existing ones. The coordinates and rendering have yet to be resolved by T-4.1.6 folks. Best regards Ken in nashua Date: Sun, 21 Dec 2008 18:30:06 -0200 From: acuariano@... To: users@... Subject: [trails-users] Javadocs and other doubts Hi all, I finally started to use Trails more seriously and have some small doubts about the documentation and how to do stuff. First of all, whenever I get to something that I think it should be somewhere in Trails, I look in the Javadocs but generally don't get a lot of information from them. Is there any reason why the Javadocs don't have more information on intended use? That is the first place people look for usage information.
I found in the "Trails gotchas" page an old link to the examples in the repository. It points to the 1.0 SNAPSHOT version in http://trails.inspiring.nl/svn/trunk/trails/examples/. It would be nice to update it to point to http://svn.codehaus.org/trails/tags/trails-1.2/examples. About the "stuff", I'm working on a simple application that creates something similar to an invoice. I have three little problems: - I need to fill-in an incremental invoice number. It should be editable for flexibility, but when creating a new invoice it should be initialized to the current invoice number. How can I set the initial value for a new invoice?
- Each line of the invoice correspond to a product. I need that the unit price of the line be independent of the product, to avoid changing old invoices if a product price changes. Also, it should be editable, to reflect special prices (promotions, etc.). When editing a line, if I change the product, the unit price for the line should change to reflect the current price of the new product. It would be nice to make it work in the browser, using JavaScript. I need to create an edition page to do this, right? How can I get all available products and their prices to be usable with JS? I would add JSON containing the products to the page so I can access them, but I don't understand enough of the Trails "plumbing" to really know how to do it.
- For several object I need to be able to "freeze" some properties. For example, an invoice could have a "status" field. When the status changes to "approved" then no more edition is allowed. Is there a nice and simple way to do this?
Thanks,
Hernán
Life on your PC is safer, easier, and more enjoyable with Windows Vista®. See how Best regards
Ken in nashua |
|
|
Re: Javadocs and other doubtsThanks Ken, will look into it.
On Mon, Dec 22, 2008 at 2:10 PM, Ken in nashua <nhhockeyplayer@...> wrote:
|
|
|
Re: Javadocs and other doubtsHola Hernán
responses inline On Sun, Dec 21, 2008 at 9:30 PM, El Acuariano <acuariano@...> wrote: > Hi all, > (...) > Is there any reason why the Javadocs don't have more > information on intended use? Mostly my laziness :( and also writter's block. I'm sorry, I know I should write more and better documentation but I always end up postponing it so I can code some more (and I know is wrong). > I found in the "Trails gotchas" page an old link to the examples in the > repository. It points to the 1.0 SNAPSHOT version > in http://trails.inspiring.nl/svn/trunk/trails/examples/. It would be nice > to update it to point > to http://svn.codehaus.org/trails/tags/trails-1.2/examples. > fixed. Remember it's a wiki, if you found something like this you help us editing it your self. > - I need to fill-in an incremental invoice number. It should be editable for > flexibility, but when creating a new invoice it should be initialized to the > current invoice number. How can I set the initial value for a new invoice? There is a builder pattern implementation. But I just realize that in Trails 1.2.x there is no way to contribute your builder (org.trails.builder.Builder) to the builder director. Take a look at it (org.trails.builder.BuilderDirector), if that is what you need I can quickly fix it to allow contributions to the map. > - Each line of the invoice correspond to a product. I need that the unit > price of the line be independent of the product, to avoid changing old > invoices if a product price changes. Also, it should be editable, to reflect > special prices (promotions, etc.). When editing a line, if I change the > product, the unit price for the line should change to reflect the current > price of the new product. It would be nice to make it work in the browser, > using JavaScript. I need to create an edition page to do this, right? How > can I get all available products and their prices to be usable with JS? I > would add JSON containing the products to the page so I can access them, but > I don't understand enough of the Trails "plumbing" to really know how to do > it. You don't need to use custom javascript to do this. Tapestry (and Trails) can take of this for you. You need a custom edit page with both template & java code and then some Tapestry love :) Add this blocks in your invoice line edit page template (I've used category instead of product): <div jwcid="category@Block"> <li> <label><span jwcid="@Insert" value="ognl:classDescriptor.getPropertyDescriptor('category').displayName"/></label> <select jwcid="categoryField@trails:AssociationSelect" value="ognl:model.category" class="field select medium" propertyDescriptor="ognl:classDescriptor.getPropertyDescriptor('category')"/> </li> </div> <div jwcid="price@Block"> <li> <label><span jwcid="@Insert" value="ognl:priceDescritor.displayName"/></label> <input jwcid="priceField@TextField" value="ognl:model.price" class="field text medium" translator="ognl:validatorTranslatorService.getTranslator(priceDescritor)" validator="ognl:validatorTranslatorService.getValidator(priceDescritor)" /> </li> </div> Then add this code to you invoice line edit page java code (remember to extend from HibernateEditPage). @InjectObject("service:trails.core.ValidatorTranslatorService") public abstract ValidatorTranslatorService getValidatorTranslatorService(); public IPropertyDescriptor getPriceDescritor() { return getClassDescriptor().getPropertyDescriptor("price"); } @EventListener(targets = "categoryField", events = "onchange") public void onCategoryFieldSelectOption(IRequestCycle cycle) { InvoiceLine model = (InvoiceLine) getModel(); if (model.getCategory() != null) { model.setPrice(model.getCategory().getPrice()); cycle.getResponseBuilder().updateComponent("priceField"); } } That's it. That's all you need. More docs: http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html > - For several object I need to be able to "freeze" some properties. For > example, an invoice could have a "status" field. When the status changes to > "approved" then no more edition is allowed. Is there a nice and simple way > to do this? The first thing I can think of is to have a block for that property and then check for the "approved" status in an @If component. <div jwcid="status@Block"> <span jwcid="@If" condition="CHECK FOR STATUS HERE"> <span jwcid="@trails:SimplePropertyEditor" property="status"/> </span><span jwcid="@Else"> SOMETHING ELSE </span> </div> > Thanks, > Hernán > Felices fiestas! Saludos! Alejandro. -- Alejandro Scandroli - http://weblog.amneris.es/ Amneris: We build process-driven web applications. http://www.amneris.es --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Javadocs and other doubtsFeliz navidad, Alejandro!
Answers below
On Thu, Dec 25, 2008 at 7:41 PM, Alejandro Scandroli <ascandroli@...> wrote: Merry xmas!!Hola Hernán Yeah, I know documentation is hard. I just can't see Trails getting good momentum if there are no good Javadocs. Maybe we users can help by submitting documentation proposals when we understand some functionality.
I tried, but got a privilege error ("You cannot view this page due to inherited restrictions").
Will look into it.
OK. Will try tomorrow.
Felices fiestas! Hernán |
| Free embeddable forum powered by Nabble | Forum Help |