Re: [T5.4] helper components and mixins module: tapestry5-xtensions
Very nice. Geoff On 11 Jul 2014, at 4:08 am, Ilya Obshadko wrote: > While I was working on my project (https://danceconvention.net), I had to > create a lot of helper components and mixins to solve routine tasks, > including better UX, better Bootstrap integration etc. > > I've finally managed to put all the independent stuff into a separate > module, so I'm pleased to provide it as an Open Source > > https://github.com/xfyre/tapestry5-xtensions > > Hopefully it could be useful to someone else. Note that currently it has > very little to no documentation; it's to be completed yet. > > -- > Ilya Obshadko - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[T5.4] helper components and mixins module: tapestry5-xtensions
While I was working on my project (https://danceconvention.net), I had to create a lot of helper components and mixins to solve routine tasks, including better UX, better Bootstrap integration etc. I've finally managed to put all the independent stuff into a separate module, so I'm pleased to provide it as an Open Source https://github.com/xfyre/tapestry5-xtensions Hopefully it could be useful to someone else. Note that currently it has very little to no documentation; it's to be completed yet. -- Ilya Obshadko
Re: FW: Customizing the grid to alter its own content
On Thu, 10 Jul 2014 11:55:57 -0300, Davide Vecchi wrote: As usual, thanks a lot for the great assistance, and in particular for pointing me to DOM rewriting. List nodes = elementToModify.getChildren(); if (nodes.size() == 1) { if (nodes.get(0) instanceof Text) { Text currentNode = (Text) nodes.get(0); Text newNode = elementToModify.text("pippo " + currentNode.toString()); newNode.moveToTop(elementToModify); nodes = elementToModify.getChildren(); nodes.get(1).remove(); } } I think the code is ok, even if it could have some improvements. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.4] split Tapestry application into separate modules
On Thu, 10 Jul 2014 11:56:07 -0300, Ilya Obshadko wrote: Thanks Thiago, I'll give it a try (currently I'm using jetty:run and until this moment I had no problems with it). jetty:run is slower to start, doesn't find the sources of most external code even when available and doesn't handle live changes to assets very well. RunJettyRun is faster, finds all available sources when debugging and it's way easier to configure. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: select problem render queue
On Thu, 10 Jul 2014 09:51:08 -0300, squallmat . wrote: Caused by: java.lang.NullPointerException at org.apache.tapestry5.internal.util.SelectModelRenderer.option(SelectModelRenderer.java:51) Check whether you passed a null OptionModel to the SelectionModel. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.4] split Tapestry application into separate modules
Thanks Thiago, I'll give it a try (currently I'm using jetty:run and until this moment I had no problems with it). On Thu, Jul 10, 2014 at 4:43 PM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > What are you using to launch the webapp? I recommend the RunJettyRun > plugin. Way better than jetty:run, if you ask me. > > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Ilya Obshadko
RE: FW: Customizing the grid to alter its own content
Right, in my case that Node is a Text. The following is what I'm doing in afterRender method; it seems to work just fine although I don't know if that's the recommended approach in DOM rewriting. As usual, thanks a lot for the great assistance, and in particular for pointing me to DOM rewriting. List nodes = elementToModify.getChildren(); if (nodes.size() == 1) { if (nodes.get(0) instanceof Text) { Text currentNode = (Text) nodes.get(0); Text newNode = elementToModify.text("pippo " + currentNode.toString()); newNode.moveToTop(elementToModify); nodes = elementToModify.getChildren(); nodes.get(1).remove(); } }
Re: FW: Customizing the grid to alter its own content
On Thu, 10 Jul 2014 11:09:05 -0300, Davide Vecchi wrote: If I do Node node = element.getChildren().get(0); I do get a org.apache.tapestry5.dom.Node representing the element's content (its toString() just returns "Hello"), but even this Node object doesn't seem to me to have methods to change its content. Node is the abstract superclass of Element and Text, so you'll need to cast them before doing more useful stuff. Or maybe I should create a new Node instance containing the text I want and then use this instance to replace the existing Node instance in the children list, like element.getChildren().set(0, newNode); That's an option too. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.4] split Tapestry application into separate modules
Yes, it could be an issue using an external maven. I let Eclipse handle the build while I'm developing, and I don't do a full external maven rebuild unless I need to deploy war files. Sometimes it helps to know the art of the possible, and myself and my team have it working this way. :-) Hopefully you find a development procedure that is right for you. On Thu, Jul 10, 2014 at 6:04 AM, Ilya Obshadko wrote: > > For your last question, if you are using Eclipse Kepler or better, the > > maven integration should be good enough to allow workspace resolution of > > the other modules, as long as they are open. > > i.e. you can change something in one module and have the dependent > modules > > pick up the changes, without needing to do a separate maven build or > > install. This even works between overlays and the main web app project. > > > > I've been expecting it should work that way, but it doesn't. > > Unless I perform "mvn clean install" inside the module project, I receive > build error > > "[WARNING] The POM for my.package:module-name:jar:0.0.1-SNAPSHOT is > missing, no dependency information available" > > I suppose it has something to do with external Maven installation that I'm > using instead of embedded one, but I'm not sure. > > > > > On Wed, Jul 9, 2014 at 4:38 PM, Ilya Obshadko > > wrote: > > > > > I would like to modularize my application into several modules, so that > > > each one of them would be a separate Maven artifact. I'm trying to > > > reproduce what I can borrow from tapestry-upload module source, but > still > > > have questions: > > > > > > - component that was moved into separate module can't be loaded by main > > > application using standard namespace; is there any way to fix that? > (that > > > is, results in UknownValueException); > > > contributeComponentClassResolver() (like in tapestry-upload) doesn't > help > > > (or I just use it incorrectly) > > > > > > - is that possible to run the whole thing within Eclipse without having > > to > > > install 'module' project into local repository? > > > > > > Thanks in advance. > > > > > > -- > > > Ilya Obshadko > > > > > > > > > -- > Ilya Obshadko >
Re: [T5.4] split Tapestry application into separate modules
What are you using to launch the webapp? I recommend the RunJettyRun plugin. Way better than jetty:run, if you ask me. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
RE: FW: Customizing the grid to alter its own content
I'm trying to use DOM rewriting for the purpose of modifying the content of some grid cells. I modified GridCell class adding a void afterRender(MarkupWriter writer) method, and in it I can retrieve the Element (org.apache.tapestry5.dom.Element) containing the value I want to modify. For ex. the toString() of one of these Element-s returns: Hello But I'm not sure how to change that "Hello" into something else. The Element class doesn't seem to me to have methods for that. If I do Node node = element.getChildren().get(0); I do get a org.apache.tapestry5.dom.Node representing the element's content (its toString() just returns "Hello"), but even this Node object doesn't seem to me to have methods to change its content. Or maybe I should create a new Node instance containing the text I want and then use this instance to replace the existing Node instance in the children list, like element.getChildren().set(0, newNode); ?
select problem render queue
I'm trying to do implement a select component on a page. I have this : *CreerClient.java:* *.* // value encoders @Property private ApplicatifDtoEncoder applicatifDtoEncoder; @Property private TypeClientDtoEncoder typeClientDtoEncoder; // select models for client types and applications @Property private SelectModel selectType; @Property private SelectModel selectApplications; @Inject SelectModelFactory selectModelFactory; // data transfer pojos for data retrieving client types and applications @Property private List typeClientList; @Property private List applicatifList; // selected objects for each select and their ids for select value @Property private ApplicatifDto selectedApplication; @Property private TypeClientDto selectedClientType; . // prepare rendering of the page void setupRender() { // retrieve client types and applications id applicatifList = serviceApplicatif.findAllApplicatifDto(); typeClientList = serviceTypeClient.findAllTypeClientDto(); // initialize selectmodels selectType = selectModelFactory.create(typeClientList, "nomType"); selectApplications = selectModelFactory.create(applicatifList, "nom"); } *CreerClient.tml :* : . ... *ApplicatifDtoEncoder:* public class ApplicatifDtoEncoder implements ValueEncoder, ValueEncoderFactory { @Inject private IServiceApplicatif serviceApplicatif; /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object) */ @Override public String toClient(ApplicatifDto value) { // return the given object's ID return String.valueOf(value.getId()); } /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toValue(java.lang.String) */ @Override public ApplicatifDto toValue(String clientValue) { // find the ApplicatifDto object of the given ID in the database return serviceApplicatif.findApplicatifDto(Long.parseLong(clientValue)); } // let this ValueEncoder also serve as a ValueEncoderFactory /* * (non-Javadoc) * * @see * org.apache.tapestry5.services.ValueEncoderFactory#create(java.lang.Class) */ @Override public ValueEncoder create(Class type) { return this; } *TypeClientDtoEncoder :* public class TypeClientDtoEncoder implements ValueEncoder, ValueEncoderFactory { @Inject private IServiceTypeClient serviceTypeClient; /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toClient(java.lang.Object) */ @Override public String toClient(TypeClientDto value) { // return the given object's ID return String.valueOf(value.getId()); } /* * (non-Javadoc) * * @see org.apache.tapestry5.ValueEncoder#toValue(java.lang.String) */ @Override public TypeClientDto toValue(String clientValue) { // find the typeclientdto object of the given ID in the database return serviceTypeClient.findTypeClientDto(Long.parseLong(clientValue)); } // let this ValueEncoder also serve as a ValueEncoderFactory /* * (non-Javadoc) * * @see * org.apache.tapestry5.services.ValueEncoderFactory#create(java.lang.Class) */ @Override public ValueEncoder create(Class type) { return this; } } But when I try to run this page I get : Render queue error in BeforeRenderTemplate[CreerClient:typeclientlist]: org.apache.tapestry5.ioc.internal.util.TapestryException In the console : [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Render queue error in BeforeRenderTemplate[CreerClient:typeclientlist]: org.apache.tapestry5.ioc.internal.util.TapestryException org.apache.tapestry5.internal.services.RenderQueueException: Render queue error in BeforeRenderTemplate[CreerClient:typeclientlist]: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:atos/smt/livraison/pages/CreerClient.tml, line 38] at org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:81) at org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:124) at $PageRenderQueue_10e6509c00f1.render(Unknown Source) at $PageRenderQueue_10e6509c00ea.render(Unknown Source) at org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37) at org.got5.tapestry5.jquery.services.js.JSModule$1.renderMarkup(JSModule.java:40) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$31.renderMarkup(TapestryModule.java:1994) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$30.renderMarkup(TapestryModule.java:1978) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:1960) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:1945) at $MarkupRenderer_10e6509c00f5.renderMarkup(Unknown Source) at org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:1931) at $MarkupRe
Re: [T5.4] split Tapestry application into separate modules
> For your last question, if you are using Eclipse Kepler or better, the > maven integration should be good enough to allow workspace resolution of > the other modules, as long as they are open. > i.e. you can change something in one module and have the dependent modules > pick up the changes, without needing to do a separate maven build or > install. This even works between overlays and the main web app project. > I've been expecting it should work that way, but it doesn't. Unless I perform "mvn clean install" inside the module project, I receive build error "[WARNING] The POM for my.package:module-name:jar:0.0.1-SNAPSHOT is missing, no dependency information available" I suppose it has something to do with external Maven installation that I'm using instead of embedded one, but I'm not sure. > On Wed, Jul 9, 2014 at 4:38 PM, Ilya Obshadko > wrote: > > > I would like to modularize my application into several modules, so that > > each one of them would be a separate Maven artifact. I'm trying to > > reproduce what I can borrow from tapestry-upload module source, but still > > have questions: > > > > - component that was moved into separate module can't be loaded by main > > application using standard namespace; is there any way to fix that? (that > > is, results in UknownValueException); > > contributeComponentClassResolver() (like in tapestry-upload) doesn't help > > (or I just use it incorrectly) > > > > - is that possible to run the whole thing within Eclipse without having > to > > install 'module' project into local repository? > > > > Thanks in advance. > > > > -- > > Ilya Obshadko > > > -- Ilya Obshadko
Re: [T5.4] split Tapestry application into separate modules
Thanks guys! I have successfully resolved the problem with component loading by introducing another namespace (just like tapestry-jquery does); I have concluded it would be better than messing with Tapestry core namespace. But I still have problems with picking up changes in component library at runtime. I've been trying to configure it using VM arguments and pom.xml properties, but unsuccessfully. This setting tapestry.modules my.package.name.ModuleName in main application configuration doesn't work. On Thu, Jul 10, 2014 at 12:05 AM, Thiago H de Paula Figueiredo < thiag...@gmail.com> wrote: > On Wed, 09 Jul 2014 17:38:04 -0300, Ilya Obshadko > wrote: > > - component that was moved into separate module can't be loaded by main >> application using standard namespace; is there any way to fix that? (that >> is, results in UknownValueException); >> > > That's expected: When you changed the component from the application to a > component library, you've changed its namespace. You can advise or decorate > ComponentClassResolver.resolveComponentTypeToClassName() and > resolveMixinTypeToClassName() (for mixins), which are the methods which map > logical names to component or mixin class names. > > > - is that possible to run the whole thing within Eclipse without having >> to install 'module' project into local repository? >> > > Yes. Just make sure the webapp module has the component modules in its > classpath. Module class autoloading won't work, as there's no JAR for the > component libraries included in this way, but then you can use the > tapestry.modules VM argument to specify comma-separated fully qualified > module class names to be loaded. Another option is to use @Submodule in > your AppModule. > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Ilya Obshadko