2020-09-25 14:29:23 +02:00
|
|
|
package envoy.client.ui.control;
|
2020-07-13 17:55:00 +02:00
|
|
|
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
import javafx.scene.layout.VBox;
|
|
|
|
|
2020-09-25 14:29:23 +02:00
|
|
|
import envoy.data.*;
|
2020-07-13 17:55:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays information about a contact in two rows. The first row contains the
|
|
|
|
* name. The second row contains the online status (user) or the member count
|
|
|
|
* (group).
|
|
|
|
*
|
|
|
|
* @author Kai S. K. Engelbart
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
2020-08-22 13:37:07 +02:00
|
|
|
public final class ContactControl extends VBox {
|
2020-07-13 17:55:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param contact the contact to display
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
|
|
|
public ContactControl(Contact contact) {
|
|
|
|
|
|
|
|
// Name label
|
|
|
|
final var nameLabel = new Label(contact.getName());
|
|
|
|
getChildren().add(nameLabel);
|
|
|
|
|
|
|
|
// Online status (user) or member count (group)
|
2020-10-08 14:34:21 +02:00
|
|
|
getChildren().add(contact instanceof User ? new UserStatusLabel((User) contact) : new GroupSizeLabel((Group) contact));
|
|
|
|
|
2020-08-26 15:50:46 +02:00
|
|
|
getStyleClass().add("list-element");
|
2020-07-13 17:55:00 +02:00
|
|
|
}
|
|
|
|
}
|