javafx.beans.property.ListProperty Java Examples

The following examples show how to use javafx.beans.property.ListProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListPropertyExTests.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Parameters
public static Collection<Object[]> data() {
	return Arrays.asList(
			new Object[][] { { new Provider<ListProperty<Integer>>() {

				@Override
				public ListProperty<Integer> get() {
					return new SimpleListPropertyEx<>(FXCollections
							.observableList(new ArrayList<Integer>()));
				}
			} }, { new Provider<ListProperty<Integer>>() {

				@Override
				public ListProperty<Integer> get() {
					// Replacement for ReadOnlySetWrapper which fixes
					// https://bugs.openjdk.java.net/browse/JDK-8136465)
					return new ReadOnlyListWrapperEx<>(FXCollections
							.observableList(new ArrayList<Integer>()));
				}
			} } });
}
 
Example #2
Source File: ListPropertyExTests.java    From gef with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void changeListenerRegistrationAndDeregistration() {
	ListProperty<Integer> property = propertyProvider.get();

	// register listener
	ChangeExpector<Integer> changeListener = null;
	changeListener = new ChangeExpector<>(property);
	property.addListener(changeListener);

	// add second listener (and remove again)
	ChangeExpector<Integer> changeListener2 = null;
	changeListener2 = new ChangeExpector<>(property);
	property.addListener(changeListener2);
	property.removeListener(changeListener2);

	ObservableList<Integer> newValue = FXCollections.observableArrayList();
	newValue.add(1);
	changeListener.addExpectation(property.get(), newValue);
	property.set(newValue);
	changeListener.check();
}
 
Example #3
Source File: PropertyVisitor.java    From SynchronizeFX with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 
 * @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;
}
 
Example #4
Source File: CommandListExecutor.java    From SynchronizeFX with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void registerInMetaModel(final Object object, final UUID id) {
    objectRegistry.registerObject(object, id);
    if (object instanceof ListProperty) {
        final List<?> list = (List<?>) object;
        if (!listPropertyMetaDataStore.hasMetaDataFor(list)) {
            listPropertyMetaDataStore.storeMetaDataOrFail(list, new ListPropertyMetaData(
                    CommandListCreator.INITIAL_LIST_VERSION, CommandListCreator.INITIAL_LIST_VERSION));
        }
    }
}
 
Example #5
Source File: Setting.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
/**
 * Loads the value of this setting using a {@link StorageHandler}.
 *
 * @param storageHandler the {@link StorageHandler} to use
 * @implNote differentiates between a {@link ListProperty}, as found in multiselection settings,
 *           and all the other property types, since those need to be handled differently by
 *           the {@link StorageHandler}.
 */
public void loadSettingValue(StorageHandler storageHandler) {
  if (value instanceof ListProperty) {
    value.setValue(storageHandler.loadObservableList(
        key.isEmpty() ? getBreadcrumb() : key, (ObservableList) value.getValue()
    ));
  } else {
    value.setValue(storageHandler.loadObject(
        key.isEmpty() ? getBreadcrumb() : key, value.getValue()
    ));
  }
}
 
Example #6
Source File: PropertyVisitor.java    From SynchronizeFX with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void handle(final ListProperty<?> property) throws IllegalAccessException {
    if (visitCollectionProperty(property)) {
        Iterator<?> it = property.listIterator();
        while (it.hasNext()) {
            visit(it.next());
        }
    }
}
 
Example #7
Source File: PropertyVisitor.java    From SynchronizeFX with GNU Lesser General Public License v3.0 5 votes vote down vote up
Parent(final Property<?> parentProperty, final ListProperty<?> parentList, final SetProperty<?> parentSet,
        final MapProperty<?, ?> parentMap) {
    this.parentList = parentList;
    this.parentSet = parentSet;
    this.parentMap = parentMap;
    this.parentProperty = parentProperty;
}
 
Example #8
Source File: PreferencesService.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
public @NotNull ListProperty<String> getRecentFiles() {
	return recentFileNames;
}
 
Example #9
Source File: GroupImpl.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull ListProperty<Shape> getShapes() {
	return shapes;
}
 
Example #10
Source File: DrawingImpl.java    From latexdraw with GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull ListProperty<Shape> getShapes() {
	return shapes;
}
 
Example #11
Source File: LedBargraph.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final ListProperty<Color> ledColorsProperty() {
    return ledColors;
}
 
Example #12
Source File: RadialBargraph.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final ListProperty<Stop> barGradientProperty() {
    if (null == barGradient) {
        barGradient = new SimpleListProperty<>(this, "barGradient", _barGradient);
    }
    return barGradient;
}
 
Example #13
Source File: Model.java    From hibernate-demos with Apache License 2.0 4 votes vote down vote up
public ListProperty<String> tagsProperty() {
    return tags;
}
 
Example #14
Source File: Service.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public ListProperty<Note> notesProperty() {
    return notes;
}
 
Example #15
Source File: Service.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public ListProperty<Note> notesProperty() {
    return notes;
}
 
Example #16
Source File: Service.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public ListProperty<Note> notesProperty() {
    return notes;
}
 
Example #17
Source File: ListPropertyExTests.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
public ListPropertyExTests(
		Provider<ListProperty<Integer>> propertyProvider) {
	this.propertyProvider = propertyProvider;
}
 
Example #18
Source File: DumpTimeline.java    From jstackfx with Apache License 2.0 4 votes vote down vote up
public ListProperty<Dump> dumpsProperty() {
    return dumps;
}
 
Example #19
Source File: MZmineProjectImpl.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ListProperty<PeakList> featureListsProperty() {
  return featureListsProperty;
}
 
Example #20
Source File: MZmineProjectImpl.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ListProperty<RawDataFile> rawDataFilesProperty() {
  return rawDataFilesProperty;
}
 
Example #21
Source File: ModularFeature.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public ListProperty<Integer> getScanNumbers() {
  return get(ScanNumbersType.class);
}
 
Example #22
Source File: ModularFeature.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public ListProperty<DataPoint> getDataPoints() {
  return get(DataPointsType.class);
}
 
Example #23
Source File: ListDataType.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ListProperty<T> createProperty() {
  return new SimpleListProperty<T>(FXCollections.observableList(new ArrayList<T>()));
}
 
Example #24
Source File: IdentityType.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
@Override
@Nonnull
public String getFormattedString(@Nonnull ListProperty<PeakIdentity> value) {
  ObservableList<PeakIdentity> list = value.getValue();
  return list == null || list.isEmpty() ? "" : list.get(0).toString();
}
 
Example #25
Source File: SelectionStrip.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ListProperty<T> itemsProperty() {
  return items;
}
 
Example #26
Source File: ToolbarControl.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ListProperty<ToolbarItem> toolbarControlsRightProperty() {
  return toolbarControlsRight;
}
 
Example #27
Source File: ToolbarControl.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ListProperty<ToolbarItem> toolbarControlsLeftProperty() {
  return toolbarControlsLeft;
}
 
Example #28
Source File: DefaultRenderColorScheme.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
public static ListProperty<Color> fillColorProperty() {
    return fillColours;
}
 
Example #29
Source File: DefaultRenderColorScheme.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
public static ListProperty<Paint> fillStylesProperty() {
    return fillStyles;
}
 
Example #30
Source File: Workbench.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
private ListProperty<WorkbenchModule> modulesProperty() {
  return modules;
}