<?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Button?> <?import…
- Usercode
- Assistant
<!-- Close Icon (Anchored to Top Right) -->
<ImageView fx:id="closeIcon" fitHeight="33.0" fitWidth="36.0" styleClass="close-icon">
<image>
<Image url="@../../Icons/no.png" />
</image>
<AnchorPane.topAnchor>10.0</AnchorPane.topAnchor>
<AnchorPane.rightAnchor>10.0</AnchorPane.rightAnchor>
</ImageView>
<!-- Main Content Container -->
<VBox prefHeight="755.0" prefWidth="1111.0" spacing="20.0" styleClass="main-container" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<!-- Search and Filter Section -->
<HBox alignment="CENTER_LEFT" prefHeight="54.0" prefWidth="1091.0" spacing="20" styleClass="search-container">
<!-- Search Field with Icon -->
<StackPane prefHeight="57.0" prefWidth="306.0" styleClass="search-field-container">
<children>
<TextField prefHeight="34.0" prefWidth="283.0" promptText="Search" styleClass="search-field" />
<ImageView fitHeight="26.0" fitWidth="31.0" styleClass="search-icon" StackPane.alignment="CENTER_RIGHT">
<image>
<Image url="@../../Icons/search.png" />
</image>
</ImageView>
</children>
</StackPane>
<!-- Radio Buttons -->
<HBox alignment="CENTER_LEFT" spacing="15" styleClass="radio-group">
<children>
<RadioButton selected="true" text="File Number" />
<RadioButton text="Mobile Number" />
<RadioButton text="Civil ID" />
<RadioButton text="All" />
</children>
</HBox>
</HBox>
<!-- Patient Info Section -->
<VBox prefHeight="180.0" prefWidth="1091.0" spacing="0" styleClass="section-container">
<!-- Section Header -->
<HBox alignment="CENTER_LEFT" prefHeight="45.0" prefWidth="1091.0" styleClass="section-header">
<children>
<Label prefHeight="50.0" prefWidth="127.0" styleClass="section-title" text="Patient Info">
<graphic>
<ImageView fitHeight="24.0" fitWidth="24.0">
<image>
<Image url="@../../Icons/info.png" />
</image>
</ImageView>
</graphic>
</Label>
</children>
</HBox>
<!-- Patient Info Grid -->
<VBox spacing="0" styleClass="content-container">
<!-- Headers Row -->
<HBox alignment="CENTER_LEFT" prefHeight="50.0" prefWidth="1091.0" styleClass="grid-header-row">
<children>
<Label styleClass="grid-header" text="File" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="130.0" styleClass="grid-header" text="Arabic Name" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="197.0" styleClass="grid-header" text="English Name" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="138.0" styleClass="grid-header" text="Mobile Number" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="100.0" styleClass="grid-header" text="Birthdate" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="97.0" styleClass="grid-header" text="User Name" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="111.0" styleClass="grid-header" text="Notice" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<!-- Data Row -->
<HBox alignment="CENTER_LEFT" prefHeight="51.0" prefWidth="1091.0" styleClass="grid-data-row">
<children>
<Label styleClass="grid-cell" text="42604" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label styleClass="grid-cell" text="مهند درويش محمد" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label styleClass="grid-cell" text="Mohanad Darwish Mohamed" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="141.0" styleClass="grid-cell" text="01117521556" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="100.0" styleClass="grid-cell" text="22-4-2001" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="97.0" styleClass="grid-cell" text="Honda" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label styleClass="grid-cell" text="" HBox.hgrow="ALWAYS" />
</children>
</HBox>
</VBox>
</VBox>
<!-- Add Attachment Button Above Patient App and Centered -->
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="866.0">
<children>
<Button fx:id="attachmentButton" prefHeight="21.0" prefWidth="214.0" styleClass="attachment-button" text=" Add Attachment">
<graphic>
<ImageView fitHeight="31.0" fitWidth="28.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Icons/AddDoc.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
</HBox>
<!-- Patient App Section -->
<VBox prefHeight="425.0" prefWidth="1073.0" spacing="5" styleClass="section-container">
<!-- Section Header -->
<HBox alignment="CENTER_LEFT" prefHeight="45.0" prefWidth="1091.0" styleClass="section-header">
<children>
<Label styleClass="section-title" text="Patient App">
<graphic>
<ImageView fitHeight="24.0" fitWidth="24.0">
<image>
<Image url="@../../Icons/sand-clock.png" />
</image>
</ImageView>
</graphic>
</Label>
</children>
</HBox>
<!-- Legend Bar -->
<HBox alignment="CENTER_LEFT" prefHeight="90.0" prefWidth="1030.0" spacing="15" styleClass="legend-bar">
<children>
<!-- Individual Legend Items -->
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #90e1f4;" />
<Label text="موعد في المستقبل" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #89BC1B;" />
<Label text="وصول" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #5be26d;" />
<Label text="تأكيد الموعد" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #904E41;" />
<Label text="تأكيد برسالة" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #7695E5;" />
<Label text="عدم الرد" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #EF6B7B;" />
<Label prefHeight="15.0" prefWidth="68.0" text="الجهاز مغلق" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #8F9998;" />
<Label text="مفصول عن الخدمة" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #C25DEA;" />
<Label text="موعد ثاني" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #C08E1A;" />
<Label text="الغاء الموعد" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #23B1D7;" />
<Label text="تأخير في الطريق" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #F6F138;" />
<Label text="خروج" />
</HBox>
<!-- Add remaining legend items as needed -->
</children>
</HBox>
<!-- Patient App Content -->
<VBox spacing="10" styleClass="content-container">
<!-- TableView -->
<TableView fx:id="patientAppTable" prefHeight="300.0" prefWidth="1030.0" styleClass="patient-app-table">
<columns>
<TableColumn fx:id="fileColumn" text="File" />
<TableColumn fx:id="timeColumn" text="Time" />
<TableColumn fx:id="dateColumn" text="Date" />
<TableColumn fx:id="deleteColumn" text="Delete" />
<TableColumn fx:id="appColumn" text="App" />
<TableColumn fx:id="statusColumn" text="Status" />
<TableColumn fx:id="groupColumn" text="Group" />
<TableColumn fx:id="memoColumn" text="MEMO" />
<TableColumn fx:id="codeColumn" text="Code" />
<TableColumn fx:id="drNameColumn" text="Dr Name" />
<TableColumn fx:id="userChangeStatusColumn" text="User Change Status" />
<TableColumn fx:id="userNameCreatedColumn" text="User Name Created" />
<TableColumn fx:id="createdDateTimeColumn" text="Created Date/Time" />
</columns>
<!-- Sample rows can be populated programmatically in the controller -->
</TableView>
</VBox>
</VBox>
</VBox>
/* Main Container Styles / .main-container { -fx-background-color: #e0ebff; -fx-padding: 20; -fx-spacing: 30; / Increased spacing for better layout */ -fx-font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }
/* Search Section Styles / .search-container { -fx-padding: 10 0; / Added vertical padding / -fx-alignment: CENTER_LEFT; -fx-spacing: 25; / Increased spacing between search field and radio buttons */ }
.search-field-container { -fx-alignment: CENTER_LEFT; -fx-spacing: 5; -fx-padding: 0; }
.search-field { -fx-pref-width: 300; -fx-background-color: white; -fx-background-radius: 20; -fx-padding: 8 30 8 8; /* Right padding to accommodate the icon */ -fx-border-color: #b3c7e6; -fx-border-width: 1px; }
.search-icon { -fx-opacity: 0.5; /* Positioned to the right via StackPane alignment in FXML */ }
/* Radio Buttons Group / .radio-group { -fx-alignment: CENTER_LEFT; -fx-spacing: 20; / Increased spacing between radio buttons */ }
.radio-group .radio-button { -fx-padding: 0 10; -fx-font-size: 13; }
/* Close Icon Styles / .close-icon { -fx-cursor: hand; -fx-background-color: transparent; / Transparent background / -fx-padding: 5; / Padding around the icon */ }
.close-icon:hover { -fx-opacity: 0.7; /* Slightly transparent on hover for feedback */ }
/* Section Container Styles (Both Patient Info and Patient App) / .section-container { -fx-background-color: #e0ebff; -fx-background-radius: 10; -fx-padding: 15; / Added padding for inner content / -fx-spacing: 0; / Removed spacing to ensure tight alignment */ }
/* Section Header Styles / .section-header { -fx-padding: 0; / Removed padding */ -fx-spacing: 10; -fx-alignment: CENTER_LEFT; }
/* Section Title Styles / .section-title { / Grey background with rounded top-right corner / -fx-background-color: #e7e4e4; -fx-font-size: 14; -fx-font-weight: bold; -fx-text-fill: #333333; -fx-padding: 5 10; / Rounded top-right corner: top-left, top-right, bottom-right, bottom-left / -fx-background-radius: 0 10 0 0; -fx-alignment: CENTER_LEFT; / Align text to the left */ }
/* Content Container Styles / .content-container { -fx-background-color: #e8f5e9; -fx-padding: 0; -fx-background-radius: 0 0 10 10; / Rounded bottom corners only / -fx-spacing: 10; / Added spacing between child elements */ }
/* Patient Info Grid Header Styles */ .grid-header-row { -fx-background-color: #c8e6c9; -fx-padding: 8; -fx-spacing: 0; -fx-alignment: CENTER_LEFT; }
.grid-header-row .grid-header { -fx-font-size: 13; -fx-font-weight: bold; }
/* Patient Info Grid Data Row Styles */ .grid-data-row { -fx-background-color: white; -fx-padding: 8; -fx-spacing: 0; -fx-alignment: CENTER_LEFT; }
.grid-header, .grid-cell { -fx-padding: 8 15; -fx-alignment: CENTER_LEFT; /* Align cells with headers */ -fx-min-width: 100; -fx-font-size: 13; }
.grid-header { -fx-font-weight: bold; }
/* Vertical Separator Lines / .vertical-line { -fx-stroke: #2e7d32; / Dark green color for visibility / -fx-stroke-width: 2; / Increased stroke width for prominence / -fx-stroke-line-cap: ROUND; / Rounded ends for a polished look */ -fx-fill: transparent; }
/* Legend Bar Styles / .legend-bar { -fx-background-color: white; / White background for contrast / -fx-padding: 15; / Increased padding / -fx-background-radius: 10 10 0 0; -fx-spacing: 20; / Increased spacing between items / -fx-effect: dropshadow(one-pass-box, rgba(0,0,0,0.1), 5, 0, 0, 1); / Subtle shadow */ }
.legend-bar .circle { -fx-radius: 5; }
.legend-bar Label { -fx-font-size: 13; /* Increased font size for better readability */ -fx-text-fill: #333333; }
/* Patient App Table Styles / .patient-app-table { -fx-background-color: #f9f9f9; / Light background for the table / -fx-padding: 10; -fx-border-color: #90c491; -fx-border-radius: 0 0 10 10; / Rounded bottom corners / -fx-cell-border-color: transparent; / Remove default cell borders */ -fx-table-cell-border-color: transparent; }
.patient-app-table .column-header-background { -fx-background-color: #c8e6c9; /* Matching Patient Info header color */ }
.patient-app-table .column-header, .patient-app-table .column-header .label { -fx-font-size: 13; -fx-font-weight: bold; -fx-text-fill: white; -fx-background-color:#90c491; /* Header text color */ }
.patient-app-table .table-row-cell:filled:odd { -fx-background-color: #e3f2fd; /* Light blue for odd rows */ }
.patient-app-table .table-row-cell:filled:even { -fx-background-color: #ffffff; /* White for even rows */ }
.patient-app-table .table-cell { -fx-alignment: CENTER_LEFT; /* Align cell content to the left / -fx-padding: 8 15; / Padding for better readability / -fx-text-fill: #333333; / Cell text color */ }
/* Styling Delete Button Within Table Cells / .patient-app-table .table-cell .button { -fx-background-color: #d9534f; / Red color for delete */ -fx-text-fill: white; -fx-padding: 5 10; -fx-background-radius: 5; -fx-cursor: hand; }
.patient-app-table .table-cell .button:hover { -fx-background-color: #c9302c; }
/* Add Attachment Button Styles / .attachment-button { -fx-background-color: #4a8dd1; -fx-text-fill: white; -fx-padding: 10 20; / Increased padding for better click area */ -fx-background-radius: 10; -fx-cursor: hand; -fx-font-size: 14; -fx-font-weight: bold; -fx-border-radius: 10; -fx-border-color: #346599; -fx-border-width: 1px; }
.attachment-button:hover { -fx-background-color: #3b7bbf; }
/* Optional: Delete Button Specific Styles / .delete-button { -fx-background-color: #d9534f; / Red color */ -fx-text-fill: white; -fx-padding: 5 10; -fx-background-radius: 5; -fx-cursor: hand; }
.delete-button:hover { -fx-background-color: #c9302c; }
I want to add some rows to the table , is it ok? if it give me the whole files updated
Yes, you can certainly add rows to your TableView to display patient appointments or other relevant data. In JavaFX, it's customary to populate the TableView using the controller class rather than directly within the FXML file. This approach leverages the Model-View-Controller (MVC) architecture, ensuring a clean separation between your UI layout and the data handling logic.
Below, I'll provide you with:
fx:ids are in place and the TableView is properly configured.TableView with sample data.Your current FXML is mostly well-structured. To ensure that the TableView can be populated dynamically, make sure each TableColumn is correctly linked to the properties of your data model. Here's the updated FXML with necessary bindings and slight modifications:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<AnchorPane prefHeight="755.0" prefWidth="1111.0" stylesheets="@PatientApp.css" xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.clinic.AddAttachment.AddAttachmentController">
<!-- Close Icon (Anchored to Top Right) -->
<ImageView fx:id="closeIcon" fitHeight="33.0" fitWidth="36.0" styleClass="close-icon">
<image>
<Image url="@../../Icons/no.png" />
</image>
<AnchorPane.topAnchor>10.0</AnchorPane.topAnchor>
<AnchorPane.rightAnchor>10.0</AnchorPane.rightAnchor>
</ImageView>
<!-- Main Content Container -->
<VBox prefHeight="755.0" prefWidth="1111.0" spacing="20.0" styleClass="main-container" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<!-- Search and Filter Section -->
<HBox alignment="CENTER_LEFT" prefHeight="54.0" prefWidth="1091.0" spacing="20" styleClass="search-container">
<!-- Search Field with Icon -->
<StackPane prefHeight="57.0" prefWidth="306.0" styleClass="search-field-container">
<children>
<TextField fx:id="searchField" prefHeight="34.0" prefWidth="283.0" promptText="Search" styleClass="search-field" />
<ImageView fitHeight="26.0" fitWidth="31.0" styleClass="search-icon" StackPane.alignment="CENTER_RIGHT">
<image>
<Image url="@../../Icons/search.png" />
</image>
</ImageView>
</children>
</StackPane>
<!-- Radio Buttons -->
<HBox alignment="CENTER_LEFT" spacing="15" styleClass="radio-group">
<children>
<RadioButton fx:id="fileNumberRadio" selected="true" text="File Number" />
<RadioButton fx:id="mobileNumberRadio" text="Mobile Number" />
<RadioButton fx:id="civilIdRadio" text="Civil ID" />
<RadioButton fx:id="allRadio" text="All" />
</children>
</HBox>
</HBox>
<!-- Patient Info Section -->
<VBox prefHeight="180.0" prefWidth="1091.0" spacing="0" styleClass="section-container">
<!-- Section Header -->
<HBox alignment="CENTER_LEFT" prefHeight="45.0" prefWidth="1091.0" styleClass="section-header">
<children>
<Label prefHeight="50.0" prefWidth="127.0" styleClass="section-title" text="Patient Info">
<graphic>
<ImageView fitHeight="24.0" fitWidth="24.0">
<image>
<Image url="@../../Icons/info.png" />
</image>
</ImageView>
</graphic>
</Label>
</children>
</HBox>
<!-- Patient Info Grid -->
<VBox spacing="0" styleClass="content-container">
<!-- Headers Row -->
<HBox alignment="CENTER_LEFT" prefHeight="50.0" prefWidth="1091.0" styleClass="grid-header-row">
<children>
<Label styleClass="grid-header" text="File" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="130.0" styleClass="grid-header" text="Arabic Name" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="197.0" styleClass="grid-header" text="English Name" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="138.0" styleClass="grid-header" text="Mobile Number" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="100.0" styleClass="grid-header" text="Birthdate" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="97.0" styleClass="grid-header" text="User Name" HBox.hgrow="ALWAYS" />
<Separator orientation="VERTICAL" styleClass="vertical-line" />
<Label prefWidth="111.0" styleClass="grid-header" text="Notice" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<!-- Data Row -->
<!-- You can remove this static data row if you plan to use TableView for data display -->
</VBox>
</VBox>
<!-- Add Attachment Button Above Patient App and Centered -->
<HBox alignment="CENTER" prefHeight="50.0" prefWidth="866.0">
<children>
<Button fx:id="attachmentButton" prefHeight="21.0" prefWidth="214.0" styleClass="attachment-button" text=" Add Attachment">
<graphic>
<ImageView fitHeight="31.0" fitWidth="28.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Icons/AddDoc.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
</HBox>
<!-- Patient App Section -->
<VBox prefHeight="425.0" prefWidth="1073.0" spacing="5" styleClass="section-container">
<!-- Section Header -->
<HBox alignment="CENTER_LEFT" prefHeight="45.0" prefWidth="1091.0" styleClass="section-header">
<children>
<Label styleClass="section-title" text="Patient App">
<graphic>
<ImageView fitHeight="24.0" fitWidth="24.0">
<image>
<Image url="@../../Icons/sand-clock.png" />
</image>
</ImageView>
</graphic>
</Label>
</children>
</HBox>
<!-- Legend Bar -->
<HBox alignment="CENTER_LEFT" prefHeight="90.0" prefWidth="1030.0" spacing="15" styleClass="legend-bar">
<children>
<!-- Individual Legend Items -->
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #90e1f4;" />
<Label text="موعد في المستقبل" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #89BC1B;" />
<Label text="وصول" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #5be26d;" />
<Label text="تأكيد الموعد" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #904E41;" />
<Label text="تأكيد برسالة" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #7695E5;" />
<Label text="عدم الرد" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #EF6B7B;" />
<Label prefHeight="15.0" prefWidth="68.0" text="الجهاز مغلق" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #8F9998;" />
<Label text="مفصول عن الخدمة" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #C25DEA;" />
<Label text="موعد ثاني" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #C08E1A;" />
<Label text="الغاء الموعد" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #23B1D7;" />
<Label text="تأخير في الطريق" />
</HBox>
<HBox alignment="CENTER_LEFT" spacing="5">
<Circle radius="10.0" style="-fx-fill: #F6F138;" />
<Label text="خروج" />
</HBox>
<!-- Add remaining legend items as needed -->
</children>
</HBox>
<!-- Patient App Content -->
<VBox spacing="10" styleClass="content-container">
<!-- TableView -->
<TableView fx:id="patientAppTable" prefHeight="300.0" prefWidth="1030.0" styleClass="patient-app-table">
<columns>
<TableColumn fx:id="fileColumn" text="File" />
<TableColumn fx:id="timeColumn" text="Time" />
<TableColumn fx:id="dateColumn" text="Date" />
<TableColumn fx:id="deleteColumn" text="Delete" />
<TableColumn fx:id="appColumn" text="App" />
<TableColumn fx:id="statusColumn" text="Status" />
<TableColumn fx:id="groupColumn" text="Group" />
<TableColumn fx:id="memoColumn" text="MEMO" />
<TableColumn fx:id="codeColumn" text="Code" />
<TableColumn fx:id="drNameColumn" text="Dr Name" />
<TableColumn fx:id="userChangeStatusColumn" text="User Change Status" />
<TableColumn fx:id="userNameCreatedColumn" text="User Name Created" />
<TableColumn fx:id="createdDateTimeColumn" text="Created Date/Time" />
</columns>
<!-- Items will be populated programmatically in the controller -->
</TableView>
</VBox>
</VBox>
</VBox>
</AnchorPane>
Key Changes:
fx:controller to point to AddAttachmentController (ensure your controller class name matches).HBox data row within the Patient Info Grid can be removed if you intend to use the TableView for dynamic data display.fx:ids: Ensure all interactive components you wish to manipulate from the controller have appropriate fx:ids.Create a model class that represents the data structure for each row in the TableView. For example, let's create a class named PatientAppointment.
Explanation:
TableView corresponds to a property in this model class.SimpleStringProperty is used for simplicity; for more complex data types (e.g., dates, numbers), consider using appropriate property types.Create or update your controller class (AddAttachmentController) to initialize the TableView with sample data.
Explanation:
@FXML): These link the controller's Java variables to the UI components defined in the FXML file.TableColumn is set up to map to the corresponding property in the PatientAppointment model.deleteColumn is customized to include a "Delete" button in each row, allowing users to remove appointments.loadSampleData method initializes the TableView with sample appointments. You can expand this list as needed.deleteAppointment method removes the selected appointment from the observable list, which automatically updates the TableView.Ensure your CSS (PatientApp.css) includes styles for the delete button and any other new components. Here's an addition to style the delete button within the table:
/* Delete Button Styles */
.delete-button {
-fx-background-color: #d9534f; /* Red color */
-fx-text-fill: white;
-fx-padding: 5 10;
-fx-background-radius: 5;
-fx-cursor: hand;
-fx-font-size: 12;
}
.delete-button:hover {
-fx-background-color: #c9302c;
}
/* Adjust TableView Styles if necessary */
.patient-app-table {
-fx-background-color: #f9f9f9; /* Light background for the table */
-fx-padding: 10;
-fx-border-color: #90c491;
-fx-border-radius: 0 0 10 10; /* Rounded bottom corners */
-fx-cell-border-color: transparent; /* Remove default cell borders */
-fx-table-cell-border-color: transparent;
}
.patient-app-table .column-header-background {
-fx-background-color: #c8e6c9; /* Matching Patient Info header color */
}
.patient-app-table .column-header, .patient-app-table .column-header .label {
-fx-font-size: 13;
-fx-font-weight: bold;
-fx-text-fill: white;
-fx-background-color: #90c491; /* Header text color */
}
.patient-app-table .table-row-cell:filled:odd {
-fx-background-color: #e3f2fd; /* Light blue for odd rows */
}
.patient-app-table .table-row-cell:filled:even {
-fx-background-color: #ffffff; /* White for even rows */
}
.patient-app-table .table-cell {
-fx-alignment: CENTER_LEFT; /* Align cell content to the left */
-fx-padding: 8 15; /* Padding for better readability */
-fx-text-fill: #333333; /* Cell text color */
}
Explanation:
.delete-button to appear red with white text, resembling a typical delete action button.TableView, including header colors, alternating row colors for readability, and cell padding.closeIcon to define their behaviors (e.g., closing the window when clicked).For clarity, here's an overview of the files involved:
src/
└── com/
└── example/
└── clinic/
└── AddAttachment/
├── AddAttachmentController.java
├── PatientAppointment.java
├── AddAttachment.fxml
└── PatientApp.css
Ensure that your project structure aligns with the package declarations and that all resources (icons, CSS) are correctly placed in the project's resource directories.
By following the above steps, your TableView should now display sample rows representing patient appointments. You can expand upon this foundation by integrating real data sources, enhancing functionalities, and refining the UI as needed.
If you encounter any issues or need further customization, feel free to ask!
Not yet included in a published release.
package com.example.clinic.AddAttachment;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class PatientAppointment {
private final StringProperty file;
private final StringProperty time;
private final StringProperty date;
private final StringProperty delete;
private final StringProperty app;
private final StringProperty status;
private final StringProperty group;
private final StringProperty memo;
private final StringProperty code;
private final StringProperty drName;
private final StringProperty userChangeStatus;
private final StringProperty userNameCreated;
private final StringProperty createdDateTime;
public PatientAppointment(String file, String time, String date, String delete, String app,
String status, String group, String memo, String code,
String drName, String userChangeStatus, String userNameCreated,
String createdDateTime) {
this.file = new SimpleStringProperty(file);
this.time = new SimpleStringProperty(time);
this.date = new SimpleStringProperty(date);
this.delete = new SimpleStringProperty(delete);
this.app = new SimpleStringProperty(app);
this.status = new SimpleStringProperty(status);
this.group = new SimpleStringProperty(group);
this.memo = new SimpleStringProperty(memo);
this.code = new SimpleStringProperty(code);
this.drName = new SimpleStringProperty(drName);
this.userChangeStatus = new SimpleStringProperty(userChangeStatus);
this.userNameCreated = new SimpleStringProperty(userNameCreated);
this.createdDateTime = new SimpleStringProperty(createdDateTime);
}
// Getters and Setters for each property
public String getFile() { return file.get(); }
public void setFile(String value) { file.set(value); }
public StringProperty fileProperty() { return file; }
public String getTime() { return time.get(); }
public void setTime(String value) { time.set(value); }
public StringProperty timeProperty() { return time; }
public String getDate() { return date.get(); }
public void setDate(String value) { date.set(value); }
public StringProperty dateProperty() { return date; }
public String getDelete() { return delete.get(); }
public void setDelete(String value) { delete.set(value); }
public StringProperty deleteProperty() { return delete; }
public String getApp() { return app.get(); }
public void setApp(String value) { app.set(value); }
public StringProperty appProperty() { return app; }
public String getStatus() { return status.get(); }
public void setStatus(String value) { status.set(value); }
public StringProperty statusProperty() { return status; }
public String getGroup() { return group.get(); }
public void setGroup(String value) { group.set(value); }
public StringProperty groupProperty() { return group; }
public String getMemo() { return memo.get(); }
public void setMemo(String value) { memo.set(value); }
public StringProperty memoProperty() { return memo; }
public String getCode() { return code.get(); }
public void setCode(String value) { code.set(value); }
public StringProperty codeProperty() { return code; }
public String getDrName() { return drName.get(); }
public void setDrName(String value) { drName.set(value); }
public StringProperty drNameProperty() { return drName; }
public String getUserChangeStatus() { return userChangeStatus.get(); }
public void setUserChangeStatus(String value) { userChangeStatus.set(value); }
public StringProperty userChangeStatusProperty() { return userChangeStatus; }
public String getUserNameCreated() { return userNameCreated.get(); }
public void setUserNameCreated(String value) { userNameCreated.set(value); }
public StringProperty userNameCreatedProperty() { return userNameCreated; }
public String getCreatedDateTime() { return createdDateTime.get(); }
public void setCreatedDateTime(String value) { createdDateTime.set(value); }
public StringProperty createdDateTimeProperty() { return createdDateTime; }
}
package com.example.clinic.AddAttachment;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.*;
public class AddAttachmentController {
@FXML
private ImageView closeIcon;
@FXML
private TextField searchField;
@FXML
private RadioButton fileNumberRadio;
@FXML
private RadioButton mobileNumberRadio;
@FXML
private RadioButton civilIdRadio;
@FXML
private RadioButton allRadio;
@FXML
private Button attachmentButton;
@FXML
private TableView<PatientAppointment> patientAppTable;
@FXML
private TableColumn<PatientAppointment, String> fileColumn;
@FXML
private TableColumn<PatientAppointment, String> timeColumn;
@FXML
private TableColumn<PatientAppointment, String> dateColumn;
@FXML
private TableColumn<PatientAppointment, String> deleteColumn;
@FXML
private TableColumn<PatientAppointment, String> appColumn;
@FXML
private TableColumn<PatientAppointment, String> statusColumn;
@FXML
private TableColumn<PatientAppointment, String> groupColumn;
@FXML
private TableColumn<PatientAppointment, String> memoColumn;
@FXML
private TableColumn<PatientAppointment, String> codeColumn;
@FXML
private TableColumn<PatientAppointment, String> drNameColumn;
@FXML
private TableColumn<PatientAppointment, String> userChangeStatusColumn;
@FXML
private TableColumn<PatientAppointment, String> userNameCreatedColumn;
@FXML
private TableColumn<PatientAppointment, String> createdDateTimeColumn;
private ObservableList<PatientAppointment> appointmentData;
@FXML
private void initialize() {
// Initialize the columns
fileColumn.setCellValueFactory(cellData -> cellData.getValue().fileProperty());
timeColumn.setCellValueFactory(cellData -> cellData.getValue().timeProperty());
dateColumn.setCellValueFactory(cellData -> cellData.getValue().dateProperty());
appColumn.setCellValueFactory(cellData -> cellData.getValue().appProperty());
statusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());
groupColumn.setCellValueFactory(cellData -> cellData.getValue().groupProperty());
memoColumn.setCellValueFactory(cellData -> cellData.getValue().memoProperty());
codeColumn.setCellValueFactory(cellData -> cellData.getValue().codeProperty());
drNameColumn.setCellValueFactory(cellData -> cellData.getValue().drNameProperty());
userChangeStatusColumn.setCellValueFactory(cellData -> cellData.getValue().userChangeStatusProperty());
userNameCreatedColumn.setCellValueFactory(cellData -> cellData.getValue().userNameCreatedProperty());
createdDateTimeColumn.setCellValueFactory(cellData -> cellData.getValue().createdDateTimeProperty());
// Initialize the delete column with a Button
deleteColumn.setCellFactory(param -> new TableCell<>() {
private final Button deleteButton = new Button("Delete");
{
deleteButton.getStyleClass().add("delete-button");
deleteButton.setOnAction(event -> {
PatientAppointment appointment = getTableView().getItems().get(getIndex());
deleteAppointment(appointment);
});
}
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setGraphic(null);
} else {
setGraphic(deleteButton);
}
}
});
// Load sample data
loadSampleData();
// Set the data to the table
patientAppTable.setItems(appointmentData);
}
private void loadSampleData() {
appointmentData = FXCollections.observableArrayList(
new PatientAppointment("42604", "10:00 AM", "22-04-2001", "", "Initial Consultation",
"Confirmed", "Group A", "N/A", "C001",
"Dr. Smith", "Admin", "adminUser", "22-04-2024 09:00"),
new PatientAppointment("42605", "11:30 AM", "23-04-2001", "", "Follow-up",
"Pending", "Group B", "Requires additional tests", "C002",
"Dr. Johnson", "Admin", "adminUser", "23-04-2024 10:15"),
// Add more sample appointments as needed
);
}
private void deleteAppointment(PatientAppointment appointment) {
// Implement the deletion logic here
appointmentData.remove(appointment);
// Optionally, add confirmation dialogs or persistence logic
}
// Event handlers for other UI components (e.g., closeIcon, attachmentButton) can be added here
}