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


Java Node.prefHeight方法代码示例

本文整理汇总了Java中javafx.scene.Node.prefHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Node.prefHeight方法的具体用法?Java Node.prefHeight怎么用?Java Node.prefHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.Node的用法示例。


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

示例1: layoutChildren

import javafx.scene.Node; //导入方法依赖的package包/类
@Override protected void layoutChildren() {
    double top = getPadding().getTop();
    double left = getPadding().getLeft();
    double right = getPadding().getRight();
    double w = getWidth() - left - right;
    double y = top;
    for(Node child:getChildren()) {
        double prefH = child.prefHeight(w);
        child.resizeRelocate(
            snapPosition(left),
            snapPosition(y),
            snapSize(w),
            snapSize(prefH)
        );
        y += vgap + prefH;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:18,代码来源:FlowSafeVBox.java

示例2: press

import javafx.scene.Node; //导入方法依赖的package包/类
private void press(MouseEvent e) {
  Node node = get();
  if (isEnable() && e.isConsumed() == false && node != null) {
    Corner corner = calcCorner(e);
    if (corner != Corner.CENTER) {
      pressedCorner = corner;
      startX = e.getScreenX();
      startY = e.getScreenY();
      startWidth = width.get() == -1 ? node.prefWidth(-1) : width.get();
      startHeight = height.get() == -1 ? node.prefHeight(-1) : height.get();
      startPosX = node.getLayoutX();
      startPosY = node.getLayoutY();
      e.consume();
    }
  }
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:17,代码来源:ResizeSupport.java

示例3: layoutPlotChildren

import javafx.scene.Node; //导入方法依赖的package包/类
/** @inheritDoc */
@Override
protected void layoutPlotChildren() {
	// update symbol positions
	for (int seriesIndex = 0; seriesIndex < getDataSize(); seriesIndex++) {
		MultiAxisChart.Series<X, Y> series = getData().get(seriesIndex);
		for (Iterator<Data<X, Y>> it = getDisplayedDataIterator(series); it.hasNext();) {
			Data<X, Y> item = it.next();
			double x = getXAxis().getDisplayPosition(item.getCurrentX());
			double y = -1;
			if (item.getExtraValue() == null || (int) item.getExtraValue() == MultiAxisChart.Y1_AXIS) {
				y = getY1Axis().getDisplayPosition(item.getCurrentY());
			} else {
				if (getY2Axis() != null) {
					if (getY2Axis().isVisible()) {
						y = getY2Axis().getDisplayPosition(item.getCurrentY());
					} else {
						continue;
					}
				} else {
					throw new NullPointerException(
							"Data found with Y2_Axis as Y axis while Y2 axis is not defined.");
				}
			}

			if (Double.isNaN(x) || Double.isNaN(y)) {
				continue;
			}
			Node symbol = item.getNode();
			if (symbol != null) {
				final double w = symbol.prefWidth(-1);
				final double h = symbol.prefHeight(-1);
				symbol.resizeRelocate(x - (w / 2), y - (h / 2), w, h);
			}
		}
	}



}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:41,代码来源:MultiAxisScatterChart.java

示例4: computePrefHeight

import javafx.scene.Node; //导入方法依赖的package包/类
@Override protected double computePrefHeight(double width) {
    double height = 0;
    for(Node child:getChildren()) height += vgap + child.prefHeight(width);
    if (!getChildren().isEmpty()) height -= vgap;
    return getPadding().getTop() + height + getPadding().getBottom();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:7,代码来源:FlowSafeVBox.java

示例5: layoutPlotChildren

import javafx.scene.Node; //导入方法依赖的package包/类
/** @inheritDoc */
@Override
protected void layoutPlotChildren() {
	List<LineTo> constructedPath = new ArrayList<>(getDataSize());
	for (int seriesIndex = 0; seriesIndex < getDataSize(); seriesIndex++) {
		MultiAxisChart.Series<X, Y> series = getData().get(seriesIndex);
		DoubleProperty seriesYAnimMultiplier = seriesYMultiplierMap.get(series);
		double lastX = 0;
		final ObservableList<Node> children = ((Group) series.getNode()).getChildren();
		ObservableList<PathElement> seriesLine = ((Path) children.get(1)).getElements();
		ObservableList<PathElement> fillPath = ((Path) children.get(0)).getElements();
		seriesLine.clear();
		fillPath.clear();
		constructedPath.clear();
		for (Iterator<Data<X, Y>> it = getDisplayedDataIterator(series); it.hasNext();) {
			Data<X, Y> item = it.next();
			double x = getXAxis().getDisplayPosition(item.getCurrentX());
			
			double y = -1;
			if (item.getExtraValue() == null || (int) item.getExtraValue() == MultiAxisChart.Y1_AXIS) {
				y = getY1Axis().getDisplayPosition(getY1Axis().toRealValue(
						getY1Axis().toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue()));
			} else {
				if (getY2Axis() != null) {
					if (getY2Axis().isVisible()) {
						y = getY2Axis().getDisplayPosition(getY2Axis().toRealValue(
								getY2Axis().toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue()));
					} else {
						continue;
					}
				} else {
					throw new NullPointerException("Y2 axis is not defined.");
				}
			}
			
			constructedPath.add(new LineTo(x, y));
			if (Double.isNaN(x) || Double.isNaN(y)) {
				continue;
			}
			lastX = x;
			Node symbol = item.getNode();
			if (symbol != null) {
				final double w = symbol.prefWidth(-1);
				final double h = symbol.prefHeight(-1);
				symbol.resizeRelocate(x - (w / 2), y - (h / 2), w, h);
			}
		}

		if (!constructedPath.isEmpty()) {
			Collections.sort(constructedPath, (e1, e2) -> Double.compare(e1.getX(), e2.getX()));
			LineTo first = constructedPath.get(0);

			final double displayYPos = first.getY();
			final double numericYPos = getY1Axis().toNumericValue(getY1Axis().getValueForDisplay(displayYPos));

			// RT-34626: We can't always use getZeroPosition(), as it may be the case
			// that the zero position of the y-axis is not visible on the chart. In these
			// cases, we need to use the height between the point and the y-axis line.
			final double yAxisZeroPos = getY1Axis().getZeroPosition();
			final boolean isYAxisZeroPosVisible = !Double.isNaN(yAxisZeroPos);
			final double yAxisHeight = getY1Axis().getHeight();
			final double yFillPos = isYAxisZeroPosVisible ? yAxisZeroPos
					: numericYPos < 0 ? numericYPos - yAxisHeight : yAxisHeight;

			seriesLine.add(new MoveTo(first.getX(), displayYPos));
			fillPath.add(new MoveTo(first.getX(), yFillPos));

			seriesLine.addAll(constructedPath);
			fillPath.addAll(constructedPath);
			fillPath.add(new LineTo(lastX, yFillPos));
			fillPath.add(new ClosePath());
		}
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:75,代码来源:MultiAxisAreaChart.java

示例6: layoutPlotChildren

import javafx.scene.Node; //导入方法依赖的package包/类
/** @inheritDoc */
@Override
protected void layoutPlotChildren() {
	List<LineTo> constructedPath = new ArrayList<>(getDataSize());
	for (int seriesIndex = 0; seriesIndex < getDataSize(); seriesIndex++) {
		Series<X, Y> series = getData().get(seriesIndex);
		final DoubleProperty seriesYAnimMultiplier = seriesYMultiplierMap.get(series);
		if (series.getNode() instanceof Path) {
			final ObservableList<PathElement> seriesLine = ((Path) series.getNode()).getElements();
			seriesLine.clear();
			constructedPath.clear();
			for (Iterator<Data<X, Y>> it = getDisplayedDataIterator(series); it.hasNext();) {
				Data<X, Y> item = it.next();
				double x = getXAxis().getDisplayPosition(item.getCurrentX());

				double y = -1;
				if (item.getExtraValue() == null || (int) item.getExtraValue() == MultiAxisChart.Y1_AXIS) {
					y = getY1Axis().getDisplayPosition(getY1Axis().toRealValue(
							getY1Axis().toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue()));
				} else {
					if (getY2Axis() != null) {
						if (getY2Axis().isVisible()) {
							y = getY2Axis().getDisplayPosition(
									getY2Axis().toRealValue(getY2Axis().toNumericValue(item.getCurrentY())
											* seriesYAnimMultiplier.getValue()));
						} else {
							continue;
						}
					} else {
						throw new NullPointerException("Y2 axis is not defined.");
					}
				}

				if (Double.isNaN(x) || Double.isNaN(y)) {
					continue;
				}
				constructedPath.add(new LineTo(x, y));

				Node symbol = item.getNode();
				if (symbol != null) {
					final double w = symbol.prefWidth(-1);
					final double h = symbol.prefHeight(-1);
					symbol.resizeRelocate(x - (w / 2), y - (h / 2), w, h);
				}
			}
			switch (getAxisSortingPolicy()) {
			case X_AXIS:
				Collections.sort(constructedPath, (e1, e2) -> Double.compare(e1.getX(), e2.getX()));
				break;
			case Y_AXIS:
				Collections.sort(constructedPath, (e1, e2) -> Double.compare(e1.getY(), e2.getY()));
				break;
			}

			if (!constructedPath.isEmpty()) {
				LineTo first = constructedPath.get(0);
				seriesLine.add(new MoveTo(first.getX(), first.getY()));
				seriesLine.addAll(constructedPath);
			}
		}
	}
}
 
开发者ID:JKostikiadis,项目名称:MultiAxisCharts,代码行数:63,代码来源:MultiAxisLineChart.java

示例7: resetDividerPosition

import javafx.scene.Node; //导入方法依赖的package包/类
/**
 * Resets the divider position to a value that ensures that the detail node will be fully
 * visible at its preferred width or height.
 */
public final void resetDividerPosition() {
    /*
     * Store the current state in order to recreate it once the
     * divider position has been updated.
     */
    boolean wasShowing = isShowDetailNode();
    boolean wasAnimated = isAnimated();

    Node node = getDetailNode();

    if (!wasShowing) {
        setAnimated(false);
        setShowDetailNode(true);

        /*
         * Force CSS pass to ensure that calls to prefWidth/Height will
         * return proper values.
         */
        node.applyCss();
    }

    double ps;

    switch (getDetailSide()) {
        case LEFT:
        case RIGHT:
            ps = node.prefWidth(-1) + 10;
            break;
        case TOP:
        case BOTTOM:
        default:
            ps = node.prefHeight(-1) + 10;
            break;
    }

    double position = 0;

    switch (getDetailSide()) {
        case LEFT:
            position = ps / getWidth();
            break;
        case RIGHT:
            position = 1 - (ps / getWidth());
            break;
        case TOP:
            position = ps / getHeight();
            break;
        case BOTTOM:
            position = 1 - (ps / getHeight());
            break;
    }

    setDividerPosition(position);

    if (!wasShowing) {
        setShowDetailNode(wasShowing);
        setAnimated(wasAnimated);
    }
}
 
开发者ID:dlemmermann,项目名称:JProCalendarFX,代码行数:64,代码来源:CalendarViewSkin.java


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