Re: Example of overriding the default ValidationDecorator
That's what i already thought of too, i was just hoping to be wrong. I tried all kinds of different approaches, a mixin can't really work as it should be applied to labels automatically and not manually adding a mixin. Using a worker i would get there but there're issues with the dynamically created conduits and it gets really messy with reflection as the parameter value has to parsed, probably ending up in the same situation as i'm now with the production mode. So i guess i'm stuck with adding the css classes just manually to the fields. Anyways, thanks for the answer. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Example-of-overriding-the-default-ValidationDecorator-tp2419072p5715029.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: Example of overriding the default ValidationDecorator
Hello, hope this Thread is still alive. I've used a similar approach to figure out if the label is attached to a field which renders a required field. The whole thing is a bit complex as we're using JSR303 annotations on the DTO so i've to get the parameter of the textField and then evaluate the string. Using reflection i'm checking if the attribute of the DTO has a NotNull annotation and depending on that i'm appending a CSS class which then renders an asterisk. Funny thing is that this doesn't work when i'm switching on the Tapestry Production Mode. When debugging i found out that all fields in my component are null whereas they're the expected objects when not using production mode. I couldn't figure out why that is, does anyone have an explanation for this behavior or any clues where/what to search for? Thanks in advance. Matt -- View this message in context: http://tapestry.1045711.n5.nabble.com/Example-of-overriding-the-default-ValidationDecorator-tp2419072p5714940.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: Inheritance and the order of loaded JS
That might be true, we 'solved' the issue by simply using the afterRender in the child class. According to the documentation under:http://tapestry.apache.org/component-rendering.html the following is written: Parents before Child Ordering is always parent-first. Methods defined in the parent class are always invoked before methods defined in the child class. When a sub-class overrides an render phase method of a base class, the method is only invoked once, along with any other base class methods. The subclass can change the implementation of the base class method via an override, but can't change the timing of when that method is invoked. See TAPESTRY-2311. This is not true, at least when using @Import -- View this message in context: http://tapestry.1045711.n5.nabble.com/Inheritance-and-the-order-of-loaded-JS-tp5714430p5714500.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
Inheritance and the order of loaded JS
Hello, i've two Tapestry components where one inherits from the other one. The same dependency exists in their JS which is realized by using the jQuery UI Widget Factory. The problem i have is the order in which the @Import loads the JS, first the JS of the child class, which relies on the availability of the parent JS, gets called, and this of course breaks the execution. I'd like to omit specifying the same JS files in both classes. I understand the worker adds the import to the setupRender of the components, i was debugging the ImportWorker and saw that JSSupport actually imports the parent class JS twice, for the child class it first uses the child JS, then the parent JS, and right after the setupRender of the child got called the JS of the parent gets imported again, event duplicate imports are ignored further then. Still the problem is that the child JS gets imported before the parent JS. Is this a bug or is it the known, wanted behavior. If so, what's the intention behind this? Can i somehow work around this or do i have to specify the JS multiple times and in the correct order? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Inheritance-and-the-order-of-loaded-JS-tp5714430.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: Inheritance and the order of loaded JS
It's not only our own components, we're using GoT5 and wanna extend some components, as they use @Import on the class i can't use placeholder methods. For some of our own components it's worth considering. Generally we've the paradigm to only use @Import except the JS needs to be loaded due to some condition for which we use the JavaScriptSupport. We introduced RequireJS to our project a while ago. It would also solve this problem nicely but as we wanted to cleanly separate the JS files it didn't really make a lot of sense as 99% of our dependencies are jQuery Plugins, which by their nature are globally available once loaded (using jQuery.sub was too bad for performance and would have required to adapt jQuery UI plugins), so we removed RequireJS again. Anyways, wouldn't it be generally better if the @Import obeys the parent child order when loading JS. I couldn't think of any case when the current behavior would be needed. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Inheritance-and-the-order-of-loaded-JS-tp5714430p5714442.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: How to resolve the rendered component in a mixin
I'd like to know the variable name of the currently rendered *SUB*component in the afterRender method of my mixin. So when myComponent (which contains i.e. an EventLink component) is rendered i can influence all it's containing subcomponents, my problem is that i don't know which subcomponent is which. If myComponent contains 5 EventLinks i can't differ which EventLink is which. I don't want to distinguish them by content, i'd much rather distinguish by variable name and if possible even by container.variable in case there's a variable name used multiple times in any nested component(s). The reason for this is described above but in short i want the user of the mixin to specify the filtering criteria so we can put the mixin on a higher level than only on the affected component directly. -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-resolve-the-rendered-component-in-a-mixin-tp5714315p5714351.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: How to resolve the rendered component in a mixin
@Muhammad: No, not exactly. I'd need a reference not necessarily to the component to which the mixin is applied but rather to all it's rendering subcomponents. Like in the example in my first post the myComponent could contain a zone which again contains i.e. an anchor tag where the var is named edit. When applying my mixin i'd like to specify it somehow like the following on one page: ... @MixinClasses({SomeMixin.class}) @Component(parameters={attrName=something, attrValue=x, pattern=edit}) private MyComponent myComponent; Where on another page i might have something like this: @MixinClasses({SomeMixin.class}) @Component(parameters={attrName=something, attrValue=y}) private LinkSubmit submit; or this (MyParentComponent contains myComponent): @MixinClasses({SomeMixin.class}) @Component(parameters={attrName=something, attrValue=z, pattern=myComponent.edit}) private MyParentComponent myParentComponent; So the pattern parameter should be optional and i'd like to use it in the mixin in the begin/afterRender to check if the attribute should be applied to the currently rendered component. @Thiago: I tried to inject the container already but i didn't find any method which would assist me with the currently rendered subcomponent, the container itself isn't what i need. I also tried and looked at ComponentResources and JSSupport. -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-resolve-the-rendered-component-in-a-mixin-tp5714315p5714348.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
How to resolve the rendered component in a mixin
Hello, i'd like to extend some components with the ability to render certain nodes with an additional attribute which is then picked up in JS and used as a keybinding for shortcuts. So far i created a mixin which i preferably would like to put on any kind of component, in case of an EventLink it should simply render: link instead of: link This works like expected but a problem comes up with components that contain components, for example: public class MyComponent { @Component(//parameters) private EventLink edit; ... more stuff in here } Now i'd like to use 'MyComponent' on different pages where on some pages i'd like to use the mixin whereas on others i don't. I also don't want to change the component and add the mixin in the component and a parameter to control if it should be active or not. When debugging i found the rendered elements are available in class RenderQueueImpl in the StackComponentResources renderingComponents, other than that i couldn't find any appearance and don't know if or how to inject or access the element. I'd like to pass the component name and optionally the container component(s) in a fashion like: 'myComponent.edit' where myComponent is the variable name as in: @Component private MyComponent myComponent; to my mixin. Is there any way i can filter the rendered element in the render phases? @BeginRender void beginRender(final MarkupWriter markupWriter) { markupWriter.addListener(new MarkupWriterListener() { @Override public void elementDidEnd(final Element element) { /** * here i'd like to put my if(element == parameter) * where element is the currently rendered component * and parameter is the passed parameter somhow in the * fashion of containerName.componentName */ element.attribute(ATTRIBUTE_NAME, shortcut); } @Override public void elementDidStart(Element element) { } }); } -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-resolve-the-rendered-component-in-a-mixin-tp5714315.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: MarkupWriter + HTML (5) Validation
@Steve: Yes, it seems like the same issue to me, the attributes are taken out from the dtd's. @Thiago: Thanks for the response, i've taken a look at those classes and many more while debugging this behavior and investigating where those attributes come from. The model in use is the htmlModel/DefaultMarkupModel which pretty much only allows some abbreviated tags but doesn't tell me anything about the informal parameters which are used subsequently (the attributes shape and clear) Should i open a new bug report for this issue (according to Massimo Lusetti's comment:Please open a new one for 5.3 if this still applicable), we're using 5.3.2? To see both behaviors in action just take a look at jumpstart: http://jumpstart.doublenegative.com.au/jumpstart/examples/input/eventlinks/0 -- View this message in context: http://tapestry.1045711.n5.nabble.com/MarkupWriter-HTML-5-Validation-tp5586070p5588736.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
MarkupWriter + HTML (5) Validation
I'm not quite sure about the issue here as i'm not too familiar with all the standards possibly involved (SGML, HTML X.X, XHTML, ). When i'm using an Action- or EventLink on my page by defining it in the Java class and then referencing it in the tml in the follwing manner: someText Tapestry renders the following: someUrl someText When using any other tag instead of 'a', for example: p t:id=myLinksomeText/p it gets rendered correctly without the shape attribute: someUrl someText I've no clue what's the benefit of rendering this attribute, in HTML 5 it's deprecated and i've never seen this attribute being used for an anchor tag. Is there a way to get rid of this attribute without using 'wrong' tags? Pretty much the same problem we got with the br tag which is used in the tml like this: br/ but Tapestry renders to: br clear=none / I couldn't figure out any way how to get rid of the clear attribute, obviously this attribute shouldn't be set there, if anywhere it should be set through css and what's worse it shouldn't be set at all. Is there any way to get rid of those attributes and secondly, why are they there by default anyways? kind regards Matt -- View this message in context: http://tapestry.1045711.n5.nabble.com/MarkupWriter-HTML-5-Validation-tp5586070p5586070.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
JS and jQuery
Hello, we're currently reevaluating big parts of our application and are also thinking about switching over to GoT5/jQuery. According to recent blog posts there's something like an JS abstraction layer coming, would it be worth to switch now and adapt as soon as this change has been released or would it be recommended to wait for this change to happen in Tapestry. I know there's more to this question and an answer heavily relies on the already existing code. I'm just curious and would like to know a bit more specific how this 'abstraction layer' will be implemented, will it be backwards-compatible with the triggered events and the overall behavior or will it change a lot. I've already checked out Tapestry's sourcecode but can't spot any changes related to this topic. kind regards Matt -- View this message in context: http://tapestry.1045711.n5.nabble.com/JS-and-jQuery-tp5576292p5576292.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
tapestry-beanvalidation
We'd like to use JSR-303 bean validation and mark invalid fields in the UI. The Tapestry beanvalidation module already does quite a good job but has a minor bug when it comes to embedded objects. The problem is that component parameters i.e. the TextField#value is only bound to the attribute itself but doesn't contain the full objectpath, so using a DTO like: class TestDTO { @NotNull private String firstName; @Valid private EmbeddedObject embeddedObject; ... } class EmbeddedObject { @NotNull private String lastName; ... } Using the TestDTO on a page in the following way: class MyPage{ ... @Property private TestDTO testDTO; @Component(parameters = {validate=testDTO}) private Form form; @Component(parameters = {value=testDTO.firstName}) private TextField firstName; @Component(parameters = {value=testDTO.embeddedObject.lastName}) private TextField embeddedField; ... } Submitting the form validates all the attributes correctly (also the embedded object validation error is listed in the t:errors component) but when it comes to BeanFieldValidator only lastName is on the Environment Stack in the BeanValidationContext. As TestDTO doesn't contain the property lastName and there's no objectpath available it doesn't traverse down the objects and can't assign the correct validation error. -- View this message in context: http://tapestry.1045711.n5.nabble.com/tapestry-beanvalidation-tp4921787p4921787.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
DiscardAfter on component level
Hello, is there the possibility to put the DiscardAfter on a method on component level and only discard the persistent fields of this component and its subcomponents, but *NOT* from the page? I couldn't find any so i wrote a worker for my own annotation @DiscardComponentAfter which can be placed on either the page level or on component level. It's basically doing the same thing as the DiscardAfterWorker except that it's using completeId from the InternalComponentResourcesImpl class and directly injects the Request to be able to remove the session attributes as the method AbstractSessionPersistentFieldStrategy#discardChanges adds a colon at the end of the page name. Maybe something like this would be helpful for other applications as well and be added to Tapestry, where to request such a feature. best regards Matt -- View this message in context: http://tapestry.1045711.n5.nabble.com/DiscardAfter-on-component-level-tp4847998p4847998.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