Quick Select Support for the GroupCreationTab #77
@ -0,0 +1,21 @@
|
||||
package envoy.client.ui.control;
|
||||
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
import envoy.data.User;
|
||||
|
||||
/**
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy Client v0.3-beta
|
||||
*/
|
||||
public class QuickSelectControl extends Label {
|
||||
|
||||
public QuickSelectControl(User user) {
|
||||
setPrefSize(35, 35);
|
||||
setMaxSize(35, 35);
|
||||
setMinSize(35, 35);
|
||||
setText(user.getName());
|
||||
getStyleClass().add("quick-select");
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,7 @@ import javafx.scene.layout.HBox;
|
||||
|
||||
import envoy.client.data.*;
|
||||
import envoy.client.event.BackEvent;
|
||||
import envoy.client.ui.control.ContactControl;
|
||||
import envoy.client.ui.control.*;
|
||||
import envoy.client.ui.listcell.ListCellFactory;
|
||||
import envoy.data.*;
|
||||
import envoy.event.GroupCreation;
|
||||
@ -58,6 +58,9 @@ public class GroupCreationTab implements EventListener {
|
||||
@FXML
|
||||
private HBox errorProceedBox;
|
||||
|
||||
@FXML
|
||||
private ListView<QuickSelectControl> quickSelectList;
|
||||
|
||||
private String name;
|
||||
|
||||
private final LocalDB localDB = Context.getInstance().getLocalDB();
|
||||
@ -86,7 +89,10 @@ public class GroupCreationTab implements EventListener {
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
@FXML
|
||||
private void userListClicked() { createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank()); }
|
||||
private void userListClicked() {
|
||||
createButton.setDisable(userList.getSelectionModel().isEmpty() || groupNameField.getText().isBlank());
|
||||
quickSelectList.getItems().add(new QuickSelectControl(userList.getSelectionModel().getSelectedItem()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, whether the {@code createButton} can be enabled because text is
|
||||
|
@ -83,3 +83,7 @@
|
||||
-fx-text-fill: white;
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
.quick-select {
|
||||
-fx-background-color: black;
|
||||
}
|
||||
|
@ -64,6 +64,7 @@
|
||||
<Insets bottom="5.0" top="5" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<ListView fx:id="quickSelectList" orientation="HORIZONTAL" prefHeight="80.0" />
|
||||
<ListView id="chat-list" fx:id="userList" focusTraversable="false" onMouseClicked="#userListClicked" prefWidth="316.0" VBox.vgrow="ALWAYS">
|
||||
<contextMenu>
|
||||
<ContextMenu anchorLocation="CONTENT_TOP_LEFT" />
|
||||
|
Reference in New Issue
Block a user