Skip to content

Commit

Permalink
Merge pull request #37 from kadampabookings/prod
Browse files Browse the repository at this point in the history
Merged September work
  • Loading branch information
salmonb authored Oct 17, 2024
2 parents 18be277 + 8796101 commit 8927a5c
Show file tree
Hide file tree
Showing 12 changed files with 374 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish-javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# WebFX requires at least JDK 13 due to javac bugs in prior versions (otherwise JDK 11+ should be enough in theory)
jdk-version: '19'
repo-dir: .
target-javadoc-dir: ./target/site/apidocs
target-javadoc-dir: ./target/reports/apidocs
web-push-repository-name: 'webfx-netlify'
web-push-repository-owner: 'webfx-project'
web-push-branch: 'javadoc'
Expand All @@ -36,7 +36,7 @@ jobs:

# Build JavaDoc
- name: Build JavaDoc
run: mvn -B package javadoc:aggregate -Ddoclint=none -Dmaven.compiler.release=8 # Using Java 8 for now due to JavaDoc errors with modules
run: mvn -B javadoc:aggregate -Ddoclint=none -Dmaven.compiler.release=8 # Using Java 8 for now due to JavaDoc errors with modules

- name: Publish JavaDoc to ${{ env.web-push-branch }} branch
uses: cpina/github-action-push-to-another-repository@master
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,43 @@ public static NumberBinding divide(final ObservableNumberValue op1, int op2) {
return Bindings.divide(op1, IntegerConstant.valueOf(op2), op1);
}

/**
* Creates a new {@link javafx.beans.binding.BooleanBinding} that holds {@code true}
* if a given {@link javafx.collections.ObservableList} is empty.
*
* @param op
* the {@code ObservableList}
* @param <E> type of the {@code List} elements
* @return the new {@code BooleanBinding}
* @throws NullPointerException
* if the {@code ObservableList} is {@code null}
* @since JavaFX 2.1
*/
public static <E> BooleanBinding isEmpty(final ObservableList<E> op) {
if (op == null) {
throw new NullPointerException("List cannot be null.");
}

return new BooleanBinding() {
{
super.bind(op);
}

@Override
public void dispose() {
super.unbind(op);
}

@Override
protected boolean computeValue() {
return op.isEmpty();
}

@Override
public ObservableList<?> getDependencies() {
return FXCollections.singletonObservableList(op);
}
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,32 @@ public final Property<TextBoundsType> boundsTypeProperty() {
return boundsType;
}

/**
* Defines if each line of text should have a line through it.
*
* @return if each line of text should have a line through it
* @defaultValue false
*/
public final BooleanProperty strikethroughProperty() {
if (strikethroughProperty == null)
strikethroughProperty = new SimpleBooleanProperty();
return strikethroughProperty;
}

private BooleanProperty strikethroughProperty;

public final void setStrikethrough(boolean value) {
strikethroughProperty().set(value);
}

public final boolean isStrikethrough() {
if (strikethroughProperty == null) {
return false;
}
return strikethroughProperty.get();
}


@Override
public double getBaselineOffset() {
Font font = getFont();
Expand Down
6 changes: 6 additions & 0 deletions webfx-kit/webfx-kit-javafxgraphics-gwt-j2cl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
<version>0.1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>dev.webfx</groupId>
<artifactId>webfx-platform-uischeduler</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>dev.webfx</groupId>
<artifactId>webfx-platform-useragent</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,39 @@
* @author Bruno Salmon
*/
public class TextPeerBase
<N extends Text, NB extends TextPeerBase<N, NB, NM>, NM extends TextPeerMixin<N, NB, NM>>
<N extends Text, NB extends TextPeerBase<N, NB, NM>, NM extends TextPeerMixin<N, NB, NM>>

extends ShapePeerBase<N, NB, NM> {
extends ShapePeerBase<N, NB, NM> {

@Override
public void bind(N t, SceneRequester sceneRequester) {
super.bind(t, sceneRequester);
requestUpdateOnPropertiesChange(sceneRequester
, t.textOriginProperty()
, t.xProperty()
, t.yProperty()
, t.wrappingWidthProperty()
, t.lineSpacingProperty()
, t.textAlignmentProperty()
, t.fontProperty()
, t.textProperty()
, t.textOriginProperty()
, t.xProperty()
, t.yProperty()
, t.wrappingWidthProperty()
, t.lineSpacingProperty()
, t.strikethroughProperty()
, t.textAlignmentProperty()
, t.fontProperty()
, t.textProperty()
);
}

@Override
public boolean updateProperty(ObservableValue changedProperty) {
Text ts = node;
return super.updateProperty(changedProperty)
|| updateProperty(ts.textProperty(), changedProperty, mixin::updateText)
|| updateProperty(ts.xProperty(), changedProperty, p -> mixin.updateX(p.doubleValue()))
|| updateProperty(ts.yProperty(), changedProperty, p -> mixin.updateY(p.doubleValue()))
|| updateProperty(ts.wrappingWidthProperty(), changedProperty, p -> mixin.updateWrappingWidth(p.doubleValue()))
|| updateProperty(ts.lineSpacingProperty(), changedProperty, mixin::updateLineSpacing)
|| updateProperty(ts.textAlignmentProperty(), changedProperty, mixin::updateTextAlignment)
|| updateProperty(ts.textOriginProperty(), changedProperty, mixin::updateTextOrigin)
|| updateProperty(ts.fontProperty(), changedProperty, mixin::updateFont)
;
|| updateProperty(ts.textProperty(), changedProperty, mixin::updateText)
|| updateProperty(ts.xProperty(), changedProperty, p -> mixin.updateX(p.doubleValue()))
|| updateProperty(ts.yProperty(), changedProperty, p -> mixin.updateY(p.doubleValue()))
|| updateProperty(ts.wrappingWidthProperty(), changedProperty, p -> mixin.updateWrappingWidth(p.doubleValue()))
|| updateProperty(ts.lineSpacingProperty(), changedProperty, mixin::updateLineSpacing)
|| updateProperty(ts.strikethroughProperty(), changedProperty, mixin::updateStrikethrough)
|| updateProperty(ts.textAlignmentProperty(), changedProperty, mixin::updateTextAlignment)
|| updateProperty(ts.textOriginProperty(), changedProperty, mixin::updateTextOrigin)
|| updateProperty(ts.fontProperty(), changedProperty, mixin::updateFont)
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ public interface TextPeerMixin
void updateY(Double y);

void updateWrappingWidth(Double wrappingWidth);

void updateLineSpacing(Number lineSpacing);

void updateStrikethrough(Boolean strikethrough);

void updateTextAlignment(TextAlignment textAlignment);

void updateFont(Font font);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ public void updateLineSpacing(Number lineSpacing) {
updateViewBox();
}

@Override
public void updateStrikethrough(Boolean strikethrough) {
svgTextPeer.updateStrikethrough(strikethrough);
updateViewBox();
}

@Override
public void updateTextAlignment(TextAlignment textAlignment) {
svgTextPeer.updateTextAlignment(textAlignment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ private void updateWrappingWithAndLineSpacing(double wrappingWidth, double lineS
updateYInAnimationFrame(true);
}

@Override
public void updateStrikethrough(Boolean strikethrough) {
setElementStyleAttribute("text-decoration", Boolean.TRUE.equals(strikethrough) ? "line-through" : null);
}

@Override
public void updateTextAlignment(TextAlignment textAlignment) {
setElementStyleAttribute("text-align", toCssTextAlignment(textAlignment));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public void updateLineSpacing(Number lineSpacing) {
// TODO: implement SVG line spacing
}

@Override
public void updateStrikethrough(Boolean strikethrough) {
// TODO: implement SVG strikethrough
}

@Override
public void updateTextAlignment(TextAlignment textAlignment) {
setElementAttribute("text-anchor", textAlignmentToSvgTextAnchor(textAlignment));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public interface MediaPlayerPeer {

void setAudioSpectrumListener(AudioSpectrumListener listener);

void setOnEndOfMedia(Runnable onEndOfMedia);

void setOnPlaying(Runnable onPlaying);

void seek(Duration duration);

}
Loading

0 comments on commit 8927a5c

Please sign in to comment.