You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2014/12/12 09:58:09 UTC

Special behavior on setEnabled

Hello All,

I would like special attribute be added to WebMarkupContainer which is part
of FormComponentPanel<String> [1] in case Form was disabled

Is it possible?

Thanks in advance for your help!

[1]
https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui-plugins/src/main/java/com/googlecode/wicket/jquery/ui/plugins/wysiwyg/WysiwygEditor.java#L89

-- 
WBR
Maxim aka solomax

Re: Special behavior on setEnabled

Posted by Martin Grigorov <mg...@apache.org>.
Yes.
Everytime WMC is rendered its #onComponentTag() will called

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Dec 12, 2014 at 11:15 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Thanks a lot!
>
> Would it work with AJAX updates as well?
>
> On Fri, Dec 12, 2014 at 3:09 PM, Sebastien <se...@gmail.com> wrote:
> >
> > Hi Maxim,
> >
> > Something like this?
> >
> >         this.container = new WebMarkupContainer("container") {
> >             @Override
> >             protected void onComponentTag(ComponentTag tag)
> >             {
> >                 super.onComponentTag(tag);
> >
> >                 if (!WysiwygEditor.this.getForm().isEnabled())
> >                 {
> >                     tag.put("mykey", "myvalue"); // tag.append(key,
> value,
> > separator); is also available
> >                 }
> >             }
> >         };
> >
> > Best regards,
> > Sebastien
> >
> > On Fri, Dec 12, 2014 at 9:58 AM, Maxim Solodovnik <so...@gmail.com>
> > wrote:
> > >
> > > Hello All,
> > >
> > > I would like special attribute be added to WebMarkupContainer which is
> > part
> > > of FormComponentPanel<String> [1] in case Form was disabled
> > >
> > > Is it possible?
> > >
> > > Thanks in advance for your help!
> > >
> > > [1]
> > >
> > >
> >
> https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui-plugins/src/main/java/com/googlecode/wicket/jquery/ui/plugins/wysiwyg/WysiwygEditor.java#L89
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
> --
> WBR
> Maxim aka solomax
>

Re: Special behavior on setEnabled

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks a lot!

Would it work with AJAX updates as well?

On Fri, Dec 12, 2014 at 3:09 PM, Sebastien <se...@gmail.com> wrote:
>
> Hi Maxim,
>
> Something like this?
>
>         this.container = new WebMarkupContainer("container") {
>             @Override
>             protected void onComponentTag(ComponentTag tag)
>             {
>                 super.onComponentTag(tag);
>
>                 if (!WysiwygEditor.this.getForm().isEnabled())
>                 {
>                     tag.put("mykey", "myvalue"); // tag.append(key, value,
> separator); is also available
>                 }
>             }
>         };
>
> Best regards,
> Sebastien
>
> On Fri, Dec 12, 2014 at 9:58 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
> >
> > Hello All,
> >
> > I would like special attribute be added to WebMarkupContainer which is
> part
> > of FormComponentPanel<String> [1] in case Form was disabled
> >
> > Is it possible?
> >
> > Thanks in advance for your help!
> >
> > [1]
> >
> >
> https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui-plugins/src/main/java/com/googlecode/wicket/jquery/ui/plugins/wysiwyg/WysiwygEditor.java#L89
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>


-- 
WBR
Maxim aka solomax

Re: Special behavior on setEnabled

Posted by Sebastien <se...@gmail.com>.
Hi Maxim,

Something like this?

        this.container = new WebMarkupContainer("container") {
            @Override
            protected void onComponentTag(ComponentTag tag)
            {
                super.onComponentTag(tag);

                if (!WysiwygEditor.this.getForm().isEnabled())
                {
                    tag.put("mykey", "myvalue"); // tag.append(key, value,
separator); is also available
                }
            }
        };

Best regards,
Sebastien

On Fri, Dec 12, 2014 at 9:58 AM, Maxim Solodovnik <so...@gmail.com>
wrote:
>
> Hello All,
>
> I would like special attribute be added to WebMarkupContainer which is part
> of FormComponentPanel<String> [1] in case Form was disabled
>
> Is it possible?
>
> Thanks in advance for your help!
>
> [1]
>
> https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui-plugins/src/main/java/com/googlecode/wicket/jquery/ui/plugins/wysiwyg/WysiwygEditor.java#L89
>
> --
> WBR
> Maxim aka solomax
>

Re: Special behavior on setEnabled

Posted by Martin Grigorov <mg...@apache.org>.
Hi Maxim,

special = new WebMarkupContainer("someId") {

  @Override public void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    Form form = Form.findParent(Form.class);
    if (form != null && form.isEnabled() == false) {
      tag.put("specialAttrName", "specialAttrValue");
    }
  }
}

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Dec 12, 2014 at 10:58 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello All,
>
> I would like special attribute be added to WebMarkupContainer which is part
> of FormComponentPanel<String> [1] in case Form was disabled
>
> Is it possible?
>
> Thanks in advance for your help!
>
> [1]
>
> https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui-plugins/src/main/java/com/googlecode/wicket/jquery/ui/plugins/wysiwyg/WysiwygEditor.java#L89
>
> --
> WBR
> Maxim aka solomax
>