Java Code Examples for javafx.scene.layout.CornerRadii

The following examples show how to use javafx.scene.layout.CornerRadii. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Open-Lowcode   Source File: ClientDisplay.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * displays a message in the status bar
 * 
 * @param message     the message to show
 * @param showaserror if true, message is shown as error (in yellow), if false,
 *                    displays it as simple text
 */
public void updateStatusBar(String message, boolean showaserror) {
	if (showaserror) {
		Platform.runLater(new Thread() {
			@Override
			public void run() {
				try {
					Date date = new Date();
					String output = "" + sdf.format(date) + " " + message;
					logger.info(output);
					statuslabel.setBackground(
							new Background(new BackgroundFill(Color.YELLOW, CornerRadii.EMPTY, Insets.EMPTY)));
					statuslabel.setText(output);
				} catch (Exception e) {
					logger.warning("Exception in setting status bar " + e.getMessage());
					for (int i = 0; i < e.getStackTrace().length; i++) {
						String element = e.getStackTrace()[i].toString();
						if (element.startsWith("org.openlowcode"))
							logger.warning(e.getStackTrace()[i].toString());
					}
				}
			}
		});
	} else
		updateStatusBar(message);
}
 
Example 2
Source Project: JFoenix   Source File: JFXTextAreaSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    super.layoutChildren(x, y, w, h);

    final double height = getSkinnable().getHeight();
    linesWrapper.layoutLines(x, y, w, h, height, promptText == null ? 0 : promptText.getLayoutBounds().getHeight() + 3);
    errorContainer.layoutPane(x, height + linesWrapper.focusedLine.getHeight(), w, h);
    linesWrapper.updateLabelFloatLayout();


    if (invalid) {
        invalid = false;
        // set the default background of text area viewport to white
        Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
        viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
            CornerRadii.EMPTY,
            Insets.EMPTY)));
        // reapply css of scroll pane in case set by the user
        viewPort.applyCss();
        errorContainer.invalid(w);
        // focus
        linesWrapper.invalid();
    }
}
 
Example 3
Source Project: medusademo   Source File: CustomGaugeSkinDemo.java    License: Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    HBox pane = new HBox(gauge0, gauge1, gauge2, gauge3, gauge4, gauge5, gauge6, gauge7, gauge8, gauge9);
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10));
    pane.setPrefWidth(400);

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Custom Gauge Skin");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 4
Source Project: medusademo   Source File: Test.java    License: Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(50, 50, 50), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Test");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");

}
 
Example 5
Source Project: Medusa   Source File: FlatSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));

    setBarColor(gauge.getCurrentValue());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
    titleText.setFill(gauge.getTitleColor());
    separator.setStroke(gauge.getBorderPaint());

    titleText.setText(gauge.getTitle());
    resizeTitleText();

    unitText.setText(gauge.getUnit());
    resizeUnitText();
}
 
Example 6
Source Project: Medusa   Source File: RoundLcdClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    ZonedDateTime time = clock.getTime();

    hourColor       = clock.getHourColor();
    minuteColor     = clock.getMinuteColor();
    fiveMinuteColor = minuteColor.darker();
    secondColor     = clock.getSecondColor();
    titleColor      = clock.getTitleColor();
    textColor       = clock.getTextColor();
    dateColor       = clock.getDateColor();
    alarmColor      = clock.getAlarmColor();

    drawBackground();
    drawForeground(time);
    drawHours(time);
    drawMinutes(time);
    drawSeconds(time);
}
 
Example 7
Source Project: Medusa   Source File: SlimClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    
    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondArc.setStroke(clock.getSecondColor());

    hour.setFill(clock.getHourColor());
    minute.setFill(clock.getMinuteColor());
    
    dateText.setFill(clock.getDateColor());
    dateNumbers.setFill(clock.getDateColor());

    hour.setFill(clock.getHourColor());
    minute.setFill(clock.getMinuteColor());

    ZonedDateTime time = clock.getTime();
    updateTime(time);
}
 
Example 8
Source Project: Medusa   Source File: DashboardSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    barBackground.setFill(gauge.getBarBackgroundColor());
    barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    setBarColor(gauge.getCurrentValue());

    dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    threshold.setStroke(gauge.getThresholdColor());
    double thresholdInnerRadius = 0.3 * height;
    double thresholdOuterRadius = 0.675 * height;
    double thresholdAngle       = Helper.clamp(90.0, 270.0, (gauge.getThreshold() - minValue) * angleStep + 90.0);
    threshold.setStartX(centerX + thresholdInnerRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setStartY(centerX + thresholdInnerRadius * Math.cos(-Math.toRadians(thresholdAngle)));
    threshold.setEndX(centerX + thresholdOuterRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setEndY(centerX + thresholdOuterRadius * Math.cos(-Math.toRadians(thresholdAngle)));

    redrawText();
}
 
Example 9
Source Project: Medusa   Source File: DesignClockSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    tickCanvas.setCache(false);
    drawTicks();
    tickCanvas.setCache(true);
    tickCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);
}
 
Example 10
Source Project: OEE-Designer   Source File: SunburstChart.java    License: MIT License 6 votes vote down vote up
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
 
Example 11
Source Project: paintera   Source File: OverlayPane.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 */
public OverlayPane()
{
	super();
	super.getChildren().add(canvasPane);
	setBackground(new Background(new BackgroundFill(Color.BLACK.deriveColor(0.0, 1.0, 1.0, 0.0), CornerRadii.EMPTY, Insets.EMPTY)));

	this.overlayRenderers = new CopyOnWriteArrayList<>();

	final ChangeListener<Number> sizeChangeListener = (observable, oldValue, newValue)
			-> {
		final double wd = widthProperty().get();
		final double hd = heightProperty().get();
		final int    w  = (int) wd;
		final int    h  = (int) hd;
		if (w <= 0 || h <= 0)
			return;
		overlayRenderers.forEach(or -> or.setCanvasSize(w, h));
		layout();
		drawOverlays();
	};

	widthProperty().addListener(sizeChangeListener);
	heightProperty().addListener(sizeChangeListener);

}
 
Example 12
Source Project: mars-sim   Source File: TilesfxClock.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("restriction")
@Override public void start(Stage stage) {

       HBox pane = new HBox(20, days, hours, minutes, seconds);
       pane.setPadding(new Insets(10));
       pane.setBackground(new Background(new BackgroundFill(Color.web("#606060"), CornerRadii.EMPTY, Insets.EMPTY)));

       //Scene scene = new Scene(pane);

       PerspectiveCamera camera = new PerspectiveCamera();
       camera.setFieldOfView(7);

       Scene scene = new Scene(pane);
       scene.setCamera(camera);
       
       stage.setTitle("Countdown");
       stage.setScene(scene);
       stage.show();

       timer.start();
   }
 
Example 13
Source Project: phoebus   Source File: ThermometerRepresentation.java    License: Eclipse Public License 1.0 6 votes vote down vote up
Thermo(Color color)
{
    setFill(color);

    fill.setArcHeight(6);
    fill.setArcWidth(6);
    fill.setManaged(false);
    border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
            new Stop(0, Color.LIGHTGRAY),
            new Stop(.3, Color.WHITESMOKE),
            new Stop(1, Color.LIGHTGRAY)));
    border.setStroke(Color.BLACK);
    arc.setLargeArcFlag(true);
    rightcorner.setY(0);

    getChildren().add(border);
    getChildren().add(fill);
    getChildren().add(ellipse);
    setBorder(new Border(
            new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
 
Example 14
Source Project: phoebus   Source File: RegionBaseRepresentation.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/** Create alarm-based border
 *  @param severity AlarmSeverity
 *  @param corners CornerRadii
 *  @return Border
 */
private static Border createAlarmBorder(final AlarmSeverity severity, final CornerRadii corners)
{
    switch (severity)
    {
    case NONE:
        // No alarm -> no border
        return null;
    case MINOR:
        // Minor -> Simple border
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, normal));
    case MAJOR:
        // Major -> Double border
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, thin),
                          new BorderStroke(alarm_colors[severity.ordinal()], solid, corners, thin, new Insets(-2*thin.getTop())));
    case INVALID:
        // Invalid -> Border is cleverly interrupted just like the communication to the control system
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], dash_dotted, corners, normal));
    case UNDEFINED:
    default:
        // Disconnected -> Dotted
        return new Border(new BorderStroke(alarm_colors[severity.ordinal()], dotted, corners, wide));
    }
}
 
Example 15
Source Project: medusademo   Source File: CombinedGauges.java    License: Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    Pane pane = new Pane(bigGauge, smallGauge);
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
    bigGauge.relocate(0, 0);
    smallGauge.relocate(0, 230);

    Scene scene = new Scene(pane);

    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 16
Source Project: phoebus   Source File: TextSymbolRepresentation.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Label createJFXNode ( ) throws Exception {

    Label symbol = new Label();

    symbol.setAlignment(JFXUtil.computePos(model_widget.propHorizontalAlignment().getValue(), model_widget.propVerticalAlignment().getValue()));
    symbol.setBackground(model_widget.propTransparent().getValue()
        ? null
        : new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY))
    );
    symbol.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
    symbol.setTextFill(JFXUtil.convert(model_widget.propForegroundColor().getValue()));
    symbol.setText("\u263A");

    enabled = model_widget.propEnabled().getValue();

    Styles.update(symbol, Styles.NOT_ENABLED, !enabled);

    return symbol;

}
 
Example 17
Source Project: phoebus   Source File: AlarmTreeView.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/** @param model Model to represent. Must <u>not</u> be running, yet */
public AlarmTreeView(final AlarmClient model)
{
    if (model.isRunning())
        throw new IllegalStateException();

    changing.setTextFill(Color.WHITE);
    changing.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));

    this.model = model;

    tree_view.setShowRoot(false);
    tree_view.setCellFactory(view -> new AlarmTreeViewCell());
    tree_view.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    setTop(createToolbar());
    setCenter(tree_view);

    tree_view.setRoot(createViewItem(model.getRoot()));

    model.addListener(this);

    createContextMenu();
    addClickSupport();
    addDragSupport();
}
 
Example 18
Source Project: phoebus   Source File: AnnunciatorTable.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Set the color of the cell if muted is <code>true</code>.
 * @param muted - boolean
 */
protected void setMutedColor(final boolean muted)
{
    final int rowIndex = getTableRow().getIndex();
    // Determine the row specific color.
    final String rowColor       = rowIndex % 2 == 0 ? WHITE  : OFF_WHITE;
    final String mutedRowColor  = rowIndex % 2 == 0 ? ORANGE : OFF_ORANGE;

    // Color the cells if muted, leave them the row color otherwise.
    String color = (muted) ? mutedRowColor : rowColor;

    setBackground( new Background( new BackgroundFill(
                                    Paint.valueOf(color), // Set the color.
                                    new CornerRadii(0),   // We want square cells.
                                    new Insets(1))));     // Don't color over the cell borders.

    /*
     * Upon row selection, the table will update the text color based on the darkness of the ROW background.
     * Not the cell background. So the cell may have a white background, but the row could be blue when selected.
     * This blue color would trigger the table to set the cell's text color to white to provide a nice contrast.
     * Only the white text would be displayed on the cell's white background, not the blue background of the
     * table row. To prevent this, set the cell's text color to always be black when drawn on a background.
     */
    setStyle("-fx-text-background-color: black;");
}
 
Example 19
Source Project: medusademo   Source File: CustomGaugeSkin.java    License: Apache License 2.0 6 votes vote down vote up
private void initGraphics() {
    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();

    foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    foregroundCtx    = foregroundCanvas.getGraphicsContext2D();

    ledInnerShadow   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
    ledDropShadow    = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);

    pane = new Pane(backgroundCanvas, foregroundCanvas);
    pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
 
Example 20
Source Project: Medusa   Source File: SlimSkin.java    License: Apache License 2.0 6 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    titleText.setText(gauge.getTitle());
    unitText.setText(gauge.getUnit());
    resizeStaticText();

    barBackground.setStroke(gauge.getBarBackgroundColor());
    setBarColor(gauge.getCurrentValue());
    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
}
 
Example 21
Source Project: diirt   Source File: ProbeController.java    License: MIT License 5 votes vote down vote up
private static Map<AlarmSeverity, Border> createBorderMap() {
    Map<AlarmSeverity, Border> map = new EnumMap<>(AlarmSeverity.class);
    map.put(AlarmSeverity.NONE, null);
    map.put(AlarmSeverity.MINOR, new Border(new BorderStroke(Color.YELLOW, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2))));
    map.put(AlarmSeverity.MAJOR, new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2))));
    map.put(AlarmSeverity.INVALID, new Border(new BorderStroke(Color.PURPLE, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2))));
    map.put(AlarmSeverity.UNDEFINED, new Border(new BorderStroke(Color.PURPLE, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(2))));
    return Collections.unmodifiableMap(map);
}
 
Example 22
Source Project: JFoenix   Source File: JFXCheckBoxSkin.java    License: Apache License 2.0 5 votes vote down vote up
private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) {
    if (indeterminate == null) {
        indeterminate = false;
    }
    indeterminateTransition.setRate(indeterminate ? 1 : -1);
    if (playAnimation) {
        indeterminateTransition.play();
    } else {
        if (indeterminate) {
            CornerRadii radii = indeterminateMark.getBackground() == null ?
                null : indeterminateMark.getBackground().getFills().get(0).getRadii();
            Insets insets = indeterminateMark.getBackground() == null ?
                null : indeterminateMark.getBackground().getFills().get(0).getInsets();
            indeterminateMark.setOpacity(1);
            indeterminateMark.setScaleY(1);
            indeterminateMark.setScaleX(1);
            indeterminateMark.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
            indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration());
        } else {
            indeterminateMark.setOpacity(0);
            indeterminateMark.setScaleY(0);
            indeterminateMark.setScaleX(0);
            indeterminateTransition.playFrom(Duration.ZERO);
        }
    }

    if (getSkinnable().isSelected()) {
        playSelectAnimation(!indeterminate, playAnimation);
    }
}
 
Example 23
Source Project: tilesfx   Source File: TileSkin.java    License: Apache License 2.0 5 votes vote down vote up
protected void redraw() {
    boolean hasRoundedCorners = tile.getRoundedCorners();
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, hasRoundedCorners ? new CornerRadii(clamp(0, Double.MAX_VALUE, size * 0.025)) : CornerRadii.EMPTY, new BorderWidths(clamp(0, Double.MAX_VALUE, tile.getBorderWidth() / PREFERRED_WIDTH * size)))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), hasRoundedCorners ? new CornerRadii(clamp(0, Double.MAX_VALUE, size * 0.025)) : CornerRadii.EMPTY, Insets.EMPTY)));

    backgroundImageView.setOpacity(tile.getBackgroundImageOpacity());

    notifyRegion.setRoundedCorner(hasRoundedCorners);
    notifyRegion.setBackgroundColor(tile.getNotifyRegionBackgroundColor());
    notifyRegion.setForegroundColor(tile.getNotifyRegionForegroundColor());
    notifyRegion.setTooltipText(tile.getNotifyRegionTooltipText());

    infoRegion.setRoundedCorner(hasRoundedCorners);
    infoRegion.setBackgroundColor(tile.getInfoRegionBackgroundColor());
    infoRegion.setForegroundColor(tile.getInfoRegionForegroundColor());
    infoRegion.setTooltipText(tile.getInfoRegionTooltipText());

    lowerRightRegion.setRoundedCorner(hasRoundedCorners);
    lowerRightRegion.setBackgroundColor(tile.getLowerRightRegionBackgroundColor());
    lowerRightRegion.setForegroundColor(tile.getLowerRightRegionForegroundColor());
    lowerRightRegion.setTooltipText(tile.getLowerRightRegionTooltipText());

    locale                = tile.getLocale();
    if (tile.getCustomDecimalFormatEnabled()) {
        decimalFormat = tile.getCustomDecimalFormat();
    } else {
        formatString = new StringBuilder("%.").append(tile.getDecimals()).append("f").toString();
    }
    tickLabelFormatString = new StringBuilder("%.").append(tile.getTickLabelDecimals()).append("f").toString();
    sectionsVisible       = tile.getSectionsVisible();
    textSize              = tile.getTextSize();
}
 
Example 24
Source Project: PDF4Teachers   Source File: GradeTreeView.java    License: Apache License 2.0 5 votes vote down vote up
public GradeTreeView(LBGradeTab gradeTab){

        disableProperty().bind(MainWindow.mainScreen.statusProperty().isNotEqualTo(MainScreen.Status.OPEN));
        setBackground(new Background(new BackgroundFill(Color.rgb(244, 244, 244), CornerRadii.EMPTY, Insets.EMPTY)));
        prefHeightProperty().bind(gradeTab.pane.heightProperty().subtract(layoutYProperty()));
        prefWidthProperty().bind(gradeTab.pane.widthProperty());

        setCellFactory(new Callback<>() {
            @Override
            public TreeCell<String> call(TreeView<String> param) {
                return new TreeCell<>() {
                    @Override protected void updateItem(String item, boolean empty){
                        super.updateItem(item, empty);

                        // Enpty cell or String Data
                        if(empty || item != null){
                            setGraphic(null);
                            setStyle(null);
                            setContextMenu(null);
                            setOnMouseClicked(null);
                            setTooltip(null);
                            return;
                        }
                        // TreeGradeData
                        if(getTreeItem() instanceof GradeTreeItem){
                            ((GradeTreeItem) getTreeItem()).updateCell(this);
                            return;
                        }
                        // Other
                        setStyle(null);
                        setGraphic(null);
                        setContextMenu(null);
                        setOnMouseClicked(null);
                        setTooltip(null);
                    }
                };
            }
        });
    }
 
Example 25
Source Project: JFoenix   Source File: PromptLinesWrapper.java    License: Apache License 2.0 5 votes vote down vote up
public void updateDisabled() {
    final boolean disabled = control.isDisable();
    line.setBorder(!disabled ? Border.EMPTY :
        new Border(new BorderStroke(control.getUnFocusColor(),
            BorderStrokeStyle.DASHED, CornerRadii.EMPTY, new BorderWidths(1))));
    line.setBackground(new Background(
        new BackgroundFill(disabled ? Color.TRANSPARENT : control.getUnFocusColor(), CornerRadii.EMPTY, Insets.EMPTY)));
}
 
Example 26
Source Project: Medusa   Source File: DigitalClockSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * height))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    ZonedDateTime time = clock.getTime();

    textColor  = clock.getTextColor();
    dateColor  = clock.getDateColor();
    alarmColor = clock.getAlarmColor();

    drawTime(time);
}
 
Example 27
Source Project: OEE-Designer   Source File: PlusMinusTileSkin.java    License: MIT License 5 votes vote down vote up
@Override protected void resize() {
    super.resize();

    description.setPrefSize(width - size * 0.1, size * 0.43);
    description.relocate(size * 0.05, titleText.isVisible() ? height * 0.42 : height * 0.32);

    double buttonSize = size * 0.18;

    minusLabel.setFont(Fonts.latoBold(size * 0.2));
    minusLabel.setPrefSize(buttonSize, buttonSize);
    minusLabel.setMinSize(buttonSize, buttonSize);
    minusLabel.setMaxSize(buttonSize, buttonSize);
    //minusLabel.setPadding(new Insets(-0.055 * size, 0, 0, 0));
    minusLabel.setPadding(new Insets(-0.0625 * size, 0, 0, 0));
    minusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
    minusLabel.relocate(size * 0.05, height - size * 0.20 - buttonSize);
    
    plusLabel.setFont(Fonts.latoBold(size * 0.2));
    plusLabel.setPrefSize(buttonSize, buttonSize);
    plusLabel.setMinSize(buttonSize, buttonSize);
    plusLabel.setMaxSize(buttonSize, buttonSize);
    plusLabel.setPadding(new Insets(-0.05 * size, 0, 0, 0));
    plusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
    plusLabel.relocate(width - size * 0.05 - buttonSize, height - size * 0.20 - buttonSize);

    valueUnitFlow.setPrefWidth(contentBounds.getWidth());
    valueUnitFlow.relocate(contentBounds.getX(), contentBounds.getY());
}
 
Example 28
Source Project: Medusa   Source File: DigitalSkin.java    License: Apache License 2.0 5 votes vote down vote up
private void initGraphics() {
    // Set initial size
    if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
        Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
        if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
            gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
        } else {
            gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();
    
    barCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    barCtx    = barCanvas.getGraphicsContext2D();

    valueBkgText = new Text();
    valueBkgText.setStroke(null);
    valueBkgText.setFill(Helper.getTranslucentColorFrom(valueColor, 0.1));

    valueText = new Text();
    valueText.setStroke(null);
    valueText.setFill(valueColor);
    Helper.enableNode(valueText, gauge.isValueVisible());

    pane = new Pane(backgroundCanvas, barCanvas, valueBkgText, valueText);
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));

    getChildren().setAll(pane);
}
 
Example 29
Source Project: OEE-Designer   Source File: PercentageTileSkin.java    License: MIT License 5 votes vote down vote up
@Override protected void redraw() {
    super.redraw();
    titleText.setText(tile.getTitle());
    unitText.setText(tile.getUnit());
    description.setText(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    percentageText.setText(String.format(locale, "%." + tile.getDecimals() + "f", tile.getValue() / range * 100));
    maxValueText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue()));
    maxValueUnitText.setText(tile.getUnit());

    resizeStaticText();

    barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, false), Insets.EMPTY)));
    barColor = tile.getBarColor();

    if (sectionsVisible && !sections.isEmpty()) {
        setBarColor(tile.getValue());
    } else {
        bar.setFill(barColor);
    }

    titleText.setFill(tile.getTitleColor());
    unitText.setFill(tile.getUnitColor());
    description.setTextFill(tile.getDescriptionColor());
    maxValueText.setFill(tile.getBackgroundColor());
    maxValueUnitText.setFill(tile.getBackgroundColor());
    maxValueRect.setFill(Double.compare(tile.getCurrentValue(), maxValue) >= 0 ? barColor : tile.getThresholdColor());
    valueText.setFill(tile.getValueColor());
    unitText.setFill(tile.getUnitColor());
}
 
Example 30
Source Project: Medusa   Source File: TileTextKpiSkin.java    License: Apache License 2.0 5 votes vote down vote up
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(size * 0.025), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY)));

    locale       = gauge.getLocale();
    formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();

    titleText.setText(gauge.getTitle());
    percentageText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getValue() / range * 100));
    maxValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue()));
    maxValueUnitText.setText(gauge.getUnit());

    resizeStaticText();

    barBackground.setBackground(new Background(new BackgroundFill(gauge.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, size * 0.025, size * 0.025, false), Insets.EMPTY)));
    barColor = gauge.getBarColor();

    if (sectionsVisible && !sections.isEmpty()) {
        setBarColor(gauge.getValue());
    } else {
        bar.setFill(barColor);
    }

    titleText.setFill(gauge.getTitleColor());
    maxValueText.setFill(gauge.getBackgroundPaint());
    maxValueUnitText.setFill(gauge.getBackgroundPaint());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
}