Author: sergeyhalipov
Date: 2007-06-25 07:26:15 -0400 (Mon, 25 Jun 2007)
New Revision: 1289
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-296
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
===================================================================
---
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2007-06-25
10:42:02 UTC (rev 1288)
+++
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2007-06-25
11:26:15 UTC (rev 1289)
@@ -1,103 +1,86 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.component;
-
-import org.ajax4jsf.framework.ajax.AjaxActionComponent;
-import org.ajax4jsf.framework.ajax.AjaxComponent;
-import org.ajax4jsf.framework.ajax.AjaxSource;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-
-import javax.faces.component.ActionSource;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-
-/**
- * JSF component class
- */
-public abstract class UISimpleTogglePanel extends AjaxActionComponent implements
AjaxComponent, AjaxSource, ActionSource
-//public abstract class UISimpleTogglePanel extends UIInput implements AjaxComponent,
AjaxSource, ActionSource
-{
-
- public static final String COMPONENT_FAMILY = "javax.faces.Command";
- public static final String SERVER_SWITCH_TYPE = "server";
- public static final String CLIENT_SWITCH_TYPE = "client";
- public static final String AJAX_SWITCH_TYPE = "ajax";
- public static final boolean COLLAPSED = false;
- public static final boolean EXPANDED = true;
-
- private boolean _opened = true;
-
- //xxxx by nick - why properties here? just describe them in config and CDK generates
- //valid fields & save/restore code
- //for "public" (.tld etc.) properties you should create abstract
getters/setters only
-
- //xxxx by nick - according to JavaDocs
http://webdownload.exadel.com/downloads/ajax4jsf/documentation/javaAPI/or...
- //AjaxActionComponent already has immediate property
-
-
- public abstract void setSwitchType(String switchType);
-
- public abstract String getSwitchType();
-
- /** A false value for this attribute makes a panel closed as default
- * Setter for opened
- * @param opened - new value
- */
- public void setOpened(boolean opened) {
- _opened = opened;
- }
-
- /**
- * A false value for this attribute makes a panel closed as default
- * Getter for opened
- * @return opened value from local variable or value bindings
- */
- public boolean isOpened() {
- ValueBinding vb = getValueBinding("opened");
- if (vb != null) {
- Boolean value = (Boolean) vb.getValue(getFacesContext());
- if (null == value) {
- return this._opened;
- }
- return (value.booleanValue());
- } else {
- return (this._opened);
- }
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- //public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
- // super.broadcast(facesEvent);
- // FacesContext facesContext = FacesContext.getCurrentInstance();
- // if (AjaxRendererUtils.isAjaxRequest(facesContext) &&
this.getSwitchType().equals(AJAX_SWITCH_TYPE)) {
- // AjaxRendererUtils.addRegionByName(facesContext,
- // this,
- // this.getId());
- // }
- //}
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.framework.ajax.AjaxActionComponent;
+import org.ajax4jsf.framework.ajax.AjaxComponent;
+import org.ajax4jsf.framework.ajax.AjaxSource;
+
+import javax.faces.component.ActionSource;
+import javax.faces.el.ValueBinding;
+
+/**
+ * JSF component class
+ */
+public abstract class UISimpleTogglePanel extends AjaxActionComponent implements
AjaxComponent, AjaxSource, ActionSource
+//public abstract class UISimpleTogglePanel extends UIInput implements AjaxComponent,
AjaxSource, ActionSource
+{
+
+ public static final String COMPONENT_FAMILY = "javax.faces.Command";
+ public static final String SERVER_SWITCH_TYPE = "server";
+ public static final String CLIENT_SWITCH_TYPE = "client";
+ public static final String AJAX_SWITCH_TYPE = "ajax";
+ public static final boolean COLLAPSED = false;
+ public static final boolean EXPANDED = true;
+
+ //xxxx by nick - why properties here? just describe them in config and CDK generates
+ //valid fields & save/restore code
+ //for "public" (.tld etc.) properties you should create abstract
getters/setters only
+
+ //xxxx by nick - according to JavaDocs
http://webdownload.exadel.com/downloads/ajax4jsf/documentation/javaAPI/or...
+ //AjaxActionComponent already has immediate property
+
+
+ public abstract void setSwitchType(String switchType);
+
+ public abstract String getSwitchType();
+
+ public abstract void setOpened(boolean opened);
+
+ public abstract boolean isOpened();
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void setValueBinding(String arg0, ValueBinding arg1) {
+ if ("opened".equals(arg0))
+ super.setValueBinding("value", arg1);
+ super.setValueBinding(arg0, arg1);
+ }
+
+ public ValueBinding getValueBinding(String arg0) {
+ if ("opened".equals(arg0))
+ return super.getValueBinding("value");
+ return super.getValueBinding(arg0);
+ }
+
+ //public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
+ // super.broadcast(facesEvent);
+ // FacesContext facesContext = FacesContext.getCurrentInstance();
+ // if (AjaxRendererUtils.isAjaxRequest(facesContext) &&
this.getSwitchType().equals(AJAX_SWITCH_TYPE)) {
+ // AjaxRendererUtils.addRegionByName(facesContext,
+ // this,
+ // this.getId());
+ // }
+ //}
+}
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
---
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-06-25
10:42:02 UTC (rev 1288)
+++
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-06-25
11:26:15 UTC (rev 1289)
@@ -102,8 +102,9 @@
event.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
event.queue();
- }
- panel.setOpened(new Boolean((String) clnId).booleanValue());
+ }
+ if (null == panel.getValueBinding("value"))
+ panel.setOpened(new Boolean((String) clnId).booleanValue());
}
if (AjaxRendererUtils.isAjaxRequest(context) &&
panel.getSwitchType().equals(UISimpleTogglePanel.AJAX_SWITCH_TYPE)) {