Hi,
I'm trying to load a list of item into a scroll pane of my main window where
each item is a instance of commentItemRendererI created a bxml file for
this commentItemRenderer called comment_pane.bxml.
The problem is I couldn't have the list shown in the main window.
What's wrong?
Brendan
public class CommentItemRenderer extends BoxPane implements
ListView.ItemRenderer, Bindable {
@BXML private Label dateLabel = null;
public CommentItemRenderer() {
super(Orientation.VERTICAL);
}
@Override
public void initialize(Map<String, Object> namespace, URL location,
Resources resources) {
}
@Override
public void render(Object item, int index, ListView listView,
boolean selected, boolean checked, boolean highlighted,
boolean disabled) {
dateLabel.setText((String) item);
}
@Override
public String toString(Object item) {
return null;
}
}
my bxml file: comment_pane.bxml
<thumbnail:CommentItemRenderer
xmlns:bxml="http://pivot.apache.org/bxml"
xmlns:thumbnail="hk.itags.gui.thumbnail"
xmlns="org.apache.pivot.wtk">
<BoxPane>
<TablePane>
<columns>
<TablePane.Column width="1*"/>
</columns>
<TablePane.Row height="-1">
<Border styles="{color:'#999999'}">
<TablePane>
<columns>
<TablePane.Column width="-1"/>
<TablePane.Column width="1*"/>
<TablePane.Column width="-1"/>
</columns>
<TablePane.Row height="-1">
<Label bxml:id="dateLabel"
text="2011-09-19 08:34"/>
<Label bxml:id="authorLabel" text="Mr.
David Foo"/>
<PushButton buttonData=">"
styles="{minimumAspectRatio:1.5}"/>
</TablePane.Row>
</TablePane>
</Border>
</TablePane.Row>
<TablePane.Row height="1*">
<Border styles="{color:'#999999'}">
<BoxPane styles="{padding:6, verticalAlignment:'top'}">
<Label bxml:id="summaryLabel" text="Summary"/>
<TextArea bxml:id="descriptionTextArea"
minimumHeight="2" text="@sample1.txt"/>
</BoxPane>
</Border>
</TablePane.Row>
</TablePane>
</BoxPane>
</thumbnail:CommentItemRenderer>
I load it into my main window from its BXML file here:
<ScrollPane bxml:id="rightScrollPane"><ListView bxml:id="listView">
<itemRenderer>
<bxml:include src="thumbnail/comment_pane.bxml"/>
</itemRenderer>
</ListView>
</ScrollPane>