private static class StyleableProperties {
    private static final CssMetaData<ProgressCircleIndicator, Number> INNER_CIRCLE_RADIUS =
        new CssMetaData<ProgressCircleIndicator, Number>(
            "-fx-inner-radius", SizeConverter.getInstance(), 60) {

          @Override
          public boolean isSettable(ProgressCircleIndicator n) {
            return n.innerCircleRadiusProperty() == null
                || !n.innerCircleRadiusProperty().isBound();
          }

          @Override
          public StyleableProperty<Number> getStyleableProperty(ProgressCircleIndicator n) {
            return (StyleableProperty<Number>) n.innerCircleRadiusProperty();
          }
        };

    public static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;

    static {
      final List<CssMetaData<? extends Styleable, ?>> styleables =
          new ArrayList<>(Control.getClassCssMetaData());
      styleables.add(INNER_CIRCLE_RADIUS);
      STYLEABLES = Collections.unmodifiableList(styleables);
    }
  }
Exemplo n.º 2
0
  private static class StyleableProperties {
    private static final CssMetaData<ScrollBar, Orientation> ORIENTATION =
        new CssMetaData<ScrollBar, Orientation>(
            "-fx-orientation",
            new EnumConverter<Orientation>(Orientation.class),
            Orientation.HORIZONTAL) {

          @Override
          public Orientation getInitialValue(ScrollBar node) {
            // A vertical ScrollBar should remain vertical
            return node.getOrientation();
          }

          @Override
          public boolean isSettable(ScrollBar n) {
            return n.orientation == null || !n.orientation.isBound();
          }

          @Override
          public StyleableProperty<Orientation> getStyleableProperty(ScrollBar n) {
            return (StyleableProperty<Orientation>) n.orientationProperty();
          }
        };

    private static final CssMetaData<ScrollBar, Number> UNIT_INCREMENT =
        new CssMetaData<ScrollBar, Number>("-fx-unit-increment", SizeConverter.getInstance(), 1.0) {

          @Override
          public boolean isSettable(ScrollBar n) {
            return n.unitIncrement == null || !n.unitIncrement.isBound();
          }

          @Override
          public StyleableProperty<Number> getStyleableProperty(ScrollBar n) {
            return (StyleableProperty<Number>) n.unitIncrementProperty();
          }
        };

    private static final CssMetaData<ScrollBar, Number> BLOCK_INCREMENT =
        new CssMetaData<ScrollBar, Number>(
            "-fx-block-increment", SizeConverter.getInstance(), 10.0) {

          @Override
          public boolean isSettable(ScrollBar n) {
            return n.blockIncrement == null || !n.blockIncrement.isBound();
          }

          @Override
          public StyleableProperty<Number> getStyleableProperty(ScrollBar n) {
            return (StyleableProperty<Number>) n.blockIncrementProperty();
          }
        };

    private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;

    static {
      final List<CssMetaData<? extends Styleable, ?>> styleables =
          new ArrayList<CssMetaData<? extends Styleable, ?>>(Control.getClassCssMetaData());
      styleables.add(ORIENTATION);
      styleables.add(UNIT_INCREMENT);
      styleables.add(BLOCK_INCREMENT);
      STYLEABLES = Collections.unmodifiableList(styleables);
    }
  }
Exemplo n.º 3
0
  /**
   * Super-lazy instantiation pattern from Bill Pugh.
   *
   * @treatAsPrivate implementation detail
   */
  private static class StyleableProperties {

    private static final CssMetaData<FlowPane, Pos> ALIGNMENT =
        new CssMetaData<FlowPane, Pos>(
            "-fx-alignment", new EnumConverter<Pos>(Pos.class), Pos.TOP_LEFT) {

          @Override
          public boolean isSettable(FlowPane node) {
            return node.alignment == null || !node.alignment.isBound();
          }

          @Override
          public StyleableProperty<Pos> getStyleableProperty(FlowPane node) {
            return (StyleableProperty<Pos>) node.alignmentProperty();
          }
        };

    private static final CssMetaData<FlowPane, HPos> COLUMN_HALIGNMENT =
        new CssMetaData<FlowPane, HPos>(
            "-fx-column-halignment", new EnumConverter<HPos>(HPos.class), HPos.LEFT) {

          @Override
          public boolean isSettable(FlowPane node) {
            return node.columnHalignment == null || !node.columnHalignment.isBound();
          }

          @Override
          public StyleableProperty<HPos> getStyleableProperty(FlowPane node) {
            return (StyleableProperty<HPos>) node.columnHalignmentProperty();
          }
        };

    private static final CssMetaData<FlowPane, Number> HGAP =
        new CssMetaData<FlowPane, Number>("-fx-hgap", SizeConverter.getInstance(), 0.0) {

          @Override
          public boolean isSettable(FlowPane node) {
            return node.hgap == null || !node.hgap.isBound();
          }

          @Override
          public StyleableProperty<Number> getStyleableProperty(FlowPane node) {
            return (StyleableProperty<Number>) node.hgapProperty();
          }
        };

    private static final CssMetaData<FlowPane, VPos> ROW_VALIGNMENT =
        new CssMetaData<FlowPane, VPos>(
            "-fx-row-valignment", new EnumConverter<VPos>(VPos.class), VPos.CENTER) {

          @Override
          public boolean isSettable(FlowPane node) {
            return node.rowValignment == null || !node.rowValignment.isBound();
          }

          @Override
          public StyleableProperty<VPos> getStyleableProperty(FlowPane node) {
            return (StyleableProperty<VPos>) node.rowValignmentProperty();
          }
        };

    private static final CssMetaData<FlowPane, Orientation> ORIENTATION =
        new CssMetaData<FlowPane, Orientation>(
            "-fx-orientation",
            new EnumConverter<Orientation>(Orientation.class),
            Orientation.HORIZONTAL) {

          @Override
          public Orientation getInitialValue(FlowPane node) {
            // A vertical flow pane should remain vertical
            return node.getOrientation();
          }

          @Override
          public boolean isSettable(FlowPane node) {
            return node.orientation == null || !node.orientation.isBound();
          }

          @Override
          public StyleableProperty<Orientation> getStyleableProperty(FlowPane node) {
            return (StyleableProperty<Orientation>) node.orientationProperty();
          }
        };

    private static final CssMetaData<FlowPane, Number> VGAP =
        new CssMetaData<FlowPane, Number>("-fx-vgap", SizeConverter.getInstance(), 0.0) {

          @Override
          public boolean isSettable(FlowPane node) {
            return node.vgap == null || !node.vgap.isBound();
          }

          @Override
          public StyleableProperty<Number> getStyleableProperty(FlowPane node) {
            return (StyleableProperty<Number>) node.vgapProperty();
          }
        };

    private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;

    static {
      final List<CssMetaData<? extends Styleable, ?>> styleables =
          new ArrayList<CssMetaData<? extends Styleable, ?>>(Region.getClassCssMetaData());
      styleables.add(ALIGNMENT);
      styleables.add(COLUMN_HALIGNMENT);
      styleables.add(HGAP);
      styleables.add(ROW_VALIGNMENT);
      styleables.add(ORIENTATION);
      styleables.add(VGAP);

      STYLEABLES = Collections.unmodifiableList(styleables);
    }
  }
  /** Super-lazy instantiation pattern from Bill Pugh. */
  @SuppressWarnings({"deprecation", "unchecked", "ConstantConditions"})
  private static class StyleableProperties {
    public static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;

    private static final CssMetaData<ConfidenceProgressIndicator, Paint> PROGRESS_COLOR =
        new CssMetaData<ConfidenceProgressIndicator, Paint>(
            "-fx-progress-color", PaintConverter.getInstance(), null) {

          @Override
          public boolean isSettable(ConfidenceProgressIndicator n) {
            final ConfidenceProgressIndicatorSkin skin =
                (ConfidenceProgressIndicatorSkin) n.getSkin();
            return skin.progressColor == null || !skin.progressColor.isBound();
          }

          @Override
          public StyleableProperty<Paint> getStyleableProperty(ConfidenceProgressIndicator n) {
            final ConfidenceProgressIndicatorSkin skin =
                (ConfidenceProgressIndicatorSkin) n.getSkin();
            return (StyleableProperty<Paint>) skin.progressColor;
          }
        };

    private static final CssMetaData<ConfidenceProgressIndicator, Number>
        INDETERMINATE_SEGMENT_COUNT =
            new CssMetaData<ConfidenceProgressIndicator, Number>(
                "-fx-indeterminate-segment-count", SizeConverter.getInstance(), 8) {

              @Override
              public void set(ConfidenceProgressIndicator node, Number value, StyleOrigin origin) {
                super.set(node, value.intValue(), origin);
              }

              @Override
              public boolean isSettable(ConfidenceProgressIndicator n) {
                final ConfidenceProgressIndicatorSkin skin =
                    (ConfidenceProgressIndicatorSkin) n.getSkin();
                return skin.indeterminateSegmentCount == null
                    || !skin.indeterminateSegmentCount.isBound();
              }

              @Override
              public StyleableProperty<Number> getStyleableProperty(ConfidenceProgressIndicator n) {
                final ConfidenceProgressIndicatorSkin skin =
                    (ConfidenceProgressIndicatorSkin) n.getSkin();
                return (StyleableProperty<Number>) skin.indeterminateSegmentCount;
              }
            };

    private static final CssMetaData<ConfidenceProgressIndicator, Boolean> SPIN_ENABLED =
        new CssMetaData<ConfidenceProgressIndicator, Boolean>(
            "-fx-spin-enabled", BooleanConverter.getInstance(), Boolean.FALSE) {

          @Override
          public boolean isSettable(ConfidenceProgressIndicator node) {
            final ConfidenceProgressIndicatorSkin skin =
                (ConfidenceProgressIndicatorSkin) node.getSkin();
            return skin.spinEnabled == null || !skin.spinEnabled.isBound();
          }

          @Override
          public StyleableProperty<Boolean> getStyleableProperty(ConfidenceProgressIndicator node) {
            final ConfidenceProgressIndicatorSkin skin =
                (ConfidenceProgressIndicatorSkin) node.getSkin();
            return (StyleableProperty<Boolean>) skin.spinEnabled;
          }
        };

    static {
      final List<CssMetaData<? extends Styleable, ?>> styleables =
          new ArrayList<>(SkinBase.getClassCssMetaData());
      styleables.add(PROGRESS_COLOR);
      styleables.add(INDETERMINATE_SEGMENT_COUNT);
      styleables.add(SPIN_ENABLED);
      STYLEABLES = Collections.unmodifiableList(styleables);
    }
  }