Skip to content
Merged
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 @@ -369,12 +369,14 @@ public void updateOrder()
* @param children list of children nodes under the parent widget
*/
public void setDisabledLook(Boolean enabled, ObservableList<Node> children) {
jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
if (children != null) {
for (Node node : children)
{
Styles.update(node, Styles.NOT_ENABLED, !enabled);
}
if (!toolkit.isEditMode()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this check as the disabled look should only be applied for the runtime display.
Some widgets call this setDisabled() method from inside an if (!toolkit.isEditMode()) {} which means it behaves correctly but this is not true of all. To be safe we can do it inside this method here to catch all calls to it.

jfx_node.setCursor(enabled ? Cursor.DEFAULT : Cursors.NO_WRITE);
if (children != null) {
for (Node node : children)
{
Styles.update(node, Styles.NOT_ENABLED, !enabled);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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

import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

Expand Down Expand Up @@ -51,6 +52,8 @@ public class TextEntryRepresentation extends RegionBaseRepresentation<TextInputC
*/
private boolean active = false;
private volatile boolean enabled = true;
private final String node_id = UUID.randomUUID().toString();;


private final DirtyFlag dirty_size = new DirtyFlag();
private final DirtyFlag dirty_style = new DirtyFlag();
Expand Down Expand Up @@ -101,6 +104,7 @@ public TextInputControl createJFXNode() throws Exception
text = new TextField();
text.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
text.getStyleClass().add("text_entry");
text.setId(node_id);

if (! toolkit.isEditMode())
{
Expand Down Expand Up @@ -425,6 +429,13 @@ else if(jfx_node instanceof TextArea){
String alignment = model_widget.propHorizontalAlignment().getValue().toString().toLowerCase();
PseudoClass alignmentClass = PseudoClass.getPseudoClass(alignment);
jfx_node.pseudoClassStateChanged(alignmentClass, true);

if (jfx_node.getScene() != null && !enabled) {
// Need to get the TextArea 'content' node to set the cursor
// for the whole widget otherwise it will only show on the borders.
jfx_node.getScene().lookup("#"+node_id+" .content").setCursor(Cursors.NO_WRITE);
jfx_node.layout();
}
}
}
if (! active)
Expand Down