aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com/jogamp/graph/ui/Group.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/Group.java')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index 6d3ff6e8c..77854b74a 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -125,22 +125,38 @@ public class Group extends Shape implements Container {
/** Removes given shape, keeps it alive. */
@Override
public Shape removeShape(final Shape s) {
- final Shape r = shapes.remove(s) ? s : null;
- markShapeDirty();
- return r;
+ if( shapes.remove(s) ) {
+ markShapeDirty();
+ return s;
+ } else {
+ return null;
+ }
}
@Override
public Shape removeShape(final int idx) {
final Shape r = shapes.remove(idx);
- markShapeDirty();
+ if( null != r ) {
+ markShapeDirty();
+ }
return r;
}
- /** Removes given shape and destroy it. */
- public void removeShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape s) {
- shapes.remove(s);
- s.destroy(gl, renderer);
+ /**
+ * Removes given shape and destroy it, if contained.
+ * @param gl GL2ES2 context
+ * @param renderer
+ * @param s the shape to be removed
+ * @return true if given Shape is removed and destroyed
+ */
+ public boolean removeShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape s) {
+ if( shapes.remove(s) ) {
+ markShapeDirty();
+ s.destroy(gl, renderer);
+ return true;
+ } else {
+ return false;
+ }
}
@Override