Package org.eclipse.gef.fx.swt.controls
Class FXAdvancedLinearGradientPicker
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.gef.fx.swt.controls.FXAdvancedLinearGradientPicker
- All Implemented Interfaces:
Drawable
A picker for multi-stop
LinearGradients.-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.Property<javafx.scene.paint.LinearGradient>Returns a writablePropertyfor the advanced gradient. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProperty name used in change events related toadvancedLinearGradientProperty() -
Constructor Summary
ConstructorsConstructorDescriptionFXAdvancedLinearGradientPicker(Composite parent, javafx.scene.paint.Color color1, javafx.scene.paint.Color color2, javafx.scene.paint.Color color3) Constructs a newFXAdvancedLinearGradientPicker. -
Method Summary
Modifier and TypeMethodDescriptionjavafx.beans.property.Property<javafx.scene.paint.LinearGradient>Returns a writablePropertyfor the advanced gradient.static javafx.scene.paint.LinearGradientcreateAdvancedLinearGradient(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 voidcreateStop(double offset) Creates a new spot for the given offset.javafx.scene.paint.LinearGradientReturns the currently selected advanced gradient.protected doublegetNextOffset(int stopIndex) Computes the maximum offset for the given stop index.protected doublegetPrevOffset(int stopIndex) Computes the minimum offset for the given stop index.protected List<javafx.scene.paint.Stop>getStops()Returns a list of theStops of the currently selected advanced gradient.static booleanisAdvancedLinearGradient(javafx.scene.paint.Paint paint) Returnstrueif the givenPaintis considered to be an "advanced" gradient.protected voidremoveStop(int index) Removes the spot specified by the given index.voidsetAdvancedGradient(javafx.scene.paint.LinearGradient advancedLinearGradient) Sets the gradient managed by this gradient picker to the given value.protected voidUpdates the direction line to display the current direction (specified by directionX and directionY).protected voidupdateGradient(List<javafx.scene.paint.Stop> newStops) Changes the currently selected advanced gradient to a new linear gradient that is constructed from the given list ofStops.protected voidupdateStop(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.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBarMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Property Details
-
advancedLinearGradient
public javafx.beans.property.Property<javafx.scene.paint.LinearGradient> advancedLinearGradientPropertyReturns a writablePropertyfor the advanced gradient.- See Also:
-
-
Field Details
-
ADVANCED_LINEAR_GRADIENT_PROPERTY
Property name used in change events related toadvancedLinearGradientProperty()- See Also:
-
-
Constructor Details
-
FXAdvancedLinearGradientPicker
public FXAdvancedLinearGradientPicker(Composite parent, javafx.scene.paint.Color color1, javafx.scene.paint.Color color2, javafx.scene.paint.Color color3) Constructs a newFXAdvancedLinearGradientPicker.- Parameters:
parent- The parentComposite.color1- The first color of the initial three-stopLinearGradient.color2- The second color of the initial three-stopLinearGradient.color3- The third color of the initial three-stopLinearGradient.
-
-
Method Details
-
createAdvancedLinearGradient
public 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.- Parameters:
c1- The start color.c2- The middle color (t = 0.5).c3- The end color.- Returns:
- An "advanced"
LinearGradientfrom the given colors.
-
isAdvancedLinearGradient
public static boolean isAdvancedLinearGradient(javafx.scene.paint.Paint paint) Returnstrueif the givenPaintis considered to be an "advanced" gradient. Otherwise returnsfalse. An advanced gradient can either be a linear gradient with at least 3 stops, or any radial gradient.- Parameters:
paint- ThePaintin question.- Returns:
trueif the givenPaintis considered to be an "advanced" gradient, othwerisefalse.
-
advancedLinearGradientProperty
public javafx.beans.property.Property<javafx.scene.paint.LinearGradient> advancedLinearGradientProperty()Returns a writablePropertyfor the advanced gradient.- See Also:
-
createStop
protected void createStop(double offset) Creates a new spot for the given offset.- Parameters:
offset- The offset for the new spot.
-
getAdvancedLinearGradient
public javafx.scene.paint.LinearGradient getAdvancedLinearGradient()Returns the currently selected advanced gradient.- Returns:
- The currently selected advanced gradient.
-
getNextOffset
protected double getNextOffset(int stopIndex) Computes the maximum offset for the given stop index.- Parameters:
stopIndex- The index of the stop for which to compute the next offset.- Returns:
- The maximum offset for the given stop index.
-
getPrevOffset
protected double getPrevOffset(int stopIndex) Computes the minimum offset for the given stop index.- Parameters:
stopIndex- The index of the stop for which to compute the previous offset.- Returns:
- The minimum offset for the given stop index.
-
getStops
Returns a list of theStops of the currently selected advanced gradient.- Returns:
- A list of the
Stops of the currently selected advanced gradient.
-
removeStop
protected void removeStop(int index) Removes the spot specified by the given index.- Parameters:
index- The spot index.
-
setAdvancedGradient
public void setAdvancedGradient(javafx.scene.paint.LinearGradient advancedLinearGradient) Sets the gradient managed by this gradient picker to the given value. Does also update the UI so that the new gradient can be manipulated.- Parameters:
advancedLinearGradient- The new gradient.
-
updateDirectionLine
protected void updateDirectionLine()Updates the direction line to display the current direction (specified by directionX and directionY). -
updateGradient
Changes the currently selected advanced gradient to a new linear gradient that is constructed from the given list ofStops.- Parameters:
newStops- The list ofStops from which the newly selected advanced gradient is constructed.
-
updateStop
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.- Parameters:
index- The index of the spot.offset- The new offset for that spot.color- The new color for that spot.
-