toolbar_visible default is %t
[scilab.git] / scilab / modules / gui / src / java / org / scilab / modules / gui / bridge / tab / SwingScilabCommonPanel.java
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2014 - Scilab Enterprises - Bruno JOFRET
4  *
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at
9  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
10  *
11  */
12 package org.scilab.modules.gui.bridge.tab;
13
14 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_AUTORESIZE__;
15 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_AXES_SIZE__;
16 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BACKGROUND__;
17 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_BORDER_OPT_PADDING__;
18 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CALLBACK__;
19 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_CHILDREN__;
20 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_COLORMAP__;
21 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_EVENTHANDLER_ENABLE__;
22 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_EVENTHANDLER_NAME__;
23 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_GRID__;
24 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_GRID_OPT_PADDING__;
25 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_ID__;
26 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_INFOBAR_VISIBLE__;
27 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_INFO_MESSAGE__;
28 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_LAYOUT__;
29 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_MENUBAR_VISIBLE__;
30 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_NAME__;
31 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_POSITION__;
32 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_RESIZE__;
33 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_SIZE__;
34 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TOOLBAR_VISIBLE__;
35 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_TYPE__;
36 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UICHECKEDMENU__;
37 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UICHILDMENU__;
38 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UIMENU__;
39 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UIPARENTMENU__;
40 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_UI_ICON__;
41 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_VISIBLE__;
42
43 import java.awt.BorderLayout;
44 import java.awt.Component;
45 import java.awt.Dimension;
46 import java.awt.GridBagConstraints;
47 import java.awt.GridBagLayout;
48 import java.awt.GridLayout;
49 import java.awt.Insets;
50 import java.awt.image.BufferedImage;
51 import java.io.File;
52 import java.io.IOException;
53
54 import javax.imageio.ImageIO;
55 import javax.swing.ImageIcon;
56 import javax.swing.JLayeredPane;
57
58 import org.scilab.modules.commons.gui.FindIconHelper;
59 import org.scilab.modules.graphic_objects.figure.Figure;
60 import org.scilab.modules.graphic_objects.figure.Figure.BarType;
61 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
62 import org.scilab.modules.graphic_objects.graphicModel.GraphicModel;
63 import org.scilab.modules.graphic_objects.uicontrol.Uicontrol;
64 import org.scilab.modules.graphic_objects.utils.LayoutType;
65 import org.scilab.modules.gui.SwingView;
66 import org.scilab.modules.gui.SwingViewObject;
67 import org.scilab.modules.gui.bridge.frame.SwingScilabFrame;
68 import org.scilab.modules.gui.bridge.frame.SwingScilabScrollableFrame;
69 import org.scilab.modules.gui.bridge.window.SwingScilabWindow;
70 import org.scilab.modules.gui.events.callback.ScilabCloseCallBack;
71 import org.scilab.modules.gui.toolbar.ToolBar;
72 import org.scilab.modules.gui.utils.Position;
73 import org.scilab.modules.gui.utils.Size;
74 import org.scilab.modules.gui.utils.ToolBarBuilder;
75 import org.scilab.modules.renderer.JoGLView.util.ColorFactory;
76
77 public class SwingScilabCommonPanel {
78
79     public static final String GRAPHICS_TOOLBAR_DESCRIPTOR = System.getenv("SCI") + "/modules/gui/etc/graphics_toolbar.xml";
80
81     /**
82      * Update the tab after a modification of its properties
83      * @param property the property name
84      * @param value the property value
85      * @see org.scilab.modules.gui.SwingViewObject#update(java.lang.String,
86      * java.lang.Object)
87      */
88     protected static void update(SwingScilabPanel component, int property, Object value) {
89         String name;
90         Integer figureId;
91         switch (property) {
92             case __GO_NAME__:
93                 name = ((String) value);
94                 figureId = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_ID__);
95                 updateTitle(component, name, figureId);
96                 break;
97             case __GO_ID__:
98                 /* Update title */
99                 figureId = ((Integer) value);
100                 Figure localFigure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
101                 name = localFigure.getName();
102                 updateTitle(component, name, figureId);
103
104                 /** Update tool bar */
105                 if (localFigure.getToolbarAsEnum() == BarType.FIGURE) {
106                     SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
107
108                     boolean currentVisible = component.getToolBar().isVisible();
109
110                     //only if toolbar is visible
111                     if (currentVisible) {
112                         //keep current delta between figure size and axes size
113                         component.storeSizeDelta();
114                     }
115
116                     ToolBar toolbar = ToolBarBuilder.buildToolBar(GRAPHICS_TOOLBAR_DESCRIPTOR, figureId);
117                     toolbar.setVisible(currentVisible);
118                     component.setToolBar(toolbar);
119                     parentWindow.addToolBar(toolbar);
120                     //force redraw to get good value on contentpane.getHeight
121                     parentWindow.validate();
122
123                     if (currentVisible) {
124                         //apply stored delta to new axes size
125                         component.applyDeltaSize();
126                     }
127                 }
128
129                 /* Update callback */
130                 String closingCommand = "if (get_figure_handle(" + figureId + ") <> []) then" + "  if (get(get_figure_handle(" + figureId + "), 'event_handler_enable') == 'on') then"
131                                         + "    execstr(get(get_figure_handle(" + figureId + "), 'event_handler')+'(" + figureId + ", -1, -1, -1000)', 'errcatch', 'm');" + "  end;" + "  delete(get_figure_handle("
132                                         + figureId + "));" + "end;";
133                 component.setCallback(null);
134                 component.setCallback(ScilabCloseCallBack.create(component.getId(), closingCommand));
135                 /* Update menus callback */
136                 Integer[] children = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_CHILDREN__);
137                 updateChildrenCallbacks(children, figureId);
138                 break;
139             case __GO_SIZE__: {
140                 Integer[] size = (Integer[]) value;
141                 SwingScilabWindow figure = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
142                 Size oldFigureSize = figure.getDims();
143                 if (oldFigureSize.getWidth() != 0 && oldFigureSize.getHeight() != 0 && ((oldFigureSize.getWidth() != size[0]) || (oldFigureSize.getHeight() != size[1]))
144                         && ((Boolean) GraphicController.getController().getProperty(component.getId(), __GO_AUTORESIZE__))) {
145                     figure.setDims(new Size(size[0], size[1]));
146                     figure.validate();
147                     GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, new Integer[] { figure.getContentPane().getWidth(), figure.getContentPane().getHeight() });
148
149                 }
150                 break;
151             }
152             case __GO_POSITION__:
153                 Integer[] position = (Integer[]) value;
154                 SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).setPosition(new Position(position[0], position[1]));
155                 break;
156             case __GO_AXES_SIZE__:
157                 Integer[] axesSize = (Integer[]) value;
158                 Dimension oldAxesSize = component.getContentPane().getSize();
159                 if (oldAxesSize.getWidth() != 0 && oldAxesSize.getHeight() != 0 && ((oldAxesSize.getWidth() != axesSize[0]) || (oldAxesSize.getHeight() != axesSize[1]))
160                         && ((Boolean) GraphicController.getController().getProperty(component.getId(), __GO_AUTORESIZE__))) {
161                     // TODO manage tabs when there are docked (do not change the window size if more than one tab docked)
162                     int deltaX = axesSize[0] - (int) oldAxesSize.getWidth();
163                     int deltaY = axesSize[1] - (int) oldAxesSize.getHeight();
164                     Size parentWindowSize = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).getDims();
165                     SwingScilabWindow.allScilabWindows.get(component.getParentWindowId()).setDims(new Size(parentWindowSize.getWidth() + deltaX, parentWindowSize.getHeight() + deltaY));
166                     GraphicController.getController().setProperty(component.getId(), __GO_SIZE__, new Integer[] { parentWindowSize.getWidth() + deltaX, parentWindowSize.getHeight() + deltaY});
167                 }
168                 break;
169             case __GO_INFO_MESSAGE__:
170                 if (component.getInfoBar() != null) {
171                     component.getInfoBar().setText((String) value);
172                 }
173                 break;
174             case __GO_EVENTHANDLER_ENABLE__:
175                 Boolean enabled = (Boolean) GraphicController.getController().getProperty(component.getId(), __GO_EVENTHANDLER_ENABLE__);
176                 component.setEventHandlerEnabled(enabled);
177                 break;
178             case __GO_EVENTHANDLER_NAME__:
179                 String eventHandlerName = (String) GraphicController.getController().getProperty(component.getId(), __GO_EVENTHANDLER_NAME__);
180                 component.setEventHandler(eventHandlerName);
181                 break;
182             case __GO_VISIBLE__:
183                 component.getContentPane().setVisible((Boolean) value);
184                 if (component.getParentWindow().getNbDockedObjects() == 1) {
185                     component.getParentWindow().setVisible((Boolean) value);
186                 }
187                 break;
188             case __GO_INFOBAR_VISIBLE__: {
189                 component.disableResizeEvent();
190                 Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
191                 component.getInfoBar().setVisible((Boolean) value);
192                 SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
193                 parentWindow.validate();
194                 GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
195                 component.enableResizeEvent();
196                 break;
197             }
198             case __GO_TOOLBAR_VISIBLE__: {
199                 component.disableResizeEvent();
200                 Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
201                 component.getToolBar().setVisible((Boolean) value);
202                 SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
203                 parentWindow.validate();
204                 GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
205                 component.enableResizeEvent();
206                 break;
207             }
208             case __GO_MENUBAR_VISIBLE__: {
209                 component.disableResizeEvent();
210                 Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
211                 component.getMenuBar().setVisible((Boolean) value);
212                 SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
213                 parentWindow.validate();
214                 GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
215                 component.enableResizeEvent();
216                 break;
217             }
218             case __GO_RESIZE__:
219                 component.getParentWindow().setResizable((Boolean) value);
220                 break;
221             case __GO_LAYOUT__:
222                 LayoutType newLayout = LayoutType.intToEnum((Integer) value);
223                 switch (newLayout) {
224                     case BORDER: {
225                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
226                         component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
227                         component.setHasLayout(true);
228                         break;
229                     }
230                     case GRIDBAG: {
231                         component.getWidgetPane().setLayout(new GridBagLayout());
232                         component.setHasLayout(true);
233                         break;
234                     }
235                     case GRID: {
236                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
237                         Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
238                         Integer[] localGrid = new Integer[] { 0, 0 };
239                         localGrid[0] = grid[0];
240                         localGrid[1] = grid[1];
241
242                         if (localGrid[0] == 0 && localGrid[1] == 0) {
243                             localGrid[0] = 1;
244                         }
245
246                         component.getWidgetPane().setLayout(new GridLayout(localGrid[0], localGrid[1], padding[0], padding[1]));
247                         component.setHasLayout(true);
248                         break;
249                     }
250                     case NONE:
251                     default:
252                         component.getWidgetPane().setLayout(null);
253                         component.setHasLayout(false);
254                         break;
255                 }
256                 break;
257             case __GO_GRID_OPT_PADDING__:
258             case __GO_GRID_OPT_GRID__: {
259                 Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
260                 LayoutType layoutType = LayoutType.intToEnum(layout);
261
262                 if (layoutType != LayoutType.GRID) {
263                     break;
264                 }
265
266                 Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
267
268                 Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
269                 Integer[] localGrid = new Integer[] { 0, 0 };
270                 localGrid[0] = grid[0];
271                 localGrid[1] = grid[1];
272
273                 if (localGrid[0] == 0 && localGrid[1] == 0) {
274                     localGrid[0] = 1;
275                 }
276
277                 component.getWidgetPane().setLayout(new GridLayout(localGrid[0], localGrid[1], padding[0], padding[1]));
278                 break;
279             }
280             case __GO_BORDER_OPT_PADDING__: {
281                 Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
282                 LayoutType layoutType = LayoutType.intToEnum(layout);
283
284                 if (layoutType != LayoutType.BORDER) {
285                     break;
286                 }
287
288                 Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
289                 component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
290                 break;
291             }
292             case __GO_UI_ICON__: {
293                 File file = new File((String) value);
294                 if (file.exists() == false) {
295                     String filename = FindIconHelper.findImage((String) value);
296                     file = new File(filename);
297                 }
298
299                 try {
300                     BufferedImage icon = ImageIO.read(file);
301                     component.getParentWindow().setIconImage(new ImageIcon(icon).getImage());
302                 } catch (IOException e) {
303                 }
304                 break;
305             }
306             case __GO_COLORMAP__: {
307                 // Force background
308                 Figure figure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
309                 component.setFigureBackground(ColorFactory.createColor(figure.getColorMap(), figure.getBackground()));
310                 break;
311             }
312             case __GO_BACKGROUND__: {
313                 Figure figure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
314                 component.setFigureBackground(ColorFactory.createColor(figure.getColorMap(), (Integer) value));
315                 break;
316             }
317         }
318     }
319
320     /**
321      * Update the title of the Tab
322      * @param figureName figure_name property
323      * @param figureId figure_id property
324      */
325     private static void updateTitle(SwingScilabPanel component, String figureName, Integer figureId) {
326         if ((figureName != null) && (figureId != null)) {
327             String figureTitle = figureName.replaceFirst("%d", figureId.toString());
328             component.setName(figureTitle);
329         }
330     }
331
332     /**
333      * Update the menus callbacks when they are linked to the figure ID
334      * @param children the children UID
335      * @param parentFigureId the figure ID
336      */
337     private static void updateChildrenCallbacks(Integer[] children, int parentFigureId) {
338         for (int kChild = 0; kChild < children.length; kChild++) {
339             Integer childType = (Integer) GraphicController.getController().getProperty(children[kChild], __GO_TYPE__);
340             if (childType != null && (childType == __GO_UIMENU__ || childType == __GO_UIPARENTMENU__ || childType == __GO_UICHILDMENU__ || childType == __GO_UICHECKEDMENU__)) {
341                 String cb = (String) GraphicController.getController().getProperty(children[kChild], __GO_CALLBACK__);
342                 SwingView.getFromId(children[kChild]).update(__GO_CALLBACK__, replaceFigureID(cb, parentFigureId));
343                 Integer[] menuChildren = (Integer[]) GraphicController.getController().getProperty(children[kChild], __GO_CHILDREN__);
344                 updateChildrenCallbacks(menuChildren, parentFigureId);
345             }
346         }
347     }
348
349     /**
350      * Replace pattern [SCILAB_FIGURE_ID] by the figure index
351      * @param initialString string read in XML file
352      * @param parentFigureId the figure ID
353      * @return callback string
354      */
355     private static String replaceFigureID(String initialString, Integer parentFigureId) {
356         return initialString.replaceAll("\\[SCILAB_FIGURE_ID\\]", Integer.toString(parentFigureId));
357     }
358
359     /**
360      * Add a SwingViewObject (from SwingView.java) to container and returns its
361      * index
362      * @param member the member to add
363      */
364     protected static void addMember(SwingScilabPanel component, SwingViewObject member) {
365         //member.get
366         Uicontrol uicontrol = (Uicontrol) GraphicModel.getModel().getObjectFromId(member.getId());
367         if (component.getWidgetPane().getLayout() instanceof BorderLayout) {
368             switch (uicontrol.getBorderPositionAsEnum()) {
369                 case BOTTOM:
370                     component.getWidgetPane().add((Component) member, BorderLayout.SOUTH);
371                     break;
372                 case TOP:
373                     component.getWidgetPane().add((Component) member, BorderLayout.NORTH);
374                     break;
375                 case LEFT:
376                     component.getWidgetPane().add((Component) member, BorderLayout.WEST);
377                     break;
378                 case RIGHT:
379                     component.getWidgetPane().add((Component) member, BorderLayout.EAST);
380                     break;
381                 case CENTER:
382                     component.getWidgetPane().add((Component) member, BorderLayout.CENTER);
383                     break;
384                 default:
385                     break;
386             }
387
388             Integer[] preferredSize = uicontrol.getBorderPreferredSize();
389             if (preferredSize[0].equals(-1) == false && preferredSize[1].equals(-1) == false) {
390                 ((Component) member).setPreferredSize(new Dimension(preferredSize[0], preferredSize[1]));
391             }
392         } else if (component.getWidgetPane().getLayout() instanceof GridBagLayout) {
393             GridBagConstraints constraints = new GridBagConstraints();
394
395             // Grid
396             Integer[] grid = uicontrol.getGridBagGrid();
397             constraints.gridx = grid[0];
398             constraints.gridy = grid[1];
399             constraints.gridwidth = grid[2];
400             constraints.gridheight = grid[3];
401
402             // Weight
403             Double[] weight = uicontrol.getGridBagWeight();
404             constraints.weightx = weight[0];
405             constraints.weighty = weight[1];
406
407             // Anchor
408             switch (uicontrol.getGridBagAnchorAsEnum()) {
409                 case RIGHT:
410                     constraints.anchor = GridBagConstraints.EAST;
411                     break;
412                 case UPPER:
413                     constraints.anchor = GridBagConstraints.NORTH;
414                     break;
415                 case LOWER:
416                     constraints.anchor = GridBagConstraints.SOUTH;
417                     break;
418                 case LOWER_RIGHT:
419                     constraints.anchor = GridBagConstraints.SOUTHEAST;
420                     break;
421                 case LOWER_LEFT:
422                     constraints.anchor = GridBagConstraints.SOUTHWEST;
423                     break;
424                 case LEFT:
425                     constraints.anchor = GridBagConstraints.WEST;
426                     break;
427                 case UPPER_RIGHT:
428                     constraints.anchor = GridBagConstraints.NORTHEAST;
429                     break;
430                 case UPPER_LEFT:
431                     constraints.anchor = GridBagConstraints.NORTHWEST;
432                     break;
433                 case CENTER:
434                 default:
435                     constraints.anchor = GridBagConstraints.CENTER;
436                     break;
437             }
438
439             // Fill
440             switch (uicontrol.getGridBagFillAsEnum()) {
441                 case BOTH:
442                     constraints.fill = GridBagConstraints.BOTH;
443                     break;
444                 case HORIZONTAL:
445                     constraints.fill = GridBagConstraints.HORIZONTAL;
446                     break;
447                 case VERTICAL:
448                     constraints.fill = GridBagConstraints.VERTICAL;
449                     break;
450                 case NONE:
451                 default:
452                     constraints.fill = GridBagConstraints.NONE;
453                     break;
454             }
455
456             // Insets
457             Double[] margins = uicontrol.getMargins();
458             constraints.insets = new Insets(margins[0].intValue(), margins[1].intValue(), margins[2].intValue(), margins[3].intValue());
459
460             // Padding
461             Integer[] padding = uicontrol.getGridBagPadding();
462             constraints.ipadx = padding[0];
463             constraints.ipady = padding[1];
464
465             Integer[] preferredSize = uicontrol.getGridBagPreferredSize();
466             if (preferredSize[0].equals(-1) == false && preferredSize[1].equals(-1) == false) {
467                 ((Component) member).setPreferredSize(new Dimension(preferredSize[0], preferredSize[1]));
468             }
469
470             component.getWidgetPane().add((Component) member, constraints);
471             component.getWidgetPane().revalidate();
472         } else {
473             if (member instanceof SwingScilabScrollableFrame || member instanceof SwingScilabFrame) {
474                 component.getWidgetPane().add((Component) member, JLayeredPane.FRAME_CONTENT_LAYER);
475             } else {
476                 component.getWidgetPane().add((Component) member, JLayeredPane.DEFAULT_LAYER + 1);
477             }
478         }
479     }
480
481     protected static void removeMember(SwingScilabPanel component, SwingViewObject member) {
482         component.getWidgetPane().remove((Component) member);
483     }
484 }