New Group UI updated.
This commit is contained in:
@@ -29,6 +29,7 @@ public class AddMembersController {
|
||||
private final Set<Contact> selectedContacts = new HashSet<>();
|
||||
|
||||
private String groupName;
|
||||
private String groupId;
|
||||
private File groupImageFile;
|
||||
|
||||
// Sample data for testing
|
||||
@@ -239,8 +240,9 @@ public class AddMembersController {
|
||||
searchIcon.setGraphic(icon);
|
||||
}
|
||||
|
||||
public void setGroupInfo(String groupName, File groupImageFile) {
|
||||
public void setGroupInfo(String groupName, String groupId, File groupImageFile) {
|
||||
this.groupName = groupName;
|
||||
this.groupId = groupId;
|
||||
this.groupImageFile = groupImageFile;
|
||||
|
||||
// You can use these later when creating the group
|
||||
|
||||
@@ -29,6 +29,7 @@ public class AddSubscriberController {
|
||||
private final Set<Contact> selectedContacts = new HashSet<>();
|
||||
|
||||
private String channelName;
|
||||
private String channelId;
|
||||
private File channelImageFile;
|
||||
private String description;
|
||||
|
||||
@@ -201,8 +202,9 @@ public class AddSubscriberController {
|
||||
searchIcon.setGraphic(icon);
|
||||
}
|
||||
|
||||
public void setChannelInfo(String name, String description, File image) {
|
||||
public void setChannelInfo(String name, String id, String description, File image) {
|
||||
this.channelName = name;
|
||||
this.channelId = id;
|
||||
this.channelImageFile = image;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ public class NewGroupController {
|
||||
@FXML private Button cancelButton;
|
||||
@FXML private Button nextButton;
|
||||
@FXML private StackPane overlayRoot; // the root
|
||||
@FXML private TextField groupIdField;
|
||||
@FXML private Label groupIdLabel;
|
||||
|
||||
private File groupImageFile;
|
||||
|
||||
@@ -58,6 +60,7 @@ public class NewGroupController {
|
||||
|
||||
nextButton.setOnAction(e -> {
|
||||
String groupName = groupNameField.getText().trim();
|
||||
String groupId = groupIdField.getText().trim();
|
||||
|
||||
if (groupName.isEmpty()) {
|
||||
// Apply error style
|
||||
@@ -67,6 +70,14 @@ public class NewGroupController {
|
||||
return;
|
||||
}
|
||||
|
||||
if (groupId.isEmpty()) {
|
||||
// Apply error style
|
||||
groupIdField.getStyleClass().add("error");
|
||||
groupIdLabel.getStyleClass().add("error");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource(
|
||||
"/org/to/telegramfinalproject/Fxml/add_member.fxml"));
|
||||
@@ -74,7 +85,7 @@ public class NewGroupController {
|
||||
|
||||
// Optional: pass groupName and image to AddMembersController
|
||||
AddMembersController controller = loader.getController();
|
||||
controller.setGroupInfo(groupName, groupImageFile);
|
||||
controller.setGroupInfo(groupName, groupId, groupImageFile);
|
||||
|
||||
// Close the current "New Group" overlay
|
||||
MainController.getInstance().closeOverlay(overlayRoot);
|
||||
@@ -87,6 +98,7 @@ public class NewGroupController {
|
||||
}
|
||||
});
|
||||
|
||||
// Reset error state when typing
|
||||
groupNameField.textProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if (!newVal.trim().isEmpty()) {
|
||||
groupNameField.getStyleClass().remove("error");
|
||||
@@ -94,6 +106,14 @@ public class NewGroupController {
|
||||
}
|
||||
});
|
||||
|
||||
// Reset error state when typing
|
||||
groupIdField.textProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if (!newVal.trim().isEmpty()) {
|
||||
groupIdField.getStyleClass().remove("error");
|
||||
groupIdLabel.getStyleClass().remove("error");
|
||||
}
|
||||
});
|
||||
|
||||
// Auto_focus search bar when overlay opens
|
||||
Platform.runLater(() -> groupNameField.requestFocus());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user