Author: abelevich
Date: 2011-01-28 08:33:29 -0500 (Fri, 28 Jan 2011)
New Revision: 21304
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable-toggler.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js
Log:
RF-10208 Collapsible Sub Table Toggler - rename the attributes and markup semantically
properly to collapsed/expanded
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2011-01-28
13:32:20 UTC (rev 21303)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTable.java 2011-01-28
13:33:29 UTC (rev 21304)
@@ -60,9 +60,9 @@
public static final String MODE_CLIENT = "client";
- public static final int EXPAND_STATE = 1;
+ public static final int EXPANDED_STATE = 1;
- public static final int COLLAPSE_STATE = 0;
+ public static final int COLLAPSED_STATE = 0;
enum PropertyKeys {
@@ -106,7 +106,6 @@
getFacesContext().getPartialViewContext().getRenderIds().add(togglerId);
}
}
-
}
super.broadcast(event);
}
@@ -157,6 +156,4 @@
state[1] = getStateHelper().get(PropertyKeys.expanded);
return state;
}
-}
-
-
+}
\ No newline at end of file
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2011-01-28
13:32:20 UTC (rev 21303)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractCollapsibleSubTableToggler.java 2011-01-28
13:33:29 UTC (rev 21304)
@@ -49,16 +49,16 @@
public static final String DEFAULT_EVENT = "onclick";
@Attribute
- public abstract String getExpandLabel();
+ public abstract String getExpandedLabel();
@Attribute
- public abstract String getCollapseLabel();
+ public abstract String getCollapsedLabel();
@Attribute
- public abstract String getExpandIcon();
+ public abstract String getExpandedIcon();
@Attribute
- public abstract String getCollapseIcon();
+ public abstract String getCollapsedIcon();
@Attribute
public abstract String getEvent();
@@ -71,4 +71,4 @@
public void setFor(String forId) {
getStateHelper().put("for", forId);
}
-}
+}
\ No newline at end of file
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2011-01-28
13:32:20 UTC (rev 21303)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableRenderer.java 2011-01-28
13:33:29 UTC (rev 21304)
@@ -103,16 +103,16 @@
String stateId = clientId + STATE;
String state = (String)requestMap.get(stateId);
- boolean isExpand = true;
+ boolean isExpanded = true;
if(state != null) {
int newValue = Integer.parseInt(state);
if(newValue < 1) {
- isExpand = false;
+ isExpanded = false;
}
- if(subTable.isExpanded() != isExpand) {
- new ToggleEvent(subTable, isExpand, togglerId).queue();
+ if(subTable.isExpanded() != isExpanded) {
+ new ToggleEvent(subTable, isExpanded, togglerId).queue();
}
}
}
@@ -241,7 +241,7 @@
writer.writeAttribute(HtmlConstants.NAME_ATTRIBUTE, stateId, null);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.INPUT_TYPE_HIDDEN,
null);
- int state = subTable.isExpanded() ? AbstractCollapsibleSubTable.EXPAND_STATE :
AbstractCollapsibleSubTable.COLLAPSE_STATE;
+ int state = subTable.isExpanded() ? AbstractCollapsibleSubTable.EXPANDED_STATE :
AbstractCollapsibleSubTable.COLLAPSED_STATE;
writer.writeAttribute(HtmlConstants.VALUE_ATTRIBUTE, state, null);
writer.endElement(HtmlConstants.INPUT_ELEM);
@@ -417,4 +417,4 @@
}
return (UIDataTableBase)parent;
}
-}
+}
\ No newline at end of file
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java 2011-01-28
13:32:20 UTC (rev 21303)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/CollapsibleSubTableTogglerRendererBase.java 2011-01-28
13:33:29 UTC (rev 21304)
@@ -65,9 +65,9 @@
private static final String DOWN_ICON_URL = "org.richfaces/down_icon.gif";
- private static final String EXPAND_STATE = "expand";
+ private static final String EXPANDED_STATE = "expanded";
- private static final String COLLAPSE_STATE = "collapse";
+ private static final String COLLAPSED_STATE = "collapsed";
@Override
protected void doDecode(FacesContext context, UIComponent component) {
@@ -83,8 +83,8 @@
boolean expanded = subTable.isExpanded();
ResponseWriter writer = context.getResponseWriter();
- encodeControl(context, writer, toggleControl, expanded, false);
- encodeControl(context, writer, toggleControl, !expanded, true);
+ encodeControl(context, writer, toggleControl, expanded, true);
+ encodeControl(context, writer, toggleControl, !expanded, false);
JSFunction jsFunction = new JSFunction("new
RichFaces.ui.CollapsibleSubTableToggler");
String toggleId = toggleControl.getClientId(context);
@@ -129,21 +129,21 @@
controlFacet.encodeAll(context);
}
- String expandIcon = control.getExpandIcon();
- if (isEmpty(expandIcon)) {
- expandIcon =
context.getApplication().getResourceHandler().createResource(UP_ICON_URL).getRequestPath();
+ String expandedIcon = control.getExpandedIcon();
+ if (isEmpty(expandedIcon)) {
+ expandedIcon =
context.getApplication().getResourceHandler().createResource(DOWN_ICON_URL).getRequestPath();
} else {
- expandIcon = RenderKitUtils.getResourceURL(expandIcon, context);
+ expandedIcon = RenderKitUtils.getResourceURL(expandedIcon, context);
}
- String collapseIcon = control.getCollapseIcon();
- if (isEmpty(collapseIcon)) {
- collapseIcon =
context.getApplication().getResourceHandler().createResource(DOWN_ICON_URL).getRequestPath();
+ String collapsedIcon = control.getCollapsedIcon();
+ if (isEmpty(collapsedIcon)) {
+ collapsedIcon =
context.getApplication().getResourceHandler().createResource(UP_ICON_URL).getRequestPath();
} else {
- collapseIcon = RenderKitUtils.getResourceURL(collapseIcon, context);
+ collapsedIcon = RenderKitUtils.getResourceURL(collapsedIcon, context);
}
- String image = expanded ? expandIcon : collapseIcon;
+ String image = expanded ? expandedIcon : collapsedIcon;
if (image != null && image.trim().length() > 0) {
writer.startElement(HtmlConstants.IMG_ELEMENT, control);
writer.writeAttribute(HtmlConstants.SRC_ATTRIBUTE, image, null);
@@ -151,7 +151,7 @@
writer.endElement(HtmlConstants.IMG_ELEMENT);
}
- String label = expanded ? control.getExpandLabel() : control.getCollapseLabel();
+ String label = expanded ? control.getExpandedLabel() :
control.getCollapsedLabel();
if (label != null && label.trim().length() > 0) {
writer.startElement(HtmlConstants.A_ELEMENT, control);
writer.writeAttribute(HtmlConstants.HREF_ATTR,
"javascript:void(0);", null);
@@ -168,8 +168,8 @@
HashMap<String, Object> options = new HashMap<String, Object>();
options.put("forId", forId);
- options.put("expandControl", toggleControlId + ":expand");
- options.put("collapseControl", toggleControlId +
":collapse");
+ options.put("expandedControl", toggleControlId +
":expanded");
+ options.put("collapsedControl", toggleControlId +
":collapsed");
String eventName = toggleControl.getEvent();
@@ -202,8 +202,7 @@
return null;
}
- protected String getState(boolean expand) {
- return expand ? EXPAND_STATE : COLLAPSE_STATE;
+ protected String getState(boolean expanded) {
+ return expanded ? EXPANDED_STATE : COLLAPSED_STATE;
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable-toggler.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable-toggler.js 2011-01-28
13:32:20 UTC (rev 21303)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable-toggler.js 2011-01-28
13:33:29 UTC (rev 21304)
@@ -5,8 +5,8 @@
richfaces.ui.CollapsibleSubTableToggler = function(id, options) {
this.id = id;
this.eventName = options.eventName;
- this.expandControl = options.expandControl;
- this.collapseControl = options.collapseControl;
+ this.expandedControl = options.expandedControl;
+ this.collapsedControl = options.collapsedControl;
this.forId = options.forId;
this.element = $(document.getElementById(this.id));
@@ -29,7 +29,7 @@
var mode = subtable.getMode();
if(richfaces.ui.CollapsibleSubTable.MODE_CLNT == mode) {
- this.toggleControl(subtable.isExpand());
+ this.toggleControl(subtable.isExpanded());
}
subtable.setOption(this.id);
@@ -37,21 +37,19 @@
}
},
- toggleControl: function(expanded) {
- var expandControl = getElementById(this.expandControl);
- var collapseControl = getElementById(this.collapseControl);
+ toggleControl: function(collapse) {
+ var expandedControl = getElementById(this.expandedControl);
+ var collapsedControl = getElementById(this.collapsedControl);
- if(expanded) {
- collapseControl.hide();
- expandControl.show();
+ if(collapse) {
+ expandedControl.hide();
+ collapsedControl.show();
} else {
- expandControl.hide();
- collapseControl.show();
+ collapsedControl.hide();
+ expandedControl.show();
}
}
-
};
-
})());
})(jQuery, window.RichFaces);
\ No newline at end of file
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js 2011-01-28
13:32:20 UTC (rev 21303)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/collapsible-subtable.js 2011-01-28
13:33:29 UTC (rev 21304)
@@ -50,7 +50,7 @@
};
var client = function(options) {
- if(this.isExpand()) {
+ if(this.isExpanded()) {
this.collapse(options);
} else {
this.expand(options);
@@ -82,12 +82,12 @@
element.call(this).show();
},
- isExpand: function() {
+ isExpanded: function() {
return (parseInt(this.getState()) == richfaces.ui.CollapsibleSubTable.expand);
},
switchState: function(options) {
- var state = this.isExpand() ? richfaces.ui.CollapsibleSubTable.collapse :
richfaces.ui.CollapsibleSubTable.expand;
+ var state = this.isExpanded() ? richfaces.ui.CollapsibleSubTable.collapse :
richfaces.ui.CollapsibleSubTable.expand;
this.setState(state);
},