01: /*
02: * SwingML Copyright (C) 2002 SwingML Team
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: Ezequiel Cuellar <ecuellar@crosslogic.com> Robert Morris
19: * <robertj@morris.net>
20: *
21: */
22:
23: package org.swingml.view.renderer;
24:
25: import java.awt.*;
26:
27: import javax.swing.*;
28:
29: import org.swingml.*;
30: import org.swingml.component.*;
31: import org.swingml.model.*;
32: import org.swingml.view.*;
33: import org.swingml.view.Renderer;
34:
35: public class JDesktopPaneRenderer extends RendererUtil implements
36: Renderer {
37:
38: public Container render(AbstractSwingMLModel aModel,
39: Container aParent) {
40: JDesktopPaneModel theModel = (JDesktopPaneModel) aModel;
41: JDesktopPaneComponent panel = new JDesktopPaneComponent(
42: theModel);
43: String orientation = theModel.getOrientation();
44: if (orientation != null && !(aParent instanceof JTabbedPane)) {
45: aParent.add(panel, orientation);
46: } else if (aParent instanceof JTabbedPane) {
47: JTabbedPane theTabbedPane = (JTabbedPane) aParent;
48: theTabbedPane.add(theModel.getText(), panel);
49: } else {
50: aParent.add(panel);
51: }
52: super.iterate(aModel, panel);
53: return panel;
54: }
55: }
|