34 lines
873 B
Java
34 lines
873 B
Java
package envoy.client.ui;
|
|
|
|
import envoy.data.Contact;
|
|
import envoy.data.User;
|
|
import javafx.scene.control.Label;
|
|
import javafx.scene.control.ListCell;
|
|
import javafx.scene.layout.VBox;
|
|
|
|
/**
|
|
* Project: <strong>envoy-client</strong><br>
|
|
* File: <strong>UserListCell.java</strong><br>
|
|
* Created: <strong>28.03.2020</strong><br>
|
|
*
|
|
* @author Kai S. K. Engelbart
|
|
* @since Envoy Client v0.1-beta
|
|
*/
|
|
public class UserListCell extends ListCell<Contact> {
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
@Override
|
|
protected void updateItem(Contact contact, boolean empty) {
|
|
super.updateItem(contact, empty);
|
|
if (!empty && contact != null) {
|
|
final Label name = new Label(contact.getName());
|
|
if (contact instanceof User) {
|
|
final Label status = new Label(((User) contact).getStatus().toString());
|
|
setGraphic(new VBox(name, status));
|
|
} else setGraphic(new VBox(name));
|
|
}
|
|
}
|
|
}
|