-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00a5230
commit 74de2c7
Showing
8 changed files
with
122 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
src/main/java/org/hildan/fxlog/coloring/ColorizedRowFactory.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package org.hildan.fxlog.view; | ||
|
||
import javafx.beans.property.Property; | ||
import javafx.beans.property.SimpleObjectProperty; | ||
import javafx.scene.control.*; | ||
import javafx.scene.text.Text; | ||
|
||
import org.hildan.fxlog.coloring.Colorizer; | ||
import org.hildan.fxlog.config.Config; | ||
import org.hildan.fxlog.core.LogEntry; | ||
|
||
/** | ||
* A table cell that can be styled. | ||
*/ | ||
public class StyledTableCell extends TableCell<LogEntry, String> { | ||
|
||
private final Text text = new Text(); | ||
|
||
private final Property<Colorizer> colorizer = new SimpleObjectProperty<>(); | ||
|
||
public StyledTableCell(TableColumn<LogEntry, String> column) { | ||
text.wrappingWidthProperty().bind(column.widthProperty()); | ||
text.fontProperty().bind(Config.getInstance().logsFontProperty()); | ||
setGraphic(text); | ||
setText(null); | ||
} | ||
|
||
@Override | ||
public void updateItem(String item, boolean empty) { | ||
if (item == getItem()) { | ||
return; | ||
} | ||
super.updateItem(item, empty); | ||
if (item == null) { | ||
setGraphic(null); | ||
text.setText(null); | ||
return; | ||
} | ||
setGraphic(text); | ||
text.setText(item); | ||
if (colorizer.getValue() != null) { | ||
TableRow row = getTableRow(); | ||
if (row != null && row.getItem() != null) { | ||
LogEntry log = (LogEntry) row.getItem(); | ||
colorizer.getValue().applyTo(text, log); | ||
} | ||
} | ||
} | ||
|
||
public Colorizer getColorizer() { | ||
return colorizer.getValue(); | ||
} | ||
|
||
public Property<Colorizer> colorizerProperty() { | ||
return colorizer; | ||
} | ||
|
||
public void setColorizer(Colorizer colorizer) { | ||
this.colorizer.setValue(colorizer); | ||
} | ||
} |