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> Alessandro Dibella
19: * <alessandro.dibella@fuurou.org>
20: */
21:
22: package org.swingml.view.renderer;
23:
24: import java.awt.*;
25:
26: import javax.swing.*;
27:
28: import org.swingml.*;
29: import org.swingml.model.*;
30: import org.swingml.view.*;
31: import org.swingml.view.Renderer;
32:
33: public class JToolBarRenderer extends RendererUtil implements Renderer {
34:
35: public Container render(AbstractSwingMLModel aModel,
36: Container aParent) {
37: JToolBarModel theModel = (JToolBarModel) aModel;
38: JToolBar theToolBar = new JToolBar();
39: theToolBar.setName(theModel.getName());
40: theToolBar.setToolTipText(theModel.getTooltip());
41: if (theModel.getOrientation().equalsIgnoreCase(Constants.EAST)
42: || theModel.getOrientation().equalsIgnoreCase(
43: Constants.WEST)) {
44: theToolBar.setOrientation(SwingConstants.VERTICAL);
45: }
46: aParent.add(theToolBar, theModel.getOrientation());
47: super.iterate(theModel, theToolBar);
48:
49: return theToolBar;
50: }
51: }
|