Access to ListView Cells
Will Hoover
java.whoover at gmail.com
Fri Aug 31 04:39:27 PDT 2012
Hi Jonathan,
I have a ListView that contains custom ListCells which have a node that
visually indicates a status of a business process and a label for the
process name. I would like to be able to allow the user to set the status of
an item at any given time. How would I do so without accessing the cell from
myListView?
myListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>()
{
public ListCell<String> call(ListView<String> list) {
return new NodeStatusView();
}
});
NodeStatusView extends ListCell<String> {
...
StatusIndicator statusIndicator;
...
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!empty && item != null) {
setText(item);
myStatusNode = new StatusIndicator();
setGraphic(this.myStatusNode);
}
}
...
public StatusIndicator getStatusIndicator() {
return statusIndicator;
}
...
}
StatusIndicator extends Parent {
...
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
...
}
-----Original Message-----
From: Jonathan Giles [mailto:jonathan.giles at oracle.com]
Sent: Thursday, August 30, 2012 4:57 PM
To: Will Hoover
Cc: openjfx-dev at openjdk.java.net
Subject: Re: Access to ListView Cells
There isn't any API to access the cells within a ListView, unless you
provide the cell factory yourself. It would be useful to understand your use
case for wanting to access the cells outside of a cell factory.
-- Jonathan
On 31/08/2012 4:28 a.m., Will Hoover wrote:
> I may be missing something, but there doesn't seem to be a way to
> access cells generated from a ListView?
>
>
>
More information about the openjfx-dev
mailing list