You could overwrite onComponentTag on your component and change the
element type there based on enabled status. just make sure to call
super first. Note that this tick might not work for some components as
they require a certain html tag but i think button will be fine.
Maurice
On Sun, Mar 30, 2008 at 4:59 PM, Eyal Golan <[EMAIL PROTECTED]> wrote:
> Hi,
> I am using behaviors for beforeRender and onRender to add html markups.
> private void init() {
> add(HeaderContributor.forCss(MyButton.class, "MyButton.css"));
> add(new AbstractBehavior() {
> private static final long serialVersionUID = 1L;
>
> @Override
> public void beforeRender(Component component) {
> component.getResponse().write(Consts.getBeforeRender());
>
> }
>
> @Override
> public void onRendered(Component component) {
> component.getResponse().write(Consts.getOnRenedered());
> }
> });
> }
>
> in order to get:
> <span class="button"><input type="submit" name="foo" value="yout text"
> /></span>
>
> This works great!
>
> BUT,
> sometimes, when the button should be disabled, I want to have this instead
> in the markup:
> <del class="button"><span>yout text</span></del>
>
> The problem is that when constructing the button, I don't know the enable
> status.
> I set button.setEnabled only after creating it.
>
> Is there a way to change the markup when someone sets to enable-false?
>
> Thanks
>
> --
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit: http://jvdrums.sourceforge.net/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]