/** * @return a list of sides that corresponds to the current drawers order */ public List<Side> getOpenedDrawersOrder() { List<Side> order = new ArrayList<>(); for (int i = 0, drawersSize = drawers.size(); i < drawersSize; i++) { final JFXDrawer jfxDrawer = drawers.get(i); if (jfxDrawer.isOpened()) { order.add(Side.valueOf(jfxDrawer.getDirection().toString())); } } return order; } }
private void show(Side side) { if (hideTimeline != null) { hideTimeline.stop(); } if (showTimeline != null && showTimeline.getStatus() == Status.RUNNING) { return; } KeyValue[] keyValues = new KeyValue[Side.values().length]; for (Side s : Side.values()) { keyValues[s.ordinal()] = new KeyValue(visibility[s.ordinal()], s.equals(side) ? 1 : 0); } Duration delay = getSkinnable().getAnimationDelay() != null ? getSkinnable() .getAnimationDelay() : Duration.millis(300); Duration duration = getSkinnable().getAnimationDuration() != null ? getSkinnable() .getAnimationDuration() : Duration.millis(200); KeyFrame keyFrame = new KeyFrame(duration, keyValues); showTimeline = new Timeline(keyFrame); showTimeline.setDelay(delay); showTimeline.play(); }
private double getLength() { if ( getSide().isHorizontal() ) return getWidth(); else return getHeight(); }
protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { double w = text.prefWidth(height); if (getSkinnable().getGraphic() != null && iconPosition().isVertical()) w += Math.max(getSkinnable().getGraphic().prefWidth(-1), graphicFixedSize()); return w + leftInset + rightInset; }
double prefHeight = bottom.prefHeight(-1); double offset = prefHeight * visibility[Side.BOTTOM.ordinal()].get(); bottom.resizeRelocate(contentX, contentY + contentHeight - offset, contentWidth, prefHeight); bottom.setVisible(visibility[Side.BOTTOM.ordinal()].get() > 0); if (left != null) { double prefWidth = left.prefWidth(-1); double offset = prefWidth * visibility[Side.LEFT.ordinal()].get(); left.resizeRelocate(contentX - (prefWidth - offset), contentY, prefWidth, contentHeight); left.setVisible(visibility[Side.LEFT.ordinal()].get() > 0); if (right != null) { double prefWidth = right.prefWidth(-1); double offset = prefWidth * visibility[Side.RIGHT.ordinal()].get(); right.resizeRelocate(contentX + contentWidth - offset, contentY, prefWidth, contentHeight); right.setVisible(visibility[Side.RIGHT.ordinal()].get() > 0); if (top != null) { double prefHeight = top.prefHeight(-1); double offset = prefHeight * visibility[Side.TOP.ordinal()].get(); top.resizeRelocate(contentX, contentY - (prefHeight - offset), contentWidth, prefHeight); top.setVisible(visibility[Side.TOP.ordinal()].get() > 0);
protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { if (iconPosition().isHorizontal()) return acc(n -> n.minHeight(width)); else return biggest(n -> n.minHeight(width)); }
inner.setAlignment(Pos.CENTER); inner.getStyleClass().add("tab-container"); inner.setRotate(getSkinnable().getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F);
private double getLabelSize() { Dimension2D dim = measureTickMarkLabelSize( "-888.88E-88", getTickLabelRotation() ); if ( getSide().isHorizontal() ) { return dim.getWidth(); } else { return dim.getHeight(); } }
/** * @return a list of sides that corresponds to the current drawers order */ public List<Side> getOpenedDrawersOrder() { List<Side> order = new ArrayList<>(); for (int i = 0, drawersSize = drawers.size(); i < drawersSize; i++) { final JFXDrawer jfxDrawer = drawers.get(i); if (jfxDrawer.isOpened()) { order.add(Side.valueOf(jfxDrawer.getDirection().toString())); } } return order; } }
protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) { if (iconPosition().isHorizontal()) return biggest(n -> n.minWidth(height)); else return acc(n -> n.minWidth(height)); }
protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) { double h = text.prefHeight(width); if (getSkinnable().getGraphic() != null && iconPosition().isHorizontal()) h += Math.max(getSkinnable().getGraphic().prefHeight(-1), graphicFixedSize()); return h + topInset + bottomInset; }
private double calculateNewFirstPos(double length, double catSpacing) { final Side side = getSide(); double newPos = 1; if (side != null) { double offset = ((isGapStartAndEnd()) ? (catSpacing / 2) : (0)); if (side.equals(Side.TOP) || side.equals(Side.BOTTOM)) { // HORIZONTAL newPos = 0 + getStartMargin() + offset; } else { // VERTICAL newPos = length - getStartMargin() - offset; } } // if autoranging is off setRange is not called so we update first // cateogory pos. if (!isAutoRanging()) { firstCategoryPos.set(newPos); } return newPos; }
/** * Get the data value for the given display position on this axis. If the * axis is a CategoryAxis this will be the nearest value. * * @param displayPosition * A pixel position on this axis * @return the nearest data value to the given pixel position or null if not * on axis; */ @Override public CalendarNode getValueForDisplay(double displayPosition) { if (getSide().equals(Side.TOP) || getSide().equals(Side.BOTTOM)) { // HORIZONTAL if (displayPosition < 0 || displayPosition > getHeight()) { return null; } double d = (displayPosition - firstCategoryPos.get()) / categorySpacing.get(); return toRealValue(d); } else { // VERTICAL if (displayPosition < 0 || displayPosition > getWidth()) { return null; } double d = (displayPosition - firstCategoryPos.get()) / (categorySpacing.get() * -1); return toRealValue(d); } }
inner.setAlignment(Pos.CENTER); inner.getStyleClass().add("tab-container"); inner.setRotate(getSkinnable().getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F);