use of javafx.scene.paint.Color in project org.csstudio.display.builder by kasemir.
the class XYPlotRepresentation method updateConfig.
private void updateConfig() {
final Color foreground = JFXUtil.convert(model_widget.propForeground().getValue());
plot.setForeground(foreground);
plot.setBackground(JFXUtil.convert(model_widget.propBackground().getValue()));
plot.setGridColor(JFXUtil.convert(model_widget.propGridColor().getValue()));
plot.setTitleFont(JFXUtil.convert(model_widget.propTitleFont().getValue()));
plot.setTitle(model_widget.propTitle().getValue());
plot.showToolbar(model_widget.propToolbar().getValue());
// Show trace names either in legend or on axis
final boolean legend = model_widget.propLegend().getValue();
plot.showLegend(legend);
// Update X Axis
updateAxisConfig(plot.getXAxis(), model_widget.propXAxis());
// Use X axis font for legend
plot.setLegendFont(JFXUtil.convert(model_widget.propXAxis().titleFont().getValue()));
// Update Y Axes
final List<AxisWidgetProperty> model_y = model_widget.propYAxes().getValue();
if (plot.getYAxes().size() != model_y.size()) {
logger.log(Level.WARNING, "Plot has " + plot.getYAxes().size() + " while model has " + model_y.size() + " Y axes");
return;
}
int i = 0;
for (YAxis<Double> plot_axis : plot.getYAxes()) {
plot_axis.useTraceNames(!legend);
updateAxisConfig(plot_axis, model_y.get(i));
++i;
}
}
use of javafx.scene.paint.Color in project org.csstudio.display.builder by kasemir.
the class RegionBaseRepresentation method custom_border_changed.
private void custom_border_changed(final WidgetProperty<?> property, final Object old_value, final Object new_value) {
final Integer width = border_width_prop.getValue();
if (width <= 0)
custom_border = null;
else {
final Color color = JFXUtil.convert(border_color_prop.getValue());
final CornerRadii corners = computeCornerRadii();
custom_border = new Border(new BorderStroke(color, solid, corners, new BorderWidths(width)));
}
dirty_border.mark();
toolkit.scheduleUpdate(this);
}
use of javafx.scene.paint.Color in project org.csstudio.display.builder by kasemir.
the class ArrayRepresentation method updateChanges.
@Override
public void updateChanges() {
super.updateChanges();
if (dirty_number.checkAndClear()) {
final int diff = children.size() - numChildren;
if (diff != 0) {
isAddingRemoving = true;
if (diff > 0)
removeChildren(children, diff);
else
addChildren(children, -diff);
isAddingRemoving = false;
}
arrangeChildren();
}
if (dirty_look.checkAndClear()) {
if (height > 0)
jfx_node.setPrefHeight(height);
if (width > 0)
jfx_node.setPrefWidth(width);
Color color = JFXUtil.convert(model_widget.propForegroundColor().getValue());
jfx_node.setBorder(new Border(new BorderStroke(color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT, new Insets(inset / 2))));
color = JFXUtil.convert(model_widget.displayBackgroundColor().getValue());
jfx_node.setBackground(new Background(new BackgroundFill(color, null, null)));
}
}
use of javafx.scene.paint.Color in project org.csstudio.display.builder by kasemir.
the class BaseGaugeRepresentation method updateChanges.
@SuppressWarnings("unchecked")
@Override
public void updateChanges() {
if (jfx_node == null) {
return;
}
super.updateChanges();
Object value;
if (dirtyGeometry.checkAndClear()) {
value = model_widget.propVisible().getValue();
if (!Objects.equals(value, jfx_node.isVisible())) {
jfx_node.setVisible((boolean) value);
}
jfx_node.setLayoutX(model_widget.propX().getValue());
jfx_node.setLayoutY(model_widget.propY().getValue());
jfx_node.setPrefWidth(model_widget.propWidth().getValue());
jfx_node.setPrefHeight(model_widget.propHeight().getValue());
clipper.setWidth(model_widget.propWidth().getValue() + 10);
clipper.setHeight(model_widget.propHeight().getValue() + 10);
}
if (dirtyLook.checkAndClear()) {
value = model_widget.propAutoScale().getValue();
if (!Objects.equals(value, jfx_node.isAutoScale())) {
jfx_node.setAutoScale((boolean) value);
}
Color bgColor = JFXUtil.convert(model_widget.propBackgroundColor().getValue());
if (model_widget.propTransparent().getValue()) {
bgColor = bgColor.deriveColor(0, 1, 1, 0);
}
if (!Objects.equals(bgColor, jfx_node.getBackgroundPaint())) {
jfx_node.setBackgroundPaint(bgColor);
}
value = JFXUtil.convert(model_widget.propForegroundColor().getValue());
if (!Objects.equals(value, jfx_node.getTitleColor())) {
Color fgColor = (Color) value;
jfx_node.setMajorTickMarkColor(fgColor);
jfx_node.setMediumTickMarkColor(fgColor);
jfx_node.setMinorTickMarkColor(fgColor);
jfx_node.setTickLabelColor(fgColor);
jfx_node.setTickMarkColor(fgColor);
jfx_node.setTitleColor(fgColor);
jfx_node.setUnitColor(fgColor);
jfx_node.setValueColor(fgColor);
jfx_node.setZeroColor(fgColor);
}
value = model_widget.propMajorTickSpace().getValue();
if (!Objects.equals(value, jfx_node.getMajorTickSpace())) {
jfx_node.setMajorTickSpace((double) value);
}
value = model_widget.propMinorTickSpace().getValue();
if (!Objects.equals(value, jfx_node.getMinorTickSpace())) {
jfx_node.setMinorTickSpace((double) value);
}
value = model_widget.propTitle().getValue();
if (!Objects.equals(value, jfx_node.getTitle())) {
jfx_node.setTitle((String) value);
}
value = model_widget.propValueVisible().getValue();
if (!Objects.equals(value, jfx_node.isValueVisible())) {
jfx_node.setValueVisible((boolean) value);
}
}
if (dirtyContent.checkAndClear()) {
value = FormatOptionHandler.actualPrecision(model_widget.runtimePropValue().getValue(), model_widget.propPrecision().getValue());
if (!Objects.equals(value, jfx_node.getDecimals())) {
jfx_node.setDecimals((int) value);
}
}
if (dirtyLimits.checkAndClear()) {
if (!Objects.equals(max, jfx_node.getMaxValue())) {
jfx_node.setMaxValue(max);
}
if (!Objects.equals(min, jfx_node.getMinValue())) {
jfx_node.setMinValue(min);
}
value = areZonesVisible();
if (!Objects.equals(value, jfx_node.getSectionsVisible())) {
jfx_node.setSectionsVisible((boolean) value);
}
value = createZones();
if (!Objects.equals(value, jfx_node.getSections())) {
jfx_node.setSections((List<Section>) value);
}
}
if (dirtyUnit.checkAndClear()) {
value = getUnit();
if (!Objects.equals(value, jfx_node.getUnit())) {
jfx_node.setUnit((String) value);
}
}
if (dirtyStyle.checkAndClear()) {
Styles.update(jfx_node, Styles.NOT_ENABLED, !model_widget.propEnabled().getValue());
}
if (dirtyValue.checkAndClear() && updatingValue.compareAndSet(false, true)) {
try {
final VType vtype = model_widget.runtimePropValue().getValue();
double newval = VTypeUtil.getValueNumber(vtype).doubleValue();
if (!Double.isNaN(newval)) {
if (newval < min) {
newval = min;
} else if (newval > max) {
newval = max;
}
jfx_node.setValue(newval);
} else {
// TODO: CR: do something!!!
}
} finally {
updatingValue.set(false);
}
}
}
use of javafx.scene.paint.Color in project org.csstudio.display.builder by kasemir.
the class BaseGaugeRepresentation method changeSkin.
/**
* Change the skin type, resetting some of the gauge parameters.
*
* @param skinType The new skin to be set.
*/
protected void changeSkin(final Gauge.SkinType skinType) {
jfx_node.setSkinType(skinType);
jfx_node.setPrefWidth(model_widget.propWidth().getValue());
jfx_node.setPrefHeight(model_widget.propHeight().getValue());
Color fgColor = JFXUtil.convert(model_widget.propForegroundColor().getValue());
jfx_node.setAnimated(false);
jfx_node.setAutoScale(model_widget.propAutoScale().getValue());
jfx_node.setBackgroundPaint(model_widget.propTransparent().getValue() ? Color.TRANSPARENT : JFXUtil.convert(model_widget.propBackgroundColor().getValue()));
jfx_node.setCheckAreasForValue(false);
jfx_node.setCheckSectionsForValue(false);
jfx_node.setCheckThreshold(false);
jfx_node.setDecimals(FormatOptionHandler.actualPrecision(model_widget.runtimePropValue().getValue(), model_widget.propPrecision().getValue()));
jfx_node.setHighlightAreas(false);
jfx_node.setInnerShadowEnabled(false);
jfx_node.setInteractive(false);
jfx_node.setLedVisible(false);
jfx_node.setMajorTickMarkColor(fgColor);
jfx_node.setMajorTickSpace(model_widget.propMajorTickSpace().getValue());
jfx_node.setMediumTickMarkColor(fgColor);
jfx_node.setMinorTickMarkColor(fgColor);
jfx_node.setMinorTickSpace(model_widget.propMinorTickSpace().getValue());
jfx_node.setReturnToZero(false);
jfx_node.setSectionIconsVisible(false);
jfx_node.setSectionTextVisible(false);
jfx_node.setTickLabelColor(fgColor);
jfx_node.setTickMarkColor(fgColor);
jfx_node.setTitle(model_widget.propTitle().getValue());
jfx_node.setTitleColor(fgColor);
jfx_node.setUnit(model_widget.propUnit().getValue());
jfx_node.setUnitColor(fgColor);
jfx_node.setValueColor(fgColor);
jfx_node.setValueVisible(model_widget.propValueVisible().getValue());
jfx_node.setZeroColor(fgColor);
}
Aggregations