001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)ExtPropertySheetComponent.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package org.openesb.tools.extpropertysheet.ui;
030:
031: import org.openesb.tools.extpropertysheet.IExtPropertyGroupsBean;
032: import com.sun.web.ui.component.TabSet;
033: import java.io.IOException;
034: import java.util.logging.Logger;
035: import javax.faces.component.UIComponent;
036: import javax.faces.component.UIComponentBase;
037: import javax.faces.context.FacesContext;
038: import javax.faces.context.ResponseWriter;
039: import javax.faces.el.ValueBinding;
040:
041: /**
042: *
043: * @author rdwivedi
044: */
045: public class ExtPropertySheetComponent extends UIComponentBase {
046:
047: private static Logger mLogger = Logger
048: .getLogger(ExtPropertySheetComponent.class.getName());
049: public static final String COMPONENT_TYPE = "org.openesb.tools.extpropertysheet.ui.ExtPropertySheetComponent";
050:
051: public static final String COMPONENT_FAMILY = "org.openesb.tools.extpropertysheet.ui";
052:
053: /** Creates a new instance of ExtPropertySheetComponent */
054:
055: private IExtPropertyGroupsBean mPropGroups = null;
056: private String mResBundle = null;
057:
058: public ExtPropertySheetComponent() {
059:
060: }
061:
062: public String getFamily() {
063: return COMPONENT_FAMILY;
064: }
065:
066: public void encodeBegin(FacesContext context) throws IOException {
067: mPropGroups = (IExtPropertyGroupsBean) getPropertyGroups();
068: // preEncoding(context);
069: ResponseWriter writer = context.getResponseWriter();
070: writer.startElement("div", this );
071:
072: }
073:
074: public void encodeEnd(FacesContext context) throws IOException {
075: context.getResponseWriter().endElement("div");
076: }
077:
078: public void createSubComponent(FacesContext context) {
079: UIComponent comp = null;
080: mPropGroups = (IExtPropertyGroupsBean) getPropertyGroups();
081: mResBundle = (String) getResourceBundle();
082: SubComponentCreator cr = new SubComponentCreator(mResBundle);
083: if (comp == null) {
084: comp = cr.createTabSet(mPropGroups, context);
085: }
086: this .getChildren().add(comp);
087:
088: }
089:
090: public Object getPropertyGroups() {
091: if (mPropGroups != null)
092: return mPropGroups;
093:
094: ValueBinding vb = getValueBinding("propertyGroups");
095: Object v = vb != null ? vb.getValue(getFacesContext()) : null;
096:
097: return v != null ? v : null;
098: }
099:
100: public void setPropertyGroups(Object pGs) {
101:
102: this .mPropGroups = (IExtPropertyGroupsBean) pGs;
103: }
104:
105: public Object getResourceBundle() {
106: if (mResBundle != null)
107: return mResBundle;
108:
109: ValueBinding vb = getValueBinding("resourceBundle");
110: Object v = vb != null ? vb.getValue(getFacesContext()) : null;
111: return v != null ? v : null;
112: }
113:
114: public void setResourceBundle(Object pGs) {
115: mResBundle = (String) pGs;
116: }
117:
118: public void decode(FacesContext context) {
119: super .decode(context);
120: mPropGroups = (IExtPropertyGroupsBean) getPropertyGroups();
121: PropertiesUpdater up = new PropertiesUpdater();
122: up.updateChartProperties((TabSet) this .getChildren().get(0),
123: mPropGroups);
124:
125: }
126:
127: public void restoreState(FacesContext context, Object state) {
128: super .restoreState(context, state);
129:
130: }
131:
132: public void processDecodes(FacesContext context) {
133: super.processDecodes(context);
134:
135: }
136:
137: }
|