53 lines
1.4 KiB
Java
53 lines
1.4 KiB
Java
package envoy.client.ui.control;
|
|
|
|
import javafx.geometry.Pos;
|
|
import javafx.scene.control.*;
|
|
import javafx.scene.image.ImageView;
|
|
import javafx.scene.layout.VBox;
|
|
import javafx.scene.shape.Rectangle;
|
|
|
|
import envoy.client.ui.controller.GroupCreationTab;
|
|
import envoy.client.util.IconUtil;
|
|
import envoy.data.User;
|
|
|
|
/**
|
|
* @author Maximilian Käfer
|
|
* @since Envoy Client v0.3-beta
|
|
*/
|
|
public class QuickSelectControl extends VBox {
|
|
|
|
public QuickSelectControl(User user, GroupCreationTab tab) {
|
|
Button removeBtn = new Button();
|
|
removeBtn.setPrefSize(10, 10);
|
|
removeBtn.setMaxSize(10, 10);
|
|
removeBtn.setMinSize(10, 10);
|
|
removeBtn.setAlignment(Pos.TOP_RIGHT);
|
|
removeBtn.setOnMouseClicked(evt -> {
|
|
tab.removeFromQuickSelection(this);
|
|
});
|
|
removeBtn.setId("remove-button");
|
|
getChildren().add(removeBtn);
|
|
|
|
// Profile picture
|
|
ImageView contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("user_icon", 32));
|
|
final var clip = new Rectangle();
|
|
clip.setWidth(32);
|
|
clip.setHeight(32);
|
|
clip.setArcHeight(32);
|
|
clip.setArcWidth(32);
|
|
contactProfilePic.setClip(clip);
|
|
setAlignment(Pos.TOP_CENTER);
|
|
getChildren().add(contactProfilePic);
|
|
|
|
Label nameLabel = new Label();
|
|
nameLabel.setPrefSize(35, 20);
|
|
nameLabel.setMaxSize(35, 20);
|
|
nameLabel.setMinSize(35, 20);
|
|
nameLabel.setText(user.getName());
|
|
nameLabel.setAlignment(Pos.TOP_CENTER);
|
|
getChildren().add(nameLabel);
|
|
|
|
getStyleClass().add("quick-select");
|
|
}
|
|
}
|