Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrushforth committed Nov 15, 2019
2 parents a3711e2 + 927fc8a commit 71fa9af
Show file tree
Hide file tree
Showing 63 changed files with 8,991 additions and 5,605 deletions.
2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<body>
<p>Provides classes that create and operate on a {@link Binding Binding}
that calculates a value that depends on one or more sources.</p>
<h1>Characteristics of Bindings</h1>
<h2>Characteristics of Bindings</h2>
<p>Bindings are assembled from one or more sources, usually called
their dependencies. A binding observes its dependencies for changes
and updates its own value according to changes in the dependencies.</p>
Expand All @@ -51,7 +51,7 @@ <h1>Characteristics of Bindings</h1>
That means, if a dependency changes, the result of a binding is not
immediately recalculated, but it is marked as invalid. Next time the
value of an invalid binding is requested, it is recalculated.</p>
<h1>High Level API and Low Level API</h1>
<h2>High Level API and Low Level API</h2>
<p>The Binding API is roughly divided in two parts, the High Level
Binding API and the Low Level Binding API. The High Level Binding API
allows to construct simple bindings in an easy to use fashion.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<p>The package {@code javafx.beans.property} defines read-only
properties and writable properties, plus a number of implementations.
</p>
<h1>Read-only Properties</h1>
<h2>Read-only Properties</h2>
<p>Read-only properties have two getters, {@code get()} returns the
primitive value, {@code getValue()} returns the boxed value.</p>
<p>It is possible to observe read-only properties for changes. They
Expand All @@ -47,7 +47,7 @@ <h1>Read-only Properties</h1>
getBean()} and {@code getName()} are defined. They return the
containing bean and the name of a property.</p>

<h1>Writable Properties</h1>
<h2>Writable Properties</h2>
<p>In addition to the functionality defined for read-only
properties, writable properties contain the following methods.</p>
<p>A writable property defines two setters in addition to the
Expand All @@ -62,4 +62,4 @@ <h1>Writable Properties</h1>
always contain the same value. If one of the properties changes, the
other one will be updated.</p>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
fundamental interfaces {@link javafx.beans.value.ObservableValue} and {@link
javafx.beans.value.WritableValue} and all of its sub-interfaces.</p>

<h1>ObservableValue</h1>
<h2>ObservableValue</h2>
An ObservableValue wraps a value that can be read and observed for
invalidations and changes. Listeners have to implement either {@link
javafx.beans.InvalidationListener} or {@link javafx.beans.value.ChangeListener}. To allow
Expand Down Expand Up @@ -83,7 +83,7 @@ <h1>ObservableValue</h1>
</tr>
</table>

<h1>WritableValue</h1>
<h2>WritableValue</h2>
A WritableValue wraps a value that can be read and set. As with {@code
ObservableValues}, a number of sub-interfaces are defined to work with
primitive types directly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* annotations, as well as the overarching
* {@link #buttonOrderProperty() button order} specified for the ButtonBar.
*
* <h3>Uniform button sizing</h3>
* <h2>Uniform button sizing</h2>
* <p>By default all buttons are uniformly sized in a ButtonBar, meaning that all
* buttons take the width of the widest button. It is possible to opt-out of this
* on a per-button basis, but calling the {@link #setButtonUniformSize(Node, boolean)} method with
Expand All @@ -63,7 +63,7 @@
* measuring process, so its size will not influence the maximum size calculated
* for all buttons in the ButtonBar.
*
* <h3>Screenshots</h3>
* <h2>Screenshots</h2>
* <p>Because a ButtonBar comes with built-in support for Windows, Mac OS
* and Linux, there are three screenshots shown below, with the same buttons
* laid out on each of the three operating systems.
Expand All @@ -73,7 +73,7 @@
* <strong>Mac OS:</strong><p><img src="doc-files/buttonBar-mac.png" alt=""></p>
* <strong>Linux:</strong><p><img src="doc-files/buttonBar-linux.png" alt=""></p>
*
* <h3>Code Samples</h3>
* <h2>Code Samples</h2>
* <p>Instantiating and using the ButtonBar is simple, simply do the following:
*
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
* }
* </pre>
*
* <h3>Key Design Goals</h3>
* <h2>Key Design Goals</h2>
* <ul>
* <li>Both time and memory efficient for large data sets</li>
* <li>Easy to build and use libraries for custom cells</li>
Expand All @@ -198,7 +198,7 @@
* <li>Easy to animate the cell size or other properties</li>
* </ul>
*
* <h3>Key Use Cases</h3>
* <h2>Key Use Cases</h2>
* Following are a number of key use cases used to drive the Cell API design,
* along with code examples showing how those use cases are satisfied by this
* API. This is by no means to be considered the definitive list of capabilities
Expand Down Expand Up @@ -262,7 +262,7 @@
* -fx-text-fill: red;
* }</pre>
*
* <h3>Editing</h3>
* <h2>Editing</h2>
* <p>Most virtualized controls that use the Cell architecture (e.g. {@link ListView},
* {@link TreeView}, {@link TableView} and {@link TreeTableView}) all support
* the notion of editing values directly via the cell. You can learn more about
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
* a different type is specified and the ComboBox is to be editable, it is
* necessary to specify a custom {@link StringConverter}.
*
* <h3>A warning about inserting Nodes into the ComboBox items list</h3>
* <h2>A warning about inserting Nodes into the ComboBox items list</h2>
* ComboBox allows for the items list to contain elements of any type, including
* {@link Node} instances. Putting nodes into
* the items list is <strong>strongly not recommended</strong>. This is because
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
* the above is to help introduce developers to the {@link Optional} API, which
* is new in Java 8 and may be foreign to many developers.
*
* <h3>Dialog Validation / Intercepting Button Actions</h3>
* <h2>Dialog Validation / Intercepting Button Actions</h2>
*
* <p>In some circumstances it is desirable to prevent a dialog from closing
* until some aspect of the dialog becomes internally consistent (e.g. a form
Expand All @@ -175,7 +175,7 @@
* }
* });}</pre>
*
* <h3>Dialog Closing Rules</h3>
* <h2>Dialog Closing Rules</h2>
*
* <p>It is important to understand what happens when a Dialog is closed, and
* also how a Dialog can be closed, especially in abnormal closing situations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
* making use of ListView, as all modern IDEs are able to auto-complete far
* more successfully with the additional type information.
*
* <h3>Populating a ListView</h3>
* <h2>Populating a ListView</h2>
* <p>A simple example of how to create and populate a ListView of names (Strings)
* is shown here:
*
Expand Down Expand Up @@ -122,7 +122,7 @@
* copied into the items list - meaning that subsequent changes to the content
* list are not observed, and will not be reflected visually within the ListView.
*
* <h3>ListView Selection / Focus APIs</h3>
* <h2>ListView Selection / Focus APIs</h2>
* <p>To track selection and focus, it is necessary to become familiar with the
* {@link SelectionModel} and {@link FocusModel} classes. A ListView has at most
* one instance of each of these classes, available from
Expand All @@ -142,14 +142,14 @@
*
* <pre> {@code listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);}</pre>
*
* <h3>Customizing ListView Visuals</h3>
* <h2>Customizing ListView Visuals</h2>
* <p>The visuals of the ListView can be entirely customized by replacing the
* default {@link #cellFactoryProperty() cell factory}. A cell factory is used to
* generate {@link ListCell} instances, which are used to represent an item in the
* ListView. See the {@link Cell} class documentation for a more complete
* description of how to write custom Cells.
*
* <h3>Editing</h3>
* <h2>Editing</h2>
* <p>This control supports inline editing of values, and this section attempts to
* give an overview of the available APIs and how you should use them.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* which has been divided into smaller parts.
* </p>
*
* <h3>Styling the page indicators</h3>
* <h2>Styling the page indicators</h2>
* <p>
* The control can be customized to display numeric page indicators or bullet style indicators by
* setting the style class {@link #STYLE_CLASS_BULLET}. The
Expand All @@ -60,14 +60,14 @@
* via CSS using -fx-max-page-indicator-count.
*</p>
*
* <h3>Page count</h3>
* <h2>Page count</h2>
* <p>
* The {@link #pageCountProperty() pageCountProperty} controls the number of
* pages this pagination control has. If the page count is
* not known {@link #INDETERMINATE} should be used as the page count.
* </p>
*
* <h3>Page factory</h3>
* <h2>Page factory</h2>
* <p>
* The {@link #pageFactoryProperty() pageFactoryProperty} is a callback function
* that is called when a page has been selected by the application or
Expand All @@ -76,7 +76,7 @@
* Null should be returned if the selected page index does not exist.
* </p>
*
* <h3>Creating a Pagination control:</h3>
* <h2>Creating a Pagination control:</h2>
* <p>
* A simple example of how to create a pagination control with ten pages and
* each page containing text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
* nodes of the root node are shown. By default, the root node is shown in the
* TreeView.
*
* <h3>TreeView Selection / Focus APIs</h3>
* <h2>TreeView Selection / Focus APIs</h2>
* <p>To track selection and focus, it is necessary to become familiar with the
* {@link SelectionModel} and {@link FocusModel} classes. A TreeView has at most
* one instance of each of these classes, available from
Expand All @@ -119,14 +119,14 @@
*
* <pre> {@code treeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);}</pre>
*
* <h3>Customizing TreeView Visuals</h3>
* <h2>Customizing TreeView Visuals</h2>
* <p>The visuals of the TreeView can be entirely customized by replacing the
* default {@link #cellFactoryProperty() cell factory}. A cell factory is used to
* generate {@link TreeCell} instances, which are used to represent an item in the
* TreeView. See the {@link Cell} class documentation for a more complete
* description of how to write custom Cells.
*
* <h3>Editing</h3>
* <h2>Editing</h2>
* <p>This control supports inline editing of values, and this section attempts to
* give an overview of the available APIs and how you should use them.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ void reconfigurePopup() {
}

private void handleKeyEvent(KeyEvent ke, boolean doConsume) {
// When the user hits the enter or F4 keys, we respond before
// When the user hits the enter key, we respond before
// ever giving the event to the TextField.
if (ke.getCode() == KeyCode.ENTER) {
if (ke.isConsumed() || ke.getEventType() != KeyEvent.KEY_RELEASED) {
Expand All @@ -562,12 +562,6 @@ private void handleKeyEvent(KeyEvent ke, boolean doConsume) {
} else if (textField != null) {
textField.fireEvent(ke);
}
} else if (ke.getCode() == KeyCode.F4) {
if (ke.getEventType() == KeyEvent.KEY_RELEASED) {
if (comboBoxBase.isShowing()) comboBoxBase.hide();
else comboBoxBase.show();
}
ke.consume(); // we always do a consume here (otherwise unit tests fail)
} else if (ke.getCode() == KeyCode.F10 || ke.getCode() == KeyCode.ESCAPE) {
// RT-23275: The TextField fires F10 and ESCAPE key events
// up to the parent, which are then fired back at the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,60 @@

import java.util.Arrays;
import java.util.List;
import java.util.Objects;

import javafx.event.Event;
import javafx.event.EventTarget;
import javafx.event.EventType;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.event.Event;
import javafx.event.EventTarget;


public class KeyEventFirer {

private final EventTarget target;

private final Scene scene;

/**
* Instantiates a KeyEventFirer on the given event target. KeyEvents are
* fired directly onto the target.
*
* <p>
* Beware: using this constructor on an <code>EventTarget</code> of type <code>Node</code>
* which is not focusOwner may lead
* to false greens (see https://bugs.openjdk.java.net/browse/JDK-8231692).
*
* @param target the target to fire keyEvents onto, must not be null.
* @throws NullPointerException if target is null.
*/
public KeyEventFirer(EventTarget target) {
this(Objects.requireNonNull(target), null);
}

/**
* Instantiates a KeyEventFirer for the given target and scene.
* Any one of those can be null, but not both. A null/not null scene decides
* about the delivering path of events. If null, events are delivered
* via <code>EventUtils.fire(target, keyEvent)</code>, otherwise via
* <code>scene.processKeyEvent(keyEvent)</code>.
* <p>
* Note that in the latter case, the target doesn't matter - the scene
* delivers keyEvents to its focusOwner. Calling code is responsible to
* setup focus state as required.
*
* @param target eventTarget used to create the event for and fire events onto
* if there's no scene
* @param scene to use for delivering events to its focusOwner if not null
*
* @throws NullPointerException if both target and scene are null
*/
public KeyEventFirer(EventTarget target, Scene scene) {
this.target = target;
this.scene = scene;
if (target == null && scene == null) {
throw new NullPointerException("both target and scene are null");
}
}

public void doUpArrowPress(KeyModifier... modifiers) {
Expand All @@ -66,9 +107,21 @@ public void doKeyTyped(KeyCode keyCode, KeyModifier... modifiers) {
fireEvents(createEvent(keyCode, KeyEvent.KEY_TYPED, modifiers));
}

/**
* Dispatches the given events. The process depends on the state of
* this firer. If the scene is null, the events are delivered via
* Event.fireEvent(target,..), otherwise they are delivered via
* scene.processKeyEvent.
*
* @param events the events to dispatch.
*/
private void fireEvents(KeyEvent... events) {
for (KeyEvent evt : events) {
Event.fireEvent(target, evt);
if (scene != null) {
scene.processKeyEvent(evt);
} else {
Event.fireEvent(target, evt);
}
}
}

Expand Down
Loading

0 comments on commit 71fa9af

Please sign in to comment.