Re: T5.0.5 Informal parameters not rendered in a descendant of AbstractField.
Thanks for the pointer Nick! I will try again. Shing --- Nick Westgate [EMAIL PROTECTED] wrote: Hi Shing. Nice to see you getting into T5. ;-) Not sure why your resources.renderInformalParameters(writer) fails, but it's likely a clash with the RenderInformals mixin in AbstractField. You should read the docs about rendering multiple tags: http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/corelib/mixins/RenderInformals.html I can confirm that writing a tag in beginRender and closing it in afterRender (without calling renderInformalParameters) works fine with informals because of AbstractField's RenderInformals. Also, you don't need to add @SupportsInformalParameters. Cheers, Nick. Shing Hing Man wrote: I have subclassed AbstractField to make a colour picker component, which is essentially a read only text field with a clickable icon next to it. The component is working, but it does not render the informal parameters. With t:colorPicker size=3 color=color / I expect the rendered text field to have an attribute of size=3. The following is the code of my component. Any assistance is appreciated! Shing @SupportsInformalParameters public class ColorPicker extends AbstractField { //private String clientId; @Parameter(required = true, principal = true) private String color; @Inject private Request request; @Inject private ComponentResources resources; @Environmental private PageRenderSupport support; @Inject @Path(classpath:/org/man/tapestry5/components/AnchorPosition.js) private Asset anchorScript; @Inject @Path(classpath:/org/man/tapestry5/components/ColorPicker2.js) private Asset colorPicker2Script; @Inject @Path(classpath:/org/man/tapestry5/components/PopupWindow.js) private Asset popupWindowScript; @Inject @Path(classpath:/org/man/tapestry5/components/colorPicker.gif) private Asset icon; void beginRender(MarkupWriter writer) { String name=getElementName(); String pickerName = name + _pick; String pickerColor = name + _color; // need to find out how to gte the form name String formName = form; String targetField = document. + formName + . + pickerColor; String color = getColor(); if (color == null) { color = #FF; // white } String style = background: + color + ;color: + color + ;; writer.element(input, type, text, name, pickerColor, onFocus, blur(), style, style, value, color); resources.renderInformalParameters(writer); writer.end(); // end of input writer.element(a, href, javascript:void(null), name, pickerName, id, pickerName, onclick, select_color( + targetField + , + ' + pickerName + ' + )); writer.element(img, src, icon.toClientURL(), border, 0, align, top); writer.end(); // end of img writer.end(); // end of a support.addScriptLink(anchorScript); support.addScriptLink(popupWindowScript); support.addScriptLink(colorPicker2Script); } public String getColor() { return color; } public void setColor(String color) { this.color = color; } @Override protected void processSubmission(FormSupport formSupport, String elementName) { color = request.getParameter(elementName + _color); } } Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today
Re: T5.0.5 Informal parameters not rendered in a descendant of AbstractField.
t:colorPicker size=3 color=color / The informal parameter size3 is rendered if I do the following changes to my ColorPicker.java (without using mixins). 1) Remove @SupportsInformalParameters and resources.renderInformalParameters(writer) 2) In the beginRender method, only render the input type=text tag (but not closing it). 3) Add an afterRender method to closed the input tag and render the color picker icon. Shing PS I have not tried the mixin way yet. --- Nick Westgate [EMAIL PROTECTED] wrote: Hi Shing. Nice to see you getting into T5. ;-) Not sure why your resources.renderInformalParameters(writer) fails, but it's likely a clash with the RenderInformals mixin in AbstractField. You should read the docs about rendering multiple tags: http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/corelib/mixins/RenderInformals.html I can confirm that writing a tag in beginRender and closing it in afterRender (without calling renderInformalParameters) works fine with informals because of AbstractField's RenderInformals. Also, you don't need to add @SupportsInformalParameters. Cheers, Nick. Shing Hing Man wrote: I have subclassed AbstractField to make a colour picker component, which is essentially a read only text field with a clickable icon next to it. The component is working, but it does not render the informal parameters. With t:colorPicker size=3 color=color / I expect the rendered text field to have an attribute of size=3. The following is the code of my component. Any assistance is appreciated! Shing @SupportsInformalParameters public class ColorPicker extends AbstractField { //private String clientId; @Parameter(required = true, principal = true) private String color; @Inject private Request request; @Inject private ComponentResources resources; @Environmental private PageRenderSupport support; @Inject @Path(classpath:/org/man/tapestry5/components/AnchorPosition.js) private Asset anchorScript; @Inject @Path(classpath:/org/man/tapestry5/components/ColorPicker2.js) private Asset colorPicker2Script; @Inject @Path(classpath:/org/man/tapestry5/components/PopupWindow.js) private Asset popupWindowScript; @Inject @Path(classpath:/org/man/tapestry5/components/colorPicker.gif) private Asset icon; void beginRender(MarkupWriter writer) { String name=getElementName(); String pickerName = name + _pick; String pickerColor = name + _color; // need to find out how to gte the form name String formName = form; String targetField = document. + formName + . + pickerColor; String color = getColor(); if (color == null) { color = #FF; // white } String style = background: + color + ;color: + color + ;; writer.element(input, type, text, name, pickerColor, onFocus, blur(), style, style, value, color); resources.renderInformalParameters(writer); writer.end(); // end of input writer.element(a, href, javascript:void(null), name, pickerName, id, pickerName, onclick, select_color( + targetField + , + ' + pickerName + ' + )); writer.element(img, src, icon.toClientURL(), border, 0, align, top); writer.end(); // end of img writer.end(); // end of a support.addScriptLink(anchorScript); support.addScriptLink(popupWindowScript); support.addScriptLink(colorPicker2Script); } public String getColor() { return color; } public void setColor(String color) { this.color = color; } @Override protected void processSubmission(FormSupport formSupport, String elementName) { color = request.getParameter(elementName + _color); } } Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5.0.5 Informal parameters not rendered in a descendant of AbstractField.
Hi Shing. By inheriting from AbstractField you are using these mixins: @SuppressWarnings(unused) @Mixin private RenderInformals _renderInformals; @SuppressWarnings(unused) @Mixin private RenderDisabled _renderDisabled; RenderInformals is rendering the informal parameters. Cheers, Nick. Shing Hing Man wrote: t:colorPicker size=3 color=color / The informal parameter size3 is rendered if I do the following changes to my ColorPicker.java (without using mixins). 1) Remove @SupportsInformalParameters and resources.renderInformalParameters(writer) 2) In the beginRender method, only render the input type=text tag (but not closing it). 3) Add an afterRender method to closed the input tag and render the color picker icon. Shing PS I have not tried the mixin way yet. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5.0.5 Informal parameters not rendered in a descendant of AbstractField.
Hi Shing. Nice to see you getting into T5. ;-) Not sure why your resources.renderInformalParameters(writer) fails, but it's likely a clash with the RenderInformals mixin in AbstractField. You should read the docs about rendering multiple tags: http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/corelib/mixins/RenderInformals.html I can confirm that writing a tag in beginRender and closing it in afterRender (without calling renderInformalParameters) works fine with informals because of AbstractField's RenderInformals. Also, you don't need to add @SupportsInformalParameters. Cheers, Nick. Shing Hing Man wrote: I have subclassed AbstractField to make a colour picker component, which is essentially a read only text field with a clickable icon next to it. The component is working, but it does not render the informal parameters. With t:colorPicker size=3 color=color / I expect the rendered text field to have an attribute of size=3. The following is the code of my component. Any assistance is appreciated! Shing @SupportsInformalParameters public class ColorPicker extends AbstractField { //private String clientId; @Parameter(required = true, principal = true) private String color; @Inject private Request request; @Inject private ComponentResources resources; @Environmental private PageRenderSupport support; @Inject @Path(classpath:/org/man/tapestry5/components/AnchorPosition.js) private Asset anchorScript; @Inject @Path(classpath:/org/man/tapestry5/components/ColorPicker2.js) private Asset colorPicker2Script; @Inject @Path(classpath:/org/man/tapestry5/components/PopupWindow.js) private Asset popupWindowScript; @Inject @Path(classpath:/org/man/tapestry5/components/colorPicker.gif) private Asset icon; void beginRender(MarkupWriter writer) { String name=getElementName(); String pickerName = name + _pick; String pickerColor = name + _color; // need to find out how to gte the form name String formName = form; String targetField = document. + formName + . + pickerColor; String color = getColor(); if (color == null) { color = #FF; // white } String style = background: + color + ;color: + color + ;; writer.element(input, type, text, name, pickerColor, onFocus, blur(), style, style, value, color); resources.renderInformalParameters(writer); writer.end(); // end of input writer.element(a, href, javascript:void(null), name, pickerName, id, pickerName, onclick, select_color( + targetField + , + ' + pickerName + ' + )); writer.element(img, src, icon.toClientURL(), border, 0, align, top); writer.end(); // end of img writer.end(); // end of a support.addScriptLink(anchorScript); support.addScriptLink(popupWindowScript); support.addScriptLink(colorPicker2Script); } public String getColor() { return color; } public void setColor(String color) { this.color = color; } @Override protected void processSubmission(FormSupport formSupport, String elementName) { color = request.getParameter(elementName + _color); } } Home page : http://www.lombok.demon.co.uk/ ___ Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]