Skip to content
Commits on Source (2)
  • Markus Koschany's avatar
    Import Upstream version 9.0.0+hg20181001 · c06dceea
    Markus Koschany authored
    c06dceea
  • Markus Koschany's avatar
    Import Debian changes 9.0.0+hg20181001-1 · 7fa8f70c
    Markus Koschany authored
    controlsfx (9.0.0+hg20181001-1) unstable; urgency=medium
    
      * Team upload.
      * New upstream version 9.0.0+hg20181118.
        - Fix FBTFS with OpenJFX 11. (Closes: #911858)
      * Rebase release-version.patch.
      * Add build.patch and work around a Gradle bug that causes a FTBFS when
        compiling to Java 11 bytecode ("this feature requires ASM 7").
      * Declare compliance with Debian Policy 4.2.1.
    7fa8f70c
#!/usr/bin/env bash
# Add back -SNAPHOT to artifact_suffix
sed -i "/artifact_suffix=/ s/=.*/=-SNAPSHOT/" controlsfx-build.properties
# Update version by 1
newVersion=${BITBUCKET_BOOKMARK%.*}.$((${BITBUCKET_BOOKMARK##*.} + 1))
sed -i "/controlsfx_specification_version=/ s/=.*/=$newVersion/" controlsfx-build.properties
# Commit back the new version
apt-get update && apt-get install mercurial -y
hg commit controlsfx-build.properties -m "Upgrading to next snapshot version" -u "ControlsFX Bot <controlsfxbot@jonathangiles.net>"
hg push https://$BITBUCKET_USERNAME:$BITBUCKET_PASSWORD@bitbucket.org/controlsfx/controlsfx
#!/usr/bin/env bash
# Remove -SNAPHOT from artifact_suffix
sed -i "/artifact_suffix=/ s/=.*/=/" controlsfx-build.properties
# Update controlsfx_specification_version with BOOKMARK pushed
sed -i "/controlsfx_specification_version=/ s/=.*/=$BITBUCKET_BOOKMARK/" controlsfx-build.properties
\ No newline at end of file
repo: 2201b18d26a2d604cc7ef5c5067b1725b2e573d7
node: 41b4600460e4458fbc24b99cc583d291a60b0851
branch: default
tag: 8.40.14
[repository]
native = CRLF
\ No newline at end of file
syntax: glob
# Gradle
.gradle/
build/
# IntelliJ IDEA
.idea/
out/
# Netbeans
.nb-gradle/
.nb-gradle-properties
# Eclipse
.settings/
bin/
# MacOS
.DS_Store
# Miscellenous
classes/
gradle.properties
75093ba3c5b190cf6e32028abe8956481cc3f70f 8.0.0-dev-preview-1
4126a1a38b741b380036a9426dbea6a6d8542123 8.0.0-dev-preview-2
229a8fdc71d72bea191283a010ae2dbbeb85dc9a 8.0.0
72de760aca86ae3ae1b06ef49f3662c54a5feb35 8.0.1
f24c2e539df07853fc9d482de2650bd7a5a74fab 8.0.2-dev-preview-1
1167c609e548a902718da94ec3639ed8c2b10a36 8.0.2-dev-preview-2
49fbd100695b2208c70462d8afd01287fced2d52 8.0.2
f804169e6636ba7e5d10b940024f9e9e0e31f210 8.0.4
8e5e0b9b4cde512f8958e626cdc7533ba172684f 8.0.3
0ba5652c7ff882647e8f169a8a58e277be5652e6 8.0.5
6ce54c6bf82c3eb91426c2557bdd9612bcb96e48 8.0.6
371bca0e905536ca6742d181fdade07258260659 8.0.6_20
086f829f8156899d93dbbfcc8e1ad655e4a95064 8.20.7
47d19341dd3cc108195efda6073ba056c9490672 8.20.8
c04b084e1b202a3b7174a0147171225c9852892f 8.40.9
48fad0295886030b0732ee9ea648f49e9c267681 8.40.10
2c5a9d8ce3aaf4dfc121a29d4641acd1a1254d76 8.40.11
580696f836e3bfc7b9b6789305045cb363a054fd 8.40.12
7dab5b09ca670f54c998400ff222bb1ee7fd5029 8.40.13
# This is a sample build configuration for Gradle.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Dockerhub as your build environment.
image: cogniteev/oracle-java:java8
pipelines:
branches:
default:
- step:
script: # Modify the commands below to build your repository.
name: Build and assemble default branch
image: cogniteev/oracle-java:java8
caches:
- gradle
script:
- chmod +x gradlew
- ./gradlew clean assemble uploadPublished -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD -Ptransifex.api=$TRANSIFEX_API
9.0.0:
- step:
name: Build and assemble 9.0.0 branch
image: abhinay/oracle-java:java10
caches:
- gradle
script:
- chmod +x gradlew
- ./gradlew build -x test
\ No newline at end of file
- ./gradlew clean assemble uploadPublished -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD -Ptransifex.api=$TRANSIFEX_API
bookmarks:
'release/8*':
- step:
name: Build and release
image: cogniteev/oracle-java:java8
caches:
- gradle
script:
- chmod +x gradlew .ci/update.sh .ci/commit.sh
- ./.ci/update.sh
- ./gradlew clean assemble uploadPublished -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD -Ptransifex.api=$TRANSIFEX_API
- ./.ci/commit.sh
'release/9*':
- step:
name: Build and release
image: abhinay/oracle-java:java10
caches:
- gradle
script:
- chmod +x gradlew .ci/update.sh .ci/commit.sh
- ./.ci/update.sh
- ./gradlew clean assemble uploadPublished -PsonatypeUsername=$SONATYPE_USERNAME -PsonatypePassword=$SONATYPE_PASSWORD -Ptransifex.api=$TRANSIFEX_API
- ./.ci/commit.sh
\ No newline at end of file
ext.java9Args = [
// For various usages of TraversalEngine
"--add-exports=javafx.graphics/com.sun.javafx.scene=org.controlsfx.controls",
"--add-exports=javafx.graphics/com.sun.javafx.scene.traversal=org.controlsfx.controls",
// For FontAwesome Style
"--add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls",
// For various behaviors across controls
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=org.controlsfx.controls",
// For ReadOnlyUnbackedObservableList across files
"--add-exports=javafx.controls/com.sun.javafx.scene.control=org.controlsfx.controls",
// For InputMap used in behavior classes
"--add-exports=javafx.controls/com.sun.javafx.scene.control.inputmap=org.controlsfx.controls",
// For EventHandlerManager across files
"--add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls",
// For MappingChange, NonIterableChange across files
"--add-exports=javafx.base/com.sun.javafx.collections=org.controlsfx.controls",
// For VersionInfo in VersionChecker
"--add-exports=javafx.base/com.sun.javafx.runtime=org.controlsfx.controls",
// For WebPage in SVGLoader
"--add-exports=javafx.web/com.sun.webkit=org.controlsfx.controls",
// For enabling FontAwesome
"--add-exports=javafx.graphics/com.sun.javafx.css=org.controlsfx.controls"
]
ext.java9RuntimeArgs = [
// For accessing VirtualFlow field from the base class in GridViewSkin
"--add-opens=javafx.controls/javafx.scene.control.skin=org.controlsfx.controls",
// For accessing getChildren in ImplUtils
"--add-opens=javafx.graphics/javafx.scene=org.controlsfx.controls"
]
static String getOSName() {
final String osName = System.getProperty("os.name").toLowerCase()
if (osName.contains("linux")) {
return ("linux")
} else if (osName.contains("mac os x") || osName.contains("darwin") || osName.contains("osx")) {
return ("mac")
} else if (osName.contains("windows")) {
return ("win")
}
return ("")
}
ext.javafx_modules = [
'javafx-base',
'javafx-graphics',
'javafx-controls',
'javafx-fxml',
'javafx-media',
'javafx-web'
]
if (JavaVersion.current().isJava11Compatible()) {
ext.javafx_version = '11'
ext.platform = getOSName()
}
subprojects {
apply plugin: 'java'
......@@ -17,15 +74,21 @@ subprojects {
controlsfx_name = 'controlsfx'
fxsampler_name = 'fxsampler'
fxsampler_version = cfg.fxsampler_specification_version + artifact_suffix
fxsampler_mainClass = 'fxsampler.FXSampler'
fxsampler_mainClass = 'org.controlsfx.fxsampler/fxsampler.FXSampler'
}
group = 'org.controlsfx'
version = specification_version + artifact_suffix
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
sourceCompatibility = '1.9'
targetCompatibility = '1.9'
if (JavaVersion.current().isJava11Compatible()) {
sourceCompatibility = rootProject.javafx_version
targetCompatibility = rootProject.javafx_version
}
afterEvaluate {
repositories {
mavenCentral()
......@@ -40,11 +103,66 @@ subprojects {
// Show that tests are run in the command-line output
events 'started', 'passed'
}
inputs.property("moduleName", moduleName)
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'ALL-MODULE-PATH',
'--add-reads', "$moduleName=junit",
'--patch-module', "$moduleName=" + files(sourceSets.test.java.outputDir).asPath,
]
classpath = files()
}
}
compileJava {
inputs.property("moduleName", moduleName)
doFirst {
options.compilerArgs += [
'--module-path', classpath.asPath,
]
classpath = files()
}
options.encoding = "UTF-8"
options.incremental = true
if ( project.name != "fxsampler" ) {
options.compilerArgs += java9Args
}
}
javadoc {
inputs.property("moduleName", moduleName)
doFirst {
exclude '**/module-info.java'
exclude 'impl/*'
options.addStringOption('-module-path', classpath.asPath)
options.addStringOption('-class-path', "")
options.addBooleanOption('html5', true)
options.addBooleanOption('javafx', true)
options.addBooleanOption('Xdoclint:none', true)
options.encoding = 'UTF-8'
javafx_modules.stream()
.map { module -> module.replace("-", ".") }
.each {
options.addStringOption('-add-modules', it)
}
// TODO: Uncomment once Javadoc link is fixed for JDK 11
/*if (JavaVersion.current().java11Compatible) {
options.links("https://openjfx.io/javadoc/11")
options.links("https://docs.oracle.com/en/java/javase/11/docs/api")
} else {*/
options.links("https://docs.oracle.com/javase/9/docs/api")
// }
// Only required JDK 9/10
options.addMultilineStringsOption("-add-exports").setValue(
[
'javafx.base/com.sun.javafx.event=ALL-UNNAMED',
'javafx.web/com.sun.webkit=ALL-UNNAMED',
'javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED'
]
)
}
}
}
task sourceJar(type: Jar) {
......
controlsfx_group=org.controlsfx
# The name of Java version required by ControlsFX.
controlsfx_specification_title=Java Version 8 Update 40
controlsfx_specification_title=Java Version 9
# The minimum required JavaFX version for ControlsFX.
# Set it to String obtained by VersionInfo.getVersion() method.
controlsfx_specification_version=8.40.14
controlsfx_specification_version=9.0.1
fxsampler_specification_version=1.0.10
......
import org.apache.tools.ant.filters.*
ext.moduleName = 'org.controlsfx.samples'
apply plugin: 'application'
applicationName = 'FXSampler'
......@@ -11,22 +12,14 @@ configurations {
sourceSets {
main {
compileClasspath += configurations.jdk
// Gradle application plugin fails to resolve resources with JDK 11
output.resourcesDir = "build/classes/java/main"
}
}
dependencies {
compile project(':controlsfx')
compile project(':fxsampler')
compile group + ':' + fxsampler_name +':' + fxsampler_version
compile group + ':' + controlsfx_name + ':' + version
try {
jdk files(jfxrtJar)
} catch (MissingPropertyException pne) {
// javafx plugin will provide in this case
}
}
jar {
......@@ -39,3 +32,13 @@ jar {
from sourceSets.main.allJava
}
run {
doFirst {
java9Args.addAll(java9RuntimeArgs)
jvmArgs = java9Args + [
'--module-path', classpath.asPath,
'--module', mainClassName,
]
classpath = files()
}
}
\ No newline at end of file
module org.controlsfx.samples {
requires java.desktop;
requires org.controlsfx.controls;
requires org.controlsfx.fxsampler;
exports org.controlsfx.samples to org.controlsfx.fxsampler;
exports org.controlsfx.samples.actions to org.controlsfx.fxsampler;
exports org.controlsfx.samples.button to org.controlsfx.fxsampler;
exports org.controlsfx.samples.checked to org.controlsfx.fxsampler;
exports org.controlsfx.samples.dialogs to org.controlsfx.fxsampler;
exports org.controlsfx.samples.propertysheet to org.controlsfx.fxsampler;
exports org.controlsfx.samples.tablefilter to org.controlsfx.fxsampler;
exports org.controlsfx.samples.tableview to org.controlsfx.fxsampler;
exports org.controlsfx.samples.textfields to org.controlsfx.fxsampler;
opens org.controlsfx.samples;
opens org.controlsfx.samples.dialogs;
opens org.controlsfx.samples.actions to org.controlsfx.controls;
opens org.controlsfx.samples.tableview to javafx.base;
provides fxsampler.FXSamplerProject with org.controlsfx.ControlsFXSampler;
}
\ No newline at end of file
......@@ -41,8 +41,7 @@ public class ControlsFXSampler implements FXSamplerProject {
label.setText(desc.toString());
label.setStyle("-fx-font-size: 1.5em; -fx-padding: 20 0 0 5;");
vBox.getChildren().addAll(pane, label);
WelcomePage wPage = new WelcomePage("Welcome to Controls FX!", vBox);
return wPage;
return new WelcomePage("Welcome to Controls FX!", vBox);
}
public static void main(String[] args) {
......
/**
* Copyright (c) 2018 ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of ControlsFX, any associated website, nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL CONTROLSFX BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.controlsfx.samples;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.geometry.Side;
import javafx.scene.Node;
import javafx.scene.control.*;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.stage.Stage;
import org.controlsfx.ControlsFXSample;
import org.controlsfx.control.ListActionView;
import org.controlsfx.control.action.Action;
import org.controlsfx.control.action.ActionUtils;
import org.controlsfx.glyphfont.FontAwesome;
import java.util.List;
public class HelloListActionView extends ControlsFXSample {
private ListActionView<String> view;
@Override
public String getSampleName() {
return "List Action View";
}
@Override
public Node getPanel(Stage stage) {
view = new ListActionView<>();
view.getItems().addAll("Dirk", "Jonathan", "Eugene","Abhinay", "Samir");
view.getActions().addAll(createActions());
GridPane pane = new GridPane();
pane.add(view, 0, 0);
pane.setAlignment(Pos.CENTER);
return pane;
}
@Override
public Node getControlPanel() {
VBox root = new VBox(20);
root.setPadding(new Insets(30, 30, 30, 30));
CheckBox useCellFactory = new CheckBox("Use cell factory");
useCellFactory.setOnAction(evt -> {
if (useCellFactory.isSelected()) {
view.setCellFactory(listView -> {
ListCell<String> cell = new ListCell<String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
setText(item == null ? "null" : item);
setGraphic(null);
}
}
};
cell.setFont(Font.font("Arial", FontWeight.BOLD,
FontPosture.ITALIC, 18));
return cell;
});
} else {
view.setCellFactory(null);
}
});
CheckBox clearActions = new CheckBox("Clear Actions");
clearActions.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
view.getActions().clear();
} else {
view.getActions().addAll(createActions());
}
});
ComboBox<Side> sideComboBox = new ComboBox<>(FXCollections.observableArrayList(Side.values()));
sideComboBox.setTooltip(new Tooltip("The side of the ListView on which the actions should be displayed"));
sideComboBox.getSelectionModel().select(Side.LEFT);
view.sideProperty().bind(sideComboBox.getSelectionModel().selectedItemProperty());
root.getChildren().addAll(useCellFactory, clearActions, sideComboBox);
return root;
}
@Override
public String getSampleDescription() {
return "A control used to let the user select multiple values from a "
+ "list of available values. Selected values are moved into a "
+ "second list that is showing the current selection. Items can "
+ "be moved by double clicking on them or by first selecting "
+ "them and then pressing one of the buttons in the center.";
}
@Override
public String getJavaDocURL() {
return Utils.JAVADOC_BASE
+ "org/controlsfx/control/ListActionView.html";
}
public static void main(String[] args) {
launch(args);
}
private ObservableList<Action> createActions() {
ListActionView.ListAction<String> moveUp = new ListActionView.ListAction<String>(
new FontAwesome().create(FontAwesome.Glyph.ANGLE_UP)) {
@Override
public void initialize(ListView<String> listView) {
setEventHandler(e -> moveSelectedItemsUp(listView));
}
};
ListActionView.ListAction<String> moveDown = new ListActionView.ListAction<String>(new FontAwesome().create(FontAwesome.Glyph.ANGLE_DOWN)) {
@Override
public void initialize(ListView<String> listView) {
setEventHandler(e -> moveSelectedItemsDown(listView));
}
};
return FXCollections.observableArrayList(moveUp, ActionUtils.ACTION_SEPARATOR, moveDown);
}
private void moveSelectedItemsUp(ListView<String> listView) {
final MultipleSelectionModel<String> selectionModel = listView.getSelectionModel();
final ObservableList<Integer> selectedIndices = selectionModel.getSelectedIndices();
final ObservableList<String> items = listView.getItems();
for (final Integer selectedIndex : selectedIndices) {
if (selectedIndex > 0) {
if (selectedIndices.contains(selectedIndex - 1)) continue;
final String item = items.get(selectedIndex);
final String itemToBeReplaced = items.get(selectedIndex - 1);
items.set(selectedIndex - 1, item);
items.set(selectedIndex, itemToBeReplaced);
selectionModel.clearSelection(selectedIndex);
selectionModel.select(selectedIndex - 1);
}
}
}
private void moveSelectedItemsDown(ListView<String> listView) {
final ObservableList<String> items = listView.getItems();
final MultipleSelectionModel<String> selectionModel = listView.getSelectionModel();
final List<Integer> selectedIndices = selectionModel.getSelectedIndices();
int lastIndex = items.size() - 1;
// Last selected item is to be replaced first
for (int index = selectedIndices.size() - 1; index >= 0; index--) {
final Integer selectedIndex = selectedIndices.get(index);
if (selectedIndex < lastIndex) {
if (selectedIndices.contains(selectedIndex + 1)) continue;
final String item = items.get(selectedIndex);
final String itemToBeReplaced = items.get(selectedIndex + 1);
items.set(selectedIndex + 1, item);
items.set(selectedIndex, itemToBeReplaced);
selectionModel.clearSelection(selectedIndex);
selectionModel.select(selectedIndex + 1);
}
}
}
}
......@@ -73,7 +73,7 @@ public class HelloNotifications extends ControlsFXSample {
private CheckBox showCloseButtonChkBox;
private CheckBox darkStyleChkBox;
private CheckBox ownerChkBox;
private Slider fadeDelaySlider;
private Slider fadeDelaySlider, thresholdSlider;
protected String graphicMode = "";
public static void main(String[] args) {
......@@ -289,6 +289,19 @@ public class HelloNotifications extends ControlsFXSample {
GridPane.setHgrow(fadeDelaySlider, Priority.ALWAYS);
grid.add(fadeDelaySlider, 1, row++);
// threshold slider
final Label thresholdLabel = new Label("Threshold: ");
thresholdLabel.getStyleClass().add("property");
grid.add(thresholdLabel, 0, row);
thresholdSlider = new Slider(0, 10, 0);
thresholdSlider.setMajorTickUnit(1);
thresholdSlider.setMinorTickCount(0);
thresholdSlider.setShowTickMarks(true);
thresholdSlider.setShowTickLabels(true);
thresholdSlider.setSnapToTicks(true);
thresholdSlider.setMaxWidth(Double.MAX_VALUE);
GridPane.setHgrow(thresholdSlider, Priority.ALWAYS);
grid.add(thresholdSlider, 1, row++);
return grid;
}
......@@ -320,11 +333,9 @@ public class HelloNotifications extends ControlsFXSample {
.graphic(graphic)
.hideAfter(Duration.seconds(fadeDelaySlider.getValue()))
.position(pos)
.onAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent arg0) {
System.out.println("Notification clicked on!");
}
});
.onAction(e -> System.out.println("Notification clicked on!"))
.threshold((int) thresholdSlider.getValue(),
Notifications.create().title("Threshold Notification"));
if (ownerChkBox.isSelected()) {
notificationBuilder.owner(stage);
......
......@@ -26,11 +26,6 @@
*/
package org.controlsfx.samples;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.stream.Collectors;
import javafx.animation.PauseTransition;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
......@@ -47,11 +42,15 @@ import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.util.Duration;
import javafx.util.StringConverter;
import org.controlsfx.ControlsFXSample;
import org.controlsfx.control.PrefixSelectionChoiceBox;
import org.controlsfx.control.PrefixSelectionComboBox;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
public class HelloPrefixSelection extends ControlsFXSample {
private final int hidingDelay = 200;
......@@ -179,7 +178,7 @@ public class HelloPrefixSelection extends ControlsFXSample {
combo4.setConverter(new StringConverter<Person>() {
@Override
public String toString(Person object) {
return String.format("%02d ", personList.indexOf(object)) + object.toString();
return String.format("%02d ", personList.indexOf(object)) + (object != null ? object.toString() : "");
}
@Override
......
/**
* Copyright (c) 2013, ControlsFX
* Copyright (c) 2013, 2018 ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -34,8 +34,6 @@ import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
......@@ -86,12 +84,18 @@ public class HelloCheckComboBox extends ControlsFXSample {
// normal ComboBox
grid.add(new Label("Normal ComboBox: "), 0, row);
grid.add(new ComboBox<String>(strings), 1, row++);
final ComboBox<String> comboBox = new ComboBox<>(strings);
comboBox.focusedProperty().addListener((o, ov, nv) -> {
if(nv) comboBox.show(); else comboBox.hide();
});
grid.add(comboBox, 1, row++);
// CheckComboBox
checkComboBox = new CheckComboBox<String>(strings);
checkComboBox.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
@Override public void onChanged(ListChangeListener.Change<? extends String> change) {
checkComboBox = new CheckComboBox<>(strings);
checkComboBox.focusedProperty().addListener((o, ov, nv) -> {
if(nv) checkComboBox.show(); else checkComboBox.hide();
});
checkComboBox.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) change -> {
updateText(checkedItemsLabel, change.getList());
while (change.next()) {
......@@ -104,12 +108,11 @@ public class HelloCheckComboBox extends ControlsFXSample {
+ change.wasReplaced() + " Updated " + change.wasUpdated());
System.out.println("============================================");
}
}
});
grid.add(new Label("CheckComboBox: "), 0, row);
grid.add(checkComboBox, 1, row++);
CheckComboBox<Person> checkComboBox2 = new CheckComboBox<Person>(Person.createDemoList());
CheckComboBox<Person> checkComboBox2 = new CheckComboBox<>(Person.createDemoList());
checkComboBox2.setConverter(new StringConverter<Person>() {
@Override
public String toString(Person object) {
......@@ -121,7 +124,7 @@ public class HelloCheckComboBox extends ControlsFXSample {
}
});
grid.add(new Label("CheckComboBox with data objects: "), 0, row);
grid.add(checkComboBox2, 1, row++);
grid.add(checkComboBox2, 1, row);
return grid;
}
......@@ -144,17 +147,13 @@ public class HelloCheckComboBox extends ControlsFXSample {
checkItem2Label.getStyleClass().add("property");
grid.add(checkItem2Label, 0, row);
final CheckBox checkItem2Btn = new CheckBox();
checkItem2Btn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
checkItem2Btn.setOnAction(e -> {
IndexedCheckModel<String> cm = checkComboBox.getCheckModel();
if (cm.isChecked(2)) {
cm.clearCheck(2);
} else {
cm.check(2);
}
if (cm != null) {
cm.toggleCheckState(2);
}
});
grid.add(checkItem2Btn, 1, row++);
grid.add(checkItem2Btn, 1, row);
return grid;
}
......@@ -182,14 +181,14 @@ public class HelloCheckComboBox extends ControlsFXSample {
}
class Person {
private StringProperty firstname = new SimpleStringProperty();
private StringProperty lastname = new SimpleStringProperty();
private StringProperty firstName = new SimpleStringProperty();
private StringProperty lastName = new SimpleStringProperty();
private ReadOnlyStringWrapper fullName = new ReadOnlyStringWrapper();
public Person(String firstname, String lastname) {
this.firstname.set(firstname);
this.lastname.set(lastname);
fullName.bind(Bindings.concat(firstname, " ", lastname));
public Person(String firstName, String lastName) {
this.firstName.set(firstName);
this.lastName.set(lastName);
fullName.bind(Bindings.concat(firstName, " ", lastName));
}
public static final ObservableList<Person> createDemoList() {
......@@ -205,28 +204,28 @@ class Person {
return result;
}
public final StringProperty firstnameProperty() {
return this.firstname;
public final StringProperty firstNameProperty() {
return this.firstName;
}
public final java.lang.String getFirstname() {
return this.firstnameProperty().get();
public final java.lang.String getFirstName() {
return this.firstNameProperty().get();
}
public final void setFirstname(final String firstname) {
this.firstnameProperty().set(firstname);
public final void setFirstName(final String firstName) {
this.firstNameProperty().set(firstName);
}
public final StringProperty lastnameProperty() {
return this.lastname;
public final StringProperty lastNameProperty() {
return this.lastName;
}
public final String getLastname() {
return this.lastnameProperty().get();
public final String getLastName() {
return this.lastNameProperty().get();
}
public final void setLastname(final String lastname) {
this.lastnameProperty().set(lastname);
public final void setLastName(final String lastName) {
this.lastNameProperty().set(lastName);
}
public final ReadOnlyStringProperty fullNameProperty() {
......
/**
* Copyright (c) 2013, ControlsFX
* Copyright (c) 2013, 2018 ControlsFX
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -29,8 +29,6 @@ package org.controlsfx.samples.checked;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
......@@ -39,7 +37,6 @@ import javafx.scene.control.SelectionMode;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.controlsfx.ControlsFXSample;
import org.controlsfx.control.CheckListView;
import org.controlsfx.control.IndexedCheckModel;
......@@ -77,13 +74,8 @@ public class HelloCheckListView extends ControlsFXSample {
// CheckListView
checkListView = new CheckListView<>(strings);
checkListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
checkListView.getSelectionModel().getSelectedItems().addListener(new ListChangeListener<String>() {
@Override public void onChanged(ListChangeListener.Change<? extends String> c) {
updateText(selectedItemsLabel, c.getList());
}
});
checkListView.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
@Override public void onChanged(ListChangeListener.Change<? extends String> change) {
checkListView.getSelectionModel().getSelectedItems().addListener((ListChangeListener<String>) c -> updateText(selectedItemsLabel, c.getList()));
checkListView.getCheckModel().getCheckedItems().addListener((ListChangeListener<String>) change -> {
updateText(checkedItemsLabel, change.getList());
while (change.next()) {
......@@ -96,7 +88,6 @@ public class HelloCheckListView extends ControlsFXSample {
+ change.wasReplaced() + " Updated " + change.wasUpdated());
System.out.println("============================================");
}
}
});
StackPane stackPane = new StackPane(checkListView);
......@@ -129,17 +120,13 @@ public class HelloCheckListView extends ControlsFXSample {
checkItem2Label.getStyleClass().add("property");
grid.add(checkItem2Label, 0, row);
final CheckBox checkItem2Btn = new CheckBox();
checkItem2Btn.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
checkItem2Btn.setOnAction(e -> {
IndexedCheckModel<String> cm = checkListView.getCheckModel();
if (cm.isChecked(2)) {
cm.clearCheck(2);
} else {
cm.check(2);
}
if (cm != null) {
cm.toggleCheckState(2);
}
});
grid.add(checkItem2Btn, 1, row++);
grid.add(checkItem2Btn, 1, row);
return grid;
......
......@@ -55,6 +55,17 @@ public final class FlightTable extends Application {
table.setItems(sortedList);
sortedList.comparatorProperty().bind(table.comparatorProperty());
TableFilter<Flight> tableFilter = TableFilter.forTableView(table).lazy(true).apply();
tableFilter.setSearchStrategy((input,target) -> {
try {
return target.matches(input);
} catch (Exception e) {
return false;
}
});
table.setEditable(true);
TableColumn<Flight, Integer> flightNumCol = new TableColumn<>("FLIGHT NUM");
flightNumCol.setCellValueFactory(cellData -> new ReadOnlyObjectWrapper<>(cellData.getValue().getFlightNumber()));
......@@ -90,16 +101,6 @@ public final class FlightTable extends Application {
gateNumber.setEditable(true);
table.getColumns().add(gateNumber);
TableFilter<Flight> tableFilter = TableFilter.forTableView(table).lazy(true).apply();
table.setEditable(true);
tableFilter.setSearchStrategy((input,target) -> {
try {
return target.matches(input);
} catch (Exception e) {
return false;
}
});
tableFilter.unSelectAllValues(origCol);
tableFilter.selectValue(origCol,"ABQ");
......