Skip to content

Commit b9aec75

Browse files
authored
Merge pull request ControlSystemStudio#3503 from rjwills28/issue3502_multiline_textentry_cursor
Fix no_write cursor not showing for multi-line TextEntry widget
2 parents 3136826 + d6080b2 commit b9aec75

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/JFXBaseRepresentation.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,14 @@ public void updateOrder()
369369
* @param children list of children nodes under the parent widget
370370
*/
371371
public void setDisabledLook(Boolean enabled, ObservableList<Node> children) {
372-
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
373-
if (children != null) {
374-
for (Node node : children)
375-
{
376-
Styles.update(node, Styles.NOT_ENABLED, !enabled);
377-
}
372+
if (!toolkit.isEditMode()) {
373+
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
374+
if (children != null) {
375+
for (Node node : children)
376+
{
377+
Styles.update(node, Styles.NOT_ENABLED, !enabled);
378+
}
379+
}
378380
}
379381
}
380382
}

app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextEntryRepresentation.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import static org.csstudio.display.builder.representation.ToolkitRepresentation.logger;
1111

12+
import java.util.UUID;
1213
import java.util.concurrent.TimeUnit;
1314
import java.util.logging.Level;
1415

@@ -51,6 +52,8 @@ public class TextEntryRepresentation extends RegionBaseRepresentation<TextInputC
5152
*/
5253
private boolean active = false;
5354
private volatile boolean enabled = true;
55+
private final String node_id = UUID.randomUUID().toString();;
56+
5457

5558
private final DirtyFlag dirty_size = new DirtyFlag();
5659
private final DirtyFlag dirty_style = new DirtyFlag();
@@ -101,6 +104,7 @@ public TextInputControl createJFXNode() throws Exception
101104
text = new TextField();
102105
text.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
103106
text.getStyleClass().add("text_entry");
107+
text.setId(node_id);
104108

105109
if (! toolkit.isEditMode())
106110
{
@@ -425,6 +429,13 @@ else if(jfx_node instanceof TextArea){
425429
String alignment = model_widget.propHorizontalAlignment().getValue().toString().toLowerCase();
426430
PseudoClass alignmentClass = PseudoClass.getPseudoClass(alignment);
427431
jfx_node.pseudoClassStateChanged(alignmentClass, true);
432+
433+
if (jfx_node.getScene() != null && !enabled) {
434+
// Need to get the TextArea 'content' node to set the cursor
435+
// for the whole widget otherwise it will only show on the borders.
436+
jfx_node.getScene().lookup("#"+node_id+" .content").setCursor(Cursors.NO_WRITE);
437+
jfx_node.layout();
438+
}
428439
}
429440
}
430441
if (! active)

0 commit comments

Comments
 (0)