diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings index 372dcf0dcf8417710d6eeca1f93102852c1351b8..b5e34a048324998476890ec6a11cfc00332f6a29 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings @@ -1,7 +1,7 @@ DynamicTextFieldTreeTableCell.java de24117e6f785b328f1ff62383626a0b4b54e8ff YELLOW DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN -DynamicTreeTableUIProviderBase.java 2c4886a5ecd7dc06c281e63c00c4e3499e5d8f28 YELLOW +DynamicTreeTableUIProviderBase.java dba6edaebf9e56067d80b51564379dd05697f830 YELLOW DynamicTreeTableViewer.java 3d91b1bd43393f5d0733a253a85436b8255526ae YELLOW DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN DynamicTreeViewer.java 725f41f4fb4b6bfa813f010fb9083ab02eea164a GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java index 2c4886a5ecd7dc06c281e63c00c4e3499e5d8f28..dba6edaebf9e56067d80b51564379dd05697f830 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableUIProviderBase.java @@ -69,32 +69,6 @@ public abstract class DynamicTreeTableUIProviderBase<T> { return null; } - /** - * Sets styling properties as background color for the given cell. - * - * This method is not intended to be overwritten. Instead there are getters as - * {@link #getBackgroundColor(int, Object)}. - * - * @param cell - * The cell to be layouted. - * @param columnIndex - * The number of the column in which this cell is contained in. - */ - private final void styleCell(TreeTableCell<T, ?> cell, int columnIndex) { - if(cell.getTreeTableRow() != null) { - T data = cell.getTreeTableRow().getItem(); - - if(data != null) { - Color bgColor = getBackgroundColor(columnIndex, data); - if(bgColor != null) { - double alpha = 0.5; - String colorStr = colorToRgbaString(bgColor, alpha); - cell.setStyle("-fx-background-color: " + colorStr); - } - } - } - } - /** * Determines the background color for a given element in the specified column. * @@ -277,6 +251,41 @@ public abstract class DynamicTreeTableUIProviderBase<T> { createEditableComboCellFactory(columnIndex, column, comboValueFactory)); } + /** + * Sets styling properties as background color for the given cell. + * + * This method is not intended to be overwritten. Instead there are getters as + * {@link #getBackgroundColor(int, Object)}. + * + * @param cell + * The cell to be layouted. + * @param columnIndex + * The number of the column in which this cell is contained in. + */ + private final void styleCell(TreeTableCell<T, ?> cell, int columnIndex) { + if(cell.getTreeTableRow() != null) { + T data = cell.getTreeTableRow().getItem(); + + if(data != null) { + Color bgColor = getBackgroundColor(columnIndex, data); + if(bgColor != null) { + // Some transparency is necessary here, for correctly displaying the selection + // bar when selecting a row. WIth out transparency, it would not be visible on + // this cell. + double alpha = 0.5; + String colorStr = colorToRgbaString(bgColor, alpha); + cell.setStyle("-fx-background-color: " + colorStr); + } + } + } + } + + /** Converts a {@link Color} object into a rgba format as used in css. */ + private final static String colorToRgbaString(Color color, double alpha) { + return String.format("rgba(%d,%d,%d,%.1f)", (int)(color.getRed() * 255), + (int)(color.getGreen() * 255), (int)(color.getBlue() * 255), alpha); + } + /** Creates a cell factory for editable cells. */ private Callback<TreeTableColumn<T, String>, TreeTableCell<T, String>> createEditableCellFactory(int colIndex) { @@ -461,12 +470,6 @@ public abstract class DynamicTreeTableUIProviderBase<T> { }; } - /** Converts a {@link Color} object into a rgba format as used in css. */ - private final static String colorToRgbaString(Color color, double alpha) { - return String.format("rgba(%d,%d,%d,%.1f)", (int)(color.getRed() * 255), - (int)(color.getGreen() * 255), (int)(color.getBlue() * 255), alpha); - } - /** * Applies this UIProvider to configure the given {@link TreeTableColumn}. *