Skip to content

Commit

Permalink
🔖 Version 11.9.3
Browse files Browse the repository at this point in the history
⬆️ Bump JavaFX to v19.0.2
⬆️ Bump MFXCore to v11.3.1

Signed-off-by: palexdev <alessandro.parisi406@gmail.com>
  • Loading branch information
palexdev committed Apr 11, 2023
1 parent d53c78b commit da77d37
Show file tree
Hide file tree
Showing 9 changed files with 367 additions and 362 deletions.
15 changes: 3 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- **Removed** for now removed features.
- **Fixed** for any bug fixes.

## [11.9.1] - 08-04-2023

## Added

- Added MFXEffects as animations were moved from core to this
## [11.9.3] - 11-04-2023

## Changed

- Upgrade MFXCore to version 11.3.0 to avoid conflicts with older versions in which the module was still called "
MFXCore" (changed to "mfx.core")
- Upgrade MFXResources to version 11.3.2

## Fixed

- GridRow: typo, rIndex must be oIndex when processing reusable cells (thanks to Alexander-Ploskin #11)
- Bump JavaFX to v19.0.2
- Bump MFXCore to v11.3.1

## [11.9.2] - 08-04-2023

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ repositories {
}
dependencies {
implementation 'io.github.palexdev:virtualizedfx:11.9.2'
implementation 'io.github.palexdev:virtualizedfx:11.9.3'
}
```

Expand All @@ -138,7 +138,7 @@ dependencies {
<dependency>
<groupId>io.github.palexdev</groupId>
<artifactId>virtualizedfx</artifactId>
<version>11.9.2</version>
<version>11.9.3</version>
</dependency>
```

Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#--------------------------------------#
GROUP=io.github.palexdev
POM_ARTIFACT_ID=virtualizedfx
VERSION_NAME=11.9.2
VERSION_NAME=11.9.3

POM_NAME=virtualizedfx
POM_DESCRIPTION=Alternative VirtualFlows for JavaFX
Expand All @@ -25,7 +25,7 @@ POM_PACKAGING=jar
#--------------------------------------#
# Versions #
#--------------------------------------#
virtualizedfxVersion=11.9.2
virtualizedfxVersion=11.9.3
jdk=11
testJdk=17
# Plugins
Expand All @@ -34,8 +34,8 @@ mavenPublishPlugin=0.19.0
bndPlugin=6.2.0
modularityPlugin=1.8.10
# Dependencies
jfx=19
mfxcore=11.3.0
jfx=19.0.2
mfxcore=11.3.1
mfxeffects=11.0.5
mfxresources=11.3.3
# Test Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.Region;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
* Default skin implementation for {@link MFXScrollBar}.
* <p></p>
Expand All @@ -50,6 +54,8 @@ public class MFXScrollBarSkin extends SkinBase<MFXScrollBar> {
private static final PseudoClass HORIZONTAL_PSEUDO_CLASS = PseudoClass.getPseudoClass("horizontal");
private static final PseudoClass FOCUS_WITHIN_PSEUDO_CLASS = PseudoClass.getPseudoClass("focus-within");

protected final List<When<?>> whens = new ArrayList<>();

//================================================================================
// Constructors
//================================================================================
Expand All @@ -62,21 +68,21 @@ public MFXScrollBarSkin(MFXScrollBar scrollBar) {
thumb.getStyleClass().add("thumb");

decIcon = IconWrapperBuilder.build()
.setIcon(IconBuilder.build().get())
.enableRippleGenerator(true)
.addStyleClasses("decrement-icon")
.get();
.setIcon(IconBuilder.build().get())
.enableRippleGenerator(true)
.addStyleClasses("decrement-icon")
.get();
incIcon = IconWrapperBuilder.build()
.setIcon(IconBuilder.build().get())
.enableRippleGenerator(true)
.addStyleClasses("increment-icon")
.get();
.setIcon(IconBuilder.build().get())
.enableRippleGenerator(true)
.addStyleClasses("increment-icon")
.get();

thumbPos = DoubleBindingBuilder.build()
.setMapper(() -> valToPos(scrollBar.getValue()))
.addSources(scrollBar.valueProperty())
.addSources(thumb.widthProperty(), thumb.heightProperty())
.get();
.setMapper(() -> valToPos(scrollBar.getValue()))
.addSources(scrollBar.valueProperty())
.addSources(thumb.widthProperty(), thumb.heightProperty())
.get();


onOrientationChange();
Expand Down Expand Up @@ -119,43 +125,48 @@ private void addListeners() {
sb.minProperty().addListener(reLayout);
sb.maxProperty().addListener(reLayout);
sb.visibleAmountProperty().addListener(reLayout);
sb.buttonsGapProperty().addListener(reLayout);

((DoubleProperty) sb.thumbPosProperty()).bind(thumbPos);
((DoubleProperty) sb.trackLengthProperty()).bind(
DoubleBindingBuilder.build()
.setMapper(() -> (sb.getOrientation() == Orientation.VERTICAL) ? track.getHeight() : track.getWidth())
.addSources(track.widthProperty(), track.heightProperty())
.addSources(sb.orientationProperty())
.get()
DoubleBindingBuilder.build()
.setMapper(() -> (sb.getOrientation() == Orientation.VERTICAL) ? track.getHeight() : track.getWidth())
.addSources(track.widthProperty(), track.heightProperty())
.addSources(sb.orientationProperty())
.get()
);

sb.visibleProperty().bind(BooleanBindingBuilder.build()
.setMapper(() -> sb.getVisibleAmount() < 1.0)
.addSources(sb.visibleAmountProperty())
.get()
.setMapper(() -> sb.getVisibleAmount() < 1.0)
.addSources(sb.visibleAmountProperty())
.get()
);

sb.buttonsVisibleProperty().addListener(invalidated -> {
updateChildren();
thumbPos.invalidate();
sb.requestLayout();
});
sb.buttonsGapProperty().addListener(reLayout);

sb.orientationProperty().addListener(invalidated -> {
onOrientationChange();
sb.requestLayout();
});

sb.behaviorProperty().addListener(invalidated -> initBehavior());

decIcon.focusedProperty().addListener((observable, oldValue, newValue) -> pseudoClassStateChanged(FOCUS_WITHIN_PSEUDO_CLASS, newValue));
incIcon.focusedProperty().addListener((observable, oldValue, newValue) -> pseudoClassStateChanged(FOCUS_WITHIN_PSEUDO_CLASS, newValue));

// Register Whens
Collections.addAll(whens,
When.onInvalidated(sb.buttonsVisibleProperty())
.then(v -> {
updateChildren();
thumbPos.invalidate();
sb.requestLayout();
}).listen(),
When.onInvalidated(sb.orientationProperty())
.then(v -> {
onOrientationChange();
sb.requestLayout();
}).listen(),
When.onInvalidated(sb.behaviorProperty())
.then(v -> initBehavior()).listen(),
When.onChanged(decIcon.focusedProperty())
.then((o, n) -> pseudoClassStateChanged(FOCUS_WITHIN_PSEUDO_CLASS, n)).listen(),
When.onChanged(incIcon.focusedProperty())
.then((o, n) -> pseudoClassStateChanged(FOCUS_WITHIN_PSEUDO_CLASS, n)).listen()
);
When.onChanged(track.layoutBoundsProperty())
.condition((oldValue, newValue) -> newValue.getWidth() > 0 && newValue.getHeight() > 0)
.then((oldValue, newValue) -> thumbPos.invalidate())
.oneShot()
.listen();
.condition((oldValue, newValue) -> newValue.getWidth() > 0 && newValue.getHeight() > 0)
.then((oldValue, newValue) -> thumbPos.invalidate())
.oneShot()
.listen();
}

/**
Expand Down Expand Up @@ -187,11 +198,11 @@ private void initBehavior() {
barPressed = true;
Point2D toTrack = track.parentToLocal(me.getX(), me.getY());
MouseEvent nme = new MouseEvent(
null, track, MouseEvent.MOUSE_PRESSED,
toTrack.getX(), toTrack.getY(), 0, 0,
MouseButton.PRIMARY, 1,
false, false, false, false, true,
false, false, false, false, false, null
null, track, MouseEvent.MOUSE_PRESSED,
toTrack.getX(), toTrack.getY(), 0, 0,
MouseButton.PRIMARY, 1,
false, false, false, false, true,
false, false, false, false, false, null
);
Event.fireEvent(track, nme);
me.consume();
Expand Down Expand Up @@ -268,9 +279,9 @@ private double valToPos(double val) {
double max = sb.getMax();
assert val >= min && val <= max;
return NumberUtils.mapOneRangeToAnother(
val,
DoubleRange.of(min, max),
DoubleRange.of(0.0, trackLength - thumbLength)
val,
DoubleRange.of(min, max),
DoubleRange.of(0.0, trackLength - thumbLength)
);
}

Expand Down Expand Up @@ -330,8 +341,8 @@ protected double computeMinWidth(double height, double topInset, double rightIns
boolean buttonsVisible = sb.isButtonsVisible();
double buttonsGap = buttonsVisible ? sb.getButtonsGap() : 0.0;
return (o == Orientation.VERTICAL) ?
getLength(Orientation.VERTICAL) :
leftInset + decIcon.getSize() + minTrackLength(Orientation.HORIZONTAL) + incIcon.getSize() + rightInset + (buttonsGap * 2);
getLength(Orientation.VERTICAL) :
leftInset + decIcon.getSize() + minTrackLength(Orientation.HORIZONTAL) + incIcon.getSize() + rightInset + (buttonsGap * 2);
}

@Override
Expand All @@ -341,8 +352,8 @@ protected double computeMinHeight(double width, double topInset, double rightIns
boolean buttonsVisible = sb.isButtonsVisible();
double buttonsGap = buttonsVisible ? sb.getButtonsGap() : 0.0;
return (o == Orientation.VERTICAL) ?
topInset + decIcon.getSize() + minTrackLength(Orientation.VERTICAL) + incIcon.getSize() + bottomInset + (buttonsGap * 2) :
getLength(Orientation.HORIZONTAL);
topInset + decIcon.getSize() + minTrackLength(Orientation.VERTICAL) + incIcon.getSize() + bottomInset + (buttonsGap * 2) :
getLength(Orientation.HORIZONTAL);
}

@Override
Expand All @@ -352,8 +363,8 @@ protected double computePrefWidth(double height, double topInset, double rightIn
boolean buttonsVisible = sb.isButtonsVisible();
double buttonsGap = buttonsVisible ? sb.getButtonsGap() : 0.0;
return (o == Orientation.VERTICAL) ?
getLength(Orientation.VERTICAL) :
leftInset + DEFAULT_LENGTH + rightInset + (buttonsGap * 2);
getLength(Orientation.VERTICAL) :
leftInset + DEFAULT_LENGTH + rightInset + (buttonsGap * 2);
}

@Override
Expand All @@ -363,24 +374,24 @@ protected double computePrefHeight(double width, double topInset, double rightIn
boolean buttonsVisible = sb.isButtonsVisible();
double buttonsGap = buttonsVisible ? sb.getButtonsGap() : 0.0;
return (o == Orientation.VERTICAL) ?
topInset + DEFAULT_LENGTH + bottomInset + (buttonsGap * 2) :
getLength(Orientation.HORIZONTAL);
topInset + DEFAULT_LENGTH + bottomInset + (buttonsGap * 2) :
getLength(Orientation.HORIZONTAL);
}

@Override
protected double computeMaxWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
MFXScrollBar scrollBar = getSkinnable();
return (scrollBar.getOrientation() == Orientation.VERTICAL) ?
scrollBar.prefWidth(-1) :
Double.MAX_VALUE;
scrollBar.prefWidth(-1) :
Double.MAX_VALUE;
}

@Override
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
MFXScrollBar scrollBar = getSkinnable();
return (scrollBar.getOrientation() == Orientation.VERTICAL) ?
Double.MAX_VALUE :
scrollBar.prefHeight(-1);
Double.MAX_VALUE :
scrollBar.prefHeight(-1);
}

@Override
Expand Down Expand Up @@ -415,10 +426,10 @@ protected void layoutChildren(double x, double y, double w, double h) {
}

Position position = LayoutUtils.computePosition(
sb, thumb,
x, y + decSize, w, thumbLength, 0,
Insets.EMPTY, HPos.CENTER, VPos.TOP,
false, true
sb, thumb,
x, y + decSize, w, thumbLength, 0,
Insets.EMPTY, HPos.CENTER, VPos.TOP,
false, true
);
double thumbW = LayoutUtils.boundWidth(thumb);
thumb.resizeRelocate(position.getX(), position.getY(), thumbW, thumbLength);
Expand All @@ -434,10 +445,10 @@ protected void layoutChildren(double x, double y, double w, double h) {
}

Position position = LayoutUtils.computePosition(
sb, thumb,
x + decSize, y, thumbLength, h, 0,
Insets.EMPTY, HPos.LEFT, VPos.CENTER,
false, true
sb, thumb,
x + decSize, y, thumbLength, h, 0,
Insets.EMPTY, HPos.LEFT, VPos.CENTER,
false, true
);
double thumbH = LayoutUtils.boundWidth(thumb);
thumb.resizeRelocate(position.getX(), position.getY(), thumbLength, thumbH);
Expand All @@ -453,6 +464,7 @@ public void dispose() {
thumb.translateYProperty().unbind();
thumbPos = null;

whens.forEach(w -> w.dispose());
super.dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public class SimpleTableCell<T, E> extends HBox implements MappingTableCell<T, E
private StringConverter<E> converter;

protected final Label label;
protected When<Boolean> ivwWhen;

//================================================================================
// Constructors
Expand Down Expand Up @@ -114,15 +115,15 @@ protected void init() {
invalidate();

columnProperty().addListener((observable, oldValue, newValue) -> {
if (oldValue != null) When.disposeFor(oldValue.inViewportProperty());
if (oldValue != null && ivwWhen != null) ivwWhen.dispose();
if (newValue != null) {
VirtualTable<T> table = newValue.getTable();
if (table == null || table.getColumnsLayoutMode() == ColumnsLayoutMode.FIXED) return;

When.onChanged(newValue.inViewportProperty())
.then((o, n) -> setVisible(getColumn() != null && getColumn().isInViewport()))
.executeNow()
.listen();
ivwWhen = When.onChanged(newValue.inViewportProperty())
.then((o, n) -> setVisible(getColumn() != null && getColumn().isInViewport()))
.executeNow()
.listen();
}
});
}
Expand Down

0 comments on commit da77d37

Please sign in to comment.