Re: Manipulate Component Markup before rendering
Any component defined within the "script" area seems to be ignored by wicket Weird. That sounds like a bug to me. Anyway, your solution seems robust enough to me. Regards, Erik. Jürgen Lind wrote: Hi Erik, thank you for the suggestion. I tried that already and it did not work. Any component defined within the "script" area seems to be ignored by wicket, i.e. when I define the label in the Java code, I get an error message stating that the component was not declared in the markup file... What I am currently using is the following code: protected void onRender(MarkupStream markupStream) { super.onRender(markupStream); final MarkupStream associatedMarkupStream = getAssociatedMarkupStream(true); MarkupElement element = associatedMarkupStream.get(2); getResponse().write(this.replaceParameters(element.toString())); } The problem here is, that I know that the markup element I want is at the second position. However, this is not very robust ;-) Cheers, J. Erik van Oosten wrote: Hello Jürgen, You coulld put a in the markup and add a Label to it. Don't forget to call setRenderBodyOnly(true) on the label. Regards, Erik. Jürgen Lind wrote: Hi, I was wondering if there is some way to rewrite the component markup before it is rendered. My setting is as follows: 1. I have a component markup file like this someFunction( "runtime parameter" ); 2. The matching component overrides "onComponentTagBody" and "onRender" protected final void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { checkComponentTag(openTag, "textarea"); replaceComponentTagBody(markupStream, openTag, getValue()); } protected void onRender(MarkupStream markupStream) { super.onRender(markupStream); super.renderAssociatedMarkup("panel", "Some error"); } Now, what I would like to do is to change the value for the "runtime parameter" in the onRender Method and replace it with a value that has been given to the component when the component was constructed. Is there any way to achieve this? Regards, J. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Manipulate Component Markup before rendering
Hi Erik, thank you for the suggestion. I tried that already and it did not work. Any component defined within the "script" area seems to be ignored by wicket, i.e. when I define the label in the Java code, I get an error message stating that the component was not declared in the markup file... What I am currently using is the following code: protected void onRender(MarkupStream markupStream) { super.onRender(markupStream); final MarkupStream associatedMarkupStream = getAssociatedMarkupStream(true); MarkupElement element = associatedMarkupStream.get(2); getResponse().write(this.replaceParameters(element.toString())); } The problem here is, that I know that the markup element I want is at the second position. However, this is not very robust ;-) Cheers, J. Erik van Oosten wrote: Hello Jürgen, You coulld put a in the markup and add a Label to it. Don't forget to call setRenderBodyOnly(true) on the label. Regards, Erik. Jürgen Lind wrote: Hi, I was wondering if there is some way to rewrite the component markup before it is rendered. My setting is as follows: 1. I have a component markup file like this someFunction( "runtime parameter" ); 2. The matching component overrides "onComponentTagBody" and "onRender" protected final void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { checkComponentTag(openTag, "textarea"); replaceComponentTagBody(markupStream, openTag, getValue()); } protected void onRender(MarkupStream markupStream) { super.onRender(markupStream); super.renderAssociatedMarkup("panel", "Some error"); } Now, what I would like to do is to change the value for the "runtime parameter" in the onRender Method and replace it with a value that has been given to the component when the component was constructed. Is there any way to achieve this? Regards, J. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mit freundlichen Grüßen, Jürgen Lind -- Dr. Jürgen Lind iteratec GmbHFon: +49 (0)89 614551-44 Inselkammerstrasse 4 Fax: +49 (0)89 614551-10 82008 Unterhaching Web: www.iteratec.de Sitz und Registergericht der iteratec GmbH: München HRB 113 519 Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Manipulate Component Markup before rendering
Hello Jürgen, You coulld put a in the markup and add a Label to it. Don't forget to call setRenderBodyOnly(true) on the label. Regards, Erik. Jürgen Lind wrote: Hi, I was wondering if there is some way to rewrite the component markup before it is rendered. My setting is as follows: 1. I have a component markup file like this someFunction( "runtime parameter" ); 2. The matching component overrides "onComponentTagBody" and "onRender" protected final void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { checkComponentTag(openTag, "textarea"); replaceComponentTagBody(markupStream, openTag, getValue()); } protected void onRender(MarkupStream markupStream) { super.onRender(markupStream); super.renderAssociatedMarkup("panel", "Some error"); } Now, what I would like to do is to change the value for the "runtime parameter" in the onRender Method and replace it with a value that has been given to the component when the component was constructed. Is there any way to achieve this? Regards, J. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Manipulate Component Markup before rendering
Hi, I was wondering if there is some way to rewrite the component markup before it is rendered. My setting is as follows: 1. I have a component markup file like this someFunction( "runtime parameter" ); 2. The matching component overrides "onComponentTagBody" and "onRender" protected final void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { checkComponentTag(openTag, "textarea"); replaceComponentTagBody(markupStream, openTag, getValue()); } protected void onRender(MarkupStream markupStream) { super.onRender(markupStream); super.renderAssociatedMarkup("panel", "Some error"); } Now, what I would like to do is to change the value for the "runtime parameter" in the onRender Method and replace it with a value that has been given to the component when the component was constructed. Is there any way to achieve this? Regards, J. -- Dr. Jürgen Lind iteratec GmbHFon: +49 (0)89 614551-44 Inselkammerstrasse 4 Fax: +49 (0)89 614551-10 82008 Unterhaching Web: www.iteratec.de Sitz und Registergericht der iteratec GmbH: München HRB 113 519 Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]