1efb650f6a0a614a9bc7f3f6456093417e158e14
[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 = localFigure.getToolbarVisible();
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(localFigure.getToolbarVisible());
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                 }
167                 break;
168             case __GO_INFO_MESSAGE__:
169                 if (component.getInfoBar() != null) {
170                     component.getInfoBar().setText((String) value);
171                 }
172                 break;
173             case __GO_EVENTHANDLER_ENABLE__:
174                 Boolean enabled = (Boolean) GraphicController.getController().getProperty(component.getId(), __GO_EVENTHANDLER_ENABLE__);
175                 component.setEventHandlerEnabled(enabled);
176                 break;
177             case __GO_EVENTHANDLER_NAME__:
178                 String eventHandlerName = (String) GraphicController.getController().getProperty(component.getId(), __GO_EVENTHANDLER_NAME__);
179                 component.setEventHandler(eventHandlerName);
180                 break;
181             case __GO_VISIBLE__:
182                 component.getContentPane().setVisible((Boolean) value);
183                 if (component.getParentWindow().getNbDockedObjects() == 1) {
184                     component.getParentWindow().setVisible((Boolean) value);
185                 }
186                 break;
187             case __GO_INFOBAR_VISIBLE__: {
188                 Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
189                 component.getInfoBar().setVisible((Boolean) value);
190                 SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
191                 parentWindow.validate();
192                 GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
193                 break;
194             }
195             case __GO_TOOLBAR_VISIBLE__: {
196                 Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
197                 component.getToolBar().setVisible((Boolean) value);
198                 SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
199                 parentWindow.validate();
200                 GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
201                 break;
202             }
203             case __GO_MENUBAR_VISIBLE__: {
204                 Integer[] oldSize = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_AXES_SIZE__);
205                 component.getMenuBar().setVisible((Boolean) value);
206                 SwingScilabWindow parentWindow = SwingScilabWindow.allScilabWindows.get(component.getParentWindowId());
207                 parentWindow.validate();
208                 GraphicController.getController().setProperty(component.getId(), __GO_AXES_SIZE__, oldSize);
209                 break;
210             }
211             case __GO_RESIZE__:
212                 component.getParentWindow().setResizable((Boolean) value);
213                 break;
214             case __GO_LAYOUT__:
215                 LayoutType newLayout = LayoutType.intToEnum((Integer) value);
216                 switch (newLayout) {
217                     case BORDER: {
218                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
219                         component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
220                         component.getWidgetPane().setLayout(new BorderLayout());
221                         component.setHasLayout(true);
222                         break;
223                     }
224                     case GRIDBAG: {
225                         component.getWidgetPane().setLayout(new GridBagLayout());
226                         component.setHasLayout(true);
227                         break;
228                     }
229                     case GRID: {
230                         Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
231                         Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
232                         Integer[] localGrid = new Integer[] { 0, 0 };
233                         localGrid[0] = grid[0];
234                         localGrid[1] = grid[1];
235
236                         if (localGrid[0] == 0 && localGrid[1] == 0) {
237                             localGrid[0] = 1;
238                         }
239
240                         component.getWidgetPane().setLayout(new GridLayout(localGrid[0], localGrid[1], padding[0], padding[1]));
241                         component.setHasLayout(true);
242                         break;
243                     }
244                     case NONE:
245                     default:
246                         component.getWidgetPane().setLayout(null);
247                         component.setHasLayout(false);
248                         break;
249                 }
250                 break;
251             case __GO_GRID_OPT_PADDING__:
252             case __GO_GRID_OPT_GRID__: {
253                 Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
254                 LayoutType layoutType = LayoutType.intToEnum(layout);
255
256                 if (layoutType != LayoutType.GRID) {
257                     break;
258                 }
259
260                 Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_PADDING__);
261
262                 Integer[] grid = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_GRID_OPT_GRID__);
263                 Integer[] localGrid = new Integer[] { 0, 0 };
264                 localGrid[0] = grid[0];
265                 localGrid[1] = grid[1];
266
267                 if (localGrid[0] == 0 && localGrid[1] == 0) {
268                     localGrid[0] = 1;
269                 }
270
271                 component.getWidgetPane().setLayout(new GridLayout(localGrid[0], localGrid[1], padding[0], padding[1]));
272                 break;
273             }
274             case __GO_BORDER_OPT_PADDING__: {
275                 Integer layout = (Integer) GraphicController.getController().getProperty(component.getId(), __GO_LAYOUT__);
276                 LayoutType layoutType = LayoutType.intToEnum(layout);
277
278                 if (layoutType != LayoutType.BORDER) {
279                     break;
280                 }
281
282                 Integer[] padding = (Integer[]) GraphicController.getController().getProperty(component.getId(), __GO_BORDER_OPT_PADDING__);
283                 component.getWidgetPane().setLayout(new BorderLayout(padding[0], padding[1]));
284                 component.getWidgetPane().setLayout(new BorderLayout());
285                 break;
286             }
287             case __GO_UI_ICON__: {
288                 File file = new File((String) value);
289                 if (file.exists() == false) {
290                     String filename = FindIconHelper.findImage((String) value);
291                     file = new File(filename);
292                 }
293
294                 try {
295                     BufferedImage icon = ImageIO.read(file);
296                     component.getParentWindow().setIconImage(new ImageIcon(icon).getImage());
297                 } catch (IOException e) {
298                 }
299                 break;
300             }
301             case __GO_COLORMAP__: {
302                 // Force background
303                 Figure figure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
304                 component.setFigureBackground(ColorFactory.createColor(figure.getColorMap(), figure.getBackground()));
305                 break;
306             }
307             case __GO_BACKGROUND__: {
308                 Figure figure = (Figure) GraphicController.getController().getObjectFromId(component.getId());
309                 component.setFigureBackground(ColorFactory.createColor(figure.getColorMap(), (Integer) value));
310                 break;
311             }
312         }
313     }
314
315     /**
316      * Update the title of the Tab
317      * @param figureName figure_name property
318      * @param figureId figure_id property
319      */
320     private static void updateTitle(SwingScilabPanel component, String figureName, Integer figureId) {
321         if ((figureName != null) && (figureId != null)) {
322             String figureTitle = figureName.replaceFirst("%d", figureId.toString());
323             component.setName(figureTitle);
324         }
325     }
326
327     /**
328      * Update the menus callbacks when they are linked to the figure ID
329      * @param children the children UID
330      * @param parentFigureId the figure ID
331      */
332     private static void updateChildrenCallbacks(Integer[] children, int parentFigureId) {
333         for (int kChild = 0; kChild < children.length; kChild++) {
334             Integer childType = (Integer) GraphicController.getController().getProperty(children[kChild], __GO_TYPE__);
335             if (childType != null && (childType == __GO_UIMENU__ || childType == __GO_UIPARENTMENU__ || childType == __GO_UICHILDMENU__ || childType == __GO_UICHECKEDMENU__)) {
336                 String cb = (String) GraphicController.getController().getProperty(children[kChild], __GO_CALLBACK__);
337                 SwingView.getFromId(children[kChild]).update(__GO_CALLBACK__, replaceFigureID(cb, parentFigureId));
338                 Integer[] menuChildren = (Integer[]) GraphicController.getController().getProperty(children[kChild], __GO_CHILDREN__);
339                 updateChildrenCallbacks(menuChildren, parentFigureId);
340             }
341         }
342     }
343
344     /**
345      * Replace pattern [SCILAB_FIGURE_ID] by the figure index
346      * @param initialString string read in XML file
347      * @param parentFigureId the figure ID
348      * @return callback string
349      */
350     private static String replaceFigureID(String initialString, Integer parentFigureId) {
351         return initialString.replaceAll("\\[SCILAB_FIGURE_ID\\]", Integer.toString(parentFigureId));
352     }
353
354     /**
355      * Add a SwingViewObject (from SwingView.java) to container and returns its
356      * index
357      * @param member the member to add
358      */
359     protected static void addMember(SwingScilabPanel component, SwingViewObject member) {
360         //member.get
361         Uicontrol uicontrol = (Uicontrol) GraphicModel.getModel().getObjectFromId(member.getId());
362         if (component.getWidgetPane().getLayout() instanceof BorderLayout) {
363             switch (uicontrol.getBorderPositionAsEnum()) {
364                 case BOTTOM:
365                     component.getWidgetPane().add((Component) member, BorderLayout.SOUTH);
366                     break;
367                 case TOP:
368                     component.getWidgetPane().add((Component) member, BorderLayout.NORTH);
369                     break;
370                 case LEFT:
371                     component.getWidgetPane().add((Component) member, BorderLayout.WEST);
372                     break;
373                 case RIGHT:
374                     component.getWidgetPane().add((Component) member, BorderLayout.EAST);
375                     break;
376                 case CENTER:
377                     component.getWidgetPane().add((Component) member, BorderLayout.CENTER);
378                     break;
379                 default:
380                     break;
381             }
382
383             Integer[] preferredSize = uicontrol.getBorderPreferredSize();
384             if (preferredSize[0].equals(-1) == false && preferredSize[1].equals(-1) == false) {
385                 ((Component) member).setPreferredSize(new Dimension(preferredSize[0], preferredSize[1]));
386             }
387         } else if (component.getWidgetPane().getLayout() instanceof GridBagLayout) {
388             GridBagConstraints constraints = new GridBagConstraints();
389
390             // Grid
391             Integer[] grid = uicontrol.getGridBagGrid();
392             constraints.gridx = grid[0];
393             constraints.gridy = grid[1];
394             constraints.gridwidth = grid[2];
395             constraints.gridheight = grid[3];
396
397             // Weight
398             Double[] weight = uicontrol.getGridBagWeight();
399             constraints.weightx = weight[0];
400             constraints.weighty = weight[1];
401
402             // Anchor
403             switch (uicontrol.getGridBagAnchorAsEnum()) {
404                 case LEFT:
405                     constraints.anchor = GridBagConstraints.EAST;
406                     break;
407                 case UPPER:
408                     constraints.anchor = GridBagConstraints.NORTH;
409                     break;
410                 case LOWER:
411                     constraints.anchor = GridBagConstraints.SOUTH;
412                     break;
413                 case LOWER_LEFT:
414                     constraints.anchor = GridBagConstraints.SOUTHEAST;
415                     break;
416                 case LOWER_RIGHT:
417                     constraints.anchor = GridBagConstraints.SOUTHWEST;
418                     break;
419                 case RIGHT:
420                     constraints.anchor = GridBagConstraints.WEST;
421                     break;
422                 case UPPER_LEFT:
423                     constraints.anchor = GridBagConstraints.NORTHEAST;
424                     break;
425                 case UPPER_RIGHT:
426                     constraints.anchor = GridBagConstraints.NORTHWEST;
427                     break;
428                 case CENTER:
429                 default:
430                     constraints.anchor = GridBagConstraints.CENTER;
431                     break;
432             }
433
434             // Fill
435             switch (uicontrol.getGridBagFillAsEnum()) {
436                 case BOTH:
437                     constraints.fill = GridBagConstraints.BOTH;
438                     break;
439                 case HORIZONTAL:
440                     constraints.fill = GridBagConstraints.HORIZONTAL;
441                     break;
442                 case VERTICAL:
443                     constraints.fill = GridBagConstraints.VERTICAL;
444                     break;
445                 case NONE:
446                 default:
447                     constraints.fill = GridBagConstraints.NONE;
448                     break;
449             }
450
451             // Insets
452             Double[] margins = uicontrol.getMargins();
453             constraints.insets = new Insets(margins[0].intValue(), margins[1].intValue(), margins[2].intValue(), margins[3].intValue());
454
455             // Padding
456             Integer[] padding = uicontrol.getGridBagPadding();
457             constraints.ipadx = padding[0];
458             constraints.ipady = padding[1];
459
460             Integer[] preferredSize = uicontrol.getGridBagPreferredSize();
461             if (preferredSize[0].equals(-1) == false && preferredSize[1].equals(-1) == false) {
462                 ((Component) member).setPreferredSize(new Dimension(preferredSize[0], preferredSize[1]));
463             }
464
465             component.getWidgetPane().add((Component) member, constraints);
466             component.getWidgetPane().revalidate();
467         } else {
468             if (member instanceof SwingScilabScrollableFrame || member instanceof SwingScilabFrame) {
469                 component.getWidgetPane().add((Component) member, JLayeredPane.FRAME_CONTENT_LAYER);
470             } else {
471                 component.getWidgetPane().add((Component) member, JLayeredPane.DEFAULT_LAYER + 1);
472             }
473         }
474     }
475
476     protected static void removeMember(SwingScilabPanel component, SwingViewObject member) {
477         component.getWidgetPane().remove((Component) member);
478     }
479 }