cleanup gui 70/13770/5
Antoine ELIAS [Mon, 17 Feb 2014 20:30:52 +0000 (21:30 +0100)]
Change-Id: I3cd2f3497dc9abbf1bff8e156cac5c61ccd55dc1

24 files changed:
scilab/modules/graphics/macros/%h_e.sci
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingView.java
scilab/modules/gui/src/java/org/scilab/modules/gui/SwingViewWidget.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/ScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/checkbox/SwingScilabCheckBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/editbox/SwingScilabEditBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/frame/SwingScilabScrollableFrame.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/layout/SwingScilabBorderLayout.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/layout/SwingScilabFlowLayout.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/listbox/SwingScilabListBox.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/popupmenu/SwingScilabPopupMenu.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/radiobutton/SwingScilabRadioButton.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabScroll.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/slider/SwingScilabSlider.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uiimage/SwingScilabUiImage.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/uitable/SwingScilabUiTable.java
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/BorderLayout.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/FlowLayout.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/LayoutManager.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabBorderLayout.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabBorderLayoutBridge.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabFlowLayout.java [deleted file]
scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabFlowLayoutBridge.java [deleted file]

index 8c947c6..06a2e2b 100644 (file)
@@ -36,5 +36,6 @@ function r=%h_e(i,h)
     else
         error("Invalid path")
     end
+
     if type(r)==10 then r=stripblanks(r),end
 endfunction
index 6b7de58..1b45f73 100644 (file)
@@ -45,7 +45,6 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTWEIGHT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FOREGROUNDCOLOR__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_SCROLLABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_HORIZONTALALIGNMENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ICON__;
@@ -59,6 +58,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_PUSHBUTTON__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_RADIOBUTTON__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_RELIEF__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SCROLLABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SEPARATOR__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDER__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
@@ -69,7 +69,6 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VALID__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_WAITBAR__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SCROLLABLE__;
 import static org.scilab.modules.gui.utils.Debug.DEBUG;
 
 import java.awt.Component;
@@ -103,8 +102,8 @@ import org.scilab.modules.gui.bridge.console.SwingScilabConsole;
 import org.scilab.modules.gui.bridge.contextmenu.SwingScilabContextMenu;
 import org.scilab.modules.gui.bridge.editbox.SwingScilabEditBox;
 import org.scilab.modules.gui.bridge.frame.SwingScilabFrame;
-import org.scilab.modules.gui.bridge.frame.SwingScilabScrollableFrame;
 import org.scilab.modules.gui.bridge.frame.SwingScilabLayer;
+import org.scilab.modules.gui.bridge.frame.SwingScilabScrollableFrame;
 import org.scilab.modules.gui.bridge.label.SwingScilabLabel;
 import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
 import org.scilab.modules.gui.bridge.menu.SwingScilabMenu;
@@ -591,29 +590,29 @@ public final class SwingView implements GraphicView {
      * @param uiControlObject the uicontrol
      * @param id the uicontrol id
      */
-    private void setDefaultProperties(Widget uiControlObject, Integer id) {
+    private void setDefaultProperties(SwingViewObject uiControlObject, Integer id) {
 
         /*
          * Visible property is set first to avoid to see the object rendered
          * before all its properties to be set (See bug #10346)
          */
-        SwingViewWidget.update(uiControlObject, __GO_VISIBLE__, GraphicController.getController().getProperty(id, __GO_VISIBLE__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_BACKGROUNDCOLOR__, GraphicController.getController().getProperty(id, __GO_UI_BACKGROUNDCOLOR__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_ENABLE__, GraphicController.getController().getProperty(id, __GO_UI_ENABLE__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_FONTANGLE__, GraphicController.getController().getProperty(id, __GO_UI_FONTANGLE__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_FONTNAME__, GraphicController.getController().getProperty(id, __GO_UI_FONTNAME__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_FONTUNITS__, GraphicController.getController().getProperty(id, __GO_UI_FONTUNITS__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_FONTSIZE__, GraphicController.getController().getProperty(id, __GO_UI_FONTSIZE__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_FONTWEIGHT__, GraphicController.getController().getProperty(id, __GO_UI_FONTWEIGHT__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_FOREGROUNDCOLOR__, GraphicController.getController().getProperty(id, __GO_UI_FOREGROUNDCOLOR__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_HORIZONTALALIGNMENT__, GraphicController.getController().getProperty(id, __GO_UI_HORIZONTALALIGNMENT__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_RELIEF__, GraphicController.getController().getProperty(id, __GO_UI_RELIEF__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_STRING__, GraphicController.getController().getProperty(id, __GO_UI_STRING__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_VERTICALALIGNMENT__, GraphicController.getController().getProperty(id, __GO_UI_VERTICALALIGNMENT__));
-        SwingViewWidget.update(uiControlObject, __GO_POSITION__, GraphicController.getController().getProperty(id, __GO_POSITION__));
-        SwingViewWidget.update(uiControlObject, __GO_LAYOUT__, GraphicController.getController().getProperty(id, __GO_LAYOUT__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_MIN__, GraphicController.getController().getProperty(id, __GO_UI_MIN__));
-        SwingViewWidget.update(uiControlObject, __GO_UI_MAX__, GraphicController.getController().getProperty(id, __GO_UI_MAX__));
+        uiControlObject.update(__GO_VISIBLE__, GraphicController.getController().getProperty(id, __GO_VISIBLE__));
+        uiControlObject.update(__GO_UI_BACKGROUNDCOLOR__, GraphicController.getController().getProperty(id, __GO_UI_BACKGROUNDCOLOR__));
+        uiControlObject.update(__GO_UI_ENABLE__, GraphicController.getController().getProperty(id, __GO_UI_ENABLE__));
+        uiControlObject.update(__GO_UI_FONTANGLE__, GraphicController.getController().getProperty(id, __GO_UI_FONTANGLE__));
+        uiControlObject.update(__GO_UI_FONTNAME__, GraphicController.getController().getProperty(id, __GO_UI_FONTNAME__));
+        uiControlObject.update(__GO_UI_FONTUNITS__, GraphicController.getController().getProperty(id, __GO_UI_FONTUNITS__));
+        uiControlObject.update(__GO_UI_FONTSIZE__, GraphicController.getController().getProperty(id, __GO_UI_FONTSIZE__));
+        uiControlObject.update(__GO_UI_FONTWEIGHT__, GraphicController.getController().getProperty(id, __GO_UI_FONTWEIGHT__));
+        uiControlObject.update(__GO_UI_FOREGROUNDCOLOR__, GraphicController.getController().getProperty(id, __GO_UI_FOREGROUNDCOLOR__));
+        uiControlObject.update(__GO_UI_HORIZONTALALIGNMENT__, GraphicController.getController().getProperty(id, __GO_UI_HORIZONTALALIGNMENT__));
+        uiControlObject.update(__GO_UI_RELIEF__, GraphicController.getController().getProperty(id, __GO_UI_RELIEF__));
+        uiControlObject.update(__GO_UI_STRING__, GraphicController.getController().getProperty(id, __GO_UI_STRING__));
+        uiControlObject.update(__GO_UI_VERTICALALIGNMENT__, GraphicController.getController().getProperty(id, __GO_UI_VERTICALALIGNMENT__));
+        uiControlObject.update(__GO_POSITION__, GraphicController.getController().getProperty(id, __GO_POSITION__));
+        uiControlObject.update(__GO_LAYOUT__, GraphicController.getController().getProperty(id, __GO_LAYOUT__));
+        uiControlObject.update(__GO_UI_MIN__, GraphicController.getController().getProperty(id, __GO_UI_MIN__));
+        uiControlObject.update(__GO_UI_MAX__, GraphicController.getController().getProperty(id, __GO_UI_MAX__));
     }
 
     public void deleteObject(Integer id) {
index a26d394..d580aad 100644 (file)
 
 package org.scilab.modules.gui;
 
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACKTYPE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACK__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_PARENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_STYLE__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TAG__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TYPE__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UICONTROL__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_BACKGROUNDCOLOR__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ENABLE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTANGLE__;
@@ -34,58 +25,21 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTUNITS__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FONTWEIGHT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FOREGROUNDCOLOR__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_GROUP_NAME__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_HORIZONTALALIGNMENT__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LAYER__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LISTBOXTOP__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_RELIEF__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING_COLNB__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_TOOLTIPSTRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_UNITS__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VERTICALALIGNMENT__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_USER_DATA__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VALID__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
 
-import java.awt.BorderLayout;
 import java.awt.Color;
-import java.awt.Component;
 import java.awt.Font;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-
-import javax.swing.AbstractButton;
-import javax.swing.JComponent;
-import javax.swing.UIManager;
-import javax.swing.border.Border;
-import javax.swing.plaf.ComponentUI;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.CallBack;
-import org.scilab.modules.graphic_objects.utils.LayoutType;
-import org.scilab.modules.gui.bridge.checkbox.SwingScilabCheckBox;
 import org.scilab.modules.gui.bridge.editbox.SwingScilabEditBox;
-import org.scilab.modules.gui.bridge.frame.SwingScilabFrame;
-import org.scilab.modules.gui.bridge.frame.SwingScilabLayer;
-import org.scilab.modules.gui.bridge.frame.SwingScilabScrollableFrame;
-import org.scilab.modules.gui.bridge.groupmanager.GroupManager;
-import org.scilab.modules.gui.bridge.listbox.SwingScilabListBox;
-import org.scilab.modules.gui.bridge.popupmenu.SwingScilabPopupMenu;
-import org.scilab.modules.gui.bridge.radiobutton.SwingScilabRadioButton;
-import org.scilab.modules.gui.bridge.slider.SwingScilabScroll;
-import org.scilab.modules.gui.bridge.slider.SwingScilabSlider;
-import org.scilab.modules.gui.bridge.textbox.SwingScilabTextBox;
-import org.scilab.modules.gui.bridge.uiimage.SwingScilabUiImage;
-import org.scilab.modules.gui.bridge.uitable.SwingScilabUiTable;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
-import org.scilab.modules.gui.utils.BorderConvertor;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.Size;
 import org.scilab.modules.gui.utils.UnitsConverter;
@@ -122,35 +76,29 @@ public final class SwingViewWidget {
      */
     public static void update(Widget uiControl, int property, Object value) {
         Integer uid = ((SwingViewObject) uiControl).getId();
-        Font font = null;
-        Double[] allColors = null;
-        double maxValue = 0;
 
         GraphicController controller = GraphicController.getController();
         switch (property) {
-            case __GO_UI_BACKGROUNDCOLOR__:
-                allColors = ((Double[]) value);
+            case __GO_UI_BACKGROUNDCOLOR__: {
+                Double[] allColors = ((Double[]) value);
                 if (allColors[0] != -1) {
-                    if (uiControl instanceof SwingScilabListBox) {
-                        ((SwingScilabListBox)uiControl).setListBackground(new Color((int) (allColors[0] * COLORS_COEFF),
-                                (int) (allColors[1] * COLORS_COEFF),
-                                (int) (allColors[2] * COLORS_COEFF)));
-                    } else {
-                        uiControl.setBackground(new Color((int) (allColors[0] * COLORS_COEFF),
-                                                          (int) (allColors[1] * COLORS_COEFF),
-                                                          (int) (allColors[2] * COLORS_COEFF)));
-                    }
+                    uiControl.setBackground(new Color(
+                                                (int) (allColors[0] * COLORS_COEFF),
+                                                (int) (allColors[1] * COLORS_COEFF),
+                                                (int) (allColors[2] * COLORS_COEFF)));
                 } else {
                     // Do not set BackgroundColor for widgets
                     // rely on Look and Feel
                     uiControl.resetBackground();
                 }
                 break;
-            case __GO_CALLBACK__:
+            }
+            case __GO_CALLBACK__: {
                 int cbType = (Integer) controller.getProperty(uid, __GO_CALLBACKTYPE__);
                 uiControl.setCallback(CommonCallBack.createCallback((String) value, cbType, uid));
                 break;
-            case __GO_CALLBACKTYPE__:
+            }
+            case __GO_CALLBACKTYPE__: {
                 String cbString = (String) controller.getProperty(uid, __GO_CALLBACK__);
                 if ((Integer) value == CallBack.UNTYPED) {
                     /*
@@ -162,16 +110,15 @@ public final class SwingViewWidget {
                     uiControl.setCallback(CommonCallBack.createCallback(cbString, (Integer) value, uid));
                 }
                 break;
-            case __GO_CHILDREN__:
-                /* Nothing to do */
-                break;
-            case __GO_UI_ENABLE__:
+            }
+            case __GO_UI_ENABLE__: {
                 uiControl.setEnabled(((Boolean) value).booleanValue());
                 break;
+            }
             case __GO_UI_FONTANGLE__ : {
                 String angle = (String) value;
                 if (angle.equals("") == false) {
-                    font = uiControl.getFont();
+                    Font font = uiControl.getFont();
                     if (font != null) {
                         if (angle.equalsIgnoreCase(ITALICFONT) || angle.equalsIgnoreCase(OBLIQUEFONT)) {
                             if (font.isBold()) {
@@ -195,7 +142,7 @@ public final class SwingViewWidget {
             case __GO_UI_FONTNAME__ : {
                 String name = (String) value;
                 if (name.equals("") == false) {
-                    font = uiControl.getFont();
+                    Font font = uiControl.getFont();
                     if (font != null) {
 
                         font = new Font(name, font.getStyle(), font.getSize());
@@ -213,7 +160,7 @@ public final class SwingViewWidget {
                 if ((Double)value != 0.0) {
                     UicontrolUnits fontUnitsProperty = UnitsConverter.stringToUnitsEnum((String) controller.getProperty(uid, __GO_UI_FONTUNITS__));
                     Double dblFontSize = UnitsConverter.convertToPoint((Double) value, fontUnitsProperty, uiControl, false);
-                    font = uiControl.getFont();
+                    Font font = uiControl.getFont();
                     if (font != null) {
                         int size = dblFontSize.intValue();
                         font = new Font(font.getName(), font.getStyle(), size);
@@ -222,13 +169,10 @@ public final class SwingViewWidget {
                 }
                 break;
             }
-            case __GO_UI_FONTUNITS__ :
-                /* Nothing to do here, this property is used when setting position */
-                break;
             case __GO_UI_FONTWEIGHT__ : {
                 String weight = (String) value;
                 if (weight.equals("") == false) {
-                    font = uiControl.getFont();
+                    Font font = uiControl.getFont();
                     if (font != null) {
                         if (weight.equalsIgnoreCase(BOLDFONT)) {
                             if (font.isItalic()) {
@@ -249,10 +193,14 @@ public final class SwingViewWidget {
                 }
                 break;
             }
-            case __GO_UI_FOREGROUNDCOLOR__ :
-                allColors = ((Double[]) value);
-                uiControl.setForeground(new Color((int) (allColors[0] * COLORS_COEFF), (int) (allColors[1] * COLORS_COEFF), (int) (allColors[2] * COLORS_COEFF)));
+            case __GO_UI_FOREGROUNDCOLOR__ : {
+                Double[] allColors = ((Double[]) value);
+                uiControl.setForeground(new Color(
+                                            (int) (allColors[0] * COLORS_COEFF),
+                                            (int) (allColors[1] * COLORS_COEFF),
+                                            (int) (allColors[2] * COLORS_COEFF)));
                 break;
+            }
             case __GO_UI_HORIZONTALALIGNMENT__ : {
                 String align = (String)value;
                 if (align.equals("") == false) {
@@ -260,226 +208,19 @@ public final class SwingViewWidget {
                 }
                 break;
             }
-            case __GO_UI_LISTBOXTOP__ :
-                if (uiControl instanceof SwingScilabListBox) {
-                    Integer[] listboxtopValue = ((Integer[]) value);
-                    if (listboxtopValue.length > 0) {
-                        ((SwingScilabListBox) uiControl).setListBoxTop(listboxtopValue[0]);
-                    }
-                }
-                break;
-            case __GO_UI_MAX__:
-                maxValue = ((Double) value);
-                if (uiControl instanceof SwingScilabScroll) {
-                    // Update the slider properties
-                    double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
-                    ((SwingScilabScroll) uiControl).setMaximumValue(maxValue);
-                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
-                    double minorSliderStep = sliderStep[0].doubleValue();
-                    double majorSliderStep = sliderStep[1].doubleValue();
-                    if (minValue <= maxValue) {
-                        ((SwingScilabScroll) uiControl).setMinorTickSpacing(minorSliderStep);
-                        ((SwingScilabScroll) uiControl).setMajorTickSpacing(majorSliderStep);
-                    }
-                } else if (uiControl instanceof SwingScilabSlider) {
-                    // Update the slider properties
-                    double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
-                    ((SwingScilabSlider) uiControl).setMaximumValue(maxValue);
-                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
-                    double minorSliderStep = sliderStep[0].doubleValue();
-                    double majorSliderStep = sliderStep[1].doubleValue();
-                    if (minValue <= maxValue) {
-                        ((SwingScilabSlider) uiControl).setMinorTickSpacing(minorSliderStep);
-                        ((SwingScilabSlider) uiControl).setMajorTickSpacing(majorSliderStep);
-                    }
-                } else if (uiControl instanceof SwingScilabListBox) {
-                    // Enable/Disable multiple selection
-                    double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
-                    ((SwingScilabListBox) uiControl).setMultipleSelectionEnabled(maxValue - minValue > 1);
-                } else if (uiControl instanceof SwingScilabCheckBox) {
-                    Double[] allValues = (Double[]) controller.getProperty(uid, __GO_UI_VALUE__);
-                    if ((allValues == null) || (allValues.length == 0)) {
-                        return;
-                    }
-                    double uicontrolValue = allValues[0];
-                    // Check/Uncheck the CheckBox
-                    ((SwingScilabCheckBox) uiControl).setChecked(maxValue == uicontrolValue);
-                } else if (uiControl instanceof SwingScilabRadioButton) {
-                    Double[] allValues = (Double[]) controller.getProperty(uid, __GO_UI_VALUE__);
-                    if ((allValues == null) || (allValues.length == 0)) {
-                        return;
-                    }
-                    double uicontrolValue = allValues[0];
-                    // Check/Uncheck the RadioButton
-                    ((SwingScilabRadioButton) uiControl).setChecked(maxValue == uicontrolValue);
-                } else if (uiControl instanceof SwingScilabTextBox) {
-                    //System.out.println("max value be come columns for textfield");
-                    //((SwingScilabTextBox) uiControl).setColumns((int)maxValue);
-                } else if (uiControl instanceof SwingScilabEditBox) {
-                    double min = ((Double) controller.getProperty(uid, __GO_UI_MIN__));
-                    double max = ((Double) controller.getProperty(uid, __GO_UI_MAX__));
-                    if (max - min > 1.0) {
-                        ((SwingScilabEditBox) uiControl).setMultiLineText(true);
-                    } else {
-                        ((SwingScilabEditBox) uiControl).setMultiLineText(false);
-                    }
-                    // Force String update
-                    update(uiControl, __GO_UI_STRING__, GraphicController.getController().getProperty(uid, __GO_UI_STRING__));
-                }
-                break;
-            case __GO_UI_MIN__:
-                double minValue = ((Double) value);
-                if (uiControl instanceof SwingScilabScroll) {
-                    // Update the slider properties
-                    maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
-                    ((SwingScilabScroll) uiControl).setMinimumValue(minValue);
-                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
-                    double minorSliderStep = sliderStep[0].doubleValue();
-                    double majorSliderStep = sliderStep[1].doubleValue();
-                    if (minValue <= maxValue) {
-                        ((SwingScilabScroll) uiControl).setMinorTickSpacing(minorSliderStep);
-                        ((SwingScilabScroll) uiControl).setMajorTickSpacing(majorSliderStep);
-                    }
-                } else if (uiControl instanceof SwingScilabSlider) {
-                    // Update the slider properties
-                    maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
-                    ((SwingScilabSlider) uiControl).setMinimumValue(minValue);
-                    Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
-                    double minorSliderStep = sliderStep[0].doubleValue();
-                    double majorSliderStep = sliderStep[1].doubleValue();
-                    if (minValue <= maxValue) {
-                        ((SwingScilabSlider) uiControl).setMinorTickSpacing(minorSliderStep);
-                        ((SwingScilabSlider) uiControl).setMajorTickSpacing(majorSliderStep);
-                    }
-                } else if (uiControl instanceof SwingScilabListBox) {
-                    // Enable/Disable multiple selection
-                    maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
-                    ((SwingScilabListBox) uiControl).setMultipleSelectionEnabled(maxValue - minValue > 1);
-                } else if (uiControl instanceof SwingScilabEditBox) {
-                    double min = ((Double) controller.getProperty(uid, __GO_UI_MIN__));
-                    double max = ((Double) controller.getProperty(uid, __GO_UI_MAX__));
-                    if (max - min > 1.0) {
-                        ((SwingScilabEditBox) uiControl).setMultiLineText(true);
-                    } else {
-                        ((SwingScilabEditBox) uiControl).setMultiLineText(false);
-                    }
-                    // Force String update
-                    update(uiControl, __GO_UI_STRING__, GraphicController.getController().getProperty(uid, __GO_UI_STRING__));
-                }
-                break;
             case __GO_POSITION__: {
-
                 /* Convert value according to units */
-                UicontrolUnits unitsProperty = UnitsConverter.stringToUnitsEnum((String) GraphicController.getController().getProperty(uid, __GO_UI_UNITS__));
-                Double[] dblValues = UnitsConverter.convertPositionToPixels((Double[]) value, unitsProperty, uiControl);
-                // Set dimensions before position because position is adjusted according to size
-                uiControl.setDims(new Size(dblValues[WIDTH_INDEX].intValue(), dblValues[HEIGHT_INDEX].intValue()));
-                uiControl.setPosition(new Position(dblValues[X_INDEX].intValue(), dblValues[Y_INDEX].intValue()));
-
-                Integer parent = (Integer)controller.getProperty(uid, __GO_PARENT__);
-                if (parent != 0) {
-                    Integer type = (Integer)controller.getProperty(parent, __GO_TYPE__);
-                    if (type == __GO_UICONTROL__) {
-
-                        Integer style = (Integer)controller.getProperty(parent, __GO_STYLE__);
-                        if (style == __GO_UI_FRAME__) {
-                            SwingViewObject obj = SwingView.getFromId(parent);
-                            if (obj instanceof SwingScilabScrollableFrame) {
-                                SwingScilabScrollableFrame frame = (SwingScilabScrollableFrame) SwingView.getFromId(parent);
-                                frame.updateChildPosition((JComponent)uiControl);
-                            }
-                        }
-                    }
-                }
-                // Manage sliders orientation
-                if (uiControl instanceof SwingScilabScroll) {
-                    if (dblValues[WIDTH_INDEX].intValue() > dblValues[HEIGHT_INDEX].intValue()) {
-                        ((SwingScilabScroll) uiControl).setHorizontal();
-                    } else {
-                        ((SwingScilabScroll) uiControl).setVertical();
-                    }
-                } else if (uiControl instanceof SwingScilabSlider) {
-                    if (dblValues[WIDTH_INDEX].intValue() > dblValues[HEIGHT_INDEX].intValue()) {
-                        ((SwingScilabSlider) uiControl).setHorizontal();
-                    } else {
-                        ((SwingScilabSlider) uiControl).setVertical();
-                    }
-                }
+                updatePosition(uiControl, uid, value);
                 break;
             }
-            case __GO_UI_RELIEF__:
+            case __GO_UI_RELIEF__: {
                 uiControl.setRelief((String) value);
                 break;
-            case __GO_UI_SLIDERSTEP__:
-                Double[] sliderStep = ((Double[]) value);
-                if (uiControl instanceof SwingScilabScroll) {
-                    // Update the slider properties
-                    double minorSliderStep = sliderStep[0].doubleValue();
-                    double majorSliderStep = sliderStep[1].doubleValue();
-                    ((SwingScilabScroll) uiControl).setMinorTickSpacing(minorSliderStep);
-                    ((SwingScilabScroll) uiControl).setMajorTickSpacing(majorSliderStep);
-                } else if (uiControl instanceof SwingScilabSlider) {
-                    // Update the slider properties
-                    double minorSliderStep = sliderStep[0].doubleValue();
-                    double majorSliderStep = sliderStep[1].doubleValue();
-                    ((SwingScilabSlider) uiControl).setMinorTickSpacing(minorSliderStep);
-                    ((SwingScilabSlider) uiControl).setMajorTickSpacing(majorSliderStep);
-                }
-                break;
-            case __GO_STYLE__:
-                /* Nothing to do unless we want to change style interactively */
-                break;
-            case __GO_UI_STRING__:
-                if (uiControl instanceof SwingScilabUiTable) {
-                    // Update column names
-                    String[] stringValue = (String[]) value;
-                    int colNb = ((Integer) controller.getProperty(uid, __GO_UI_STRING_COLNB__));
-                    String[] colNames = new String[colNb - 1];
-                    for (int k = 1; k < colNb; k++) {
-                        colNames[k - 1] = stringValue[k * (stringValue.length / colNb)];
-                    }
-                    ((SwingScilabUiTable) uiControl).setColumnNames(colNames);
-                    // Update row names
-                    String[] rowNames = new String[stringValue.length / colNb - 1];
-                    for (int k = 1; k < stringValue.length / colNb; k++) {
-                        rowNames[k - 1] = stringValue[k];
-                    }
-                    ((SwingScilabUiTable) uiControl).setRowNames(rowNames);
-                    // Update data
-                    String[] tableData = new String[rowNames.length * colNames.length];
-                    int kData = 0;
-                    for (int kCol = 1; kCol <= colNames.length; kCol++) {
-                        for (int kRow = 1; kRow <= rowNames.length; kRow++) {
-                            tableData[kData++] = stringValue[kCol * (stringValue.length / colNb) + kRow];
-                        }
-                    }
-                    if (tableData.length != 0) {
-                        ((SwingScilabUiTable) uiControl).setData(tableData);
-                    }
-                } else if (uiControl instanceof SwingScilabListBox) {
-                    // Listboxes manage string vectors
-                    ((SwingScilabListBox) uiControl).setText((String[]) value);
-                } else if (uiControl instanceof SwingScilabPopupMenu) {
-                    // Popupmenus manage string vectors
-                    ((SwingScilabPopupMenu) uiControl).setText((String[]) value);
-                } else if (uiControl instanceof SwingScilabEditBox) {
-                    double min = ((Double) controller.getProperty(uid, __GO_UI_MIN__));
-                    double max = ((Double) controller.getProperty(uid, __GO_UI_MAX__));
-                    if (max - min > 1.0) {
-                        ((SwingScilabEditBox) uiControl).setText((String[]) value);
-                        ((SwingScilabEditBox) uiControl).setMultiLineText(true);
-                    } else {
-                        uiControl.setText(((String[]) value)[0]);
-                        ((SwingScilabEditBox) uiControl).setMultiLineText(false);
-                    }
-                } else if (uiControl instanceof SwingScilabLayer) {
-                    SwingScilabLayer layer = (SwingScilabLayer)uiControl;
-                    //if intValue[0] is out of bounds, do not update view but let "wrong" value in model
-                    layer.setActiveLayerFromName(((String[]) value)[0]);
-                } else {
-                    uiControl.setText(((String[]) value)[0]);
-                }
+            }
+            case __GO_UI_STRING__: {
+                uiControl.setText(((String[]) value)[0]);
                 break;
+            }
             case __GO_UI_TOOLTIPSTRING__:
                 String[] tooltipString = ((String[]) value);
                 String tooltipText = tooltipString[0];
@@ -496,91 +237,7 @@ public final class SwingViewWidget {
                     uiControl.setToolTipText(tooltipText);
                 }
                 break;
-            case __GO_UI_STRING_COLNB__:
-                /* Nothing to do */
-            case __GO_TAG__:
-                /* Nothing to do */
-            case __GO_USER_DATA__:
-                /* Nothing to do here */
-            case __GO_UI_UNITS__:
-                /*
-                 * Nothing to do here, this property is used when setting
-                 * position
-                 */
-            case __GO_VALID__:
-                /* Nothing to do */
-                break;
-            case __GO_UI_VALUE__:
 
-                Double[] doubleValue = ((Double[]) value);
-                if (doubleValue.length == 0) {
-                    return;
-                }
-                int[] intValue = new int[doubleValue.length];
-                for (int k = 0; k < doubleValue.length; k++) {
-                    intValue[k] = doubleValue[k].intValue();
-                }
-
-                if (uiControl instanceof SwingScilabPopupMenu) {
-                    // Update selected items in the popupmenu
-                    ((SwingScilabPopupMenu) uiControl).setUserSelectedIndex(intValue[0]);
-                } else if (uiControl instanceof SwingScilabCheckBox) {
-                    // Check the checkbox if the value is equal to MAX property
-                    maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
-                    ((SwingScilabCheckBox) uiControl).setChecked(maxValue == intValue[0]);
-                } else if (uiControl instanceof SwingScilabRadioButton) {
-                    // Check the radiobutton if the value is equal to MAX property
-                    maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
-                    ((SwingScilabRadioButton) uiControl).setChecked(maxValue == intValue[0]);
-                } else if (uiControl instanceof SwingScilabScroll) {
-                    // Update the slider value
-                    ((SwingScilabScroll) uiControl).setUserValue(doubleValue[0]);
-                } else if (uiControl instanceof SwingScilabSlider) {
-                    // Update the slider value
-                    ((SwingScilabSlider) uiControl).setUserValue(doubleValue[0]);
-                } else if (uiControl instanceof SwingScilabUiImage) {
-                    // Update the image parameters
-                    double[] imageParams = new double[5];
-                    if (doubleValue.length < 1) {
-                        imageParams[0] = 1.0;
-                    } else {
-                        imageParams[0] = doubleValue[0];
-                    }
-                    if (doubleValue.length < 2) {
-                        imageParams[1] = 1.0;
-                    } else {
-                        imageParams[1] = doubleValue[1];
-                    }
-                    if (doubleValue.length < 3) {
-                        imageParams[2] = 0.0;
-                    } else {
-                        imageParams[2] = doubleValue[2];
-                    }
-                    if (doubleValue.length < 4) {
-                        imageParams[3] = 0.0;
-                    } else {
-                        imageParams[3] = doubleValue[3];
-                    }
-                    if (doubleValue.length < 5) {
-                        imageParams[4] = 0.0;
-                    } else {
-                        imageParams[4] = doubleValue[4];
-                    }
-                    double[] scale = new double[2];
-                    scale[0] = imageParams[0];
-                    scale[1] = imageParams[1];
-                    ((SwingScilabUiImage) uiControl).setScale(scale);
-                    double[] shear = new double[2];
-                    shear[0] = imageParams[2];
-                    shear[1] = imageParams[3];
-                    ((SwingScilabUiImage) uiControl).setShear(shear);
-                    ((SwingScilabUiImage) uiControl).setRotate(imageParams[4]);
-                } else if (uiControl instanceof SwingScilabLayer) {
-                    SwingScilabLayer layer = (SwingScilabLayer)uiControl;
-                    //if intValue[0] is out of bounds, do not update view but let "wrong" value in model
-                    layer.setActiveLayer(intValue[0]);
-                }
-                break;
             case __GO_UI_VERTICALALIGNMENT__ : {
                 String align = (String)value;
                 if (align.equals("") == false) {
@@ -589,121 +246,25 @@ public final class SwingViewWidget {
                 break;
             }
             case __GO_VISIBLE__ : {
-                boolean needUpdate = true;
-                if (uiControl instanceof SwingScilabFrame || uiControl instanceof SwingScilabScrollableFrame) {
-                    Component frame = (Component) uiControl;
-                    Integer parent = (Integer) controller.getProperty(uid, __GO_PARENT__);
-                    if (parent != 0) {
-                        Integer type = (Integer) controller.getProperty(parent, __GO_TYPE__);
-                        if (type == __GO_UICONTROL__) {
-                            Integer style = (Integer) controller.getProperty(parent, __GO_STYLE__);
-                            if (style == __GO_UI_LAYER__) {
-                                //no no no don't touch visible on layer children !
-                                Boolean visible = (Boolean)value;
-                                SwingScilabLayer layer = (SwingScilabLayer) SwingView.getFromId(parent);
-                                Boolean isActive = layer.isLayerActive(frame);
-                                if (isActive != visible ) {
-                                    controller.setProperty(uid, __GO_VISIBLE__, isActive);
-                                }
-
-                                needUpdate = false;
-                            }
-                        }
-                    }
-                }
-
-                if (needUpdate) {
-                    uiControl.setVisible(((Boolean) value).booleanValue());
-                }
+                uiControl.setVisible(((Boolean) value).booleanValue());
                 break;
             }
             case __GO_PARENT__:
                 /* Update position */
                 SwingViewWidget.update(uiControl, __GO_POSITION__, controller.getProperty(uid, __GO_POSITION__));
                 break;
-            case __GO_UI_GROUP_NAME__:
-                if (uiControl instanceof SwingScilabRadioButton || uiControl instanceof SwingScilabCheckBox) {
-                    String groupName = (String) value;
-                    if (groupName == null || groupName.equals("")) {
-                        //remove rb from buttonGroup Map
-                        GroupManager.getGroupManager().removeFromGroup((AbstractButton) uiControl);
-                    } else {
-                        GroupManager.getGroupManager().addToGroup(groupName, (AbstractButton) uiControl);
-                    }
-                }
-                break;
-            case __GO_LAYOUT__: {
-                if (uiControl instanceof SwingScilabScrollableFrame) {
-                    SwingScilabScrollableFrame frame = (SwingScilabScrollableFrame) uiControl;
-                    LayoutType newLayout = LayoutType.intToEnum((Integer) value);
-                    switch (newLayout) {
-                        case BORDER: {
-                            Integer[] padding = (Integer[]) controller.getProperty(frame.getId(), __GO_BORDER_OPT_PADDING__);
-                            frame.setLayout(new BorderLayout(padding[0], padding[1]));
-                            break;
-                        }
-                        case GRIDBAG:
-                            frame.setLayout(new GridBagLayout());
-                            break;
-                        case GRID: {
-                            Integer[] padding = (Integer[]) controller.getProperty(frame.getId(), __GO_GRID_OPT_PADDING__);
-                            Integer[] grid = (Integer[]) controller.getProperty(frame.getId(), __GO_GRID_OPT_GRID__);
-                            if (grid[0] == 0 && grid[1] == 0) {
-                                grid[0] = 1;
-                            }
-                            frame.setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
-                            break;
-                        }
-                        case NONE:
-                        default:
-                            frame.setLayout(null);
-                            break;
-                    }
-                } else if (uiControl instanceof SwingScilabFrame) {
-                    SwingScilabFrame frame = (SwingScilabFrame) uiControl;
-                    LayoutType newLayout = LayoutType.intToEnum((Integer) value);
-                    switch (newLayout) {
-                        case BORDER: {
-                            Integer[] padding = (Integer[]) controller.getProperty(frame.getId(), __GO_BORDER_OPT_PADDING__);
-                            frame.setLayout(new BorderLayout(padding[0], padding[1]));
-                            break;
-                        }
-                        case GRIDBAG:
-                            frame.setLayout(new GridBagLayout());
-                            break;
-                        case GRID: {
-                            Integer[] padding = (Integer[]) controller.getProperty(frame.getId(), __GO_GRID_OPT_PADDING__);
-                            Integer[] grid = (Integer[]) controller.getProperty(frame.getId(), __GO_GRID_OPT_GRID__);
-                            if (grid[0] == 0 && grid[1] == 0) {
-                                grid[0] = 1;
-                            }
-                            frame.setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
-                            break;
-                        }
-                        case NONE:
-                        default:
-                            frame.setLayout(null);
-                            break;
-                    }
-                }
-                break;
-            }
-            case __GO_UI_FRAME_BORDER__:
-                if (uiControl instanceof SwingScilabScrollableFrame) {
-                    SwingScilabScrollableFrame frame = (SwingScilabScrollableFrame) uiControl;
-                    Integer borderId = (Integer) value;
-                    Border border = BorderConvertor.getBorder(borderId);
-                    frame.setBorder(border);
-                } else if (uiControl instanceof SwingScilabFrame) {
-                    SwingScilabFrame frame = (SwingScilabFrame) uiControl;
-                    Integer borderId = (Integer) value;
-                    Border border = BorderConvertor.getBorder(borderId);
-                    frame.setBorder(border);
-                }
-
-                break;
             default:
-                //System.err.println("[SwingScilabWidget.update] Property not mapped: " + property);
+                break;
         }
     }
+
+    public static Double[] updatePosition(Widget uiControl, Integer uid, Object value) {
+        /* Convert value according to units */
+        UicontrolUnits unitsProperty = UnitsConverter.stringToUnitsEnum((String) GraphicController.getController().getProperty(uid, __GO_UI_UNITS__));
+        Double[] dblValues = UnitsConverter.convertPositionToPixels((Double[]) value, unitsProperty, uiControl);
+        // Set dimensions before position because position is adjusted according to size
+        uiControl.setDims(new Size(dblValues[WIDTH_INDEX].intValue(), dblValues[HEIGHT_INDEX].intValue()));
+        uiControl.setPosition(new Position(dblValues[X_INDEX].intValue(), dblValues[Y_INDEX].intValue()));
+        return dblValues;
+    }
 }
index 008777f..3d47029 100644 (file)
@@ -61,10 +61,6 @@ import org.scilab.modules.gui.helpbrowser.SimpleHelpBrowser;
 import org.scilab.modules.gui.label.Label;
 import org.scilab.modules.gui.label.ScilabLabelBridge;
 import org.scilab.modules.gui.label.SimpleLabel;
-import org.scilab.modules.gui.layout.BorderLayout;
-import org.scilab.modules.gui.layout.FlowLayout;
-import org.scilab.modules.gui.layout.ScilabBorderLayoutBridge;
-import org.scilab.modules.gui.layout.ScilabFlowLayoutBridge;
 import org.scilab.modules.gui.listbox.ListBox;
 import org.scilab.modules.gui.listbox.ScilabListBoxBridge;
 import org.scilab.modules.gui.listbox.SimpleListBox;
@@ -4757,28 +4753,6 @@ public class ScilabBridge {
         ScilabPopupMenuBridge.requestFocus(popupMenu);
     }
 
-    /*********************/
-    /* FlowLayout Bridge */
-    /*********************/
-    /**
-     * Creates a new FlowLayout
-     * @return the created FlowLayout
-     */
-    public static FlowLayout createFlowLayout() {
-        return ScilabFlowLayoutBridge.createFlowLayout();
-    }
-
-    /***********************/
-    /* BorderLayout Bridge */
-    /***********************/
-    /**
-     * Creates a new BorderLayout
-     * @return the created BorderLayout
-     */
-    public static BorderLayout createBorderLayout() {
-        return ScilabBorderLayoutBridge.createBorderLayout();
-    }
-
     /***********************/
     /* FileChooser Bridge */
     /***********************/
index 1714e47..fa1f5ce 100644 (file)
@@ -81,16 +81,16 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
                     if (groupname != null && groupname.equals("") == false) {
                         Enumeration<AbstractButton> elements = GroupManager.getGroupManager().getGroupElements(groupname);
                         while (elements.hasMoreElements()) {
-                            AbstractButton aButton =  elements.nextElement();
+                            AbstractButton aButton = elements.nextElement();
                             if (aButton == e.getSource()) {
                                 continue;
                             }
 
                             Integer id = 0;
                             if (aButton instanceof SwingScilabRadioButton) {
-                                id = ((SwingScilabRadioButton)aButton).getId();
+                                id = ((SwingScilabRadioButton) aButton).getId();
                             } else if (aButton instanceof SwingScilabRadioButton) {
-                                id = ((SwingScilabCheckBox)aButton).getId();
+                                id = ((SwingScilabCheckBox) aButton).getId();
                             } else {
                                 continue;
                             }
@@ -102,7 +102,6 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
                     }
                 }
 
-
                 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, value);
                 if (callback != null) {
                     callback.actionPerformed(e);
@@ -131,7 +130,8 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
     }
 
     /**
-     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab CheckBox
+     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * CheckBox
      * @return the position of the CheckBox
      * @see org.scilab.modules.gui.uielement.UIElement#getPosition()
      */
@@ -149,7 +149,8 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
     }
 
     /**
-     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab CheckBox
+     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * CheckBox
      * @param newPosition the position we want to set to the CheckBox
      * @see org.scilab.modules.gui.uielement.UIElement#setPosition(org.scilab.modules.gui.utils.Position)
      */
@@ -241,11 +242,11 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
                 boolean selected = false;
 
                 if (aButton instanceof SwingScilabRadioButton) {
-                    id = ((SwingScilabRadioButton)aButton).getId();
-                    selected = ((SwingScilabRadioButton)aButton).isSelected();
+                    id = ((SwingScilabRadioButton) aButton).getId();
+                    selected = ((SwingScilabRadioButton) aButton).isSelected();
                 } else if (aButton instanceof SwingScilabCheckBox) {
-                    id = ((SwingScilabCheckBox)aButton).getId();
-                    selected = ((SwingScilabCheckBox)aButton).isSelected();
+                    id = ((SwingScilabCheckBox) aButton).getId();
+                    selected = ((SwingScilabCheckBox) aButton).isSelected();
                 } else {
                     continue;
                 }
@@ -336,11 +337,55 @@ public class SwingScilabCheckBox extends JCheckBox implements SwingViewObject, S
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        GraphicController controller = GraphicController.getController();
+        switch (property) {
+            case __GO_UI_GROUP_NAME__: {
+                String groupName = (String) value;
+                if (groupName == null || groupName.equals("")) {
+                    //remove rb from buttonGroup Map
+                    GroupManager.getGroupManager().removeFromGroup(this);
+                } else {
+                    GroupManager.getGroupManager().addToGroup(groupName, this);
+                }
+                break;
+            }
+            case __GO_UI_MAX__: {
+                Double maxValue = ((Double) value);
+                Double[] allValues = (Double[]) controller.getProperty(uid, __GO_UI_VALUE__);
+                if ((allValues == null) || (allValues.length == 0)) {
+                    return;
+                }
+
+                double uicontrolValue = allValues[0];
+                // Check/Uncheck the CheckBox
+                setChecked(maxValue == uicontrolValue);
+                break;
+            }
+            case __GO_UI_VALUE__: {
+                Double[] doubleValue = ((Double[]) value);
+                if (doubleValue.length == 0) {
+                    return;
+                }
+
+                int[] intValue = new int[doubleValue.length];
+                for (int k = 0; k < doubleValue.length; k++) {
+                    intValue[k] = doubleValue[k].intValue();
+                }
+
+                // Check the checkbox if the value is equal to MAX property
+                Integer maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
+                setChecked(maxValue == intValue[0]);
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+                break;
+            }
+        }
     }
 
     public void resetBackground() {
-        Color color = (Color)UIManager.getLookAndFeelDefaults().get("CheckBox.background");
+        Color color = (Color) UIManager.getLookAndFeelDefaults().get("CheckBox.background");
         if (color != null) {
             setBackground(color);
         }
index 7fe1ebd..e8815c8 100644 (file)
 package org.scilab.modules.gui.bridge.editbox;
 
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 
 import java.awt.Color;
-import java.awt.Dimension;
 import java.awt.Font;
-import java.awt.Graphics;
 import java.awt.event.ActionEvent;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
@@ -29,7 +28,6 @@ import java.awt.event.KeyEvent;
 import javax.swing.AbstractAction;
 import javax.swing.InputMap;
 import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
 import javax.swing.JTextPane;
 import javax.swing.KeyStroke;
 import javax.swing.ScrollPaneConstants;
@@ -67,7 +65,6 @@ import org.scilab.modules.gui.utils.Size;
 /**
  * Swing implementation for Scilab EditBox in GUIs
  * @author Vincent COUVERT
- * @author Marouane BEN JELLOUL
  */
 public class SwingScilabEditBox extends JScrollPane implements SwingViewObject, SimpleEditBox {
 
@@ -448,25 +445,46 @@ public class SwingScilabEditBox extends JScrollPane implements SwingViewObject,
      * @param value property value
      */
     public void update(int property, Object value) {
+        GraphicController controller = GraphicController.getController();
+
         switch (property) {
-            case __GO_UI_MAX__ : {
-                //                Double columns = (Double)value;
-                //                Graphics g = textPane.getGraphics();
-                //                Integer width = 50;
-                //                if (g != null) {
-                //                    width = textPane.getGraphics().getFontMetrics(textPane.getFont()).charWidth('m');
-                //                }
-                //                Integer totalWidth = columns.intValue() * width;
-                //                Dimension current = textPane.getPreferredSize();
-                //                System.out.println("current : " + current.toString());
-                //                current.width = totalWidth;
-                //                textPane.setPreferredSize(current);
-                //                current = textPane.getPreferredSize();
-                //                System.out.println("new : " + current.toString());
+            case __GO_UI_MAX__: {
+                double min = ((Double) controller.getProperty(uid, __GO_UI_MIN__));
+                double max = ((Double) controller.getProperty(uid, __GO_UI_MAX__));
+                if (max - min > 1.0) {
+                    setMultiLineText(true);
+                } else {
+                    setMultiLineText(false);
+                }
+                // Force String update
+                update(__GO_UI_STRING__, GraphicController.getController().getProperty(uid, __GO_UI_STRING__));
                 break;
             }
-
-            default : {
+            case __GO_UI_MIN__: {
+                Double min = ((Double) value);
+                Double max = ((Double) controller.getProperty(uid, __GO_UI_MAX__));
+                if (max - min > 1.0) {
+                    setMultiLineText(true);
+                } else {
+                    setMultiLineText(false);
+                }
+                // Force String update
+                update(__GO_UI_STRING__, GraphicController.getController().getProperty(uid, __GO_UI_STRING__));
+                break;
+            }
+            case __GO_UI_STRING__: {
+                double min = ((Double) controller.getProperty(uid, __GO_UI_MIN__));
+                double max = ((Double) controller.getProperty(uid, __GO_UI_MAX__));
+                if (max - min > 1.0) {
+                    setText((String[]) value);
+                    setMultiLineText(true);
+                } else {
+                    setText(((String[]) value)[0]);
+                    setMultiLineText(false);
+                }
+                break;
+            }
+            default: {
                 SwingViewWidget.update(this, property, value);
                 break;
             }
index 736aa24..e262353 100644 (file)
 
 package org.scilab.modules.gui.bridge.frame;
 
+
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_PARENT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_STYLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TYPE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UICONTROL__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ENABLE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_FRAME_BORDER__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LAYER__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -32,12 +45,14 @@ import java.awt.event.ComponentListener;
 
 import javax.swing.JPanel;
 import javax.swing.UIManager;
+import javax.swing.border.Border;
 
 import org.scilab.modules.graphic_objects.axes.AxesContainer;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicModel.GraphicModel;
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
+import org.scilab.modules.graphic_objects.utils.LayoutType;
 import org.scilab.modules.gui.SwingView;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
@@ -71,10 +86,12 @@ import org.scilab.modules.gui.slider.Slider;
 import org.scilab.modules.gui.tab.Tab;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.utils.BorderConvertor;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.PositionConverter;
 import org.scilab.modules.gui.utils.ScilabRelief;
 import org.scilab.modules.gui.utils.Size;
+import org.scilab.modules.gui.widget.Widget;
 
 /**
  * Swing implementation for Scilab frames in GUI
@@ -749,9 +766,26 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        GraphicController controller = GraphicController.getController();
+
         switch (property) {
-            case __GO_UI_STRING__:
+            case __GO_UI_VALUE__: {
+                Double[] doubleValue = ((Double[]) value);
+                if (doubleValue.length == 0) {
+                    return;
+                }
+
+                int[] intValue = new int[doubleValue.length];
+                for (int k = 0; k < doubleValue.length; k++) {
+                    intValue[k] = doubleValue[k].intValue();
+                }
+
+                SwingScilabLayer layer = (SwingScilabLayer) this;
+                //if intValue[0] is out of bounds, do not update view but let "wrong" value in model
+                layer.setActiveLayer(intValue[0]);
+                break;
+            }
+            case __GO_UI_STRING__: {
                 // Update tab title
                 Container parent = getParent();
                 if (parent instanceof SwingScilabTabGroup) {
@@ -761,12 +795,84 @@ public class SwingScilabFrame extends JPanel implements SwingViewObject, SimpleF
                         tab.setTitleAt(index, ((String[]) value)[0]);
                     }
                 }
+
+                if (this instanceof SwingScilabLayer) {
+                    SwingScilabLayer layer = (SwingScilabLayer) this;
+                    //if intValue[0] is out of bounds, do not update view but let "wrong" value in model
+                    layer.setActiveLayerFromName(((String[]) value)[0]);
+                }
                 break;
-            case __GO_POSITION__:
+            }
+            case __GO_POSITION__: {
+                SwingViewWidget.updatePosition(this, uid, value);
                 revalidate();
                 doLayout();
                 break;
-            default :
+            }
+            case __GO_UI_FRAME_BORDER__: {
+                Integer borderId = (Integer) value;
+                Border border = BorderConvertor.getBorder(borderId);
+                setBorder(border);
+                break;
+            }
+            case __GO_LAYOUT__: {
+                LayoutType newLayout = LayoutType.intToEnum((Integer) value);
+                switch (newLayout) {
+                    case BORDER: {
+                        Integer[] padding = (Integer[]) controller.getProperty(getId(), __GO_BORDER_OPT_PADDING__);
+                        setLayout(new BorderLayout(padding[0], padding[1]));
+                        break;
+                    }
+                    case GRIDBAG:
+                        setLayout(new GridBagLayout());
+                        break;
+                    case GRID: {
+                        Integer[] padding = (Integer[]) controller.getProperty(getId(), __GO_GRID_OPT_PADDING__);
+                        Integer[] grid = (Integer[]) controller.getProperty(getId(), __GO_GRID_OPT_GRID__);
+                        if (grid[0] == 0 && grid[1] == 0) {
+                            grid[0] = 1;
+                        }
+
+                        setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
+                        break;
+                    }
+                    case NONE:
+                    default: {
+                        setLayout(null);
+                        break;
+                    }
+                }
+                break;
+            }
+            case __GO_VISIBLE__: {
+                boolean needUpdate = true;
+                Integer parent = (Integer) controller.getProperty(uid, __GO_PARENT__);
+                if (parent != 0) {
+                    Integer type = (Integer) controller.getProperty(parent, __GO_TYPE__);
+                    if (type == __GO_UICONTROL__) {
+                        Integer style = (Integer) controller.getProperty(parent, __GO_STYLE__);
+                        if (style == __GO_UI_LAYER__) {
+                            //no no no don't touch visible on layer children !
+                            Boolean visible = (Boolean) value;
+                            SwingScilabLayer layer = (SwingScilabLayer) SwingView.getFromId(parent);
+                            Boolean isActive = layer.isLayerActive(this);
+                            if (isActive != visible) {
+                                controller.setProperty(uid, __GO_VISIBLE__, isActive);
+                            }
+
+                            needUpdate = false;
+                        }
+                    }
+                }
+
+                if (needUpdate) {
+                    setVisible(((Boolean) value).booleanValue());
+                }
+
+                break;
+            }
+            default:
+                SwingViewWidget.update(this, property, value);
                 break;
         }
     }
index 5bc32b0..e6a2000 100644 (file)
@@ -13,9 +13,7 @@
 
 package org.scilab.modules.gui.bridge.frame;
 
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ENABLE__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.*;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -39,6 +37,7 @@ import javax.swing.border.Border;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicModel.GraphicModel;
 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
+import org.scilab.modules.graphic_objects.utils.LayoutType;
 import org.scilab.modules.gui.SwingView;
 import org.scilab.modules.gui.SwingViewObject;
 import org.scilab.modules.gui.SwingViewWidget;
@@ -52,6 +51,7 @@ import org.scilab.modules.gui.frame.SimpleFrame;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.utils.BorderConvertor;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.PositionConverter;
 import org.scilab.modules.gui.utils.ScilabRelief;
@@ -242,11 +242,7 @@ public class SwingScilabScrollableFrame extends JScrollPane implements SwingView
         } else if (getLayout() instanceof GridLayout) {
             this.panel.add((Component) member, 0);
         } else {
-            //define width and height for panel
-            //and set preferred size
-
             panel.add((Component) member);
-            updateChildPosition((JComponent)member);
         }
 
         SwingScilabPanel win = (SwingScilabPanel)SwingUtilities.getAncestorOfClass(SwingScilabPanel.class, this);
@@ -412,6 +408,8 @@ public class SwingScilabScrollableFrame extends JScrollPane implements SwingView
      * @param value property value
      */
     public void update(int property, Object value) {
+        GraphicController controller = GraphicController.getController();
+
         switch (property) {
             case __GO_UI_STRING__: {
                 // Update tab title
@@ -419,7 +417,7 @@ public class SwingScilabScrollableFrame extends JScrollPane implements SwingView
                 if (parent instanceof SwingScilabTabGroup) {
                     SwingScilabTabGroup tab = (SwingScilabTabGroup) parent;
                     Component[] components = tab.getComponents();
-                    for (int i = 0; i < components.length ; ++i) {
+                    for (int i = 0; i < components.length; ++i) {
                         if (components[i] instanceof SwingScilabScrollableFrame && this.getId() == ((SwingScilabScrollableFrame) components[i]).getId()) {
                             tab.setTitleAt(i, ((String[]) value)[0]);
                             break;
@@ -428,7 +426,68 @@ public class SwingScilabScrollableFrame extends JScrollPane implements SwingView
                 }
                 break;
             }
-            default :
+            case __GO_UI_FRAME_BORDER__: {
+                Integer borderId = (Integer) value;
+                Border border = BorderConvertor.getBorder(borderId);
+                setBorder(border);
+                break;
+            }
+            case __GO_LAYOUT__ : {
+                LayoutType newLayout = LayoutType.intToEnum((Integer) value);
+                switch (newLayout) {
+                    case BORDER: {
+                        Integer[] padding = (Integer[]) controller.getProperty(getId(), __GO_BORDER_OPT_PADDING__);
+                        setLayout(new BorderLayout(padding[0], padding[1]));
+                        break;
+                    }
+                    case GRIDBAG:
+                        setLayout(new GridBagLayout());
+                        break;
+                    case GRID: {
+                        Integer[] padding = (Integer[]) controller.getProperty(getId(), __GO_GRID_OPT_PADDING__);
+                        Integer[] grid = (Integer[]) controller.getProperty(getId(), __GO_GRID_OPT_GRID__);
+                        if (grid[0] == 0 && grid[1] == 0) {
+                            grid[0] = 1;
+                        }
+                        setLayout(new GridLayout(grid[0], grid[1], padding[0], padding[1]));
+                        break;
+                    }
+                    case NONE:
+                    default: {
+                        setLayout(null);
+                        break;
+                    }
+                }
+                break;
+            }
+            case __GO_VISIBLE__ : {
+                boolean needUpdate = true;
+                Integer parent = (Integer) controller.getProperty(uid, __GO_PARENT__);
+                if (parent != 0) {
+                    Integer type = (Integer) controller.getProperty(parent, __GO_TYPE__);
+                    if (type == __GO_UICONTROL__) {
+                        Integer style = (Integer) controller.getProperty(parent, __GO_STYLE__);
+                        if (style == __GO_UI_LAYER__) {
+                            //no no no don't touch visible on layer children !
+                            Boolean visible = (Boolean)value;
+                            SwingScilabLayer layer = (SwingScilabLayer) SwingView.getFromId(parent);
+                            Boolean isActive = layer.isLayerActive(this);
+                            if (isActive != visible ) {
+                                controller.setProperty(uid, __GO_VISIBLE__, isActive);
+                            }
+
+                            needUpdate = false;
+                        }
+                    }
+                }
+
+                if (needUpdate) {
+                    setVisible(((Boolean) value).booleanValue());
+                }
+
+                break;
+            }
+            default:
                 SwingViewWidget.update(this, property, value);
                 break;
         }
@@ -476,42 +535,6 @@ public class SwingScilabScrollableFrame extends JScrollPane implements SwingView
         return null;
     }
 
-    public void updateChildPosition(JComponent child) {
-        /*        System.out.println("updateChildPosition");
-                Dimension size = child.getSize();
-                System.out.println("child size : " + size.toString());
-                Point loc = child.getLocation();
-                System.out.println("child loc : " + loc.toString());
-                if(Math.abs(loc.x + size.width) > panelSize.width) {
-                    System.out.println("update width from " + panelSize.width + " to " + Math.abs(loc.x + size.width));
-                    panelSize.width = Math.abs(loc.x + size.width);
-                }
-
-                if(Math.abs(loc.y + size.height) > panelSize.height) {
-                    System.out.println("update height from " + panelSize.height + " to " + Math.abs(loc.y + size.height));
-                    panelSize.height = Math.abs(loc.y + size.height);
-                }
-
-                if(loc.x < panelLoc.x) {
-                    System.out.println("update x from " + panelLoc.x + " to " + loc.x);
-                    panelLoc.x = loc.x;
-                }
-
-                if(loc.y < panelLoc.y) {
-                    System.out.println("update y from " + panelLoc.y + " to " + loc.y);
-                    panelLoc.y = loc.y;
-                }
-
-                panel.setPreferredSize(panelSize);
-                panel.setLocation(panelLoc);
-                Point newLoc = panel.getLocation();
-                System.out.println("newLoc : " + newLoc.toString());
-                System.out.println("view port location : " + getViewport().getViewPosition().toString());
-                System.out.println("view port size : " + getViewport().getViewSize().toString());
-                revalidate();
-        */
-    }
-
     public void setBorder(Border border) {
         if (panel != null) {
             panel.setBorder(border);
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/layout/SwingScilabBorderLayout.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/layout/SwingScilabBorderLayout.java
deleted file mode 100644 (file)
index 04a92c9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.bridge.layout;
-
-import org.scilab.modules.gui.layout.BorderLayout;
-
-/**
- * Swing implementation for Scilab BorderLayout in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class SwingScilabBorderLayout extends java.awt.BorderLayout implements BorderLayout {
-
-    private static final long serialVersionUID = 222353824141297435L;
-
-    /**
-     * Constructor
-     */
-    public SwingScilabBorderLayout() {
-        super();
-    }
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/layout/SwingScilabFlowLayout.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/layout/SwingScilabFlowLayout.java
deleted file mode 100644 (file)
index 29d3174..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.bridge.layout;
-
-import org.scilab.modules.gui.layout.FlowLayout;
-
-/**
- * Swing implementation for Scilab FlowLayout in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class SwingScilabFlowLayout extends java.awt.FlowLayout implements FlowLayout {
-
-    private static final long serialVersionUID = 1947906560190763378L;
-
-    /**
-     * Constructor
-     */
-    public SwingScilabFlowLayout() {
-        super();
-    }
-}
index 2419917..fe6093c 100644 (file)
@@ -14,8 +14,7 @@
 
 package org.scilab.modules.gui.bridge.listbox;
 
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_LISTBOXTOP__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.*;
 
 import java.awt.Color;
 import java.awt.Font;
@@ -53,6 +52,8 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
 
     private static final long serialVersionUID = 3507396207331058895L;
 
+    private static final int COLORS_COEFF = 255;
+
     private Integer uid;
 
     private CommonCallBack callback;
@@ -82,7 +83,6 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
                     scilabIndices[i] = (double) javaIndices[i] + 1;
                 }
 
-                System.out.println("scilabIndices : " + scilabIndices.length);
                 GraphicController.getController().setProperty(uid, __GO_UI_VALUE__, scilabIndices);
                 if (e.getButton() == MouseEvent.BUTTON1 && callback != null) {
                     callback.actionPerformed(null);
@@ -516,6 +516,7 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
      * @param value property value
      */
     public void update(int property, Object value) {
+        GraphicController controller = GraphicController.getController();
         switch (property) {
             case __GO_UI_VALUE__ : {
                 Double[] indexes = (Double[])value;
@@ -526,9 +527,46 @@ public class SwingScilabListBox extends JScrollPane implements SwingViewObject,
                 setSelectedIndices(index);
                 break;
             }
-
-            default : {
+            case __GO_UI_BACKGROUNDCOLOR__ : {
+                Double[] allColors = ((Double[]) value);
+                if (allColors[0] != -1) {
+                    setListBackground(new Color((int) (allColors[0] * COLORS_COEFF),
+                                                (int) (allColors[1] * COLORS_COEFF),
+                                                (int) (allColors[2] * COLORS_COEFF)));
+                } else {
+                    resetBackground();
+                }
+                break;
+            }
+            case __GO_UI_STRING__ : {
+                // Listboxes manage string vectors
+                setText((String[]) value);
+                break;
+            }
+            case __GO_UI_MAX__ : {
+                Double maxValue = ((Double) value);
+                // Enable/Disable multiple selection
+                double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
+                setMultipleSelectionEnabled(maxValue - minValue > 1);
+                break;
+            }
+            case __GO_UI_MIN__ : {
+                Double minValue = ((Double) value);
+                // Enable/Disable multiple selection
+                Double maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
+                setMultipleSelectionEnabled(maxValue - minValue > 1);
+                break;
+            }
+            case __GO_UI_LISTBOXTOP__: {
+                Integer[] listboxtopValue = ((Integer[]) value);
+                if (listboxtopValue.length > 0) {
+                    setListBoxTop(listboxtopValue[0]);
+                }
+                break;
+            }
+            default: {
                 SwingViewWidget.update(this, property, value);
+                break;
             }
         }
     }
index f309ab6..12628b8 100644 (file)
@@ -14,6 +14,7 @@
 
 package org.scilab.modules.gui.bridge.popupmenu;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
 import java.awt.Color;
@@ -24,8 +25,8 @@ import javax.swing.JComboBox;
 import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
-import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
+import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.popupmenu.SimplePopupMenu;
@@ -68,7 +69,6 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
                     callback.actionPerformed(null);
                 }
 
-
             }
         };
         addActionListener(defaultActionListener);
@@ -338,13 +338,15 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
     }
 
     /**
-     * Class created as a workaround for bug: http://bugzilla.scilab.org/show_bug.cgi?id=7898
-     * This bug is a Java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4133743
+     * Class created as a workaround for bug:
+     * http://bugzilla.scilab.org/show_bug.cgi?id=7898 This bug is a Java bug:
+     * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4133743
      *
      * This workaround has been proposed by a user on Java bug tracker.
      *
-     * The toString method will be used to display the elements, but because the class inherits its
-     * equals method from Object instead of String, none of the elements are considered duplicates.
+     * The toString method will be used to display the elements, but because the
+     * class inherits its equals method from Object instead of String, none of
+     * the elements are considered duplicates.
      *
      */
     private class SwingScilabPopupMenuItem {
@@ -392,11 +394,35 @@ public class SwingScilabPopupMenu extends JComboBox implements SwingViewObject,
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        switch (property) {
+            case __GO_UI_STRING__: {
+                setText((String[]) value);
+                break;
+            }
+            case __GO_UI_VALUE__: {
+                Double[] doubleValue = ((Double[]) value);
+                if (doubleValue.length == 0) {
+                    return;
+                }
+
+                int[] intValue = new int[doubleValue.length];
+                for (int k = 0; k < doubleValue.length; k++) {
+                    intValue[k] = doubleValue[k].intValue();
+                }
+
+                // Update selected items in the popupmenu
+                setUserSelectedIndex(intValue[0]);
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+                break;
+            }
+        }
     }
 
     public void resetBackground() {
-        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ComboBox.background");
+        Color color = (Color) UIManager.getLookAndFeelDefaults().get("ComboBox.background");
         if (color != null) {
             setBackground(color);
         }
index d3d8f6d..2fc9994 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2007 - INRIA - Vincent Couvert
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
@@ -82,16 +81,16 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
                     if (groupname != null && groupname.equals("") == false) {
                         Enumeration<AbstractButton> elements = GroupManager.getGroupManager().getGroupElements(groupname);
                         while (elements.hasMoreElements()) {
-                            AbstractButton aButton =  elements.nextElement();
+                            AbstractButton aButton = elements.nextElement();
                             if (aButton == e.getSource()) {
                                 continue;
                             }
 
                             Integer id = 0;
                             if (aButton instanceof SwingScilabRadioButton) {
-                                id = ((SwingScilabRadioButton)aButton).getId();
+                                id = ((SwingScilabRadioButton) aButton).getId();
                             } else if (aButton instanceof SwingScilabRadioButton) {
-                                id = ((SwingScilabCheckBox)aButton).getId();
+                                id = ((SwingScilabCheckBox) aButton).getId();
                             } else {
                                 continue;
                             }
@@ -131,7 +130,8 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
     }
 
     /**
-     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab RadioButton
+     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * RadioButton
      * @return the position of the RadioButton
      * @see org.scilab.modules.gui.uielement.UIElement#getPosition()
      */
@@ -149,7 +149,8 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
     }
 
     /**
-     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab RadioButton
+     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * RadioButton
      * @param newPosition the position to set to the RadioButton
      * @see org.scilab.modules.gui.uielement.UIElement#setPosition(org.scilab.modules.gui.utils.Position)
      */
@@ -228,7 +229,6 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
             removeActionListener(actListener);
         }
 
-
         String groupname = (String) GraphicController.getController().getProperty(uid, __GO_UI_GROUP_NAME__);
         if (groupname != null && groupname.equals("") == false) {
             // use setSelected of ButtonGroup instead of JRadioButton
@@ -243,11 +243,11 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
                 boolean selected = false;
 
                 if (aButton instanceof SwingScilabRadioButton) {
-                    id = ((SwingScilabRadioButton)aButton).getId();
-                    selected = ((SwingScilabRadioButton)aButton).isSelected();
+                    id = ((SwingScilabRadioButton) aButton).getId();
+                    selected = ((SwingScilabRadioButton) aButton).isSelected();
                 } else if (aButton instanceof SwingScilabCheckBox) {
-                    id = ((SwingScilabCheckBox)aButton).getId();
-                    selected = ((SwingScilabCheckBox)aButton).isSelected();
+                    id = ((SwingScilabCheckBox) aButton).getId();
+                    selected = ((SwingScilabCheckBox) aButton).isSelected();
                 } else {
                     continue;
                 }
@@ -332,16 +332,58 @@ public class SwingScilabRadioButton extends JRadioButton implements SwingViewObj
     }
 
     /**
-    * Generic update method
-    * @param property property name
-    * @param value property value
-    */
+     * Generic update method
+     * @param property property name
+     * @param value property value
+     */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        GraphicController controller = GraphicController.getController();
+        switch (property) {
+            case __GO_UI_GROUP_NAME__: {
+                String groupName = (String) value;
+                if (groupName == null || groupName.equals("")) {
+                    //remove rb from buttonGroup Map
+                    GroupManager.getGroupManager().removeFromGroup(this);
+                } else {
+                    GroupManager.getGroupManager().addToGroup(groupName, this);
+                }
+                break;
+            }
+            case __GO_UI_MAX__: {
+                Double maxValue = ((Double) value);
+                Double[] allValues = (Double[]) controller.getProperty(uid, __GO_UI_VALUE__);
+                if ((allValues == null) || (allValues.length == 0)) {
+                    return;
+                }
+                double uicontrolValue = allValues[0];
+                // Check/Uncheck the RadioButton
+                setChecked(maxValue == uicontrolValue);
+                break;
+            }
+            case __GO_UI_VALUE__: {
+                Double[] doubleValue = ((Double[]) value);
+                if (doubleValue.length == 0) {
+                    return;
+                }
+
+                int[] intValue = new int[doubleValue.length];
+                for (int k = 0; k < doubleValue.length; k++) {
+                    intValue[k] = doubleValue[k].intValue();
+                }
+
+                // Check the radiobutton if the value is equal to MAX property
+                Integer maxValue = ((Double) controller.getProperty(uid, __GO_UI_MAX__)).intValue();
+                setChecked(maxValue == intValue[0]);
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+            }
+        }
     }
 
     public void resetBackground() {
-        Color color = (Color)UIManager.getLookAndFeelDefaults().get("RadioButton.background");
+        Color color = (Color) UIManager.getLookAndFeelDefaults().get("RadioButton.background");
         if (color != null) {
             setBackground(color);
         }
index 1e999db..ca8ea53 100644 (file)
 
 package org.scilab.modules.gui.bridge.slider;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
 
 import java.awt.Color;
@@ -25,8 +27,8 @@ import javax.swing.JScrollBar;
 import javax.swing.UIManager;
 
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
-import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.SwingViewObject;
+import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.slider.SimpleSlider;
@@ -65,7 +67,8 @@ public class SwingScilabScroll extends JScrollBar implements SwingViewObject, Si
         super();
         // needed to have slider working with GLCanvas
         setOpaque(true);
-        setFocusable(true); /* Enable to manage the slider using keyboard (See bug #10840) */
+        /* Enable to manage the slider using keyboard (See bug #10840) */
+        setFocusable(true);
         setMinimum(MINIMUM_VALUE);
         setMaximum(MAXIMUM_VALUE + getVisibleAmount());
         adjustmentListener = new AdjustmentListener() {
@@ -98,7 +101,8 @@ public class SwingScilabScroll extends JScrollBar implements SwingViewObject, Si
     }
 
     /**
-     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab Slider
+     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * Slider
      * @return the position of the Slider
      * @see org.scilab.modules.gui.uielement.UIElement#getPosition()
      */
@@ -117,7 +121,8 @@ public class SwingScilabScroll extends JScrollBar implements SwingViewObject, Si
     }
 
     /**
-     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab Slider
+     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * Slider
      * @param newPosition the position to set to the Slider
      * @see org.scilab.modules.gui.uielement.UIElement#setPosition(org.scilab.modules.gui.utils.Position)
      */
@@ -343,7 +348,64 @@ public class SwingScilabScroll extends JScrollBar implements SwingViewObject, Si
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        GraphicController controller = GraphicController.getController();
+
+        switch (property) {
+            case __GO_UI_MAX__: {
+                Double maxValue = (Double) value;
+                // Update the slider properties
+                Double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
+                setMaximumValue(maxValue);
+                Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
+                double minorSliderStep = sliderStep[0].doubleValue();
+                double majorSliderStep = sliderStep[1].doubleValue();
+                if (minValue <= maxValue) {
+                    setMinorTickSpacing(minorSliderStep);
+                    setMajorTickSpacing(majorSliderStep);
+                }
+                break;
+            }
+            case __GO_UI_MIN__: {
+                Double minValue = (Double) value;
+                // Update the slider properties
+                Double maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
+                setMinimumValue(minValue);
+                Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
+                double minorSliderStep = sliderStep[0].doubleValue();
+                double majorSliderStep = sliderStep[1].doubleValue();
+                if (minValue <= maxValue) {
+                    setMinorTickSpacing(minorSliderStep);
+                    setMajorTickSpacing(majorSliderStep);
+                }
+                break;
+            }
+            case __GO_POSITION__: {
+                Double[] dblValues = SwingViewWidget.updatePosition(this, uid, value);
+                if (dblValues[0].intValue() > dblValues[1].intValue()) {
+                    setHorizontal();
+                } else {
+                    setVertical();
+                }
+                break;
+            }
+            case __GO_UI_SLIDERSTEP__: {
+                Double[] sliderStep = ((Double[]) value);
+                double minorSliderStep = sliderStep[0].doubleValue();
+                double majorSliderStep = sliderStep[1].doubleValue();
+                setMinorTickSpacing(minorSliderStep);
+                setMajorTickSpacing(majorSliderStep);
+                break;
+            }
+            case __GO_UI_VALUE__: {
+                Double[] doubleValue = ((Double[]) value);
+                setUserValue(doubleValue[0]);
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+                break;
+            }
+        }
     }
 
     /**
@@ -358,7 +420,7 @@ public class SwingScilabScroll extends JScrollBar implements SwingViewObject, Si
     }
 
     public void resetBackground() {
-        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ScrollBar.background");
+        Color color = (Color) UIManager.getLookAndFeelDefaults().get("ScrollBar.background");
         if (color != null) {
             setBackground(color);
         }
index 7acca5e..561cffd 100644 (file)
@@ -12,6 +12,7 @@
 
 package org.scilab.modules.gui.bridge.slider;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MAX__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_MIN__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_SLIDERSTEP__;
@@ -44,8 +45,7 @@ import org.scilab.modules.gui.utils.Size;
 
 /**
  * Swing implementation for Scilab Slider in GUIs
- * @author Vincent COUVERT
- * @author Marouane BEN JELLOUL
+ * @author Antoine ELIAS
  */
 public class SwingScilabSlider extends JSlider implements SwingViewObject, SimpleSlider {
 
@@ -412,7 +412,64 @@ public class SwingScilabSlider extends JSlider implements SwingViewObject, Simpl
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        GraphicController controller = GraphicController.getController();
+
+        switch (property) {
+            case __GO_UI_MAX__: {
+                Double maxValue = (Double) value;
+                // Update the slider properties
+                Double minValue = (Double) controller.getProperty(uid, __GO_UI_MIN__);
+                setMaximumValue(maxValue);
+                Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
+                double minorSliderStep = sliderStep[0].doubleValue();
+                double majorSliderStep = sliderStep[1].doubleValue();
+                if (minValue <= maxValue) {
+                    setMinorTickSpacing(minorSliderStep);
+                    setMajorTickSpacing(majorSliderStep);
+                }
+                break;
+            }
+            case __GO_UI_MIN__ : {
+                Double minValue = (Double)value;
+                // Update the slider properties
+                Double maxValue = (Double) controller.getProperty(uid, __GO_UI_MAX__);
+                setMinimumValue(minValue);
+                Double[] sliderStep = ((Double[]) controller.getProperty(uid, __GO_UI_SLIDERSTEP__));
+                double minorSliderStep = sliderStep[0].doubleValue();
+                double majorSliderStep = sliderStep[1].doubleValue();
+                if (minValue <= maxValue) {
+                    setMinorTickSpacing(minorSliderStep);
+                    setMajorTickSpacing(majorSliderStep);
+                }
+                break;
+            }
+            case __GO_POSITION__ : {
+                Double[] dblValues = SwingViewWidget.updatePosition(this, uid, value);
+                if (dblValues[0].intValue() > dblValues[1].intValue()) {
+                    setHorizontal();
+                } else {
+                    setVertical();
+                }
+                break;
+            }
+            case __GO_UI_SLIDERSTEP__ : {
+                Double[] sliderStep = ((Double[]) value);
+                double minorSliderStep = sliderStep[0].doubleValue();
+                double majorSliderStep = sliderStep[1].doubleValue();
+                setMinorTickSpacing(minorSliderStep);
+                setMajorTickSpacing(majorSliderStep);
+                break;
+            }
+            case __GO_UI_VALUE__ : {
+                Double[] doubleValue = ((Double[]) value);
+                setUserValue(doubleValue[0]);
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+                break;
+            }
+        }
     }
 
     /**
index aa04714..b33b69d 100644 (file)
@@ -12,6 +12,8 @@
  */
 package org.scilab.modules.gui.bridge.uiimage;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
+
 import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.Image;
@@ -67,7 +69,6 @@ public class SwingScilabUiImage extends JLabel implements SwingViewObject, Simpl
         shear = new double[2];
     }
 
-
     /**
      * Draws a swing Scilab Image
      * @see org.scilab.modules.gui.uielement.UIElement#draw()
@@ -87,7 +88,8 @@ public class SwingScilabUiImage extends JLabel implements SwingViewObject, Simpl
     }
 
     /**
-     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab element
+     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * element
      * @return the position of the element
      * @see org.scilab.modules.gui.uielement.UIElement#getPosition()
      */
@@ -105,7 +107,8 @@ public class SwingScilabUiImage extends JLabel implements SwingViewObject, Simpl
     }
 
     /**
-     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab element
+     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * element
      * @param newPosition the position to set to the element
      * @see org.scilab.modules.gui.uielement.UIElement#setPosition(org.scilab.modules.gui.utils.Position)
      */
@@ -293,11 +296,63 @@ public class SwingScilabUiImage extends JLabel implements SwingViewObject, Simpl
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+
+        switch (property) {
+            case __GO_UI_VALUE__: {
+                Double[] doubleValue = ((Double[]) value);
+                if (doubleValue.length == 0) {
+                    return;
+                }
+
+                // Update the image parameters
+                double[] imageParams = new double[5];
+                if (doubleValue.length < 1) {
+                    imageParams[0] = 1.0;
+                } else {
+                    imageParams[0] = doubleValue[0];
+                }
+                if (doubleValue.length < 2) {
+                    imageParams[1] = 1.0;
+                } else {
+                    imageParams[1] = doubleValue[1];
+                }
+                if (doubleValue.length < 3) {
+                    imageParams[2] = 0.0;
+                } else {
+                    imageParams[2] = doubleValue[2];
+                }
+                if (doubleValue.length < 4) {
+                    imageParams[3] = 0.0;
+                } else {
+                    imageParams[3] = doubleValue[3];
+                }
+                if (doubleValue.length < 5) {
+                    imageParams[4] = 0.0;
+                } else {
+                    imageParams[4] = doubleValue[4];
+                }
+
+                double[] scale = new double[2];
+                scale[0] = imageParams[0];
+                scale[1] = imageParams[1];
+                setScale(scale);
+
+                double[] shear = new double[2];
+                shear[0] = imageParams[2];
+                shear[1] = imageParams[3];
+                setShear(shear);
+                setRotate(imageParams[4]);
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+                break;
+            }
+        }
     }
 
     public void resetBackground() {
-        Color color = (Color)UIManager.getLookAndFeelDefaults().get("Label.background");
+        Color color = (Color) UIManager.getLookAndFeelDefaults().get("Label.background");
         if (color != null) {
             setBackground(color);
         }
index 4967410..1d7b7a1 100644 (file)
  */
 package org.scilab.modules.gui.bridge.uitable;
 
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_STRING_COLNB__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_VALUE__;
+
 import java.awt.Color;
 import java.awt.Font;
 
-import javax.swing.JList;
-import javax.swing.JTable;
 import javax.swing.JLabel;
+import javax.swing.JList;
 import javax.swing.JScrollPane;
+import javax.swing.JTable;
 import javax.swing.UIManager;
 
-import org.scilab.modules.gui.SwingViewWidget;
+import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingViewObject;
+import org.scilab.modules.gui.SwingViewWidget;
 import org.scilab.modules.gui.events.callback.CommonCallBack;
-import org.scilab.modules.gui.uitable.SimpleUiTable;
 import org.scilab.modules.gui.menubar.MenuBar;
 import org.scilab.modules.gui.textbox.TextBox;
 import org.scilab.modules.gui.toolbar.ToolBar;
+import org.scilab.modules.gui.uitable.SimpleUiTable;
 import org.scilab.modules.gui.utils.Position;
 import org.scilab.modules.gui.utils.PositionConverter;
 import org.scilab.modules.gui.utils.ScilabAlignment;
@@ -125,8 +129,8 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
 
     /**
      * Sets the visibility status of an UIElement
-     * @param newVisibleState the visibility status we want to set for the UIElement
-     *                      (true if the UIElement is visible, false if not)
+     * @param newVisibleState the visibility status we want to set for the
+     * UIElement (true if the UIElement is visible, false if not)
      */
     public void setVisible(boolean newVisibleState) {
         super.setVisible(newVisibleState);
@@ -143,7 +147,8 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
     }
 
     /**
-     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab element
+     * Gets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * element
      * @return the position of the element
      * @see org.scilab.modules.gui.uielement.UIElement#getPosition()
      */
@@ -161,7 +166,8 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
     }
 
     /**
-     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab element
+     * Sets the position (X-coordinate and Y-coordinate) of a swing Scilab
+     * element
      * @param newPosition the position to set to the element
      * @see org.scilab.modules.gui.uielement.UIElement#setPosition(org.scilab.modules.gui.utils.Position)
      */
@@ -353,8 +359,8 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
 
     /**
      * Sets the Data for uitable
-     * @param text the String that contains row data delimited by a '|'
-     *        and column data delimited by " ". Example: 1.26 3.47 | a b | d e | a b
+     * @param text the String that contains row data delimited by a '|' and
+     * column data delimited by " ". Example: 1.26 3.47 | a b | d e | a b
      */
     public void setData(String[] text) {
         //initializes data structure with number of rows and columns
@@ -418,11 +424,50 @@ public class SwingScilabUiTable extends JScrollPane implements SwingViewObject,
      * @param value property value
      */
     public void update(int property, Object value) {
-        SwingViewWidget.update(this, property, value);
+        GraphicController controller = GraphicController.getController();
+
+        switch (property) {
+            case __GO_UI_VALUE__: {
+                // Update column names
+                String[] stringValue = (String[]) value;
+                int colNb = ((Integer) controller.getProperty(uid, __GO_UI_STRING_COLNB__));
+                String[] colNames = new String[colNb - 1];
+                for (int k = 1; k < colNb; k++) {
+                    colNames[k - 1] = stringValue[k * (stringValue.length / colNb)];
+                }
+
+                setColumnNames(colNames);
+
+                // Update row names
+                String[] rowNames = new String[stringValue.length / colNb - 1];
+                for (int k = 1; k < stringValue.length / colNb; k++) {
+                    rowNames[k - 1] = stringValue[k];
+                }
+
+                setRowNames(rowNames);
+
+                // Update data
+                String[] tableData = new String[rowNames.length * colNames.length];
+                int kData = 0;
+                for (int kCol = 1; kCol <= colNames.length; kCol++) {
+                    for (int kRow = 1; kRow <= rowNames.length; kRow++) {
+                        tableData[kData++] = stringValue[kCol * (stringValue.length / colNb) + kRow];
+                    }
+                }
+
+                if (tableData.length != 0) {
+                    setData(tableData);
+                }
+                break;
+            }
+            default: {
+                SwingViewWidget.update(this, property, value);
+            }
+        }
     }
 
     public void resetBackground() {
-        Color color = (Color)UIManager.getLookAndFeelDefaults().get("ScrollPane.background");
+        Color color = (Color) UIManager.getLookAndFeelDefaults().get("ScrollPane.background");
         if (color != null) {
             setBackground(color);
         }
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/BorderLayout.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/BorderLayout.java
deleted file mode 100644 (file)
index 7ba4909..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-/**
- * Interface for BorderLayout associated to objects in Scilab GUIs
- * @author Marouane BEN JELLOUL
- */
-public interface BorderLayout extends LayoutManager {
-    //  TODO : Add the methods that are usefull for a BorderLayout
-
-    /**
-     * The center layout constraint (middle of container).
-     */
-    String CENTER = java.awt.BorderLayout.CENTER;
-
-    /**
-     * The east layout constraint (right side of container).
-     */
-    String EAST = java.awt.BorderLayout.EAST;
-
-    /**
-     * The north layout constraint (top of container).
-     */
-    String NORTH = java.awt.BorderLayout.NORTH;
-
-    /**
-     * The south layout constraint (bottom of container).
-     */
-    String SOUTH = java.awt.BorderLayout.SOUTH;
-
-    /**
-     * The west layout constraint (left side of container).
-     */
-    String WEST = java.awt.BorderLayout.WEST;
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/FlowLayout.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/FlowLayout.java
deleted file mode 100644 (file)
index c27b896..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-/**
- * Interface for FlowLayout associated to objects in Scilab GUIs
- * @author Marouane BEN JELLOUL
- */
-public interface FlowLayout extends LayoutManager {
-    //  TODO : Add the methods that are usefull for a FlowLayout
-
-    /**
-     * This value indicates that each row of components should be centered.
-     */
-    int CENTER = java.awt.FlowLayout.CENTER;
-    /**
-     * This value indicates that each row of components should be justified to the leading edge of the container's orientation,
-     *  for example, to the left in left-to-right orientations.
-     */
-    int LEADING = java.awt.FlowLayout.LEADING;
-    /**
-     * This value indicates that each row of components should be left-justified.
-     */
-    int LEFT = java.awt.FlowLayout.LEFT;
-    /**
-     * This value indicates that each row of components should be right-justified.
-     */
-    int RIGHT = java.awt.FlowLayout.RIGHT;
-    /**
-     * This value indicates that each row of components should be justified to the trailing edge of the container's orientation,
-     *  for example, to the right in left-to-right orientations.
-     */
-    int TRAILING = java.awt.FlowLayout.TRAILING;
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/LayoutManager.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/LayoutManager.java
deleted file mode 100644 (file)
index 89c4998..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-/**
- * Interface for LayoutManager associated to objects in Scilab GUIs
- * @author Marouane BEN JELLOUL
- */
-public interface LayoutManager {
-    //  TODO : Add the methods that are usefull for a LayoutManager
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabBorderLayout.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabBorderLayout.java
deleted file mode 100644 (file)
index 43220e4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-import org.scilab.modules.gui.bridge.ScilabBridge;
-
-/**
- * Class for Scilab Menus in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class ScilabBorderLayout implements BorderLayout {
-
-    /**
-     * Constructor
-     */
-    protected ScilabBorderLayout() {
-        throw new UnsupportedOperationException(); /* Prevents calls from subclass */
-    }
-
-    /**
-     * Creates a Scilab BorderLayout object
-     * @return the created BorderLayout
-     */
-    public static BorderLayout createBorderLayout() {
-        return ScilabBridge.createBorderLayout();
-    }
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabBorderLayoutBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabBorderLayoutBridge.java
deleted file mode 100644 (file)
index 70b656a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-import org.scilab.modules.gui.bridge.layout.SwingScilabBorderLayout;
-
-/**
- * Bridge for Scilab BorderLayout in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class ScilabBorderLayoutBridge {
-
-    /**
-     * Constructor
-     */
-    protected ScilabBorderLayoutBridge() {
-        throw new UnsupportedOperationException(); /* Prevents calls from subclass */
-    }
-
-    /**
-     * Creates a Scilab BorderLayout
-     * @return the created BorderLayout
-     */
-    public static BorderLayout createBorderLayout() {
-        return new SwingScilabBorderLayout();
-    }
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabFlowLayout.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabFlowLayout.java
deleted file mode 100644 (file)
index eadc5ba..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-import org.scilab.modules.gui.bridge.ScilabBridge;
-
-/**
- * Class for Scilab Menus in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class ScilabFlowLayout implements FlowLayout {
-
-    /**
-     * Constructor
-     */
-    protected ScilabFlowLayout() {
-        throw new UnsupportedOperationException(); /* Prevents calls from subclass */
-    }
-
-    /**
-     * Creates a Scilab FlowLayout object
-     * @return the created FlowLayout
-     */
-    public static FlowLayout createFlowLayout() {
-        return ScilabBridge.createFlowLayout();
-    }
-}
diff --git a/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabFlowLayoutBridge.java b/scilab/modules/gui/src/java/org/scilab/modules/gui/layout/ScilabFlowLayoutBridge.java
deleted file mode 100644 (file)
index ceb1d06..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2007 - INRIA - Marouane BEN JELLOUL
- *
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- */
-
-package org.scilab.modules.gui.layout;
-
-import org.scilab.modules.gui.bridge.layout.SwingScilabFlowLayout;
-
-/**
- * Bridge for Scilab FlowLayouts in GUIs
- * @author Marouane BEN JELLOUL
- */
-public class ScilabFlowLayoutBridge {
-
-    /**
-     * Constructor
-     */
-    protected ScilabFlowLayoutBridge() {
-        throw new UnsupportedOperationException(); /* Prevents calls from subclass */
-    }
-
-    /**
-     * Creates a Scilab FlowLayout
-     * @return the created FlowLayout
-     */
-    public static FlowLayout createFlowLayout() {
-        return new SwingScilabFlowLayout();
-    }
-}