Resolved by myself. I just need to add other elements for listView item under the new WebMarkupContainer.

Thanks, Igor.

Khlystov Alexandr пишет:
Error:

WicketMessage: Unable to find component with id 'id' in [MarkupContainer [Component id = idTr]]. This means that you declared wicket:id=id in your markup, but that you either did not add the component to your page at all, or that the hierarchy does not match.


Code:

JAVA: (colored code here: http://rafb.net/p/D9Hg5838.html)
HTML: (http://rafb.net/p/pAao6a88.html)

JAVA plain:
@AuthorizeInstantiation("ADMIN")
public class AdminNavPage extends ThreeColumnBasePage {

@SpringBean(name="navigationManager")
private NavigationManager navigationManager;

public AdminNavPage() {
super();
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("date", new Date().toString());
add(new Label("labelText", new StringResourceModel("parametrizedText", this,
new Model(new Simple()))));
List<NavItem> usersNavList = navigationManager.getNavigation(NavigationType.ALL);

//TODO implement the list VIEW
add(new ListView("listview", usersNavList) {
@Override
protected void populateItem(ListItem item) {
final NavItem navItem = (NavItem) item.getModelObject();
item.add(new WebMarkupContainer("idTr"){

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("id", "rowId"+navItem.getId());
}
});
item.add(new Label("id", navItem.getId()+""));
item.add(new TextLink("name", new Model(navItem.getName())){
@Override
public void onClick() {
setResponsePage(navItem.getPageClass());
}
});
item.add(new Label("order", navItem.getOrder()+""));
}
});
}

static class Simple implements Serializable {
private String date = new Date().toString();
Simple() {
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
}
}

HTML plain:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- $Id: NavigationPage.html 69 2009-04-11 19:09:47Z akhlystov $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml"; xmlns:wicket="http://wicket.sourceforge.net/";
xml:lang="en" lang="en">

<head>
</head>
<body>
<wicket:extend>

<div class="mainCenterTable">
<table width="100%" cellpadding="10px" cellspacing="0px" border="0px">
<tr>
<td><span wicket:id="labelText"></span>


<div class="horLine"></div>

<table class="buttonsTable" cellpadding="0px" cellspacing="0px" border="0px">
<tr>
<td>
<div class="buttonsTableDiv">
<div class="tableGroupButtonLeft"><input id="actionAdd"
class="buttonInactive" type="button" value="Add"
onmouseout="changeC(this.id,'buttonInactive');"
onmouseover="changeC(this.id,'buttonActive');" /></div>

<div class="tableGroupButtonRight"><input id="actionDisable"
class="buttonInactive" type="button" value="Remove"
onmouseout="changeC(this.id,'buttonInactive');"
onmouseover="changeC(this.id,'buttonActive');" /></div>
</div>
</td>
</tr>
</table>

<div class="horLine"></div>

<table class="itemsTable" cellpadding="0px" cellspacing="2px" border="0px">
<tr class="itemsTableHeaderTr">
<td class="itemsTableHeaderTdSystem"><input type="checkbox"
class="tableCheckbox"></input></td>
<td class="itemsTableHeaderTd width20percent"><a href="#">Header 1</a><img
src="images/list/listHeaderArrowDown.gif" /></td>
<td class="itemsTableHeaderTd width20percent"><a href="#">Header 2</a><img
src="images/list/listHeaderArrowUp.gif" /></td>
<td class="itemsTableHeaderTd width60percent"><a href="#">Header 3</a></td>
<!-- <td>&nbsp;</td> just for correct width percent -->
</tr>
<tr>
<td class="rowHeaderLine" />
<td class="rowHeaderLine" />
<td class="rowHeaderLine" />
<td class="rowHeaderLine" />
</tr>
<wicket:container wicket:id="listview">
<tr wicket:id="idTr" id="row4" class="itemsTableTr" onmouseover="changeLC(this.id,1);"
onmouseout="changeLC(this.id,0);">
<td class="itemsTableTdSystem"><input type="checkbox" class="tableCheckbox"></input></td>
<td wicket:id="id" class="itemsTableTd">Item 32 id</td>
<td class="itemsTableTd"><a wicket:id="name" href="#"> Item 32 caption</a></td>
<td wicket:id="order" class="itemsTableTd">Item 32 status</td>
</tr>
<tr>
<td class="rowLine" />
<td class="rowLine" />
<td class="rowLine" />
<td class="rowLine" />
</tr>
</wicket:container>
</table>

<div class="horLine"></div>

</td>
</tr>
</table>
</div>
</wicket:extend>
</body>
</html>

it should be webmarkupcontainer, and it should work just fine. paste
your complete code with markup and markupcontainer for the whole
page/panel.

-igor

On Sat, Apr 18, 2009 at 4:03 AM, Khlystov Alexandr <a...@ovservice.org> wrote:
Hello again!

I can't set 'id' attribute to the <tr> tag:

WicketMessage: Expected close tag for <tr id="rowId1"
onmouseout="changeLC(this.id,0);" class="itemsTableTr" wicket:id="idTr"
onmouseover="changeLC(this.id,1);">

JAVA:
add(new ListView("listview", usersNavList) {
@Override
protected void populateItem(ListItem item) {
final NavItem navItem = (NavItem) item.getModelObject();
item.add(new WebComponent("idTr"){

@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("id", "rowId"+navItem.getId());
}
});
...

HTML:
<wicket:container wicket:id="listview">
<tr wicket:id="idTr" id="row4" class="itemsTableTr"
onmouseover="changeLC(this.id,1);"
onmouseout="changeLC(this.id,0);">
<td class="itemsTableTdSystem"><input type="checkbox"
class="tableCheckbox"></input></td>
<td wicket:id="id" class="itemsTableTd">Item 32 id</td>
<td class="itemsTableTd"><a wicket:id="name" href="#">
Item 32 caption</a></td>
<td wicket:id="order" class="itemsTableTd">Item 32
status</td>
</tr>
<tr>
<td class="rowLine" />
<td class="rowLine" />
<td class="rowLine" />
<td class="rowLine" />
</tr>
</wicket:container>


I've tried WebComponent to reference the <tr> tag in my sample - it doesn't
work, also I tried WebMarkupContainer - but fails too with this error:

WicketMessage: Unable to find component with id 'id' in [MarkupContainer [Component id = idTr]]. This means that you declared wicket:id=id in your markup, but that you either did not add the component to your page at all,
or that the hierarchy does not match.



JAVA diff:

- item.add(new WebComponent("idTr"){
+ item.add(new WebMarkupContainer("idTr"){





Thanks in advance.


--
Khlystov Alexandr


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



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







--
Khlystov Alexandr


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

Reply via email to