Quick Select Support for the GroupCreationTab #77
@ -1,11 +1,12 @@
|
|||||||
package envoy.client.ui.control;
|
package envoy.client.ui.control;
|
||||||
|
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.shape.Rectangle;
|
import javafx.scene.shape.Rectangle;
|
||||||
|
|
||||||
|
import envoy.client.ui.controller.GroupCreationTab;
|
||||||
import envoy.client.util.IconUtil;
|
import envoy.client.util.IconUtil;
|
||||||
import envoy.data.User;
|
import envoy.data.User;
|
||||||
|
|
||||||
@ -15,7 +16,17 @@ import envoy.data.User;
|
|||||||
*/
|
*/
|
||||||
public class QuickSelectControl extends VBox {
|
public class QuickSelectControl extends VBox {
|
||||||
|
|
||||||
public QuickSelectControl(User user) {
|
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
|
// Profile picture
|
||||||
ImageView contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("user_icon", 32));
|
ImageView contactProfilePic = new ImageView(IconUtil.loadIconThemeSensitive("user_icon", 32));
|
||||||
@ -38,5 +49,4 @@ public class QuickSelectControl extends VBox {
|
|||||||
|
|
||||||
getStyleClass().add("quick-select");
|
getStyleClass().add("quick-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
mpk marked this conversation as resolved
|
|||||||
|
@ -91,7 +91,7 @@ public class GroupCreationTab implements EventListener {
|
|||||||
@FXML
|
@FXML
|
||||||
private void userListClicked() {
|
private void userListClicked() {
|
||||||
createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank());
|
createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank());
|
||||||
quickSelectList.getItems().add(new QuickSelectControl(userList.getSelectionModel().getSelectedItem()));
|
quickSelectList.getItems().add(new QuickSelectControl(userList.getSelectionModel().getSelectedItem(), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -157,6 +157,8 @@ public class GroupCreationTab implements EventListener {
|
|||||||
return localDB.getChats().stream().map(Chat::getRecipient).filter(Group.class::isInstance).map(Contact::getName).anyMatch(newName::equals);
|
return localDB.getChats().stream().map(Chat::getRecipient).filter(Group.class::isInstance).map(Contact::getName).anyMatch(newName::equals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeFromQuickSelection(QuickSelectControl element) { quickSelectList.getItems().remove(element); }
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void backButtonClicked() {
|
private void backButtonClicked() {
|
||||||
eventBus.dispatch(new BackEvent());
|
eventBus.dispatch(new BackEvent());
|
||||||
|
@ -83,3 +83,8 @@
|
|||||||
-fx-text-fill: white;
|
-fx-text-fill: white;
|
||||||
-fx-background-color: transparent;
|
-fx-background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#remove-button {
|
||||||
|
-fx-background-color: red;
|
||||||
|
-fx-background-radius: 1em;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user
This is, as far as I can see, unnecessary.
Have tested it, it is.