diff --git a/app/alarm/model/src/main/java/org/phoebus/applications/alarm/AlarmSystem.java b/app/alarm/model/src/main/java/org/phoebus/applications/alarm/AlarmSystem.java index aca6d01f1b..63b0126b17 100644 --- a/app/alarm/model/src/main/java/org/phoebus/applications/alarm/AlarmSystem.java +++ b/app/alarm/model/src/main/java/org/phoebus/applications/alarm/AlarmSystem.java @@ -63,6 +63,9 @@ public class AlarmSystem extends AlarmSystemConstants /** Font size for the alarm area view */ @Preference public static int alarm_area_font_size; + /** Font size for the alarm table view */ + @Preference public static int alarm_table_font_size; + /** Limit for the number of context menu items */ @Preference public static int alarm_menu_max_items; diff --git a/app/alarm/model/src/main/resources/alarm_preferences.properties b/app/alarm/model/src/main/resources/alarm_preferences.properties index 181866785f..e724d9c00e 100644 --- a/app/alarm/model/src/main/resources/alarm_preferences.properties +++ b/app/alarm/model/src/main/resources/alarm_preferences.properties @@ -49,6 +49,9 @@ alarm_area_gap=5 # Font size for the alarm area view. alarm_area_font_size=15 +# Font size for the alarm table view. +alarm_table_font_size=12 + # Limit for the number of context menu items. # # Separately applied to the number of 'guidance', diff --git a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java index fd9036a42e..98ae4461bc 100644 --- a/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java +++ b/app/alarm/ui/src/main/java/org/phoebus/applications/alarm/ui/table/AlarmTableUI.java @@ -17,10 +17,12 @@ import javafx.application.Platform; import javafx.scene.control.TableColumnBase; +import javafx.scene.image.Image; import javafx.scene.layout.Background; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; +import javafx.scene.text.Font; import org.phoebus.applications.alarm.AlarmSystem; import org.phoebus.applications.alarm.client.AlarmClient; import org.phoebus.applications.alarm.model.AlarmTreeItem; @@ -186,8 +188,16 @@ protected void updateItem(final SeverityLevel item, final boolean empty) if (empty || item == null) setGraphic(null); - else - setGraphic(new ImageView(AlarmUI.getIcon(item))); + else { + Image image = AlarmUI.getIcon(item); + ImageView icon = new ImageView(image); + + double scale = AlarmSystem.alarm_table_font_size / Font.getDefault().getSize(); + icon.setPreserveRatio(true); + icon.setFitWidth(image.getWidth() * scale); + + setGraphic(icon); + } } } @@ -414,6 +424,8 @@ private TableView createTable(final ObservableList r final SortedList sorted = new SortedList<>(rows); final TableView table = new TableView<>(sorted); + table.setStyle("-fx-font-size: " + AlarmSystem.alarm_table_font_size + "px"); + // Ensure that the sorted rows are always updated as the column sorting // of the TableView is changed by the user clicking on table headers. sorted.comparatorProperty().bind(table.comparatorProperty()); @@ -421,7 +433,8 @@ private TableView createTable(final ObservableList r // Prepare columns. final List> cols = new ArrayList<>(); TableColumn sevcol = new TableColumn<>(/* Icon */); - sevcol.setPrefWidth(25); + double iconScale = AlarmSystem.alarm_table_font_size / Font.getDefault().getSize(); + sevcol.setPrefWidth(25 * iconScale); sevcol.setReorderable(false); sevcol.setCellValueFactory(cell -> cell.getValue().severity); sevcol.setCellFactory(c -> new SeverityIconCell());