Fix table uicontrols. 59/14359/4
Vincent COUVERT [Mon, 7 Apr 2014 14:13:32 +0000 (16:13 +0200)]
To test: test_run gui table

Change-Id: Id3b44974f9bdc16ea87a5205f759cf6dfe0e9f88

scilab/modules/gui/help/en_US/uicontrol.xml
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uitable/SwingScilabUiTable.java

index 1200b26..b35cb73 100644 (file)
@@ -175,7 +175,6 @@ table = [params; [ towns country pop temp ]]
 f = gcf();
 clf
 as = f.axes_size;  // [width height]
-delete(ut)
 ut = uicontrol("style","table",..
                "string",table,..
                "position",[5 as(2)-100 300 87],.. // => @top left corner of figure
index b9e811f..918cd9e 100644 (file)
@@ -335,7 +335,9 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
     }
 
     public void setEmptyText() {
-        getLabel().setText(null);
+        setColumnNames(new String[] {""});
+        setRowNames(new String[] {""});
+        setData(new String[] {""});
     }
 
     /**
@@ -440,6 +442,12 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
             case __GO_UI_STRING__: {
                 // Update column names
                 String[] stringValue = (String[]) value;
+                if (stringValue.length == 0) {
+                    setColumnNames(new String[] {""});
+                    setRowNames(new String[] {""});
+                    setData(new String[] {""});
+                    return;
+                }
                 int colNb = ((Integer) controller.getProperty(uid, __GO_UI_STRING_COLNB__));
                 String[] colNames = new String[colNb - 1];
                 for (int k = 1; k < colNb; k++) {