ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread Nino Saturnino Martinez Vazquez Wael
Sure there a dozens of ways todo this, mine is just one of them. Im 
starting a new thread since it'll be more exposed then.


The idea is following:

Parent:

public class BasePage extends WebPage {

   protected final String LINK_LABEL_ID = linkText;
   protected final String LINK_ID = link;

   protected final String FOOTER_ID = item;
   protected final String HEADER_ID = item;

   protected ListWebMarkupContainer generalAccordionItem = new 
ArrayListWebMarkupContainer();


   protected ListWebMarkupContainer footer = new 
ArrayListWebMarkupContainer();
  
   protected ListWebMarkupContainer header = new 
ArrayListWebMarkupContainer();


   private AccordionPanel accordionPanel;

   /**
* Constructor that is invoked when page is invoked without a session.
*
* @param parameters
*Page parameters
*/
   public BasePage() {
   accordionPanel = new AccordionPanel(accordionMenu);
   add(accordionPanel);

   add(new ListView(footerContent, footer) {
   @Override
   protected void populateItem(ListItem item) {
   WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

   .getModelObject();
   item.add(webMarkupContainer);

   }
   });
   add(new ListView(headerContent, header) {
   @Override
   protected void populateItem(ListItem item) {
   WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

   .getModelObject();
   item.add(webMarkupContainer);

   }
   });

}
   protected void addMenu(AccordionPanelItem accordionPanelItem) {
   accordionPanel.addMenu(accordionPanelItem);
   };

   protected void addFooter(WebMarkupContainer webMarkupContainer) {
   footer.add(webMarkupContainer);
   };
   protected void addHeader(WebMarkupContainer webMarkupContainer) {
   header.add(webMarkupContainer);
   };

Subs/Children then calls the methods... Problem with this technique is 
that you need to use the right markup id's.. To make sure they are 
always set, and giving full control to the child/sub on what to add, I'd 
suggest that you create a BasePanel which encapsules the id, and then 
required that instead of a markupcontainer, that way subs/child only 
need to have panels that extend the basepanel...


But it depends on your needs, mine weren't that tricky..


regards Nino


Jonathan Locke wrote:

could you share this technique?  i think this might be a good idea.


Nino.Martinez wrote:
  
On the other hand, I've also done something with listviews.. Allowing 
sub pages adding markup items to menus etc Using the listviews as 
place holders...


Kaspar Fischer wrote:


Ah, 'course! Should have thought of it, that's an option they mention
in Wicket in Action.

However, Sebastiaan's solution can be reused in places where the markup
you have to change is not in head. -- Good to know.

On 04.03.2008, at 15:27, richardwilko wrote:

  
The way I do it is; dont specify a title in your base page then just 
add the

title in the subpage:

base page.html
html
!-- anything shared in all the pages eg a base.css file --
head
/head
body
   wicket:child/
/body
/html

subpage.html:

wicket:head
titlehard code or use wicket label to add this/title
/wicket:head
wicket:extend
  !-- anything ... --
/wicket:extend

subpage.java

Richard



hbf wrote:


I am using markup inheritance (wicket:child and wicket:extend)
and need to set the
page title from my subpage. I currently add a label in the base class
(BasePage.java)
and make it use an abstract method getTitle(), which is overridden in
the subclass
(SubPage.java). Has anybody found a better way?

Here's my solution:

!-- BasePage.html --
html
head
   title wicket:id=title[Page title]/title
/head
body
   wicket:child/
/body
/html

!-- SubPage.html --
wicket:extend
   !-- anything ... --
/wicket:extend


public abstract class BasePage extends WebPage
{
   // ...
   public BasePage(final PageParameters parameters)
   {
 add(new Label(title, new PropertyModel(this, title)));
   }
   public abstract String getTitle();
}

public class SubPage extends BasePage
{
   // ...
   public String getTitle()
   {
 return whatever title;
   }
}

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



  

--
View this message in context: 
http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15828280.html 


Sent from the Wicket - User mailing list archive at Nabble.com.


-
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: ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread Nino Saturnino Martinez Vazquez Wael

EEK!, I'll try once more to create a new thread!

Nino Saturnino Martinez Vazquez Wael wrote:
Sure there a dozens of ways todo this, mine is just one of them. Im 
starting a new thread since it'll be more exposed then.


The idea is following:

Parent:

public class BasePage extends WebPage {

   protected final String LINK_LABEL_ID = linkText;
   protected final String LINK_ID = link;

   protected final String FOOTER_ID = item;
   protected final String HEADER_ID = item;

   protected ListWebMarkupContainer generalAccordionItem = new 
ArrayListWebMarkupContainer();


   protected ListWebMarkupContainer footer = new 
ArrayListWebMarkupContainer();
 protected ListWebMarkupContainer header = new 
ArrayListWebMarkupContainer();


   private AccordionPanel accordionPanel;

   /**
* Constructor that is invoked when page is invoked without a session.
*
* @param parameters
*Page parameters
*/
   public BasePage() {
   accordionPanel = new AccordionPanel(accordionMenu);
   add(accordionPanel);

   add(new ListView(footerContent, footer) {
   @Override
   protected void populateItem(ListItem item) {
   WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

   .getModelObject();
   item.add(webMarkupContainer);

   }
   });
   add(new ListView(headerContent, header) {
   @Override
   protected void populateItem(ListItem item) {
   WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

   .getModelObject();
   item.add(webMarkupContainer);

   }
   });

}
   protected void addMenu(AccordionPanelItem accordionPanelItem) {
   accordionPanel.addMenu(accordionPanelItem);
   };

   protected void addFooter(WebMarkupContainer webMarkupContainer) {
   footer.add(webMarkupContainer);
   };
   protected void addHeader(WebMarkupContainer webMarkupContainer) {
   header.add(webMarkupContainer);
   };

Subs/Children then calls the methods... Problem with this technique is 
that you need to use the right markup id's.. To make sure they are 
always set, and giving full control to the child/sub on what to add, 
I'd suggest that you create a BasePanel which encapsules the id, and 
then required that instead of a markupcontainer, that way subs/child 
only need to have panels that extend the basepanel...


But it depends on your needs, mine weren't that tricky..


regards Nino


Jonathan Locke wrote:

could you share this technique?  i think this might be a good idea.


Nino.Martinez wrote:
 
On the other hand, I've also done something with listviews.. 
Allowing sub pages adding markup items to menus etc Using the 
listviews as place holders...


Kaspar Fischer wrote:
   

Ah, 'course! Should have thought of it, that's an option they mention
in Wicket in Action.

However, Sebastiaan's solution can be reused in places where the 
markup

you have to change is not in head. -- Good to know.

On 04.03.2008, at 15:27, richardwilko wrote:

 
The way I do it is; dont specify a title in your base page then 
just add the

title in the subpage:

base page.html
html
!-- anything shared in all the pages eg a base.css file --
head
/head
body
   wicket:child/
/body
/html

subpage.html:

wicket:head
titlehard code or use wicket label to add this/title
/wicket:head
wicket:extend
  !-- anything ... --
/wicket:extend

subpage.java

Richard



hbf wrote:
   

I am using markup inheritance (wicket:child and wicket:extend)
and need to set the
page title from my subpage. I currently add a label in the base 
class

(BasePage.java)
and make it use an abstract method getTitle(), which is 
overridden in

the subclass
(SubPage.java). Has anybody found a better way?

Here's my solution:

!-- BasePage.html --
html
head
   title wicket:id=title[Page title]/title
/head
body
   wicket:child/
/body
/html

!-- SubPage.html --
wicket:extend
   !-- anything ... --
/wicket:extend


public abstract class BasePage extends WebPage
{
   // ...
   public BasePage(final PageParameters parameters)
   {
 add(new Label(title, new PropertyModel(this, title)));
   }
   public abstract String getTitle();
}

public class SubPage extends BasePage
{
   // ...
   public String getTitle()
   {
 return whatever title;
   }
}

- 


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



  

--
View this message in context: 
http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15828280.html 


Sent from the Wicket - User mailing list archive at Nabble.com.


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



-

ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread Nino Saturnino Martinez Vazquez Wael
Sure there a dozens of ways todo this, mine is just one of them. Im 
starting a new thread since it'll be more exposed then.


The idea is following:

Parent:

public class BasePage extends WebPage {

  protected final String LINK_LABEL_ID = linkText;
  protected final String LINK_ID = link;

  protected final String FOOTER_ID = item;
  protected final String HEADER_ID = item;

  protected ListWebMarkupContainer generalAccordionItem = new 
ArrayListWebMarkupContainer();


  protected ListWebMarkupContainer footer = new 
ArrayListWebMarkupContainer();
protected ListWebMarkupContainer header = new 
ArrayListWebMarkupContainer();


  private AccordionPanel accordionPanel;

  /**
   * Constructor that is invoked when page is invoked without a session.
   *
   * @param parameters
   *Page parameters
   */
  public BasePage() {
  accordionPanel = new AccordionPanel(accordionMenu);
  add(accordionPanel);

  add(new ListView(footerContent, footer) {
  @Override
  protected void populateItem(ListItem item) {
  WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

  .getModelObject();
  item.add(webMarkupContainer);

  }
  });
  add(new ListView(headerContent, header) {
  @Override
  protected void populateItem(ListItem item) {
  WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

  .getModelObject();
  item.add(webMarkupContainer);

  }
  });

}
  protected void addMenu(AccordionPanelItem accordionPanelItem) {
  accordionPanel.addMenu(accordionPanelItem);
  };

  protected void addFooter(WebMarkupContainer webMarkupContainer) {
  footer.add(webMarkupContainer);
  };
  protected void addHeader(WebMarkupContainer webMarkupContainer) {
  header.add(webMarkupContainer);
  };

Subs/Children then calls the methods... Problem with this technique is 
that you need to use the right markup id's.. To make sure they are 
always set, and giving full control to the child/sub on what to add, I'd 
suggest that you create a BasePanel which encapsules the id, and then 
required that instead of a markupcontainer, that way subs/child only 
need to have panels that extend the basepanel...


But it depends on your needs, mine weren't that tricky..


regards Nino

--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread James Carman
On 3/5/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote:
 Sure there a dozens of ways todo this, mine is just one of them. Im
  starting a new thread since it'll be more exposed then.

  The idea is following:

  Parent:

  public class BasePage extends WebPage {

 protected final String LINK_LABEL_ID = linkText;
 protected final String LINK_ID = link;

 protected final String FOOTER_ID = item;
 protected final String HEADER_ID = item;

 protected ListWebMarkupContainer generalAccordionItem = new
  ArrayListWebMarkupContainer();

 protected ListWebMarkupContainer footer = new
  ArrayListWebMarkupContainer();

 protected ListWebMarkupContainer header = new
  ArrayListWebMarkupContainer();

 private AccordionPanel accordionPanel;

 /**
  * Constructor that is invoked when page is invoked without a session.
  *
  * @param parameters
  *Page parameters
  */
 public BasePage() {
 accordionPanel = new AccordionPanel(accordionMenu);
 add(accordionPanel);

 add(new ListView(footerContent, footer) {
 @Override
 protected void populateItem(ListItem item) {
 WebMarkupContainer webMarkupContainer =
  (WebMarkupContainer) item
 .getModelObject();
 item.add(webMarkupContainer);

 }
 });
 add(new ListView(headerContent, header) {
 @Override
 protected void populateItem(ListItem item) {
 WebMarkupContainer webMarkupContainer =
  (WebMarkupContainer) item
 .getModelObject();
 item.add(webMarkupContainer);

 }
 });

  }
 protected void addMenu(AccordionPanelItem accordionPanelItem) {
 accordionPanel.addMenu(accordionPanelItem);
 };

 protected void addFooter(WebMarkupContainer webMarkupContainer) {
 footer.add(webMarkupContainer);
 };
 protected void addHeader(WebMarkupContainer webMarkupContainer) {
 header.add(webMarkupContainer);
 };

  Subs/Children then calls the methods... Problem with this technique is
  that you need to use the right markup id's.. To make sure they are
  always set, and giving full control to the child/sub on what to add, I'd
  suggest that you create a BasePanel which encapsules the id, and then
  required that instead of a markupcontainer, that way subs/child only
  need to have panels that extend the basepanel...


Couldn't you use a VelocityPanel to generate your markup and have it
parse the markup after it's generated to avoid the whole need to use
the right markup ids part?  I was thinking about doing something like
this for generating dynamic editor forms (a la Trails) for objects,
since Wicket doesn't like you putting TextFields on spans (you must
use an input tag).  I was going to have a Velocity script that
decides what type of tag to spit out based on the type of component in
the list.

  But it depends on your needs, mine weren't that tricky..


  regards Nino


  Jonathan Locke wrote:
   could you share this technique?  i think this might be a good idea.
  
  
   Nino.Martinez wrote:
  
   On the other hand, I've also done something with listviews.. Allowing
   sub pages adding markup items to menus etc Using the listviews as
   place holders...
  
   Kaspar Fischer wrote:
  
   Ah, 'course! Should have thought of it, that's an option they mention
   in Wicket in Action.
  
   However, Sebastiaan's solution can be reused in places where the markup
   you have to change is not in head. -- Good to know.
  
   On 04.03.2008, at 15:27, richardwilko wrote:
  
  
   The way I do it is; dont specify a title in your base page then just
   add the
   title in the subpage:
  
   base page.html
   html
   !-- anything shared in all the pages eg a base.css file --
   head
   /head
   body
  wicket:child/
   /body
   /html
  
   subpage.html:
  
   wicket:head
   titlehard code or use wicket label to add this/title
   /wicket:head
   wicket:extend
 !-- anything ... --
   /wicket:extend
  
   subpage.java
  
   Richard
  
  
  
   hbf wrote:
  
   I am using markup inheritance (wicket:child and wicket:extend)
   and need to set the
   page title from my subpage. I currently add a label in the base class
   (BasePage.java)
   and make it use an abstract method getTitle(), which is overridden in
   the subclass
   (SubPage.java). Has anybody found a better way?
  
   Here's my solution:
  
   !-- BasePage.html --
   html
   head
  title wicket:id=title[Page title]/title
   /head
   body
  wicket:child/
   /body
   /html
  
   !-- SubPage.html --
   wicket:extend
  !-- anything ... --
   /wicket:extend
  
  
   public abstract class BasePage extends WebPage
   {
  // ...
  public BasePage(final PageParameters parameters)
  {
add(new Label(title, new PropertyModel(this, title)));
  }

Re: ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread Nino Saturnino Martinez Vazquez Wael



James Carman wrote:

On 3/5/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote:
  

Sure there a dozens of ways todo this, mine is just one of them. Im
 starting a new thread since it'll be more exposed then.

 The idea is following:

 Parent:

 public class BasePage extends WebPage {

protected final String LINK_LABEL_ID = linkText;
protected final String LINK_ID = link;

protected final String FOOTER_ID = item;
protected final String HEADER_ID = item;

protected ListWebMarkupContainer generalAccordionItem = new
 ArrayListWebMarkupContainer();

protected ListWebMarkupContainer footer = new
 ArrayListWebMarkupContainer();

protected ListWebMarkupContainer header = new
 ArrayListWebMarkupContainer();

private AccordionPanel accordionPanel;

/**
 * Constructor that is invoked when page is invoked without a session.
 *
 * @param parameters
 *Page parameters
 */
public BasePage() {
accordionPanel = new AccordionPanel(accordionMenu);
add(accordionPanel);

add(new ListView(footerContent, footer) {
@Override
protected void populateItem(ListItem item) {
WebMarkupContainer webMarkupContainer =
 (WebMarkupContainer) item
.getModelObject();
item.add(webMarkupContainer);

}
});
add(new ListView(headerContent, header) {
@Override
protected void populateItem(ListItem item) {
WebMarkupContainer webMarkupContainer =
 (WebMarkupContainer) item
.getModelObject();
item.add(webMarkupContainer);

}
});

 }
protected void addMenu(AccordionPanelItem accordionPanelItem) {
accordionPanel.addMenu(accordionPanelItem);
};

protected void addFooter(WebMarkupContainer webMarkupContainer) {
footer.add(webMarkupContainer);
};
protected void addHeader(WebMarkupContainer webMarkupContainer) {
header.add(webMarkupContainer);
};

 Subs/Children then calls the methods... Problem with this technique is
 that you need to use the right markup id's.. To make sure they are
 always set, and giving full control to the child/sub on what to add, I'd
 suggest that you create a BasePanel which encapsules the id, and then
 required that instead of a markupcontainer, that way subs/child only
 need to have panels that extend the basepanel...




Couldn't you use a VelocityPanel to generate your markup and have it
parse the markup after it's generated to avoid the whole need to use
the right markup ids part?  I was thinking about doing something like
this for generating dynamic editor forms (a la Trails) for objects,
since Wicket doesn't like you putting TextFields on spans (you must
use an input tag).  I was going to have a Velocity script that
decides what type of tag to spit out based on the type of component in
the list.

  

i'll reply in the other thread...

 But it depends on your needs, mine weren't that tricky..


 regards Nino


 Jonathan Locke wrote:
  could you share this technique?  i think this might be a good idea.
 
 
  Nino.Martinez wrote:
 
  On the other hand, I've also done something with listviews.. Allowing
  sub pages adding markup items to menus etc Using the listviews as
  place holders...
 
  Kaspar Fischer wrote:
 
  Ah, 'course! Should have thought of it, that's an option they mention
  in Wicket in Action.
 
  However, Sebastiaan's solution can be reused in places where the markup
  you have to change is not in head. -- Good to know.
 
  On 04.03.2008, at 15:27, richardwilko wrote:
 
 
  The way I do it is; dont specify a title in your base page then just
  add the
  title in the subpage:
 
  base page.html
  html
  !-- anything shared in all the pages eg a base.css file --
  head
  /head
  body
 wicket:child/
  /body
  /html
 
  subpage.html:
 
  wicket:head
  titlehard code or use wicket label to add this/title
  /wicket:head
  wicket:extend
!-- anything ... --
  /wicket:extend
 
  subpage.java
 
  Richard
 
 
 
  hbf wrote:
 
  I am using markup inheritance (wicket:child and wicket:extend)
  and need to set the
  page title from my subpage. I currently add a label in the base class
  (BasePage.java)
  and make it use an abstract method getTitle(), which is overridden in
  the subclass
  (SubPage.java). Has anybody found a better way?
 
  Here's my solution:
 
  !-- BasePage.html --
  html
  head
 title wicket:id=title[Page title]/title
  /head
  body
 wicket:child/
  /body
  /html
 
  !-- SubPage.html --
  wicket:extend
 !-- anything ... --
  /wicket:extend
 
 
  public abstract class BasePage extends WebPage
  {
 // ...
 public BasePage(final PageParameters parameters)
 {
   add(new Label(title, new PropertyModel(this, title)));
 }
 public abstract String getTitle();
  }
 
  public class SubPage extends 

Re: ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread Nino Saturnino Martinez Vazquez Wael

Answer below:

   James Carman Wrote:

   Couldn't you use a VelocityPanel to generate your markup and have it
   parse the markup after it's generated to avoid the whole need to use
   the right markup ids part? I was thinking about doing something like
   this for generating dynamic editor forms (a la Trails) for objects,
   since Wicket doesn't like you putting TextFields on spans (you must
   use an input tag). I was going to have a Velocity script that
   decides what type of tag to spit out based on the type of component in
   the list.

What I found simple, which I perhaps did not explain clearly.. Where to only 
accept basePanels in forexample addMenu method, that way a base panel would 
look something like this:



public class BasePanelItem extends Panel {

public final static String ITEM_ID = item;

public AccordionPanelItem() {
super(ITEM_ID);
}

Now we have the id fixed...

Then the user only need add what ever user wants when user extends 
basePanelItem.. So this solves that too... And the problem with 
attaching to wrong tags are solved too... There might be some overhead 
because each time you want todo something special you need to create a 
panel, but I think it's worth it..


PS, youve seen the web beans project right? 
http://wicketwebbeans.sourceforge.net/




regards Nino


Nino Saturnino Martinez Vazquez Wael wrote:
Sure there a dozens of ways todo this, mine is just one of them. Im 
starting a new thread since it'll be more exposed then.


The idea is following:

Parent:

public class BasePage extends WebPage {

  protected final String LINK_LABEL_ID = linkText;
  protected final String LINK_ID = link;

  protected final String FOOTER_ID = item;
  protected final String HEADER_ID = item;

  protected ListWebMarkupContainer generalAccordionItem = new 
ArrayListWebMarkupContainer();


  protected ListWebMarkupContainer footer = new 
ArrayListWebMarkupContainer();
protected ListWebMarkupContainer header = new 
ArrayListWebMarkupContainer();


  private AccordionPanel accordionPanel;

  /**
   * Constructor that is invoked when page is invoked without a session.
   *
   * @param parameters
   *Page parameters
   */
  public BasePage() {
  accordionPanel = new AccordionPanel(accordionMenu);
  add(accordionPanel);

  add(new ListView(footerContent, footer) {
  @Override
  protected void populateItem(ListItem item) {
  WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

  .getModelObject();
  item.add(webMarkupContainer);

  }
  });
  add(new ListView(headerContent, header) {
  @Override
  protected void populateItem(ListItem item) {
  WebMarkupContainer webMarkupContainer = 
(WebMarkupContainer) item

  .getModelObject();
  item.add(webMarkupContainer);

  }
  });

}
  protected void addMenu(AccordionPanelItem accordionPanelItem) {
  accordionPanel.addMenu(accordionPanelItem);
  };

  protected void addFooter(WebMarkupContainer webMarkupContainer) {
  footer.add(webMarkupContainer);
  };
  protected void addHeader(WebMarkupContainer webMarkupContainer) {
  header.add(webMarkupContainer);
  };

Subs/Children then calls the methods... Problem with this technique is 
that you need to use the right markup id's.. To make sure they are 
always set, and giving full control to the child/sub on what to add, 
I'd suggest that you create a BasePanel which encapsules the id, and 
then required that instead of a markupcontainer, that way subs/child 
only need to have panels that extend the basepanel...


But it depends on your needs, mine weren't that tricky..


regards Nino



--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread James Carman
On 3/5/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote:
 Answer below:


 James Carman Wrote:

 Couldn't you use a VelocityPanel to generate your markup and have it
 parse the markup after it's generated to avoid the whole need to use
 the right markup ids part? I was thinking about doing something like
 this for generating dynamic editor forms (a la Trails) for objects,
 since Wicket doesn't like you putting TextFields on spans (you must
 use an input tag). I was going to have a Velocity script that
 decides what type of tag to spit out based on the type of component in
 the list.


 What I found simple, which I perhaps did not explain clearly.. Where to only 
 accept basePanels in forexample addMenu method, that way a base panel would 
 look something like this:



  public class BasePanelItem extends Panel {

 public final static String ITEM_ID = item;

 public AccordionPanelItem() {
 super(ITEM_ID);
 }

  Now we have the id fixed...

  Then the user only need add what ever user wants when user extends
  basePanelItem.. So this solves that too... And the problem with
  attaching to wrong tags are solved too... There might be some overhead
  because each time you want todo something special you need to create a
  panel, but I think it's worth it..

  PS, youve seen the web beans project right?
  http://wicketwebbeans.sourceforge.net/


Yes, I've seen WWB.  But, I'm a roll your own kind of guy.
Actually, I'm going through this experiment to help me learn Wicket.
I was part of the Trails team and I was wondering how we'd do the same
thing in Wicket.



  regards Nino



  Nino Saturnino Martinez Vazquez Wael wrote:
   Sure there a dozens of ways todo this, mine is just one of them. Im
   starting a new thread since it'll be more exposed then.
  
   The idea is following:
  
   Parent:
  
   public class BasePage extends WebPage {
  
 protected final String LINK_LABEL_ID = linkText;
 protected final String LINK_ID = link;
  
 protected final String FOOTER_ID = item;
 protected final String HEADER_ID = item;
  
 protected ListWebMarkupContainer generalAccordionItem = new
   ArrayListWebMarkupContainer();
  
 protected ListWebMarkupContainer footer = new
   ArrayListWebMarkupContainer();
   protected ListWebMarkupContainer header = new
   ArrayListWebMarkupContainer();
  
 private AccordionPanel accordionPanel;
  
 /**
  * Constructor that is invoked when page is invoked without a session.
  *
  * @param parameters
  *Page parameters
  */
 public BasePage() {
 accordionPanel = new AccordionPanel(accordionMenu);
 add(accordionPanel);
  
 add(new ListView(footerContent, footer) {
 @Override
 protected void populateItem(ListItem item) {
 WebMarkupContainer webMarkupContainer =
   (WebMarkupContainer) item
 .getModelObject();
 item.add(webMarkupContainer);
  
 }
 });
 add(new ListView(headerContent, header) {
 @Override
 protected void populateItem(ListItem item) {
 WebMarkupContainer webMarkupContainer =
   (WebMarkupContainer) item
 .getModelObject();
 item.add(webMarkupContainer);
  
 }
 });
  
   }
 protected void addMenu(AccordionPanelItem accordionPanelItem) {
 accordionPanel.addMenu(accordionPanelItem);
 };
  
 protected void addFooter(WebMarkupContainer webMarkupContainer) {
 footer.add(webMarkupContainer);
 };
 protected void addHeader(WebMarkupContainer webMarkupContainer) {
 header.add(webMarkupContainer);
 };
  
   Subs/Children then calls the methods... Problem with this technique is
   that you need to use the right markup id's.. To make sure they are
   always set, and giving full control to the child/sub on what to add,
   I'd suggest that you create a BasePanel which encapsules the id, and
   then required that instead of a markupcontainer, that way subs/child
   only need to have panels that extend the basepanel...
  
   But it depends on your needs, mine weren't that tricky..
  
  
   regards Nino
  

  --
  -Wicket for love
  -Jme for fun

  Nino Martinez Wael
  Java Specialist @ Jayway DK
  http://www.jayway.dk
  +45 2936 7684


  -
  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: ways of doing markup Inheritance [WAS Re: Page title when using markup inheritance]

2008-03-05 Thread Nino Saturnino Martinez Vazquez Wael



James Carman wrote:

On 3/5/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote:
  

Answer below:


James Carman Wrote:

Couldn't you use a VelocityPanel to generate your markup and have it
parse the markup after it's generated to avoid the whole need to use
the right markup ids part? I was thinking about doing something like
this for generating dynamic editor forms (a la Trails) for objects,
since Wicket doesn't like you putting TextFields on spans (you must
use an input tag). I was going to have a Velocity script that
decides what type of tag to spit out based on the type of component in
the list.


What I found simple, which I perhaps did not explain clearly.. Where to only 
accept basePanels in forexample addMenu method, that way a base panel would 
look something like this:



 public class BasePanelItem extends Panel {

public final static String ITEM_ID = item;

public AccordionPanelItem() {
super(ITEM_ID);
}

 Now we have the id fixed...

 Then the user only need add what ever user wants when user extends
 basePanelItem.. So this solves that too... And the problem with
 attaching to wrong tags are solved too... There might be some overhead
 because each time you want todo something special you need to create a
 panel, but I think it's worth it..



What did you think of this approach?

 PS, youve seen the web beans project right?
 http://wicketwebbeans.sourceforge.net/




Yes, I've seen WWB.  But, I'm a roll your own kind of guy.
Actually, I'm going through this experiment to help me learn Wicket.
I was part of the Trails team and I was wondering how we'd do the same
thing in Wicket.

  

 regards Nino



 Nino Saturnino Martinez Vazquez Wael wrote:
  Sure there a dozens of ways todo this, mine is just one of them. Im
  starting a new thread since it'll be more exposed then.
 
  The idea is following:
 
  Parent:
 
  public class BasePage extends WebPage {
 
protected final String LINK_LABEL_ID = linkText;
protected final String LINK_ID = link;
 
protected final String FOOTER_ID = item;
protected final String HEADER_ID = item;
 
protected ListWebMarkupContainer generalAccordionItem = new
  ArrayListWebMarkupContainer();
 
protected ListWebMarkupContainer footer = new
  ArrayListWebMarkupContainer();
  protected ListWebMarkupContainer header = new
  ArrayListWebMarkupContainer();
 
private AccordionPanel accordionPanel;
 
/**
 * Constructor that is invoked when page is invoked without a session.
 *
 * @param parameters
 *Page parameters
 */
public BasePage() {
accordionPanel = new AccordionPanel(accordionMenu);
add(accordionPanel);
 
add(new ListView(footerContent, footer) {
@Override
protected void populateItem(ListItem item) {
WebMarkupContainer webMarkupContainer =
  (WebMarkupContainer) item
.getModelObject();
item.add(webMarkupContainer);
 
}
});
add(new ListView(headerContent, header) {
@Override
protected void populateItem(ListItem item) {
WebMarkupContainer webMarkupContainer =
  (WebMarkupContainer) item
.getModelObject();
item.add(webMarkupContainer);
 
}
});
 
  }
protected void addMenu(AccordionPanelItem accordionPanelItem) {
accordionPanel.addMenu(accordionPanelItem);
};
 
protected void addFooter(WebMarkupContainer webMarkupContainer) {
footer.add(webMarkupContainer);
};
protected void addHeader(WebMarkupContainer webMarkupContainer) {
header.add(webMarkupContainer);
};
 
  Subs/Children then calls the methods... Problem with this technique is
  that you need to use the right markup id's.. To make sure they are
  always set, and giving full control to the child/sub on what to add,
  I'd suggest that you create a BasePanel which encapsules the id, and
  then required that instead of a markupcontainer, that way subs/child
  only need to have panels that extend the basepanel...
 
  But it depends on your needs, mine weren't that tricky..
 
 
  regards Nino
 

 --
 -Wicket for love
 -Jme for fun

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


 -
 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]


  


--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL 

Re: Page title when using markup inheritance

2008-03-04 Thread Sebastiaan van Erk
I do basically the same thing, but since the title does not change on my 
pages I see no need to have a (dynamic) model for the property, plus I 
just use the constructor to set it, which saves some loc. In other words:


public abstract class BasePage extends WebPage
{
  // ...
  public BasePage(String title)
  {
add(new Label(title, title));
  }
}

public class SubPage extends BasePage
{
  public SubPage(PageParameters parameters) {
 super(whatever title);
  }
}

If you need the page parameters in the BasePage constructor then feel 
free to pass them with the constructor too...


Regards,
Sebastiaan

Kaspar Fischer wrote:
I am using markup inheritance (wicket:child and wicket:extend) and 
need to set the
page title from my subpage. I currently add a label in the base class 
(BasePage.java)
and make it use an abstract method getTitle(), which is overridden in 
the subclass

(SubPage.java). Has anybody found a better way?

Here's my solution:

!-- BasePage.html --
html
head
  title wicket:id=title[Page title]/title
/head
body
  wicket:child/
/body
/html

!-- SubPage.html --
wicket:extend
  !-- anything ... --
/wicket:extend


public abstract class BasePage extends WebPage
{
  // ...
  public BasePage(final PageParameters parameters)
  {
add(new Label(title, new PropertyModel(this, title)));
  }
  public abstract String getTitle();
}

public class SubPage extends BasePage
{
  // ...
  public String getTitle()
  {
return whatever title;
  }
}

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



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Page title when using markup inheritance

2008-03-04 Thread richardwilko

The way I do it is; dont specify a title in your base page then just add the
title in the subpage:

base page.html
html
!-- anything shared in all the pages eg a base.css file --
head
/head
body
   wicket:child/
/body
/html

subpage.html:

wicket:head
titlehard code or use wicket label to add this/title
/wicket:head
wicket:extend
  !-- anything ... --
/wicket:extend

subpage.java

Richard



hbf wrote:
 
 I am using markup inheritance (wicket:child and wicket:extend)  
 and need to set the
 page title from my subpage. I currently add a label in the base class  
 (BasePage.java)
 and make it use an abstract method getTitle(), which is overridden in  
 the subclass
 (SubPage.java). Has anybody found a better way?
 
 Here's my solution:
 
 !-- BasePage.html --
 html
 head
title wicket:id=title[Page title]/title
 /head
 body
wicket:child/
 /body
 /html
 
 !-- SubPage.html --
 wicket:extend
!-- anything ... --
 /wicket:extend
 
 
 public abstract class BasePage extends WebPage
 {
// ...
public BasePage(final PageParameters parameters)
{
  add(new Label(title, new PropertyModel(this, title)));
}
public abstract String getTitle();
 }
 
 public class SubPage extends BasePage
 {
// ...
public String getTitle()
{
  return whatever title;
}
 }
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15828280.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Page title when using markup inheritance

2008-03-04 Thread James Carman
On 3/4/08, Sebastiaan van Erk [EMAIL PROTECTED] wrote:
 I do basically the same thing, but since the title does not change on my
  pages I see no need to have a (dynamic) model for the property, plus I
  just use the constructor to set it, which saves some loc. In other words:


  public abstract class BasePage extends WebPage
  {
// ...

public BasePage(String title)
{
  add(new Label(title, title));

}
  }

  public class SubPage extends BasePage
  {

public SubPage(PageParameters parameters) {
   super(whatever title);
}
  }

  If you need the page parameters in the BasePage constructor then feel
  free to pass them with the constructor too...

  Regards,

 Sebastiaan


The problem with this approach is that you're not able to localize the
title if you hard-code it.  What I've done is actually specify a key
for my messages file and I use that.  So, every page has to define its
page.title key in its PageClass.properties file.


  Kaspar Fischer wrote:
   I am using markup inheritance (wicket:child and wicket:extend) and
   need to set the
   page title from my subpage. I currently add a label in the base class
   (BasePage.java)
   and make it use an abstract method getTitle(), which is overridden in
   the subclass
   (SubPage.java). Has anybody found a better way?
  
   Here's my solution:
  
   !-- BasePage.html --
   html
   head
 title wicket:id=title[Page title]/title
   /head
   body
 wicket:child/
   /body
   /html
  
   !-- SubPage.html --
   wicket:extend
 !-- anything ... --
   /wicket:extend
  
  
   public abstract class BasePage extends WebPage
   {
 // ...
 public BasePage(final PageParameters parameters)
 {
   add(new Label(title, new PropertyModel(this, title)));
 }
 public abstract String getTitle();
   }
  
   public class SubPage extends BasePage
   {
 // ...
 public String getTitle()
 {
   return whatever title;
 }
   }
  
   -
   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: Page title when using markup inheritance

2008-03-04 Thread Nino Saturnino Martinez Vazquez Wael
On the other hand, I've also done something with listviews.. Allowing 
sub pages adding markup items to menus etc Using the listviews as 
place holders...


Kaspar Fischer wrote:

Ah, 'course! Should have thought of it, that's an option they mention
in Wicket in Action.

However, Sebastiaan's solution can be reused in places where the markup
you have to change is not in head. -- Good to know.

On 04.03.2008, at 15:27, richardwilko wrote:

The way I do it is; dont specify a title in your base page then just 
add the

title in the subpage:

base page.html
html
!-- anything shared in all the pages eg a base.css file --
head
/head
body
   wicket:child/
/body
/html

subpage.html:

wicket:head
titlehard code or use wicket label to add this/title
/wicket:head
wicket:extend
  !-- anything ... --
/wicket:extend

subpage.java

Richard



hbf wrote:


I am using markup inheritance (wicket:child and wicket:extend)
and need to set the
page title from my subpage. I currently add a label in the base class
(BasePage.java)
and make it use an abstract method getTitle(), which is overridden in
the subclass
(SubPage.java). Has anybody found a better way?

Here's my solution:

!-- BasePage.html --
html
head
   title wicket:id=title[Page title]/title
/head
body
   wicket:child/
/body
/html

!-- SubPage.html --
wicket:extend
   !-- anything ... --
/wicket:extend


public abstract class BasePage extends WebPage
{
   // ...
   public BasePage(final PageParameters parameters)
   {
 add(new Label(title, new PropertyModel(this, title)));
   }
   public abstract String getTitle();
}

public class SubPage extends BasePage
{
   // ...
   public String getTitle()
   {
 return whatever title;
   }
}

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





--
View this message in context: 
http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15828280.html 


Sent from the Wicket - User mailing list archive at Nabble.com.


-
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]




--
-Wicket for love
-Jme for fun

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Page title when using markup inheritance

2008-03-04 Thread James Carman
On 3/4/08, Sebastiaan van Erk [EMAIL PROTECTED] wrote:
 James Carman wrote:

   The problem with this approach is that you're not able to localize the
   title if you hard-code it.  What I've done is actually specify a key
   for my messages file and I use that.  So, every page has to define its
   page.title key in its PageClass.properties file.


 That's what I do it too. :-) In applications that are localized I change the


  add(new Label(title, title))


 with

  add(new Label(title, new StringResourceModel(titleKey, this, new
  CompoundPropertyModel(this)));

Very nice!  I like the fact that you can do substitutions with this.
I had that problem on the back burner in my brain until I needed to
solve it.  But, you took care of it for me.  Thanks!


  This has the added benefit that you can do nice property substitutions,
  that is, if the titleKey resolves to Profile for ${session.userName}
  then you'll get a nice title Profile for Sebastiaan dynamically. :-) I
  don't use a static key though (like page.title) because my keys come
  from the database and I have little web page with a tree view where you
  can edit the key values. :-)

  Regards,

 Sebastiaan


Kaspar Fischer wrote:
 I am using markup inheritance (wicket:child and wicket:extend) and
 need to set the
 page title from my subpage. I currently add a label in the base class
 (BasePage.java)
 and make it use an abstract method getTitle(), which is overridden in
 the subclass
 (SubPage.java). Has anybody found a better way?

 Here's my solution:

 !-- BasePage.html --
 html
 head
   title wicket:id=title[Page title]/title
 /head
 body
   wicket:child/
 /body
 /html

 !-- SubPage.html --
 wicket:extend
   !-- anything ... --
 /wicket:extend


 public abstract class BasePage extends WebPage
 {
   // ...
   public BasePage(final PageParameters parameters)
   {
 add(new Label(title, new PropertyModel(this, title)));
   }
   public abstract String getTitle();
 }

 public class SubPage extends BasePage
 {
   // ...
   public String getTitle()
   {
 return whatever title;
   }
 }

 -
 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]
  



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



Re: Page title when using markup inheritance

2008-03-04 Thread Sebastiaan van Erk

James Carman wrote:


The problem with this approach is that you're not able to localize the
title if you hard-code it.  What I've done is actually specify a key
for my messages file and I use that.  So, every page has to define its
page.title key in its PageClass.properties file.


That's what I do it too. :-) In applications that are localized I change the

add(new Label(title, title))

with

add(new Label(title, new StringResourceModel(titleKey, this, new 
CompoundPropertyModel(this)));


This has the added benefit that you can do nice property substitutions, 
that is, if the titleKey resolves to Profile for ${session.userName} 
then you'll get a nice title Profile for Sebastiaan dynamically. :-) I 
don't use a static key though (like page.title) because my keys come 
from the database and I have little web page with a tree view where you 
can edit the key values. :-)


Regards,
Sebastiaan


 Kaspar Fischer wrote:
  I am using markup inheritance (wicket:child and wicket:extend) and
  need to set the
  page title from my subpage. I currently add a label in the base class
  (BasePage.java)
  and make it use an abstract method getTitle(), which is overridden in
  the subclass
  (SubPage.java). Has anybody found a better way?
 
  Here's my solution:
 
  !-- BasePage.html --
  html
  head
title wicket:id=title[Page title]/title
  /head
  body
wicket:child/
  /body
  /html
 
  !-- SubPage.html --
  wicket:extend
!-- anything ... --
  /wicket:extend
 
 
  public abstract class BasePage extends WebPage
  {
// ...
public BasePage(final PageParameters parameters)
{
  add(new Label(title, new PropertyModel(this, title)));
}
public abstract String getTitle();
  }
 
  public class SubPage extends BasePage
  {
// ...
public String getTitle()
{
  return whatever title;
}
  }
 
  -
  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]



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Page title when using markup inheritance

2008-03-04 Thread James Carman
On 3/4/08, Hoover, William [EMAIL PROTECTED] wrote:
 public abstract class BasePage extends WebPage {
 public BasePage(final PageParameters parameters) {

 // If the title is not set in any sub-pages this will be the 
 default
 setTitle(new StringResourceModel(base.page.title, this, 
 null));
 }

 protected final void setTitle(final StringResourceModel srm) {
 addOrReplace(new Label(title, srm));

 }

How about this:

  protected final void setTitle(IModel titleModel) {
addOrReplace(new Label(title, titleModel));
  }

That way, you can calculate your title from anything you want.

  }
  !-- BasePage.html --
  html
 head
 title wicket:id=title[Page title]/title
 /head
 body
 wicket:child/
 /body
  /html





 public final class SubPage extends BasePage {
 public BasePage(final PageParameters parameters) {
 setTitle(new StringResourceModel(sub.page.title, this, 
 null));

 }
  }
  !-- SubPage.html --
  wicket:extend
 !-- anything ... --
  /wicket:extend


 -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] Behalf Of James Carman
  Sent: Tuesday, March 04, 2008 10:53 AM
  To: users@wicket.apache.org
  Subject: Re: Page title when using markup inheritance


  On 3/4/08, Sebastiaan van Erk [EMAIL PROTECTED] wrote:
   James Carman wrote:
  
 The problem with this approach is that you're not able to localize the
 title if you hard-code it.  What I've done is actually specify a key
 for my messages file and I use that.  So, every page has to define its
 page.title key in its PageClass.properties file.
  
  
   That's what I do it too. :-) In applications that are localized I change 
 the
  
  
add(new Label(title, title))
  
  
   with
  
add(new Label(title, new StringResourceModel(titleKey, this, new
CompoundPropertyModel(this)));

  Very nice!  I like the fact that you can do substitutions with this.
  I had that problem on the back burner in my brain until I needed to
  solve it.  But, you took care of it for me.  Thanks!

  
This has the added benefit that you can do nice property substitutions,
that is, if the titleKey resolves to Profile for ${session.userName}
then you'll get a nice title Profile for Sebastiaan dynamically. :-) I
don't use a static key though (like page.title) because my keys come
from the database and I have little web page with a tree view where you
can edit the key values. :-)
  
Regards,
  
   Sebastiaan
  
  
  Kaspar Fischer wrote:
   I am using markup inheritance (wicket:child and wicket:extend) 
 and
   need to set the
   page title from my subpage. I currently add a label in the base 
 class
   (BasePage.java)
   and make it use an abstract method getTitle(), which is overridden 
 in
   the subclass
   (SubPage.java). Has anybody found a better way?
  
   Here's my solution:
  
   !-- BasePage.html --
   html
   head
 title wicket:id=title[Page title]/title
   /head
   body
 wicket:child/
   /body
   /html
  
   !-- SubPage.html --
   wicket:extend
 !-- anything ... --
   /wicket:extend
  
  
   public abstract class BasePage extends WebPage
   {
 // ...
 public BasePage(final PageParameters parameters)
 {
   add(new Label(title, new PropertyModel(this, title)));
 }
 public abstract String getTitle();
   }
  
   public class SubPage extends BasePage
   {
 // ...
 public String getTitle()
 {
   return whatever title;
 }
   }
  
   
 -
   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]

  
  

  -
  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]



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



Re: Page title when using markup inheritance

2008-03-04 Thread Jonathan Locke


could you share this technique?  i think this might be a good idea.


Nino.Martinez wrote:
 
 On the other hand, I've also done something with listviews.. Allowing 
 sub pages adding markup items to menus etc Using the listviews as 
 place holders...
 
 Kaspar Fischer wrote:
 Ah, 'course! Should have thought of it, that's an option they mention
 in Wicket in Action.

 However, Sebastiaan's solution can be reused in places where the markup
 you have to change is not in head. -- Good to know.

 On 04.03.2008, at 15:27, richardwilko wrote:

 The way I do it is; dont specify a title in your base page then just 
 add the
 title in the subpage:

 base page.html
 html
 !-- anything shared in all the pages eg a base.css file --
 head
 /head
 body
wicket:child/
 /body
 /html

 subpage.html:

 wicket:head
 titlehard code or use wicket label to add this/title
 /wicket:head
 wicket:extend
   !-- anything ... --
 /wicket:extend

 subpage.java

 Richard



 hbf wrote:

 I am using markup inheritance (wicket:child and wicket:extend)
 and need to set the
 page title from my subpage. I currently add a label in the base class
 (BasePage.java)
 and make it use an abstract method getTitle(), which is overridden in
 the subclass
 (SubPage.java). Has anybody found a better way?

 Here's my solution:

 !-- BasePage.html --
 html
 head
title wicket:id=title[Page title]/title
 /head
 body
wicket:child/
 /body
 /html

 !-- SubPage.html --
 wicket:extend
!-- anything ... --
 /wicket:extend


 public abstract class BasePage extends WebPage
 {
// ...
public BasePage(final PageParameters parameters)
{
  add(new Label(title, new PropertyModel(this, title)));
}
public abstract String getTitle();
 }

 public class SubPage extends BasePage
 {
// ...
public String getTitle()
{
  return whatever title;
}
 }

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




 -- 
 View this message in context: 
 http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15828280.html
  

 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 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]


 
 -- 
 -Wicket for love
 -Jme for fun
 
 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Page-title-when-using-markup-inheritance-tp15827853p15835720.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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