Re: [Wicket-user] Is it possible to remove something from a page?
Lowell, Sorry for my bad answers today, I was doing too many things at the same time, and now that I re-read your use case I think I understand better what you want. If I'm correct, you want to decorate a label with a star, and use some css class or id with that star and have the ability to turn the star off or on depending on a condition. Disregard the rest of the thread, because indeed Labels (or any component replacing their bodies) don't allow nested components. Your best choice is to use a behavior: label.add(new AbstractBehavior() { @Override public boolean isEnabled(Component component) { return myCondition(); } @Override public void onRendered(Component component) { Response response = component.getResponse(); response.write(span id='foo' class='bar'*/span); } }); The behavior writes directly to the response (after the component itself is rendered) and the visibility can be steered using isEnabled. Do note that if it wasn't for the fact that you're trying to decorate labels, you could have used Borders instead of a behavior. Not to say that this is better, just be aware of the alternative (in case you are annotating markupcontainers). Hope this helps, Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
You need to use the css pseudo-elements before and after: http://www.w3schools.com/css/css_pseudo_elements.asp http://www.w3schools.com/css/css_pseudo_elements.asp . They're not supported by all browsers tho (in particular, not by IE I think). -- View this message in context: http://www.nabble.com/Is-it-possible-to-remove-something-from-a-page--tf3844138.html#a10908274 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
Cool, that looks sensical to me. I like how I don't have to actually have the stars in my html file. But one thing - the isEnabled() method does not exist in the AbstractBehavior class. But I think the following will work: label.add(new AbstractBehavior() { @Override public void onRendered(Component component) { if (starIsVisible) { Response response = component.getResponse(); response.write(span id='foo' class='bar'*/span); } } }); On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Lowell, Sorry for my bad answers today, I was doing too many things at the same time, and now that I re-read your use case I think I understand better what you want. If I'm correct, you want to decorate a label with a star, and use some css class or id with that star and have the ability to turn the star off or on depending on a condition. Disregard the rest of the thread, because indeed Labels (or any component replacing their bodies) don't allow nested components. Your best choice is to use a behavior: label.add(new AbstractBehavior() { @Override public boolean isEnabled(Component component) { return myCondition(); } @Override public void onRendered(Component component) { Response response = component.getResponse(); response.write(span id='foo' class='bar'*/span); } }); The behavior writes directly to the response (after the component itself is rendered) and the visibility can be steered using isEnabled. Do note that if it wasn't for the fact that you're trying to decorate labels, you could have used Borders instead of a behavior. Not to say that this is better, just be aware of the alternative (in case you are annotating markupcontainers). Hope this helps, Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
But one thing - the isEnabled() method does not exist in the AbstractBehavior class. public boolean isEnabled(Component component) is defined in both the IBehavior interface and implemented (default) in AbstractBehavior. It's in 1.3 though. But I think the following will work: label.add(new AbstractBehavior() { @Override public void onRendered(Component component) { if (starIsVisible) { Response response = component.getResponse(); response.write(span id='foo' class='bar'*/span); } } }); Sure, that'll work too. Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
Cool. So no need to 'add' it? On 5/30/07, Eelco Hillenius [EMAIL PROTECTED] wrote: new WebMarkupContainer(removeMe) { protected void onBeforeRender() { super.onBeforeRender(); setVisible(sometimesFalse()); } } That, or alternatively, new WebMarkupContainer(removeMe) { public boolean isVisible() { return sometimesFalse(); } } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
On Thu, 31 May 2007, Lowell Kirsh wrote: Cool. So no need to 'add' it? Yes of course. You must add to a parent every component that you want to render, otherwise it's just garbage (for the JVM). - Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? Thanks Lowell On 5/30/07, Timo Rantalaiho [EMAIL PROTECTED] wrote: On Wed, 30 May 2007, Lowell Kirsh wrote: I making a web page which contains some markup that I'd like to remove (sometimes). I imagine it would look like: ... span wicket:id=removeMeHello bW/borld/span ... Is it possible to remove this markup? new WebMarkupContainer(removeMe) { protected void onBeforeRender() { super.onBeforeRender(); setVisible(sometimesFalse()); } } - Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
LabelWithStar should extend Panel. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
Well, I need some way of setting the text from within my java code so i don't see how I could get away without it. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Actually, do you need span wicket:id=foo at all? Eelco On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: LabelWithStar should extend Panel. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net
Re: [Wicket-user] Is it possible to remove something from a page?
And which Panel method do I need to call to set its text without removing the star Component? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: LabelWithStar should extend Panel. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it
Re: [Wicket-user] Is it possible to remove something from a page?
Actually, do you need span wicket:id=foo at all? Eelco On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: LabelWithStar should extend Panel. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
Re: [Wicket-user] Is it possible to remove something from a page?
Basically what I want to do is from this markup: span wicket:id=fooTEXTspan wicket:id=star*span/span I'd like to replace 'TEXT' with some text from my java code, and would like to set the visibility of the 'star' span from within my code. Replacing TEXT seems similar to what a Label does, but a Label won't support the embedded 'star' span. So I tried to mimic Label my creating my own component (I tried WebMarkupContainer) and mimic the behavior of Label, but also allow for the embedded component. So I tried to override the onComponentTagBody() method with one that calls replaceComponentTagBody() but that didn't work because that removed the 'star' span. So what I'd really like to do would be to create my custom component and somehow tell it to replace the text of its body (ie. the 'TEXT') but to do so without removing child components. Make sense? On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: And which Panel method do I need to call to set its text without removing the star Component? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: LabelWithStar should extend Panel. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express
Re: [Wicket-user] Is it possible to remove something from a page?
Oh, if this helps, what I want could be achieved with this: span wicket:id=foobar span wicket:id=textTEXT/span span wicket:id=star*/span /span and then doing something like: foobar = new MarkupContainer(foobar); foobar.add(new Label(text, ...)) foobar.add(new WebMarkupContainer(removeMe) { public boolean isVisible() { return sometimesFalse(); } }); add(foobar); but I find the template html to be less readable in this case and was hoping to not have to do it this way. Lowell On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Basically what I want to do is from this markup: span wicket:id=fooTEXTspan wicket:id=star*span/span I'd like to replace 'TEXT' with some text from my java code, and would like to set the visibility of the 'star' span from within my code. Replacing TEXT seems similar to what a Label does, but a Label won't support the embedded 'star' span. So I tried to mimic Label my creating my own component (I tried WebMarkupContainer) and mimic the behavior of Label, but also allow for the embedded component. So I tried to override the onComponentTagBody() method with one that calls replaceComponentTagBody() but that didn't work because that removed the 'star' span. So what I'd really like to do would be to create my custom component and somehow tell it to replace the text of its body (ie. the 'TEXT') but to do so without removing child components. Make sense? On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: And which Panel method do I need to call to set its text without removing the star Component? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: LabelWithStar should extend Panel. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: But I get the following error: ...WicketMessage: Expected close tag for 'span wicket:id=foobar' Possible attempt to embed component(s) 'span wicket:id=star' in the body of this component which discards its body Doesn't that mean my approach is flawed? On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: Then you should be able to use that label idea and embed it in your component. Eelco On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: Once again I left out a detail - the reason I have the span is that I want to apply a CSS class to the star. Also, I like to have the star as a child of the other component, because that way I don't have to assign unique names to each star, and also, I can package the text and the star as one object type (or just use a single method to deal with both at once) so that I don't have duplicated code. On 5/31/07, Eelco Hillenius [EMAIL PROTECTED] wrote: On 5/31/07, Lowell Kirsh [EMAIL PROTECTED] wrote: My use case is actually turning out slightly more complex than I posted. What I actually have is: span wicket:id=fooTEXTspan wicket:id=star*/spanspan and I'd like to sometimes remove the star. So my java (which doesn't work) looks like: private static class LabelWithStar extends WebMarkupContainer { public LabelWithStar(String id, String model, final boolean starIsVisible) { super(id, new Model(model)); this.add(new WebMarkupContainer(star) { public boolean isVisible() { return starIsVisible; } }); } protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, getModelObjectAsString()); } } This doesn't work because the call to replaceComponentTagBody() removes the span with the star. How should I be doing this instead? You mean you need to have the span? Why is that? Alternatively, you can do something like add(new Label(star, new AbstractReadOnlyModel() { @Override public Object getObject() { return isStarVisible() ? * : ; } })); } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net
Re: [Wicket-user] Is it possible to remove something from a page?
Some CSS gurus claim that CSS could be used to append or prepend content to elements, so maybe you would be easier off by doing just that and toggling the css class programmatically. That would work. I tried googling how to do that, with no luck. Anybody have any pointers or links? lowell - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
On Wed, 30 May 2007, Lowell Kirsh wrote: I making a web page which contains some markup that I'd like to remove (sometimes). I imagine it would look like: ... span wicket:id=removeMeHello bW/borld/span ... Is it possible to remove this markup? new WebMarkupContainer(removeMe) { protected void onBeforeRender() { super.onBeforeRender(); setVisible(sometimesFalse()); } } - Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Is it possible to remove something from a page?
new WebMarkupContainer(removeMe) { protected void onBeforeRender() { super.onBeforeRender(); setVisible(sometimesFalse()); } } That, or alternatively, new WebMarkupContainer(removeMe) { public boolean isVisible() { return sometimesFalse(); } } Eelco - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user