Author: sergeyhalipov
Date: 2007-06-21 12:05:45 -0400 (Thu, 21 Jun 2007)
New Revision: 1261
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.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-21
15:17:06 UTC (rev 1260)
+++
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2007-06-21
16:05:45 UTC (rev 1261)
@@ -28,6 +28,7 @@
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;
@@ -46,6 +47,8 @@
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
@@ -58,9 +61,31 @@
public abstract String getSwitchType();
- public abstract void setOpened(boolean opened);
+ /** 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;
+ }
- public abstract boolean isOpened();
+ /**
+ * 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;