Skip to content

Commit

Permalink
Update another RichTextFX-specific CSS property to use the -rtfx pref…
Browse files Browse the repository at this point in the history
…ix; "-fill" reverted back to "-color"

Note: "-fill" was initially used  instead of "-color" because of JDK-8133685. Now that a different prefix is used, this is no longer necessary
  • Loading branch information
JordanMartinez committed Jun 10, 2016
1 parent 8459717 commit 601d057
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void updateBackgroundShapes() {
*/
private void updateBackground(TextExt text, int start, int end, int index) {
// Set fill
Paint paint = text.backgroundFillProperty().get();
Paint paint = text.backgroundColorProperty().get();
if (paint != null) {
Path backgroundShape = backgroundShapes.get(index);
backgroundShape.setFill(paint);
Expand Down
28 changes: 14 additions & 14 deletions richtextfx/src/main/java/org/fxmisc/richtext/TextExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@

public class TextExt extends Text {

private final StyleableObjectProperty<Paint> backgroundFill = new StyleableObjectProperty<Paint>(null) {
private final StyleableObjectProperty<Paint> backgroundColor = new StyleableObjectProperty<Paint>(null) {
@Override
public Object getBean() {
return TextExt.this;
}

@Override
public String getName() {
return "backgroundFill";
return "backgroundColor";
}

@Override
public CssMetaData<TextExt, Paint> getCssMetaData() {
return StyleableProperties.BACKGROUND_FILL;
return StyleableProperties.BACKGROUND_COLOR;
}
};

Expand Down Expand Up @@ -115,7 +115,7 @@ public CssMetaData<TextExt, StrokeLineCap> getCssMetaData() {
List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(super.getCssMetaData());

// Add new properties
styleables.add(StyleableProperties.BACKGROUND_FILL);
styleables.add(StyleableProperties.BACKGROUND_COLOR);
styleables.add(StyleableProperties.UNDERLINE_COLOR);
styleables.add(StyleableProperties.UNDERLINE_WIDTH);
styleables.add(StyleableProperties.UNDERLINE_DASH_ARRAY);
Expand All @@ -125,16 +125,16 @@ public CssMetaData<TextExt, StrokeLineCap> getCssMetaData() {
return styleables;
}

public Paint getBackgroundFill() {
return backgroundFill.get();
public Paint getBackgroundColor() {
return backgroundColor.get();
}

public void setBackgroundFill(Paint fill) {
backgroundFill.set(fill);
public void setBackgroundColor(Paint fill) {
backgroundColor.set(fill);
}

public ObjectProperty<Paint> backgroundFillProperty() {
return backgroundFill;
public ObjectProperty<Paint> backgroundColorProperty() {
return backgroundColor;
}

// Color of the text underline (-fx-underline is already defined by JavaFX)
Expand All @@ -159,18 +159,18 @@ public ObjectProperty<Paint> backgroundFillProperty() {

private static class StyleableProperties {

private static final CssMetaData<TextExt, Paint> BACKGROUND_FILL = new CssMetaData<TextExt, Paint>(
"-fx-background-fill",
private static final CssMetaData<TextExt, Paint> BACKGROUND_COLOR = new CssMetaData<TextExt, Paint>(
"-rtfx-background-color",
StyleConverter.getPaintConverter(),
Color.TRANSPARENT) {
@Override
public boolean isSettable(TextExt node) {
return !node.backgroundFill.isBound();
return !node.backgroundColor.isBound();
}

@Override
public StyleableProperty<Paint> getStyleableProperty(TextExt node) {
return node.backgroundFill;
return node.backgroundColor;
}
};

Expand Down

0 comments on commit 601d057

Please sign in to comment.