Skip to content

Commit

Permalink
Fixes #186 Open event with single click
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Sep 27, 2022
1 parent c8e1664 commit 2b2974c
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@
import javafx.beans.binding.BooleanBinding;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.ReadOnlyBooleanWrapper;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
Expand Down Expand Up @@ -130,7 +132,7 @@ protected EntryViewBase(Entry<?> entry) {
focusedProperty().addListener(it -> processFocus());

addEventHandler(MouseEvent.MOUSE_CLICKED, evt -> {
if (evt.getButton().equals(PRIMARY) && evt.getClickCount() == 2) {
if (evt.getButton().equals(PRIMARY) && evt.isStillSincePress() && evt.getClickCount() == getDetailsClickCount()) {
showDetails(evt, evt.getScreenX(), evt.getScreenY());
}
});
Expand Down Expand Up @@ -231,6 +233,28 @@ protected EntryViewBase(Entry<?> entry) {
layerProperty().addListener(weakLayerListener);
}

private final IntegerProperty detailsClickCount = new SimpleIntegerProperty(this, "detailsClickCount", 2);

public final int getDetailsClickCount() {
return detailsClickCount.get();
}

/**
* Determins the click count that is required to trigger the
* "show details" action.
*
* @see DateControl#entryDetailsCallbackProperty()
*
* @return the "show details" click count
*/
public final IntegerProperty detailsClickCountProperty() {
return detailsClickCount;
}

public final void setDetailsClickCount(int detailsClickCount) {
this.detailsClickCount.set(detailsClickCount);
}

/**
* Returns the calendar entry for which the view was created.
*
Expand Down

0 comments on commit 2b2974c

Please sign in to comment.