* Bug #11489 fixed - 'SliderStep' property was ignored for uicontrols.
[scilab.git] / scilab / modules / gui / src / java / org / scilab / modules / gui / SwingView.java
index 350dece..bce37ce 100644 (file)
@@ -165,26 +165,26 @@ public final class SwingView implements GraphicView {
 
     private enum UielementType {
         Console,
-            CheckBox,
-            Edit,
-            Frame,
-            Figure,
-            Image,
-            ListBox,
-            PopupMenu,
-            Progressbar,
-            PushButton,
-            RadioButton,
-            Slider,
-            Table,
-            Text,
-            Uimenu,
-            UiParentMenu,
-            UiChildMenu,
-            UiCheckedMenu,
-            UiContextMenu,
-            Waitbar
-            }
+        CheckBox,
+        Edit,
+        Frame,
+        Figure,
+        Image,
+        ListBox,
+        PopupMenu,
+        Progressbar,
+        PushButton,
+        RadioButton,
+        Slider,
+        Table,
+        Text,
+        Uimenu,
+        UiParentMenu,
+        UiChildMenu,
+        UiCheckedMenu,
+        UiContextMenu,
+        Waitbar
+    }
 
     private class TypedObject {
         private UielementType   _type;
@@ -221,21 +221,21 @@ public final class SwingView implements GraphicView {
             return _children.contains(childUID);
         }
     };
-    
+
     private static final Set<Integer> managedTypes = new HashSet<Integer>(Arrays.asList(
-            GraphicObjectProperties.__GO_FIGURE__,
-            GraphicObjectProperties.__GO_UICONTEXTMENU__,
-            GraphicObjectProperties.__GO_UIMENU__,
-            GraphicObjectProperties.__GO_CONSOLE__,
-            GraphicObjectProperties.__GO_PROGRESSIONBAR__,
-            GraphicObjectProperties.__GO_WAITBAR__,
-            GraphicObjectProperties.__GO_UICONTROL__
+                GraphicObjectProperties.__GO_FIGURE__,
+                GraphicObjectProperties.__GO_UICONTEXTMENU__,
+                GraphicObjectProperties.__GO_UIMENU__,
+                GraphicObjectProperties.__GO_CONSOLE__,
+                GraphicObjectProperties.__GO_PROGRESSIONBAR__,
+                GraphicObjectProperties.__GO_WAITBAR__,
+                GraphicObjectProperties.__GO_UICONTROL__
             ));
     @Override
     public void createObject(String id) {
-        
+
         int objectType = (Integer) GraphicController.getController().getProperty(id, __GO_TYPE__);
-        
+
         if (managedTypes.contains(objectType) == false) {
             return;
         }
@@ -272,46 +272,46 @@ public final class SwingView implements GraphicView {
     private UielementType StyleToEnum(int style) {
         DEBUG("SwingView", "StyleToEnum(" + style + ")");
         switch (style) {
-        case __GO_FIGURE__ :
-            return UielementType.Figure;
-        case __GO_CONSOLE__ :
-            return UielementType.Console;
-        case __GO_UI_CHECKBOX__ :
-            return UielementType.CheckBox;
-        case __GO_UI_EDIT__ :
-            return UielementType.Edit;
-        case __GO_UI_FRAME__ :
-            return UielementType.Frame;
-        case __GO_UI_IMAGE__ :
-            return UielementType.Image;
-        case __GO_UI_LISTBOX__ :
-            return UielementType.ListBox;
-        case __GO_UI_POPUPMENU__ :
-            return UielementType.PopupMenu;
-        case __GO_UI_PUSHBUTTON__ :
-            return UielementType.PushButton;
-        case __GO_UI_RADIOBUTTON__ :
-            return UielementType.RadioButton;
-        case __GO_UI_SLIDER__ :
-            return UielementType.Slider;
-        case __GO_UI_TABLE__ :
-            return UielementType.Table;
-        case __GO_UI_TEXT__ :
-            return UielementType.Text;
-        case __GO_UIMENU__ :
-            return UielementType.UiChildMenu;
-        case __GO_UIPARENTMENU__ :
-            return UielementType.UiParentMenu;
-        case __GO_UICHILDMENU__ :
-            return UielementType.UiChildMenu;
-        case __GO_UICHECKEDMENU__ :
-            return UielementType.UiCheckedMenu;
-        case __GO_PROGRESSIONBAR__ :
-            return UielementType.Progressbar;
-        case __GO_WAITBAR__ :
-            return UielementType.Waitbar;
-        case __GO_UICONTEXTMENU__ :
-            return UielementType.UiContextMenu;
+            case __GO_FIGURE__ :
+                return UielementType.Figure;
+            case __GO_CONSOLE__ :
+                return UielementType.Console;
+            case __GO_UI_CHECKBOX__ :
+                return UielementType.CheckBox;
+            case __GO_UI_EDIT__ :
+                return UielementType.Edit;
+            case __GO_UI_FRAME__ :
+                return UielementType.Frame;
+            case __GO_UI_IMAGE__ :
+                return UielementType.Image;
+            case __GO_UI_LISTBOX__ :
+                return UielementType.ListBox;
+            case __GO_UI_POPUPMENU__ :
+                return UielementType.PopupMenu;
+            case __GO_UI_PUSHBUTTON__ :
+                return UielementType.PushButton;
+            case __GO_UI_RADIOBUTTON__ :
+                return UielementType.RadioButton;
+            case __GO_UI_SLIDER__ :
+                return UielementType.Slider;
+            case __GO_UI_TABLE__ :
+                return UielementType.Table;
+            case __GO_UI_TEXT__ :
+                return UielementType.Text;
+            case __GO_UIMENU__ :
+                return UielementType.UiChildMenu;
+            case __GO_UIPARENTMENU__ :
+                return UielementType.UiParentMenu;
+            case __GO_UICHILDMENU__ :
+                return UielementType.UiChildMenu;
+            case __GO_UICHECKEDMENU__ :
+                return UielementType.UiCheckedMenu;
+            case __GO_PROGRESSIONBAR__ :
+                return UielementType.Progressbar;
+            case __GO_WAITBAR__ :
+                return UielementType.Waitbar;
+            case __GO_UICONTEXTMENU__ :
+                return UielementType.UiContextMenu;
         }
         return null;
     }
@@ -323,152 +323,155 @@ public final class SwingView implements GraphicView {
 
     private SwingViewObject CreateObjectFromType(UielementType type, String id) {
         switch (type) {
-        case CheckBox:
-            SwingScilabCheckBox checkBox = new SwingScilabCheckBox();
-            checkBox.setId(id);
-            setDefaultProperties(checkBox, id);
-            return checkBox;
-        case Console:
-            Console console = (Console) GraphicController.getController().getObjectFromId(id);
-            if (console.getScilabMode() == Console.ScilabMode.STD) {
-                WindowsConfigurationManager.restoreUUID(NULLUUID);
-                SwingScilabConsole sciConsole = ((SwingScilabConsole) ScilabConsole.getConsole().getAsSimpleConsole());
-                SwingScilabTab consoleTab = (SwingScilabTab) sciConsole.getParent();
-                consoleTab.setId(id);
-                return consoleTab;
-            } else {
-                return null;
-            }
-        case Edit:
-            SwingScilabEditBox edit = new SwingScilabEditBox();
-            edit.setId(id);
-            setDefaultProperties(edit, id);
-            return edit;
-        case Figure:
-            Figure figure = (Figure) GraphicController.getController().getObjectFromId(id);
-            String figureTitle = figure.getName();
-            Integer figureId = figure.getId();
-            if ((figureTitle != null) && (figureId != null)) {
-                figureTitle = figureTitle.replaceFirst("%d", figureId.toString());
-            }
+            case CheckBox:
+                SwingScilabCheckBox checkBox = new SwingScilabCheckBox();
+                checkBox.setId(id);
+                setDefaultProperties(checkBox, id);
+                return checkBox;
+            case Console:
+                Console console = (Console) GraphicController.getController().getObjectFromId(id);
+                if (console.getScilabMode() == Console.ScilabMode.STD) {
+                    WindowsConfigurationManager.restoreUUID(NULLUUID);
+                    SwingScilabConsole sciConsole = ((SwingScilabConsole) ScilabConsole.getConsole().getAsSimpleConsole());
+                    SwingScilabTab consoleTab = (SwingScilabTab) sciConsole.getParent();
+                    consoleTab.setId(id);
+                    return consoleTab;
+                } else {
+                    return null;
+                }
+            case Edit:
+                SwingScilabEditBox edit = new SwingScilabEditBox();
+                edit.setId(id);
+                setDefaultProperties(edit, id);
+                return edit;
+            case Figure:
+                Figure figure = (Figure) GraphicController.getController().getObjectFromId(id);
+                String figureTitle = figure.getName();
+                Integer figureId = figure.getId();
+                if ((figureTitle != null) && (figureId != null)) {
+                    figureTitle = figureTitle.replaceFirst("%d", figureId.toString());
+                }
 
-            SwingScilabWindow window = new SwingScilabWindow();
+                SwingScilabWindow window = new SwingScilabWindow();
 
-            window.setTitle(figureTitle);
-            /* TOOLBAR */
-            ToolBar toolBar = ToolBarBuilder.buildToolBar(SwingScilabTab.GRAPHICS_TOOLBAR_DESCRIPTOR, figureId);
-            /* INFOBAR */
-            TextBox infoBar = ScilabTextBox.createTextBox();
+                window.setTitle(figureTitle);
+                /* TOOLBAR */
+                ToolBar toolBar = ToolBarBuilder.buildToolBar(SwingScilabTab.GRAPHICS_TOOLBAR_DESCRIPTOR, figureId);
+                /* INFOBAR */
+                TextBox infoBar = ScilabTextBox.createTextBox();
 
-            SwingScilabTab tab = new SwingScilabTab(figureTitle, figureId, figure);
-            tab.setId(id);
+                SwingScilabTab tab = new SwingScilabTab(figureTitle, figureId, figure);
+                tab.setId(id);
 
-            tab.setMenuBar(ScilabMenuBar.createMenuBar());
-            tab.setToolBar(toolBar);
-            tab.setInfoBar(ScilabTextBox.createTextBox());
-            window.addMenuBar(tab.getMenuBar());
-            window.addToolBar(tab.getToolBar());
-            window.addInfoBar(tab.getInfoBar());
+                tab.setMenuBar(ScilabMenuBar.createMenuBar());
+                tab.setToolBar(toolBar);
+                tab.setInfoBar(ScilabTextBox.createTextBox());
+                window.addMenuBar(tab.getMenuBar());
+                window.addToolBar(tab.getToolBar());
+                window.addInfoBar(tab.getInfoBar());
 
-            tab.setWindowIcon("graphic-window");
+                tab.setWindowIcon("graphic-window");
 
-            tab.setParentWindowId(window.getId());
+                tab.setParentWindowId(window.getId());
 
-            tab.setEventHandler(figure.getEventHandlerString());
-            tab.setEventHandlerEnabled(figure.getEventHandlerEnable());
+                tab.setEventHandler(figure.getEventHandlerString());
+                tab.setEventHandlerEnabled(figure.getEventHandlerEnable());
 
-            DockingManager.dock(tab, window.getDockingPort());
-            ActiveDockableTracker.requestDockableActivation(tab);
+                DockingManager.dock(tab, window.getDockingPort());
+                ActiveDockableTracker.requestDockableActivation(tab);
 
-            window.setVisible(true);
-            tab.setVisible(true);
-            tab.setName(figureTitle);
+                window.setVisible(true);
+                tab.setVisible(true);
+                tab.setName(figureTitle);
 
-            String infoMessage = figure.getInfoMessage();
-            if ((infoMessage == null) || (infoMessage.length() == 0)) {
-                infoBar.setText("");
-            } else {
-                infoBar.setText(infoMessage);
-            }
-            tab.update(__GO_SIZE__, (Integer[]) GraphicController.getController().getProperty(id, __GO_SIZE__));
-            tab.update(__GO_POSITION__, (Integer[]) GraphicController.getController().getProperty(id, __GO_POSITION__));
-            // TODO set other default properties
-            return tab;
-        case Frame:
-            SwingScilabFrame frame = new SwingScilabFrame();
-            frame.setId(id);
-            setDefaultProperties(frame, id);
-            return frame;
-        case Image:
-            SwingScilabUiImage image = new SwingScilabUiImage();
-            image.setId(id);
-            return image;
-        case ListBox:
-            SwingScilabListBox listBox = new SwingScilabListBox();
-            listBox.setId(id);
-            return listBox;
-        case PopupMenu:
-            SwingScilabPopupMenu popupMenu = new SwingScilabPopupMenu();
-            popupMenu.setId(id);
-            setDefaultProperties(popupMenu, id);
-            return popupMenu;
-        case Progressbar:
-            SwingScilabWaitBar progressbar = new SwingScilabWaitBar();
-            progressbar.setIndeterminateMode(true);
-            progressbar.setId(id);
-            return progressbar;
-        case PushButton:
-            SwingScilabPushButton pushButton = new SwingScilabPushButton();
-            pushButton.setId(id);
-            setDefaultProperties(pushButton, id);
-            return pushButton;
-        case RadioButton:
-            SwingScilabRadioButton radioButton = new SwingScilabRadioButton();
-            radioButton.setId(id);
-            setDefaultProperties(radioButton, id);
-            return radioButton;
-        case Slider:
-            SwingScilabSlider slider = new SwingScilabSlider();
-            slider.setId(id);
-            setDefaultProperties(slider, id);
-            return slider;
-        case Table:
-            SwingScilabUiTable table = new SwingScilabUiTable();
-            table.setId(id);
-            return table;
-        case Text:
-            SwingScilabLabel text = new SwingScilabLabel();
-            text.setId(id);
-            setDefaultProperties(text, id);
-            return text;
-        case Uimenu:
-            throw new UnsupportedOperationException();
-        case UiParentMenu: /* SwingView internal type */
-            SwingScilabMenu parentMenu = new SwingScilabMenu();
-            parentMenu.setId(id);
-            setMenuDefaultProperties(parentMenu, id);
-            return parentMenu;
-        case UiChildMenu: /* SwingView internal type */
-            SwingScilabMenuItem childMenu = new SwingScilabMenuItem();
-            childMenu.setId(id);
-            setMenuDefaultProperties(childMenu, id);
-            return childMenu;
-        case UiCheckedMenu: /* SwingView internal type */
-            SwingScilabCheckBoxMenuItem checkedMenu = new SwingScilabCheckBoxMenuItem(false);
-            checkedMenu.setId(id);
-            setMenuDefaultProperties(checkedMenu, id);
-            return checkedMenu;
-        case UiContextMenu:
-            SwingScilabContextMenu contextMenu = new SwingScilabContextMenu();
-            contextMenu.setId(id);
-            return contextMenu;
-        case Waitbar:
-            SwingScilabWaitBar waitbar = new SwingScilabWaitBar();
-            waitbar.setIndeterminateMode(false);
-            waitbar.setId(id);
-            return waitbar;
-        default:
-            return null;
+                String infoMessage = figure.getInfoMessage();
+                if ((infoMessage == null) || (infoMessage.length() == 0)) {
+                    infoBar.setText("");
+                } else {
+                    infoBar.setText(infoMessage);
+                }
+                tab.update(__GO_SIZE__, (Integer[]) GraphicController.getController().getProperty(id, __GO_SIZE__));
+                tab.update(__GO_POSITION__, (Integer[]) GraphicController.getController().getProperty(id, __GO_POSITION__));
+                // TODO set other default properties
+                return tab;
+            case Frame:
+                SwingScilabFrame frame = new SwingScilabFrame();
+                frame.setId(id);
+                setDefaultProperties(frame, id);
+                return frame;
+            case Image:
+                SwingScilabUiImage image = new SwingScilabUiImage();
+                image.setId(id);
+                setDefaultProperties(image, id);
+                return image;
+            case ListBox:
+                SwingScilabListBox listBox = new SwingScilabListBox();
+                listBox.setId(id);
+                setDefaultProperties(listBox, id);
+                return listBox;
+            case PopupMenu:
+                SwingScilabPopupMenu popupMenu = new SwingScilabPopupMenu();
+                popupMenu.setId(id);
+                setDefaultProperties(popupMenu, id);
+                return popupMenu;
+            case Progressbar:
+                SwingScilabWaitBar progressbar = new SwingScilabWaitBar();
+                progressbar.setIndeterminateMode(true);
+                progressbar.setId(id);
+                return progressbar;
+            case PushButton:
+                SwingScilabPushButton pushButton = new SwingScilabPushButton();
+                pushButton.setId(id);
+                setDefaultProperties(pushButton, id);
+                return pushButton;
+            case RadioButton:
+                SwingScilabRadioButton radioButton = new SwingScilabRadioButton();
+                radioButton.setId(id);
+                setDefaultProperties(radioButton, id);
+                return radioButton;
+            case Slider:
+                SwingScilabSlider slider = new SwingScilabSlider();
+                slider.setId(id);
+                setDefaultProperties(slider, id);
+                return slider;
+            case Table:
+                SwingScilabUiTable table = new SwingScilabUiTable();
+                table.setId(id);
+                setDefaultProperties(table, id);
+                return table;
+            case Text:
+                SwingScilabLabel text = new SwingScilabLabel();
+                text.setId(id);
+                setDefaultProperties(text, id);
+                return text;
+            case Uimenu:
+                throw new UnsupportedOperationException();
+            case UiParentMenu: /* SwingView internal type */
+                SwingScilabMenu parentMenu = new SwingScilabMenu();
+                parentMenu.setId(id);
+                setMenuDefaultProperties(parentMenu, id);
+                return parentMenu;
+            case UiChildMenu: /* SwingView internal type */
+                SwingScilabMenuItem childMenu = new SwingScilabMenuItem();
+                childMenu.setId(id);
+                setMenuDefaultProperties(childMenu, id);
+                return childMenu;
+            case UiCheckedMenu: /* SwingView internal type */
+                SwingScilabCheckBoxMenuItem checkedMenu = new SwingScilabCheckBoxMenuItem(false);
+                checkedMenu.setId(id);
+                setMenuDefaultProperties(checkedMenu, id);
+                return checkedMenu;
+            case UiContextMenu:
+                SwingScilabContextMenu contextMenu = new SwingScilabContextMenu();
+                contextMenu.setId(id);
+                return contextMenu;
+            case Waitbar:
+                SwingScilabWaitBar waitbar = new SwingScilabWaitBar();
+                waitbar.setIndeterminateMode(false);
+                waitbar.setId(id);
+                return waitbar;
+            default:
+                return null;
         }
     }
 
@@ -540,10 +543,10 @@ public final class SwingView implements GraphicView {
         final TypedObject requestedObject = allObjects.get(id);
         if (requestedObject != null) {
             switch (requestedObject.getType()) {
-            case Figure:
-                final SwingScilabTab tab = (SwingScilabTab) requestedObject.getValue();
-                tab.disablePaint();
-                SwingUtilities.invokeLater(new Runnable() {
+                case Figure:
+                    final SwingScilabTab tab = (SwingScilabTab) requestedObject.getValue();
+                    tab.disablePaint();
+                    SwingUtilities.invokeLater(new Runnable() {
                         public void run() {
                             DockingManager.close(tab);
                             DockingManager.unregisterDockable((Dockable) tab);
@@ -553,16 +556,16 @@ public final class SwingView implements GraphicView {
                             tab.close();
                         }
                     });
-                break;
-            case Progressbar:
-            case Waitbar:
-                SwingScilabWaitBar bar = (SwingScilabWaitBar) requestedObject.getValue();
-                bar.close();
-                break;
-            default:
-                // Nothing to do
-                // uicontrol case: the object is destroyed when its parent updates its children
-                break;
+                    break;
+                case Progressbar:
+                case Waitbar:
+                    SwingScilabWaitBar bar = (SwingScilabWaitBar) requestedObject.getValue();
+                    bar.close();
+                    break;
+                default:
+                    // Nothing to do
+                    // uicontrol case: the object is destroyed when its parent updates its children
+                    break;
             }
             allObjects.remove(id);
         }
@@ -592,41 +595,40 @@ public final class SwingView implements GraphicView {
         if (registeredObject != null && property == __GO_CHILDREN__) {
             String[] newChildren = (String[]) GraphicController.getController().getProperty(id, __GO_CHILDREN__);
 
-            switch(type)
-            {
-            /*
-             * FIGURE CHILDREN UPDATE
-             */
-            case __GO_FIGURE__ :
-                updateFigureChildren(id, newChildren);
-                break;
-            /*
-             * CONSOLE CHILDREN UPDATE
-             */
-            case __GO_CONSOLE__ :
-                updateConsoleChildren(id, newChildren);
-                break;
-            /*
-             * MENU CHILDREN UPDATE
-             */
-            case __GO_UIMENU__ :
-                updateMenuChildren(id, newChildren);
-                break;
-            /*
-             * CONTEXTMENU CHILDREN UPDATE
-             */
-            case __GO_UICONTEXTMENU__ :
-                updateContextMenuChildren(id, newChildren);
-                break;
-            /*
-             * UICONTROL "FRAME" CHILDREN UPDATE
-             */
-            case __GO_UICONTROL__ :
-                int style = (Integer) GraphicController.getController().getProperty(id, __GO_STYLE__);
-                if (style == __GO_UI_FRAME__) {
-                    updateFrameChildren(id, newChildren);
-                }
-                break;
+            switch (type) {
+                    /*
+                     * FIGURE CHILDREN UPDATE
+                     */
+                case __GO_FIGURE__ :
+                    updateFigureChildren(id, newChildren);
+                    break;
+                    /*
+                     * CONSOLE CHILDREN UPDATE
+                     */
+                case __GO_CONSOLE__ :
+                    updateConsoleChildren(id, newChildren);
+                    break;
+                    /*
+                     * MENU CHILDREN UPDATE
+                     */
+                case __GO_UIMENU__ :
+                    updateMenuChildren(id, newChildren);
+                    break;
+                    /*
+                     * CONTEXTMENU CHILDREN UPDATE
+                     */
+                case __GO_UICONTEXTMENU__ :
+                    updateContextMenuChildren(id, newChildren);
+                    break;
+                    /*
+                     * UICONTROL "FRAME" CHILDREN UPDATE
+                     */
+                case __GO_UICONTROL__ :
+                    int style = (Integer) GraphicController.getController().getProperty(id, __GO_STYLE__);
+                    if (style == __GO_UI_FRAME__) {
+                        updateFrameChildren(id, newChildren);
+                    }
+                    break;
             }
         }
 
@@ -638,21 +640,21 @@ public final class SwingView implements GraphicView {
             if (type == __GO_UIMENU__) {
                 TypedObject updatedObject = allObjects.get(id);
                 switch (updatedObject.getType()) {
-                case UiParentMenu:
-                    allObjects.put(id, CreateObjectFromType(__GO_UICHECKEDMENU__, id));
-                    registeredObject = allObjects.get(id);
-                    break;
-                case UiChildMenu:
-                    String parentId = (String) GraphicController.getController().getProperty(id, __GO_PARENT__);
-                    int index = ((SwingScilabMenu) allObjects.get(parentId).getValue())
-                        .getComponentZOrder((SwingScilabMenuItem) allObjects.get(id).getValue());
-                    ((SwingScilabMenu) allObjects.get(parentId).getValue()).remove((SwingScilabMenuItem) allObjects.get(id).getValue());
-                    allObjects.put(id, CreateObjectFromType(__GO_UICHECKEDMENU__, id));
-                    registeredObject = allObjects.get(id);
-                    ((SwingScilabMenu) allObjects.get(parentId).getValue()).add((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue(), index);
-                    return;
-                default:
-                    break;
+                    case UiParentMenu:
+                        allObjects.put(id, CreateObjectFromType(__GO_UICHECKEDMENU__, id));
+                        registeredObject = allObjects.get(id);
+                        break;
+                    case UiChildMenu:
+                        String parentId = (String) GraphicController.getController().getProperty(id, __GO_PARENT__);
+                        int index = ((SwingScilabMenu) allObjects.get(parentId).getValue())
+                                    .getComponentZOrder((SwingScilabMenuItem) allObjects.get(id).getValue());
+                        ((SwingScilabMenu) allObjects.get(parentId).getValue()).remove((SwingScilabMenuItem) allObjects.get(id).getValue());
+                        allObjects.put(id, CreateObjectFromType(__GO_UICHECKEDMENU__, id));
+                        registeredObject = allObjects.get(id);
+                        ((SwingScilabMenu) allObjects.get(parentId).getValue()).add((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue(), index);
+                        return;
+                    default:
+                        break;
                 }
             }
         }
@@ -727,14 +729,14 @@ public final class SwingView implements GraphicView {
                 if (childType == __GO_UIMENU__) {
                     TypedObject childAsTypedObject = allObjects.get(childId);
                     switch (childAsTypedObject.getType()) {
-                    case UiChildMenu:
-                    case UiCheckedMenu:
-                        allObjects.put(childId, CreateObjectFromType(__GO_UIPARENTMENU__, childId));
-                        ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
-                        break;
-                    default: /* UiParentMenu */
-                        ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
-                        break;
+                        case UiChildMenu:
+                        case UiCheckedMenu:
+                            allObjects.put(childId, CreateObjectFromType(__GO_UIPARENTMENU__, childId));
+                            ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
+                            break;
+                        default: /* UiParentMenu */
+                            ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
+                            break;
                     }
                     needRevalidate = true;
                 }
@@ -754,7 +756,7 @@ public final class SwingView implements GraphicView {
                 int childType = (Integer) GraphicController.getController().getProperty(childId, __GO_TYPE__);
 
                 /* Remove an uicontrol */
-                if (childType ==__GO_UICONTROL__) {
+                if (childType == __GO_UICONTROL__) {
                     ((SwingScilabTab) updatedComponent).removeMember(allObjects.get(childId).getValue());
                     needRevalidate = true;
                 }
@@ -763,12 +765,12 @@ public final class SwingView implements GraphicView {
                 if (childType == __GO_UIMENU__) {
                     TypedObject childAsTypedObject = allObjects.get(childId);
                     switch (childAsTypedObject.getType()) {
-                    case UiCheckedMenu:
-                        ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).remove((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
-                        break;
-                    default: /* UiParentMenu */
-                        ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).remove((SwingScilabMenu) allObjects.get(childId).getValue());
-                        break;
+                        case UiCheckedMenu:
+                            ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).remove((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
+                            break;
+                        default: /* UiParentMenu */
+                            ((Container) ((SwingScilabTab) updatedComponent).getMenuBar().getAsSimpleMenuBar()).remove((SwingScilabMenu) allObjects.get(childId).getValue());
+                            break;
                     }
                     needRevalidate = true;
                 }
@@ -852,14 +854,14 @@ public final class SwingView implements GraphicView {
                 if (childType == __GO_UIMENU__) {
                     TypedObject childAsTypedObject = allObjects.get(childId);
                     switch (childAsTypedObject.getType()) {
-                    case UiChildMenu:
-                    case UiCheckedMenu:
-                        allObjects.put(childId, CreateObjectFromType(__GO_UIPARENTMENU__, childId));
-                        ((Container) ((SwingScilabTab) updatedObject.getValue()).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
-                        break;
-                    default: /* UiParentMenu */
-                        ((Container) ((SwingScilabTab) updatedObject.getValue()).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
-                        break;
+                        case UiChildMenu:
+                        case UiCheckedMenu:
+                            allObjects.put(childId, CreateObjectFromType(__GO_UIPARENTMENU__, childId));
+                            ((Container) ((SwingScilabTab) updatedObject.getValue()).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
+                            break;
+                        default: /* UiParentMenu */
+                            ((Container) ((SwingScilabTab) updatedObject.getValue()).getMenuBar().getAsSimpleMenuBar()).add((SwingScilabMenu) allObjects.get(childId).getValue());
+                            break;
                     }
                     needRevalidate = true;
                 }
@@ -914,83 +916,83 @@ public final class SwingView implements GraphicView {
                     Object addedChild = allObjects.get(childId).getValue();
                     JComponent parent = null;
                     switch (updatedObject.getType()) {
-                    case UiChildMenu:
-                        updatedComponent = (SwingScilabMenuItem) updatedObject.getValue();
-                        parent = (JComponent) updatedComponent.getParent();
-                        switch (childAsTypedObject.getType()) {
                         case UiChildMenu:
-                            /* Replace the item by a parent menu */
-                            updatedObjectPosition = parent.getComponentZOrder((SwingScilabMenuItem) allObjects.get(id).getValue());
-                            parent.remove((SwingScilabMenuItem) allObjects.get(id).getValue());
-                            newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
-                            allObjects.put(id, newParent);
-                            newParent.addChild(childId);
-                            parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
-                            /* Update the created menu */
-                            ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenuItem) addedChild);
+                            updatedComponent = (SwingScilabMenuItem) updatedObject.getValue();
+                            parent = (JComponent) updatedComponent.getParent();
+                            switch (childAsTypedObject.getType()) {
+                                case UiChildMenu:
+                                    /* Replace the item by a parent menu */
+                                    updatedObjectPosition = parent.getComponentZOrder((SwingScilabMenuItem) allObjects.get(id).getValue());
+                                    parent.remove((SwingScilabMenuItem) allObjects.get(id).getValue());
+                                    newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
+                                    allObjects.put(id, newParent);
+                                    newParent.addChild(childId);
+                                    parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
+                                    /* Update the created menu */
+                                    ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenuItem) addedChild);
+                                    break;
+                                case UiCheckedMenu:
+                                    /* Replace the item by a parent menu */
+                                    updatedObjectPosition = parent.getComponentZOrder((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
+                                    parent.remove((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
+                                    newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
+                                    allObjects.put(id, newParent);
+                                    newParent.addChild(childId);
+                                    parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
+                                    /* Update the created menu */
+                                    ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabCheckBoxMenuItem) addedChild);
+                                    break;
+                                default: /* UiParentMenu */
+                                    ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenu) addedChild);
+                                    break;
+                            }
                             break;
                         case UiCheckedMenu:
-                            /* Replace the item by a parent menu */
-                            updatedObjectPosition = parent.getComponentZOrder((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
-                            parent.remove((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
-                            newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
-                            allObjects.put(id, newParent);
-                            newParent.addChild(childId);
-                            parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
-                            /* Update the created menu */
-                            ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabCheckBoxMenuItem) addedChild);
+                            updatedComponent = (SwingScilabCheckBoxMenuItem) updatedObject.getValue();
+                            parent = (JComponent) updatedComponent.getParent();
+                            switch (childAsTypedObject.getType()) {
+                                case UiChildMenu:
+                                    /* Replace the item by a parent menu */
+                                    updatedObjectPosition = parent.getComponentZOrder((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
+                                    parent.remove((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
+                                    newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
+                                    allObjects.put(id, newParent);
+                                    newParent.addChild(childId);
+                                    parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
+                                    /* Update the created menu */
+                                    ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenuItem) allObjects.get(childId).getValue());
+                                    break;
+                                case UiCheckedMenu:
+                                    /* Replace the item by a parent menu */
+                                    updatedObjectPosition = parent.getComponentZOrder((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
+                                    parent.remove((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
+                                    newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
+                                    allObjects.put(id, newParent);
+                                    newParent.addChild(childId);
+                                    parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
+                                    /* Update the created menu */
+                                    ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
+                                    break;
+                                default: /* UiParentMenu */
+                                    ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenu) allObjects.get(childId).getValue());
+                                    break;
+                            }
                             break;
                         default: /* UiParentMenu */
-                            ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenu) addedChild);
-                            break;
-                        }
-                        break;
-                    case UiCheckedMenu:
-                        updatedComponent = (SwingScilabCheckBoxMenuItem) updatedObject.getValue();
-                        parent = (JComponent) updatedComponent.getParent();
-                        switch (childAsTypedObject.getType()) {
-                        case UiChildMenu:
-                            /* Replace the item by a parent menu */
-                            updatedObjectPosition = parent.getComponentZOrder((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
-                            parent.remove((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
-                            newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
-                            allObjects.put(id, newParent);
-                            newParent.addChild(childId);
-                            parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
-                            /* Update the created menu */
-                            ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenuItem) allObjects.get(childId).getValue());
+                            SwingScilabMenu updatedMenu = (SwingScilabMenu) updatedObject.getValue();
+                            updatedComponent = updatedMenu;
+                            switch (childAsTypedObject.getType()) {
+                                case UiChildMenu:
+                                    updatedMenu.add((SwingScilabMenuItem) allObjects.get(childId).getValue());
+                                    break;
+                                case UiCheckedMenu:
+                                    updatedMenu.add((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
+                                    break;
+                                default: /* UiParentMenu */
+                                    updatedMenu.add((SwingScilabMenu) allObjects.get(childId).getValue());
+                                    break;
+                            }
                             break;
-                        case UiCheckedMenu:
-                            /* Replace the item by a parent menu */
-                            updatedObjectPosition = parent.getComponentZOrder((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
-                            parent.remove((SwingScilabCheckBoxMenuItem) allObjects.get(id).getValue());
-                            newParent = CreateObjectFromType(__GO_UIPARENTMENU__, id);
-                            allObjects.put(id, newParent);
-                            newParent.addChild(childId);
-                            parent.add((SwingScilabMenu) allObjects.get(id).getValue(), updatedObjectPosition);
-                            /* Update the created menu */
-                            ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
-                            break;
-                        default: /* UiParentMenu */
-                            ((SwingScilabMenu) allObjects.get(id).getValue()).add((SwingScilabMenu) allObjects.get(childId).getValue());
-                            break;
-                        }
-                        break;
-                    default: /* UiParentMenu */
-                        SwingScilabMenu updatedMenu = (SwingScilabMenu) updatedObject.getValue();
-                        updatedComponent = updatedMenu;
-                        switch (childAsTypedObject.getType()) {
-                        case UiChildMenu:
-                            updatedMenu.add((SwingScilabMenuItem) allObjects.get(childId).getValue());
-                            break;
-                        case UiCheckedMenu:
-                            updatedMenu.add((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
-                            break;
-                        default: /* UiParentMenu */
-                            updatedMenu.add((SwingScilabMenu) allObjects.get(childId).getValue());
-                            break;
-                        }
-                        break;
                     }
                     needRevalidate = true;
                 }
@@ -1011,15 +1013,15 @@ public final class SwingView implements GraphicView {
                 Object removedMenu = allObjects.get(childId).getValue();
 
                 switch (childAsTypedObject.getType()) {
-                case UiChildMenu:
-                    updatedMenu.remove((SwingScilabMenuItem) removedMenu);
-                    break;
-                case UiCheckedMenu:
-                    updatedMenu.remove((SwingScilabCheckBoxMenuItem) removedMenu);
-                    break;
-                default:
-                    updatedMenu.remove((SwingScilabMenu) removedMenu);
-                    break;
+                    case UiChildMenu:
+                        updatedMenu.remove((SwingScilabMenuItem) removedMenu);
+                        break;
+                    case UiCheckedMenu:
+                        updatedMenu.remove((SwingScilabCheckBoxMenuItem) removedMenu);
+                        break;
+                    default:
+                        updatedMenu.remove((SwingScilabMenu) removedMenu);
+                        break;
                 }
                 needRevalidate = true;
             }
@@ -1051,15 +1053,15 @@ public final class SwingView implements GraphicView {
                     SwingScilabContextMenu updatedMenu = (SwingScilabContextMenu) updatedObject.getValue();
                     updatedComponent = updatedMenu;
                     switch (childAsTypedObject.getType()) {
-                    case UiChildMenu:
-                        updatedMenu.add((SwingScilabMenuItem) allObjects.get(childId).getValue());
-                        break;
-                    case UiCheckedMenu:
-                        updatedMenu.add((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
-                        break;
-                    default: /* UiParentMenu */
-                        updatedMenu.add((SwingScilabMenu) allObjects.get(childId).getValue());
-                        break;
+                        case UiChildMenu:
+                            updatedMenu.add((SwingScilabMenuItem) allObjects.get(childId).getValue());
+                            break;
+                        case UiCheckedMenu:
+                            updatedMenu.add((SwingScilabCheckBoxMenuItem) allObjects.get(childId).getValue());
+                            break;
+                        default: /* UiParentMenu */
+                            updatedMenu.add((SwingScilabMenu) allObjects.get(childId).getValue());
+                            break;
                     }
                     needRevalidate = true;
                 }
@@ -1078,15 +1080,15 @@ public final class SwingView implements GraphicView {
                 Object removedMenu = allObjects.get(childId).getValue();
 
                 switch (childAsTypedObject.getType()) {
-                case UiChildMenu:
-                    updatedMenu.remove((SwingScilabMenuItem) removedMenu);
-                    break;
-                case UiCheckedMenu:
-                    updatedMenu.remove((SwingScilabCheckBoxMenuItem) removedMenu);
-                    break;
-                default:
-                    updatedMenu.remove((SwingScilabMenu) removedMenu);
-                    break;
+                    case UiChildMenu:
+                        updatedMenu.remove((SwingScilabMenuItem) removedMenu);
+                        break;
+                    case UiCheckedMenu:
+                        updatedMenu.remove((SwingScilabCheckBoxMenuItem) removedMenu);
+                        break;
+                    default:
+                        updatedMenu.remove((SwingScilabMenu) removedMenu);
+                        break;
                 }
                 needRevalidate = true;
             }