Created
September 13, 2012 03:49
-
-
Save shemnon/3711714 to your computer and use it in GitHub Desktop.
JavaFX CSS Styling Plumbing
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
public final void setBackScale(double value) { | |
backScaleProperty().set(value); | |
} | |
public final double getBackScale() { | |
return backScale == null ? 0.7 : backScale.get(); | |
} | |
public final DoubleProperty backScaleProperty() { | |
if (backScale == null) { | |
backScale = new StyleableDoubleProperty(0.7) { | |
@Override | |
protected void invalidated() { | |
styleablePropertyInvalidated(); | |
} | |
@Override | |
public StyleableProperty getStyleableProperty() { | |
return BACK_SCALE; | |
} | |
@Override | |
public Object getBean() { | |
return ShelfDeckSkin.this; | |
} | |
@Override | |
public String getName() { | |
return "backScale"; | |
} | |
}; | |
} | |
return backScale; | |
} |
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
private static final StyleableProperty<ShelfDeckSkin,Number> BACK_SCALE = | |
new StyleableProperty<ShelfDeckSkin,Number>("-x-back-scale", | |
SizeConverter.getInstance(), 0.7) { | |
@Override | |
public boolean isSettable(ShelfDeckSkin deck) { | |
return deck.backScale == null || !deck.backScale.isBound(); | |
} | |
@Override | |
public WritableValue<Number> getWritableValue(ShelfDeckSkin deck) { | |
return deck.backScaleProperty(); | |
} | |
}; |
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
private static List<StyleableProperty> STYLEABLES; | |
@Override | |
@Deprecated | |
public List<StyleableProperty> impl_getStyleableProperties() { | |
if (STYLEABLES == null) { | |
final List<StyleableProperty> styleables = new ArrayList<StyleableProperty>(super.impl_getStyleableProperties()); | |
Collections.addAll(styleables, | |
BACK_ANGLE, | |
BACK_OFFSET, | |
BACK_SCALE, | |
BACK_SPACING); | |
STYLEABLES = Collections.unmodifiableList(styleables); | |
} | |
return STYLEABLES; //To change body of overridden methods use File | Settings | File Templates. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment