Skip to content
Snippets Groups Projects
Commit 21dc8c3a authored by Andreas Bayha's avatar Andreas Bayha
Browse files

YELLOW

parent bd455b5a
No related branches found
No related tags found
1 merge request!1254014
DynamicTextFieldTreeTableCell.java de24117e6f785b328f1ff62383626a0b4b54e8ff YELLOW DynamicTextFieldTreeTableCell.java de24117e6f785b328f1ff62383626a0b4b54e8ff YELLOW
DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN
DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN
DynamicTreeTableUIProviderBase.java 2c4886a5ecd7dc06c281e63c00c4e3499e5d8f28 YELLOW DynamicTreeTableUIProviderBase.java dba6edaebf9e56067d80b51564379dd05697f830 YELLOW
DynamicTreeTableViewer.java 3d91b1bd43393f5d0733a253a85436b8255526ae YELLOW DynamicTreeTableViewer.java 3d91b1bd43393f5d0733a253a85436b8255526ae YELLOW
DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN
DynamicTreeViewer.java 725f41f4fb4b6bfa813f010fb9083ab02eea164a GREEN DynamicTreeViewer.java 725f41f4fb4b6bfa813f010fb9083ab02eea164a GREEN
......
...@@ -69,32 +69,6 @@ public abstract class DynamicTreeTableUIProviderBase<T> { ...@@ -69,32 +69,6 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
return null; 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. * Determines the background color for a given element in the specified column.
* *
...@@ -277,6 +251,41 @@ public abstract class DynamicTreeTableUIProviderBase<T> { ...@@ -277,6 +251,41 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
createEditableComboCellFactory(columnIndex, column, comboValueFactory)); 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. */ /** Creates a cell factory for editable cells. */
private Callback<TreeTableColumn<T, String>, TreeTableCell<T, String>> private Callback<TreeTableColumn<T, String>, TreeTableCell<T, String>>
createEditableCellFactory(int colIndex) { createEditableCellFactory(int colIndex) {
...@@ -461,12 +470,6 @@ public abstract class DynamicTreeTableUIProviderBase<T> { ...@@ -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}. * Applies this UIProvider to configure the given {@link TreeTableColumn}.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment