Re: YUI menu and wicker border problem

2009-03-03 Thread jchappelle

I am having a similar problem. I have a MasterPage class that is my common
page. When I hard code the menu as a page that extends Webpage everything is
fine but when I extend my MasterPage class it doesn't work. 

Could someone please help?

Josh


Michal Hybler wrote:
 
 Hi all!
 I want to combine YUI menu( from yui examples) with wicket border system
 to reach that menu will be displayed on each page.
 I have 2 problems:
 - menu lost its functionality (sub menu doesnt work) if i use it in hard
 coded page its all right.
 - in spite of I added menu in table it is outside the table and cell which
 should contain it is empty.
 
 There is my code:
 
 layoutPage:
 
 java:
 
 public class PageBorder extends Border {
   BoxBorder box;
 
   /**
* Constructor
*/
   /*
* public Page1() { add(new Menu(navomaticBorder));
* 
* }
*/
   public PageBorder(String id) {
   super(id);
   initMenu();
   }
 
   private void initMenu() {
   AbstractYuiMenuItem mi = null;
 
   YuiMenu menu = new YuiMenu(menu);
 
   menu.addMenuItem(new TestAction(M : L1));
   menu.addMenuItem(new TestAction(M : L2));
   mi = menu.addMenuItem(new TestAction(M : L3));
   menu.addMenuItem(new TestAction(M : L4));
   menu.addMenuItem(new TestAction(M : L5));
 
   YuiMenu subMenu = mi.newSubMenu(m_subMenu1);
   subMenu.addMenuItem(new TestAction(Label 1));
   subMenu.addMenuItem(new TestAction(Label 2));
   add(menu);
 
   }
 
   private static class TestAction implements IYuiMenuAction,
   java.io.Serializable {
   private final String id;
 
   public TestAction(String id) {
   this.id = id;
   }
 
   public IModel getName() {
   return new Model(id);
   }
 
   public void onClick() {
   System.out.println(Link:  + id);
   }
   }
 
 }
 
 html:
 
 ?xml version=1.0 encoding=UTF-8?
 html xmlns=http://www.w3.org/1999/xhtml; 
 head
 
 /head
 body class=yui-skin-sam
 
 
 wicket:border
 table
 tr
 td
 div wicket:id=menuMenu Here/div
 /td
 tdwicket:body//td
 /tr
 /table
 /wicket:border
 
 
 /body
 /html
 
 
 page ancestor:
 
 
 package cz.legend.mvcr.kup.lims.application;
 
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.markup.html.border.Border;
 
 public abstract class CommonPage extends WebPage {
   private Border border;
 
   public MarkupContainer add(final Component child) {
   // Add children of the page to the page's border component
   if (border == null) {
   // Create border and add it to the page
   border = new PageBorder(border);
   super.add(border);
   }
   border.add(child);
   return this;
   }
 
 }
 
 test page:
 
 java:
 
 package cz.legend.mvcr.kup.lims.application;
 
 import org.apache.wicket.markup.html.basic.Label;
 
 public class Page1 extends CommonPage {
 
   /**
* Constructor
*/
   /*
* public Page1() { add(new Menu(navomaticBorder));
* 
* }
*/
   public Page1() {
   add(new Label(test, This is a Test));
   }
 
 }
 
 
 html:
 
 html xmlns:wicket=http://wicket.apache.org/;
 head
 titleWicket Examples - navomatic/title
 link rel=stylesheet type=text/css href=style.css/
 /head
 body
 
 div style = width:250px
 TEST LABEL
 Welcome to Page 1 of Navomatic.  Notice that the Page1 link is now
 clickable
 (so that you can return to Page1 if you want to) and the Page2
 link is
 italicized text.  Go ahead and click the Page3 link.
 /div
 
 /body
 /html
 
 
 If i use label instead of menu (for test) everything is ok then I thinkn
 problem is in Yui menu. Any ideas about that?
 
 Thanx for your help (and sorry for my english :blush:)
 Regards Michal Hybler
 

-- 
View this message in context: 
http://www.nabble.com/YUI-menu-and-wicker-border-problem-tp21683436p22314033.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



YUI menu and wicker border problem

2009-01-27 Thread Michal Hybler

Hi all!
I want to combine YUI menu( from yui examples) with wicket border system
to reach that menu will be displayed on each page.
I have 2 problems:
- menu lost its functionality (sub menu doesnt work) if i use it in hard
coded page its all right.
- in spite of I added menu in table it is outside the table and cell which
should contain it is empty.

There is my code:

layoutPage:

java:

public class PageBorder extends Border {
BoxBorder box;

/**
 * Constructor
 */
/*
 * public Page1() { add(new Menu(navomaticBorder));
 * 
 * }
 */
public PageBorder(String id) {
super(id);
initMenu();
}

private void initMenu() {
AbstractYuiMenuItem mi = null;

YuiMenu menu = new YuiMenu(menu);

menu.addMenuItem(new TestAction(M : L1));
menu.addMenuItem(new TestAction(M : L2));
mi = menu.addMenuItem(new TestAction(M : L3));
menu.addMenuItem(new TestAction(M : L4));
menu.addMenuItem(new TestAction(M : L5));

YuiMenu subMenu = mi.newSubMenu(m_subMenu1);
subMenu.addMenuItem(new TestAction(Label 1));
subMenu.addMenuItem(new TestAction(Label 2));
add(menu);

}

private static class TestAction implements IYuiMenuAction,
java.io.Serializable {
private final String id;

public TestAction(String id) {
this.id = id;
}

public IModel getName() {
return new Model(id);
}

public void onClick() {
System.out.println(Link:  + id);
}
}

}

html:

?xml version=1.0 encoding=UTF-8?
html xmlns=http://www.w3.org/1999/xhtml; 
head

/head
body class=yui-skin-sam


wicket:border
table
tr
td
div wicket:id=menuMenu Here/div
/td
tdwicket:body//td
/tr
/table
/wicket:border


/body
/html


page ancestor:


package cz.legend.mvcr.kup.lims.application;

import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.border.Border;

public abstract class CommonPage extends WebPage {
private Border border;

public MarkupContainer add(final Component child) {
// Add children of the page to the page's border component
if (border == null) {
// Create border and add it to the page
border = new PageBorder(border);
super.add(border);
}
border.add(child);
return this;
}

}

test page:

java:

package cz.legend.mvcr.kup.lims.application;

import org.apache.wicket.markup.html.basic.Label;

public class Page1 extends CommonPage {

/**
 * Constructor
 */
/*
 * public Page1() { add(new Menu(navomaticBorder));
 * 
 * }
 */
public Page1() {
add(new Label(test, This is a Test));
}

}


html:

html xmlns:wicket=http://wicket.apache.org/;
head
titleWicket Examples - navomatic/title
link rel=stylesheet type=text/css href=style.css/
/head
body

div style = width:250px
TEST LABEL
Welcome to Page 1 of Navomatic.  Notice that the Page1 link is now
clickable
(so that you can return to Page1 if you want to) and the Page2 link
is
italicized text.  Go ahead and click the Page3 link.
/div

/body
/html


If i use label instead of menu (for test) everything is ok then I thinkn
problem is in Yui menu. Any ideas about that?

Thanx for your help (and sorry for my english :blush:)
Regards Michal Hybler
-- 
View this message in context: 
http://www.nabble.com/YUI-menu-and-wicker-border-problem-tp21683436p21683436.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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