pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: ItemRender Layout question
Date Tue, 03 Jan 2012 11:24:13 GMT
Brendan,

I took a quick look at your code and think the problem is due to the
way you are using the renderer.

The renderer itself is a Component or Container that is populated with
the relevant data for the list item, table row, tree node, etc.  This
is then painted in the correct location.

You seem to want to have a FlowPane inside your renderer as a
placeholder, but then swap it with another FlowPane when the renderer
is painted.  If you want to do this, you will need to remove (or hide)
the placeholder FlowPane from it's parent, and then add the new
FlowPane before the renderer is painted.

You might achieve this by adding a setFlowPane(FlowPane) method to the
renderer.  That method would know about the parent Container for the
FlowPane, so could remove any existing ones and add the new one in the
correct location.

Chris
2011/12/29 Brendan cheng <ccp999@hotmail.com>:
> Hi Chris,
>
> I just made a compact version of my program which demonstrating nested
> ListViewItemRenderer can't show up.
> I don't know how to link it to the main program to be shown on screen.
>
> Please advise me!
>
> Brendan
>
>> Date: Wed, 28 Dec 2011 09:25:36 +0000
>> Subject: Re: ItemRender Layout question
>> From: cbartlett.x@gmail.com
>> To: user@pivot.apache.org
>
>>
>> Brendan,
>>
>> Could you please post a small, complete example demonstrating the
>> problem with the FlowPane not showing? Try to keep it simple by only
>> using a custom renderer and not all of your other custom classes.
>>
>> Chris
>>
>> 2011/12/28 Brendan cheng <ccp999@hotmail.com>:
>> > Hi,
>> >
>> > in renderer function, is this going to work?
>> >
>> > @Override
>> &g t;
>
>> > public void render(Object item, int index, ListView listView,
>> >
>> > boolean selected, boolean checked, boolean highlighted,
>> >
>> > boolean disabled) {
>> >
>> > if (item != null && item instanceof Tab.LogView) {
>> >
>> > Tab.LogView logview = (Tab.LogView) item;
>> >
>> > fieldsflowPane = logview.fieldsPane;
>> >
>> > }
>> >
>> > }
>> >
>> >
>> > I couldn't get logview.fieldsPane to be shown in fieldsflowPane.
>> >
>> > How to assign the logview.fieldsPane into fieldsflowPane?
>> >
>> > How to change a component's parent reference?
>> >
>> >
>> > Brendan
>> >
>> >
>> > ________________________________
>> > From: ccp999@hotmail.com
>> > To: user@pivot.apache.org
>> > Subject: ItemRender Layout question
>> > Date: Tue, 27 Dec 2011 14:21:45 +0000
>> >
>> >
>> > Hi,
>> >
>> > I'm trying render a list of list view with a nested list view.  Despite
>> > all
>> > my effort,  I can't get it display on screen.
>> >
>> > Here is the snippet of code:
>> >
>> > public void addNode(Person person) throws
>> >
>> > IOException, SerializationException {
>> >
>> >
>> > BXMLSerializer bxmlSerializer = new BXMLSerializer();
>> >
>> > LogItemRenderer logItemRenderer = (LogItemRenderer) bxmlSerializer
>> >
>> > .readObject(getClass().getResource(
>> >
>> > "fullview/LogItemRenderer.bxml"));
>> >
>> >
>> > ListView listView = new ListView();
>> >
>> > listView.setItemRenderer(logItemRenderer);
>> >
>> >
>> > org.apache.pivot.collections.List&lt ;LogView> logviewlist = new
>
>> > org.apache.pivot.collections.ArrayList<LogView>();
>> >
>> > for (Log log : person.getLogs()) {
>> >
>> > if (log instanceof Log) {
>> >
>> > Log restclientlog = (Log) log;
>> >
>> > ListView sysfieldlistView = new ListView();
>> >
>> > sysfieldlistView.setItemRenderer(new FieldItemRenderer());
>> >
>> > org.apache.pivot.collections.List<Field> syslist = new
>> > ArrayList<Field>();
>> >
>> > for (Field field : restclientlog.sysFields) {
>> >
>> >       syslist.add(field);
>> >
>> > }
>> >
>> > sysfieldlistView.setListData(syslist);
>> >
>> > FlowPane flowPane = new FlowPane();
>> >
>> > flowPane.add(sysfieldlistView);
>> >
>> > logviewlist.add(new LogView(log, flowPane));
>> >
>> > }
>> >
>> > }
>> >
>> > listView.setListData(logviewlist);
>> >
>> > Accordion.setHeaderData(listView, "Log");
>> >
>> > centerAccordion.getPanels().add(listView);
>> >
>> >
>> > }
>> >
>> >
>> > Both FieldItemRender and LogItemRenderer follow
>> > your ListViewItemRenderer
>> > and most component show up properly except the content of FlowPane.
>> >
>> >
>> > I have no idea why the content in the FlowPane can't show up.
>> >
>> >
>> > Any help?
>> >
>> >
>> > Brendan
>> >
>> >

Mime
View raw message