Checkstyle: reformat code
This commit is contained in:
parent
a9bc7ace6f
commit
deb27f576a
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.scene.control.Control;
|
import javafx.scene.control.Control;
|
||||||
@ -22,7 +23,9 @@ public abstract class BehaviorBase<C extends Control, S extends SkinBase<C>> {
|
|||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called from {@link SkinBase#dispose()} to clean up the behavior state */
|
/**
|
||||||
|
* Called from {@link SkinBase#dispose()} to clean up the behavior state
|
||||||
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
this.control = null;
|
this.control = null;
|
||||||
this.skin = null;
|
this.skin = null;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -31,7 +32,8 @@ public abstract class BehaviorSkinBase<C extends Control, B extends BehaviorBase
|
|||||||
* {@link SkinBase#registerChangeListener(ObservableValue, Consumer)} method,
|
* {@link SkinBase#registerChangeListener(ObservableValue, Consumer)} method,
|
||||||
* because it will be done automatically from dispose method.
|
* because it will be done automatically from dispose method.
|
||||||
*/
|
*/
|
||||||
protected void unregisterListeners() { }
|
protected void unregisterListeners() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -65,7 +66,9 @@ public class Breadcrumbs<T> extends Control {
|
|||||||
protected final Callback<BreadCrumbItem<T>, ? extends Node> defaultDividerFactory =
|
protected final Callback<BreadCrumbItem<T>, ? extends Node> defaultDividerFactory =
|
||||||
item -> item != null && !item.isLast() ? new Label("/") : null;
|
item -> item != null && !item.isLast() ? new Label("/") : null;
|
||||||
|
|
||||||
/** Creates an empty bread crumb bar. */
|
/**
|
||||||
|
* Creates an empty bread crumb bar.
|
||||||
|
*/
|
||||||
public Breadcrumbs() {
|
public Breadcrumbs() {
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
@ -88,7 +91,9 @@ public class Breadcrumbs<T> extends Control {
|
|||||||
setDividerFactory(defaultDividerFactory);
|
setDividerFactory(defaultDividerFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Skin<?> createDefaultSkin() {
|
protected Skin<?> createDefaultSkin() {
|
||||||
return new BreadcrumbsSkin<>(this);
|
return new BreadcrumbsSkin<>(this);
|
||||||
@ -228,7 +233,9 @@ public class Breadcrumbs<T> extends Control {
|
|||||||
return onCrumbAction;
|
return onCrumbAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set a new EventHandler for when a user selects a crumb. */
|
/**
|
||||||
|
* Set a new EventHandler for when a user selects a crumb.
|
||||||
|
*/
|
||||||
public final void setOnCrumbAction(EventHandler<BreadCrumbActionEvent<T>> value) {
|
public final void setOnCrumbAction(EventHandler<BreadCrumbActionEvent<T>> value) {
|
||||||
onCrumbActionProperty().set(value);
|
onCrumbActionProperty().set(value);
|
||||||
}
|
}
|
||||||
@ -239,7 +246,7 @@ public class Breadcrumbs<T> extends Control {
|
|||||||
|
|
||||||
protected final ObjectProperty<EventHandler<BreadCrumbActionEvent<T>>> onCrumbAction = new ObjectPropertyBase<>() {
|
protected final ObjectProperty<EventHandler<BreadCrumbActionEvent<T>>> onCrumbAction = new ObjectPropertyBase<>() {
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
protected void invalidated() {
|
protected void invalidated() {
|
||||||
setEventHandler(BreadCrumbActionEvent.CRUMB_ACTION, (EventHandler<BreadCrumbActionEvent>) (Object) get());
|
setEventHandler(BreadCrumbActionEvent.CRUMB_ACTION, (EventHandler<BreadCrumbActionEvent>) (Object) get());
|
||||||
@ -289,7 +296,9 @@ public class Breadcrumbs<T> extends Control {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Represents an Event which is fired when a bread crumb was activated. */
|
/**
|
||||||
|
* Represents an Event which is fired when a bread crumb was activated.
|
||||||
|
*/
|
||||||
public static class BreadCrumbActionEvent<TE> extends Event {
|
public static class BreadCrumbActionEvent<TE> extends Event {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -302,7 +311,9 @@ public class Breadcrumbs<T> extends Control {
|
|||||||
|
|
||||||
private final BreadCrumbItem<TE> selectedCrumb;
|
private final BreadCrumbItem<TE> selectedCrumb;
|
||||||
|
|
||||||
/** Creates a new event that can subsequently be fired. */
|
/**
|
||||||
|
* Creates a new event that can subsequently be fired.
|
||||||
|
*/
|
||||||
public BreadCrumbActionEvent(BreadCrumbItem<TE> selectedCrumb) {
|
public BreadCrumbActionEvent(BreadCrumbItem<TE> selectedCrumb) {
|
||||||
super(CRUMB_ACTION);
|
super(CRUMB_ACTION);
|
||||||
this.selectedCrumb = selectedCrumb;
|
this.selectedCrumb = selectedCrumb;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import atlantafx.base.controls.Breadcrumbs.BreadCrumbItem;
|
import atlantafx.base.controls.Breadcrumbs.BreadCrumbItem;
|
||||||
@ -78,7 +79,9 @@ public class BreadcrumbsSkin<T> extends SkinBase<Breadcrumbs<T>> {
|
|||||||
double bottomInset, double leftInset) {
|
double bottomInset, double leftInset) {
|
||||||
double width = 0;
|
double width = 0;
|
||||||
for (Node node : getChildren()) {
|
for (Node node : getChildren()) {
|
||||||
if (!node.isManaged()) { continue; }
|
if (!node.isManaged()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
width += snapSizeX(node.prefWidth(height));
|
width += snapSizeX(node.prefWidth(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +151,12 @@ public class BreadcrumbsSkin<T> extends SkinBase<Breadcrumbs<T>> {
|
|||||||
Collections.reverse(path);
|
Collections.reverse(path);
|
||||||
|
|
||||||
// if the path consists of a single item it considered as first, but not last
|
// if the path consists of a single item it considered as first, but not last
|
||||||
if (path.size() > 0) { path.get(0).setFirst(true); }
|
if (path.size() > 0) {
|
||||||
if (path.size() > 1) { path.get(path.size() - 1).setLast(true); }
|
path.get(0).setFirst(true);
|
||||||
|
}
|
||||||
|
if (path.size() > 1) {
|
||||||
|
path.get(path.size() - 1).setLast(true);
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
@ -41,7 +42,9 @@ import javafx.scene.control.TextField;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class CustomTextField extends TextField {
|
public class CustomTextField extends TextField {
|
||||||
|
|
||||||
/** Instantiates a default CustomTextField. */
|
/**
|
||||||
|
* Instantiates a default CustomTextField.
|
||||||
|
*/
|
||||||
public CustomTextField() {
|
public CustomTextField() {
|
||||||
getStyleClass().add("custom-text-field");
|
getStyleClass().add("custom-text-field");
|
||||||
}
|
}
|
||||||
@ -106,7 +109,9 @@ public class CustomTextField extends TextField {
|
|||||||
// Methods //
|
// Methods //
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Skin<?> createDefaultSkin() {
|
protected Skin<?> createDefaultSkin() {
|
||||||
return new CustomTextFieldSkin(this) {
|
return new CustomTextFieldSkin(this) {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* or visit www.oracle.com if you need additional information or have any
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import java.time.DateTimeException;
|
import java.time.DateTimeException;
|
||||||
@ -72,7 +73,9 @@ public class InlineDatePicker extends Control {
|
|||||||
protected LocalDate lastValidDate = null;
|
protected LocalDate lastValidDate = null;
|
||||||
protected Chronology lastValidChronology = IsoChronology.INSTANCE;
|
protected Chronology lastValidChronology = IsoChronology.INSTANCE;
|
||||||
|
|
||||||
/** Creates a default DatePicker instance with a <code>null</code> date value set. */
|
/**
|
||||||
|
* Creates a default DatePicker instance with a <code>null</code> date value set.
|
||||||
|
*/
|
||||||
public InlineDatePicker() {
|
public InlineDatePicker() {
|
||||||
this(null);
|
this(null);
|
||||||
|
|
||||||
@ -111,7 +114,9 @@ public class InlineDatePicker extends Control {
|
|||||||
getStyleClass().add(DEFAULT_STYLE_CLASS);
|
getStyleClass().add(DEFAULT_STYLE_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Skin<?> createDefaultSkin() {
|
protected Skin<?> createDefaultSkin() {
|
||||||
return new InlineDatePickerSkin(this);
|
return new InlineDatePickerSkin(this);
|
||||||
@ -131,7 +136,9 @@ public class InlineDatePicker extends Control {
|
|||||||
valueProperty().set(value);
|
valueProperty().set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectProperty<LocalDate> valueProperty() { return value; }
|
public ObjectProperty<LocalDate> valueProperty() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom cell factory can be provided to customize individual day cells
|
* A custom cell factory can be provided to customize individual day cells
|
||||||
@ -298,7 +305,9 @@ public class InlineDatePicker extends Control {
|
|||||||
return StyleableProperties.STYLEABLES;
|
return StyleableProperties.STYLEABLES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
|
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() {
|
||||||
return getClassCssMetaData();
|
return getClassCssMetaData();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import static atlantafx.base.util.PlatformUtils.isMac;
|
import static atlantafx.base.util.PlatformUtils.isMac;
|
||||||
@ -56,7 +57,9 @@ public class InlineDatePickerBehavior extends BehaviorBase<InlineDatePicker, Inl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prevents any other key events but ESC from reaching the control owner
|
// prevents any other key events but ESC from reaching the control owner
|
||||||
if (e.getCode() != ESCAPE) { e.consume(); }
|
if (e.getCode() != ESCAPE) {
|
||||||
|
e.consume();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveForward(MouseEvent e) {
|
public void moveForward(MouseEvent e) {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* or visit www.oracle.com if you need additional information or have any
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import static atlantafx.base.controls.InlineDatePicker.isValidDate;
|
import static atlantafx.base.controls.InlineDatePicker.isValidDate;
|
||||||
@ -101,11 +102,16 @@ public class InlineDatePickerSkin extends BehaviorSkinBase<InlineDatePicker, Inl
|
|||||||
|
|
||||||
private final ObjectProperty<YearMonth> displayedYearMonth = new SimpleObjectProperty<>(this, "displayedYearMonth");
|
private final ObjectProperty<YearMonth> displayedYearMonth = new SimpleObjectProperty<>(this, "displayedYearMonth");
|
||||||
|
|
||||||
public ObjectProperty<YearMonth> displayedYearMonthProperty() { return displayedYearMonth; }
|
public ObjectProperty<YearMonth> displayedYearMonthProperty() {
|
||||||
|
return displayedYearMonth;
|
||||||
|
}
|
||||||
|
|
||||||
private final ObjectBinding<LocalDate> firstDayOfMonth = Bindings.createObjectBinding(() -> displayedYearMonth.get().atDay(1), displayedYearMonth);
|
private final ObjectBinding<LocalDate> firstDayOfMonth =
|
||||||
|
Bindings.createObjectBinding(() -> displayedYearMonth.get().atDay(1), displayedYearMonth);
|
||||||
|
|
||||||
public LocalDate getFirstDayOfMonth() { return firstDayOfMonth.get(); }
|
public LocalDate getFirstDayOfMonth() {
|
||||||
|
return firstDayOfMonth.get();
|
||||||
|
}
|
||||||
|
|
||||||
public InlineDatePickerSkin(InlineDatePicker datePicker) {
|
public InlineDatePickerSkin(InlineDatePicker datePicker) {
|
||||||
super(datePicker);
|
super(datePicker);
|
||||||
@ -550,7 +556,9 @@ public class InlineDatePickerSkin extends BehaviorSkinBase<InlineDatePicker, Inl
|
|||||||
|
|
||||||
protected void createDayCells() {
|
protected void createDayCells() {
|
||||||
EventHandler<MouseEvent> dayCellActionHandler = e -> {
|
EventHandler<MouseEvent> dayCellActionHandler = e -> {
|
||||||
if (e.getButton() != MouseButton.PRIMARY) { return; }
|
if (e.getButton() != MouseButton.PRIMARY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
DateCell dayCell = (DateCell) e.getSource();
|
DateCell dayCell = (DateCell) e.getSource();
|
||||||
selectDayCell(dayCell);
|
selectDayCell(dayCell);
|
||||||
lastFocusedDayCell = dayCell;
|
lastFocusedDayCell = dayCell;
|
||||||
@ -612,7 +620,7 @@ public class InlineDatePickerSkin extends BehaviorSkinBase<InlineDatePicker, Inl
|
|||||||
int firstChar = word.codePointAt(0);
|
int firstChar = word.codePointAt(0);
|
||||||
if (!Character.isTitleCase(firstChar)) {
|
if (!Character.isTitleCase(firstChar)) {
|
||||||
word = new String(new int[] {
|
word = new String(new int[] {
|
||||||
Character.toTitleCase(firstChar) }, 0, 1) +
|
Character.toTitleCase(firstChar)}, 0, 1) +
|
||||||
word.substring(Character.offsetByCodePoints(word, 0, 1));
|
word.substring(Character.offsetByCodePoints(word, 0, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
@ -179,7 +180,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the content property
|
* Returns the value of the content property
|
||||||
*
|
*
|
||||||
* @return the content node
|
* @return the content node
|
||||||
*
|
|
||||||
* @see #contentNodeProperty()
|
* @see #contentNodeProperty()
|
||||||
*/
|
*/
|
||||||
public final Node getContentNode() {
|
public final Node getContentNode() {
|
||||||
@ -190,7 +190,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the content property.
|
* Sets the value of the content property.
|
||||||
*
|
*
|
||||||
* @param content the new content node value
|
* @param content the new content node value
|
||||||
*
|
|
||||||
* @see #contentNodeProperty()
|
* @see #contentNodeProperty()
|
||||||
*/
|
*/
|
||||||
public final void setContentNode(Node content) {
|
public final void setContentNode(Node content) {
|
||||||
@ -379,7 +378,8 @@ public class Popover extends PopupControl {
|
|||||||
// due to JavaFX async nature. The only way seems to start popover as invisible (not opaque)
|
// due to JavaFX async nature. The only way seems to start popover as invisible (not opaque)
|
||||||
// and then restore its visibility after a fixed delay to hide window repositioning.
|
// and then restore its visibility after a fixed delay to hide window repositioning.
|
||||||
// Still it's not a 100% guarantee,but better than nothing.
|
// Still it's not a 100% guarantee,but better than nothing.
|
||||||
int delay = Math.min((int) Objects.requireNonNullElse(fadeInDuration, DEFAULT_FADE_DURATION).toMillis() / 2, 250);
|
int delay =
|
||||||
|
Math.min((int) Objects.requireNonNullElse(fadeInDuration, DEFAULT_FADE_DURATION).toMillis() / 2, 250);
|
||||||
new Timer().schedule(new TimerTask() {
|
new Timer().schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -531,7 +531,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the headerAlwaysVisible property.
|
* Sets the value of the headerAlwaysVisible property.
|
||||||
*
|
*
|
||||||
* @param visible if true, then the header is visible even while attached
|
* @param visible if true, then the header is visible even while attached
|
||||||
*
|
|
||||||
* @see #headerAlwaysVisibleProperty()
|
* @see #headerAlwaysVisibleProperty()
|
||||||
*/
|
*/
|
||||||
public final void setHeaderAlwaysVisible(boolean visible) {
|
public final void setHeaderAlwaysVisible(boolean visible) {
|
||||||
@ -542,7 +541,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the detachable property.
|
* Returns the value of the detachable property.
|
||||||
*
|
*
|
||||||
* @return true if the header is visible even while attached
|
* @return true if the header is visible even while attached
|
||||||
*
|
|
||||||
* @see #headerAlwaysVisibleProperty()
|
* @see #headerAlwaysVisibleProperty()
|
||||||
*/
|
*/
|
||||||
public final boolean isHeaderAlwaysVisible() {
|
public final boolean isHeaderAlwaysVisible() {
|
||||||
@ -562,7 +560,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the closeButtonEnabled property.
|
* Sets the value of the closeButtonEnabled property.
|
||||||
*
|
*
|
||||||
* @param enabled if false, the popover will not be closeable by the header's close button
|
* @param enabled if false, the popover will not be closeable by the header's close button
|
||||||
*
|
|
||||||
* @see #closeButtonEnabledProperty()
|
* @see #closeButtonEnabledProperty()
|
||||||
*/
|
*/
|
||||||
public final void setCloseButtonEnabled(boolean enabled) {
|
public final void setCloseButtonEnabled(boolean enabled) {
|
||||||
@ -573,7 +570,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the closeButtonEnabled property.
|
* Returns the value of the closeButtonEnabled property.
|
||||||
*
|
*
|
||||||
* @return true if the header's close button is enabled
|
* @return true if the header's close button is enabled
|
||||||
*
|
|
||||||
* @see #closeButtonEnabledProperty()
|
* @see #closeButtonEnabledProperty()
|
||||||
*/
|
*/
|
||||||
public final boolean isCloseButtonEnabled() {
|
public final boolean isCloseButtonEnabled() {
|
||||||
@ -593,7 +589,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the detachable property.
|
* Sets the value of the detachable property.
|
||||||
*
|
*
|
||||||
* @param detachable if true then the user can detach / tear off the popover
|
* @param detachable if true then the user can detach / tear off the popover
|
||||||
*
|
|
||||||
* @see #detachableProperty()
|
* @see #detachableProperty()
|
||||||
*/
|
*/
|
||||||
public final void setDetachable(boolean detachable) {
|
public final void setDetachable(boolean detachable) {
|
||||||
@ -604,7 +599,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the detachable property.
|
* Returns the value of the detachable property.
|
||||||
*
|
*
|
||||||
* @return true if the user is allowed to detach / tear off the popover
|
* @return true if the user is allowed to detach / tear off the popover
|
||||||
*
|
|
||||||
* @see #detachableProperty()
|
* @see #detachableProperty()
|
||||||
*/
|
*/
|
||||||
public final boolean isDetachable() {
|
public final boolean isDetachable() {
|
||||||
@ -629,7 +623,6 @@ public class Popover extends PopupControl {
|
|||||||
*
|
*
|
||||||
* @param detached if true the popover will change its appearance to "detached"
|
* @param detached if true the popover will change its appearance to "detached"
|
||||||
* mode
|
* mode
|
||||||
*
|
|
||||||
* @see #detachedProperty()
|
* @see #detachedProperty()
|
||||||
*/
|
*/
|
||||||
public final void setDetached(boolean detached) {
|
public final void setDetached(boolean detached) {
|
||||||
@ -640,7 +633,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the detached property.
|
* Returns the value of the detached property.
|
||||||
*
|
*
|
||||||
* @return true if the popover is currently detached.
|
* @return true if the popover is currently detached.
|
||||||
*
|
|
||||||
* @see #detachedProperty()
|
* @see #detachedProperty()
|
||||||
*/
|
*/
|
||||||
public final boolean isDetached() {
|
public final boolean isDetached() {
|
||||||
@ -662,7 +654,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the arrow size property.
|
* Returns the value of the arrow size property.
|
||||||
*
|
*
|
||||||
* @return the arrow size property value
|
* @return the arrow size property value
|
||||||
*
|
|
||||||
* @see #arrowSizeProperty()
|
* @see #arrowSizeProperty()
|
||||||
*/
|
*/
|
||||||
public final double getArrowSize() {
|
public final double getArrowSize() {
|
||||||
@ -673,7 +664,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the arrow size property.
|
* Sets the value of the arrow size property.
|
||||||
*
|
*
|
||||||
* @param size the new value of the arrow size property
|
* @param size the new value of the arrow size property
|
||||||
*
|
|
||||||
* @see #arrowSizeProperty()
|
* @see #arrowSizeProperty()
|
||||||
*/
|
*/
|
||||||
public final void setArrowSize(double size) {
|
public final void setArrowSize(double size) {
|
||||||
@ -696,7 +686,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the arrow indent property.
|
* Returns the value of the arrow indent property.
|
||||||
*
|
*
|
||||||
* @return the arrow indent value
|
* @return the arrow indent value
|
||||||
*
|
|
||||||
* @see #arrowIndentProperty()
|
* @see #arrowIndentProperty()
|
||||||
*/
|
*/
|
||||||
public final double getArrowIndent() {
|
public final double getArrowIndent() {
|
||||||
@ -707,7 +696,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the arrow indent property.
|
* Sets the value of the arrow indent property.
|
||||||
*
|
*
|
||||||
* @param size the arrow indent value
|
* @param size the arrow indent value
|
||||||
*
|
|
||||||
* @see #arrowIndentProperty()
|
* @see #arrowIndentProperty()
|
||||||
*/
|
*/
|
||||||
public final void setArrowIndent(double size) {
|
public final void setArrowIndent(double size) {
|
||||||
@ -729,7 +717,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the corner radius property.
|
* Returns the value of the corner radius property.
|
||||||
*
|
*
|
||||||
* @return the corner radius
|
* @return the corner radius
|
||||||
*
|
|
||||||
* @see #cornerRadiusProperty()
|
* @see #cornerRadiusProperty()
|
||||||
*/
|
*/
|
||||||
public final double getCornerRadius() {
|
public final double getCornerRadius() {
|
||||||
@ -740,7 +727,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the corner radius property.
|
* Sets the value of the corner radius property.
|
||||||
*
|
*
|
||||||
* @param radius the corner radius
|
* @param radius the corner radius
|
||||||
*
|
|
||||||
* @see #cornerRadiusProperty()
|
* @see #cornerRadiusProperty()
|
||||||
*/
|
*/
|
||||||
public final void setCornerRadius(double radius) {
|
public final void setCornerRadius(double radius) {
|
||||||
@ -762,7 +748,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the title property.
|
* Returns the value of the title property.
|
||||||
*
|
*
|
||||||
* @return the detached title
|
* @return the detached title
|
||||||
*
|
|
||||||
* @see #titleProperty()
|
* @see #titleProperty()
|
||||||
*/
|
*/
|
||||||
public final String getTitle() {
|
public final String getTitle() {
|
||||||
@ -773,7 +758,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the title property.
|
* Sets the value of the title property.
|
||||||
*
|
*
|
||||||
* @param title the title to use when detached
|
* @param title the title to use when detached
|
||||||
*
|
|
||||||
* @see #titleProperty()
|
* @see #titleProperty()
|
||||||
*/
|
*/
|
||||||
public final void setTitle(String title) {
|
public final void setTitle(String title) {
|
||||||
@ -783,14 +767,14 @@ public class Popover extends PopupControl {
|
|||||||
titleProperty().set(title);
|
titleProperty().set(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ObjectProperty<ArrowLocation> arrowLocation = new SimpleObjectProperty<>(this, "arrowLocation", ArrowLocation.LEFT_TOP);
|
private final ObjectProperty<ArrowLocation> arrowLocation =
|
||||||
|
new SimpleObjectProperty<>(this, "arrowLocation", ArrowLocation.LEFT_TOP);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the preferred arrow location. This might not be the actual
|
* Stores the preferred arrow location. This might not be the actual
|
||||||
* location of the arrow if auto fix is enabled.
|
* location of the arrow if auto fix is enabled.
|
||||||
*
|
*
|
||||||
* @return the arrow location property
|
* @return the arrow location property
|
||||||
*
|
|
||||||
* @see #setAutoFix(boolean)
|
* @see #setAutoFix(boolean)
|
||||||
*/
|
*/
|
||||||
public final ObjectProperty<ArrowLocation> arrowLocationProperty() {
|
public final ObjectProperty<ArrowLocation> arrowLocationProperty() {
|
||||||
@ -801,7 +785,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the arrow location property.
|
* Sets the value of the arrow location property.
|
||||||
*
|
*
|
||||||
* @param location the requested location
|
* @param location the requested location
|
||||||
*
|
|
||||||
* @see #arrowLocationProperty()
|
* @see #arrowLocationProperty()
|
||||||
*/
|
*/
|
||||||
public final void setArrowLocation(ArrowLocation location) {
|
public final void setArrowLocation(ArrowLocation location) {
|
||||||
@ -812,7 +795,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the arrow location property.
|
* Returns the value of the arrow location property.
|
||||||
*
|
*
|
||||||
* @return the preferred arrow location
|
* @return the preferred arrow location
|
||||||
*
|
|
||||||
* @see #arrowLocationProperty()
|
* @see #arrowLocationProperty()
|
||||||
*/
|
*/
|
||||||
public final ArrowLocation getArrowLocation() {
|
public final ArrowLocation getArrowLocation() {
|
||||||
@ -859,7 +841,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the fade-in duration property.
|
* Returns the value of the fade-in duration property.
|
||||||
*
|
*
|
||||||
* @return the fade-in duration
|
* @return the fade-in duration
|
||||||
*
|
|
||||||
* @see #fadeInDurationProperty()
|
* @see #fadeInDurationProperty()
|
||||||
*/
|
*/
|
||||||
public final Duration getFadeInDuration() {
|
public final Duration getFadeInDuration() {
|
||||||
@ -871,7 +852,6 @@ public class Popover extends PopupControl {
|
|||||||
* Popover.show(..).
|
* Popover.show(..).
|
||||||
*
|
*
|
||||||
* @param duration the requested fade-in duration
|
* @param duration the requested fade-in duration
|
||||||
*
|
|
||||||
* @see #fadeInDurationProperty()
|
* @see #fadeInDurationProperty()
|
||||||
*/
|
*/
|
||||||
public final void setFadeInDuration(Duration duration) {
|
public final void setFadeInDuration(Duration duration) {
|
||||||
@ -882,7 +862,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the fade-out duration property.
|
* Returns the value of the fade-out duration property.
|
||||||
*
|
*
|
||||||
* @return the fade-out duration
|
* @return the fade-out duration
|
||||||
*
|
|
||||||
* @see #fadeOutDurationProperty()
|
* @see #fadeOutDurationProperty()
|
||||||
*/
|
*/
|
||||||
public final Duration getFadeOutDuration() {
|
public final Duration getFadeOutDuration() {
|
||||||
@ -893,7 +872,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the fade-out duration property.
|
* Sets the value of the fade-out duration property.
|
||||||
*
|
*
|
||||||
* @param duration the requested fade-out duration
|
* @param duration the requested fade-out duration
|
||||||
*
|
|
||||||
* @see #fadeOutDurationProperty()
|
* @see #fadeOutDurationProperty()
|
||||||
*/
|
*/
|
||||||
public final void setFadeOutDuration(Duration duration) {
|
public final void setFadeOutDuration(Duration duration) {
|
||||||
@ -914,7 +892,6 @@ public class Popover extends PopupControl {
|
|||||||
* Returns the value of the "animated" property.
|
* Returns the value of the "animated" property.
|
||||||
*
|
*
|
||||||
* @return true if the Popover will be shown and hidden with a short fade animation
|
* @return true if the Popover will be shown and hidden with a short fade animation
|
||||||
*
|
|
||||||
* @see #animatedProperty()
|
* @see #animatedProperty()
|
||||||
*/
|
*/
|
||||||
public final boolean isAnimated() {
|
public final boolean isAnimated() {
|
||||||
@ -925,7 +902,6 @@ public class Popover extends PopupControl {
|
|||||||
* Sets the value of the "animated" property.
|
* Sets the value of the "animated" property.
|
||||||
*
|
*
|
||||||
* @param animated if true the Popover will be shown and hidden with a short fade animation
|
* @param animated if true the Popover will be shown and hidden with a short fade animation
|
||||||
*
|
|
||||||
* @see #animatedProperty()
|
* @see #animatedProperty()
|
||||||
*/
|
*/
|
||||||
public final void setAnimated(boolean animated) {
|
public final void setAnimated(boolean animated) {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import static atlantafx.base.controls.Popover.ArrowLocation;
|
import static atlantafx.base.controls.Popover.ArrowLocation;
|
||||||
@ -252,7 +253,8 @@ public class PopoverSkin implements Skin<Popover> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() { }
|
public void dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
private Node createCloseIcon() {
|
private Node createCloseIcon() {
|
||||||
Group group = new Group();
|
Group group = new Group();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.geometry.Orientation;
|
import javafx.geometry.Orientation;
|
||||||
@ -6,7 +7,9 @@ import javafx.scene.control.Slider;
|
|||||||
import javafx.scene.control.skin.SliderSkin;
|
import javafx.scene.control.skin.SliderSkin;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
|
|
||||||
/** {@link Slider} skin that supports progress color. */
|
/**
|
||||||
|
* {@link Slider} skin that supports progress color.
|
||||||
|
*/
|
||||||
public class ProgressSliderSkin extends SliderSkin {
|
public class ProgressSliderSkin extends SliderSkin {
|
||||||
|
|
||||||
protected final StackPane thumb;
|
protected final StackPane thumb;
|
||||||
@ -45,7 +48,8 @@ public class ProgressSliderSkin extends SliderSkin {
|
|||||||
} else {
|
} else {
|
||||||
progressY = thumb.getLayoutY();
|
progressY = thumb.getLayoutY();
|
||||||
progressWidth = track.getWidth();
|
progressWidth = track.getWidth();
|
||||||
progressHeight = track.getLayoutBounds().getMaxY() + track.getLayoutY() - thumb.getLayoutY() - snappedBottomInset();
|
progressHeight =
|
||||||
|
track.getLayoutBounds().getMaxY() + track.getLayoutY() - thumb.getLayoutY() - snappedBottomInset();
|
||||||
}
|
}
|
||||||
|
|
||||||
progressTrack.resizeRelocate(progressX, progressY, progressWidth, progressHeight);
|
progressTrack.resizeRelocate(progressX, progressY, progressWidth, progressHeight);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
@ -12,7 +13,8 @@ import javafx.util.StringConverter;
|
|||||||
|
|
||||||
public class RingProgressIndicator extends ProgressIndicator {
|
public class RingProgressIndicator extends ProgressIndicator {
|
||||||
|
|
||||||
public RingProgressIndicator() { }
|
public RingProgressIndicator() {
|
||||||
|
}
|
||||||
|
|
||||||
public RingProgressIndicator(double progress) {
|
public RingProgressIndicator(double progress) {
|
||||||
this(progress, false);
|
this(progress, false);
|
||||||
@ -52,7 +54,8 @@ public class RingProgressIndicator extends ProgressIndicator {
|
|||||||
|
|
||||||
// ~
|
// ~
|
||||||
|
|
||||||
protected final ObjectProperty<StringConverter<Double>> stringConverter = new SimpleObjectProperty<>(this, "converter", null);
|
protected final ObjectProperty<StringConverter<Double>> stringConverter =
|
||||||
|
new SimpleObjectProperty<>(this, "converter", null);
|
||||||
|
|
||||||
public StringConverter<Double> getStringConverter() {
|
public StringConverter<Double> getStringConverter() {
|
||||||
return stringConverterProperty().get();
|
return stringConverterProperty().get();
|
||||||
@ -62,7 +65,9 @@ public class RingProgressIndicator extends ProgressIndicator {
|
|||||||
this.stringConverterProperty().set(stringConverter);
|
this.stringConverterProperty().set(stringConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Optional converter to transform progress value to string. */
|
/**
|
||||||
|
* Optional converter to transform progress value to string.
|
||||||
|
*/
|
||||||
public ObjectProperty<StringConverter<Double>> stringConverterProperty() {
|
public ObjectProperty<StringConverter<Double>> stringConverterProperty() {
|
||||||
return stringConverter;
|
return stringConverter;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -249,7 +250,8 @@ public class RingProgressIndicatorSkin extends SkinBase<RingProgressIndicator> {
|
|||||||
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
|
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(SkinBase.getClassCssMetaData());
|
final List<CssMetaData<? extends Styleable, ?>> styleables =
|
||||||
|
new ArrayList<>(SkinBase.getClassCssMetaData());
|
||||||
styleables.add(INDETERMINATE_ANIMATION_TIME);
|
styleables.add(INDETERMINATE_ANIMATION_TIME);
|
||||||
STYLEABLES = Collections.unmodifiableList(styleables);
|
STYLEABLES = Collections.unmodifiableList(styleables);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.geometry.Orientation;
|
import javafx.geometry.Orientation;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
@ -41,7 +42,9 @@ public class ToggleSwitch extends Labeled {
|
|||||||
protected static final String DEFAULT_STYLE_CLASS = "toggle-switch";
|
protected static final String DEFAULT_STYLE_CLASS = "toggle-switch";
|
||||||
protected static final PseudoClass PSEUDO_CLASS_SELECTED = PseudoClass.getPseudoClass("selected");
|
protected static final PseudoClass PSEUDO_CLASS_SELECTED = PseudoClass.getPseudoClass("selected");
|
||||||
|
|
||||||
/** Creates a toggle switch with empty string for its label. */
|
/**
|
||||||
|
* Creates a toggle switch with empty string for its label.
|
||||||
|
*/
|
||||||
public ToggleSwitch() {
|
public ToggleSwitch() {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
@ -64,20 +67,28 @@ public class ToggleSwitch extends Labeled {
|
|||||||
// Properties //
|
// Properties //
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/** Indicates whether this switch is selected. */
|
/**
|
||||||
|
* Indicates whether this switch is selected.
|
||||||
|
*/
|
||||||
private BooleanProperty selected;
|
private BooleanProperty selected;
|
||||||
|
|
||||||
/** Sets the selected value. */
|
/**
|
||||||
|
* Sets the selected value.
|
||||||
|
*/
|
||||||
public final void setSelected(boolean value) {
|
public final void setSelected(boolean value) {
|
||||||
selectedProperty().set(value);
|
selectedProperty().set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether this Toggle Switch is selected. */
|
/**
|
||||||
|
* Returns whether this Toggle Switch is selected.
|
||||||
|
*/
|
||||||
public final boolean isSelected() {
|
public final boolean isSelected() {
|
||||||
return selected != null && selected.get();
|
return selected != null && selected.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the selected property. */
|
/**
|
||||||
|
* Returns the selected property.
|
||||||
|
*/
|
||||||
public final BooleanProperty selectedProperty() {
|
public final BooleanProperty selectedProperty() {
|
||||||
if (selected == null) {
|
if (selected == null) {
|
||||||
selected = new BooleanPropertyBase() {
|
selected = new BooleanPropertyBase() {
|
||||||
@ -117,7 +128,9 @@ public class ToggleSwitch extends Labeled {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Skin<?> createDefaultSkin() {
|
protected Skin<?> createDefaultSkin() {
|
||||||
return new ToggleSwitchSkin(this);
|
return new ToggleSwitchSkin(this);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package atlantafx.base.controls;
|
package atlantafx.base.controls;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -76,8 +77,9 @@ public class ToggleSwitchSkin extends SkinBase<ToggleSwitch> {
|
|||||||
thumbArea.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
|
thumbArea.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
|
||||||
thumb.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
|
thumb.setOnMouseReleased(event -> mousePressedOnToggleSwitch(control));
|
||||||
control.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
control.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (newValue.booleanValue() != oldValue.booleanValue())
|
if (newValue.booleanValue() != oldValue.booleanValue()) {
|
||||||
selectedStateChanged();
|
selectedStateChanged();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.theme;
|
package atlantafx.base.theme;
|
||||||
|
|
||||||
public final class NordDark implements Theme {
|
public final class NordDark implements Theme {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.theme;
|
package atlantafx.base.theme;
|
||||||
|
|
||||||
public final class NordLight implements Theme {
|
public final class NordLight implements Theme {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.theme;
|
package atlantafx.base.theme;
|
||||||
|
|
||||||
public final class PrimerDark implements Theme {
|
public final class PrimerDark implements Theme {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.theme;
|
package atlantafx.base.theme;
|
||||||
|
|
||||||
public final class PrimerLight implements Theme {
|
public final class PrimerLight implements Theme {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.theme;
|
package atlantafx.base.theme;
|
||||||
|
|
||||||
import javafx.css.PseudoClass;
|
import javafx.css.PseudoClass;
|
||||||
@ -83,10 +84,12 @@ public final class Styles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleStyleClass(Node node, String styleClass) {
|
public static void toggleStyleClass(Node node, String styleClass) {
|
||||||
if (node == null)
|
if (node == null) {
|
||||||
throw new NullPointerException("Node cannot be null!");
|
throw new NullPointerException("Node cannot be null!");
|
||||||
if (styleClass == null)
|
}
|
||||||
|
if (styleClass == null) {
|
||||||
throw new NullPointerException("Style class cannot be null!");
|
throw new NullPointerException("Style class cannot be null!");
|
||||||
|
}
|
||||||
|
|
||||||
int idx = node.getStyleClass().indexOf(styleClass);
|
int idx = node.getStyleClass().indexOf(styleClass);
|
||||||
if (idx > 0) {
|
if (idx > 0) {
|
||||||
@ -97,10 +100,12 @@ public final class Styles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void addStyleClass(Node node, String styleClass, String... excludes) {
|
public static void addStyleClass(Node node, String styleClass, String... excludes) {
|
||||||
if (node == null)
|
if (node == null) {
|
||||||
throw new NullPointerException("Node cannot be null!");
|
throw new NullPointerException("Node cannot be null!");
|
||||||
if (styleClass == null)
|
}
|
||||||
|
if (styleClass == null) {
|
||||||
throw new NullPointerException("Style class cannot be null!");
|
throw new NullPointerException("Style class cannot be null!");
|
||||||
|
}
|
||||||
|
|
||||||
if (excludes != null && excludes.length > 0) {
|
if (excludes != null && excludes.length > 0) {
|
||||||
node.getStyleClass().removeAll(excludes);
|
node.getStyleClass().removeAll(excludes);
|
||||||
@ -109,10 +114,12 @@ public final class Styles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void activatePseudoClass(Node node, PseudoClass pseudoClass, PseudoClass... excludes) {
|
public static void activatePseudoClass(Node node, PseudoClass pseudoClass, PseudoClass... excludes) {
|
||||||
if (node == null)
|
if (node == null) {
|
||||||
throw new NullPointerException("Node cannot be null!");
|
throw new NullPointerException("Node cannot be null!");
|
||||||
if (pseudoClass == null)
|
}
|
||||||
|
if (pseudoClass == null) {
|
||||||
throw new NullPointerException("PseudoClass cannot be null!");
|
throw new NullPointerException("PseudoClass cannot be null!");
|
||||||
|
}
|
||||||
|
|
||||||
if (excludes != null && excludes.length > 0) {
|
if (excludes != null && excludes.length > 0) {
|
||||||
for (PseudoClass exclude : excludes) {
|
for (PseudoClass exclude : excludes) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.theme;
|
package atlantafx.base.theme;
|
||||||
|
|
||||||
import static javafx.application.Application.STYLESHEET_CASPIAN;
|
import static javafx.application.Application.STYLESHEET_CASPIAN;
|
||||||
@ -16,10 +17,12 @@ public interface Theme {
|
|||||||
boolean isDarkMode();
|
boolean isDarkMode();
|
||||||
|
|
||||||
static Theme of(final String name, final String userAgentStylesheet, final boolean darkMode) {
|
static Theme of(final String name, final String userAgentStylesheet, final boolean darkMode) {
|
||||||
if (name == null)
|
if (name == null) {
|
||||||
throw new NullPointerException("Name cannot be null!");
|
throw new NullPointerException("Name cannot be null!");
|
||||||
if (userAgentStylesheet == null)
|
}
|
||||||
|
if (userAgentStylesheet == null) {
|
||||||
throw new NullPointerException("User agent stylesheet cannot be null!");
|
throw new NullPointerException("User agent stylesheet cannot be null!");
|
||||||
|
}
|
||||||
|
|
||||||
return new Theme() {
|
return new Theme() {
|
||||||
|
|
||||||
@ -41,6 +44,7 @@ public interface Theme {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default boolean isDefault() {
|
default boolean isDefault() {
|
||||||
return STYLESHEET_MODENA.equals(getUserAgentStylesheet()) || STYLESHEET_CASPIAN.equals(getUserAgentStylesheet());
|
return STYLESHEET_MODENA.equals(getUserAgentStylesheet()) ||
|
||||||
|
STYLESHEET_CASPIAN.equals(getUserAgentStylesheet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.util;
|
package atlantafx.base.util;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.util;
|
package atlantafx.base.util;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.util;
|
package atlantafx.base.util;
|
||||||
|
|
||||||
import java.util.function.UnaryOperator;
|
import java.util.function.UnaryOperator;
|
||||||
@ -25,19 +26,24 @@ public class PasswordTextFormatter extends TextFormatter<String> {
|
|||||||
char bullet) {
|
char bullet) {
|
||||||
super(valueConverter, null, filter);
|
super(valueConverter, null, filter);
|
||||||
|
|
||||||
if (valueConverter == null)
|
if (valueConverter == null) {
|
||||||
throw new NullPointerException("StringConverter cannot be null!");
|
throw new NullPointerException("StringConverter cannot be null!");
|
||||||
if (filter == null)
|
}
|
||||||
|
if (filter == null) {
|
||||||
throw new NullPointerException("UnaryOperator cannot be null!");
|
throw new NullPointerException("UnaryOperator cannot be null!");
|
||||||
if (textField == null)
|
}
|
||||||
|
if (textField == null) {
|
||||||
throw new NullPointerException("TextField cannot be null!");
|
throw new NullPointerException("TextField cannot be null!");
|
||||||
|
}
|
||||||
|
|
||||||
PasswordFilter passwordFilter = (PasswordFilter) getFilter();
|
PasswordFilter passwordFilter = (PasswordFilter) getFilter();
|
||||||
passwordFilter.setBullet(bullet);
|
passwordFilter.setBullet(bullet);
|
||||||
passwordFilter.setInitialText(textField.getText());
|
passwordFilter.setInitialText(textField.getText());
|
||||||
|
|
||||||
revealPasswordProperty().addListener((obs, old, val) -> {
|
revealPasswordProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Force text field update, because converter is only called on focus events by default.
|
// Force text field update, because converter is only called on focus events by default.
|
||||||
// Also, reset caret first, because otherwise its position won't be correct due to
|
// Also, reset caret first, because otherwise its position won't be correct due to
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.base.util;
|
package atlantafx.base.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +12,8 @@ public class PasswordTextFormatterTest {
|
|||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void startup() {
|
public static void startup() {
|
||||||
Platform.startup(() -> { });
|
Platform.startup(() -> {
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler;
|
package atlantafx.sampler;
|
||||||
|
|
||||||
import static java.lang.Double.MAX_VALUE;
|
import static java.lang.Double.MAX_VALUE;
|
||||||
@ -27,7 +28,9 @@ public class DefaultExceptionHandler implements Thread.UncaughtExceptionHandler
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
var dialog = createExceptionDialog(e);
|
var dialog = createExceptionDialog(e);
|
||||||
if (dialog != null) { dialog.showAndWait(); }
|
if (dialog != null) {
|
||||||
|
dialog.showAndWait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Alert createExceptionDialog(Throwable throwable) {
|
private Alert createExceptionDialog(Throwable throwable) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler;
|
package atlantafx.sampler;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -50,7 +51,9 @@ public final class FileResource {
|
|||||||
public InputStream getInputStream() throws IOException {
|
public InputStream getInputStream() throws IOException {
|
||||||
if (internal) {
|
if (internal) {
|
||||||
var is = anchor.getResourceAsStream(location);
|
var is = anchor.getResourceAsStream(location);
|
||||||
if (is == null) { throw new IOException("Resource not found: " + location); }
|
if (is == null) {
|
||||||
|
throw new IOException("Resource not found: " + location);
|
||||||
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
return new FileInputStream(toPath().toFile());
|
return new FileInputStream(toPath().toFile());
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler;
|
package atlantafx.sampler;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
@ -91,7 +92,8 @@ public class Launcher extends Application {
|
|||||||
|
|
||||||
private void loadApplicationProperties() {
|
private void loadApplicationProperties() {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
try (InputStreamReader in = new InputStreamReader(Resources.getResourceAsStream("application.properties"), UTF_8)) {
|
try (InputStreamReader in = new InputStreamReader(Resources.getResourceAsStream("application.properties"),
|
||||||
|
UTF_8)) {
|
||||||
properties.load(in);
|
properties.load(in);
|
||||||
properties.forEach((key, value) -> System.setProperty(
|
properties.forEach((key, value) -> System.setProperty(
|
||||||
String.valueOf(key),
|
String.valueOf(key),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler;
|
package atlantafx.sampler;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.event;
|
package atlantafx.sampler.event;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.event;
|
package atlantafx.sampler.event;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -20,7 +21,8 @@ import java.util.function.Consumer;
|
|||||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public final class DefaultEventBus implements EventBus {
|
public final class DefaultEventBus implements EventBus {
|
||||||
|
|
||||||
public DefaultEventBus() {}
|
public DefaultEventBus() {
|
||||||
|
}
|
||||||
|
|
||||||
private final Map<Class<?>, Set<Consumer>> subscribers = new ConcurrentHashMap<>();
|
private final Map<Class<?>, Set<Consumer>> subscribers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.event;
|
package atlantafx.sampler.event;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -7,7 +8,8 @@ public abstract class Event {
|
|||||||
|
|
||||||
protected final UUID id = UUID.randomUUID();
|
protected final UUID id = UUID.randomUUID();
|
||||||
|
|
||||||
protected Event() { }
|
protected Event() {
|
||||||
|
}
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -15,8 +17,12 @@ public abstract class Event {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) { return true; }
|
if (this == o) {
|
||||||
if (!(o instanceof Event event)) { return false; }
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof Event event)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return id.equals(event.id);
|
return id.equals(event.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.event;
|
package atlantafx.sampler.event;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.event;
|
package atlantafx.sampler.event;
|
||||||
|
|
||||||
import javafx.scene.input.KeyCodeCombination;
|
import javafx.scene.input.KeyCodeCombination;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.event;
|
package atlantafx.sampler.event;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
@Target(ElementType.METHOD)
|
@Target(ElementType.METHOD)
|
||||||
public @interface Listener {}
|
public @interface Listener {
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.fake;
|
package atlantafx.sampler.fake;
|
||||||
|
|
||||||
import static atlantafx.sampler.util.Controls.menuItem;
|
import static atlantafx.sampler.util.Controls.menuItem;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.fake.domain;
|
package atlantafx.sampler.fake.domain;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -28,27 +29,49 @@ public final class Book {
|
|||||||
this.isbn = isbn;
|
this.isbn = isbn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getId() { return id; }
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(UUID id) { this.id = id; }
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getState() { return state.get(); }
|
public boolean getState() {
|
||||||
|
return state.get();
|
||||||
|
}
|
||||||
|
|
||||||
public void setState(boolean state) { this.state.set(state); }
|
public void setState(boolean state) {
|
||||||
|
this.state.set(state);
|
||||||
|
}
|
||||||
|
|
||||||
public BooleanProperty stateProperty() { return state; }
|
public BooleanProperty stateProperty() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAuthor() { return author; }
|
public String getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAuthor(String author) { this.author = author; }
|
public void setAuthor(String author) {
|
||||||
|
this.author = author;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTitle() { return title; }
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) { this.title = title; }
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
public String getIsbn() { return isbn; }
|
public String getIsbn() {
|
||||||
|
return isbn;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsbn(String isbn) { this.isbn = isbn; }
|
public void setIsbn(String isbn) {
|
||||||
|
this.isbn = isbn;
|
||||||
|
}
|
||||||
|
|
||||||
public static Book random(Faker faker) {
|
public static Book random(Faker faker) {
|
||||||
return new Book(
|
return new Book(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.fake.domain;
|
package atlantafx.sampler.fake.domain;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -33,31 +34,57 @@ public final class Product {
|
|||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() { return id; }
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(int id) { this.id = id; }
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getState() { return state.get(); }
|
public boolean getState() {
|
||||||
|
return state.get();
|
||||||
|
}
|
||||||
|
|
||||||
public BooleanProperty stateProperty() { return state; }
|
public BooleanProperty stateProperty() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
public void setState(boolean state) { this.state.set(state); }
|
public void setState(boolean state) {
|
||||||
|
this.state.set(state);
|
||||||
|
}
|
||||||
|
|
||||||
public String getBrand() { return brand; }
|
public String getBrand() {
|
||||||
|
return brand;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBrand(String brand) { this.brand = brand; }
|
public void setBrand(String brand) {
|
||||||
|
this.brand = brand;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() { return name; }
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public void setName(String name) { this.name = name; }
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPrice() { return price; }
|
public String getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
public void setPrice(String price) { this.price = price; }
|
public void setPrice(String price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getCount() { return count; }
|
public Integer getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCount(Integer count) { this.count = count; }
|
public void setCount(Integer count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
public double getAvailability() {
|
public double getAvailability() {
|
||||||
return count * 1.0 / MAX_STOCK_SIZE;
|
return count * 1.0 / MAX_STOCK_SIZE;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.layout;
|
package atlantafx.sampler.layout;
|
||||||
|
|
||||||
import atlantafx.sampler.util.Containers;
|
import atlantafx.sampler.util.Containers;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.layout;
|
package atlantafx.sampler.layout;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.TEXT_SMALL;
|
import static atlantafx.base.theme.Styles.TEXT_SMALL;
|
||||||
@ -100,7 +101,9 @@ class HeaderBar extends HBox {
|
|||||||
() -> model.themeChangeToggleProperty().get() ? 1.0 : 0.5, model.themeChangeToggleProperty()
|
() -> model.themeChangeToggleProperty().get() ? 1.0 : 0.5, model.themeChangeToggleProperty()
|
||||||
));
|
));
|
||||||
quickConfigBtn.setOnMouseClicked(e -> {
|
quickConfigBtn.setOnMouseClicked(e -> {
|
||||||
if (quickConfigActionHandler != null) { quickConfigActionHandler.accept(popoverAnchor); }
|
if (quickConfigActionHandler != null) {
|
||||||
|
quickConfigActionHandler.accept(popoverAnchor);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var sourceCodeBtn = new FontIcon(ICON_CODE);
|
var sourceCodeBtn = new FontIcon(ICON_CODE);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.layout;
|
package atlantafx.sampler.layout;
|
||||||
|
|
||||||
import static atlantafx.base.controls.Popover.ArrowLocation.TOP_CENTER;
|
import static atlantafx.base.controls.Popover.ArrowLocation.TOP_CENTER;
|
||||||
@ -73,7 +74,9 @@ class MainLayer extends BorderPane {
|
|||||||
headerBar.setQuickConfigActionHandler(this::showThemeConfigPopover);
|
headerBar.setQuickConfigActionHandler(this::showThemeConfigPopover);
|
||||||
|
|
||||||
model.selectedPageProperty().addListener((obs, old, val) -> {
|
model.selectedPageProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { loadPage(val); }
|
if (val != null) {
|
||||||
|
loadPage(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
model.currentSubLayerProperty().addListener((obs, old, val) -> {
|
model.currentSubLayerProperty().addListener((obs, old, val) -> {
|
||||||
@ -85,7 +88,8 @@ class MainLayer extends BorderPane {
|
|||||||
|
|
||||||
// update code view color theme on app theme change
|
// update code view color theme on app theme change
|
||||||
DefaultEventBus.getInstance().subscribe(ThemeEvent.class, e -> {
|
DefaultEventBus.getInstance().subscribe(ThemeEvent.class, e -> {
|
||||||
if (ThemeManager.getInstance().getTheme() != null && model.currentSubLayerProperty().get() == SubLayer.SOURCE_CODE) {
|
if (ThemeManager.getInstance().getTheme() != null &&
|
||||||
|
model.currentSubLayerProperty().get() == SubLayer.SOURCE_CODE) {
|
||||||
showSourceCode();
|
showSourceCode();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -123,7 +127,9 @@ class MainLayer extends BorderPane {
|
|||||||
transition.setFromValue(0.0);
|
transition.setFromValue(0.0);
|
||||||
transition.setToValue(1.0);
|
transition.setToValue(1.0);
|
||||||
transition.setOnFinished(t -> {
|
transition.setOnFinished(t -> {
|
||||||
if (nextPage instanceof Pane nextPane) { nextPane.toFront(); }
|
if (nextPage instanceof Pane nextPane) {
|
||||||
|
nextPane.toFront();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
transition.play();
|
transition.play();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.layout;
|
package atlantafx.sampler.layout;
|
||||||
|
|
||||||
import static atlantafx.sampler.layout.MainModel.SubLayer.PAGE;
|
import static atlantafx.sampler.layout.MainModel.SubLayer.PAGE;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.layout;
|
package atlantafx.sampler.layout;
|
||||||
|
|
||||||
import atlantafx.sampler.util.Animations;
|
import atlantafx.sampler.util.Animations;
|
||||||
@ -67,14 +68,17 @@ public class Overlay extends StackPane {
|
|||||||
// hide overlay by pressing ESC (only works when overlay or one of its children has focus,
|
// hide overlay by pressing ESC (only works when overlay or one of its children has focus,
|
||||||
// that's why we requesting it in the toFront())
|
// that's why we requesting it in the toFront())
|
||||||
addEventHandler(KeyEvent.KEY_PRESSED, e -> {
|
addEventHandler(KeyEvent.KEY_PRESSED, e -> {
|
||||||
if (e.getCode() == KeyCode.ESCAPE) { hideAndConsume.accept(e); }
|
if (e.getCode() == KeyCode.ESCAPE) {
|
||||||
|
hideAndConsume.accept(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// hide overlay by clicking outside content area
|
// hide overlay by clicking outside content area
|
||||||
setOnMouseClicked(e -> {
|
setOnMouseClicked(e -> {
|
||||||
Pane content = getContent();
|
Pane content = getContent();
|
||||||
Node eventSource = e.getPickResult().getIntersectedNode();
|
Node eventSource = e.getPickResult().getIntersectedNode();
|
||||||
if (e.getButton() == MouseButton.PRIMARY && content != null && !NodeUtils.isDescendant(content, eventSource)) {
|
if (e.getButton() == MouseButton.PRIMARY && content != null &&
|
||||||
|
!NodeUtils.isDescendant(content, eventSource)) {
|
||||||
hideAndConsume.accept(e);
|
hideAndConsume.accept(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -131,7 +135,9 @@ public class Overlay extends StackPane {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toFront() {
|
public void toFront() {
|
||||||
if (onFrontProperty.get()) { return; }
|
if (onFrontProperty.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.toFront();
|
super.toFront();
|
||||||
fadeInTransition.playFromStart();
|
fadeInTransition.playFromStart();
|
||||||
onFrontProperty.set(true);
|
onFrontProperty.set(true);
|
||||||
@ -139,7 +145,9 @@ public class Overlay extends StackPane {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toBack() {
|
public void toBack() {
|
||||||
if (!onFrontProperty.get()) { return; }
|
if (!onFrontProperty.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
super.toBack();
|
super.toBack();
|
||||||
fadeOutTransition.playFromStart();
|
fadeOutTransition.playFromStart();
|
||||||
onFrontProperty.set(false);
|
onFrontProperty.set(false);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.layout;
|
package atlantafx.sampler.layout;
|
||||||
|
|
||||||
import static javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED;
|
import static javafx.scene.control.ScrollPane.ScrollBarPolicy.AS_NEEDED;
|
||||||
@ -180,17 +181,23 @@ class Sidebar extends StackPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Optional<NavLink> findLink(Class<? extends Page> pageClass) {
|
public Optional<NavLink> findLink(Class<? extends Page> pageClass) {
|
||||||
if (pageClass == null) { return Optional.empty(); }
|
if (pageClass == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
return Optional.ofNullable(registry.get(pageClass));
|
return Optional.ofNullable(registry.get(pageClass));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<NavLink> getPrevious() {
|
public Optional<NavLink> getPrevious() {
|
||||||
var current = content.indexOf(registry.get(model.selectedPageProperty().get()));
|
var current = content.indexOf(registry.get(model.selectedPageProperty().get()));
|
||||||
if (!(current > 0)) { return Optional.empty(); }
|
if (!(current > 0)) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = current - 1; i >= 0; i--) {
|
for (int i = current - 1; i >= 0; i--) {
|
||||||
var r = content.get(i);
|
var r = content.get(i);
|
||||||
if (r instanceof NavLink link) { return Optional.of(link); }
|
if (r instanceof NavLink link) {
|
||||||
|
return Optional.of(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@ -198,11 +205,15 @@ class Sidebar extends StackPane {
|
|||||||
|
|
||||||
public Optional<NavLink> getNext() {
|
public Optional<NavLink> getNext() {
|
||||||
var current = content.indexOf(registry.get(model.selectedPageProperty().get()));
|
var current = content.indexOf(registry.get(model.selectedPageProperty().get()));
|
||||||
if (!(current >= 0 && current < content.size() - 1)) { return Optional.empty(); } // has next
|
if (!(current >= 0 && current < content.size() - 1)) {
|
||||||
|
return Optional.empty();
|
||||||
|
} // has next
|
||||||
|
|
||||||
for (int i = current + 1; i < content.size(); i++) {
|
for (int i = current + 1; i < content.size(); i++) {
|
||||||
var r = content.get(i);
|
var r = content.get(i);
|
||||||
if (r instanceof NavLink link) { return Optional.of(link); }
|
if (r instanceof NavLink link) {
|
||||||
|
return Optional.of(link);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@ -310,7 +321,8 @@ class Sidebar extends StackPane {
|
|||||||
|
|
||||||
public boolean matches(String filter) {
|
public boolean matches(String filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
return contains(getText(), filter) || searchKeywords.stream().anyMatch(keyword -> contains(keyword, filter));
|
return contains(getText(), filter) ||
|
||||||
|
searchKeywords.stream().anyMatch(keyword -> contains(keyword, filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean contains(String text, String filter) {
|
private boolean contains(String text, String filter) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page;
|
package atlantafx.sampler.page;
|
||||||
|
|
||||||
import static atlantafx.sampler.util.Containers.setScrollConstraints;
|
import static atlantafx.sampler.util.Containers.setScrollConstraints;
|
||||||
@ -66,12 +67,15 @@ public abstract class AbstractPage extends BorderPane implements Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() { }
|
public void reset() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layoutChildren() {
|
protected void layoutChildren() {
|
||||||
super.layoutChildren();
|
super.layoutChildren();
|
||||||
if (isRendered) { return; }
|
if (isRendered) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isRendered = true;
|
isRendered = true;
|
||||||
onRendered();
|
onRendered();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page;
|
package atlantafx.sampler.page;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page;
|
package atlantafx.sampler.page;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_CIRCLE;
|
import static atlantafx.base.theme.Styles.BUTTON_CIRCLE;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page;
|
package atlantafx.sampler.page;
|
||||||
|
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page;
|
package atlantafx.sampler.page;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_CIRCLE;
|
import static atlantafx.base.theme.Styles.BUTTON_CIRCLE;
|
||||||
@ -80,12 +81,16 @@ public class QuickConfigMenu extends StackPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MainMenu getOrCreateMainMenu() {
|
private MainMenu getOrCreateMainMenu() {
|
||||||
if (mainMenu == null) { mainMenu = new MainMenu(navHandler); }
|
if (mainMenu == null) {
|
||||||
|
mainMenu = new MainMenu(navHandler);
|
||||||
|
}
|
||||||
return mainMenu;
|
return mainMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ThemeSelectionMenu getOrCreateThemeSelectionMenu() {
|
private ThemeSelectionMenu getOrCreateThemeSelectionMenu() {
|
||||||
if (themeSelectionMenu == null) { themeSelectionMenu = new ThemeSelectionMenu(navHandler); }
|
if (themeSelectionMenu == null) {
|
||||||
|
themeSelectionMenu = new ThemeSelectionMenu(navHandler);
|
||||||
|
}
|
||||||
return themeSelectionMenu;
|
return themeSelectionMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page;
|
package atlantafx.sampler.page;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.DENSE;
|
import static atlantafx.base.theme.Styles.DENSE;
|
||||||
@ -31,7 +32,9 @@ public class AccordionPage extends AbstractPage {
|
|||||||
public static final String NAME = "Accordion";
|
public static final String NAME = "Accordion";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private final BooleanProperty expandedProperty = new SimpleBooleanProperty(true);
|
private final BooleanProperty expandedProperty = new SimpleBooleanProperty(true);
|
||||||
private final BooleanProperty animatedProperty = new SimpleBooleanProperty(true);
|
private final BooleanProperty animatedProperty = new SimpleBooleanProperty(true);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.base.controls.Breadcrumbs;
|
import atlantafx.base.controls.Breadcrumbs;
|
||||||
@ -25,7 +26,9 @@ public class BreadcrumbsPage extends AbstractPage {
|
|||||||
private static final int CRUMB_COUNT = 5;
|
private static final int CRUMB_COUNT = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public BreadcrumbsPage() {
|
public BreadcrumbsPage() {
|
||||||
super();
|
super();
|
||||||
@ -54,7 +57,9 @@ public class BreadcrumbsPage extends AbstractPage {
|
|||||||
|
|
||||||
private SampleBlock customDividerSample() {
|
private SampleBlock customDividerSample() {
|
||||||
Callback<BreadCrumbItem<String>, ? extends Node> dividerFactory = item -> {
|
Callback<BreadCrumbItem<String>, ? extends Node> dividerFactory = item -> {
|
||||||
if (item == null) { return new Label("", new FontIcon(Material2AL.HOME)); }
|
if (item == null) {
|
||||||
|
return new Label("", new FontIcon(Material2AL.HOME));
|
||||||
|
}
|
||||||
return !item.isLast() ? new Label("", new FontIcon(Material2AL.CHEVRON_RIGHT)) : null;
|
return !item.isLast() ? new Label("", new FontIcon(Material2AL.CHEVRON_RIGHT)) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,8 +77,12 @@ public class BreadcrumbsPage extends AbstractPage {
|
|||||||
|
|
||||||
var breadcrumbs = new Breadcrumbs<>(model);
|
var breadcrumbs = new Breadcrumbs<>(model);
|
||||||
breadcrumbs.setSelectedCrumb(getAncestor(model, CRUMB_COUNT / 2));
|
breadcrumbs.setSelectedCrumb(getAncestor(model, CRUMB_COUNT / 2));
|
||||||
if (crumbFactory != null) { breadcrumbs.setCrumbFactory(crumbFactory); }
|
if (crumbFactory != null) {
|
||||||
if (dividerFactory != null) { breadcrumbs.setDividerFactory(dividerFactory); }
|
breadcrumbs.setCrumbFactory(crumbFactory);
|
||||||
|
}
|
||||||
|
if (dividerFactory != null) {
|
||||||
|
breadcrumbs.setDividerFactory(dividerFactory);
|
||||||
|
}
|
||||||
|
|
||||||
nextBtn.setOnAction(e -> {
|
nextBtn.setOnAction(e -> {
|
||||||
BreadCrumbItem<String> selected = breadcrumbs.getSelectedCrumb();
|
BreadCrumbItem<String> selected = breadcrumbs.getSelectedCrumb();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.ACCENT;
|
import static atlantafx.base.theme.Styles.ACCENT;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.base.controls.Spacer;
|
import atlantafx.base.controls.Spacer;
|
||||||
@ -39,7 +40,9 @@ public class ChartPage extends AbstractPage {
|
|||||||
public static final String NAME = "Chart";
|
public static final String NAME = "Chart";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private final BorderPane chartWrapper = new BorderPane();
|
private final BorderPane chartWrapper = new BorderPane();
|
||||||
private final ComboBox<Example> exampleSelect = new ComboBox<>();
|
private final ComboBox<Example> exampleSelect = new ComboBox<>();
|
||||||
@ -55,7 +58,9 @@ public class ChartPage extends AbstractPage {
|
|||||||
exampleSelect.setMaxWidth(Double.MAX_VALUE);
|
exampleSelect.setMaxWidth(Double.MAX_VALUE);
|
||||||
exampleSelect.getItems().setAll(Example.values());
|
exampleSelect.getItems().setAll(Example.values());
|
||||||
exampleSelect.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
exampleSelect.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Chart newChart = createChart(val);
|
Chart newChart = createChart(val);
|
||||||
|
|
||||||
@ -78,7 +83,9 @@ public class ChartPage extends AbstractPage {
|
|||||||
|
|
||||||
var disableToggle = new ToggleSwitch("Disable");
|
var disableToggle = new ToggleSwitch("Disable");
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedChart().ifPresent(ch -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedChart().ifPresent(ch -> {
|
||||||
if (val != null) { ch.setDisable(val); }
|
if (val != null) {
|
||||||
|
ch.setDisable(val);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var controls = new HBox(disableToggle);
|
var controls = new HBox(disableToggle);
|
||||||
@ -108,14 +115,30 @@ public class ChartPage extends AbstractPage {
|
|||||||
|
|
||||||
private Chart createChart(Example example) {
|
private Chart createChart(Example example) {
|
||||||
switch (example) {
|
switch (example) {
|
||||||
case AREA_CHART -> { return areaChart(false); }
|
case AREA_CHART -> {
|
||||||
case BAR_CHART -> { return barChart(false); }
|
return areaChart(false);
|
||||||
case BUBBLE_CHART -> { return bubbleChart(); }
|
}
|
||||||
case LINE_CHART -> { return lineChart(); }
|
case BAR_CHART -> {
|
||||||
case PIE_CHART -> { return pieChart(); }
|
return barChart(false);
|
||||||
case SCATTER_CHART -> { return scatterChart(); }
|
}
|
||||||
case STACKED_AREA_CHART -> { return areaChart(true); }
|
case BUBBLE_CHART -> {
|
||||||
case STACKED_BAR_CHART -> { return barChart(true); }
|
return bubbleChart();
|
||||||
|
}
|
||||||
|
case LINE_CHART -> {
|
||||||
|
return lineChart();
|
||||||
|
}
|
||||||
|
case PIE_CHART -> {
|
||||||
|
return pieChart();
|
||||||
|
}
|
||||||
|
case SCATTER_CHART -> {
|
||||||
|
return scatterChart();
|
||||||
|
}
|
||||||
|
case STACKED_AREA_CHART -> {
|
||||||
|
return areaChart(true);
|
||||||
|
}
|
||||||
|
case STACKED_BAR_CHART -> {
|
||||||
|
return barChart(true);
|
||||||
|
}
|
||||||
default -> throw new IllegalArgumentException("Unexpected enum value: " + example);
|
default -> throw new IllegalArgumentException("Unexpected enum value: " + example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.sampler.page.AbstractPage;
|
import atlantafx.sampler.page.AbstractPage;
|
||||||
@ -13,7 +14,9 @@ public class CheckBoxPage extends AbstractPage {
|
|||||||
public static final String NAME = "CheckBox";
|
public static final String NAME = "CheckBox";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private CheckBox basicCheck;
|
private CheckBox basicCheck;
|
||||||
private CheckBox indeterminateCheck;
|
private CheckBox indeterminateCheck;
|
||||||
@ -68,7 +71,9 @@ public class CheckBoxPage extends AbstractPage {
|
|||||||
var normalBox = basicCheck.lookup(".box");
|
var normalBox = basicCheck.lookup(".box");
|
||||||
var indeterminateBox = indeterminateCheck.lookup(".box");
|
var indeterminateBox = indeterminateCheck.lookup(".box");
|
||||||
|
|
||||||
if (normalBox == null || indeterminateBox == null) { return; }
|
if (normalBox == null || indeterminateBox == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// force layout to obtain node bounds
|
// force layout to obtain node bounds
|
||||||
((StackPane) normalBox).layout();
|
((StackPane) normalBox).layout();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -21,7 +22,9 @@ public class ColorPickerPage extends AbstractPage {
|
|||||||
public static final String NAME = "ColorPicker";
|
public static final String NAME = "ColorPicker";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public ColorPickerPage() {
|
public ColorPickerPage() {
|
||||||
super();
|
super();
|
||||||
@ -38,7 +41,9 @@ public class ColorPickerPage extends AbstractPage {
|
|||||||
labelToggle.setSelected(true);
|
labelToggle.setSelected(true);
|
||||||
labelToggle.selectedProperty().addListener((obs, old, val) -> {
|
labelToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
colorPicker.setStyle("-fx-color-label-visible: false;");
|
colorPicker.setStyle("-fx-color-label-visible: false;");
|
||||||
if (val) { colorPicker.setStyle("-fx-color-label-visible: true;"); }
|
if (val) {
|
||||||
|
colorPicker.setStyle("-fx-color-label-visible: true;");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var disableToggle = new ToggleSwitch();
|
var disableToggle = new ToggleSwitch();
|
||||||
@ -78,7 +83,9 @@ public class ColorPickerPage extends AbstractPage {
|
|||||||
var choice = new ChoiceBox<String>();
|
var choice = new ChoiceBox<String>();
|
||||||
choice.getItems().setAll(optDefault, optButton, optSplitButton);
|
choice.getItems().setAll(optDefault, optButton, optSplitButton);
|
||||||
choice.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
choice.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
colorPicker.getStyleClass().removeAll(
|
colorPicker.getStyleClass().removeAll(
|
||||||
ColorPicker.STYLE_CLASS_BUTTON,
|
ColorPicker.STYLE_CLASS_BUTTON,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.STATE_DANGER;
|
import static atlantafx.base.theme.Styles.STATE_DANGER;
|
||||||
@ -32,7 +33,9 @@ public class ComboBoxPage extends AbstractPage {
|
|||||||
private static final int PREF_WIDTH = 200;
|
private static final int PREF_WIDTH = 200;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public ComboBoxPage() {
|
public ComboBoxPage() {
|
||||||
super();
|
super();
|
||||||
@ -165,7 +168,9 @@ public class ComboBoxPage extends AbstractPage {
|
|||||||
private ComboBox<String> createComboBoxWith(Consumer<ComboBox<String>> mutator) {
|
private ComboBox<String> createComboBoxWith(Consumer<ComboBox<String>> mutator) {
|
||||||
var c = new ComboBox<String>();
|
var c = new ComboBox<String>();
|
||||||
c.setPrefWidth(PREF_WIDTH);
|
c.setPrefWidth(PREF_WIDTH);
|
||||||
if (mutator != null) { mutator.accept(c); }
|
if (mutator != null) {
|
||||||
|
mutator.accept(c);
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +181,9 @@ public class ComboBoxPage extends AbstractPage {
|
|||||||
private ChoiceBox<String> createChoiceBoxWith(Consumer<ChoiceBox<String>> mutator) {
|
private ChoiceBox<String> createChoiceBoxWith(Consumer<ChoiceBox<String>> mutator) {
|
||||||
var c = new ChoiceBox<String>();
|
var c = new ChoiceBox<String>();
|
||||||
c.setPrefWidth(PREF_WIDTH);
|
c.setPrefWidth(PREF_WIDTH);
|
||||||
if (mutator != null) { mutator.accept(c); }
|
if (mutator != null) {
|
||||||
|
mutator.accept(c);
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +194,8 @@ public class ComboBoxPage extends AbstractPage {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private record Badge(String text, Ikon icon) { }
|
private record Badge(String text, Ikon icon) {
|
||||||
|
}
|
||||||
|
|
||||||
private static class BadgeCell extends ListCell<Badge> {
|
private static class BadgeCell extends ListCell<Badge> {
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.STATE_DANGER;
|
import static atlantafx.base.theme.Styles.STATE_DANGER;
|
||||||
@ -19,7 +20,9 @@ public class CustomTextFieldPage extends AbstractPage {
|
|||||||
private static final int PREF_WIDTH = 120;
|
private static final int PREF_WIDTH = 120;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public CustomTextFieldPage() {
|
public CustomTextFieldPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
||||||
@ -65,7 +66,9 @@ public class DatePickerPage extends AbstractPage {
|
|||||||
""");
|
""");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private final BooleanProperty weekNumProperty = new SimpleBooleanProperty();
|
private final BooleanProperty weekNumProperty = new SimpleBooleanProperty();
|
||||||
private final BooleanProperty showClockProperty = new SimpleBooleanProperty();
|
private final BooleanProperty showClockProperty = new SimpleBooleanProperty();
|
||||||
@ -205,13 +208,17 @@ public class DatePickerPage extends AbstractPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(LocalDate localDate) {
|
public String toString(LocalDate localDate) {
|
||||||
if (localDate == null) { return ""; }
|
if (localDate == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
return DATE_FORMATTER.format(localDate);
|
return DATE_FORMATTER.format(localDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDate fromString(String dateString) {
|
public LocalDate fromString(String dateString) {
|
||||||
if (dateString == null || dateString.trim().isEmpty()) { return null; }
|
if (dateString == null || dateString.trim().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return LocalDate.parse(dateString, DATE_FORMATTER);
|
return LocalDate.parse(dateString, DATE_FORMATTER);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -277,8 +284,12 @@ public class DatePickerPage extends AbstractPage {
|
|||||||
resetBtn.setOnAction(e -> style.set(null));
|
resetBtn.setOnAction(e -> style.set(null));
|
||||||
|
|
||||||
style.addListener((obs, old, val) -> {
|
style.addListener((obs, old, val) -> {
|
||||||
if (old != null) { old.removeFrom(parent); }
|
if (old != null) {
|
||||||
if (val != null) { val.addTo(parent); }
|
old.removeFrom(parent);
|
||||||
|
}
|
||||||
|
if (val != null) {
|
||||||
|
val.addTo(parent);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setAlignment(Pos.CENTER);
|
setAlignment(Pos.CENTER);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -37,7 +38,9 @@ public class DialogPage extends AbstractPage {
|
|||||||
public static final String NAME = "Dialog";
|
public static final String NAME = "Dialog";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private final BooleanProperty showHeaderProperty = new SimpleBooleanProperty(true);
|
private final BooleanProperty showHeaderProperty = new SimpleBooleanProperty(true);
|
||||||
private final BooleanProperty minDecorationsProperty = new SimpleBooleanProperty(true);
|
private final BooleanProperty minDecorationsProperty = new SimpleBooleanProperty(true);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_VGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_VGAP;
|
||||||
@ -25,7 +26,9 @@ public class HTMLEditorPage extends AbstractPage {
|
|||||||
public static final String NAME = "HTMLEditor";
|
public static final String NAME = "HTMLEditor";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private HTMLEditor editor = createEditor();
|
private HTMLEditor editor = createEditor();
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
||||||
@ -28,7 +29,9 @@ public class InputGroupPage extends AbstractPage {
|
|||||||
public static final String NAME = "Input Group";
|
public static final String NAME = "Input Group";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public InputGroupPage() {
|
public InputGroupPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -18,7 +19,9 @@ public class LabelPage extends AbstractPage {
|
|||||||
public static final String NAME = "Label";
|
public static final String NAME = "Label";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public LabelPage() {
|
public LabelPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.ACCENT;
|
import static atlantafx.base.theme.Styles.ACCENT;
|
||||||
@ -45,7 +46,9 @@ public class ListPage extends AbstractPage {
|
|||||||
public static final String NAME = "ListView";
|
public static final String NAME = "ListView";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private final List<Book> dataList = generate(() -> Book.random(FAKER), 50);
|
private final List<Book> dataList = generate(() -> Book.random(FAKER), 50);
|
||||||
private final StringConverter<Book> bookStringConverter = new BookStringConverter(dataList);
|
private final StringConverter<Book> bookStringConverter = new BookStringConverter(dataList);
|
||||||
@ -62,20 +65,26 @@ public class ListPage extends AbstractPage {
|
|||||||
|
|
||||||
private VBox createPlayground() {
|
private VBox createPlayground() {
|
||||||
var borderedToggle = new ToggleSwitch("Bordered");
|
var borderedToggle = new ToggleSwitch("Bordered");
|
||||||
borderedToggle.selectedProperty().addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, BORDERED)));
|
borderedToggle.selectedProperty()
|
||||||
|
.addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, BORDERED)));
|
||||||
|
|
||||||
var denseToggle = new ToggleSwitch("Dense");
|
var denseToggle = new ToggleSwitch("Dense");
|
||||||
denseToggle.selectedProperty().addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, DENSE)));
|
denseToggle.selectedProperty()
|
||||||
|
.addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, DENSE)));
|
||||||
|
|
||||||
var stripedToggle = new ToggleSwitch("Striped");
|
var stripedToggle = new ToggleSwitch("Striped");
|
||||||
stripedToggle.selectedProperty().addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, STRIPED)));
|
stripedToggle.selectedProperty()
|
||||||
|
.addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, STRIPED)));
|
||||||
|
|
||||||
var edge2edgeToggle = new ToggleSwitch("Edge to edge");
|
var edge2edgeToggle = new ToggleSwitch("Edge to edge");
|
||||||
edge2edgeToggle.selectedProperty().addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, Tweaks.EDGE_TO_EDGE)));
|
edge2edgeToggle.selectedProperty()
|
||||||
|
.addListener((obs, old, value) -> toggleListProperty(lv -> toggleStyleClass(lv, Tweaks.EDGE_TO_EDGE)));
|
||||||
|
|
||||||
var disableToggle = new ToggleSwitch("Disable");
|
var disableToggle = new ToggleSwitch("Disable");
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedList().ifPresent(lv -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedList().ifPresent(lv -> {
|
||||||
if (val != null) { lv.setDisable(val); }
|
if (val != null) {
|
||||||
|
lv.setDisable(val);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var controls = new HBox(BLOCK_HGAP, borderedToggle, denseToggle, stripedToggle, edge2edgeToggle);
|
var controls = new HBox(BLOCK_HGAP, borderedToggle, denseToggle, stripedToggle, edge2edgeToggle);
|
||||||
@ -101,7 +110,9 @@ public class ListPage extends AbstractPage {
|
|||||||
select.getItems().setAll(Example.values());
|
select.getItems().setAll(Example.values());
|
||||||
|
|
||||||
select.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
select.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ListView<?> newList = createList(val);
|
ListView<?> newList = createList(val);
|
||||||
|
|
||||||
@ -145,18 +156,32 @@ public class ListPage extends AbstractPage {
|
|||||||
|
|
||||||
private void toggleListProperty(Consumer<ListView<?>> consumer) {
|
private void toggleListProperty(Consumer<ListView<?>> consumer) {
|
||||||
findDisplayedList().ifPresent(lv -> {
|
findDisplayedList().ifPresent(lv -> {
|
||||||
if (consumer != null) { consumer.accept(lv); }
|
if (consumer != null) {
|
||||||
|
consumer.accept(lv);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListView<?> createList(Example example) {
|
private ListView<?> createList(Example example) {
|
||||||
switch (example) {
|
switch (example) {
|
||||||
case TEXT -> { return stringList(); }
|
case TEXT -> {
|
||||||
case EDITABLE -> { return editableList(); }
|
return stringList();
|
||||||
case CHECK_BOX -> { return checkBoxList(); }
|
}
|
||||||
case CHOICE_BOX -> { return choiceBoxList(); }
|
case EDITABLE -> {
|
||||||
case COMBO_BOX -> { return comboBoxList(); }
|
return editableList();
|
||||||
case NESTED_CONTROLS -> { return nestedControlsList(); }
|
}
|
||||||
|
case CHECK_BOX -> {
|
||||||
|
return checkBoxList();
|
||||||
|
}
|
||||||
|
case CHOICE_BOX -> {
|
||||||
|
return choiceBoxList();
|
||||||
|
}
|
||||||
|
case COMBO_BOX -> {
|
||||||
|
return comboBoxList();
|
||||||
|
}
|
||||||
|
case NESTED_CONTROLS -> {
|
||||||
|
return nestedControlsList();
|
||||||
|
}
|
||||||
default -> throw new IllegalArgumentException("Unexpected enum value: " + example);
|
default -> throw new IllegalArgumentException("Unexpected enum value: " + example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,7 +213,8 @@ public class ListPage extends AbstractPage {
|
|||||||
private ListView<Book> choiceBoxList() {
|
private ListView<Book> choiceBoxList() {
|
||||||
var lv = new ListView<Book>();
|
var lv = new ListView<Book>();
|
||||||
lv.setEditable(true);
|
lv.setEditable(true);
|
||||||
lv.setCellFactory(ChoiceBoxListCell.forListView(bookStringConverter, dataList.subList(0, 10).toArray(Book[]::new)));
|
lv.setCellFactory(
|
||||||
|
ChoiceBoxListCell.forListView(bookStringConverter, dataList.subList(0, 10).toArray(Book[]::new)));
|
||||||
lv.getItems().setAll(dataList.stream().limit(10).collect(Collectors.toList()));
|
lv.getItems().setAll(dataList.stream().limit(10).collect(Collectors.toList()));
|
||||||
return lv;
|
return lv;
|
||||||
}
|
}
|
||||||
@ -196,7 +222,8 @@ public class ListPage extends AbstractPage {
|
|||||||
private ListView<Book> comboBoxList() {
|
private ListView<Book> comboBoxList() {
|
||||||
var lv = new ListView<Book>();
|
var lv = new ListView<Book>();
|
||||||
lv.setEditable(true);
|
lv.setEditable(true);
|
||||||
lv.setCellFactory(ComboBoxListCell.forListView(bookStringConverter, dataList.subList(0, 10).toArray(Book[]::new)));
|
lv.setCellFactory(
|
||||||
|
ComboBoxListCell.forListView(bookStringConverter, dataList.subList(0, 10).toArray(Book[]::new)));
|
||||||
lv.getItems().setAll(dataList.stream().limit(10).collect(Collectors.toList()));
|
lv.getItems().setAll(dataList.stream().limit(10).collect(Collectors.toList()));
|
||||||
return lv;
|
return lv;
|
||||||
}
|
}
|
||||||
@ -246,13 +273,17 @@ public class ListPage extends AbstractPage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(Book book) {
|
public String toString(Book book) {
|
||||||
if (book == null) { return null; }
|
if (book == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return String.format("\"%s\" by %s", book.getTitle(), book.getAuthor());
|
return String.format("\"%s\" by %s", book.getTitle(), book.getAuthor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Book fromString(String s) {
|
public Book fromString(String s) {
|
||||||
if (s == null) { return null; }
|
if (s == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
int sep = s.indexOf("\" by");
|
int sep = s.indexOf("\" by");
|
||||||
String title = s.substring(1, sep);
|
String title = s.substring(1, sep);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.ACCENT;
|
import static atlantafx.base.theme.Styles.ACCENT;
|
||||||
@ -32,7 +33,9 @@ public class MenuButtonPage extends AbstractPage {
|
|||||||
private static final int PREF_WIDTH = 150;
|
private static final int PREF_WIDTH = 150;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public MenuButtonPage() {
|
public MenuButtonPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static javafx.scene.input.KeyCombination.CONTROL_DOWN;
|
import static javafx.scene.input.KeyCombination.CONTROL_DOWN;
|
||||||
@ -23,7 +24,9 @@ public class MenuPage extends AbstractPage {
|
|||||||
public static final String NAME = "Menu";
|
public static final String NAME = "Menu";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public MenuPage() {
|
public MenuPage() {
|
||||||
super();
|
super();
|
||||||
@ -40,10 +43,12 @@ public class MenuPage extends AbstractPage {
|
|||||||
private SampleBlock contextMenuExample() {
|
private SampleBlock contextMenuExample() {
|
||||||
var contextMenu = new ContextMenu();
|
var contextMenu = new ContextMenu();
|
||||||
|
|
||||||
var undoItem = Controls.menuItem("_Undo", Feather.CORNER_DOWN_LEFT, new KeyCodeCombination(KeyCode.Z, CONTROL_DOWN));
|
var undoItem =
|
||||||
|
Controls.menuItem("_Undo", Feather.CORNER_DOWN_LEFT, new KeyCodeCombination(KeyCode.Z, CONTROL_DOWN));
|
||||||
undoItem.setMnemonicParsing(true);
|
undoItem.setMnemonicParsing(true);
|
||||||
|
|
||||||
var redoItem = Controls.menuItem("_Redo", Feather.CORNER_DOWN_RIGHT, new KeyCodeCombination(KeyCode.Y, CONTROL_DOWN));
|
var redoItem =
|
||||||
|
Controls.menuItem("_Redo", Feather.CORNER_DOWN_RIGHT, new KeyCodeCombination(KeyCode.Y, CONTROL_DOWN));
|
||||||
redoItem.setMnemonicParsing(true);
|
redoItem.setMnemonicParsing(true);
|
||||||
|
|
||||||
contextMenu.getItems().addAll(
|
contextMenu.getItems().addAll(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.ACCENT;
|
import static atlantafx.base.theme.Styles.ACCENT;
|
||||||
@ -55,7 +56,9 @@ public class OverviewPage extends AbstractPage {
|
|||||||
private static final int COMBO_BOX_WIDTH = 150;
|
private static final int COMBO_BOX_WIDTH = 150;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public OverviewPage() {
|
public OverviewPage() {
|
||||||
super();
|
super();
|
||||||
@ -306,7 +309,9 @@ public class OverviewPage extends AbstractPage {
|
|||||||
boolean selected,
|
boolean selected,
|
||||||
String... styleClasses) {
|
String... styleClasses) {
|
||||||
var toggleButton = new ToggleButton(text);
|
var toggleButton = new ToggleButton(text);
|
||||||
if (group != null) { toggleButton.setToggleGroup(group); }
|
if (group != null) {
|
||||||
|
toggleButton.setToggleGroup(group);
|
||||||
|
}
|
||||||
toggleButton.setSelected(selected);
|
toggleButton.setSelected(selected);
|
||||||
toggleButton.getStyleClass().addAll(styleClasses);
|
toggleButton.getStyleClass().addAll(styleClasses);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -23,7 +24,9 @@ public class PaginationPage extends AbstractPage {
|
|||||||
private static final int PREF_CONTROL_WIDTH = 120;
|
private static final int PREF_CONTROL_WIDTH = 120;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public PaginationPage() {
|
public PaginationPage() {
|
||||||
super();
|
super();
|
||||||
@ -62,13 +65,17 @@ public class PaginationPage extends AbstractPage {
|
|||||||
|
|
||||||
var showArrowsToggle = new ToggleSwitch();
|
var showArrowsToggle = new ToggleSwitch();
|
||||||
showArrowsToggle.selectedProperty().addListener((obs, old, val) -> {
|
showArrowsToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { pagination.setStyle(String.format("-fx-arrows-visible: %s;", val)); }
|
if (val != null) {
|
||||||
|
pagination.setStyle(String.format("-fx-arrows-visible: %s;", val));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
showArrowsToggle.setSelected(true);
|
showArrowsToggle.setSelected(true);
|
||||||
|
|
||||||
var showPageInfoToggle = new ToggleSwitch();
|
var showPageInfoToggle = new ToggleSwitch();
|
||||||
showPageInfoToggle.selectedProperty().addListener((obs, old, val) -> {
|
showPageInfoToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { pagination.setStyle(String.format("-fx-page-information-visible: %s;", val)); }
|
if (val != null) {
|
||||||
|
pagination.setStyle(String.format("-fx-page-information-visible: %s;", val));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
showPageInfoToggle.setSelected(true);
|
showPageInfoToggle.setSelected(true);
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -31,7 +32,9 @@ public class PopoverPage extends AbstractPage {
|
|||||||
public static final String NAME = "Popover";
|
public static final String NAME = "Popover";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public PopoverPage() {
|
public PopoverPage() {
|
||||||
super();
|
super();
|
||||||
@ -86,7 +89,8 @@ public class PopoverPage extends AbstractPage {
|
|||||||
|
|
||||||
var icon = new FontIcon(Feather.ALERT_TRIANGLE);
|
var icon = new FontIcon(Feather.ALERT_TRIANGLE);
|
||||||
icon.setIconSize(32); // not always works
|
icon.setIconSize(32); // not always works
|
||||||
icon.setStyle("-fx-icon-size:32px;-fx-icon-color:-color-warning-fg;-fx-fill:-color-warning-fg;" + icon.getStyle());
|
icon.setStyle(
|
||||||
|
"-fx-icon-size:32px;-fx-icon-color:-color-warning-fg;-fx-fill:-color-warning-fg;" + icon.getStyle());
|
||||||
|
|
||||||
var label = new Label(FAKER.chuckNorris().fact(), icon);
|
var label = new Label(FAKER.chuckNorris().fact(), icon);
|
||||||
label.setStyle("-fx-graphic-text-gap:10;");
|
label.setStyle("-fx-graphic-text-gap:10;");
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_CIRCLE;
|
import static atlantafx.base.theme.Styles.BUTTON_CIRCLE;
|
||||||
@ -46,7 +47,9 @@ public class ProgressPage extends AbstractPage {
|
|||||||
public static final String NAME = "Progress";
|
public static final String NAME = "Progress";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public ProgressPage() {
|
public ProgressPage() {
|
||||||
super();
|
super();
|
||||||
@ -256,7 +259,9 @@ public class ProgressPage extends AbstractPage {
|
|||||||
content.setPrefHeight(200);
|
content.setPrefHeight(200);
|
||||||
|
|
||||||
bar.progressProperty().addListener((obs, old, val) -> {
|
bar.progressProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (val.floatValue() > 0.80) {
|
if (val.floatValue() > 0.80) {
|
||||||
barStack.pseudoClassStateChanged(stateDanger, true);
|
barStack.pseudoClassStateChanged(stateDanger, true);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_VGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_VGAP;
|
||||||
@ -16,7 +17,9 @@ public class RadioButtonPage extends AbstractPage {
|
|||||||
public static final String NAME = "RadioButton";
|
public static final String NAME = "RadioButton";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public RadioButtonPage() {
|
public RadioButtonPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.sampler.page.AbstractPage;
|
import atlantafx.sampler.page.AbstractPage;
|
||||||
@ -17,7 +18,9 @@ public class ScrollPanePage extends AbstractPage {
|
|||||||
private static final int SPACING = 1;
|
private static final int SPACING = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public ScrollPanePage() {
|
public ScrollPanePage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static javafx.geometry.Orientation.HORIZONTAL;
|
import static javafx.geometry.Orientation.HORIZONTAL;
|
||||||
@ -25,7 +26,9 @@ public final class SeparatorPage extends AbstractPage {
|
|||||||
private static final int PANE_SIZE = 100;
|
private static final int PANE_SIZE = 100;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public SeparatorPage() {
|
public SeparatorPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static javafx.geometry.Orientation.VERTICAL;
|
import static javafx.geometry.Orientation.VERTICAL;
|
||||||
@ -20,7 +21,9 @@ public class SliderPage extends AbstractPage {
|
|||||||
private static final int SPACING = 20;
|
private static final int SPACING = 20;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public SliderPage() {
|
public SliderPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.base.util.IntegerStringConverter;
|
import atlantafx.base.util.IntegerStringConverter;
|
||||||
@ -14,7 +15,9 @@ public final class SpinnerPage extends AbstractPage {
|
|||||||
private static final int PREF_WIDTH = 120;
|
private static final int PREF_WIDTH = 120;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public SpinnerPage() {
|
public SpinnerPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.sampler.page.AbstractPage;
|
import atlantafx.sampler.page.AbstractPage;
|
||||||
@ -18,7 +19,9 @@ public class SplitPanePage extends AbstractPage {
|
|||||||
public static final String NAME = "SplitPane";
|
public static final String NAME = "SplitPane";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public SplitPanePage() {
|
public SplitPanePage() {
|
||||||
super();
|
super();
|
||||||
@ -68,8 +71,12 @@ public class SplitPanePage extends AbstractPage {
|
|||||||
doubleSplitPane.setOrientation(Orientation.VERTICAL);
|
doubleSplitPane.setOrientation(Orientation.VERTICAL);
|
||||||
doubleSplitPane.setDividerPositions(0.5);
|
doubleSplitPane.setDividerPositions(0.5);
|
||||||
doubleSplitPane.getItems().setAll(
|
doubleSplitPane.getItems().setAll(
|
||||||
new VBox(topSplitPane) {{ setAlignment(Pos.CENTER); }},
|
new VBox(topSplitPane) {{
|
||||||
new VBox(bottomSplitPane) {{ setAlignment(Pos.CENTER); }}
|
setAlignment(Pos.CENTER);
|
||||||
|
}},
|
||||||
|
new VBox(bottomSplitPane) {{
|
||||||
|
setAlignment(Pos.CENTER);
|
||||||
|
}}
|
||||||
);
|
);
|
||||||
doubleSplitPane.setMinSize(400, 200);
|
doubleSplitPane.setMinSize(400, 200);
|
||||||
doubleSplitPane.setMaxSize(400, 200);
|
doubleSplitPane.setMaxSize(400, 200);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.ACCENT;
|
import static atlantafx.base.theme.Styles.ACCENT;
|
||||||
@ -38,7 +39,9 @@ public class TabPanePage extends AbstractPage {
|
|||||||
private static final double TAB_MIN_HEIGHT = 60;
|
private static final double TAB_MIN_HEIGHT = 60;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private Side tabSide = Side.TOP;
|
private Side tabSide = Side.TOP;
|
||||||
private boolean fullWidth = false;
|
private boolean fullWidth = false;
|
||||||
@ -122,7 +125,9 @@ public class TabPanePage extends AbstractPage {
|
|||||||
|
|
||||||
var floatingToggle = new ToggleSwitch();
|
var floatingToggle = new ToggleSwitch();
|
||||||
floatingToggle.selectedProperty().addListener((obs, old, val) -> {
|
floatingToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { Styles.toggleStyleClass(tabs, TabPane.STYLE_CLASS_FLOATING); }
|
if (val != null) {
|
||||||
|
Styles.toggleStyleClass(tabs, TabPane.STYLE_CLASS_FLOATING);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var animatedToggle = new ToggleSwitch();
|
var animatedToggle = new ToggleSwitch();
|
||||||
@ -148,7 +153,9 @@ public class TabPanePage extends AbstractPage {
|
|||||||
|
|
||||||
var disableToggle = new ToggleSwitch();
|
var disableToggle = new ToggleSwitch();
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { tabs.setDisable(val); }
|
if (val != null) {
|
||||||
|
tabs.setDisable(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var togglesGrid = new GridPane();
|
var togglesGrid = new GridPane();
|
||||||
@ -240,7 +247,9 @@ public class TabPanePage extends AbstractPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void rotateTabs(BorderPane borderPane, TabPane tabs, Side side) {
|
private void rotateTabs(BorderPane borderPane, TabPane tabs, Side side) {
|
||||||
if (tabSide == side) { return; }
|
if (tabSide == side) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
borderPane.getChildren().removeAll(tabs);
|
borderPane.getChildren().removeAll(tabs);
|
||||||
tabSide = side;
|
tabSide = side;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BORDERED;
|
import static atlantafx.base.theme.Styles.BORDERED;
|
||||||
@ -59,7 +60,9 @@ public class TablePage extends AbstractPage {
|
|||||||
public static final String NAME = "TableView";
|
public static final String NAME = "TableView";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private TableView<Product> table;
|
private TableView<Product> table;
|
||||||
private final List<Product> dataList = IntStream.range(1, 51).boxed()
|
private final List<Product> dataList = IntStream.range(1, 51).boxed()
|
||||||
@ -161,7 +164,9 @@ public class TablePage extends AbstractPage {
|
|||||||
|
|
||||||
var disableToggle = new ToggleSwitch("Disable");
|
var disableToggle = new ToggleSwitch("Disable");
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { table.setDisable(val); }
|
if (val != null) {
|
||||||
|
table.setDisable(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var header = new HBox(
|
var header = new HBox(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.STATE_DANGER;
|
import static atlantafx.base.theme.Styles.STATE_DANGER;
|
||||||
@ -18,7 +19,9 @@ public class TextAreaPage extends AbstractPage {
|
|||||||
private static final double CONTROL_HEIGHT = 120;
|
private static final double CONTROL_HEIGHT = 120;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public TextAreaPage() {
|
public TextAreaPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.LARGE;
|
import static atlantafx.base.theme.Styles.LARGE;
|
||||||
@ -21,7 +22,9 @@ public class TextFieldPage extends AbstractPage {
|
|||||||
public static final String NAME = "TextField";
|
public static final String NAME = "TextField";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public TextFieldPage() {
|
public TextFieldPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.DENSE;
|
import static atlantafx.base.theme.Styles.DENSE;
|
||||||
@ -35,7 +36,9 @@ public class TitledPanePage extends AbstractPage {
|
|||||||
private static final String ELEVATED_PREFIX = "elevated-";
|
private static final String ELEVATED_PREFIX = "elevated-";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public TitledPanePage() {
|
public TitledPanePage() {
|
||||||
super();
|
super();
|
||||||
@ -82,9 +85,13 @@ public class TitledPanePage extends AbstractPage {
|
|||||||
playground.getStyleClass().removeAll(
|
playground.getStyleClass().removeAll(
|
||||||
playground.getStyleClass().stream().filter(c -> c.startsWith(ELEVATED_PREFIX)).toList()
|
playground.getStyleClass().stream().filter(c -> c.startsWith(ELEVATED_PREFIX)).toList()
|
||||||
);
|
);
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int level = val.intValue();
|
int level = val.intValue();
|
||||||
if (level > 0) { playground.getStyleClass().add(ELEVATED_PREFIX + level); }
|
if (level > 0) {
|
||||||
|
playground.getStyleClass().add(ELEVATED_PREFIX + level);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// NOTE:
|
// NOTE:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
||||||
@ -25,7 +26,9 @@ public class ToggleButtonPage extends AbstractPage {
|
|||||||
public static final String NAME = "ToggleButton";
|
public static final String NAME = "ToggleButton";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public ToggleButtonPage() {
|
public ToggleButtonPage() {
|
||||||
super();
|
super();
|
||||||
@ -98,7 +101,9 @@ public class ToggleButtonPage extends AbstractPage {
|
|||||||
nextBtn
|
nextBtn
|
||||||
);
|
);
|
||||||
group.selectedToggleProperty().addListener((obs, old, val) -> {
|
group.selectedToggleProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { old.setSelected(true); }
|
if (val == null) {
|
||||||
|
old.setSelected(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return new SampleBlock("Wizard", wizard);
|
return new SampleBlock("Wizard", wizard);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import atlantafx.base.controls.ToggleSwitch;
|
import atlantafx.base.controls.ToggleSwitch;
|
||||||
@ -12,7 +13,9 @@ public class ToggleSwitchPage extends AbstractPage {
|
|||||||
public static final String NAME = "ToggleSwitch";
|
public static final String NAME = "ToggleSwitch";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public ToggleSwitchPage() {
|
public ToggleSwitchPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.ACCENT;
|
import static atlantafx.base.theme.Styles.ACCENT;
|
||||||
@ -57,7 +58,9 @@ public class ToolBarPage extends AbstractPage {
|
|||||||
public static final String NAME = "ToolBar";
|
public static final String NAME = "ToolBar";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private Side toolbarPos = Side.TOP;
|
private Side toolbarPos = Side.TOP;
|
||||||
|
|
||||||
@ -149,7 +152,9 @@ public class ToolBarPage extends AbstractPage {
|
|||||||
|
|
||||||
var disableToggle = new ToggleSwitch();
|
var disableToggle = new ToggleSwitch();
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { toolbar.setDisable(val); }
|
if (val != null) {
|
||||||
|
toolbar.setDisable(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var togglesGrid = new GridPane();
|
var togglesGrid = new GridPane();
|
||||||
@ -178,13 +183,17 @@ public class ToolBarPage extends AbstractPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void rotateToolbar(BorderPane borderPane, ToolBar toolbar, Side pos) {
|
private void rotateToolbar(BorderPane borderPane, ToolBar toolbar, Side pos) {
|
||||||
if (toolbarPos == pos) { return; }
|
if (toolbarPos == pos) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var topBar = (TopBar) borderPane.getTop();
|
var topBar = (TopBar) borderPane.getTop();
|
||||||
toolbarPos = pos;
|
toolbarPos = pos;
|
||||||
|
|
||||||
boolean changed = borderPane.getChildren().removeAll(toolbar);
|
boolean changed = borderPane.getChildren().removeAll(toolbar);
|
||||||
if (!changed) { topBar.removeToolBar(); }
|
if (!changed) {
|
||||||
|
topBar.removeToolBar();
|
||||||
|
}
|
||||||
|
|
||||||
// WARNING:
|
// WARNING:
|
||||||
// Rotating existing buttons seems tempting, but it won't work.
|
// Rotating existing buttons seems tempting, but it won't work.
|
||||||
@ -270,7 +279,8 @@ public class ToolBarPage extends AbstractPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MenuItem[] createItems(int count) {
|
public static MenuItem[] createItems(int count) {
|
||||||
return IntStream.range(0, count).mapToObj(i -> new MenuItem(FAKER.babylon5().character())).toArray(MenuItem[]::new);
|
return IntStream.range(0, count).mapToObj(i -> new MenuItem(FAKER.babylon5().character()))
|
||||||
|
.toArray(MenuItem[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -23,7 +24,9 @@ public class TooltipPage extends AbstractPage {
|
|||||||
public static final String NAME = "Tooltip";
|
public static final String NAME = "Tooltip";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public TooltipPage() {
|
public TooltipPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.DENSE;
|
import static atlantafx.base.theme.Styles.DENSE;
|
||||||
@ -38,10 +39,12 @@ public class TreePage extends AbstractPage {
|
|||||||
|
|
||||||
public static final String NAME = "TreeView";
|
public static final String NAME = "TreeView";
|
||||||
private static final int MAX_TREE_DEPTH = 3;
|
private static final int MAX_TREE_DEPTH = 3;
|
||||||
private static final int[] TREE_DICE = { -1, 0, 1 };
|
private static final int[] TREE_DICE = {-1, 0, 1};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private final BorderPane treeWrapper = new BorderPane();
|
private final BorderPane treeWrapper = new BorderPane();
|
||||||
private final ComboBox<Example> exampleSelect = createExampleSelect();
|
private final ComboBox<Example> exampleSelect = createExampleSelect();
|
||||||
@ -62,7 +65,9 @@ public class TreePage extends AbstractPage {
|
|||||||
|
|
||||||
var showRootToggle = new ToggleSwitch("Show root");
|
var showRootToggle = new ToggleSwitch("Show root");
|
||||||
showRootToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedTree().ifPresent(tv -> {
|
showRootToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedTree().ifPresent(tv -> {
|
||||||
if (val != null) { tv.setShowRoot(val); }
|
if (val != null) {
|
||||||
|
tv.setShowRoot(val);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
showRootToggle.setSelected(true);
|
showRootToggle.setSelected(true);
|
||||||
|
|
||||||
@ -78,7 +83,9 @@ public class TreePage extends AbstractPage {
|
|||||||
|
|
||||||
var disableToggle = new ToggleSwitch("Disable");
|
var disableToggle = new ToggleSwitch("Disable");
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedTree().ifPresent(tv -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> findDisplayedTree().ifPresent(tv -> {
|
||||||
if (val != null) { tv.setDisable(val); }
|
if (val != null) {
|
||||||
|
tv.setDisable(val);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var controls = new HBox(BLOCK_HGAP, denseToggle, showRootToggle, altIconToggle, edge2edgeToggle);
|
var controls = new HBox(BLOCK_HGAP, denseToggle, showRootToggle, altIconToggle, edge2edgeToggle);
|
||||||
@ -103,7 +110,9 @@ public class TreePage extends AbstractPage {
|
|||||||
select.setMaxWidth(Double.MAX_VALUE);
|
select.setMaxWidth(Double.MAX_VALUE);
|
||||||
select.getItems().setAll(Example.values());
|
select.getItems().setAll(Example.values());
|
||||||
select.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
select.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TreeView<String> newTree = createTree(val);
|
TreeView<String> newTree = createTree(val);
|
||||||
|
|
||||||
@ -148,18 +157,32 @@ public class TreePage extends AbstractPage {
|
|||||||
|
|
||||||
private TreeView<String> createTree(Example example) {
|
private TreeView<String> createTree(Example example) {
|
||||||
switch (example) {
|
switch (example) {
|
||||||
case TEXT -> { return stringTree(); }
|
case TEXT -> {
|
||||||
case GRAPHIC -> { return graphicTree(); }
|
return stringTree();
|
||||||
case EDITABLE -> { return editableTree(); }
|
}
|
||||||
case CHECK_BOX -> { return checkBoxTree(); }
|
case GRAPHIC -> {
|
||||||
case CHOICE_BOX -> { return choiceBoxTree(); }
|
return graphicTree();
|
||||||
case COMBO_BOX -> { return comboBoxTree(); }
|
}
|
||||||
|
case EDITABLE -> {
|
||||||
|
return editableTree();
|
||||||
|
}
|
||||||
|
case CHECK_BOX -> {
|
||||||
|
return checkBoxTree();
|
||||||
|
}
|
||||||
|
case CHOICE_BOX -> {
|
||||||
|
return choiceBoxTree();
|
||||||
|
}
|
||||||
|
case COMBO_BOX -> {
|
||||||
|
return comboBoxTree();
|
||||||
|
}
|
||||||
default -> throw new IllegalArgumentException("Unexpected enum value: " + example);
|
default -> throw new IllegalArgumentException("Unexpected enum value: " + example);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void generateTree(TreeItem<T> parent, Supplier<TreeItem<T>> supplier, int limit, int depth) {
|
private <T> void generateTree(TreeItem<T> parent, Supplier<TreeItem<T>> supplier, int limit, int depth) {
|
||||||
if (limit == 0) { return; }
|
if (limit == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var item = supplier.get();
|
var item = supplier.get();
|
||||||
parent.getChildren().add(item);
|
parent.getChildren().add(item);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.components;
|
package atlantafx.sampler.page.components;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BORDERED;
|
import static atlantafx.base.theme.Styles.BORDERED;
|
||||||
@ -50,7 +51,9 @@ public class TreeTablePage extends AbstractPage {
|
|||||||
public static final String NAME = "TreeTableView";
|
public static final String NAME = "TreeTableView";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
private TreeTableView<Product> treeTable;
|
private TreeTableView<Product> treeTable;
|
||||||
|
|
||||||
@ -143,7 +146,9 @@ public class TreeTablePage extends AbstractPage {
|
|||||||
|
|
||||||
var disableToggle = new ToggleSwitch("Disable");
|
var disableToggle = new ToggleSwitch("Disable");
|
||||||
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
disableToggle.selectedProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { treeTable.setDisable(val); }
|
if (val != null) {
|
||||||
|
treeTable.setDisable(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var header = new HBox(
|
var header = new HBox(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.sampler.util.Controls.hyperlink;
|
import static atlantafx.sampler.util.Controls.hyperlink;
|
||||||
@ -49,7 +50,8 @@ class ColorPalette extends VBox {
|
|||||||
noteText.getChildren().setAll(
|
noteText.getChildren().setAll(
|
||||||
new TextFlow(
|
new TextFlow(
|
||||||
new Text("Color contrast between text and its background must meet "),
|
new Text("Color contrast between text and its background must meet "),
|
||||||
hyperlink("required WCAG standards",
|
hyperlink(
|
||||||
|
"required WCAG standards",
|
||||||
URI.create("https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html")
|
URI.create("https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html")
|
||||||
),
|
),
|
||||||
new Text(":")
|
new Text(":")
|
||||||
@ -86,7 +88,9 @@ class ColorPalette extends VBox {
|
|||||||
grid.add(colorBlock("-color-fg-default", "-color-accent-muted", "-color-accent-emphasis"), 2, 1);
|
grid.add(colorBlock("-color-fg-default", "-color-accent-muted", "-color-accent-emphasis"), 2, 1);
|
||||||
grid.add(colorBlock("-color-accent-fg", "-color-accent-subtle", "-color-accent-emphasis"), 3, 1);
|
grid.add(colorBlock("-color-accent-fg", "-color-accent-subtle", "-color-accent-emphasis"), 3, 1);
|
||||||
|
|
||||||
grid.add(colorBlock("-color-fg-emphasis", "-color-neutral-emphasis-plus", "-color-neutral-emphasis-plus"), 0, 2);
|
grid.add(
|
||||||
|
colorBlock("-color-fg-emphasis", "-color-neutral-emphasis-plus", "-color-neutral-emphasis-plus"), 0, 2
|
||||||
|
);
|
||||||
grid.add(colorBlock("-color-fg-emphasis", "-color-neutral-emphasis", "-color-neutral-emphasis"), 1, 2);
|
grid.add(colorBlock("-color-fg-emphasis", "-color-neutral-emphasis", "-color-neutral-emphasis"), 1, 2);
|
||||||
grid.add(colorBlock("-color-fg-default", "-color-neutral-muted", "-color-neutral-emphasis"), 2, 2);
|
grid.add(colorBlock("-color-fg-default", "-color-neutral-muted", "-color-neutral-emphasis"), 2, 2);
|
||||||
grid.add(colorBlock("-color-fg-default", "-color-neutral-subtle", "-color-neutral-emphasis"), 3, 2);
|
grid.add(colorBlock("-color-fg-default", "-color-neutral-subtle", "-color-neutral-emphasis"), 3, 2);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.base.theme.Styles.TITLE_3;
|
import static atlantafx.base.theme.Styles.TITLE_3;
|
||||||
@ -116,7 +117,9 @@ class ColorPaletteBlock extends VBox {
|
|||||||
colorRectangle.pseudoClassStateChanged(PASSED, ContrastLevel.AA_NORMAL.satisfies(contrastRatio));
|
colorRectangle.pseudoClassStateChanged(PASSED, ContrastLevel.AA_NORMAL.satisfies(contrastRatio));
|
||||||
|
|
||||||
contrastRatioText.setText(String.format("%.2f", contrastRatio));
|
contrastRatioText.setText(String.format("%.2f", contrastRatio));
|
||||||
contrastLevelIcon.setIconCode(ContrastLevel.AA_NORMAL.satisfies(contrastRatio) ? Material2AL.CHECK : Material2AL.CLOSE);
|
contrastLevelIcon.setIconCode(
|
||||||
|
ContrastLevel.AA_NORMAL.satisfies(contrastRatio) ? Material2AL.CHECK : Material2AL.CLOSE
|
||||||
|
);
|
||||||
contrastLevelLabel.setVisible(true);
|
contrastLevelLabel.setVisible(true);
|
||||||
contrastLevelLabel.setText(ContrastLevel.AAA_NORMAL.satisfies(contrastRatio) ? "AAA" : "AA");
|
contrastLevelLabel.setText(ContrastLevel.AAA_NORMAL.satisfies(contrastRatio) ? "AAA" : "AA");
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import atlantafx.base.theme.Styles;
|
import atlantafx.base.theme.Styles;
|
||||||
@ -44,7 +45,9 @@ class ColorScale extends VBox {
|
|||||||
headerBox.getStyleClass().add("header");
|
headerBox.getStyleClass().add("header");
|
||||||
|
|
||||||
var noteText = new TextFlow(
|
var noteText = new TextFlow(
|
||||||
new Text("Avoid referencing scale variables directly when building UI that needs to adapt to different color themes. Instead, use the functional variables listed above.")
|
new Text(
|
||||||
|
"Avoid referencing scale variables directly when building UI that needs to adapt to different color themes. Instead, use the functional variables listed above."
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
backgroundProperty().addListener((obs, old, val) -> bgBaseColor.set(
|
backgroundProperty().addListener((obs, old, val) -> bgBaseColor.set(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.sampler.util.ContrastLevel.getColorLuminance;
|
import static atlantafx.sampler.util.ContrastLevel.getColorLuminance;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.general.ColorPaletteBlock.validateColorName;
|
import static atlantafx.sampler.page.general.ColorPaletteBlock.validateColorName;
|
||||||
@ -96,22 +97,35 @@ class ContrastChecker extends GridPane {
|
|||||||
setForeground(fgColor);
|
setForeground(fgColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBgColorName() { return bgColorName; }
|
public String getBgColorName() {
|
||||||
|
return bgColorName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFgColorName() { return fgColorName; }
|
public String getFgColorName() {
|
||||||
|
return fgColorName;
|
||||||
|
}
|
||||||
|
|
||||||
public Color getBgColor() { return bgColor.colorProperty().get(); }
|
public Color getBgColor() {
|
||||||
|
return bgColor.colorProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
public Color getFgColor() { return fgColor.colorProperty().get(); }
|
public Color getFgColor() {
|
||||||
|
return fgColor.colorProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
public ReadOnlyObjectProperty<Color> bgColorProperty() { return bgColor.colorProperty(); }
|
public ReadOnlyObjectProperty<Color> bgColorProperty() {
|
||||||
|
return bgColor.colorProperty();
|
||||||
|
}
|
||||||
|
|
||||||
public ReadOnlyObjectProperty<Color> fgColorProperty() { return fgColor.colorProperty(); }
|
public ReadOnlyObjectProperty<Color> fgColorProperty() {
|
||||||
|
return fgColor.colorProperty();
|
||||||
|
}
|
||||||
|
|
||||||
// Returns fg color that guaranteed to be visible on the current bg.
|
// Returns fg color that guaranteed to be visible on the current bg.
|
||||||
public Color getSafeFgColor() {
|
public Color getSafeFgColor() {
|
||||||
if (contrastRatio.get() <= CONTRAST_RATIO_THRESHOLD) {
|
if (contrastRatio.get() <= CONTRAST_RATIO_THRESHOLD) {
|
||||||
return getColorLuminance(flattenColor(bgBaseColor.get(), bgColor.getColor())) < LUMINANCE_THRESHOLD ? Color.WHITE : Color.BLACK;
|
return getColorLuminance(flattenColor(bgBaseColor.get(), bgColor.getColor())) < LUMINANCE_THRESHOLD ?
|
||||||
|
Color.WHITE : Color.BLACK;
|
||||||
} else {
|
} else {
|
||||||
return fgColor.getColor();
|
return fgColor.getColor();
|
||||||
}
|
}
|
||||||
@ -148,7 +162,9 @@ class ContrastChecker extends GridPane {
|
|||||||
var contrastLevels = new HBox(20, aaNormalBox, aaLargeBox, aaaNormalBox, aaaLargeBox);
|
var contrastLevels = new HBox(20, aaNormalBox, aaLargeBox, aaaNormalBox, aaaLargeBox);
|
||||||
|
|
||||||
contrastRatio.addListener((obs, old, val) -> {
|
contrastRatio.addListener((obs, old, val) -> {
|
||||||
if (val == null) { return; }
|
if (val == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
float ratio = val.floatValue();
|
float ratio = val.floatValue();
|
||||||
updateContrastLevelLabel(aaNormalLabel, ContrastLevel.AA_NORMAL.satisfies(ratio));
|
updateContrastLevelLabel(aaNormalLabel, ContrastLevel.AA_NORMAL.satisfies(ratio));
|
||||||
updateContrastLevelLabel(aaLargeLabel, ContrastLevel.AA_LARGE.satisfies(ratio));
|
updateContrastLevelLabel(aaLargeLabel, ContrastLevel.AA_LARGE.satisfies(ratio));
|
||||||
@ -184,7 +200,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
bgHueSlider = slider(1, 360, 1, 1);
|
bgHueSlider = slider(1, 360, 1, 1);
|
||||||
bgHueSlider.valueProperty().addListener((obs, old, val) -> {
|
bgHueSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { bgColor.setHue(val.floatValue()); }
|
if (val != null) {
|
||||||
|
bgColor.setHue(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var bgHueLabel = new Label("Hue °");
|
var bgHueLabel = new Label("Hue °");
|
||||||
bgHueLabel.textProperty().bind(Bindings.createStringBinding(
|
bgHueLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -193,7 +211,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
bgSaturationSlider = slider(0, 1, 0, 0.01);
|
bgSaturationSlider = slider(0, 1, 0, 0.01);
|
||||||
bgSaturationSlider.valueProperty().addListener((obs, old, val) -> {
|
bgSaturationSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { bgColor.setSaturation(val.floatValue()); }
|
if (val != null) {
|
||||||
|
bgColor.setSaturation(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var bgSaturationLabel = new Label("Saturation");
|
var bgSaturationLabel = new Label("Saturation");
|
||||||
bgSaturationLabel.textProperty().bind(Bindings.createStringBinding(
|
bgSaturationLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -202,7 +222,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
bgLightnessSlider = slider(0, 1, 0, 0.01);
|
bgLightnessSlider = slider(0, 1, 0, 0.01);
|
||||||
bgLightnessSlider.valueProperty().addListener((obs, old, val) -> {
|
bgLightnessSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { bgColor.setLightness(val.floatValue()); }
|
if (val != null) {
|
||||||
|
bgColor.setLightness(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var bgLightnessLabel = new Label("Lightness");
|
var bgLightnessLabel = new Label("Lightness");
|
||||||
bgLightnessLabel.textProperty().bind(Bindings.createStringBinding(
|
bgLightnessLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -211,7 +233,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
bgAlphaSlider = slider(0, 1, 0, 0.01);
|
bgAlphaSlider = slider(0, 1, 0, 0.01);
|
||||||
bgAlphaSlider.valueProperty().addListener((obs, old, val) -> {
|
bgAlphaSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { bgColor.setAlpha(val.floatValue()); }
|
if (val != null) {
|
||||||
|
bgColor.setAlpha(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var bgAlphaLabel = new Label("Alpha");
|
var bgAlphaLabel = new Label("Alpha");
|
||||||
bgAlphaLabel.textProperty().bind(Bindings.createStringBinding(
|
bgAlphaLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -222,7 +246,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
fgHueSlider = slider(1, 360, 1, 1);
|
fgHueSlider = slider(1, 360, 1, 1);
|
||||||
fgHueSlider.valueProperty().addListener((obs, old, val) -> {
|
fgHueSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { fgColor.setHue(val.floatValue()); }
|
if (val != null) {
|
||||||
|
fgColor.setHue(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var fgHueLabel = new Label("Hue °");
|
var fgHueLabel = new Label("Hue °");
|
||||||
fgHueLabel.textProperty().bind(Bindings.createStringBinding(
|
fgHueLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -231,7 +257,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
fgSaturationSlider = slider(0, 1, 0, 0.01);
|
fgSaturationSlider = slider(0, 1, 0, 0.01);
|
||||||
fgSaturationSlider.valueProperty().addListener((obs, old, val) -> {
|
fgSaturationSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { fgColor.setSaturation(val.floatValue()); }
|
if (val != null) {
|
||||||
|
fgColor.setSaturation(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var fgSaturationLabel = new Label("Saturation");
|
var fgSaturationLabel = new Label("Saturation");
|
||||||
fgSaturationLabel.textProperty().bind(Bindings.createStringBinding(
|
fgSaturationLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -240,7 +268,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
fgLightnessSlider = slider(0, 1, 0, 0.01);
|
fgLightnessSlider = slider(0, 1, 0, 0.01);
|
||||||
fgLightnessSlider.valueProperty().addListener((obs, old, val) -> {
|
fgLightnessSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { fgColor.setLightness(val.floatValue()); }
|
if (val != null) {
|
||||||
|
fgColor.setLightness(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var fgLightnessLabel = new Label("Lightness");
|
var fgLightnessLabel = new Label("Lightness");
|
||||||
fgLightnessLabel.textProperty().bind(Bindings.createStringBinding(
|
fgLightnessLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -249,7 +279,9 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
fgAlphaSlider = slider(0, 1, 0, 0.01);
|
fgAlphaSlider = slider(0, 1, 0, 0.01);
|
||||||
fgAlphaSlider.valueProperty().addListener((obs, old, val) -> {
|
fgAlphaSlider.valueProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { fgColor.setAlpha(val.floatValue()); }
|
if (val != null) {
|
||||||
|
fgColor.setAlpha(val.floatValue());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
var fgAlphaLabel = new Label("Alpha");
|
var fgAlphaLabel = new Label("Alpha");
|
||||||
fgAlphaLabel.textProperty().bind(Bindings.createStringBinding(
|
fgAlphaLabel.textProperty().bind(Bindings.createStringBinding(
|
||||||
@ -312,11 +344,15 @@ class ContrastChecker extends GridPane {
|
|||||||
add(fgAlphaSlider, 1, 11);
|
add(fgAlphaSlider, 1, 11);
|
||||||
|
|
||||||
bgColor.colorProperty().addListener((obs, old, val) -> {
|
bgColor.colorProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { updateStyle(); }
|
if (val != null) {
|
||||||
|
updateStyle();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fgColor.colorProperty().addListener((obs, old, val) -> {
|
fgColor.colorProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null) { updateStyle(); }
|
if (val != null) {
|
||||||
|
updateStyle();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +421,8 @@ class ContrastChecker extends GridPane {
|
|||||||
private static class ObservableHSLAColor {
|
private static class ObservableHSLAColor {
|
||||||
|
|
||||||
private final ObservableList<Float> values = FXCollections.observableArrayList(0f, 0f, 0f, 0f);
|
private final ObservableList<Float> values = FXCollections.observableArrayList(0f, 0f, 0f, 0f);
|
||||||
private final ReadOnlyObjectWrapper<Color> color = new ReadOnlyObjectWrapper<>() { };
|
private final ReadOnlyObjectWrapper<Color> color = new ReadOnlyObjectWrapper<>() {
|
||||||
|
};
|
||||||
|
|
||||||
public ObservableHSLAColor(Color initialColor) {
|
public ObservableHSLAColor(Color initialColor) {
|
||||||
values.addListener((ListChangeListener<Float>) c -> {
|
values.addListener((ListChangeListener<Float>) c -> {
|
||||||
@ -441,7 +478,7 @@ class ContrastChecker extends GridPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float[] getRGBAArithmeticColor() {
|
public float[] getRGBAArithmeticColor() {
|
||||||
float[] hsl = new float[] { getHue(), getSaturation(), getLightness() };
|
float[] hsl = new float[] {getHue(), getSaturation(), getLightness()};
|
||||||
var color = JColor.color(hsl, getAlpha());
|
var color = JColor.color(hsl, getAlpha());
|
||||||
return new float[] {
|
return new float[] {
|
||||||
color.getRedArithmetic(),
|
color.getRedArithmetic(),
|
||||||
@ -452,7 +489,7 @@ class ContrastChecker extends GridPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getColorHexWithAlpha() {
|
public String getColorHexWithAlpha() {
|
||||||
float[] hsl = new float[] { getHue(), getSaturation(), getLightness() };
|
float[] hsl = new float[] {getHue(), getSaturation(), getLightness()};
|
||||||
return JColor.color(hsl, getAlpha()).getColorHexWithAlpha();
|
return JColor.color(hsl, getAlpha()).getColorHexWithAlpha();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,7 +509,8 @@ class ContrastChecker extends GridPane {
|
|||||||
private void createMenu() {
|
private void createMenu() {
|
||||||
var hexItem = new MenuItem("Copy as HEX");
|
var hexItem = new MenuItem("Copy as HEX");
|
||||||
hexItem.setOnAction(e -> {
|
hexItem.setOnAction(e -> {
|
||||||
var c = JColor.color(new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
|
var c = JColor.color(
|
||||||
|
new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
|
||||||
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
|
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
|
||||||
toHexWithAlpha(color.getColor()) :
|
toHexWithAlpha(color.getColor()) :
|
||||||
c.getColorHex()
|
c.getColorHex()
|
||||||
@ -481,18 +519,22 @@ class ContrastChecker extends GridPane {
|
|||||||
|
|
||||||
var rgbItem = new MenuItem("Copy as RGB");
|
var rgbItem = new MenuItem("Copy as RGB");
|
||||||
rgbItem.setOnAction(e -> {
|
rgbItem.setOnAction(e -> {
|
||||||
var c = JColor.color(new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
|
var c = JColor.color(
|
||||||
|
new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
|
||||||
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
|
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
|
||||||
String.format("rgba(%d,%d,%d, %.1f)", c.getGreen(), c.getGreen(), c.getBlue(), c.getAlphaArithmetic()) :
|
String.format("rgba(%d,%d,%d, %.1f)", c.getGreen(), c.getGreen(), c.getBlue(),
|
||||||
|
c.getAlphaArithmetic()) :
|
||||||
String.format("rgb(%d,%d,%d)", c.getGreen(), c.getGreen(), c.getBlue())
|
String.format("rgb(%d,%d,%d)", c.getGreen(), c.getGreen(), c.getBlue())
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
var hslItem = new MenuItem("Copy as HSL");
|
var hslItem = new MenuItem("Copy as HSL");
|
||||||
hslItem.setOnAction(e -> {
|
hslItem.setOnAction(e -> {
|
||||||
var c = JColor.color(new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
|
var c = JColor.color(
|
||||||
|
new float[] {color.getHue(), color.getSaturation(), color.getLightness(), color.getAlpha()});
|
||||||
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
|
PlatformUtils.copyToClipboard(color.getAlpha() < 1 ?
|
||||||
String.format("hsla(%.0f,%.2f,%.2f, %.1f)", c.getHue(), c.getSaturation(), c.getLightness(), c.getAlphaArithmetic()) :
|
String.format("hsla(%.0f,%.2f,%.2f, %.1f)", c.getHue(), c.getSaturation(), c.getLightness(),
|
||||||
|
c.getAlphaArithmetic()) :
|
||||||
String.format("hsl(%.0f,%.2f,%.2f)", c.getHue(), c.getSaturation(), c.getLightness())
|
String.format("hsl(%.0f,%.2f,%.2f)", c.getHue(), c.getSaturation(), c.getLightness())
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import atlantafx.sampler.page.OverlayDialog;
|
import atlantafx.sampler.page.OverlayDialog;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
import static atlantafx.sampler.page.SampleBlock.BLOCK_HGAP;
|
||||||
@ -32,7 +33,9 @@ public class IconsPage extends AbstractPage {
|
|||||||
public static final String NAME = "Icons";
|
public static final String NAME = "Icons";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
public IconsPage() {
|
public IconsPage() {
|
||||||
super();
|
super();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: MIT */
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
|
||||||
package atlantafx.sampler.page.general;
|
package atlantafx.sampler.page.general;
|
||||||
|
|
||||||
import static atlantafx.sampler.event.ThemeEvent.EventType.COLOR_CHANGE;
|
import static atlantafx.sampler.event.ThemeEvent.EventType.COLOR_CHANGE;
|
||||||
@ -59,13 +60,19 @@ public class ThemePage extends AbstractPage {
|
|||||||
private ContrastCheckerDialog contrastCheckerDialog;
|
private ContrastCheckerDialog contrastCheckerDialog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return NAME; }
|
public String getName() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDisplaySourceCode() { return false; }
|
public boolean canDisplaySourceCode() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canChangeThemeSettings() { return false; }
|
public boolean canChangeThemeSettings() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public ThemePage() {
|
public ThemePage() {
|
||||||
super();
|
super();
|
||||||
@ -94,7 +101,8 @@ public class ThemePage extends AbstractPage {
|
|||||||
private void createView() {
|
private void createView() {
|
||||||
var noteText = new TextFlow(
|
var noteText = new TextFlow(
|
||||||
new Text("AtlantaFX follows "),
|
new Text("AtlantaFX follows "),
|
||||||
hyperlink("Github Primer interface guidelines", URI.create("https://primer.style/design/foundations/color")),
|
hyperlink("Github Primer interface guidelines",
|
||||||
|
URI.create("https://primer.style/design/foundations/color")),
|
||||||
new Text(" and color system.")
|
new Text(" and color system.")
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -141,7 +149,9 @@ public class ThemePage extends AbstractPage {
|
|||||||
var selector = new ChoiceBox<SamplerTheme>();
|
var selector = new ChoiceBox<SamplerTheme>();
|
||||||
selector.getItems().setAll(TM.getRepository().getAll());
|
selector.getItems().setAll(TM.getRepository().getAll());
|
||||||
selector.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
selector.getSelectionModel().selectedItemProperty().addListener((obs, old, val) -> {
|
||||||
if (val != null && getScene() != null) { TM.setTheme(val); }
|
if (val != null && getScene() != null) {
|
||||||
|
TM.setTheme(val);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
selector.setPrefWidth(250);
|
selector.setPrefWidth(250);
|
||||||
|
|
||||||
@ -164,7 +174,9 @@ public class ThemePage extends AbstractPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void selectCurrentTheme() {
|
private void selectCurrentTheme() {
|
||||||
if (TM.getTheme() == null) { return; }
|
if (TM.getTheme() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
themeSelector.getItems().stream()
|
themeSelector.getItems().stream()
|
||||||
.filter(t -> Objects.equals(TM.getTheme().getName(), t.getName()))
|
.filter(t -> Objects.equals(TM.getTheme().getName(), t.getName()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user