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


Java Insets.getTop方法代码示例

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


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

示例1: layoutChildren

import javafx.geometry.Insets; //导入方法依赖的package包/类
@Override
protected void layoutChildren() {
    Insets insets = getInsets();

    double top = insets.getTop();
    double bottom = insets.getBottom();
    double left = insets.getLeft();
    double right = insets.getRight();

    double w = getWidth();
    double h = getHeight();

    double availableHeight = h - top - bottom;

    double ps1 = dayOfMonthLabel.prefWidth(-1);
    double ps2 = dayOfWeekLabel.prefWidth(-1);
    double ps4 = counterLabel.prefWidth(-1);

    double ph = counterLabel.prefHeight(-1);

    dayOfMonthLabel.resizeRelocate(left, top, ps1, availableHeight);
    dayOfWeekLabel.resizeRelocate(left + ps1, top, ps2, availableHeight);

    // center the counter label, do not let it use the entire height
    counterLabel.resizeRelocate(w - right - ps4, top + availableHeight / 2 - ph / 2, ps4, Math.min(availableHeight, ph));
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:27,代码来源:MonthSheetView.java

示例2: computePrefHeight

import javafx.geometry.Insets; //导入方法依赖的package包/类
@Override
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {

    List<AllDayEntryView> entryViews = getChildren().stream().filter(node -> node instanceof AllDayEntryView).map(node -> (AllDayEntryView) node).collect(Collectors.toList());

    List<Placement> placements = Resolver.resolve(entryViews);

    int maxPosition = 0;
    for (Placement p : placements) {
        maxPosition = Math.max(maxPosition, p.getColumnIndex());
    }

    Insets insets = getSkinnable().getInsets();
    Insets extraPadding = getSkinnable().getExtraPadding();

    double rowHeight = getSkinnable().getRowHeight();
    double rowSpacing = getSkinnable().getRowSpacing();
    return (maxPosition + 1) * rowHeight + (maxPosition * rowSpacing) + insets.getTop() + insets.getBottom() * extraPadding.getTop() + extraPadding.getBottom();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:20,代码来源:AllDayViewSkin.java

示例3: layoutChildren

import javafx.geometry.Insets; //导入方法依赖的package包/类
@Override
protected void layoutChildren() {
    Insets insets = getInsets();

    double top = insets.getTop();
    double bottom = insets.getBottom();
    double left = insets.getLeft();
    double right = insets.getRight();

    double w = getWidth();
    double h = getHeight();

    double availableHeight = h - top - bottom;

    double ps1 = dayOfMonthLabel.prefWidth(-1);
    double ps2 = dayOfWeekLabel.prefWidth(-1);
    double ps3 = icon.prefWidth(-1);

    dayOfMonthLabel.resizeRelocate(left, top, ps1, availableHeight);
    dayOfWeekLabel.resizeRelocate(left + ps1, top, ps2, availableHeight);
    icon.resizeRelocate(w - right - ps3, (availableHeight - icon.prefHeight(-1)) / 2, ps3, availableHeight);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:23,代码来源:WeatherApp.java

示例4: layoutChildren

import javafx.geometry.Insets; //导入方法依赖的package包/类
@Override
protected void layoutChildren() {
    super.layoutChildren();

    switch (dayView.getHoursLayoutStrategy()) {
        case FIXED_HOUR_COUNT:
            double height = getHeight();
            int visibleHours = dayView.getVisibleHours();
            dayView.setHourHeight(Math.max(1, height / visibleHours)); // height must be at least 1px
            break;
        case FIXED_HOUR_HEIGHT:
            break;
    }

    Insets insets = getInsets();


    final double ph = dayView.prefHeight(-1);
    dayView.resizeRelocate(
            snapPosition(insets.getLeft()),
            snapPosition(insets.getTop()),
            snapSize(getWidth() - insets.getLeft() - insets.getRight()),
            snapSize(Math.max(ph, getHeight() - insets.getTop() - insets.getBottom())));

    switch (dayView.getHoursLayoutStrategy()) {
        case FIXED_HOUR_COUNT:
            if (cachedStartTime != null) {
                dayView.setTranslateY(-ViewHelper.getTimeLocation(dayView, cachedStartTime, true));
            }
            break;
        case FIXED_HOUR_HEIGHT:
            break;
    }

    if (dayView.getTranslateY() + dayView.getHeight() < getHeight() - insets.getTop() - insets.getBottom()) {
        dayView.setTranslateY(getMaxTranslateY(insets));
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:39,代码来源:DayViewScrollPane.java

示例5: getMaxTranslateY

import javafx.geometry.Insets; //导入方法依赖的package包/类
private double getMaxTranslateY(Insets insets) {
    return (getHeight() - insets.getTop() - insets.getBottom()) - dayView.getHeight();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:4,代码来源:DayViewScrollPane.java

示例6: layoutChildren

import javafx.geometry.Insets; //导入方法依赖的package包/类
@Override
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
    super.layoutChildren(contentX, contentY, contentWidth, contentHeight);

    double rowHeight = getSkinnable().getRowHeight();
    double rowSpacing = getSkinnable().getRowSpacing();

    double height = 0;

    Insets extraPadding = getSkinnable().getExtraPadding();

    List<AllDayEntryView> entryViews = getChildren().stream().filter(node -> node instanceof AllDayEntryView).map(node -> (AllDayEntryView) node).collect(Collectors.toList());

    List<Placement> placements = Resolver.resolve(entryViews);

    for (Placement placement : placements) {
        EntryViewBase<?> view = placement.getEntryView();
        Entry<?> entry = view.getEntry();

        LocalDate startDate = getSkinnable().getDate();
        if (getSkinnable().isAdjustToFirstDayOfWeek()) {
            startDate = Util.adjustToFirstDayOfWeek(getSkinnable().getDate(), getSkinnable().getFirstDayOfWeek());
        }

        LocalDate endDate = startDate.plusDays(getSkinnable().getNumberOfDays() - 1);

        long deltaDays = ChronoUnit.DAYS.between(startDate, entry.getStartDate());

        long entryDurationInDays = ChronoUnit.DAYS.between(entry.getStartDate(), entry.getEndDate()) + 1;

        if (deltaDays < 0) {
            entryDurationInDays += deltaDays;
        }

        if (entry.getStartDate().isBefore(startDate)) {
            view.getProperties().put("startDate", startDate); //$NON-NLS-1$
        } else {
            view.getProperties().put("startDate", entry.getStartDate()); //$NON-NLS-1$
        }

        if (entry.getEndDate().isAfter(endDate)) {
            view.getProperties().put("endDate", endDate); //$NON-NLS-1$
        } else {
            view.getProperties().put("endDate", entry.getEndDate()); //$NON-NLS-1$
        }

        entryDurationInDays = Math.max(entryDurationInDays, 1);

        double dayWidth = contentWidth / getSkinnable().getNumberOfDays();

        double x = Math.max(0, contentX + (deltaDays * dayWidth));
        double y = contentY + placement.getColumnIndex() * (rowHeight + rowSpacing) + extraPadding.getTop();

        double w;
        if (getSkinnable().getNumberOfDays() == 1) {
            w = contentWidth + 1;
        } else {
            w = Math.min(entryDurationInDays * dayWidth - getSkinnable().getColumnSpacing(), contentWidth - x);
        }

        view.setMaxHeight(rowHeight);

        view.resizeRelocate(snapPosition(x), snapPosition(y), snapSize(w), snapSize(rowHeight));

        height = Math.max(height, y + rowHeight);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:68,代码来源:AllDayViewSkin.java


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