01: /*
02: * This file is part of the WfMOpen project.
03: * Copyright (C) 2001-2005 Danet GmbH (www.danet.de), BU BTS.
04: * All rights reserved.
05: *
06: * This program is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU General Public License as published by
08: * the Free Software Foundation; either version 2 of the License, or
09: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: *
20: * $Id: XmlDisplayWindow.java,v 1.2 2007/03/27 21:59:43 mlipp Exp $
21: *
22: * $Log: XmlDisplayWindow.java,v $
23: * Revision 1.2 2007/03/27 21:59:43 mlipp
24: * Fixed lots of checkstyle warnings.
25: *
26: * Revision 1.1 2006/10/05 13:27:39 drmlipp
27: * New tag for XML display.
28: *
29: */
30: package de.danet.an.util.jsf.taglib;
31:
32: import javax.faces.component.UIComponentBase;
33: import javax.faces.context.FacesContext;
34: import javax.faces.convert.Converter;
35: import javax.faces.el.ValueBinding;
36:
37: /**
38: * This class provides a component that causes a window with
39: * XML data to pop up.
40: *
41: * @author Michael Lipp
42: *
43: */
44: public class XmlDisplayWindow extends UIComponentBase {
45:
46: public static String COMPONENT_FAMILY = "de.danet.bts.jsf.taglib";
47: public static String COMPONENT_TYPE = "de.danet.bts.XmlDisplayWindow";
48:
49: private Object xmlData;
50:
51: /* (non-Javadoc)
52: * @see javax.faces.component.UIComponent#getFamily()
53: */
54: public String getFamily() {
55: return COMPONENT_FAMILY;
56: }
57:
58: public void setXmlData(Object value) {
59: xmlData = (Object) value;
60: }
61:
62: public Object getXmlData() {
63: if (xmlData != null) {
64: return xmlData;
65: }
66: ValueBinding vb = getValueBinding("xmlData");
67: return vb != null ? (Object) vb.getValue(getFacesContext())
68: : null;
69: }
70:
71: public Object saveState(FacesContext context) {
72: Object[] values = new Object[2];
73: values[0] = super .saveState(context);
74: values[1] = xmlData;
75: return ((Object) (values));
76: }
77:
78: public void restoreState(FacesContext context, Object state) {
79: Object[] values = (Object[]) state;
80: super .restoreState(context, values[0]);
81: xmlData = (Object) values[1];
82: }
83: }
|