From a4fc84cba410e7e7082e8fd097cb0185d0aac1a2 Mon Sep 17 00:00:00 2001
From: Sven Gothel
+ * Enabled widget behavior for a group causes
+ *
+ *
+ *
+ * This method modifies all elements of this group for enabled or disabled widget behavior. + *
+ * @param v enable or disable + * @return this group for chaining + */ + public final Group setWidgetMode(final boolean v) { + widgetMode = v; + if( v ) { + enableUniActivationImpl(true, forwardActivation); + } else { + enableUniActivationImpl(false, null); + } + return this; + } + protected final void enableUniActivationImpl(final boolean v, final Listener activationListener) { + for(final Shape s : shapes ) { + if( s.isGroup() ) { + final Group sg = (Group)s; + sg.setWidgetMode(v); + } + s.onActivation(activationListener); + } + } + + /** Returns whether {@link #setWidgetMode(boolean)} is enabled or disabled. */ + public final boolean getWidgetMode() { return widgetMode; } + @Override public boolean isActive() { - return super.isActive() || forAll((final Shape gs) -> { return gs.isActive(); }); + return super.isActive() || ( widgetMode && forAll((final Shape gs) -> { return gs.isActive(); } ) ); + } + + @Override + public float getAdjustedZ() { + final float[] v = { getAdjustedZImpl() }; + if( widgetMode && !super.isActive() ) { + forAll((final Shape gs) -> { + if( gs.isActive() ) { + v[0] = gs.getAdjustedZImpl(); + return true; + } else { + return false; + } + } ); + } + return v[0]; } @Override diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java index d3b4bcbef..bfea0773f 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java @@ -1239,7 +1239,7 @@ public abstract class Shape { this.zOffset = zOffset; setIO(IO_ACTIVE, v); if( DEBUG ) { - System.err.println("XXX Activation "+this); + System.err.println("XXX "+(v?" Active":"DeActive")+" "+this); } if( null != onActivationListener ) { onActivationListener.run(this); @@ -1252,6 +1252,15 @@ public abstract class Shape { /** Returns true of this shape is active */ public boolean isActive() { return isIO(IO_ACTIVE); } + protected final Listener forwardActivation = new Listener() { + @Override + public void run(final Shape shape) { + if( null != onActivationListener ) { + onActivationListener.run(shape); + } + } + }; + public float getAdjustedZ() { return getAdjustedZImpl(); } -- cgit v1.2.3