本文整理匯總了Java中javafx.beans.property.ListProperty類的典型用法代碼示例。如果您正苦於以下問題:Java ListProperty類的具體用法?Java ListProperty怎麽用?Java ListProperty使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ListProperty類屬於javafx.beans.property包,在下文中一共展示了ListProperty類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: FilterPopUp
import javafx.beans.property.ListProperty; //導入依賴的package包/類
public FilterPopUp(ListProperty<T> allCellValues, ListProperty<T> blacklistedCellValues) {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FilterPopUp.fxml"));
fxmlLoader.setController(this);
fxmlLoader.setRoot(rootContent);
try {
fxmlLoader.load();
} catch (IOException e) {
throw new RuntimeException("Could not load fxml", e);
}
this.blacklistedCellValues = blacklistedCellValues;
listView.itemsProperty().bind(allCellValues);
addSelectionProperties(allCellValues);
allCellValues.addListener((ListChangeListener<T>) c -> {
mapCellValueToSelectedProperty.clear();
addSelectionProperties(c.getList());
chkBox_selectAll.selectedProperty().set(true);
});
initSelectAllCheckbox();
}
示例2: testGeneratedOutputTypes
import javafx.beans.property.ListProperty; //導入依賴的package包/類
@Test
public void testGeneratedOutputTypes() throws Exception {
ObjectFactory of = new ObjectFactory();
TestType cut = of.createTestType();
assertTrue("StringProperty expected!", cut.aStringProperty() instanceof StringProperty);
assertTrue("ObjectProperty expected!", cut.aBooleanProperty() instanceof ObjectProperty);
assertTrue("ObjectProperty expected!", cut.aDoubleProperty() instanceof ObjectProperty);
assertTrue("ObjectProperty expected!", cut.aFloatProperty() instanceof ObjectProperty);
assertTrue("ObjectProperty expected!", cut.aLongProperty() instanceof ObjectProperty);
cut.getAList();
assertTrue("ListProperty expected!", cut.aListProperty() instanceof ListProperty);
assertTrue("ObjectProperty expected!", cut.anIntegerProperty() instanceof ObjectProperty);
assertTrue("BooleanProperty expected!", cut.aPrimitiveBooleanProperty() instanceof BooleanProperty);
assertTrue("DoubleProperty expected!", cut.aPrimitiveDoubleProperty() instanceof DoubleProperty);
assertTrue("FloatProperty expected!", cut.aPrimitiveFloatProperty() instanceof FloatProperty);
assertTrue("LongProperty expected!", cut.aPrimitiveLongProperty() instanceof LongProperty);
assertTrue("IntegerProperty expected!", cut.aPrimitiveIntegerProperty() instanceof IntegerProperty);
}
示例3: getJSONEpisodeList
import javafx.beans.property.ListProperty; //導入依賴的package包/類
private String getJSONEpisodeList(ListProperty<List<Episode>> list) {
ObservableList<List<Map<String, String>>> seasonList = FXCollections.observableArrayList();
for (List<Episode> episodes : list) {
List<Map<String, String>> episodeList = new ArrayList<>();
for (Episode episode : episodes) {
HashMap<String, String> map = new HashMap<>();
map.put("seasonNum", episode.getSeasonNum());
map.put("episodeName", episode.getEpisodeName());
map.put("watched", Boolean.toString(episode.getWatched()));
episodeList.add(map);
}
seasonList.add(episodeList);
}
Type observableListType = new TypeToken<ObservableList<String>>(){}.getType();
return gson.toJson(seasonList, observableListType);
}
示例4: visitFields
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
*
* @param object
* The object which fields should be visited.
* @return {@code true} when the object was a observable object, {@code false} when it was a simple object.
* @throws SecurityException
* If a {@link SecurityManager} is active and denies access to fields via reflection.
* @throws IllegalAccessException
* If access modifiers like {@code private} are enforced even when the model is accessed via reflection.
*/
private boolean visitFields(final Object object) throws IllegalAccessException {
boolean isObservableObject = false;
for (final Field field : getInheritedFields(object.getClass())) {
field.setAccessible(true);
currentField = field;
final Class<?> fieldClass = field.getType();
if (!isObservableObject && classImplementsOrExtends(fieldClass, Property.class)) {
startVisiting(object);
isObservableObject = true;
}
if (classImplementsOrExtends(fieldClass, ListProperty.class)) {
handle((ListProperty<?>) field.get(object));
} else if (classImplementsOrExtends(fieldClass, SetProperty.class)) {
handle((SetProperty<?>) field.get(object));
} else if (classImplementsOrExtends(fieldClass, MapProperty.class)) {
handle((MapProperty<?, ?>) field.get(object));
} else if (classImplementsOrExtends(fieldClass, Property.class)) {
handle((Property<?>) field.get(object));
}
}
return isObservableObject;
}
示例5: displayModal
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
* Display the window with the automatically generated form that allows the user to set a method's parameters.
*
* @param callerClass Class to get class loader from, to use for loading the window's FXML file
* @param injector Injector to use when loading FXML, so that the model etc. are injected automatically.
* @param method Method that the window should display configuration options for.
*/
public static void displayModal(Class callerClass, Injector injector, IDocumentation method, ListProperty<JPair<String, Object>> paramsProperty) {
Parent root;
FXMLLoader loader = new FXMLLoader(
callerClass.getClassLoader().getResource("wizard-fxml/DynamicConfiguration.fxml"),
null,
new JavaFXBuilderFactory(),
injector::getInstance
);
try {
root = loader.load();
} catch (IOException e) {
e.printStackTrace();
return;
}
root.getProperties().put("controller", loader.getController());
Object controller = loader.getController();
if (controller instanceof DynamicConfigurationController) {
// Cast the controller instance since we know it's safe here
DynamicConfigurationController popupController = (DynamicConfigurationController) controller;
// Give the configuration options to the controller
JsonArray params = method.getParameterConfiguration();
popupController.setParameters(params, paramsProperty);
// Create the popup
Stage dialog = new Stage();
dialog.setScene(new Scene(root));
dialog.setTitle("JedAI - Parameter Configuration");
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.show();
} else {
// This shouldn't ever happen.
System.err.println("Error when showing the parameter customization popup (Wrong controller instance?)");
}
}
示例6: configBtnHandler
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
* Show the advanced configuration window for the pressed button
*
* @param actionEvent Button action event
*/
public void configBtnHandler(ActionEvent actionEvent) {
if (actionEvent.getSource() instanceof Button) {
// Get button ID
String id = ((Button) actionEvent.getSource()).getId();
// Get the required parameters to give to configuration modal
ListProperty<JPair<String, Object>> modelProperty = null;
String readerType = null;
boolean groundTruth = false;
IDocumentation reader;
switch (id) {
case "entitiesD1ConfigBtn":
readerType = model.getEntityProfilesD1Type();
modelProperty = model.entityProfilesD1ParametersProperty();
break;
case "entitiesD2ConfigBtn":
readerType = model.getEntityProfilesD2Type();
modelProperty = model.entityProfilesD2ParametersProperty();
break;
case "gTruthConfigBtn":
readerType = model.getGroundTruthType();
modelProperty = model.groundTruthParametersProperty();
groundTruth = true;
break;
}
reader = MethodConfiguration.getDataReader(groundTruth, readerType);
// Now that we have all required parameters, show the configuration window
MethodConfiguration.displayModal(getClass(), injector, reader, modelProperty);
}
}
示例7: parametersNode
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
* Create a node for displaying the advanced configuration parameters of a method.
*
* @param parametersProperty List property, that contains the values of the method's parameters
* @return Node that displays the given parameters and values
*/
private Node parametersNode(ListProperty<JPair<String, Object>> parametersProperty) {
// Create the node to show the parameters
ListView<JPair<String, Object>> paramsList = new ListView<>();
paramsList.setMaxHeight(60);
//todo: add vgap to the list
// Bind the ListView's items to the given parameters property
paramsList.itemsProperty().bind(parametersProperty);
return paramsList;
}
示例8: nestListProp
import javafx.beans.property.ListProperty; //導入依賴的package包/類
public static <F, T> ListProperty<T> nestListProp(ObservableValue<F> pf, Function<F, ListProperty<T>> func) {
ListProperty<T> current = func.apply(pf.getValue());
ListProperty<T> nestProp = new SimpleListProperty<>();
CacheUtil.set(BeanUtil.class, nestProp, current);
nestProp.bindBidirectional(current);
pf.addListener((ob, o, n) -> {
CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContentBidirectional(p));
ListProperty<T> pt = func.apply(n);
CacheUtil.set(BeanUtil.class, nestProp, pt);
nestProp.bindContentBidirectional(pt);
});
return nestProp;
}
示例9: nestListValue
import javafx.beans.property.ListProperty; //導入依賴的package包/類
public static <F, T> ObservableList<T> nestListValue(ObservableValue<F> pf, Function<F, ObservableList<T>> func) {
ObservableList<T> current = func.apply(pf.getValue());
ListProperty<T> nestProp = new SimpleListProperty<>();
CacheUtil.set(BeanUtil.class, nestProp, current);
nestProp.bindContent(current);
pf.addListener((ob, o, n) -> {
CacheUtil.<ListProperty<T>> remove(BeanUtil.class, nestProp).ifPresent(p -> nestProp.unbindContent(p));
ObservableList<T> pt = func.apply(n);
CacheUtil.set(BeanUtil.class, nestProp, pt);
nestProp.bindContent(pt);
});
return nestProp;
}
示例10: propertyValueClass
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
* Provides the underlying value class for a given {@link Property}
*
* @param property
* the {@link Property} to check
* @return the value class of the {@link Property}
*/
@SuppressWarnings("unchecked")
protected static <T> Class<T> propertyValueClass(final Property<T> property) {
Class<T> clazz = null;
if (property != null) {
if (StringProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) String.class;
} else if (IntegerProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Integer.class;
} else if (BooleanProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Boolean.class;
} else if (DoubleProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Double.class;
} else if (FloatProperty.class
.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Float.class;
} else if (LongProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Long.class;
} else if (ListProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) List.class;
} else if (MapProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) Map.class;
} else {
clazz = (Class<T>) Object.class;
}
}
return clazz;
}
示例11: updateData
import javafx.beans.property.ListProperty; //導入依賴的package包/類
@Override
public void updateData(String text, ListProperty<BODTO<T>> list, BooleanProperty busy) {
if (!Strings.isEmpty(text)) {
final BusinessObjectQueryRemote<T> query = getContext().getBean(queryClass);
busy.set(true);
getContext().getBean(MExecutor.class)
.call(() -> query.autoCompletion(text))
.whenCompleteUI((l,e) -> {
busy.set(false);
list.addAll(l);
});
}
}
示例12: bindBidirectional
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
* Bind a pair of type-differing JavaFX properties bidirectionally. Keeps the two properties internally
* and synchronizes them via {@link javafx.beans.value.ChangeListener}s.
* The String property is a comma-separated list of {@link Course#getName()}s from the list.
*
* @param registry the course registry from which to recognize inputted courses
* @param listProperty the list property to bind
* @param stringProperty the string property to bind
*/
public void bindBidirectional(CourseRegistry registry, ListProperty<Course> listProperty,
StringProperty stringProperty) {
this.courseRegistry = registry;
this.listProperty = listProperty;
this.stringProperty = stringProperty;
this.listProperty.addListener(listListener);
this.stringProperty.addListener(stringListener);
listListener.changed(listProperty, null, listProperty.get());
}
示例13: addChannelToList
import javafx.beans.property.ListProperty; //導入依賴的package包/類
public static void addChannelToList(final ListProperty<TwitchChannel> activeList, final TwitchChannel channel) {
synchronized (activeList) {
final ObservableList<TwitchChannel> activeChannelServices = FXCollections
.observableArrayList(activeList.get());
activeChannelServices.add(channel);
activeList.set(activeChannelServices);
}
}
示例14: setupToolBar
import javafx.beans.property.ListProperty; //導入依賴的package包/類
private void setupToolBar() {
final Button homeButton = GlyphsDude.createIconButton(FontAwesomeIcon.HOME);
homeButton.setOnAction(event -> this.browserCore.goToHome());
final Button refreshButton = GlyphsDude.createIconButton(FontAwesomeIcon.REFRESH);
refreshButton.setOnAction(event -> this.browserCore.refresh());
this.searchTextField.textProperty().addListener((obs, oldValue, newValue) -> {
if (!"".equals(newValue)) {
this.browserCore.filter(newValue);
}
});
final Label searchLabel = new Label("Filter");
final ComboBox<String> favouriteGameComboBox = new ComboBox<>();
final ListProperty<String> favouriteGames = Settings.getInstance().favouriteGamesProperty();
favouriteGameComboBox.itemsProperty().bind(favouriteGames);
favouriteGameComboBox.getSelectionModel().selectedItemProperty().addListener((obs, oldValue, newValue) -> {
if (newValue != null) {
this.browserCore.openGame(newValue);
Platform.runLater(() -> favouriteGameComboBox.setValue(null));
}
});
this.qualityComboBox.getItems().add("Worst");
this.qualityComboBox.getItems().add("Best");
this.qualityComboBox.getSelectionModel().select(1);
this.browserToolBar.getItems().add(homeButton);
this.browserToolBar.getItems().add(new Separator(Orientation.VERTICAL));
this.browserToolBar.getItems().add(refreshButton);
this.browserToolBar.getItems().add(new Separator(Orientation.VERTICAL));
this.browserToolBar.getItems().add(searchLabel);
this.browserToolBar.getItems().add(this.searchTextField);
this.browserToolBar.getItems().add(new Separator(Orientation.VERTICAL));
this.browserToolBar.getItems().add(favouriteGameComboBox);
this.browserToolBar.getItems().add(new Separator(Orientation.VERTICAL));
this.browserToolBar.getItems().add(this.qualityComboBox);
}
示例15: propertyValueClass
import javafx.beans.property.ListProperty; //導入依賴的package包/類
/**
* Provides the underlying value class for a given {@linkplain Property}
*
* @param property
* the {@linkplain Property} to check
* @return the value class of the {@linkplain Property}
*/
@SuppressWarnings("unchecked")
protected static <T> Class<T> propertyValueClass(final Property<T> property) {
Class<T> clazz = null;
if (property != null) {
if (StringProperty.class.isAssignableFrom(property.getClass())) {
clazz = (Class<T>) String.class;
} else if (IntegerProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Integer.class;
} else if (BooleanProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Boolean.class;
} else if (DoubleProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Double.class;
} else if (FloatProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Float.class;
} else if (LongProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Long.class;
} else if (ListProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) List.class;
} else if (MapProperty.class.isAssignableFrom(property
.getClass())) {
clazz = (Class<T>) Map.class;
} else {
clazz = (Class<T>) Object.class;
}
}
return clazz;
}