public class FXAdvancedGradientPicker extends java.lang.Object implements IPropertyChangeNotifier
LinearGradient
s.Constructor and Description |
---|
FXAdvancedGradientPicker(Composite parent)
Constructs a new
FXAdvancedGradientPicker . |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
protected static javafx.scene.paint.LinearGradient |
createAdvancedLinearGradient(javafx.scene.paint.Color c1,
javafx.scene.paint.Color c2,
javafx.scene.paint.Color c3)
Creates an "advanced" linear color gradient with 3 stops from the given
colors.
|
protected Control |
createControl(Composite parent)
Creates the visualization for this
FXAdvancedGradientPicker . |
protected void |
createStop(double offset)
Creates a new spot for the given offset.
|
javafx.scene.paint.Paint |
getAdvancedGradient()
Returns the currently selected advanced gradient.
|
Control |
getControl()
Returns the
Control that visualizes this
FXAdvancedGradientPicker . |
protected double |
getNextOffset(int stopIndex)
Computes the maximum offset for the given stop index.
|
protected double |
getPrevOffset(int stopIndex)
Computes the minimum offset for the given stop index.
|
protected java.util.List<javafx.scene.paint.Stop> |
getStops()
Returns a list of the
Stop s of the currently selected advanced
gradient. |
static boolean |
isAdvancedGradient(javafx.scene.paint.Paint paint)
Returns
true if the given Paint is considered to be
an "advanced" gradient. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
protected void |
removeStop(int index)
Removes the spot specified by the given index.
|
void |
setAdvancedGradient(javafx.scene.paint.Paint advancedGradient)
Sets the gradient managed by this gradient picker to the given value.
|
protected void |
updateDirectionLine()
Updates the direction line to display the current direction (specified by
directionX and directionY).
|
protected void |
updateGradient(java.util.List<javafx.scene.paint.Stop> newStops)
Changes the currently selected advanced gradient to a new linear gradient
that is constructed from the given list of
Stop s. |
protected void |
updateStop(int index,
double offset,
javafx.scene.paint.Color color)
Sets the offset and color of the spot specified by the given index to the
given values.
|
public FXAdvancedGradientPicker(Composite parent)
FXAdvancedGradientPicker
.parent
- The parent Composite
.protected static javafx.scene.paint.LinearGradient createAdvancedLinearGradient(javafx.scene.paint.Color c1, javafx.scene.paint.Color c2, javafx.scene.paint.Color c3)
c1
- The start color.c2
- The middle color (t = 0.5).c3
- The end color.LinearGradient
from the given colors.public static boolean isAdvancedGradient(javafx.scene.paint.Paint paint)
true
if the given Paint
is considered to be
an "advanced" gradient. Otherwise returns false
. An advanced
gradient can either be a linear gradient with at least 3 stops, or any
radial gradient.paint
- The Paint
in question.true
if the given Paint
is considered to be
an "advanced" gradient, othwerise false
.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in interface IPropertyChangeNotifier
protected Control createControl(Composite parent)
FXAdvancedGradientPicker
.parent
- The parent Composite
.Control
that visualizes this
FXAdvancedGradientPicker
.protected void createStop(double offset)
offset
- The offset for the new spot.public javafx.scene.paint.Paint getAdvancedGradient()
public Control getControl()
Control
that visualizes this
FXAdvancedGradientPicker
.Control
that visualizes this
FXAdvancedGradientPicker
.protected double getNextOffset(int stopIndex)
stopIndex
- The index of the stop for which to compute the next offset.protected double getPrevOffset(int stopIndex)
stopIndex
- The index of the stop for which to compute the previous
offset.protected java.util.List<javafx.scene.paint.Stop> getStops()
Stop
s of the currently selected advanced
gradient.Stop
s of the currently selected advanced
gradient.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in interface IPropertyChangeNotifier
protected void removeStop(int index)
index
- The spot index.public void setAdvancedGradient(javafx.scene.paint.Paint advancedGradient)
advancedGradient
- The new gradient.protected void updateDirectionLine()
protected void updateGradient(java.util.List<javafx.scene.paint.Stop> newStops)
Stop
s.newStops
- The list of Stop
s from which the newly selected
advanced gradient is constructed.protected void updateStop(int index, double offset, javafx.scene.paint.Color color)
index
- The index of the spot.offset
- The new offset for that spot.color
- The new color for that spot.Copyright (c) 2014 itemis AG and others. All rights reserved.