Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -414,14 +424,17 @@ private TableView<AlarmInfoRow> createTable(final ObservableList<AlarmInfoRow> r
final SortedList<AlarmInfoRow> sorted = new SortedList<>(rows);
final TableView<AlarmInfoRow> 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());

// Prepare columns.
final List<TableColumn<AlarmInfoRow, ?>> cols = new ArrayList<>();
TableColumn<AlarmInfoRow, SeverityLevel> 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());
Expand Down
Loading