Delete openGL component in Frame if removed. 23/14123/7
Bruno JOFRET [Tue, 25 Mar 2014 13:14:04 +0000 (14:14 +0100)]
Change-Id: Ifa1a2477ad222d72db7daf12abad648c88cd034c

scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/tab/SwingScilabStaticPanel.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/AxesDrawer.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/ruler/AxesRulerDrawer.java

index 54853e4..d3f79ac 100644 (file)
@@ -1108,6 +1108,12 @@ public final class SwingView implements GraphicView {
                     updatedComponent.remove((Component) allObjects.get(childId).getValue());
                     needRevalidate = true;
                 }
+                
+                if (childType == __GO_AXES__) {
+                    updatedComponent.removeAxes();
+                    needRevalidate = true;
+                }
+                
             }
         }
         if (needRevalidate && updatedComponent != null) {
index ad55126..20cdf65 100644 (file)
@@ -1008,4 +1008,11 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
             setForeground(color);
         }
     }
+
+    public void removeAxes() {
+        getComponent(0).setEnabled(false);
+        getComponent(0).removeNotify();
+        removeAll();
+        doLayout();
+    }
 }
index 51abd18..7aaa982 100644 (file)
@@ -110,6 +110,7 @@ public class SwingScilabStaticPanel extends SwingScilabScrollPane implements Swi
                         }
                     }
                 }
+                getParentWindow().validate();
             }
 
             public void componentMoved(ComponentEvent arg0) {
index c94ec24..b94438c 100755 (executable)
@@ -1048,7 +1048,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                 }
 
                 if (property != GraphicObjectProperties.__GO_CHILDREN__) {
-                    axesDrawer.computeRulers(axes);
+                    //axesDrawer.computeRulers(axes);
                 }
             }
 
index f383ac6..bb7cbb4 100644 (file)
@@ -225,7 +225,7 @@ public class AxesDrawer {
                 }
             }
 
-            computeRulers(axes);
+            //computeRulers(axes);
             final double xratio = rulerDrawer.getRulerDrawer(axes, 0).getDistanceRatio();
             final double yratio = rulerDrawer.getRulerDrawer(axes, 1).getDistanceRatio();
 
@@ -302,7 +302,7 @@ public class AxesDrawer {
 
             if (!m[0].equals(margins[0]) || !m[1].equals(margins[1]) || !m[2].equals(margins[2]) || !m[3].equals(margins[3])) {
                 axes.setMargins(m);
-                computeRulers(axes);
+                //computeRulers(axes);
             }
         }
     }
index b8f172d..8d3c43a 100644 (file)
@@ -168,7 +168,8 @@ public class AxesRulerDrawer {
                 GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_X_AXIS_TICKS_LOCATIONS__, toDoubleArray(values));
                 GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_X_AXIS_TICKS_LABELS__, toStringArray(values, rulerDrawingResult.getFormat()));
                 if (axes.getAutoSubticks()) {
-                    GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_X_AXIS_SUBTICKS__, rulerDrawingResult.getSubTicksDensity());
+                    //GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_X_AXIS_SUBTICKS__, rulerDrawingResult.getSubTicksDensity());
+                    axes.setXAxisSubticks(rulerDrawingResult.getSubTicksDensity());
                 }
             }
 
@@ -225,7 +226,8 @@ public class AxesRulerDrawer {
                 GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Y_AXIS_TICKS_LOCATIONS__, toDoubleArray(values));
                 GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Y_AXIS_TICKS_LABELS__, toStringArray(values, rulerDrawingResult.getFormat()));
                 if (axes.getAutoSubticks()) {
-                    GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Y_AXIS_SUBTICKS__, rulerDrawingResult.getSubTicksDensity());
+                    //GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Y_AXIS_SUBTICKS__, rulerDrawingResult.getSubTicksDensity());
+                    axes.setYAxisSubticks(rulerDrawingResult.getSubTicksDensity());
                 }
             }
 
@@ -292,7 +294,8 @@ public class AxesRulerDrawer {
                     GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Z_AXIS_TICKS_LOCATIONS__, toDoubleArray(values));
                     GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Z_AXIS_TICKS_LABELS__, toStringArray(values, rulerDrawingResult.getFormat()));
                     if (axes.getAutoSubticks()) {
-                        GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Z_AXIS_SUBTICKS__, rulerDrawingResult.getSubTicksDensity());
+                        //GraphicController.getController().setProperty(axes.getIdentifier(), GraphicObjectProperties.__GO_Z_AXIS_SUBTICKS__, rulerDrawingResult.getSubTicksDensity());
+                        axes.setZAxisSubticks(rulerDrawingResult.getSubTicksDensity());
                     }
                 }