Re: Making a DecoratedButton; Need to pre-fix/post-fix div tag around the button component

2010-09-24 Thread Martin Grigorov
attach AbstractBehavior to Button and override
org.apache.wicket.behavior.AbstractBehavior.beforeRender(Component)
org.apache.wicket.behavior.AbstractBehavior.onRendered(Component)

in their bodies write directly to the response:
RequestCycle.get().getResponse().write(your stuff)

On Fri, Sep 24, 2010 at 3:25 AM, FarhanS farhan.sar...@gmail.com wrote:


 Hi Guys,

 I am trying to make a reusable DecoratedButton component (extension of
 wicket Button), which would draw itself with appropriate icon, color, and
 other styles, based on the provided ButtonType, an enum e.g. 'Save',
 'Edit',
 'Delete', 'Search', 'Cancel' etc...

 I am trying to find solution to; how to encapsulate the html (associated
 with the button) in the form of wicket component to get the desired look 
 feel. The html that represents the button is as below:


  div class=buttons
  button type=submit
  ./resources/Save.png Save
  /button
  /div


 The html-button as you see above is encapsulated in a 'div' tag. The
 Button component (DecoratedButton) I am making, I want the user to use the
 html button tag to attach the component to (instead of using div which
 is the container tag in my implementation), as that is only intuitive, when
 using a Button component.

 Ok, so here is my question, how can i prefix/post-fix div tag or any
 other
 tag, around the html button tag to which the new DecoratedButton
 component
 will be attached to. I did think about the option of renaming the
 'button'
 tag to 'div' using setName in OnComponentTag() method, and than
 appending/injecting the remaining html within it (e.g. the Button itself).
 But than what if the user has any other behaviors/style/attributes attached
 to the button component, how would gather all those attributes from it to
 the new button tag html i inject with the div..? It doesn't seem like the
 right way to go ?

 Any ideas/thoughts ?

 Thanks in advance,

 Farhan.
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Making-a-DecoratedButton-Need-to-pre-fix-post-fix-div-tag-around-the-button-component-tp2552950p2552950.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: Making a DecoratedButton; Need to pre-fix/post-fix div tag around the button component

2010-09-24 Thread Alexander Morozov

Check out the artifactory code (http://www.jfrog.org/index.php) and check
TemplateBehavior class.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Making-a-DecoratedButton-Need-to-pre-fix-post-fix-div-tag-around-the-button-component-tp2552950p2553242.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Making a DecoratedButton; Need to pre-fix/post-fix div tag around the button component

2010-09-23 Thread FarhanS

Hi Guys,

I am trying to make a reusable DecoratedButton component (extension of
wicket Button), which would draw itself with appropriate icon, color, and
other styles, based on the provided ButtonType, an enum e.g. 'Save', 'Edit',
'Delete', 'Search', 'Cancel' etc...

I am trying to find solution to; how to encapsulate the html (associated
with the button) in the form of wicket component to get the desired look 
feel. The html that represents the button is as below:


 div class=buttons
  button type=submit
  ./resources/Save.png Save
  /button
 /div


The html-button as you see above is encapsulated in a 'div' tag. The
Button component (DecoratedButton) I am making, I want the user to use the
html button tag to attach the component to (instead of using div which
is the container tag in my implementation), as that is only intuitive, when
using a Button component.

Ok, so here is my question, how can i prefix/post-fix div tag or any other
tag, around the html button tag to which the new DecoratedButton component
will be attached to. I did think about the option of renaming the 'button'
tag to 'div' using setName in OnComponentTag() method, and than
appending/injecting the remaining html within it (e.g. the Button itself). 
But than what if the user has any other behaviors/style/attributes attached
to the button component, how would gather all those attributes from it to
the new button tag html i inject with the div..? It doesn't seem like the
right way to go ?

Any ideas/thoughts ?

Thanks in advance,

Farhan.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Making-a-DecoratedButton-Need-to-pre-fix-post-fix-div-tag-around-the-button-component-tp2552950p2552950.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org