JavaFX Utils

Draggable

Component to help transfer non serialize data on Drag event.

Draggable class is generic in T extends Node, I where I is the type of info to be transferred.

Constructors

	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, TransferMode mode, Image dragView, boolean receives, boolean sends, boolean permitSelfDrag)
					

  • node : Node in which Draggable will be mounted.
  • onReceive : function call when info is received from another Draggable, this function should return true to indicate that item were accepted.
  • afterSend : function called after info been accepted for another Draggable.
  • group : object representing the key of group in which info will be dragged.
  • mode : TransferMode to me set on drag.
  • dragView : Image to be setted as dragview during the drag.
  • receives : indicates if this component receives data.
  • sends : indicates if this component sends data.
  • permitSelfDrag : indicates if it is permitted drag into same Draggable.

There are more constructors with different parameters, but all will internally call this first one.

Variations :

  • Constructors that receive IComponent<T> component will obtain Node from component.getNode().
  • Constructors that don't receive boolean receives and boolean sends this value will be assumed as true.
  • Constructors that don't receive TransferMode mode this value will be assumed as TransferMode.LINK.
  • Constructors that don't receive Object group this value will be assumed as WITHOUT_GROUP.
  • Constructors that don't receive Image dragView this value will be assumed as null.
  • Constructors that don't receive boolean permitSelfDrag this value will be assumed as true.
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, TransferMode mode, Image dragView)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, TransferMode mode, Image dragView)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, Image dragView)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, TransferMode mode)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, TransferMode mode)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Image dragView)
					
	public Draggable(T node, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, TransferMode mode, Image dragView)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, TransferMode mode, Image dragView)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, Image dragView)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group, TransferMode mode)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Object group)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, TransferMode mode)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info, Image dragView)
					
	public Draggable(IComponent<T> component, Function<I, Boolean> onReceive, Consumer<I> afterSend, I info)
					

Usage

	Button buttonA;
	Button buttonB;

	new Draggable<>(buttonA, (item)->true, this::afterSend, "A").mount();
	new Draggable<>(buttonB, (item)->true, this::afterSend, "B").mount();
				

Links