Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class Messages
FontStyle_BoldItalic,
FontStyle_Italic,
FontStyle_Regular,
FontStyle_Underline,
FontStyle_UnderlineBold,
FontStyle_UnderlineItalic,
GroupWidget_Description,
GroupWidget_Name,
HighlightActiveRegion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ private WidgetFontStyle parseStyle(final String style_text)
return WidgetFontStyle.ITALIC;
case "bold italic":
return WidgetFontStyle.BOLD_ITALIC;
case "underline":
return WidgetFontStyle.UNDERLINE;
case "underline_bold":
return WidgetFontStyle.UNDERLINE_BOLD;
case "underline_italic":
return WidgetFontStyle.UNDERLINE_ITALIC;
default:
return WidgetFontStyle.REGULAR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ public enum WidgetFontStyle
/** Italic */
ITALIC(Messages.FontStyle_Italic),
/** Bold and italic */
BOLD_ITALIC(Messages.FontStyle_BoldItalic);
BOLD_ITALIC(Messages.FontStyle_BoldItalic),
/** Underline */
UNDERLINE(Messages.FontStyle_Underline),
/** Underline and bold */
UNDERLINE_BOLD(Messages.FontStyle_UnderlineBold),
/** Underline and italic*/
UNDERLINE_ITALIC(Messages.FontStyle_UnderlineItalic);

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ FontStyle_Bold=Bold
FontStyle_BoldItalic=Bold & Italic
FontStyle_Italic=Italic
FontStyle_Regular=Regular
FontStyle_Underline=Underline
FontStyle_UnderlineBold=Underline & Bold
FontStyle_UnderlineItalic=Underline & Italic
GroupWidget_Description=Group of widgets
GroupWidget_Name=Group
HighlightActiveRegion=Highlight Active Region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ FontStyle_Bold=Gras
FontStyle_BoldItalic=Gras & Italique
FontStyle_Italic=Italique
FontStyle_Regular=Normal
FontStyle_Underline=Souligné
FontStyle_UnderlineBold=Souligné & Gras
FontStyle_UnderlineItalic=Souligné & Italique
GroupWidget_Description=Groupe de widgets
GroupWidget_Name=Groupe
HighlightActiveRegion=Mettre en surbrillance la région active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@
switch (f.getStyle())
{
case BOLD:
case UNDERLINE_BOLD:

Check warning on line 174 in app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXUtil.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge the previous cases into this one using comma-separated label.

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AaCzrTPjIXDpLODYxhA6&open=AaCzrTPjIXDpLODYxhA6&pullRequest=3927
return Font.font(f.getFamily(), FontWeight.BOLD, FontPosture.REGULAR, calibrated);
case ITALIC:
case UNDERLINE_ITALIC:

Check warning on line 177 in app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/JFXUtil.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge the previous cases into this one using comma-separated label.

See more on https://sonarcloud.io/project/issues?id=ControlSystemStudio_phoebus&issues=AaCzrTPjIXDpLODYxhA7&open=AaCzrTPjIXDpLODYxhA7&pullRequest=3927
return Font.font(f.getFamily(), FontWeight.NORMAL, FontPosture.ITALIC, calibrated);
case BOLD_ITALIC:
return Font.font(f.getFamily(), FontWeight.BOLD, FontPosture.ITALIC, calibrated);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.function.Consumer;

import javafx.event.Event;
import javafx.scene.text.Text;
import org.csstudio.display.builder.model.persist.NamedWidgetFonts;
import org.csstudio.display.builder.model.persist.WidgetFontService;
import org.csstudio.display.builder.model.properties.NamedWidgetFont;
Expand Down Expand Up @@ -82,7 +83,7 @@ private static <T> T defaultIfNull ( T value, T defaultValue ) {
@FXML private ComboBox<WidgetFontStyle> styles;
@FXML private ComboBox<Double> sizes;

@FXML private TextField preview;
@FXML private Text preview;

@FXML private Button cancelButton;
@FXML private Button defaultButton;
Expand Down Expand Up @@ -224,7 +225,9 @@ public void initialize ( URL location, ResourceBundle resources ) {
}

preview.setFont(JFXUtil.convert(newValue));

WidgetFontStyle style = newValue.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
preview.setUnderline(underline);
});

// Buttons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.ActionInfos;
import org.csstudio.display.builder.model.properties.RotationStep;
import org.csstudio.display.builder.model.properties.StringWidgetProperty;
import org.csstudio.display.builder.model.properties.*;
import org.csstudio.display.builder.model.spi.ActionInfo;
import org.csstudio.display.builder.model.widgets.ActionButtonWidget;
import org.csstudio.display.builder.representation.javafx.Cursors;
Expand Down Expand Up @@ -167,7 +165,7 @@ private ButtonBase makeBaseButton() {
button.setOnAction(event -> confirm(() -> handleActions(actions.getActions())));
result = button;
if (actions.getActions().size() == 1) {
// If the ActionButton only has a single action and that is to
// If the ActionButton only has a single action and that is to
// write to a PV then is_writePV should be true.
// This means that if the PV is non-writable then the
// ActionButton will be disabled.
Expand Down Expand Up @@ -392,12 +390,12 @@ private void updateColors() {
style = "-fx-background: transparent; -fx-color: transparent; -fx-focus-color: rgba(3,158,211,0.1); -fx-mark-color: transparent; -fx-background-color: transparent;";
else
style = JFXUtil.shadedStyle(model_widget.propBackgroundColor().getValue());

final String fg_css = JFXUtil.webHex(model_widget.propForegroundColor().getValue());
// Most labels use -fx-text-fill
style += " -fx-text-fill: " + fg_css + ";";
// Modena sets .menu-button .label to -fx-text-fill: -fx-text-base-color, so patch -fx-text-base-color as well
style += " -fx-text-base-color: " + fg_css + ";";
style += " -fx-text-base-color: " + fg_css + ";";
}

@Override
Expand All @@ -412,6 +410,10 @@ public void updateChanges() {
base.setText(button_text);
base.setStyle(style);
base.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle fontStyle = font.getStyle();
boolean underline = fontStyle.toString().contains(WidgetFontStyle.UNDERLINE.toString());
base.setUnderline(underline);

// If widget is not wide enough to show the label, hide menu button 'arrow'.
if (base instanceof MenuButton) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.widgets.BaseLEDWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
import org.epics.vtype.AlarmSeverity;
Expand Down Expand Up @@ -230,6 +232,10 @@ public void updateChanges()
final Color color = JFXUtil.convert(model_widget.propForegroundColor().getValue());
label.setTextFill(color);
label.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
label.setUnderline(underline);

led.setStyle("-fx-stroke: " + JFXUtil.webRgbOrHex(model_widget.propLineColor().getValue()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.CommonWidgetProperties;
import org.csstudio.display.builder.model.properties.ConfirmDialog;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.util.ModelResourceUtil;
import org.csstudio.display.builder.model.util.VTypeUtil;
import org.csstudio.display.builder.model.widgets.BoolButtonWidget;
Expand Down Expand Up @@ -359,7 +361,7 @@ private void representationChanged(final WidgetProperty<?> property, final Objec
value_label = state_labels[on_state];

computeBackground();

pos = JFXUtil.computePos(model_widget.propHorizontalAlignment().getValue(),
model_widget.propVerticalAlignment().getValue());

Expand Down Expand Up @@ -394,6 +396,10 @@ public void updateChanges()
hei = model_widget.propHeight().getValue();
button.setPrefSize(wid, hei);
button.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
button.setUnderline(underline);
button.setTextFill(foreground);
button.setStyle(background);

Expand All @@ -417,7 +423,7 @@ public void updateChanges()
{
enabled = model_widget.propEnabled().getValue() &&
model_widget.runtimePropPVWritable().getValue();
setDisabledLook(enabled, jfx_node.getChildren());
setDisabledLook(enabled, jfx_node.getChildren());
}
if (update_value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.util.VTypeUtil;
import org.csstudio.display.builder.model.widgets.CheckBoxWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
Expand Down Expand Up @@ -223,6 +225,11 @@ public void updateChanges()
jfx_node.setText(label);
jfx_node.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
jfx_node.setTextFill(JFXUtil.convert(model_widget.propForegroundColor().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
jfx_node.setUnderline(underline);


// Don't disable the widget, because that would also remove the
// context menu etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.util.VTypeUtil;
import org.csstudio.display.builder.model.widgets.ChoiceButtonWidget;
import org.csstudio.display.builder.representation.javafx.Cursors;
Expand Down Expand Up @@ -181,12 +183,12 @@ private void selectionChanged(final ObservableValue<? extends Toggle> obs, final
{
active = false;
}
}
else if (!enabled && newval == null)
}
else if (!enabled && newval == null)
{
// If the choice button is not enabled (no write allowed)
// we still have to ensure the 'oldval' stays selected
// as otherwise clicking on the same value will set an
// as otherwise clicking on the same value will set an
// unselected look on the ChoiceButton.
toggle.selectToggle(oldval);
}
Expand Down Expand Up @@ -346,6 +348,10 @@ public void updateChanges()
final ButtonBase b = (ButtonBase) node;
b.setTextFill(fg);
b.setFont(font);
WidgetFont fontStyle = model_widget.propFont().getValue();
WidgetFontStyle style = fontStyle.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
b.setUnderline(underline);
b.setAlignment(pos);
b.setTextAlignment(TextAlignment.values()[model_widget.propHorizontalAlignment().getValue().ordinal()]);
if (((Toggle)b).isSelected())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.properties.RotationStep;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.widgets.LabelWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
import org.phoebus.ui.javafx.TextUtils;
Expand Down Expand Up @@ -188,6 +190,10 @@ public void updateChanges()
label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
}
label.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
label.setUnderline(underline);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.util.VTypeUtil;
import org.csstudio.display.builder.model.widgets.RadioWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
Expand Down Expand Up @@ -305,6 +307,10 @@ public void updateChanges()
final RadioButton rb = (RadioButton) rb_node;
rb.setTextFill(fg);
rb.setFont(font);
WidgetFont fontStyle = model_widget.propFont().getValue();
WidgetFontStyle style = fontStyle.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
rb.setUnderline(underline);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.csstudio.display.builder.model.UntypedWidgetPropertyListener;
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.util.VTypeUtil;
import org.csstudio.display.builder.model.widgets.SlideButtonWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
Expand Down Expand Up @@ -94,6 +96,10 @@ public void updateChanges ( ) {
label.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
label.setText(labelContent);
label.setTextFill(foreground);
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
label.setUnderline(underline);

// Don't disable the widget, because that would also remove the context menu etc.
// Just apply a style that matches the disabled look.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.csstudio.display.builder.model.WidgetProperty;
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.RotationStep;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.widgets.TextSymbolWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
import org.epics.util.array.ListNumber;
Expand Down Expand Up @@ -222,6 +224,11 @@ protected Label createJFXNode ( ) throws Exception {
: new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY))
);
symbol.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
symbol.setUnderline(underline);

symbol.setTextFill(JFXUtil.convert(model_widget.propForegroundColor().getValue()));
symbol.setText("\u263A");
symbol.setManaged(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import org.csstudio.display.builder.model.WidgetPropertyListener;
import org.csstudio.display.builder.model.properties.RotationStep;
import org.csstudio.display.builder.model.properties.VerticalAlignment;
import org.csstudio.display.builder.model.properties.WidgetFont;
import org.csstudio.display.builder.model.properties.WidgetFontStyle;
import org.csstudio.display.builder.model.widgets.PVWidget;
import org.csstudio.display.builder.model.widgets.TextUpdateWidget;
import org.csstudio.display.builder.representation.javafx.JFXUtil;
Expand Down Expand Up @@ -256,6 +258,11 @@ public void updateChanges()
Color color = JFXUtil.convert(model_widget.propForegroundColor().getValue());
label.setTextFill(color);
label.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
WidgetFont font = model_widget.propFont().getValue();
WidgetFontStyle style = font.getStyle();
boolean underline = style.toString().contains(WidgetFontStyle.UNDERLINE.toString());
label.setUnderline(underline);

label.setAlignment(pos);
label.setWrapText(model_widget.propWrapWords().getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
Expand Down Expand Up @@ -101,7 +101,7 @@
</GridPane>
<TitledPane alignment="CENTER" animated="false" collapsible="false" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" style="-fx-box-border: ladder(-fx-color,black 20%,derive(-fx-color,-15%) 30%);" text="%WidgetFontPopOver_Preview">
<content>
<TextField fx:id="preview" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="50.0" promptText="%WidgetFontPopOver_PreviewPrompt" style="-fx-text-box-border: transparent;" text="%WidgetFontPopOver_ExampleText" />
<Text fx:id="preview" style="-fx-text-box-border: transparent;" text="%WidgetFontPopOver_ExampleText" />
</content>
</TitledPane>
</items>
Expand All @@ -121,4 +121,3 @@
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0" />
</padding>
</VBox>

Loading
Loading