Re: WebMarkupContainer without template markup

2007-09-09 Thread Scott Swank
We're choosing an item from a list and then using ajax to populate a
view of the item, together with a listview of purchasable details.
For any given item there may or may not be images.  Either managing
the relevant components in a page-level collection or using a visitor
to find them works.  The key to the solution is:

1. they are all in a panel
2. that panel must be an ajax target
3. the logic to determine whether they are visible must be in the
onbeforereneder method of that panel

Thanks all.

- Scott

On 9/8/07, Ryan Holmes [EMAIL PROTECTED] wrote:

 On Sep 7, 2007, at 8:52 PM, Carlos Pita wrote:

  You can also make the components to hide implement some listener (or
  just marker) interface X and then do a visitChildren traversal from
  page.onBeforeRender as follows:
 
  visitChildren(X.class, new IVisitor() {
public Object component(Component component) {
  comp.setVisible(your visibility logic here);
}
  });
 
  This is less centralized that keeping a list at the top level, if you
  care about this.
 
  Regards,
  Carlos
 
 

 Damn. I just now recommended the same thing. Sorry, didn't notice
 your post.

 This approach definitely seems cleaner than managing a list of
 component references -- I wonder if it works for Scott...

 -Ryan

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WebMarkupContainer without template markup

2007-09-08 Thread Ryan Holmes
How about using an IVisitor to call setVisible() on the image  
components? That way, you wouldn't need to keep an explicit reference  
to those image components. You could trigger the visitor in  
onBeforeRender() and you could use a marker interface to identify the  
image components whose visibility should be changed (called  
'IOptionalImage' in the example below). Something like:


public class OptionalImageVisitor implements IVisitor {
private boolean visible;

public OptionalImageVisitor(boolean visible) {
this.visible = visible;
}

public Object component(Component component) {
component.setVisible(this.visible);
}

}

public class MyPage {
public onBeforeRender() {
		boolean imagesVisible =  ...logic to determine whether images are  
visible
		visitChildren(IOptionalImage.class, new OptionalImageVisitor 
(imagesVisible);

}
}

-Ryan

On Sep 7, 2007, at 1:41 PM, Scott Swank wrote:


Matej,

My issue isn't that the div is rendered, but rather that I have to add
it to the html file in the first place.  I think that I could
implement this as a Behavior, but for this problem I just went ahead
and added div tags around the relevant components.

Thanks again,
Scott

On 9/7/07, Matej Knopp [EMAIL PROTECTED] wrote:

Can't you just call webmarkupcontainer.setRenderBodyOnly(true) ?

-Matej

On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:

I get what you're saying, but the images in question are scattered
across the page rather than in one place that could simply be
enclosed.  Thank you none the less, I do appreciate the insight.

Cheers,
Scott


On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:

well, thats kinda the point of the enclosure...

it lets you group components together inside it, and let one of  
those

components drive the visibility of the entire enclosure

-igor


On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:


I could, but it's kind of the opposite of what I want.  I want to
_not_ have to add an enclosing tag to the relevant portions of the
html template.  So I don't mind coding a WebMarkupContainer --  
I just

want to avoid having to change:

  span wicket:id=foo/span

to

  div wicket:id=fooContainerspan wicket:id=foo/span/ 
div


The basic problem is that sometimes we have a set of images for a
product (scattered across a few components) and sometimes we  
don't.
My thought is to wrap all of the relevant images in such a  
container

that knows how to determine isVisible().

Scott

On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
you can prob port enclosure to 1.2.6 yourself if you wanted it  
badly


-igor


On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:


Pity we're not on 1.3 yet.  Thank you though.

Scott

On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:

no, but you can try wicket:enclosure tag. see javadoc on

Enclosure.java


-igor



On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:


I want to make a few parts of my page visible or not in a

consistent
manner -- i.e. based on the same true/false result, which I  
derive

from my model.  Can I wrap the relevant components in
WebMarkupContainer without adding a matching div tag to my

markup?


Thank you,
Scott


 
-

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--
Scott Swank
reformed mathematician

-- 
---

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--
Scott Swank
reformed mathematician

 
-

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WebMarkupContainer without template markup

2007-09-08 Thread Ryan Holmes


On Sep 7, 2007, at 8:52 PM, Carlos Pita wrote:


You can also make the components to hide implement some listener (or
just marker) interface X and then do a visitChildren traversal from
page.onBeforeRender as follows:

visitChildren(X.class, new IVisitor() {
  public Object component(Component component) {
comp.setVisible(your visibility logic here);
  }
});

This is less centralized that keeping a list at the top level, if you
care about this.

Regards,
Carlos




Damn. I just now recommended the same thing. Sorry, didn't notice  
your post.


This approach definitely seems cleaner than managing a list of  
component references -- I wonder if it works for Scott...


-Ryan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



WebMarkupContainer without template markup

2007-09-07 Thread Scott Swank
I want to make a few parts of my page visible or not in a consistent
manner -- i.e. based on the same true/false result, which I derive
from my model.  Can I wrap the relevant components in
WebMarkupContainer without adding a matching div tag to my markup?

Thank you,
Scott

-- 
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WebMarkupContainer without template markup

2007-09-07 Thread Igor Vaynberg
no, but you can try wicket:enclosure tag. see javadoc on Enclosure.java

-igor



On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:

 I want to make a few parts of my page visible or not in a consistent
 manner -- i.e. based on the same true/false result, which I derive
 from my model.  Can I wrap the relevant components in
 WebMarkupContainer without adding a matching div tag to my markup?

 Thank you,
 Scott

 --
 Scott Swank
 reformed mathematician

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: WebMarkupContainer without template markup

2007-09-07 Thread Igor Vaynberg
you can prob port enclosure to 1.2.6 yourself if you wanted it badly

-igor


On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:

 Pity we're not on 1.3 yet.  Thank you though.

 Scott

 On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
  no, but you can try wicket:enclosure tag. see javadoc on Enclosure.java
 
  -igor
 
 
 
  On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
  
   I want to make a few parts of my page visible or not in a consistent
   manner -- i.e. based on the same true/false result, which I derive
   from my model.  Can I wrap the relevant components in
   WebMarkupContainer without adding a matching div tag to my markup?
  
   Thank you,
   Scott

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: WebMarkupContainer without template markup

2007-09-07 Thread Igor Vaynberg
well, thats kinda the point of the enclosure...

it lets you group components together inside it, and let one of those
components drive the visibility of the entire enclosure

-igor


On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:

 I could, but it's kind of the opposite of what I want.  I want to
 _not_ have to add an enclosing tag to the relevant portions of the
 html template.  So I don't mind coding a WebMarkupContainer -- I just
 want to avoid having to change:

   span wicket:id=foo/span

 to

   div wicket:id=fooContainerspan wicket:id=foo/span/div

 The basic problem is that sometimes we have a set of images for a
 product (scattered across a few components) and sometimes we don't.
 My thought is to wrap all of the relevant images in such a container
 that knows how to determine isVisible().

 Scott

 On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
  you can prob port enclosure to 1.2.6 yourself if you wanted it badly
 
  -igor
 
 
  On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
  
   Pity we're not on 1.3 yet.  Thank you though.
  
   Scott
  
   On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
no, but you can try wicket:enclosure tag. see javadoc on
 Enclosure.java
   
-igor
   
   
   
On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:

 I want to make a few parts of my page visible or not in a
 consistent
 manner -- i.e. based on the same true/false result, which I derive
 from my model.  Can I wrap the relevant components in
 WebMarkupContainer without adding a matching div tag to my
 markup?

 Thank you,
 Scott
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 


 --
 Scott Swank
 reformed mathematician

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: WebMarkupContainer without template markup

2007-09-07 Thread Scott Swank
I get what you're saying, but the images in question are scattered
across the page rather than in one place that could simply be
enclosed.  Thank you none the less, I do appreciate the insight.

Cheers,
Scott


On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 well, thats kinda the point of the enclosure...

 it lets you group components together inside it, and let one of those
 components drive the visibility of the entire enclosure

 -igor


 On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
 
  I could, but it's kind of the opposite of what I want.  I want to
  _not_ have to add an enclosing tag to the relevant portions of the
  html template.  So I don't mind coding a WebMarkupContainer -- I just
  want to avoid having to change:
 
span wicket:id=foo/span
 
  to
 
div wicket:id=fooContainerspan wicket:id=foo/span/div
 
  The basic problem is that sometimes we have a set of images for a
  product (scattered across a few components) and sometimes we don't.
  My thought is to wrap all of the relevant images in such a container
  that knows how to determine isVisible().
 
  Scott
 
  On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
   you can prob port enclosure to 1.2.6 yourself if you wanted it badly
  
   -igor
  
  
   On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
   
Pity we're not on 1.3 yet.  Thank you though.
   
Scott
   
On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 no, but you can try wicket:enclosure tag. see javadoc on
  Enclosure.java

 -igor



 On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
 
  I want to make a few parts of my page visible or not in a
  consistent
  manner -- i.e. based on the same true/false result, which I derive
  from my model.  Can I wrap the relevant components in
  WebMarkupContainer without adding a matching div tag to my
  markup?
 
  Thank you,
  Scott
   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
 
 
  --
  Scott Swank
  reformed mathematician
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



-- 
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WebMarkupContainer without template markup

2007-09-07 Thread Matej Knopp
Can't you just call webmarkupcontainer.setRenderBodyOnly(true) ?

-Matej

On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
 I get what you're saying, but the images in question are scattered
 across the page rather than in one place that could simply be
 enclosed.  Thank you none the less, I do appreciate the insight.

 Cheers,
 Scott


 On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
  well, thats kinda the point of the enclosure...
 
  it lets you group components together inside it, and let one of those
  components drive the visibility of the entire enclosure
 
  -igor
 
 
  On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
  
   I could, but it's kind of the opposite of what I want.  I want to
   _not_ have to add an enclosing tag to the relevant portions of the
   html template.  So I don't mind coding a WebMarkupContainer -- I just
   want to avoid having to change:
  
 span wicket:id=foo/span
  
   to
  
 div wicket:id=fooContainerspan wicket:id=foo/span/div
  
   The basic problem is that sometimes we have a set of images for a
   product (scattered across a few components) and sometimes we don't.
   My thought is to wrap all of the relevant images in such a container
   that knows how to determine isVisible().
  
   Scott
  
   On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
you can prob port enclosure to 1.2.6 yourself if you wanted it badly
   
-igor
   
   
On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:

 Pity we're not on 1.3 yet.  Thank you though.

 Scott

 On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
  no, but you can try wicket:enclosure tag. see javadoc on
   Enclosure.java
 
  -igor
 
 
 
  On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
  
   I want to make a few parts of my page visible or not in a
   consistent
   manner -- i.e. based on the same true/false result, which I derive
   from my model.  Can I wrap the relevant components in
   WebMarkupContainer without adding a matching div tag to my
   markup?
  
   Thank you,
   Scott

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


   
  
  
   --
   Scott Swank
   reformed mathematician
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 


 --
 Scott Swank
 reformed mathematician

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: WebMarkupContainer without template markup

2007-09-07 Thread Scott Swank
Matej,

My issue isn't that the div is rendered, but rather that I have to add
it to the html file in the first place.  I think that I could
implement this as a Behavior, but for this problem I just went ahead
and added div tags around the relevant components.

Thanks again,
Scott

On 9/7/07, Matej Knopp [EMAIL PROTECTED] wrote:
 Can't you just call webmarkupcontainer.setRenderBodyOnly(true) ?

 -Matej

 On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
  I get what you're saying, but the images in question are scattered
  across the page rather than in one place that could simply be
  enclosed.  Thank you none the less, I do appreciate the insight.
 
  Cheers,
  Scott
 
 
  On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
   well, thats kinda the point of the enclosure...
  
   it lets you group components together inside it, and let one of those
   components drive the visibility of the entire enclosure
  
   -igor
  
  
   On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
   
I could, but it's kind of the opposite of what I want.  I want to
_not_ have to add an enclosing tag to the relevant portions of the
html template.  So I don't mind coding a WebMarkupContainer -- I just
want to avoid having to change:
   
  span wicket:id=foo/span
   
to
   
  div wicket:id=fooContainerspan wicket:id=foo/span/div
   
The basic problem is that sometimes we have a set of images for a
product (scattered across a few components) and sometimes we don't.
My thought is to wrap all of the relevant images in such a container
that knows how to determine isVisible().
   
Scott
   
On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 you can prob port enclosure to 1.2.6 yourself if you wanted it badly

 -igor


 On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
 
  Pity we're not on 1.3 yet.  Thank you though.
 
  Scott
 
  On 9/7/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
   no, but you can try wicket:enclosure tag. see javadoc on
Enclosure.java
  
   -igor
  
  
  
   On 9/7/07, Scott Swank [EMAIL PROTECTED] wrote:
   
I want to make a few parts of my page visible or not in a
consistent
manner -- i.e. based on the same true/false result, which I 
derive
from my model.  Can I wrap the relevant components in
WebMarkupContainer without adding a matching div tag to my
markup?
   
Thank you,
Scott
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

   
   
--
Scott Swank
reformed mathematician
   
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
 
 
  --
  Scott Swank
  reformed mathematician
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Scott Swank
reformed mathematician

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]