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