diff options
author | Sven Gothel <[email protected]> | 2023-12-12 08:27:43 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-12 08:27:43 +0100 |
commit | b7f8a70674e36a8c324f91d0f73f89667c3c8300 (patch) | |
tree | 15757f3dcdcab08ed9415a51aea0ad9cf75f814a /src/graphui | |
parent | f5978af858b387b5e58cf470c4edcf40ac0cabfd (diff) |
GraphUI Shape/Group: Group.isActive() also returns true if any child is active; Add isContainer() to avoid rfeflection
Diffstat (limited to 'src/graphui')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Group.java | 8 | ||||
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Shape.java | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java index 38e1fd12e..aa5079b02 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Group.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java @@ -101,6 +101,9 @@ public class Group extends Shape implements Container { this.setInteractive(false); } + @Override + public final boolean isContainer() { return true; } + /** Return current {@link Group.Layout}. */ public Layout getLayout() { return layouter; } @@ -244,6 +247,11 @@ public class Group extends Shape implements Container { public boolean getRelayoutOnDirtyShapes() { return relayoutOnDirtyShapes; } @Override + public boolean isActive() { + return super.isActive() || forAll((final Shape gs) -> { return gs.isActive(); }); + } + + @Override protected boolean isShapeDirty() { if( relayoutOnDirtyShapes ) { // Deep dirty state update: diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java index 961b2cba4..a80f07403 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java @@ -216,6 +216,9 @@ public abstract class Shape { /** Return the optional symbolic name for this shape. */ public final String getName() { return this.name; } + /** Returns true if this shape denotes a container, e.g. {@link Group}, otherwise false. */ + public boolean isContainer() { return false; } + /** Returns true if this shape is enabled and hence visible, otherwise false. */ public final boolean isEnabled() { return isIO(IO_ENABLED); } /** Enable or disable this shape, i.e. its visibility. */ @@ -1244,7 +1247,7 @@ public abstract class Shape { } } /** Returns true of this shape is active */ - public final boolean isActive() { return isIO(IO_ACTIVE); } + public boolean isActive() { return isIO(IO_ACTIVE); } /** * Set whether this shape is interactive, |