当前位置: 首页>>代码示例>>Java>>正文


Java ReadOnlyObjectProperty类代码示例

本文整理汇总了Java中javafx.beans.property.ReadOnlyObjectProperty的典型用法代码示例。如果您正苦于以下问题:Java ReadOnlyObjectProperty类的具体用法?Java ReadOnlyObjectProperty怎么用?Java ReadOnlyObjectProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ReadOnlyObjectProperty类属于javafx.beans.property包,在下文中一共展示了ReadOnlyObjectProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recurrenceSourceProperty

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
/**
 * If the entry is a recurrence (see {@link #recurrenceProperty()}) then
 * this property will store a reference to the entry for which the
 * recurrence was created.
 *
 * @return the entry that was the source of the recurrence
 */
public final ReadOnlyObjectProperty<Entry<T>> recurrenceSourceProperty() {
    if (recurrenceSource == null) {
        recurrenceSource = new ReadOnlyObjectWrapper<Entry<T>>(this, "recurrenceSource") { //$NON-NLS-1$
            @Override
            public void set(Entry<T> newEntry) {
                super.set(newEntry);
                if (newEntry != null) {
                    setRecurrence(true);
                } else {
                    setRecurrence(false);
                }
            }
        };
    }

    return recurrenceSource.getReadOnlyProperty();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:25,代码来源:Entry.java

示例2: buildAdditionalDisableCondition

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:VirtualAssetEditorDialog.java

示例3: loadCatchTypes

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@Override
public ReadOnlyObjectProperty<RequestStatus> loadCatchTypes(Consumer<CatchType> loadCallback) {
	RestClient catchTypeClient = RestClient.create().method("GET").host("https://api.nestnz.org")
   			.path("/catch-type").connectTimeout(TIMEOUT);
	return processReadRequest(ApiCatchType.class, catchTypeClient, apiCatchType -> {
		URL imageUrl = null;
		if (apiCatchType.getImageUrl() != null) {
			try {
				imageUrl = new URL(apiCatchType.getImageUrl());
			} catch (MalformedURLException ex) {
				LOG.log(Level.WARNING, "Error decoding image url: "+apiCatchType.getImageUrl(), ex);
			}
		}
		CatchType catchType = new CatchType(apiCatchType.getId(), apiCatchType.getName(), imageUrl);
		loadCallback.accept(catchType);
	});
}
 
开发者ID:FrancisG-Massey,项目名称:Capstone2016,代码行数:18,代码来源:RestNetworkService.java

示例4: loadTrapline

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@Override
public ReadOnlyObjectProperty<RequestStatus> loadTrapline(Trapline trapline, Consumer<Trap> loadCallback) {
	RestClient trapsClient = RestClient.create().method("GET").host("https://api.nestnz.org")
   			.path("/trap").connectTimeout(TIMEOUT).queryParam("trapline-id", Integer.toString(trapline.getId()));
	
	return processReadRequest(ApiTrap.class, trapsClient, apiTrap -> {
		if (apiTrap.getTraplineId() != trapline.getId()) {
			LOG.log(Level.WARNING, apiTrap+" was returned in a request for trapline "+trapline.getId());
			return;
		}
		
		LocalDateTime created = LocalDateTime.parse(apiTrap.getCreated().replace(' ', 'T'));
		LocalDateTime lastReset = apiTrap.getLastReset() == null ? null : LocalDateTime.parse(apiTrap.getLastReset().replace(' ', 'T'));
		
		Trap trap  = new Trap(apiTrap.getId(), apiTrap.getNumber(), 
				apiTrap.getLatitude(), apiTrap.getLongitude(), TrapStatus.ACTIVE, created, lastReset);
		
		loadCallback.accept(trap);			
	});
}
 
开发者ID:FrancisG-Massey,项目名称:Capstone2016,代码行数:21,代码来源:RestNetworkService.java

示例5: set

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void set(Consumer<Object> dispatcher, Object node, String name, VProperty vProperty) {
	if(! (node instanceof ListView)) {
		throw new IllegalStateException("Trying to set selectionModel of node " + node);
	}

	final ListView listView = (ListView) node;

	final ReadOnlyObjectProperty selectedItemProperty = listView.getSelectionModel().selectedItemProperty();

	clearListeners(node, selectedItemProperty);

	final Object value = vProperty.isValueDefined()? vProperty.getValue() : null;
	listView.getSelectionModel().select(value);

	if(vProperty.getChangeListener().isDefined()) {
		setChangeListener(dispatcher, node, selectedItemProperty, vProperty.getChangeListener().get());
	}

	if(vProperty.getInvalidationListener().isDefined()) {
		setInvalidationListener(dispatcher, node, selectedItemProperty, vProperty.getInvalidationListener().get());
	}
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:25,代码来源:ListViewSelectionModelSelectItemsAccessor.java

示例6: getFindReplaceDialog

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@Override
public FindReplaceDialog getFindReplaceDialog() {
  if (findReplaceDialog == null) {
    findReplaceDialog = new FindReplaceDialog(getWindow(), this);
    ChangeListener<Node> focusOwnerListener = (observable, oldValue,
        newValue) -> findReplaceDialog.getController().setFocusOwner(newValue);
    ChangeListener<Scene> sceneListener = (observable, oldValue, newValue) -> {
      if (oldValue != null)
        oldValue.focusOwnerProperty().removeListener(focusOwnerListener);
      if (newValue != null)
        newValue.focusOwnerProperty().addListener(focusOwnerListener);
    };
    ReadOnlyObjectProperty<Scene> sceneProperty = root.sceneProperty();
    sceneProperty.addListener(sceneListener);
    sceneListener.changed(sceneProperty, null, sceneProperty.get());
  }
  return findReplaceDialog;
}
 
开发者ID:Adrodoc55,项目名称:MPL,代码行数:19,代码来源:MplIdeController.java

示例7: invalidate

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
private void invalidate() {
    boolean initialized = false;

    for (ReadOnlyObjectProperty<Bounds> property : sourceBounds) {
        Bounds bounds = property.get();

        if (!initialized) {
            minX.set(floorIfNeeded(bounds.getMinX()));
            minY.set(floorIfNeeded(bounds.getMinY()));
            minZ.set(floorIfNeeded(bounds.getMinZ()));
            maxX.set(ceilIfNeeded(bounds.getMaxX()));
            maxY.set(ceilIfNeeded(bounds.getMaxY()));
            maxZ.set(ceilIfNeeded(bounds.getMaxZ()));
            initialized = true;
        } else {
            minX.set(Double.min(minX.get(), floorIfNeeded(bounds.getMinX())));
            minY.set(Double.min(minY.get(), floorIfNeeded(bounds.getMinY())));
            minZ.set(Double.min(minZ.get(), floorIfNeeded(bounds.getMinZ())));
            maxX.set(Double.max(maxX.get(), ceilIfNeeded(bounds.getMaxX())));
            maxY.set(Double.max(maxY.get(), ceilIfNeeded(bounds.getMaxY())));
            maxZ.set(Double.max(maxZ.get(), ceilIfNeeded(bounds.getMaxZ())));
        }
    }
}
 
开发者ID:dejv78,项目名称:j.commons,代码行数:25,代码来源:CompositeObservableBounds.java

示例8: bindPossibleScoringButtons

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
private void bindPossibleScoringButtons() {
    ReadOnlyIntegerProperty selectedIndex = this.tablePossibleScores
            .getSelectionModel().selectedIndexProperty();
    ReadOnlyObjectProperty<PossibleScoring> selectedItem = this.tablePossibleScores
            .getSelectionModel().selectedItemProperty();

    // only enable move-up button if an item other than the topmost is
    // selected
    this.buttonMoveScoreUp.disableProperty().bind(
            selectedIndex.isEqualTo(0).or(selectedItem.isNull()));

    // only enable move-down button if an item other than the last one is
    // selected
    // index < size - 1 && selected != null
    this.buttonMoveScoreDown.disableProperty().bind(
            selectedIndex.greaterThanOrEqualTo(
                    Bindings.size(this.tablePossibleScores.getItems())
                            .subtract(1)).or(selectedItem.isNull()));

    // only enable remove button if an item is selected
    this.buttonRemoveScore.disableProperty().bind(selectedItem.isNull());

    // only enable edit button if an item is selected
    this.buttonEditScore.disableProperty().bind(selectedItem.isNull());
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:26,代码来源:TournamentModuleEditorDialog.java

示例9: monitorStageScene

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
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());
    }
}
 
开发者ID:McFoggy,项目名称:cssfx,代码行数:19,代码来源:CSSFXMonitor.java

示例10: bindContextMenuForTreeTableCell

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
/**
 * Helper method which provides extra logic for extracting the {@link TreeItem} {@link Property} from a
 * {@link TreeTableCell}, which itself has no {@link TreeItem} property. The {@link TreeItem} {@link Property} we
 * want to bind can be found in the containing {@link TreeTableRow} instead.
 * <p>
 *
 * @param <T> the type of the item contained in the {@link TreeTableRow}
 * @param appCtx the {@link ApplicationContext} of the application
 * @param ctxMenuProperty the {@link ContextMenu} {@link Property} of the {@link TreeTableCell}
 * @param tableRowProperty the {@link TreeTableRow} {@link Property} of the {@link TreeTableCell}
 */
private static <T> void bindContextMenuForTreeTableCell(ApplicationContext appCtx,
    ObjectProperty<ContextMenu> ctxMenuProperty,
    ReadOnlyObjectProperty<TreeTableRow<T>> tableRowProperty)
{
    tableRowProperty.addListener((property, oldValue, newValue) ->
    {
        // If the containing TreeTableRow disappears, unbind the context menu if any
        if (newValue == null)
        {
            ctxMenuProperty.unbind();
            return;
        }

        // Otherwise, bind the ContextMenu to the TreeItem Property of the containing TreeTable row.
        bindContextMenu(appCtx, ctxMenuProperty, newValue.treeItemProperty());
    });
}
 
开发者ID:jvm-profiling-tools,项目名称:honest-profiler,代码行数:29,代码来源:ContextMenuUtil.java

示例11: initializeTabChangeListener

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
public void initializeTabChangeListener(TabPane tabPane) {

        ReadOnlyObjectProperty<Tab> itemProperty = tabPane.getSelectionModel().selectedItemProperty();

        tabPane.setOnMouseReleased(event -> {
            Optional.ofNullable(itemProperty)
                    .map(ObservableObjectValue::get)
                    .filter(e -> e instanceof MyTab)
                    .map(e -> (MyTab) e)
                    .map(MyTab::getEditorPane)
                    .ifPresent(EditorPane::focus);
        });

        itemProperty.addListener((observable, oldValue, selectedTab) -> {
            Optional.ofNullable(selectedTab)
                    .filter(e -> e instanceof MyTab)
                    .map(e -> (MyTab) e)
                    .map(MyTab::getEditorPane)
                    .filter(EditorPane::getReady)
                    .ifPresent(EditorPane::updatePreviewUrl);
        });
    }
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:23,代码来源:TabService.java

示例12: afterInit

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@PostConstruct
public void afterInit() {
    threadService.runActionLater(() -> {
        getWindow().setMember("afx", controller);
        ReadOnlyObjectProperty<Worker.State> stateProperty = webEngine().getLoadWorker().stateProperty();
        WebView popupView = new WebView();
        Stage stage = new Stage();
        stage.setScene(new Scene(popupView));
        stage.setTitle("AsciidocFX");
        InputStream logoStream = SlidePane.class.getResourceAsStream("/logo.png");
        stage.getIcons().add(new Image(logoStream));
        webEngine().setCreatePopupHandler(param -> {
            if (!stage.isShowing()) {
                stage.show();
                popupView.requestFocus();
            }
            return popupView.getEngine();
        });
        stateProperty.addListener(this::stateListener);
    });
}
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:22,代码来源:SlidePane.java

示例13: viewportBoundsProperty

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
@Override
public ReadOnlyObjectProperty<Rectangle2afp<?, ?, ?, ?, ?, ?>> viewportBoundsProperty() {
	if (this.viewportBounds == null) {
		this.viewportBounds = new ReadOnlyObjectWrapper<>(this, VIEWPORT_BOUNDS_PROPERTY);
		this.viewportBounds.bind(Bindings.createObjectBinding(() -> {
			final double scale = getScaleValue();
			final double visibleAreaWidth = getWidth() / scale;
			final double visibleAreaHeight = getHeight() / scale;
			final double visibleAreaX = getViewportCenterX() - visibleAreaWidth / 2.;
			final double visibleAreaY = getViewportCenterY() - visibleAreaHeight / 2.;
			return new Rectangle2d(visibleAreaX, visibleAreaY, visibleAreaWidth, visibleAreaHeight);
		}, widthProperty(), heightProperty(), viewportCenterXProperty(), viewportCenterYProperty(),
				scaleValueProperty()));
	}
	return this.viewportBounds.getReadOnlyProperty();
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:17,代码来源:ZoomableCanvas.java

示例14: dateControlProperty

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
/**
 * The date control where the entry view is shown.
 *
 * @return the date control
 */
public final ReadOnlyObjectProperty<T> dateControlProperty() {
    if (dateControl == null) {
        dateControl = new ReadOnlyObjectWrapper<>(this, "dateControl", _dateControl); //$NON-NLS-1$
    }

    return dateControl.getReadOnlyProperty();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:13,代码来源:EntryViewBase.java

示例15: startTimeProperty

import javafx.beans.property.ReadOnlyObjectProperty; //导入依赖的package包/类
/**
 * The time where the entry view starts (not the start time of the calendar
 * entry).
 *
 * @return the start time of the view (not of the calendar entry)
 */
public final ReadOnlyObjectProperty<LocalTime> startTimeProperty() {
    if (startTime == null) {
        startTime = new ReadOnlyObjectWrapper<>(this, "startTime", _startTime); //$NON-NLS-1$
    }
    return startTime.getReadOnlyProperty();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:13,代码来源:EntryViewBase.java


注:本文中的javafx.beans.property.ReadOnlyObjectProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。