javafx.beans.property.ReadOnlyObjectProperty Java Examples

The following examples show how to use javafx.beans.property.ReadOnlyObjectProperty. 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: CSSFXMonitor.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
private void monitorStageScene(ReadOnlyObjectProperty<Scene> stageSceneProperty) {
    // first listen to changes
    stageSceneProperty.addListener(new ChangeListener<Scene>() {
        @Override
        public void changed(ObservableValue<? extends Scene> ov, Scene o, Scene n) {
            if (o != null) {
                unregisterScene(o);
            }
            if (n != null) {
                registerScene(n);
            }
        }
    });

    if (stageSceneProperty.getValue() != null) {
        registerScene(stageSceneProperty.getValue());
    }
}
 
Example #2
Source File: RenderedMap.java    From BlockMap with MIT License 6 votes vote down vote up
public RenderedMap(RegionFolder regionFolder, ExecutorService executor, ReadOnlyObjectProperty<Vector2dc> mouseWorldProperty) {
	this.regionFolder = Objects.requireNonNull(regionFolder);
	this.mouseWorldProperty = Objects.requireNonNull(mouseWorldProperty);
	Collection<Vector2ic> regions = regionFolder.listRegions();
	if (regions.isEmpty())
		throw new IllegalArgumentException("World can not be empty");
	regionFolder.listRegions().stream().map(r -> new RenderedRegion(this, r)).forEach(r -> plainRegions.put(r.position, r));

	this.regions.put(0, plainRegions);
	for (int i = 1; i <= DisplayViewport.MAX_ZOOM_LEVEL; i++) {
		int j = i;
		this.regions.put(i, this.regions.get(i - 1)
				.keySet()
				.stream()
				.map(v -> new Vector2i(v.x() >> 1, v.y() >> 1))
				.distinct()
				.collect(Collectors.toMap(Function.identity(), k -> new RenderedRegion(this, j, k))));
	}

	regionsRendered = 0;
	regionsCount = regions.size();
	notRendered.addAll(plainRegions.values());
	/* Create one task per region file. Don't specify which one yet, this will be determined later on the fly */
	for (int i = 0; i < regionsCount; i++)
		executor.submit(this);
}
 
Example #3
Source File: VirtualAssetEditorDialog.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@Override
@FxThread
protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() {

    final VirtualResourceTree<C> resourceTree = getResourceTree();
    final MultipleSelectionModel<TreeItem<VirtualResourceElement<?>>> selectionModel = resourceTree.getSelectionModel();
    final ReadOnlyObjectProperty<TreeItem<VirtualResourceElement<?>>> selectedItemProperty = selectionModel.selectedItemProperty();

    final Class<C> type = getObjectsType();
    final BooleanBinding typeCondition = new BooleanBinding() {

        @Override
        protected boolean computeValue() {
            final TreeItem<VirtualResourceElement<?>> treeItem = selectedItemProperty.get();
            return treeItem == null || !type.isInstance(treeItem.getValue().getObject());
        }

        @Override
        public Boolean getValue() {
            return computeValue();
        }
    };

    return Bindings.or(selectedItemProperty.isNull(), typeCondition);
}
 
Example #4
Source File: RectangleItem.java    From OpenLabeler with Apache License 2.0 6 votes vote down vote up
@Override
public List<? extends Shape> getHandles(Translate translate, Scale scale, ReadOnlyObjectProperty<Color> colorProperty) {
   // 4 corner resize handles
   List<Rectangle> handles = Arrays.asList(new Rectangle[]{
         createHandle(Location.NW, cursorNW),
         createHandle(Location.NE, cursorNE),
         createHandle(Location.SE, cursorSE),
         createHandle(Location.SW, cursorSW)});

   // Maintain constant handle size at different zoom level
   handles.forEach(handle -> {
      scale.addEventHandler(TransformChangedEvent.TRANSFORM_CHANGED, event -> {
         handle.setWidth(HANDLE_SIZE / scale.getX());
         handle.setHeight(HANDLE_SIZE / scale.getY());
      });
      handle.fillProperty().bind(colorProperty);
      handle.setWidth(HANDLE_SIZE / scale.getX());
      handle.setHeight(HANDLE_SIZE / scale.getY());
      handle.getTransforms().addAll(translate, scale);
   });
   return handles;
}
 
Example #5
Source File: AssetEditorDialog.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
@Override
@FxThread
protected @NotNull ObservableBooleanValue buildAdditionalDisableCondition() {
    final ResourceTree resourceTree = getResourceTree();
    final MultipleSelectionModel<TreeItem<ResourceElement>> selectionModel = resourceTree.getSelectionModel();
    final ReadOnlyObjectProperty<TreeItem<ResourceElement>> selectedItemProperty = selectionModel.selectedItemProperty();
    return selectedItemProperty.isNull();
}
 
Example #6
Source File: AdapterInjector.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private void deferAdapterInjection(IAdaptable adaptable,
		Runnable runnable) {
	if (adaptable instanceof IAdaptable.Bound) {
		@SuppressWarnings("unchecked")
		ReadOnlyObjectProperty<? extends IAdaptable> adaptableProperty = ((IAdaptable.Bound<? extends IAdaptable>) adaptable)
				.adaptableProperty();
		if (adaptableProperty.get() == null) {
			// defer until we have an adaptable and can test the rest of the
			// chain
			adaptableProperty.addListener(new ChangeListener<IAdaptable>() {
				@Override
				public void changed(
						ObservableValue<? extends IAdaptable> observable,
						IAdaptable oldValue, IAdaptable newValue) {
					if (newValue != null) {
						observable.removeListener(this);
						deferAdapterInjection(newValue, runnable);
					}
				}
			});
		} else {
			// test rest of the chain
			deferAdapterInjection(adaptableProperty.get(), runnable);
		}
	} else {
		// the chain is complete, thus perform the injection
		runnable.run();
	}
}
 
Example #7
Source File: ObjectTag.java    From OpenLabeler with Apache License 2.0 4 votes vote down vote up
@Override
public ReadOnlyObjectProperty<Color> fillColorProperty() {
    return fillColorProperty;
}
 
Example #8
Source File: PreferencesFxModel.java    From PreferencesFX with Apache License 2.0 4 votes vote down vote up
public ReadOnlyObjectProperty<Category> displayedCategoryProperty() {
  return displayedCategory;
}
 
Example #9
Source File: BitcoinUIModel.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
public ReadOnlyObjectProperty<Address> addressProperty() {
    return address;
}
 
Example #10
Source File: TableCellSkinFixed.java    From ARMStrong with Mozilla Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public ReadOnlyObjectProperty<TableColumn<S,T>> tableColumnProperty() {
	if (getSkinnable() != null)  	 
		return getSkinnable().tableColumnProperty();
	return null;
}
 
Example #11
Source File: SearchHandler.java    From PreferencesFX with Apache License 2.0 4 votes vote down vote up
public ReadOnlyObjectProperty<Category> categoryMatchProperty() {
  return categoryMatch;
}
 
Example #12
Source File: DesktopPane.java    From desktoppanefx with Apache License 2.0 4 votes vote down vote up
public ReadOnlyObjectProperty<InternalWindow> activeWindowProperty() {
    return activeWindow;
}
 
Example #13
Source File: DownloadModsTask.java    From CMPDL with MIT License 4 votes vote down vote up
public ReadOnlyObjectProperty<Task<?>> taskProperty() {
    return task;
}
 
Example #14
Source File: WalletPasswordController.java    From thunder with GNU Affero General Public License v3.0 4 votes vote down vote up
public ReadOnlyObjectProperty<KeyParameter> aesKeyProperty () {
    return aesKey;
}
 
Example #15
Source File: AbstractAnchor.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ReadOnlyObjectProperty<Node> anchorageProperty() {
	return anchorageProperty.getReadOnlyProperty();
}
 
Example #16
Source File: IAdaptable.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ReadOnlyObjectProperty<T> adaptableProperty() {
	return adaptableProperty;
}
 
Example #17
Source File: WalletPasswordController.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
public ReadOnlyObjectProperty<KeyParameter> aesKeyProperty() {
    return aesKey;
}
 
Example #18
Source File: AbstractBehavior.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ReadOnlyObjectProperty<IVisualPart<? extends Node>> adaptableProperty() {
	return hostProperty.getReadOnlyProperty();
}
 
Example #19
Source File: WorkbenchTest.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
@Test
void activeModuleViewProperty() {
  assertTrue(workbench.activeModuleViewProperty() instanceof ReadOnlyObjectProperty);
}
 
Example #20
Source File: Tile.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<Node> iconProperty() {
  return icon;
}
 
Example #21
Source File: Tab.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<Node> iconProperty() {
  return icon;
}
 
Example #22
Source File: Tab.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<WorkbenchModule> moduleProperty() {
  return module;
}
 
Example #23
Source File: Workbench.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<Side> drawerSideShownProperty() {
  return drawerSideShown;
}
 
Example #24
Source File: Workbench.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<Region> drawerShownProperty() {
  return drawerShown;
}
 
Example #25
Source File: Workbench.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<Node> activeModuleViewProperty() {
  return activeModuleView;
}
 
Example #26
Source File: Workbench.java    From WorkbenchFX with Apache License 2.0 4 votes vote down vote up
public final ReadOnlyObjectProperty<WorkbenchModule> activeModuleProperty() {
  return activeModule;
}
 
Example #27
Source File: GuiControllerServer.java    From BlockMap with MIT License 4 votes vote down vote up
public ReadOnlyObjectProperty<Pair<String, RegionFolder>> folderProperty() {
	return folder.getReadOnlyProperty();
}
 
Example #28
Source File: GuiControllerWorld.java    From BlockMap with MIT License 4 votes vote down vote up
public ReadOnlyObjectProperty<Pair<String, RegionFolder>> folderProperty() {
	return folder.getReadOnlyProperty();
}
 
Example #29
Source File: WorldRendererCanvas.java    From BlockMap with MIT License 4 votes vote down vote up
public ReadOnlyObjectProperty<String> getStatus() {
	return status.getReadOnlyProperty();
}
 
Example #30
Source File: AbstractVisualPart.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public ReadOnlyObjectProperty<IVisualPart<? extends Node>> parentProperty() {
	return parentProperty.getReadOnlyProperty();
}