From b7f8a70674e36a8c324f91d0f73f89667c3c8300 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 12 Dec 2023 08:27:43 +0100 Subject: GraphUI Shape/Group: Group.isActive() also returns true if any child is active; Add isContainer() to avoid rfeflection --- src/graphui/classes/com/jogamp/graph/ui/Group.java | 8 ++++++++ src/graphui/classes/com/jogamp/graph/ui/Shape.java | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/graphui/classes/com/jogamp/graph') 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; } @@ -243,6 +246,11 @@ public class Group extends Shape implements Container { public void setRelayoutOnDirtyShapes(final boolean v) { relayoutOnDirtyShapes = v; } 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 ) { 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, -- cgit v1.2.3