io.github.interacto.jfx.binding.api.BaseBinderBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of interacto-javafx Show documentation
Show all versions of interacto-javafx Show documentation
The JavaFX implementation of the Interacto library
The newest version!
/*
* Interacto
* Copyright (C) 2020 Arnaud Blouin
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package io.github.interacto.jfx.binding.api;
import io.github.interacto.jfx.interaction.help.HelpAnimation;
import java.util.function.BooleanSupplier;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ObservableList;
import javafx.scene.control.Button;
import javafx.scene.layout.Pane;
/**
* The base interface for building widget bindings.
* @param The type of accepted widgets.
*/
public interface BaseBinderBuilder {
/**
* Specifies the widgets on which the binding must operate.
* When a widget is added to this list, the added widget is binded to this binding.
* When widget is removed from this list, this widget is unbinded from this binding.
* @param widgets The observable list of the widgets involved in the bindings.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder on(final W... widgets);
/**
* Specifies the observable list that will contain the widgets on which the binding must operate.
* When a widget is added to this list, the added widget is binded to this binding.
* When widget is removed from this list, this widget is unbinded from this binding.
* @param widgets The observable list of the widgets involved in the bindings.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder on(final ObservableList widgets);
/**
* Specifies the conditions to fulfill to initialise, update, or execute the command while the interaction is running.
* @param whenPredicate The predicate that checks whether the command can be initialised, updated, or executed.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder when(final BooleanSupplier whenPredicate);
/**
* Defines actions to perform with a widget binding ends.
* @param endFct The command to execute on each widget binding end.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder end(final Runnable endFct);
/**
* If called, all the events the interaction will process will be consumed.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder consume();
/**
* Specifies the logging level to use.
* Several call to 'log' can be done to log different parts:
* log(LogLevel.INTERACTION).log(LogLevel.COMMAND)
* @param level The logging level to use.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder log(final LogLevel... level);
/**
* Specifies that the command will be executed in a separated threads.
* Beware of UI modifications: UI changes must be done in the JFX UI thread.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder async(final Button cancel, final DoubleProperty progressProp, final StringProperty msgProp);
/**
* Uses the given animation to explain how the binding works.
* @param animation The animation to play. If null, the default animation of the user interaction is used (if defined).
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder help(final HelpAnimation animation);
/**
* Uses the default help animation of the user interaction to explain how the binding works.
* @param helpPane The pane where the animation will be played.
* @return A clone of the current builder to chain the building configuration.
*/
BaseBinderBuilder help(final Pane helpPane);
}