01: /*
02: * SwingML Copyright (C) 2002 Robert J. Morris.
03: *
04: * This library is free software; you can redistribute it and/or modify it under
05: * the terms of the GNU Lesser General Public License as published by the Free
06: * Software Foundation; either version 2 of the License, or (at your option) any
07: * later version.
08: *
09: * This library is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12: * details.
13: *
14: * You should have received a copy of the GNU Lesser General Public License
15: * along with this library; if not, write to the Free Software Foundation, Inc.,
16: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: *
18: * Authors: Robert J. Morris <robertj@morris.net>
19: */
20:
21: package org.swingml.view.renderer;
22:
23: import java.awt.*;
24:
25: import org.swingml.*;
26: import org.swingml.component.*;
27: import org.swingml.model.*;
28: import org.swingml.view.*;
29:
30: public class GridBagPanelRenderer extends RendererUtil implements
31: Renderer {
32:
33: public Container render(AbstractSwingMLModel aModel,
34: Container aParent) {
35: GridBagPanelModel theModel = (GridBagPanelModel) aModel;
36: GridBagPanelComponent theGridBagPanel = new GridBagPanelComponent(
37: theModel);
38: /*
39: * Using the JSplitPaneModel's getOrientation() value, we can now add
40: * the newly initialized JSplitPane component to the parent container.
41: */
42: String theOrientation = theModel.getOrientation();
43: if (theOrientation != null) {
44: aParent.add(theGridBagPanel, theOrientation);
45: } else {
46: aParent.add(theGridBagPanel);
47: }
48: super.iterate(theModel, theGridBagPanel);
49: return theGridBagPanel;
50: }
51: }
|