01: /*
02: #IFNDEF ALT_LICENSE
03: ThinWire(R) RIA Ajax Framework
04: Copyright (C) 2003-2007 Custom Credit Systems
05:
06: This library is free software; you can redistribute it and/or modify it under
07: the terms of the GNU Lesser General Public License as published by the Free
08: Software Foundation; either version 2.1 of the License, or (at your option) any
09: later version.
10:
11: This library is distributed in the hope that it will be useful, but WITHOUT ANY
12: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13: PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14:
15: You should have received a copy of the GNU Lesser General Public License along
16: with this library; if not, write to the Free Software Foundation, Inc., 59
17: Temple Place, Suite 330, Boston, MA 02111-1307 USA
18:
19: Users who would rather have a commercial license, warranty or support should
20: contact the following company who invented, built and supports the technology:
21:
22: Custom Credit Systems, Richardson, TX 75081, USA.
23: email: info@thinwire.com ph: +1 (888) 644-6405
24: http://www.thinwire.com
25: #ENDIF
26: [ v1.2_RC2 ]
27: */
28: package thinwire.render.web;
29:
30: import thinwire.ui.Component;
31: import thinwire.ui.TabFolder;
32: import thinwire.ui.TabSheet;
33: import thinwire.ui.event.PropertyChangeEvent;
34: import thinwire.ui.style.Border;
35:
36: /**
37: * @author Joshua J. Gertzen
38: */
39: class TabSheetRenderer extends ContainerRenderer {
40: private static final String TABSHEET_CLASS = "tw_TabSheet";
41:
42: void render(WindowRenderer wr, Component c,
43: ComponentRenderer container) {
44: init(TABSHEET_CLASS, wr, c, container);
45: //a tabsheet does not support x, y, width, height, enabled or visible
46: setPropertyChangeIgnored(Component.PROPERTY_X, true);
47: setPropertyChangeIgnored(Component.PROPERTY_Y, true);
48: setPropertyChangeIgnored(Component.PROPERTY_WIDTH, true);
49: setPropertyChangeIgnored(Component.PROPERTY_HEIGHT, true);
50: setPropertyChangeIgnored(Component.PROPERTY_ENABLED, true);
51: setPropertyChangeIgnored(Border.PROPERTY_BORDER_TYPE, true);
52: setPropertyChangeIgnored(Border.PROPERTY_BORDER_COLOR, true);
53: setPropertyChangeIgnored(Border.PROPERTY_BORDER_SIZE, true);
54: setPropertyChangeIgnored(Border.PROPERTY_BORDER_IMAGE, true);
55: TabSheet ts = (TabSheet) c;
56: addInitProperty(TabSheet.PROPERTY_TEXT, parseRichText(ts
57: .getText()));
58: addInitProperty(TabSheet.PROPERTY_IMAGE, getQualifiedURL(ts
59: .getImage()));
60: addInitProperty("tabIndex", ((TabFolder) ts.getParent())
61: .getChildren().indexOf(ts));
62: super .render(wr, c, container);
63: }
64:
65: public void propertyChange(PropertyChangeEvent pce) {
66: String name = pce.getPropertyName();
67: Object newValue = pce.getNewValue();
68:
69: if (name.equals(TabSheet.PROPERTY_IMAGE)) {
70: postClientEvent(SET_IMAGE,
71: getQualifiedURL((String) newValue));
72: } else if (name.equals(TabSheet.PROPERTY_TEXT)) {
73: postClientEvent(TextComponentRenderer.SET_TEXT,
74: parseRichText((String) newValue));
75: } else {
76: super.propertyChange(pce);
77: }
78: }
79: }
|