JBoss Rich Faces SVN: r12003 - in trunk/framework/impl/src/main/java/org/ajax4jsf: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-12-23 15:04:48 -0500 (Tue, 23 Dec 2008)
New Revision: 12003
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
Log:
https://jira.jboss.org/jira/browse/RF-4432
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-12-23 18:52:44 UTC (rev 12002)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-12-23 20:04:48 UTC (rev 12003)
@@ -540,7 +540,7 @@
.getSubmittedRegionClientId();
boolean invoked = false;
if (submittedRegionClientId != null && !submittedRegionClientId.equals(JS_NULL) && !submittedRegionClientId.equals(getClientId(context))) {
- invoked = invokeOnComponent(context, submittedRegionClientId, new ContextCallbackWrapper(_ajaxInvoker));
+ invoked = invokeOnComponent(context, submittedRegionClientId, _ajaxInvoker);
}
// if container not found, use Root for encode.
// https://jira.jboss.org/jira/browse/RF-3975
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java 2008-12-23 18:52:44 UTC (rev 12002)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java 2008-12-23 20:04:48 UTC (rev 12003)
@@ -29,38 +29,31 @@
/**
* @author Anton Belevich
- *
+ *
*/
public class ContextCallbackWrapper implements ContextCallback {
-
- ContextCallback callback;
-
- public ContextCallbackWrapper(ContextCallback callback) {
- this.callback = callback;
- }
-
- public void invokeContextCallback(FacesContext context, UIComponent target) {
- if(isParentRendered(target)) {
- callback.invokeContextCallback(context, target);
+
+ ContextCallback callback;
+
+ public ContextCallbackWrapper(ContextCallback callback) {
+ this.callback = callback;
}
- }
-
- public boolean isParentRendered( UIComponent target) {
- List <UIComponent> componentsList = new ArrayList<UIComponent>();
- UIComponent component = target;
-
- while (component != null) {
- componentsList.add(component);
- component = component.getParent();
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ if (isParentRendered(target)) {
+ callback.invokeContextCallback(context, target);
+ }
}
-
- for (int i = componentsList.size() - 1; i >= 0; i--) {
- UIComponent processComponent = componentsList.get(i);
- if(!processComponent.isRendered()) {
- return false;
- }
- }
- return true;
- }
+ public boolean isParentRendered(UIComponent target) {
+ UIComponent component = target;
+
+ while (component != null) {
+ if (!component.isRendered()) {
+ return false;
+ }
+ component = component.getParent();
+ }
+ return true;
+ }
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2008-12-23 18:52:44 UTC (rev 12002)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/AjaxContainerRenderer.java 2008-12-23 20:04:48 UTC (rev 12003)
@@ -65,8 +65,7 @@
public static final String AJAX_UPDATE_HEADER = "Ajax-Update-Ids";
- static final Log log = LogFactory
- .getLog(AjaxContainerRenderer.class);
+ static final Log log = LogFactory.getLog(AjaxContainerRenderer.class);
public static final String AJAX_FLAG_HEADER = "Ajax-Response";
@@ -105,7 +104,7 @@
*/
public void encodeAjax(FacesContext context, UIComponent component)
throws IOException {
- UIComponent root ;
+ UIComponent root;
// Iterate over all childrens, render it if nessesary...
log.debug(Messages.getMessage(Messages.RENDER_CHILDREN_AJAX_INFO));
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
@@ -114,19 +113,31 @@
if (((AjaxContainer) component).isRenderRegionOnly()) {
root = component;
} else {
- root = context.getViewRoot();
+ root = context.getViewRoot();
}
String path = AjaxRendererUtils.getAbsoluteId(root);
// if(! (component instanceof NamingContainer)){
path = path.substring(0, path
.lastIndexOf(NamingContainer.SEPARATOR_CHAR) + 1);
- encodeAjaxComponent(context, root, path, ids, renderedAreas);
+ if (isParentRendered(root)) {
+ encodeAjaxComponent(context, root, path, ids, renderedAreas);
+ }
// Write information about encoded areas after submission.
AjaxRendererUtils.encodeAreas(context, component);
}
-
-
+ public boolean isParentRendered(UIComponent target) {
+ UIComponent component = target;
+
+ while (component != null) {
+ if (!component.isRendered()) {
+ return false;
+ }
+ component = component.getParent();
+ }
+ return true;
+ }
+
/*
* always return true, since component must maintain set of rendered
* components.
@@ -140,27 +151,29 @@
/*
* (non-Javadoc)
*
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
+ * @see
+ * org.ajax4jsf.renderkit.RendererBase#doDecode(javax.faces.context.FacesContext
+ * , javax.faces.component.UIComponent)
*/
protected void doDecode(FacesContext context, UIComponent component) {
String clientId = component.getClientId(context);
- Map<String, String> paramMap = context.getExternalContext().getRequestParameterMap();
+ Map<String, String> paramMap = context.getExternalContext()
+ .getRequestParameterMap();
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(
Messages.DECODE_AJAX_REQUEST_STATUS_INFO, clientId));
-// log.debug(Messages.getMessage(Messages.REQUEST_PARAMETERS_MAP,
-// paramMap.toString()));
+ // log.debug(Messages.getMessage(Messages.REQUEST_PARAMETERS_MAP,
+ // paramMap.toString()));
}
Object ajaxParameter = paramMap.get(AJAX_PARAMETER_NAME);
AjaxContainer ajaxContainer = (AjaxContainer) component;
if (null != ajaxParameter && ajaxParameter.equals(clientId)) {
- ajaxContainer.setSubmitted(true);
- if(ajaxContainer.isSelfRendered()){
- AjaxContext.getCurrentInstance(context).setSelfRender(true);
- }
- AjaxEvent event = new AjaxEvent(component);
- component.queueEvent(event);
+ ajaxContainer.setSubmitted(true);
+ if (ajaxContainer.isSelfRendered()) {
+ AjaxContext.getCurrentInstance(context).setSelfRender(true);
+ }
+ AjaxEvent event = new AjaxEvent(component);
+ component.queueEvent(event);
} else {
ajaxContainer.setSubmitted(false);
}
16 years
JBoss Rich Faces SVN: r12002 - trunk/ui/core/src/main/java/org/ajax4jsf/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-12-23 13:52:44 -0500 (Tue, 23 Dec 2008)
New Revision: 12002
Modified:
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java
Log:
https://jira.jboss.org/jira/browse/RF-4553
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2008-12-23 18:36:09 UTC (rev 12001)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIInclude.java 2008-12-23 18:52:44 UTC (rev 12002)
@@ -51,7 +51,7 @@
public static final String LAYOUT_BLOCK ="block";
public static final String LAYOUT_INLINE ="inline";
- private boolean _ajaxRendered = true;
+ private boolean _ajaxRendered = false;
private boolean _ajaxRenderedSet = false;
private boolean wasNavigation = false;
@@ -63,7 +63,7 @@
* @see org.ajax4jsf.framework.ajax.ViewIdHolder#skipNavigation(java.lang.String)
*/
public boolean skipNavigation(String ViewId) {
-// wasNavigation = true;
+ wasNavigation = true;
return true;
}
@@ -126,8 +126,12 @@
public boolean isAjaxRendered() {
Boolean value = null;
- if(!this._ajaxRenderedSet) {
- ValueExpression ve = getValueExpression("ajaxRendered");
+
+ if(this._ajaxRenderedSet) {
+ return this._ajaxRendered;
+ }
+
+ ValueExpression ve = getValueExpression("ajaxRendered");
if (ve != null) {
try {
value = (Boolean) ve.getValue(getFacesContext().getELContext());
@@ -135,10 +139,11 @@
throw new FacesException(e);
}
}
- }
+
if (null == value) {
- value = this._ajaxRendered;
+// value = this._ajaxRendered;
+ value = isWasNavigation();
}
return (!LAYOUT_NONE.equals(getLayout())) && value;
16 years
JBoss Rich Faces SVN: r12001 - trunk/framework/api/src/main/java/org/ajax4jsf/resource/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-23 13:36:09 -0500 (Tue, 23 Dec 2008)
New Revision: 12001
Modified:
trunk/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
Log:
JavaDoc added for urlToStreamSafe() method
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2008-12-23 18:34:51 UTC (rev 12000)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java 2008-12-23 18:36:09 UTC (rev 12001)
@@ -69,6 +69,12 @@
}
}
+ /**
+ * Variant of {@link #urlToStream(URL)} method that doesn't throw IOException, but silently ignores them
+ *
+ * @param url
+ * @return
+ */
public static final InputStream urlToStreamSafe(URL url) {
try {
return urlToStream(url);
16 years
JBoss Rich Faces SVN: r12000 - in trunk/ui: beanValidator/src/main/java/org/richfaces/event and 95 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-12-23 13:34:51 -0500 (Tue, 23 Dec 2008)
New Revision: 12000
Modified:
trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputText.java
trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputTextarea.java
trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationEvent.java
trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationListener.java
trunk/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java
trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java
trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java
trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java
trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java
trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
trunk/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx
trunk/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java
trunk/ui/beanValidator/src/test/java/org/richfaces/validator/UnValidableBean.java
trunk/ui/beanValidator/src/test/java/org/richfaces/validator/ValidableBean.java
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
trunk/ui/combobox/src/main/java/org/richfaces/component/UIComboBox.java
trunk/ui/combobox/src/main/templates/combobox.jspx
trunk/ui/componentControl/src/main/templates/htmlComponentControl.jspx
trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/Lifo.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx
trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx
trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java
trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java
trunk/ui/dataFilterSlider/src/main/templates/dataFilterSlider.jspx
trunk/ui/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/ColumnsIterator.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconConstants.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortAsc.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortDesc.java
trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortNone.java
trunk/ui/dataTable/src/main/templates/org/richfaces/htmlColgroup.jspx
trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataDefinitionList.jspx
trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataGrid.jspx
trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx
trunk/ui/dataTable/src/main/templates/org/richfaces/htmlSubTable.jspx
trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java
trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/DataTableRenderingTest.java
trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/SortableHeaderRenderingTest.java
trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
trunk/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
trunk/ui/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java
trunk/ui/effect/src/main/templates/effect.jspx
trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/html/images/UploadButtonBgLightGradient.java
trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
trunk/ui/gmap/src/main/templates/gmap.jspx
trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx
trunk/ui/inplaceInput/src/main/java/org/richfaces/component/UIInplaceInput.java
trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
trunk/ui/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java
trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx
trunk/ui/insert/src/main/java/org/ajax4jsf/renderkit/AbstractInsertRenderer.java
trunk/ui/insert/src/main/java/org/richfaces/ui/component/DummyHighLight.java
trunk/ui/insert/src/main/java/org/richfaces/ui/component/Highlight.java
trunk/ui/insert/src/main/java/org/richfaces/ui/component/HighlightImpl.java
trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx
trunk/ui/jQuery/src/main/templates/jQuery.jspx
trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx
trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java
trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java
trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
trunk/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListButtonGradient.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListHeaderGradient.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java
trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx
trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
trunk/ui/pickList/src/main/templates/htmlPickList.jspx
trunk/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
trunk/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconSplit.java
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx
trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/model/internal/TestObj.java
trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/JSFComponentTest.java
trunk/ui/separator/src/main/templates/separator.jspx
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
trunk/ui/spacer/src/main/templates/spacer.jspx
trunk/ui/state/src/main/java/org/richfaces/el/StateELResolver.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplication.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplicationFactory.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StateExpressionFactory.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StateMethodExpressionWrapper.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StateNavigationHandler.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StatePropertyResolver.java
trunk/ui/state/src/main/java/org/richfaces/ui/application/StateResolver.java
trunk/ui/state/src/main/java/org/richfaces/ui/model/State.java
trunk/ui/state/src/main/java/org/richfaces/ui/model/StateImpl.java
trunk/ui/state/src/main/java/org/richfaces/ui/model/States.java
trunk/ui/state/src/main/templates/org/richfaces/ui/htmlState.jspx
trunk/ui/state/src/main/templates/org/richfaces/ui/htmlStates.jspx
trunk/ui/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/templates/table.jspx
trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabClassBuilder.java
trunk/ui/tabPanel/src/main/templates/tab.jspx
trunk/ui/tabPanel/src/main/templates/tabHeader.jspx
trunk/ui/tabPanel/src/main/templates/tabPanel.jspx
trunk/ui/togglePanel/src/main/java/org/richfaces/component/UIToggleControl.java
trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
trunk/ui/togglePanel/src/main/templates/toggleControl.jspx
trunk/ui/togglePanel/src/main/templates/togglePanel.jspx
trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java
trunk/ui/tooltip/src/main/java/org/richfaces/taglib/ToolTipTagHandlerBase.java
trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
trunk/ui/tree/src/main/templates/htmlTree.jspx
trunk/ui/tree/src/main/templates/htmlTreeNode.jspx
trunk/ui/tree/src/test/java/org/richfaces/component/TreeNodeTest.java
trunk/ui/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java
trunk/ui/treeModel/src/test/java/org/richfaces/component/TreeModelComponentTest.java
trunk/ui/virtualEarth/src/main/templates/virtualEarth.jspx
Log:
https://jira.jboss.org/jira/browse/RF-5104
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputText.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputText.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputText.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,98 +1,98 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.html;
-
-import java.util.List;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-
-import org.richfaces.validator.FacesBeanValidator;
-
-/**
- * @author asmirnov
- *
- */
-public class HtmlInputText extends javax.faces.component.html.HtmlInputText {
-
- @Override
- protected void validateValue(FacesContext context, Object newValue) {
- // If our value is valid, enforce the required property if present
- if (isValid() && isRequired() && isEmpty(newValue)) {
- super.validateValue(context, newValue);
- }
- // If our value is valid and not empty, call all validators
- if (isValid()) {
- Validator[] validators = this.getValidators();
- if (validators != null) {
- for (Validator validator : validators) {
- try {
- if (validator instanceof FacesBeanValidator
- || !isEmpty(newValue)) {
- validator.validate(context, this, newValue);
- }
- } catch (ValidatorException ve) {
- // If the validator throws an exception, we're
- // invalid, and we need to add a message
- setValid(false);
- FacesMessage message;
- String validatorMessageString = getValidatorMessage();
-
- if (null != validatorMessageString) {
- message = new FacesMessage(
- FacesMessage.SEVERITY_ERROR,
- validatorMessageString,
- validatorMessageString);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- } else {
- message = ve.getFacesMessage();
- }
- if (message != null) {
- context.addMessage(getClientId(context), message);
- }
- }
- }
- }
- }
-
- }
-
- private static boolean isEmpty(Object value) {
-
- if (value == null) {
- return (true);
- } else if ((value instanceof String) && (((String) value).length() < 1)) {
- return (true);
- } else if (value.getClass().isArray()) {
- if (0 == java.lang.reflect.Array.getLength(value)) {
- return (true);
- }
- } else if (value instanceof List) {
- if (((List) value).isEmpty()) {
- return (true);
- }
- }
- return (false);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.html;
+
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.richfaces.validator.FacesBeanValidator;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class HtmlInputText extends javax.faces.component.html.HtmlInputText {
+
+ @Override
+ protected void validateValue(FacesContext context, Object newValue) {
+ // If our value is valid, enforce the required property if present
+ if (isValid() && isRequired() && isEmpty(newValue)) {
+ super.validateValue(context, newValue);
+ }
+ // If our value is valid and not empty, call all validators
+ if (isValid()) {
+ Validator[] validators = this.getValidators();
+ if (validators != null) {
+ for (Validator validator : validators) {
+ try {
+ if (validator instanceof FacesBeanValidator
+ || !isEmpty(newValue)) {
+ validator.validate(context, this, newValue);
+ }
+ } catch (ValidatorException ve) {
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message;
+ String validatorMessageString = getValidatorMessage();
+
+ if (null != validatorMessageString) {
+ message = new FacesMessage(
+ FacesMessage.SEVERITY_ERROR,
+ validatorMessageString,
+ validatorMessageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ } else {
+ message = ve.getFacesMessage();
+ }
+ if (message != null) {
+ context.addMessage(getClientId(context), message);
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private static boolean isEmpty(Object value) {
+
+ if (value == null) {
+ return (true);
+ } else if ((value instanceof String) && (((String) value).length() < 1)) {
+ return (true);
+ } else if (value.getClass().isArray()) {
+ if (0 == java.lang.reflect.Array.getLength(value)) {
+ return (true);
+ }
+ } else if (value instanceof List) {
+ if (((List) value).isEmpty()) {
+ return (true);
+ }
+ }
+ return (false);
+ }
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputTextarea.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputTextarea.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/component/html/HtmlInputTextarea.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,98 +1,98 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.html;
-
-import java.util.List;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-
-import org.richfaces.validator.FacesBeanValidator;
-
-/**
- * @author asmirnov
- *
- */
-public class HtmlInputTextarea extends javax.faces.component.html.HtmlInputTextarea {
-
- @Override
- protected void validateValue(FacesContext context, Object newValue) {
- // If our value is valid, enforce the required property if present
- if (isValid() && isRequired() && isEmpty(newValue)) {
- super.validateValue(context, newValue);
- }
- // If our value is valid and not empty, call all validators
- if (isValid()) {
- Validator[] validators = this.getValidators();
- if (validators != null) {
- for (Validator validator : validators) {
- try {
- if (validator instanceof FacesBeanValidator
- || !isEmpty(newValue)) {
- validator.validate(context, this, newValue);
- }
- } catch (ValidatorException ve) {
- // If the validator throws an exception, we're
- // invalid, and we need to add a message
- setValid(false);
- FacesMessage message;
- String validatorMessageString = getValidatorMessage();
-
- if (null != validatorMessageString) {
- message = new FacesMessage(
- FacesMessage.SEVERITY_ERROR,
- validatorMessageString,
- validatorMessageString);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- } else {
- message = ve.getFacesMessage();
- }
- if (message != null) {
- context.addMessage(getClientId(context), message);
- }
- }
- }
- }
- }
-
- }
-
- private static boolean isEmpty(Object value) {
-
- if (value == null) {
- return (true);
- } else if ((value instanceof String) && (((String) value).length() < 1)) {
- return (true);
- } else if (value.getClass().isArray()) {
- if (0 == java.lang.reflect.Array.getLength(value)) {
- return (true);
- }
- } else if (value instanceof List) {
- if (((List) value).isEmpty()) {
- return (true);
- }
- }
- return (false);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.html;
+
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.richfaces.validator.FacesBeanValidator;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class HtmlInputTextarea extends javax.faces.component.html.HtmlInputTextarea {
+
+ @Override
+ protected void validateValue(FacesContext context, Object newValue) {
+ // If our value is valid, enforce the required property if present
+ if (isValid() && isRequired() && isEmpty(newValue)) {
+ super.validateValue(context, newValue);
+ }
+ // If our value is valid and not empty, call all validators
+ if (isValid()) {
+ Validator[] validators = this.getValidators();
+ if (validators != null) {
+ for (Validator validator : validators) {
+ try {
+ if (validator instanceof FacesBeanValidator
+ || !isEmpty(newValue)) {
+ validator.validate(context, this, newValue);
+ }
+ } catch (ValidatorException ve) {
+ // If the validator throws an exception, we're
+ // invalid, and we need to add a message
+ setValid(false);
+ FacesMessage message;
+ String validatorMessageString = getValidatorMessage();
+
+ if (null != validatorMessageString) {
+ message = new FacesMessage(
+ FacesMessage.SEVERITY_ERROR,
+ validatorMessageString,
+ validatorMessageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ } else {
+ message = ve.getFacesMessage();
+ }
+ if (message != null) {
+ context.addMessage(getClientId(context), message);
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private static boolean isEmpty(Object value) {
+
+ if (value == null) {
+ return (true);
+ } else if ((value instanceof String) && (((String) value).length() < 1)) {
+ return (true);
+ } else if (value.getClass().isArray()) {
+ if (0 == java.lang.reflect.Array.getLength(value)) {
+ return (true);
+ }
+ } else if (value instanceof List) {
+ if (((List) value).isEmpty()) {
+ return (true);
+ }
+ }
+ return (false);
+ }
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationEvent.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationEvent.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationEvent.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,68 +1,68 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-
-/**
- * @author asmirnov
- *
- */
-public class ValidationEvent extends FacesEvent {
-
- /**
- *
- */
- private static final long serialVersionUID = 5593837134704144777L;
-
- public ValidationEvent(UIComponent component) {
- super(component);
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- @Override
- public boolean isAppropriateListener(FacesListener listener) {
- // TODO Auto-generated method stub
- return listener instanceof ValidationListener;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- @Override
- public void processListener(FacesListener listener) {
- if (listener instanceof ValidationListener) {
- ValidationListener validationListener = (ValidationListener) listener;
- validationListener.processValidation(this);
- }
-
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ValidationEvent extends FacesEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5593837134704144777L;
+
+ public ValidationEvent(UIComponent component) {
+ super(component);
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ // TODO Auto-generated method stub
+ return listener instanceof ValidationListener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ if (listener instanceof ValidationListener) {
+ ValidationListener validationListener = (ValidationListener) listener;
+ validationListener.processValidation(this);
+ }
+
+ }
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationListener.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationListener.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/event/ValidationListener.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,34 +1,34 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.event;
-
-import javax.faces.event.FacesListener;
-
-
-/**
- * @author asmirnov
- *
- */
-public interface ValidationListener extends FacesListener {
-
- public void processValidation(ValidationEvent event);
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.event;
+
+import javax.faces.event.FacesListener;
+
+
+/**
+ * @author asmirnov
+ *
+ */
+public interface ValidationListener extends FacesListener {
+
+ public void processValidation(ValidationEvent event);
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -106,5 +106,5 @@
return org.richfaces.component.UIBeanValidator.class;
}
-
-}
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,118 +1,118 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.taglib;
-
-import java.io.IOException;
-
-import javax.el.ELException;
-import javax.faces.FacesException;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
-import org.richfaces.component.UIBeanValidator;
-import org.richfaces.validator.FacesBeanValidator;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.FaceletException;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagException;
-import com.sun.facelets.tag.TagHandler;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-
-/**
- * @author asmirnov
- *
- */
-public class AjaxValidatorHandler extends TagHandler {
-
- /**
- * A UIComponent for capturing a child UIComponent, representative of the
- * desired Facet
- *
- * @author Jacob Hookom
- *
- */
- private final static class UIFacet extends UIComponentBase {
- public String getFamily() {
- return null;
- }
- }
-
- private TagAttribute _event;
- private TagAttribute _summary;
- private AjaxComponentHandler _validatorHandler;
-
- /**
- * @param config
- */
- public AjaxValidatorHandler(ComponentConfig config) {
- super(config);
- _event = getAttribute("event");
- _summary = getAttribute("summary");
- _validatorHandler = new AjaxComponentHandler(config);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
- * javax.faces.component.UIComponent)
- */
- public void apply(FaceletContext ctx, UIComponent parent)
- throws IOException, FacesException, FaceletException, ELException {
- if (parent == null || !(parent instanceof EditableValueHolder)) {
- throw new TagException(this.tag,
- "Parent not an instance of EditableValueHolder: " + parent);
- }
- if (null == parent.getParent()) {
- // New created component, add validator.
- FacesContext facesContext = FacesContext.getCurrentInstance();
- FacesBeanValidator validator = (FacesBeanValidator) facesContext
- .getApplication().createValidator(
- FacesBeanValidator.BEAN_VALIDATOR_TYPE);
- if (null != _summary) {
- validator.setSummary(_summary.getValueExpression(ctx, String.class));
- }
- ((EditableValueHolder) parent).addValidator(validator);
- }
- if (null != this._event) {
- UIComponent c;
- UIFacet facet = new UIFacet();
- // Find facet for client validation component
- String eventName = _event.getValue();
- String facetName = UIBeanValidator.BEAN_VALIDATOR_FACET + eventName;
- c = parent.getFacet(facetName);
- if (null != c) {
- parent.getFacets().remove(facetName);
- facet.getChildren().add(c);
- }
- this._validatorHandler.apply(ctx, facet);
- c = (UIComponent) facet.getChildren().get(0);
- parent.getFacets().put(facetName, c);
-
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.taglib;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
+import org.richfaces.component.UIBeanValidator;
+import org.richfaces.validator.FacesBeanValidator;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagException;
+import com.sun.facelets.tag.TagHandler;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class AjaxValidatorHandler extends TagHandler {
+
+ /**
+ * A UIComponent for capturing a child UIComponent, representative of the
+ * desired Facet
+ *
+ * @author Jacob Hookom
+ *
+ */
+ private final static class UIFacet extends UIComponentBase {
+ public String getFamily() {
+ return null;
+ }
+ }
+
+ private TagAttribute _event;
+ private TagAttribute _summary;
+ private AjaxComponentHandler _validatorHandler;
+
+ /**
+ * @param config
+ */
+ public AjaxValidatorHandler(ComponentConfig config) {
+ super(config);
+ _event = getAttribute("event");
+ _summary = getAttribute("summary");
+ _validatorHandler = new AjaxComponentHandler(config);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
+ * javax.faces.component.UIComponent)
+ */
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ if (parent == null || !(parent instanceof EditableValueHolder)) {
+ throw new TagException(this.tag,
+ "Parent not an instance of EditableValueHolder: " + parent);
+ }
+ if (null == parent.getParent()) {
+ // New created component, add validator.
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ FacesBeanValidator validator = (FacesBeanValidator) facesContext
+ .getApplication().createValidator(
+ FacesBeanValidator.BEAN_VALIDATOR_TYPE);
+ if (null != _summary) {
+ validator.setSummary(_summary.getValueExpression(ctx, String.class));
+ }
+ ((EditableValueHolder) parent).addValidator(validator);
+ }
+ if (null != this._event) {
+ UIComponent c;
+ UIFacet facet = new UIFacet();
+ // Find facet for client validation component
+ String eventName = _event.getValue();
+ String facetName = UIBeanValidator.BEAN_VALIDATOR_FACET + eventName;
+ c = parent.getFacet(facetName);
+ if (null != c) {
+ parent.getFacets().remove(facetName);
+ facet.getChildren().add(c);
+ }
+ this._validatorHandler.apply(ctx, facet);
+ c = (UIComponent) facet.getChildren().get(0);
+ parent.getFacets().put(facetName, c);
+
+ }
+ }
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,137 +1,137 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.taglib;
-
-import javax.el.ValueExpression;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.webapp.UIComponentClassicTagBase;
-import javax.servlet.jsp.JspException;
-
-import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-import org.richfaces.component.UIBeanValidator;
-import org.richfaces.renderkit.html.BeanValidatorRenderer;
-import org.richfaces.validator.FacesBeanValidator;
-
-/**
- * @author asmirnov
- *
- */
-public class AjaxValidatorTagBase extends UIComponentTagBase {
-
- /**
- * Generate script for given event ( onclick, onenter ... )
- */
- private String event = null;
-
- private ValueExpression summary = null;
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTagBase#getComponentType()
- */
- @Override
- public String getComponentType() {
- return UIBeanValidator.COMPONENT_TYPE;
- }
-
- /**
- * @param event
- * the event to set
- */
- public void setEvent(String event) {
- this.event = event;
- }
-
- /**
- * @param summary
- * the summary to set
- */
- public void setSummary(ValueExpression summary) {
- this.summary = summary;
- }
-
- @Override
- public int doStartTag() throws JspException {
- // Locate our parent UIComponentTag
- UIComponentClassicTagBase tag = UIComponentClassicTagBase
- .getParentUIComponentClassicTagBase(pageContext);
- if (tag == null) {
- // PENDING i18n
- throw new JspException(
- "Not nested in a UIComponentTag Error for tag with handler class:"
- + this.getClass().getName());
- }
- UIComponent component = tag.getComponentInstance();
- if (!(component instanceof EditableValueHolder)) {
- // PENDING i18n
- throw new JspException(
- "Not nested in a UIInput component. Error for tag with handler class:"
- + this.getClass().getName());
-
- }
- // Nothing to do unless this tag created a component
- if (tag.getCreated()) {
- // New created component, add validator.
- FacesContext facesContext = FacesContext.getCurrentInstance();
- FacesBeanValidator validator = (FacesBeanValidator) facesContext
- .getApplication().createValidator(
- FacesBeanValidator.BEAN_VALIDATOR_TYPE);
- if (null != summary) {
- validator.setSummary(summary);
- }
- ((EditableValueHolder) component).addValidator(validator);
-
- }
- return super.doStartTag();
- }
-
- @Override
- protected void setProperties(UIComponent component) {
- super.setProperties(component);
- setStringProperty(component, "event", event);
- }
-
- @Override
- public void release() {
- super.release();
- event = null;
- summary = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see javax.faces.webapp.UIComponentTagBase#getRendererType()
- */
- @Override
- public String getRendererType() {
- return BeanValidatorRenderer.RENDERER_TYPE;
- }
-
- @Override
- protected String getFacetName() {
- return UIBeanValidator.BEAN_VALIDATOR_FACET
- + (null == event ? "" : event);
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.taglib;
+
+import javax.el.ValueExpression;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.webapp.UIComponentClassicTagBase;
+import javax.servlet.jsp.JspException;
+
+import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
+import org.richfaces.component.UIBeanValidator;
+import org.richfaces.renderkit.html.BeanValidatorRenderer;
+import org.richfaces.validator.FacesBeanValidator;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class AjaxValidatorTagBase extends UIComponentTagBase {
+
+ /**
+ * Generate script for given event ( onclick, onenter ... )
+ */
+ private String event = null;
+
+ private ValueExpression summary = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTagBase#getComponentType()
+ */
+ @Override
+ public String getComponentType() {
+ return UIBeanValidator.COMPONENT_TYPE;
+ }
+
+ /**
+ * @param event
+ * the event to set
+ */
+ public void setEvent(String event) {
+ this.event = event;
+ }
+
+ /**
+ * @param summary
+ * the summary to set
+ */
+ public void setSummary(ValueExpression summary) {
+ this.summary = summary;
+ }
+
+ @Override
+ public int doStartTag() throws JspException {
+ // Locate our parent UIComponentTag
+ UIComponentClassicTagBase tag = UIComponentClassicTagBase
+ .getParentUIComponentClassicTagBase(pageContext);
+ if (tag == null) {
+ // PENDING i18n
+ throw new JspException(
+ "Not nested in a UIComponentTag Error for tag with handler class:"
+ + this.getClass().getName());
+ }
+ UIComponent component = tag.getComponentInstance();
+ if (!(component instanceof EditableValueHolder)) {
+ // PENDING i18n
+ throw new JspException(
+ "Not nested in a UIInput component. Error for tag with handler class:"
+ + this.getClass().getName());
+
+ }
+ // Nothing to do unless this tag created a component
+ if (tag.getCreated()) {
+ // New created component, add validator.
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ FacesBeanValidator validator = (FacesBeanValidator) facesContext
+ .getApplication().createValidator(
+ FacesBeanValidator.BEAN_VALIDATOR_TYPE);
+ if (null != summary) {
+ validator.setSummary(summary);
+ }
+ ((EditableValueHolder) component).addValidator(validator);
+
+ }
+ return super.doStartTag();
+ }
+
+ @Override
+ protected void setProperties(UIComponent component) {
+ super.setProperties(component);
+ setStringProperty(component, "event", event);
+ }
+
+ @Override
+ public void release() {
+ super.release();
+ event = null;
+ summary = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.webapp.UIComponentTagBase#getRendererType()
+ */
+ @Override
+ public String getRendererType() {
+ return BeanValidatorRenderer.RENDERER_TYPE;
+ }
+
+ @Override
+ protected String getFacetName() {
+ return UIBeanValidator.BEAN_VALIDATOR_FACET
+ + (null == event ? "" : event);
+ }
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,61 +1,61 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.taglib;
-
-import javax.faces.validator.Validator;
-
-import org.richfaces.validator.FacesBeanValidator;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.TagConfig;
-import com.sun.facelets.tag.jsf.ValidateHandler;
-import com.sun.facelets.tag.jsf.ValidatorConfig;
-
-/**
- * @author asmirnov
- *
- */
-public class BeanValidatorHandler extends ValidateHandler {
-
- private TagAttribute _summary;
-
- /**
- * @param config
- */
- public BeanValidatorHandler(TagConfig config) {
- super(config);
- _summary = getAttribute("summary");
- }
-
- @Override
- protected Validator createValidator(FaceletContext ctx) {
- FacesBeanValidator validator = (FacesBeanValidator) ctx.getFacesContext()
- .getApplication().createValidator(
- FacesBeanValidator.BEAN_VALIDATOR_TYPE);
- if (null != _summary) {
- validator
- .setSummary(_summary.getValueExpression(ctx, String.class));
- }
- return validator;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.taglib;
+
+import javax.faces.validator.Validator;
+
+import org.richfaces.validator.FacesBeanValidator;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.tag.jsf.ValidateHandler;
+import com.sun.facelets.tag.jsf.ValidatorConfig;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class BeanValidatorHandler extends ValidateHandler {
+
+ private TagAttribute _summary;
+
+ /**
+ * @param config
+ */
+ public BeanValidatorHandler(TagConfig config) {
+ super(config);
+ _summary = getAttribute("summary");
+ }
+
+ @Override
+ protected Validator createValidator(FaceletContext ctx) {
+ FacesBeanValidator validator = (FacesBeanValidator) ctx.getFacesContext()
+ .getApplication().createValidator(
+ FacesBeanValidator.BEAN_VALIDATOR_TYPE);
+ if (null != _summary) {
+ validator
+ .setSummary(_summary.getValueExpression(ctx, String.class));
+ }
+ return validator;
+ }
+
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,113 +1,113 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.taglib;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.servlet.jsp.JspException;
-
-import org.richfaces.validator.BeanValidator;
-import org.richfaces.validator.FacesBeanValidator;
-
-public class BeanValidatorTag extends javax.faces.webapp.ValidatorELTag {
-
- /**
- *
- */
- private static final long serialVersionUID = -5230299574915210593L;
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.taglib;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.servlet.jsp.JspException;
+
+import org.richfaces.validator.BeanValidator;
+import org.richfaces.validator.FacesBeanValidator;
+
+public class BeanValidatorTag extends javax.faces.webapp.ValidatorELTag {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5230299574915210593L;
// Fields
-
- /*
- * summary Summary message for a validation errors.
- */
- private ValueExpression _summary;
-
- /**
- * <p>The {@link javax.el.ValueExpression} that evaluates to an object that
- * implements {@link BeanValidator}.</p>
- */
- private ValueExpression binding = null;
-
- /**
- * Summary message for a validation errors. Setter for summary
- *
- * @param summary
- * - new value
- */
- public void setSummary(ValueExpression __summary) {
- this._summary = __summary;
- }
-
- /**
- * <p>Set the expression that will be used to create a
- * {@link javax.el.ValueExpression} that references a backing bean property
- * of the {@link BeanValidator} instance to be created.</p>
- *
- * @param binding The new expression
- */
- public void setBinding(ValueExpression binding) {
- this.binding = binding;
- }
-
- protected Validator createValidator() throws JspException {
- ValueExpression ve = this.binding;
-
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- FacesBeanValidator validator = null;
-
- try {
- ELContext elContext = facesContext.getELContext();
- if (ve != null) {
- validator = (FacesBeanValidator) ve.getValue(elContext);
- }
-
- if (validator == null) {
- validator = (FacesBeanValidator) FacesContext
- .getCurrentInstance().getApplication().createValidator(
- "org.richfaces.BeanValidator");
-
- if (ve != null && validator != null) {
- ve.setValue(elContext, validator);
- }
- }
- } catch (Exception e) {
- throw new FacesException(e);
- }
-
- _setProperties(validator);
-
- return validator;
- }
-
- // Support method to wire in properties
- private void _setProperties(FacesBeanValidator validator)
- throws JspException {
- if (_summary != null) {
- if (_summary instanceof ValueExpression) {
- validator.setSummary(_summary);
- }
- }
- }
-}
+
+ /*
+ * summary Summary message for a validation errors.
+ */
+ private ValueExpression _summary;
+
+ /**
+ * <p>The {@link javax.el.ValueExpression} that evaluates to an object that
+ * implements {@link BeanValidator}.</p>
+ */
+ private ValueExpression binding = null;
+
+ /**
+ * Summary message for a validation errors. Setter for summary
+ *
+ * @param summary
+ * - new value
+ */
+ public void setSummary(ValueExpression __summary) {
+ this._summary = __summary;
+ }
+
+ /**
+ * <p>Set the expression that will be used to create a
+ * {@link javax.el.ValueExpression} that references a backing bean property
+ * of the {@link BeanValidator} instance to be created.</p>
+ *
+ * @param binding The new expression
+ */
+ public void setBinding(ValueExpression binding) {
+ this.binding = binding;
+ }
+
+ protected Validator createValidator() throws JspException {
+ ValueExpression ve = this.binding;
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ FacesBeanValidator validator = null;
+
+ try {
+ ELContext elContext = facesContext.getELContext();
+ if (ve != null) {
+ validator = (FacesBeanValidator) ve.getValue(elContext);
+ }
+
+ if (validator == null) {
+ validator = (FacesBeanValidator) FacesContext
+ .getCurrentInstance().getApplication().createValidator(
+ "org.richfaces.BeanValidator");
+
+ if (ve != null && validator != null) {
+ ve.setValue(elContext, validator);
+ }
+ }
+ } catch (Exception e) {
+ throw new FacesException(e);
+ }
+
+ _setProperties(validator);
+
+ return validator;
+ }
+
+ // Support method to wire in properties
+ private void _setProperties(FacesBeanValidator validator)
+ throws JspException {
+ if (_summary != null) {
+ if (_summary instanceof ValueExpression) {
+ validator.setSummary(_summary);
+ }
+ }
+ }
+}
Modified: trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
===================================================================
--- trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,508 +1,508 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.validator;
-
-import java.beans.FeatureDescriptor;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.ELResolver;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.el.ELContextWrapper;
-import org.hibernate.validator.ClassValidator;
-import org.hibernate.validator.InvalidValue;
-
-/**
- * Perform validation by Hibernate Validator annotations
- *
- * @author asmirnov
- *
- */
-public class BeanValidator {
-
- private static final String RESOURCE_BUNDLE_IS_NOT_REGISTERED_FOR_CURRENT_LOCALE = "Resource bundle is not registered for current locale";
-
- private static final String FACES_CONTEXT_IS_NULL = "Faces context is null";
-
- private static final String INPUT_PARAMETERS_IS_NOT_CORRECT = "Input parameters is not correct.";
-
- private static final String LOCALE_IS_NOT_SET = "Locale is not set";
-
- private static final String VIEW_ROOT_IS_NOT_INITIALIZED = "ViewRoot is not initialized";
-
- public static final String VALIDATOR_PARAM = BeanValidator.class.getName();
-
- private Map<ValidatorKey, ClassValidator<? extends Object>> classValidators = new ConcurrentHashMap<ValidatorKey, ClassValidator<? extends Object>>();
-
- private BeanValidator() {
- // This is a "singleton"-like class. Only factory methods allowed.
- }
-
- /**
- * Create BeanValidator instance. For a Junit tests only.
- *
- * @return
- */
- static BeanValidator createInstance() {
- // TODO - get instance class name from a "META-INF/service"
- // If the Seam framework is active, use org.jboss.seam.core.Validators
- // component should be used.
- return new BeanValidator();
- }
-
- private static final Object MUTEX = new Object();
-
- /**
- * Return BeanValidator object from a ServletContext attribute. Create new
- * instance if none is defined.
- *
- * @param context
- * @return
- */
- public static BeanValidator getInstance(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- externalContext.getContext();
- BeanValidator instance;
- // TODO - use properly synchronization mutex ?
- synchronized (MUTEX) {
- Map<String, Object> applicationMap = externalContext
- .getApplicationMap();
- instance = (BeanValidator) applicationMap.get(VALIDATOR_PARAM);
- if (null == instance) {
- // Vaildator not initialized - create and store new instance.
- instance = createInstance();
- applicationMap.put(VALIDATOR_PARAM, instance);
- }
- }
- return instance;
- }
-
- /**
- * Perform Validation for a new value.
- *
- * @param context
- * current faces context.
- * @param target
- * {@link ValueExpression} for a value assignment.
- * @param value
- * new value for validation
- * @return null if no validation errors. Array of the validation messages
- * otherwise.
- * @throws FacesException
- * if locale or context not properly initialized
- */
- public String[] validate(FacesContext context, ValueExpression target,
- Object value) {
- // TODO - check null parameters.
- if (null == context) {
- throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
- }
- String[] validationMessages = null;
- if (null != target) {
- ELContext elContext = context.getELContext();
- ValidationResolver validationResolver = new ValidationResolver(
- elContext.getELResolver(), calculateLocale(context));
- ELContextWrapper wrappedElContext = new ELContextWrapper(elContext,
- validationResolver);
- // TODO - handle ELExceptions ?
- try {
- target.setValue(wrappedElContext, value);
- } catch (ELException e) {
- throw new FacesException(e);
- }
- if (!validationResolver.isValid()) {
- validationMessages = validationResolver.getValidationMessages();
- }
-
- }
- return validationMessages;
- }
-
- protected Locale calculateLocale(FacesContext context) {
- if (null == context.getViewRoot()) {
- throw new FacesException(VIEW_ROOT_IS_NOT_INITIALIZED);
- } else if (null == context.getViewRoot().getLocale()) {
- throw new FacesException(LOCALE_IS_NOT_SET);
- }
- Locale locale = context.getViewRoot().getLocale();
- return locale;
- }
-
- // Method for checking input parameters for prevent NPE
- private void checkInputParameters(FacesContext context,
- ValueExpression target) {
- if (null == context || null == target ) {
- throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
- }
- }
-
- /**
- * Validate bean property for a new value. TODO - localization ?
- *
- * @param base
- * - bean
- * @param property
- * - bean property name.
- * @param value
- * new value.
- * @return null for a valid value, array of the validation messages
- * othervise.
- */
- public String[] validate(Object base, String property, Object value,
- Locale locale) {
- InvalidValue[] invalidValues = validateBean(base, property, value,
- locale);
- if (null == invalidValues) {
- return null;
- } else {
- String[] result = new String[invalidValues.length];
- for (int i = 0; i < invalidValues.length; i++) {
- InvalidValue invalidValue = invalidValues[i];
- result[i] = invalidValue.getMessage();
- }
- return result;
- }
- }
-
- @SuppressWarnings("unchecked")
- public String[] validateGraph(FacesContext context, Object value,
- Set<String> profiles) {
- if (null == context) {
- throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
- }
- String validationMessages[] = null;
- if (null != value) {
- ClassValidator<Object> validator = (ClassValidator<Object>) getValidator(
- value.getClass(), calculateLocale(context));
- if (validator.hasValidationRules()) {
- InvalidValue[] invalidValues = validator
- .getInvalidValues(value);
- if (null != invalidValues && invalidValues.length > 0) {
- validationMessages = new String[invalidValues.length];
- for (int i = 0; i < invalidValues.length; i++) {
- InvalidValue invalidValue = invalidValues[i];
- validationMessages[i] = invalidValue.getMessage();
- }
- }
- }
-
- }
- return validationMessages;
- }
-
- /**
- * Validate bean property of the base object aganist new value
- *
- * @param base
- * @param property
- * @param value
- * @return
- */
- protected InvalidValue[] validateBean(Object base, String property,
- Object value, Locale locale) {
- Class<? extends Object> beanClass = base.getClass();
- InvalidValue[] invalidValues = validateClass(beanClass, property,
- value, locale);
- return invalidValues;
- }
-
- /**
- * Validate bean property in the base class aganist new value.
- *
- * @param beanClass
- * @param property
- * @param value
- * @return
- */
- protected InvalidValue[] validateClass(Class<? extends Object> beanClass,
- String property, Object value, Locale locale) {
- ClassValidator<? extends Object> classValidator = getValidator(
- beanClass, locale);
- InvalidValue[] invalidValues = classValidator
- .getPotentialInvalidValues(property, value);
- return invalidValues;
- }
-
- /**
- * Get ( or create ) {@link ClassValidator} for a given bean class.
- *
- * @param beanClass
- * @return
- */
- @SuppressWarnings("unchecked")
- protected ClassValidator<? extends Object> getValidator(
- Class<? extends Object> beanClass, Locale locale) {
- // TODO - localization support.
- ValidatorKey key = new ValidatorKey(beanClass, locale);
- ClassValidator result = classValidators.get(key);
- if (null == result) {
- result = createValidator(beanClass, locale);
- classValidators.put(key, result);
- }
- return result;
- }
-
- /*
- * This method determine ResourceBundle, used in current request @param
- * locale - user locale @return ResourceBundle instance
- */
- private ResourceBundle getCurrentResourceBundle(Locale locale) {
- if (null == FacesContext.getCurrentInstance()
- || null == FacesContext.getCurrentInstance().getApplication()) {
- throw new FacesException(FACES_CONTEXT_IS_NULL);
- }
- String appBundle = FacesContext.getCurrentInstance().getApplication()
- .getMessageBundle();
- if (null == appBundle || null == locale) {
- return null;
- }
-
- ResourceBundle bundle;
-
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- if (classLoader != null) {
- bundle = ResourceBundle.getBundle(appBundle, locale, classLoader);
- } else {
- bundle = ResourceBundle.getBundle(appBundle, locale);
- }
-
- return bundle;
- }
-
- /*
- * Method for create new instance of ClassValidator, if same not in cache.
- *
- * @param beanClass - Class to validate @param locale - user Locale, used
- * during validation process @return ClassValidator instance
- */
- @SuppressWarnings("unchecked")
- private ClassValidator<? extends Object> createValidator(
- Class<? extends Object> beanClass, Locale locale) {
- ResourceBundle bundle = getCurrentResourceBundle(locale);
- return bundle == null ? new ClassValidator(beanClass)
- : new ClassValidator(beanClass, bundle);
- }
-
- /**
- * Wrapper class for a {@link ELResolver}. For a setValue method, perform
- * validation instead of real assignment.
- *
- * @author asmirnov
- *
- */
- final class ValidationResolver extends ELResolver {
-
- /**
- * Original resolver.
- */
- private final ELResolver parent;
-
- private boolean valid = true;
-
- private String[] validationMessages = null;
-
- private Locale locale = null;
-
- /**
- * @param parent
- */
- public ValidationResolver(ELResolver parent, Locale locale) {
- this.parent = parent;
- this.locale = locale;
- }
-
- public boolean isValid() {
- // TODO Auto-generated method stub
- return valid;
- }
-
- /**
- * @param context
- * @param base
- * @return
- * @see javax.el.ELResolver#getCommonPropertyType(javax.el.ELContext,
- * java.lang.Object)
- */
- public Class<?> getCommonPropertyType(ELContext context, Object base) {
- return parent.getCommonPropertyType(context, base);
- }
-
- /**
- * @param context
- * @param base
- * @return
- * @see javax.el.ELResolver#getFeatureDescriptors(javax.el.ELContext,
- * java.lang.Object)
- */
- public Iterator<FeatureDescriptor> getFeatureDescriptors(
- ELContext context, Object base) {
- return parent.getFeatureDescriptors(context, base);
- }
-
- /**
- * @param context
- * @param base
- * @param property
- * @return
- * @see javax.el.ELResolver#getType(javax.el.ELContext,
- * java.lang.Object, java.lang.Object)
- */
- public Class<?> getType(ELContext context, Object base, Object property) {
- return parent.getType(context, base, property);
- }
-
- /**
- * @param context
- * @param base
- * @param property
- * @return
- * @see javax.el.ELResolver#getValue(javax.el.ELContext,
- * java.lang.Object, java.lang.Object)
- */
- public Object getValue(ELContext context, Object base, Object property) {
- return parent.getValue(context, base, property);
- }
-
- /**
- * @param context
- * @param base
- * @param property
- * @return
- * @see javax.el.ELResolver#isReadOnly(javax.el.ELContext,
- * java.lang.Object, java.lang.Object)
- */
- public boolean isReadOnly(ELContext context, Object base,
- Object property) {
- return parent.isReadOnly(context, base, property);
- }
-
- /**
- * @param context
- * @param base
- * @param property
- * @param value
- * @see javax.el.ELResolver#setValue(javax.el.ELContext,
- * java.lang.Object, java.lang.Object, java.lang.Object)
- */
- public void setValue(ELContext context, Object base, Object property,
- Object value) {
- if (null != base && null != property) {
- context.setPropertyResolved(true);
- //https://jira.jboss.org/jira/browse/RF-4034
- //apache el looses locale information during value resolution,
- //so we use our own
- validationMessages = validate(base, property.toString(), value, locale);
- valid = null == validationMessages
- || 0 == validationMessages.length;
- }
- }
-
- /**
- * @return the validationMessages
- */
- public String[] getValidationMessages() {
- return validationMessages;
- }
-
- }
-
- /**
- * Class for identify validator instance by locale
- *
- * @author amarkhel
- *
- */
- static class ValidatorKey {
- private final Class<? extends Object> validatableClass;
- private final Locale locale;
-
- /**
- * Constructor for ValidatorKey object
- *
- * @param validatableClass
- * - class to validate
- * @param locale
- * - User locale to determine Resource bundle, used during
- * validation process
- */
- public ValidatorKey(Class<? extends Object> validatableClass,
- Locale locale) {
- this.validatableClass = validatableClass;
- this.locale = locale;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((locale == null) ? 0 : locale.hashCode());
- result = prime
- * result
- + ((validatableClass == null) ? 0 : validatableClass
- .hashCode());
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof ValidatorKey))
- return false;
- ValidatorKey other = (ValidatorKey) obj;
- if (locale == null) {
- if (other.locale != null)
- return false;
- } else if (!locale.equals(other.locale))
- return false;
- if (validatableClass == null) {
- if (other.validatableClass != null)
- return false;
- } else if (!validatableClass.equals(other.validatableClass))
- return false;
- return true;
- }
-
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.validator;
+
+import java.beans.FeatureDescriptor;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.el.ELContextWrapper;
+import org.hibernate.validator.ClassValidator;
+import org.hibernate.validator.InvalidValue;
+
+/**
+ * Perform validation by Hibernate Validator annotations
+ *
+ * @author asmirnov
+ *
+ */
+public class BeanValidator {
+
+ private static final String RESOURCE_BUNDLE_IS_NOT_REGISTERED_FOR_CURRENT_LOCALE = "Resource bundle is not registered for current locale";
+
+ private static final String FACES_CONTEXT_IS_NULL = "Faces context is null";
+
+ private static final String INPUT_PARAMETERS_IS_NOT_CORRECT = "Input parameters is not correct.";
+
+ private static final String LOCALE_IS_NOT_SET = "Locale is not set";
+
+ private static final String VIEW_ROOT_IS_NOT_INITIALIZED = "ViewRoot is not initialized";
+
+ public static final String VALIDATOR_PARAM = BeanValidator.class.getName();
+
+ private Map<ValidatorKey, ClassValidator<? extends Object>> classValidators = new ConcurrentHashMap<ValidatorKey, ClassValidator<? extends Object>>();
+
+ private BeanValidator() {
+ // This is a "singleton"-like class. Only factory methods allowed.
+ }
+
+ /**
+ * Create BeanValidator instance. For a Junit tests only.
+ *
+ * @return
+ */
+ static BeanValidator createInstance() {
+ // TODO - get instance class name from a "META-INF/service"
+ // If the Seam framework is active, use org.jboss.seam.core.Validators
+ // component should be used.
+ return new BeanValidator();
+ }
+
+ private static final Object MUTEX = new Object();
+
+ /**
+ * Return BeanValidator object from a ServletContext attribute. Create new
+ * instance if none is defined.
+ *
+ * @param context
+ * @return
+ */
+ public static BeanValidator getInstance(FacesContext context) {
+ ExternalContext externalContext = context.getExternalContext();
+ externalContext.getContext();
+ BeanValidator instance;
+ // TODO - use properly synchronization mutex ?
+ synchronized (MUTEX) {
+ Map<String, Object> applicationMap = externalContext
+ .getApplicationMap();
+ instance = (BeanValidator) applicationMap.get(VALIDATOR_PARAM);
+ if (null == instance) {
+ // Vaildator not initialized - create and store new instance.
+ instance = createInstance();
+ applicationMap.put(VALIDATOR_PARAM, instance);
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Perform Validation for a new value.
+ *
+ * @param context
+ * current faces context.
+ * @param target
+ * {@link ValueExpression} for a value assignment.
+ * @param value
+ * new value for validation
+ * @return null if no validation errors. Array of the validation messages
+ * otherwise.
+ * @throws FacesException
+ * if locale or context not properly initialized
+ */
+ public String[] validate(FacesContext context, ValueExpression target,
+ Object value) {
+ // TODO - check null parameters.
+ if (null == context) {
+ throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
+ }
+ String[] validationMessages = null;
+ if (null != target) {
+ ELContext elContext = context.getELContext();
+ ValidationResolver validationResolver = new ValidationResolver(
+ elContext.getELResolver(), calculateLocale(context));
+ ELContextWrapper wrappedElContext = new ELContextWrapper(elContext,
+ validationResolver);
+ // TODO - handle ELExceptions ?
+ try {
+ target.setValue(wrappedElContext, value);
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ if (!validationResolver.isValid()) {
+ validationMessages = validationResolver.getValidationMessages();
+ }
+
+ }
+ return validationMessages;
+ }
+
+ protected Locale calculateLocale(FacesContext context) {
+ if (null == context.getViewRoot()) {
+ throw new FacesException(VIEW_ROOT_IS_NOT_INITIALIZED);
+ } else if (null == context.getViewRoot().getLocale()) {
+ throw new FacesException(LOCALE_IS_NOT_SET);
+ }
+ Locale locale = context.getViewRoot().getLocale();
+ return locale;
+ }
+
+ // Method for checking input parameters for prevent NPE
+ private void checkInputParameters(FacesContext context,
+ ValueExpression target) {
+ if (null == context || null == target ) {
+ throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
+ }
+ }
+
+ /**
+ * Validate bean property for a new value. TODO - localization ?
+ *
+ * @param base
+ * - bean
+ * @param property
+ * - bean property name.
+ * @param value
+ * new value.
+ * @return null for a valid value, array of the validation messages
+ * othervise.
+ */
+ public String[] validate(Object base, String property, Object value,
+ Locale locale) {
+ InvalidValue[] invalidValues = validateBean(base, property, value,
+ locale);
+ if (null == invalidValues) {
+ return null;
+ } else {
+ String[] result = new String[invalidValues.length];
+ for (int i = 0; i < invalidValues.length; i++) {
+ InvalidValue invalidValue = invalidValues[i];
+ result[i] = invalidValue.getMessage();
+ }
+ return result;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public String[] validateGraph(FacesContext context, Object value,
+ Set<String> profiles) {
+ if (null == context) {
+ throw new FacesException(INPUT_PARAMETERS_IS_NOT_CORRECT);
+ }
+ String validationMessages[] = null;
+ if (null != value) {
+ ClassValidator<Object> validator = (ClassValidator<Object>) getValidator(
+ value.getClass(), calculateLocale(context));
+ if (validator.hasValidationRules()) {
+ InvalidValue[] invalidValues = validator
+ .getInvalidValues(value);
+ if (null != invalidValues && invalidValues.length > 0) {
+ validationMessages = new String[invalidValues.length];
+ for (int i = 0; i < invalidValues.length; i++) {
+ InvalidValue invalidValue = invalidValues[i];
+ validationMessages[i] = invalidValue.getMessage();
+ }
+ }
+ }
+
+ }
+ return validationMessages;
+ }
+
+ /**
+ * Validate bean property of the base object aganist new value
+ *
+ * @param base
+ * @param property
+ * @param value
+ * @return
+ */
+ protected InvalidValue[] validateBean(Object base, String property,
+ Object value, Locale locale) {
+ Class<? extends Object> beanClass = base.getClass();
+ InvalidValue[] invalidValues = validateClass(beanClass, property,
+ value, locale);
+ return invalidValues;
+ }
+
+ /**
+ * Validate bean property in the base class aganist new value.
+ *
+ * @param beanClass
+ * @param property
+ * @param value
+ * @return
+ */
+ protected InvalidValue[] validateClass(Class<? extends Object> beanClass,
+ String property, Object value, Locale locale) {
+ ClassValidator<? extends Object> classValidator = getValidator(
+ beanClass, locale);
+ InvalidValue[] invalidValues = classValidator
+ .getPotentialInvalidValues(property, value);
+ return invalidValues;
+ }
+
+ /**
+ * Get ( or create ) {@link ClassValidator} for a given bean class.
+ *
+ * @param beanClass
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ protected ClassValidator<? extends Object> getValidator(
+ Class<? extends Object> beanClass, Locale locale) {
+ // TODO - localization support.
+ ValidatorKey key = new ValidatorKey(beanClass, locale);
+ ClassValidator result = classValidators.get(key);
+ if (null == result) {
+ result = createValidator(beanClass, locale);
+ classValidators.put(key, result);
+ }
+ return result;
+ }
+
+ /*
+ * This method determine ResourceBundle, used in current request @param
+ * locale - user locale @return ResourceBundle instance
+ */
+ private ResourceBundle getCurrentResourceBundle(Locale locale) {
+ if (null == FacesContext.getCurrentInstance()
+ || null == FacesContext.getCurrentInstance().getApplication()) {
+ throw new FacesException(FACES_CONTEXT_IS_NULL);
+ }
+ String appBundle = FacesContext.getCurrentInstance().getApplication()
+ .getMessageBundle();
+ if (null == appBundle || null == locale) {
+ return null;
+ }
+
+ ResourceBundle bundle;
+
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader != null) {
+ bundle = ResourceBundle.getBundle(appBundle, locale, classLoader);
+ } else {
+ bundle = ResourceBundle.getBundle(appBundle, locale);
+ }
+
+ return bundle;
+ }
+
+ /*
+ * Method for create new instance of ClassValidator, if same not in cache.
+ *
+ * @param beanClass - Class to validate @param locale - user Locale, used
+ * during validation process @return ClassValidator instance
+ */
+ @SuppressWarnings("unchecked")
+ private ClassValidator<? extends Object> createValidator(
+ Class<? extends Object> beanClass, Locale locale) {
+ ResourceBundle bundle = getCurrentResourceBundle(locale);
+ return bundle == null ? new ClassValidator(beanClass)
+ : new ClassValidator(beanClass, bundle);
+ }
+
+ /**
+ * Wrapper class for a {@link ELResolver}. For a setValue method, perform
+ * validation instead of real assignment.
+ *
+ * @author asmirnov
+ *
+ */
+ final class ValidationResolver extends ELResolver {
+
+ /**
+ * Original resolver.
+ */
+ private final ELResolver parent;
+
+ private boolean valid = true;
+
+ private String[] validationMessages = null;
+
+ private Locale locale = null;
+
+ /**
+ * @param parent
+ */
+ public ValidationResolver(ELResolver parent, Locale locale) {
+ this.parent = parent;
+ this.locale = locale;
+ }
+
+ public boolean isValid() {
+ // TODO Auto-generated method stub
+ return valid;
+ }
+
+ /**
+ * @param context
+ * @param base
+ * @return
+ * @see javax.el.ELResolver#getCommonPropertyType(javax.el.ELContext,
+ * java.lang.Object)
+ */
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
+ return parent.getCommonPropertyType(context, base);
+ }
+
+ /**
+ * @param context
+ * @param base
+ * @return
+ * @see javax.el.ELResolver#getFeatureDescriptors(javax.el.ELContext,
+ * java.lang.Object)
+ */
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(
+ ELContext context, Object base) {
+ return parent.getFeatureDescriptors(context, base);
+ }
+
+ /**
+ * @param context
+ * @param base
+ * @param property
+ * @return
+ * @see javax.el.ELResolver#getType(javax.el.ELContext,
+ * java.lang.Object, java.lang.Object)
+ */
+ public Class<?> getType(ELContext context, Object base, Object property) {
+ return parent.getType(context, base, property);
+ }
+
+ /**
+ * @param context
+ * @param base
+ * @param property
+ * @return
+ * @see javax.el.ELResolver#getValue(javax.el.ELContext,
+ * java.lang.Object, java.lang.Object)
+ */
+ public Object getValue(ELContext context, Object base, Object property) {
+ return parent.getValue(context, base, property);
+ }
+
+ /**
+ * @param context
+ * @param base
+ * @param property
+ * @return
+ * @see javax.el.ELResolver#isReadOnly(javax.el.ELContext,
+ * java.lang.Object, java.lang.Object)
+ */
+ public boolean isReadOnly(ELContext context, Object base,
+ Object property) {
+ return parent.isReadOnly(context, base, property);
+ }
+
+ /**
+ * @param context
+ * @param base
+ * @param property
+ * @param value
+ * @see javax.el.ELResolver#setValue(javax.el.ELContext,
+ * java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) {
+ if (null != base && null != property) {
+ context.setPropertyResolved(true);
+ //https://jira.jboss.org/jira/browse/RF-4034
+ //apache el looses locale information during value resolution,
+ //so we use our own
+ validationMessages = validate(base, property.toString(), value, locale);
+ valid = null == validationMessages
+ || 0 == validationMessages.length;
+ }
+ }
+
+ /**
+ * @return the validationMessages
+ */
+ public String[] getValidationMessages() {
+ return validationMessages;
+ }
+
+ }
+
+ /**
+ * Class for identify validator instance by locale
+ *
+ * @author amarkhel
+ *
+ */
+ static class ValidatorKey {
+ private final Class<? extends Object> validatableClass;
+ private final Locale locale;
+
+ /**
+ * Constructor for ValidatorKey object
+ *
+ * @param validatableClass
+ * - class to validate
+ * @param locale
+ * - User locale to determine Resource bundle, used during
+ * validation process
+ */
+ public ValidatorKey(Class<? extends Object> validatableClass,
+ Locale locale) {
+ this.validatableClass = validatableClass;
+ this.locale = locale;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((locale == null) ? 0 : locale.hashCode());
+ result = prime
+ * result
+ + ((validatableClass == null) ? 0 : validatableClass
+ .hashCode());
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof ValidatorKey))
+ return false;
+ ValidatorKey other = (ValidatorKey) obj;
+ if (locale == null) {
+ if (other.locale != null)
+ return false;
+ } else if (!locale.equals(other.locale))
+ return false;
+ if (validatableClass == null) {
+ if (other.validatableClass != null)
+ return false;
+ } else if (!validatableClass.equals(other.validatableClass))
+ return false;
+ return true;
+ }
+
+ }
+}
Modified: trunk/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx
===================================================================
--- trunk/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -14,4 +14,4 @@
x:passThruWithExclusions="value,name,type,id"
>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java
===================================================================
--- trunk/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/test/java/org/richfaces/validator/BeanValidatorTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,81 +1,81 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.validator;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.hibernate.validator.ClassValidator;
-import org.hibernate.validator.InvalidValue;
-
-public class BeanValidatorTest extends AbstractAjax4JsfTestCase {
-
- public BeanValidatorTest(String name) {
- super(name);
- }
-
- public void testValidate() {
-
- }
-
- public void setUp() throws Exception {
- super.setUp();
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testGetValidator() throws Exception {
- BeanValidator beanValidator = BeanValidator.createInstance();
- ClassValidator<? extends Object> validator = beanValidator.getValidator(ValidableBean.class,Locale.ENGLISH);
- assertNotNull(validator);
- assertTrue(validator.hasValidationRules());
- validator = beanValidator.getValidator(String.class,Locale.getDefault());
- assertNotNull(validator);
- assertFalse(validator.hasValidationRules());
- }
-
- public void testValidateClass() throws Exception {
- BeanValidator beanValidator = BeanValidator.createInstance();
- InvalidValue[] invalidValues = beanValidator.validateClass(ValidableBean.class, "integerProperty", new Integer(3),Locale.getDefault());
- assertNotNull(invalidValues);
- assertEquals(0, invalidValues.length);
- invalidValues = beanValidator.validateClass(ValidableBean.class, "integerProperty", new Integer(-1),Locale.getDefault());
- assertNotNull(invalidValues);
- assertEquals(1, invalidValues.length);
- invalidValues = beanValidator.validateClass(UnValidableBean.class, "integerProperty", new Integer(-1),Locale.getDefault());
- assertNotNull(invalidValues);
- assertEquals(0, invalidValues.length);
- invalidValues = beanValidator.validateClass(ValidableBean.class, "nonExistentProperty", new Integer(-1),Locale.getDefault());
- assertNotNull(invalidValues);
- assertEquals(0, invalidValues.length);
-
- }
-
- public void testValidateBean() throws Exception {
- BeanValidator beanValidator = BeanValidator.createInstance();
- InvalidValue[] invalidValues = beanValidator.validateBean(new ValidableBean(), "integerProperty", new Integer(-1),Locale.getDefault());
- assertNotNull(invalidValues);
- assertEquals(1, invalidValues.length);
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.validator;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.hibernate.validator.ClassValidator;
+import org.hibernate.validator.InvalidValue;
+
+public class BeanValidatorTest extends AbstractAjax4JsfTestCase {
+
+ public BeanValidatorTest(String name) {
+ super(name);
+ }
+
+ public void testValidate() {
+
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testGetValidator() throws Exception {
+ BeanValidator beanValidator = BeanValidator.createInstance();
+ ClassValidator<? extends Object> validator = beanValidator.getValidator(ValidableBean.class,Locale.ENGLISH);
+ assertNotNull(validator);
+ assertTrue(validator.hasValidationRules());
+ validator = beanValidator.getValidator(String.class,Locale.getDefault());
+ assertNotNull(validator);
+ assertFalse(validator.hasValidationRules());
+ }
+
+ public void testValidateClass() throws Exception {
+ BeanValidator beanValidator = BeanValidator.createInstance();
+ InvalidValue[] invalidValues = beanValidator.validateClass(ValidableBean.class, "integerProperty", new Integer(3),Locale.getDefault());
+ assertNotNull(invalidValues);
+ assertEquals(0, invalidValues.length);
+ invalidValues = beanValidator.validateClass(ValidableBean.class, "integerProperty", new Integer(-1),Locale.getDefault());
+ assertNotNull(invalidValues);
+ assertEquals(1, invalidValues.length);
+ invalidValues = beanValidator.validateClass(UnValidableBean.class, "integerProperty", new Integer(-1),Locale.getDefault());
+ assertNotNull(invalidValues);
+ assertEquals(0, invalidValues.length);
+ invalidValues = beanValidator.validateClass(ValidableBean.class, "nonExistentProperty", new Integer(-1),Locale.getDefault());
+ assertNotNull(invalidValues);
+ assertEquals(0, invalidValues.length);
+
+ }
+
+ public void testValidateBean() throws Exception {
+ BeanValidator beanValidator = BeanValidator.createInstance();
+ InvalidValue[] invalidValues = beanValidator.validateBean(new ValidableBean(), "integerProperty", new Integer(-1),Locale.getDefault());
+ assertNotNull(invalidValues);
+ assertEquals(1, invalidValues.length);
+ }
+}
Modified: trunk/ui/beanValidator/src/test/java/org/richfaces/validator/UnValidableBean.java
===================================================================
--- trunk/ui/beanValidator/src/test/java/org/richfaces/validator/UnValidableBean.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/test/java/org/richfaces/validator/UnValidableBean.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,78 +1,78 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.validator;
-
-
-/**
- * @author asmirnov
- *
- */
-public class UnValidableBean {
-
- private int integerProperty;
-
- private String text;
-
- private Object foo;
-
- /**
- * @return the integerProperty
- */
- public int getIntegerProperty() {
- return integerProperty;
- }
-
- /**
- * @param integerProperty the integerProperty to set
- */
- public void setIntegerProperty(int integerProperty) {
- this.integerProperty = integerProperty;
- }
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the foo
- */
- public Object getFoo() {
- return foo;
- }
-
- /**
- * @param foo the foo to set
- */
- public void setFoo(Object foo) {
- this.foo = foo;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.validator;
+
+
+/**
+ * @author asmirnov
+ *
+ */
+public class UnValidableBean {
+
+ private int integerProperty;
+
+ private String text;
+
+ private Object foo;
+
+ /**
+ * @return the integerProperty
+ */
+ public int getIntegerProperty() {
+ return integerProperty;
+ }
+
+ /**
+ * @param integerProperty the integerProperty to set
+ */
+ public void setIntegerProperty(int integerProperty) {
+ this.integerProperty = integerProperty;
+ }
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the foo
+ */
+ public Object getFoo() {
+ return foo;
+ }
+
+ /**
+ * @param foo the foo to set
+ */
+ public void setFoo(Object foo) {
+ this.foo = foo;
+ }
+
+}
Modified: trunk/ui/beanValidator/src/test/java/org/richfaces/validator/ValidableBean.java
===================================================================
--- trunk/ui/beanValidator/src/test/java/org/richfaces/validator/ValidableBean.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/beanValidator/src/test/java/org/richfaces/validator/ValidableBean.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,88 +1,88 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.validator;
-
-import org.hibernate.validator.Length;
-import org.hibernate.validator.Max;
-import org.hibernate.validator.Min;
-import org.hibernate.validator.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class ValidableBean {
-
- @Min(2)
- @Max(5)
- private int integerProperty;
-
- private String text;
-
- private Object foo;
-
- /**
- * @return the integerProperty
- */
- public int getIntegerProperty() {
- return integerProperty;
- }
-
- /**
- * @param integerProperty the integerProperty to set
- */
- @Min(2)
- @Max(5)
- public void setIntegerProperty(int integerProperty) {
- this.integerProperty = integerProperty;
- }
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- @Length(max=10,min=1,message="text size")
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the foo
- */
- public Object getFoo() {
- return foo;
- }
-
- /**
- * @param foo the foo to set
- */
- @NotNull
- public void setFoo(Object foo) {
- this.foo = foo;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.validator;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotNull;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ValidableBean {
+
+ @Min(2)
+ @Max(5)
+ private int integerProperty;
+
+ private String text;
+
+ private Object foo;
+
+ /**
+ * @return the integerProperty
+ */
+ public int getIntegerProperty() {
+ return integerProperty;
+ }
+
+ /**
+ * @param integerProperty the integerProperty to set
+ */
+ @Min(2)
+ @Max(5)
+ public void setIntegerProperty(int integerProperty) {
+ this.integerProperty = integerProperty;
+ }
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ @Length(max=10,min=1,message="text size")
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @return the foo
+ */
+ public Object getFoo() {
+ return foo;
+ }
+
+ /**
+ * @param foo the foo to set
+ */
+ @NotNull
+ public void setFoo(Object foo) {
+ this.foo = foo;
+ }
+
+}
Modified: trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/calendar/src/main/java/org/richfaces/renderkit/html/iconimages/CalendarSeparator.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,121 +1,121 @@
-/**
- * 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.renderkit.html.iconimages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.util.Date;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.GifRenderer;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.Zipper2;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class CalendarSeparator extends Java2Dresource {
- private final static Dimension DIMENSIONS = new Dimension(1, 15);
- private final static String COLOR_SKIN_PARAM = "headerTextColor";
- private final static String DEFAULT_HTML_COLOR = "#FFFFFF";
-
- public CalendarSeparator() {
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
- }
-
- @Override
- public Dimension getDimensions(FacesContext facesContext, Object data) {
- return DIMENSIONS;
- }
-
- @Override
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return DIMENSIONS;
- }
-
- @Override
- protected Object getDataToStore(FacesContext context, Object data) {
- Skin skin = SkinFactory.getInstance().getSkin(context);
- Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
-
- byte [] ret = new byte[3];
- Color color = null;
- Zipper2 zipper = new Zipper2(ret);
-
- String htmlColor = (String) skin.getParameter(context, COLOR_SKIN_PARAM);
- if (null == htmlColor || "".equals(htmlColor))
- htmlColor = (String) defaultSkin.getParameter(context, COLOR_SKIN_PARAM);
-
- if (htmlColor == null) {
- htmlColor = DEFAULT_HTML_COLOR;
- }
-
- color = HtmlColor.decode(htmlColor);
-
- zipper.addColor(color);
-
- return ret;
- }
-
- @Override
- protected void paint(ResourceContext context, Graphics2D g2d) {
- Color color = (Color)restoreData(context);
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
- g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
- g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- g2d.setColor(color);
- //TODO hans, need to be optimized
- for (int i = 0;i < DIMENSIONS.getHeight(); i += 2 ) {
- g2d.drawLine(0, i, 0, i);
- }
- }
-
- protected Object deserializeData(byte[] objectArray) {
- if (objectArray == null) {
- return null;
- }
-
- Zipper2 zipper = new Zipper2(objectArray);
-
- return zipper.nextColor();
- }
-
- public boolean isCacheable() {
- return true;
- }
-}
+/**
+ * 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.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class CalendarSeparator extends Java2Dresource {
+ private final static Dimension DIMENSIONS = new Dimension(1, 15);
+ private final static String COLOR_SKIN_PARAM = "headerTextColor";
+ private final static String DEFAULT_HTML_COLOR = "#FFFFFF";
+
+ public CalendarSeparator() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ @Override
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return DIMENSIONS;
+ }
+
+ @Override
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return DIMENSIONS;
+ }
+
+ @Override
+ protected Object getDataToStore(FacesContext context, Object data) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ byte [] ret = new byte[3];
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ String htmlColor = (String) skin.getParameter(context, COLOR_SKIN_PARAM);
+ if (null == htmlColor || "".equals(htmlColor))
+ htmlColor = (String) defaultSkin.getParameter(context, COLOR_SKIN_PARAM);
+
+ if (htmlColor == null) {
+ htmlColor = DEFAULT_HTML_COLOR;
+ }
+
+ color = HtmlColor.decode(htmlColor);
+
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ @Override
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color color = (Color)restoreData(context);
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(color);
+ //TODO hans, need to be optimized
+ for (int i = 0;i < DIMENSIONS.getHeight(); i += 2 ) {
+ g2d.drawLine(0, i, 0, i);
+ }
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+
+ Zipper2 zipper = new Zipper2(objectArray);
+
+ return zipper.nextColor();
+ }
+
+ public boolean isCacheable() {
+ return true;
+ }
+}
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -92,7 +92,7 @@
variables.setVariable("buttonIcon",buttonIcon);
if(buttonLabel==null || buttonLabel.length()==0){
]]>
- </jsp:scriptlet> <img id="#{clientId}PopupButton" alt=" "
+ </jsp:scriptlet> <img id="#{clientId}PopupButton" alt=""
class="rich-calendar-button #{component.attributes['buttonClass']}"
accesskey="#{component.attributes['accesskey']}"
style="vertical-align: middle"
Modified: trunk/ui/combobox/src/main/java/org/richfaces/component/UIComboBox.java
===================================================================
--- trunk/ui/combobox/src/main/java/org/richfaces/component/UIComboBox.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/combobox/src/main/java/org/richfaces/component/UIComboBox.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -38,4 +38,4 @@
public abstract boolean isEnableManualInput();
public abstract void setEnableManualInput(boolean enableManualInput);
-}
\ No newline at end of file
+}
Modified: trunk/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/ui/combobox/src/main/templates/combobox.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/combobox/src/main/templates/combobox.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -244,18 +244,18 @@
<table id="#{clientId}shadow" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="rich-combobox-shadow-tl">
- <img src="#{spacer}" width="10" height="1" alt=" " style="border:0"></img><br></br>
+ <img src="#{spacer}" width="10" height="1" alt="" style="border:0"></img><br></br>
</td>
<td class="rich-combobox-shadow-tr">
- <img src="#{spacer}" width="1" height="10" alt=" " style="border:0"></img><br></br>
+ <img src="#{spacer}" width="1" height="10" alt="" style="border:0"></img><br></br>
</td>
</tr>
<tr>
<td class="rich-combobox-shadow-bl">
- <img src="#{spacer}" width="1" height="10" alt=" " style="border:0"></img><br></br>
+ <img src="#{spacer}" width="1" height="10" alt="" style="border:0"></img><br></br>
</td>
<td class="rich-combobox-shadow-br">
- <img src="#{spacer}" width="10" height="10" alt=" " style="border:0"></img><br></br>
+ <img src="#{spacer}" width="10" height="10" alt="" style="border:0"></img><br></br>
</td>
</tr>
</table>
@@ -362,4 +362,4 @@
#{component.attributes["showDelay"]}, #{component.attributes["hideDelay"]});
</script>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/componentControl/src/main/templates/htmlComponentControl.jspx
===================================================================
--- trunk/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -54,4 +54,4 @@
<![CDATA[ } ]]>
</jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/Lifo.java
===================================================================
--- trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/Lifo.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/contextMenu/src/main/java/org/richfaces/renderkit/html/Lifo.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -60,4 +60,4 @@
return top.content;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/KeepAlive.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,43 +1,43 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.component;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author asmirnov
- *
- */
-public class KeepAlive extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.ajax4jsf.KeepAlive";
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.KeepAlive";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.component;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class KeepAlive extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.KeepAlive";
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.KeepAlive";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIPortlet.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,73 +1,73 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.component;
-
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class UIPortlet extends UIComponentBase implements NamingContainer {
-
-
- private static final Log _log = LogFactory.getLog(UIPortlet.class);
- /**
- * <p>The standard component type for this component.</p>
- */
- public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
-
-
- /**
- * <p>The standard component family for this component.</p>
- */
- public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
-
- private String portletId = null;
-
- @Override
- public void setId(String id) {
- portletId = null;
- super.setId(id);
- }
-
- // ----------------------------------------------------- UIComponent Methods
- public String getClientId(FacesContext context) {
- if (portletId == null) {
- portletId = context.getExternalContext().encodeNamespace(super.getClientId(context));
- }
- return portletId;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class UIPortlet extends UIComponentBase implements NamingContainer {
+
+
+ private static final Log _log = LogFactory.getLog(UIPortlet.class);
+ /**
+ * <p>The standard component type for this component.</p>
+ */
+ public static final String COMPONENT_TYPE = "org.ajax4jsf.Portlet";
+
+
+ /**
+ * <p>The standard component family for this component.</p>
+ */
+ public static final String COMPONENT_FAMILY = "org.ajax4jsf.Portlet";
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ public String getFamily() {
+ // TODO Auto-generated method stub
+ return COMPONENT_FAMILY;
+ }
+
+ private String portletId = null;
+
+ @Override
+ public void setId(String id) {
+ portletId = null;
+ super.setId(id);
+ }
+
+ // ----------------------------------------------------- UIComponent Methods
+ public String getClientId(FacesContext context) {
+ if (portletId == null) {
+ portletId = context.getExternalContext().encodeNamespace(super.getClientId(context));
+ }
+ return portletId;
+ }
+
+}
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/button.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -47,4 +47,4 @@
<jsp:scriptlet>encodeTypeAndImage(context,component);</jsp:scriptlet>
</input>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/function.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -21,4 +21,4 @@
#{this:getFunction(context,component)};
//]]>
</script>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/link.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -18,7 +18,7 @@
type="#{component.attributes['type']}"
x:passThruWithExclusions="value,name,onclick,type,href,id"
onclick="#{this:getOnClick(context,component)}"
- href="#"
+ href="#"
class="#{component.attributes['styleClass']}"
>
#{this:getValue(component)}
@@ -27,4 +27,4 @@
</vcp:body>
</a>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx
===================================================================
--- trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/main/templates/org/ajax4jsf/renderkit/html/log.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -24,10 +24,10 @@
x:style='width:#{component.width};height:#{component.height};overflow:auto;#{component.attributes["style"]}'
x:passThruWithExclusions="value,name,id,style"
>
- <button onclick="LOG.clear()">Clear</button><br />
- <script type="text/javascript">
- LOG.LEVEL = LOG.#{component.level};
+ <button onclick="LOG.clear()">Clear</button><br />
+ <script type="text/javascript">
+ LOG.LEVEL = LOG.#{component.level};
</script>
</div>
<jsp:scriptlet> } </jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,86 +1,86 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.ajax4jsf.component;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-
-public class IncludeComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
- private UIInclude include = null;
- private UIForm form = null;
-
- public IncludeComponentTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- include = (UIInclude) application.createComponent(UIInclude.COMPONENT_TYPE);
- include.setId("include");
- include.setLayout(UIInclude.LAYOUT_NONE);
-
- form.getChildren().add(include);
-
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- form = null;
- include = null;
- }
-
- public void testState() throws Exception {
-
- }
-
- public void testViewId() throws Exception {
- include.setViewId(null);
- assertNull(include.getViewId());
-
- String viewId = "viewId";
- include.setViewId(viewId);
- String newViewId = include.getViewId();
- assertNotNull(newViewId);
- assertEquals(viewId, newViewId);
- }
-
- public void testLayout() throws Exception {
- include.setLayout(null);
- assertNull(include.getLayout());
-
- include.setLayout(UIInclude.LAYOUT_BLOCK);
- String newLayout = include.getLayout();
- assertNotNull(newLayout);
- assertEquals(UIInclude.LAYOUT_BLOCK, newLayout);
- }
-
- public void testAjaxRendered() throws Exception {
- assertFalse(include.isAjaxRendered());
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.ajax4jsf.component;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+public class IncludeComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
+ private UIInclude include = null;
+ private UIForm form = null;
+
+ public IncludeComponentTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ include = (UIInclude) application.createComponent(UIInclude.COMPONENT_TYPE);
+ include.setId("include");
+ include.setLayout(UIInclude.LAYOUT_NONE);
+
+ form.getChildren().add(include);
+
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ form = null;
+ include = null;
+ }
+
+ public void testState() throws Exception {
+
+ }
+
+ public void testViewId() throws Exception {
+ include.setViewId(null);
+ assertNull(include.getViewId());
+
+ String viewId = "viewId";
+ include.setViewId(viewId);
+ String newViewId = include.getViewId();
+ assertNotNull(newViewId);
+ assertEquals(viewId, newViewId);
+ }
+
+ public void testLayout() throws Exception {
+ include.setLayout(null);
+ assertNull(include.getLayout());
+
+ include.setLayout(UIInclude.LAYOUT_BLOCK);
+ String newLayout = include.getLayout();
+ assertNotNull(newLayout);
+ assertEquals(UIInclude.LAYOUT_BLOCK, newLayout);
+ }
+
+ public void testAjaxRendered() throws Exception {
+ assertFalse(include.isAjaxRendered());
+ }
+
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadBundleComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,144 +1,144 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.ajax4jsf.component;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class LoadBundleComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
- private UIForm form;
- private UILoadBundle bundle = null;
- private static final String BUNDLE_NAME = "testBundle";
-
- public LoadBundleComponentTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- bundle = (UILoadBundle) application.createComponent(UILoadBundle.COMPONENT_TYPE);
- if (null != bundle) {
- bundle.setId("loadBundle");
- bundle.setVar(BUNDLE_NAME);
- bundle.setBasename("org.ajax4jsf.component.test_skin");
- form.getChildren().add(bundle);
- }
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- form = null;
- bundle = null;
- }
-
- public void testLoadBundle() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertEquals("non-existent key", loadedMap.get("non-existent key"));
-
- assertEquals("#000000", loadedMap.get("shadowBackgroundColor"));
- }
-
- public void testSize() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertEquals(0, loadedMap.size());
- }
-
- public void testContainsKey() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertTrue(loadedMap.containsKey("shadowBackgroundColor"));
-
- assertFalse(loadedMap.containsKey("non-existent key"));
- }
-
- public void testFakeFunctions() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
- assertNotNull(loadedMap);
-
- assertFalse(loadedMap.isEmpty());
-
- assertFalse(loadedMap.containsValue(null));
- assertFalse(loadedMap.containsValue("any-string"));
-
- try {
- loadedMap.put("key1", "value1");
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- try {
- loadedMap.putAll(new HashMap());
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- try {
- loadedMap.remove("key1");
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- try {
- loadedMap.clear();
- assertFalse("UnsupportedOperationException was not thrown", true);
- } catch (UnsupportedOperationException e) {
-
- }
-
- assertNull(loadedMap.keySet());
-
- assertNull(loadedMap.values());
-
- assertNull(loadedMap.entrySet());
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.ajax4jsf.component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class LoadBundleComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
+ private UIForm form;
+ private UILoadBundle bundle = null;
+ private static final String BUNDLE_NAME = "testBundle";
+
+ public LoadBundleComponentTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ bundle = (UILoadBundle) application.createComponent(UILoadBundle.COMPONENT_TYPE);
+ if (null != bundle) {
+ bundle.setId("loadBundle");
+ bundle.setVar(BUNDLE_NAME);
+ bundle.setBasename("org.ajax4jsf.component.test_skin");
+ form.getChildren().add(bundle);
+ }
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ form = null;
+ bundle = null;
+ }
+
+ public void testLoadBundle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertEquals("non-existent key", loadedMap.get("non-existent key"));
+
+ assertEquals("#000000", loadedMap.get("shadowBackgroundColor"));
+ }
+
+ public void testSize() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertEquals(0, loadedMap.size());
+ }
+
+ public void testContainsKey() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertTrue(loadedMap.containsKey("shadowBackgroundColor"));
+
+ assertFalse(loadedMap.containsKey("non-existent key"));
+ }
+
+ public void testFakeFunctions() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ Map loadedMap = (Map)facesContext.getExternalContext().getRequestMap().get(BUNDLE_NAME);
+ assertNotNull(loadedMap);
+
+ assertFalse(loadedMap.isEmpty());
+
+ assertFalse(loadedMap.containsValue(null));
+ assertFalse(loadedMap.containsValue("any-string"));
+
+ try {
+ loadedMap.put("key1", "value1");
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ try {
+ loadedMap.putAll(new HashMap());
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ try {
+ loadedMap.remove("key1");
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ try {
+ loadedMap.clear();
+ assertFalse("UnsupportedOperationException was not thrown", true);
+ } catch (UnsupportedOperationException e) {
+
+ }
+
+ assertNull(loadedMap.keySet());
+
+ assertNull(loadedMap.values());
+
+ assertNull(loadedMap.entrySet());
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/LoadResourceComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -361,4 +361,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxFormRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,144 +1,144 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.ajax4jsf.renderkit.html;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.ajax4jsf.component.UIAjaxForm;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class AjaxFormRendererTest extends AbstractAjax4JsfTestCase {
- private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
- private static Set javaScripts = new HashSet();
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
- }
-
- private UIAjaxForm form1;
- private UIAjaxForm form2;
-
- public AjaxFormRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form1 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
- form1.setId("form1");
- form1.setAjaxSubmit(true);
-
- form2 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
- form2.setId("form2");
- form2.setAjaxSubmit(false);
-
- facesContext.getViewRoot().getChildren().add(form1);
- facesContext.getViewRoot().getChildren().add(form2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * Test script rendering
- *
- * @throws Exception
- */
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
- }
-
- /**
- * Test rendering
- *
- * @throws Exception
- */
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
- assertNotNull(htmlForm1);
- assertEquals("form", htmlForm1.getTagName());
-
- String action = htmlForm1.getAttributeValue("action");
- assertNotNull(action);
- assertTrue(action.startsWith("javascript:A4J.AJAX.SubmitForm"));
-
- HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
- assertNotNull(htmlForm2);
- assertEquals("form", htmlForm2.getTagName());
-
- action = htmlForm2.getAttributeValue("action");
- assertNotNull(action);
- assertTrue(action.startsWith("/"));
- }
-
- /**
- * Test rendering hidden inputs
- *
- * @throws Exception
- */
- public void testRenderHiddenInputs() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
- List inputs = htmlForm1.getHtmlElementsByTagName("input");
- assertNotNull(inputs);
- boolean foundId = false;
- boolean foundAutoscroll = false;
- for (Iterator it = inputs.iterator(); it.hasNext();) {
- HtmlElement input = (HtmlElement) it.next();
- String name = input.getAttributeValue("name");
- assertNotNull(name);
- if (!foundId && name.equals(form1.getClientId(facesContext))) {
- foundId = true;
- }
- if (!foundAutoscroll && name.equals("autoScroll")) {
- foundAutoscroll = true;
- }
- }
- assertTrue(foundId);
- assertTrue(foundAutoscroll);
-
- HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
- assertNotNull(htmlForm2);
- assertEquals("form", htmlForm2.getTagName());
-
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.ajax4jsf.renderkit.html;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.ajax4jsf.component.UIAjaxForm;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class AjaxFormRendererTest extends AbstractAjax4JsfTestCase {
+ private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
+ private static Set javaScripts = new HashSet();
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
+ }
+
+ private UIAjaxForm form1;
+ private UIAjaxForm form2;
+
+ public AjaxFormRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form1 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
+ form1.setId("form1");
+ form1.setAjaxSubmit(true);
+
+ form2 = (UIAjaxForm) application.createComponent(UIAjaxForm.COMPONENT_TYPE);
+ form2.setId("form2");
+ form2.setAjaxSubmit(false);
+
+ facesContext.getViewRoot().getChildren().add(form1);
+ facesContext.getViewRoot().getChildren().add(form2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
+ }
+
+ /**
+ * Test rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
+ assertNotNull(htmlForm1);
+ assertEquals("form", htmlForm1.getTagName());
+
+ String action = htmlForm1.getAttributeValue("action");
+ assertNotNull(action);
+ assertTrue(action.startsWith("javascript:A4J.AJAX.SubmitForm"));
+
+ HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
+ assertNotNull(htmlForm2);
+ assertEquals("form", htmlForm2.getTagName());
+
+ action = htmlForm2.getAttributeValue("action");
+ assertNotNull(action);
+ assertTrue(action.startsWith("/"));
+ }
+
+ /**
+ * Test rendering hidden inputs
+ *
+ * @throws Exception
+ */
+ public void testRenderHiddenInputs() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement htmlForm1 = page.getHtmlElementById(form1.getClientId(facesContext));
+ List inputs = htmlForm1.getHtmlElementsByTagName("input");
+ assertNotNull(inputs);
+ boolean foundId = false;
+ boolean foundAutoscroll = false;
+ for (Iterator it = inputs.iterator(); it.hasNext();) {
+ HtmlElement input = (HtmlElement) it.next();
+ String name = input.getAttributeValue("name");
+ assertNotNull(name);
+ if (!foundId && name.equals(form1.getClientId(facesContext))) {
+ foundId = true;
+ }
+ if (!foundAutoscroll && name.equals("autoScroll")) {
+ foundAutoscroll = true;
+ }
+ }
+ assertTrue(foundId);
+ assertTrue(foundAutoscroll);
+
+ HtmlElement htmlForm2 = page.getHtmlElementById(form2.getClientId(facesContext));
+ assertNotNull(htmlForm2);
+ assertEquals("form", htmlForm2.getTagName());
+
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxIncludeRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,103 +1,103 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIInclude;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.ElementNotFoundException;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxIncludeRendererTest extends AbstractAjax4JsfTestCase {
- private UIInclude include1 = null;
- private UIInclude include2 = null;
- private UIInclude include3 = null;
- private UIForm form;
-
- public AjaxIncludeRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- include1 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
- include1.setId("include1");
- include1.setLayout(UIInclude.LAYOUT_NONE);
-
- UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
- output.setRendered(true);
- output.setId("output");
- output.setValue("output");
- include1.getChildren().add(output);
-
- include2 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
- include2.setId("include2");
- include2.setLayout(UIInclude.LAYOUT_BLOCK);
-
- include3 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
- include3.setId("include3");
- include3.setLayout(UIInclude.LAYOUT_INLINE);
-
- form.getChildren().add(include1);
- form.getChildren().add(include2);
- form.getChildren().add(include3);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- include1 = null;
- include2 = null;
- include3 = null;
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- try {
- HtmlElement empty = page.getHtmlElementById(include1.getClientId(facesContext));
- assertFalse("ElementNotFoundException was not thrown", true);
- } catch (ElementNotFoundException e) {
-
- }
-
- HtmlElement div = page.getHtmlElementById(include2.getClientId(facesContext));
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
-
- HtmlElement span = page.getHtmlElementById(include3.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIInclude;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxIncludeRendererTest extends AbstractAjax4JsfTestCase {
+ private UIInclude include1 = null;
+ private UIInclude include2 = null;
+ private UIInclude include3 = null;
+ private UIForm form;
+
+ public AjaxIncludeRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ include1 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
+ include1.setId("include1");
+ include1.setLayout(UIInclude.LAYOUT_NONE);
+
+ UIOutput output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ output.setRendered(true);
+ output.setId("output");
+ output.setValue("output");
+ include1.getChildren().add(output);
+
+ include2 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
+ include2.setId("include2");
+ include2.setLayout(UIInclude.LAYOUT_BLOCK);
+
+ include3 = (UIInclude)application.createComponent(UIInclude.COMPONENT_TYPE);
+ include3.setId("include3");
+ include3.setLayout(UIInclude.LAYOUT_INLINE);
+
+ form.getChildren().add(include1);
+ form.getChildren().add(include2);
+ form.getChildren().add(include3);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ include1 = null;
+ include2 = null;
+ include3 = null;
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ try {
+ HtmlElement empty = page.getHtmlElementById(include1.getClientId(facesContext));
+ assertFalse("ElementNotFoundException was not thrown", true);
+ } catch (ElementNotFoundException e) {
+
+ }
+
+ HtmlElement div = page.getHtmlElementById(include2.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+
+ HtmlElement span = page.getHtmlElementById(include3.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxOutputPanelRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,119 +1,119 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIAjaxOutputPanel;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.ElementNotFoundException;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxOutputPanelRendererTest extends AbstractAjax4JsfTestCase {
- private UIForm form = null;
- private UIAjaxOutputPanel panel1 = null;
- private UIAjaxOutputPanel panel2 = null;
- private UIAjaxOutputPanel panel3 = null;
- private UIAjaxOutputPanel panel4 = null;
- private UIOutput output = null;
-
- public AjaxOutputPanelRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- panel1 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel1.setId("panel1");
- panel1.setLayout("none");
- form.getChildren().add(panel1);
-
- panel2 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel2.setId("panel2");
- panel2.setLayout("block");
- form.getChildren().add(panel2);
-
- panel3 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel3.setId("panel3");
- panel3.setLayout("inline");
- form.getChildren().add(panel3);
-
- panel4 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
- panel4.setId("panel4");
- panel4.setLayout("none");
-
- output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
- output.setId("output");
- output.setValue("output");
- output.setTransient(true);
- panel4.getChildren().add(output);
-
- form.getChildren().add(panel4);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- output = null;
- panel1 = null;
- panel2 = null;
- panel3 = null;
- form = null;
- }
-
- public void testRender() throws Exception{
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- try {
- HtmlElement empty = page.getHtmlElementById(panel1.getClientId(facesContext));
- assertFalse("ElementNotFoundException was not thrown", true);
- } catch (ElementNotFoundException e) {
-
- }
-
- HtmlElement div = page.getHtmlElementById(panel2.getClientId(facesContext));
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
-
- HtmlElement span = page.getHtmlElementById(panel3.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
-
- span = page.getHtmlElementById(output.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
-
- assertFalse(output.isTransient());
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIAjaxOutputPanel;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxOutputPanelRendererTest extends AbstractAjax4JsfTestCase {
+ private UIForm form = null;
+ private UIAjaxOutputPanel panel1 = null;
+ private UIAjaxOutputPanel panel2 = null;
+ private UIAjaxOutputPanel panel3 = null;
+ private UIAjaxOutputPanel panel4 = null;
+ private UIOutput output = null;
+
+ public AjaxOutputPanelRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ panel1 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel1.setId("panel1");
+ panel1.setLayout("none");
+ form.getChildren().add(panel1);
+
+ panel2 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel2.setId("panel2");
+ panel2.setLayout("block");
+ form.getChildren().add(panel2);
+
+ panel3 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel3.setId("panel3");
+ panel3.setLayout("inline");
+ form.getChildren().add(panel3);
+
+ panel4 = (UIAjaxOutputPanel)application.createComponent(UIAjaxOutputPanel.COMPONENT_TYPE);
+ panel4.setId("panel4");
+ panel4.setLayout("none");
+
+ output = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ output.setId("output");
+ output.setValue("output");
+ output.setTransient(true);
+ panel4.getChildren().add(output);
+
+ form.getChildren().add(panel4);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ output = null;
+ panel1 = null;
+ panel2 = null;
+ panel3 = null;
+ form = null;
+ }
+
+ public void testRender() throws Exception{
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ try {
+ HtmlElement empty = page.getHtmlElementById(panel1.getClientId(facesContext));
+ assertFalse("ElementNotFoundException was not thrown", true);
+ } catch (ElementNotFoundException e) {
+
+ }
+
+ HtmlElement div = page.getHtmlElementById(panel2.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+
+ HtmlElement span = page.getHtmlElementById(panel3.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+
+ span = page.getHtmlElementById(output.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+
+ assertFalse(output.isTransient());
+ }
+
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPageRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,127 +1,127 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-
-import javax.faces.component.UIOutput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxPageRendererTest extends AbstractAjax4JsfTestCase{
-
- private org.ajax4jsf.component.html.HtmlPage ajaxPage = null;
- private static Set<String> javaScripts = new HashSet<String>();
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- }
-
- private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
-
- public AjaxPageRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- ajaxPage = (org.ajax4jsf.component.html.HtmlPage) application.createComponent(org.ajax4jsf.component.html.HtmlPage.COMPONENT_TYPE);
- ajaxPage.setId("page");
-
- UIOutput head = new UIOutput();
- head.setValue("HEAD");
- ajaxPage.getFacets().put("head", head);
-
- UIOutput content = new UIOutput();
- content.setValue("content");
- ajaxPage.getChildren().add(content);
-
- ajaxPage.setFormat("xhtml");
- ajaxPage.setPageTitle("title");
-
- facesContext.getViewRoot().setLocale(new Locale("be", "BY"));
-
- facesContext.getViewRoot().getChildren().add(ajaxPage);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement html = (HtmlElement)page.getFirstChild();
- assertNotNull(html);
- assertEquals("html", html.getTagName());
-
- String lang = html.getAttributeValue("lang");
- assertNotNull(lang);
- assertEquals(lang, "be_BY");
-
- HtmlElement title = (HtmlElement) html.getHtmlElementsByTagName("title").get(0);
- assertNotNull(title);
-
- assertEquals("title", title.getFirstChild().asText());
-
- HtmlElement meta = (HtmlElement) html.getHtmlElementsByTagName("meta").get(0);
-
- assertNotNull(meta);
- String httpEquiv = meta.getAttributeValue("http-equiv");
- assertEquals(httpEquiv, "Content-Type");
-
- String content = meta.getAttributeValue("content");
- assertEquals(content, "application/xhtml+xml");
- }
-
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
- }
-
- @Override
- protected void encodeDocumentProlog(FacesContext context,
- UIViewRoot viewRoot, ResponseWriter writer) throws IOException {
-
- //do nothing as a4j:page encodes full page structure
- }
-
- @Override
- protected void encodeDocumentEpilog(FacesContext context,
- UIViewRoot viewRoot, ResponseWriter writer) throws IOException {
-
- //do nothing as a4j:page encodes full page structure
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import javax.faces.component.UIOutput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxPageRendererTest extends AbstractAjax4JsfTestCase{
+
+ private org.ajax4jsf.component.html.HtmlPage ajaxPage = null;
+ private static Set<String> javaScripts = new HashSet<String>();
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ }
+
+ private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
+
+ public AjaxPageRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ ajaxPage = (org.ajax4jsf.component.html.HtmlPage) application.createComponent(org.ajax4jsf.component.html.HtmlPage.COMPONENT_TYPE);
+ ajaxPage.setId("page");
+
+ UIOutput head = new UIOutput();
+ head.setValue("HEAD");
+ ajaxPage.getFacets().put("head", head);
+
+ UIOutput content = new UIOutput();
+ content.setValue("content");
+ ajaxPage.getChildren().add(content);
+
+ ajaxPage.setFormat("xhtml");
+ ajaxPage.setPageTitle("title");
+
+ facesContext.getViewRoot().setLocale(new Locale("be", "BY"));
+
+ facesContext.getViewRoot().getChildren().add(ajaxPage);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement html = (HtmlElement)page.getFirstChild();
+ assertNotNull(html);
+ assertEquals("html", html.getTagName());
+
+ String lang = html.getAttributeValue("lang");
+ assertNotNull(lang);
+ assertEquals(lang, "be_BY");
+
+ HtmlElement title = (HtmlElement) html.getHtmlElementsByTagName("title").get(0);
+ assertNotNull(title);
+
+ assertEquals("title", title.getFirstChild().asText());
+
+ HtmlElement meta = (HtmlElement) html.getHtmlElementsByTagName("meta").get(0);
+
+ assertNotNull(meta);
+ String httpEquiv = meta.getAttributeValue("http-equiv");
+ assertEquals(httpEquiv, "Content-Type");
+
+ String content = meta.getAttributeValue("content");
+ assertEquals(content, "application/xhtml+xml");
+ }
+
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
+ }
+
+ @Override
+ protected void encodeDocumentProlog(FacesContext context,
+ UIViewRoot viewRoot, ResponseWriter writer) throws IOException {
+
+ //do nothing as a4j:page encodes full page structure
+ }
+
+ @Override
+ protected void encodeDocumentEpilog(FacesContext context,
+ UIViewRoot viewRoot, ResponseWriter writer) throws IOException {
+
+ //do nothing as a4j:page encodes full page structure
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxPushRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,140 +1,140 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIPush;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-
-import com.gargoylesoftware.htmlunit.html.DomText;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class AjaxPushRendererTest extends AbstractAjax4JsfTestCase {
-
- private static Set<String> javaScripts = new HashSet<String>();
- private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- }
- private UIForm form = null;
- private UIPush push1 = null;
- private UIPush push2 = null;
-
- public AjaxPushRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- push1 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
- push1.setId("push1");
- push1.setEnabled(true);
- form.getChildren().add(push1);
-
- push2 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
- push2.setId("push2");
- push2.setEnabled(false);
- form.getChildren().add(push2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- push1 = null;
- push2 = null;
- form = null;
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
- assertNotNull(span1);
- assertEquals("span", span1.getTagName());
- String style = span1.getAttributeValue("style");
- assertNotNull(style);
- assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
-
- HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
- assertNotNull(span2);
- assertEquals("span", span2.getTagName());
- style = span2.getAttributeValue("style");
- assertNotNull(style);
- assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
- }
-
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
- assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
-
- HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
- assertNotNull(span1);
- scripts = span1.getHtmlElementsByTagName("script");
- int i = 0;
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- DomText text = (DomText) item.getFirstChild();
-
- assertNotNull(text);
- assertTrue(text.asText().contains("A4J.AJAX.Push"));
-
- i++;
- }
- assertEquals(1, i);
-
- HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
- assertNotNull(span2);
- scripts = span2.getHtmlElementsByTagName("script");
- i = 0;
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- DomText text = (DomText) item.getFirstChild();
-
- assertNotNull(text);
- assertTrue(text.asText().contains("A4J.AJAX.StopPush"));
-
- i++;
- }
- assertEquals(1, i);
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIPush;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class AjaxPushRendererTest extends AbstractAjax4JsfTestCase {
+
+ private static Set<String> javaScripts = new HashSet<String>();
+ private static final boolean IS_PAGE_AVAILABILITY_CHECK = true;
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ }
+ private UIForm form = null;
+ private UIPush push1 = null;
+ private UIPush push2 = null;
+
+ public AjaxPushRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ push1 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
+ push1.setId("push1");
+ push1.setEnabled(true);
+ form.getChildren().add(push1);
+
+ push2 = (UIPush) application.createComponent(UIPush.COMPONENT_TYPE);
+ push2.setId("push2");
+ push2.setEnabled(false);
+ form.getChildren().add(push2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ push1 = null;
+ push2 = null;
+ form = null;
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
+ assertNotNull(span1);
+ assertEquals("span", span1.getTagName());
+ String style = span1.getAttributeValue("style");
+ assertNotNull(style);
+ assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
+
+ HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
+ assertNotNull(span2);
+ assertEquals("span", span2.getTagName());
+ style = span2.getAttributeValue("style");
+ assertNotNull(style);
+ assertTrue(style.matches("display\\s*\\:\\s*none\\s*\\;\\s*"));
+ }
+
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ assertEquals(getCountValidScripts(page, javaScripts, IS_PAGE_AVAILABILITY_CHECK).intValue(), javaScripts.size());
+
+ HtmlElement span1 = page.getHtmlElementById(push1.getClientId(facesContext));
+ assertNotNull(span1);
+ scripts = span1.getHtmlElementsByTagName("script");
+ int i = 0;
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ DomText text = (DomText) item.getFirstChild();
+
+ assertNotNull(text);
+ assertTrue(text.asText().contains("A4J.AJAX.Push"));
+
+ i++;
+ }
+ assertEquals(1, i);
+
+ HtmlElement span2 = page.getHtmlElementById(push2.getClientId(facesContext));
+ assertNotNull(span2);
+ scripts = span2.getHtmlElementsByTagName("script");
+ i = 0;
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ DomText text = (DomText) item.getFirstChild();
+
+ assertNotNull(text);
+ assertTrue(text.asText().contains("A4J.AJAX.StopPush"));
+
+ i++;
+ }
+ assertEquals(1, i);
+ }
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/AjaxStatusRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,153 +1,153 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.ajax4jsf.renderkit.html;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIGraphic;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIAjaxStatus;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class AjaxStatusRendererTest extends AbstractAjax4JsfTestCase {
- private UIForm form = null;
- private UIAjaxStatus status1 = null;
- private UIAjaxStatus status2 = null;
-
- public AjaxStatusRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- application.addComponent("org.ajax4jsf.AjaxStatus", "org.ajax4jsf.component.html.HtmlAjaxStatus");
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- status1 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
- status1.setId("status1");
- status1.setStartStyle("color: red;");
- status1.setStartStyleClass("A B C D");
- status1.setStopStyle("color: green;");
- status1.setStopStyleClass("X Y Z");
- status1.setStartText("startText");
- status1.setStopText("stopText");
- status1.getAttributes().put("layout", "block");
-
- status2 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
- status2.setId("status2");
- status2.setStartStyle("color: red;");
- status2.setStartStyleClass("A B C D");
- status2.setStopStyle("color: green;");
- status2.setStopStyleClass("X Y Z");
- status2.getAttributes().put("layout", "inline");
-
- UIGraphic startImage = new UIGraphic();
- startImage.setValue("start.png");
- startImage.getAttributes().put("alt", "alt");
- status2.getFacets().put("start", startImage);
-
- UIGraphic stopGraphic = new UIGraphic();
- stopGraphic.setValue("stop.png");
- stopGraphic.getAttributes().put("alt", "alt");
- status2.getFacets().put("stop", stopGraphic);
-
- form.getChildren().add(status1);
- form.getChildren().add(status2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- status1 = null;
- status2 = null;
- form = null;
- }
-
- /**
- * Test rendering
- *
- * @throws Exception
- */
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement div = page.getHtmlElementById(status1.getClientId(facesContext));
- assertNotNull(div);
- assertEquals("div", div.getNodeName());
-
- Iterator childIterator = div.getChildIterator();
- int i = 0;
- while (childIterator.hasNext()) {
- i++;
- HtmlElement element = (HtmlElement) childIterator.next();
- assertEquals("div", element.getNodeName());
- }
- assertEquals(2, i);
-
- HtmlElement div1 = page.getHtmlElementById(status1.getClientId(facesContext) + ".start");
- assertNotNull(div1);
- String style1 = div1.getAttributeValue("style");
- assertNotNull(style1);
- assertTrue(style1.contains("color: red;"));
- String class1 = div1.getAttributeValue("class");
- assertNotNull(class1);
- assertEquals(class1, "A B C D");
-
- HtmlElement div2 = page.getHtmlElementById(status1.getClientId(facesContext) + ".stop");
- assertNotNull(div2);
- String style2 = div2.getAttributeValue("style");
- assertNotNull(style2);
- assertTrue(style2.contains("color: green;"));
- String class2 = div2.getAttributeValue("class");
- assertNotNull(class2);
- assertEquals(class2, "X Y Z");
-
- form.getChildren().remove(0);
- page = renderView();
- System.out.println(page.asXml());
-
- HtmlElement span = (HtmlElement) div.getNextSibling();
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
-
- childIterator = span.getChildIterator();
- i = 0;
- while (childIterator.hasNext()) {
- i++;
- HtmlElement element = (HtmlElement) childIterator.next();
- assertEquals("span", element.getNodeName());
- assertEquals("img", element.getFirstChild().getNodeName());
- }
- assertEquals(2, i);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.ajax4jsf.renderkit.html;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIGraphic;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIAjaxStatus;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class AjaxStatusRendererTest extends AbstractAjax4JsfTestCase {
+ private UIForm form = null;
+ private UIAjaxStatus status1 = null;
+ private UIAjaxStatus status2 = null;
+
+ public AjaxStatusRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent("org.ajax4jsf.AjaxStatus", "org.ajax4jsf.component.html.HtmlAjaxStatus");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ status1 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
+ status1.setId("status1");
+ status1.setStartStyle("color: red;");
+ status1.setStartStyleClass("A B C D");
+ status1.setStopStyle("color: green;");
+ status1.setStopStyleClass("X Y Z");
+ status1.setStartText("startText");
+ status1.setStopText("stopText");
+ status1.getAttributes().put("layout", "block");
+
+ status2 = (UIAjaxStatus)application.createComponent(UIAjaxStatus.COMPONENT_TYPE);
+ status2.setId("status2");
+ status2.setStartStyle("color: red;");
+ status2.setStartStyleClass("A B C D");
+ status2.setStopStyle("color: green;");
+ status2.setStopStyleClass("X Y Z");
+ status2.getAttributes().put("layout", "inline");
+
+ UIGraphic startImage = new UIGraphic();
+ startImage.setValue("start.png");
+ startImage.getAttributes().put("alt", "alt");
+ status2.getFacets().put("start", startImage);
+
+ UIGraphic stopGraphic = new UIGraphic();
+ stopGraphic.setValue("stop.png");
+ stopGraphic.getAttributes().put("alt", "alt");
+ status2.getFacets().put("stop", stopGraphic);
+
+ form.getChildren().add(status1);
+ form.getChildren().add(status2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ status1 = null;
+ status2 = null;
+ form = null;
+ }
+
+ /**
+ * Test rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement div = page.getHtmlElementById(status1.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals("div", div.getNodeName());
+
+ Iterator childIterator = div.getChildIterator();
+ int i = 0;
+ while (childIterator.hasNext()) {
+ i++;
+ HtmlElement element = (HtmlElement) childIterator.next();
+ assertEquals("div", element.getNodeName());
+ }
+ assertEquals(2, i);
+
+ HtmlElement div1 = page.getHtmlElementById(status1.getClientId(facesContext) + ".start");
+ assertNotNull(div1);
+ String style1 = div1.getAttributeValue("style");
+ assertNotNull(style1);
+ assertTrue(style1.contains("color: red;"));
+ String class1 = div1.getAttributeValue("class");
+ assertNotNull(class1);
+ assertEquals(class1, "A B C D");
+
+ HtmlElement div2 = page.getHtmlElementById(status1.getClientId(facesContext) + ".stop");
+ assertNotNull(div2);
+ String style2 = div2.getAttributeValue("style");
+ assertNotNull(style2);
+ assertTrue(style2.contains("color: green;"));
+ String class2 = div2.getAttributeValue("class");
+ assertNotNull(class2);
+ assertEquals(class2, "X Y Z");
+
+ form.getChildren().remove(0);
+ page = renderView();
+ System.out.println(page.asXml());
+
+ HtmlElement span = (HtmlElement) div.getNextSibling();
+ assertNotNull(span);
+ assertEquals("span", span.getNodeName());
+
+ childIterator = span.getChildIterator();
+ i = 0;
+ while (childIterator.hasNext()) {
+ i++;
+ HtmlElement element = (HtmlElement) childIterator.next();
+ assertEquals("span", element.getNodeName());
+ assertEquals("img", element.getFirstChild().getNodeName());
+ }
+ assertEquals(2, i);
+ }
+
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/HtmlCommandLinkRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,139 +1,139 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit.html;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlCommandLink;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class HtmlCommandLinkRendererTest extends AbstractAjax4JsfTestCase {
- /** Set with required javascripts for Editor */
- private static Set<String> javaScripts = new HashSet<String>();
-
- static {
- javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
- }
-
- private UIForm form = null;
- private HtmlCommandLink link1 = null;
- private HtmlCommandLink link2 = null;
-
- public HtmlCommandLinkRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- facesContext.getRenderKit().addRenderer(HtmlCommandLink.COMPONENT_FAMILY, "org.ajax4jsf.Link", new HtmlCommandLinkRenderer());
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- link1 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
- link1.setId("link1");
- link1.setValue("link1");
- link1.getAttributes().put("disabled", Boolean.FALSE);
- link1.setRendererType("org.ajax4jsf.Link");
- form.getChildren().add(link1);
-
- link2 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
- link2.setId("link2");
- link2.setValue("link2");
- link2.getAttributes().put("disabled", Boolean.TRUE);
- link2.setRendererType("org.ajax4jsf.Link");
- form.getChildren().add(link2);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- link1 = null;
- link2 = null;
- form = null;
- }
-
- public void testRendered() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement href = page.getHtmlElementById(link1.getClientId(facesContext));
- assertNotNull(href);
- assertEquals("a", href.getTagName());
-
- String onclick = href.getAttributeValue("onclick");
- assertNotNull(onclick);
- assertTrue(onclick.contains(AjaxFormRenderer.FORM_SUBMIT_FUNCTION_NAME));
-
- HtmlElement span = page.getHtmlElementById(link2.getClientId(facesContext));
- assertNotNull(span);
- assertEquals("span", span.getTagName());
-
- String disabled = span.getAttributeValue("disabled");
- assertNotNull(disabled);
- assertEquals("disabled", disabled);
- }
-
- /**
- * Method to test if required scripts is present on page
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- public void testLinkScripts() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- List scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(
- "script");
-
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- String srcAttr = item.getSrcAttribute();
- if (StringUtils.isNotBlank(srcAttr)) {
- boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
- found = srcAttr.contains(src);
- if (found) {
- break;
- }
- }
- assertTrue(found);
- }
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class HtmlCommandLinkRendererTest extends AbstractAjax4JsfTestCase {
+ /** Set with required javascripts for Editor */
+ private static Set<String> javaScripts = new HashSet<String>();
+
+ static {
+ javaScripts.add("org/ajax4jsf/javascript/scripts/form.js");
+ }
+
+ private UIForm form = null;
+ private HtmlCommandLink link1 = null;
+ private HtmlCommandLink link2 = null;
+
+ public HtmlCommandLinkRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ facesContext.getRenderKit().addRenderer(HtmlCommandLink.COMPONENT_FAMILY, "org.ajax4jsf.Link", new HtmlCommandLinkRenderer());
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ link1 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
+ link1.setId("link1");
+ link1.setValue("link1");
+ link1.getAttributes().put("disabled", Boolean.FALSE);
+ link1.setRendererType("org.ajax4jsf.Link");
+ form.getChildren().add(link1);
+
+ link2 = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
+ link2.setId("link2");
+ link2.setValue("link2");
+ link2.getAttributes().put("disabled", Boolean.TRUE);
+ link2.setRendererType("org.ajax4jsf.Link");
+ form.getChildren().add(link2);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ link1 = null;
+ link2 = null;
+ form = null;
+ }
+
+ public void testRendered() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement href = page.getHtmlElementById(link1.getClientId(facesContext));
+ assertNotNull(href);
+ assertEquals("a", href.getTagName());
+
+ String onclick = href.getAttributeValue("onclick");
+ assertNotNull(onclick);
+ assertTrue(onclick.contains(AjaxFormRenderer.FORM_SUBMIT_FUNCTION_NAME));
+
+ HtmlElement span = page.getHtmlElementById(link2.getClientId(facesContext));
+ assertNotNull(span);
+ assertEquals("span", span.getTagName());
+
+ String disabled = span.getAttributeValue("disabled");
+ assertNotNull(disabled);
+ assertEquals("disabled", disabled);
+ }
+
+ /**
+ * Method to test if required scripts is present on page
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ public void testLinkScripts() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(
+ "script");
+
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+ assertTrue(found);
+ }
+ }
+ }
+
+}
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/renderkit/html/MediaOutputRendererTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,141 +1,141 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit.html;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIParameter;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.component.UIMediaOutput;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class MediaOutputRendererTest extends AbstractAjax4JsfTestCase {
- UIForm form = null;
- UIMediaOutput media1 = null;
- UIMediaOutput media2 = null;
- UIMediaOutput media3 = null;
- UIMediaOutput media4 = null;
- UIMediaOutput media5 = null;
-
- public MediaOutputRendererTest(String name) {
- super(name);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- application.addComponent("org.ajax4jsf.MMedia", "org.ajax4jsf.component.html.MediaOutput");
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- media1 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media1.setId("media1");
- media1.setElement("a");
- media1.setUriAttribute("href");
- form.getChildren().add(media1);
-
- media2 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media2.setId("media2");
- media2.setElement("img");
- media2.setUriAttribute("src");
- media2.getAttributes().put("alt", "Generated value");
- form.getChildren().add(media2);
-
- media3 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media3.setId("media3");
- media3.setElement("object");
- media3.setUriAttribute("data");
- form.getChildren().add(media3);
-
- media4 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media4.setId("media4");
- media4.setElement("a");
- UIParameter param = new UIParameter();
- param.setName("name");
- param.setValue("value");
- media4.getChildren().add(param);
- form.getChildren().add(media4);
-
- media5 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
- media5.setId("media5");
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- media1 = null;
- media2 = null;
- media3 = null;
- media4 = null;
- media5 = null;
- form = null;
- }
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- System.out.println(page.asXml());
-
- HtmlElement a = page.getHtmlElementById(media1.getClientId(facesContext));
- assertNotNull(a);
- assertEquals("a", a.getTagName());
- String href = a.getAttributeValue("href");
- assertNotNull(href);
-
- HtmlElement img = page.getHtmlElementById(media2.getClientId(facesContext));
- assertNotNull(img);
- assertEquals("img", img.getTagName());
- String src = img.getAttributeValue("src");
- assertNotNull(src);
-
- HtmlElement object = page.getHtmlElementById(media3.getClientId(facesContext));
- assertNotNull(object);
- assertEquals("object", object.getTagName());
- String data = object.getAttributeValue("data");
- assertNotNull(data);
-
- // Rendering without uriAttribute
- HtmlElement a2 = page.getHtmlElementById(media4.getClientId(facesContext));
- assertNotNull(a2);
- assertEquals("a", a2.getTagName());
- String href2 = a2.getAttributeValue("href");
- assertNotNull(href2);
- assertTrue(href2.endsWith("name=value"));
- }
-
- public void testRenderWithoutElement() throws Exception {
- form.getChildren().add(media5);
- try {
- renderView();
- assertTrue("'element' is undefined but exception was not thrown", false);
- } catch (FacesException e) {
-
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit.html;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIParameter;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.component.UIMediaOutput;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class MediaOutputRendererTest extends AbstractAjax4JsfTestCase {
+ UIForm form = null;
+ UIMediaOutput media1 = null;
+ UIMediaOutput media2 = null;
+ UIMediaOutput media3 = null;
+ UIMediaOutput media4 = null;
+ UIMediaOutput media5 = null;
+
+ public MediaOutputRendererTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent("org.ajax4jsf.MMedia", "org.ajax4jsf.component.html.MediaOutput");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ media1 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media1.setId("media1");
+ media1.setElement("a");
+ media1.setUriAttribute("href");
+ form.getChildren().add(media1);
+
+ media2 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media2.setId("media2");
+ media2.setElement("img");
+ media2.setUriAttribute("src");
+ media2.getAttributes().put("alt", "Generated value");
+ form.getChildren().add(media2);
+
+ media3 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media3.setId("media3");
+ media3.setElement("object");
+ media3.setUriAttribute("data");
+ form.getChildren().add(media3);
+
+ media4 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media4.setId("media4");
+ media4.setElement("a");
+ UIParameter param = new UIParameter();
+ param.setName("name");
+ param.setValue("value");
+ media4.getChildren().add(param);
+ form.getChildren().add(media4);
+
+ media5 = (UIMediaOutput)application.createComponent(UIMediaOutput.COMPONENT_TYPE);
+ media5.setId("media5");
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ media1 = null;
+ media2 = null;
+ media3 = null;
+ media4 = null;
+ media5 = null;
+ form = null;
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+ HtmlElement a = page.getHtmlElementById(media1.getClientId(facesContext));
+ assertNotNull(a);
+ assertEquals("a", a.getTagName());
+ String href = a.getAttributeValue("href");
+ assertNotNull(href);
+
+ HtmlElement img = page.getHtmlElementById(media2.getClientId(facesContext));
+ assertNotNull(img);
+ assertEquals("img", img.getTagName());
+ String src = img.getAttributeValue("src");
+ assertNotNull(src);
+
+ HtmlElement object = page.getHtmlElementById(media3.getClientId(facesContext));
+ assertNotNull(object);
+ assertEquals("object", object.getTagName());
+ String data = object.getAttributeValue("data");
+ assertNotNull(data);
+
+ // Rendering without uriAttribute
+ HtmlElement a2 = page.getHtmlElementById(media4.getClientId(facesContext));
+ assertNotNull(a2);
+ assertEquals("a", a2.getTagName());
+ String href2 = a2.getAttributeValue("href");
+ assertNotNull(href2);
+ assertTrue(href2.endsWith("name=value"));
+ }
+
+ public void testRenderWithoutElement() throws Exception {
+ form.getChildren().add(media5);
+ try {
+ renderView();
+ assertTrue("'element' is undefined but exception was not thrown", false);
+ } catch (FacesException e) {
+
+ }
+ }
+
+}
Modified: trunk/ui/dataFilterSlider/src/main/templates/dataFilterSlider.jspx
===================================================================
--- trunk/ui/dataFilterSlider/src/main/templates/dataFilterSlider.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataFilterSlider/src/main/templates/dataFilterSlider.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -38,7 +38,7 @@
</jsp:scriptlet>
<div id="#{clientId}slider-track" class="track rich-dataFilterSlider-track #{component.trackStyleClass}" style="width:#{component.attributes['width']}">
<div id="#{clientId}slider-handle" class="handle rich-dataFilterSlider-handle #{component.handleStyleClass}">
- <img src="#{arrow}" width="7" height="8" alt=" " style="border:0" />
+ <img src="#{arrow}" width="7" height="8" alt="" style="border:0" />
</div>
</div>
@@ -100,4 +100,4 @@
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java
===================================================================
--- trunk/ui/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataFilterSlider/src/test/java/org/richfaces/component/DataFilterSliderComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -319,4 +319,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/ColumnsIterator.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/ColumnsIterator.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/ColumnsIterator.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,80 +1,80 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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 java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-
-/**
- * Iterator for all children table columns.
- * @author asmirnov
- *
- */
-class ColumnsIterator implements Iterator<UIComponent>{
-
-
- private UIComponent next;
-
- private boolean initialized = false;
-
- protected Iterator<UIComponent> childrenIterator;
-
- public ColumnsIterator(UIComponent dataTable) {
- this.childrenIterator = dataTable.getChildren().iterator();
- }
-
- public boolean hasNext() {
- if(!initialized){
- next = nextColumn();
- initialized = true;
- }
- return null != next;
- }
-
- public UIComponent next() {
- if (!hasNext()) {
- throw new NoSuchElementException();
- }
- UIComponent result = next;
- next = nextColumn();
- return result;
- }
-
- public void remove() {
- throw new UnsupportedOperationException("Iterator is read-only");
- }
-
- protected UIComponent nextColumn(){
- UIComponent nextColumn = null;
- while (childrenIterator.hasNext()) {
- UIComponent child = childrenIterator.next();
- if(child instanceof UIColumn || child instanceof Column){
- nextColumn = child;
- break;
- }
- }
- return nextColumn;
- }
-
-}
\ No newline at end of file
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+
+/**
+ * Iterator for all children table columns.
+ * @author asmirnov
+ *
+ */
+class ColumnsIterator implements Iterator<UIComponent>{
+
+
+ private UIComponent next;
+
+ private boolean initialized = false;
+
+ protected Iterator<UIComponent> childrenIterator;
+
+ public ColumnsIterator(UIComponent dataTable) {
+ this.childrenIterator = dataTable.getChildren().iterator();
+ }
+
+ public boolean hasNext() {
+ if(!initialized){
+ next = nextColumn();
+ initialized = true;
+ }
+ return null != next;
+ }
+
+ public UIComponent next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ UIComponent result = next;
+ next = nextColumn();
+ return result;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Iterator is read-only");
+ }
+
+ protected UIComponent nextColumn(){
+ UIComponent nextColumn = null;
+ while (childrenIterator.hasNext()) {
+ UIComponent child = childrenIterator.next();
+ if(child instanceof UIColumn || child instanceof Column){
+ nextColumn = child;
+ break;
+ }
+ }
+ return nextColumn;
+ }
+
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/DataIterator.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,78 +1,78 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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 java.util.Iterator;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-
-import org.ajax4jsf.component.AjaxSupport;
-
-class DataIterator extends ColumnsIterator {
-
- protected Iterator<UIComponent> facetsIterator;
-
- public DataIterator(UIComponent dataTable) {
- super(dataTable);
- facetsIterator = dataTable.getFacets().values().iterator();
- }
-
- @Override
- protected UIComponent nextColumn() {
- UIComponent nextColumn = null;
- while (null == nextColumn && childrenIterator.hasNext()) {
- UIComponent child = childrenIterator.next();
- if (child.isRendered()) {
- if (child instanceof UIColumn || child instanceof Column) {
- nextColumn = child;
- } else if (checkAjaxComponent(child)) {
- nextColumn = child;
- }
- }
- }
- while (null == nextColumn && facetsIterator.hasNext()) {
- UIComponent child = facetsIterator.next();
- if (checkAjaxComponent(child)) {
- nextColumn = child;
- break;
- }
- }
- return nextColumn;
- }
-
- /**
- * @param child
- * @return
- */
- protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
- return child.getChildren().iterator();
- }
-
- /**
- * @param child
- * @return
- */
- protected boolean checkAjaxComponent(UIComponent child) {
- return child instanceof AjaxSupport || child instanceof Dropzone;
- }
-
-}
\ No newline at end of file
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 java.util.Iterator;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.component.AjaxSupport;
+
+class DataIterator extends ColumnsIterator {
+
+ protected Iterator<UIComponent> facetsIterator;
+
+ public DataIterator(UIComponent dataTable) {
+ super(dataTable);
+ facetsIterator = dataTable.getFacets().values().iterator();
+ }
+
+ @Override
+ protected UIComponent nextColumn() {
+ UIComponent nextColumn = null;
+ while (null == nextColumn && childrenIterator.hasNext()) {
+ UIComponent child = childrenIterator.next();
+ if (child.isRendered()) {
+ if (child instanceof UIColumn || child instanceof Column) {
+ nextColumn = child;
+ } else if (checkAjaxComponent(child)) {
+ nextColumn = child;
+ }
+ }
+ }
+ while (null == nextColumn && facetsIterator.hasNext()) {
+ UIComponent child = facetsIterator.next();
+ if (checkAjaxComponent(child)) {
+ nextColumn = child;
+ break;
+ }
+ }
+ return nextColumn;
+ }
+
+ /**
+ * @param child
+ * @return
+ */
+ protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
+ return child.getChildren().iterator();
+ }
+
+ /**
+ * @param child
+ * @return
+ */
+ protected boolean checkAjaxComponent(UIComponent child) {
+ return child instanceof AjaxSupport || child instanceof Dropzone;
+ }
+
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/FixedChildrenIterator.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,106 +1,106 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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 java.util.Iterator;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-
-class FixedChildrenIterator extends DataIterator {
-
- private Iterator<UIComponent> currentColumnIterator;
-
- public FixedChildrenIterator(UIComponent dataTable) {
- super(dataTable);
- }
-
- @Override
- protected UIComponent nextColumn() {
- UIComponent nextColumn = null;
- if (null != currentColumnIterator) {
- nextColumn = currentColumnIterator.next();
- checkNextColumnChild();
- } else {
- while (null == nextColumn && childrenIterator.hasNext()) {
- UIComponent child = childrenIterator.next();
- if (child instanceof UIColumn || child instanceof Column) {
- boolean rendered = true;
- try {
- rendered = child.isRendered();
- } catch (Exception e) {
- // This exception can be thrown for a header/footer
- // facets
- // there column rendered attribute was binded to a row
- // variable.
- }
- if (rendered) {
- Iterator<UIComponent> iterator = getColumnChildrenIterator(child);
- if (iterator.hasNext()) {
- currentColumnIterator = iterator;
- nextColumn = currentColumnIterator.next();
- checkNextColumnChild();
- }
-
- }
- } else if (checkAjaxComponent(child)) {
- nextColumn = child;
- }
- }
- }
- if (null == nextColumn) {
- nextColumn = getNextFacet();
- }
- return nextColumn;
- }
-
- /**
- * @param nextColumn
- * @return
- */
- protected UIComponent getNextFacet() {
- UIComponent nextColumn = null;
- while (null == nextColumn && facetsIterator.hasNext()) {
- UIComponent child = facetsIterator.next();
- if (checkAjaxComponent(child)) {
- nextColumn = child;
- }
- }
- return nextColumn;
- }
-
- @Override
- protected boolean checkAjaxComponent(UIComponent child) {
- return !super.checkAjaxComponent(child);
- }
-
- @Override
- protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
- return child.getFacets().values().iterator();
- }
-
- protected void checkNextColumnChild() {
- if (!currentColumnIterator.hasNext()) {
- currentColumnIterator = null;
- }
- }
-
-}
\ No newline at end of file
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 java.util.Iterator;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+
+class FixedChildrenIterator extends DataIterator {
+
+ private Iterator<UIComponent> currentColumnIterator;
+
+ public FixedChildrenIterator(UIComponent dataTable) {
+ super(dataTable);
+ }
+
+ @Override
+ protected UIComponent nextColumn() {
+ UIComponent nextColumn = null;
+ if (null != currentColumnIterator) {
+ nextColumn = currentColumnIterator.next();
+ checkNextColumnChild();
+ } else {
+ while (null == nextColumn && childrenIterator.hasNext()) {
+ UIComponent child = childrenIterator.next();
+ if (child instanceof UIColumn || child instanceof Column) {
+ boolean rendered = true;
+ try {
+ rendered = child.isRendered();
+ } catch (Exception e) {
+ // This exception can be thrown for a header/footer
+ // facets
+ // there column rendered attribute was binded to a row
+ // variable.
+ }
+ if (rendered) {
+ Iterator<UIComponent> iterator = getColumnChildrenIterator(child);
+ if (iterator.hasNext()) {
+ currentColumnIterator = iterator;
+ nextColumn = currentColumnIterator.next();
+ checkNextColumnChild();
+ }
+
+ }
+ } else if (checkAjaxComponent(child)) {
+ nextColumn = child;
+ }
+ }
+ }
+ if (null == nextColumn) {
+ nextColumn = getNextFacet();
+ }
+ return nextColumn;
+ }
+
+ /**
+ * @param nextColumn
+ * @return
+ */
+ protected UIComponent getNextFacet() {
+ UIComponent nextColumn = null;
+ while (null == nextColumn && facetsIterator.hasNext()) {
+ UIComponent child = facetsIterator.next();
+ if (checkAjaxComponent(child)) {
+ nextColumn = child;
+ }
+ }
+ return nextColumn;
+ }
+
+ @Override
+ protected boolean checkAjaxComponent(UIComponent child) {
+ return !super.checkAjaxComponent(child);
+ }
+
+ @Override
+ protected Iterator<UIComponent> getColumnChildrenIterator(UIComponent child) {
+ return child.getFacets().values().iterator();
+ }
+
+ protected void checkNextColumnChild() {
+ if (!currentColumnIterator.hasNext()) {
+ currentColumnIterator = null;
+ }
+ }
+
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/SubtableFixedChildrenIterator.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,39 +1,39 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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 javax.faces.component.UIComponent;
-
-/**
- * @author asmirnov
- *
- */
-public class SubtableFixedChildrenIterator extends FixedChildrenIterator {
-
- public SubtableFixedChildrenIterator(UIComponent dataTable) {
- super(dataTable);
- }
-
- @Override
- protected UIComponent getNextFacet() {
- return null;
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 javax.faces.component.UIComponent;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class SubtableFixedChildrenIterator extends FixedChildrenIterator {
+
+ public SubtableFixedChildrenIterator(UIComponent dataTable) {
+ super(dataTable);
+ }
+
+ @Override
+ protected UIComponent getNextFacet() {
+ return null;
+ }
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/component/UIDataTable.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -195,4 +195,4 @@
super.restoreState(context, states[0]);
sortPriority = (Collection<Object>)states[1];
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -764,4 +764,4 @@
utils2.encodeAttribute(context, table, "onRowContextMenu", "oncontextmenu" );
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,38 +1,38 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-public interface HeaderEncodeStrategy {
-
- public abstract void encodeBegin(FacesContext context, ResponseWriter writer,
- UIComponent column, String facetName, boolean sortableColumn) throws IOException;
-
- public abstract void encodeEnd(FacesContext context, ResponseWriter writer,
- UIComponent column, String facetName, boolean sortableColumn) throws IOException;
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+public interface HeaderEncodeStrategy {
+
+ public abstract void encodeBegin(FacesContext context, ResponseWriter writer,
+ UIComponent column, String facetName, boolean sortableColumn) throws IOException;
+
+ public abstract void encodeEnd(FacesContext context, ResponseWriter writer,
+ UIComponent column, String facetName, boolean sortableColumn) throws IOException;
+
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/TableHolder.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -111,4 +111,4 @@
public void setGridRowCounter(int gridRowCounter) {
this.gridRowCounter = gridRowCounter;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconConstants.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconConstants.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconConstants.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,30 +1,30 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.iconimages;
-
-
-class DataTableIconConstants {
-
- public static final String SORT_ICON_COLOR = "dataTableSortIconColor";
- public static final String SORT_ICON_BORDER_COLOR = "dataTableSortIconBorderColor";
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.iconimages;
+
+
+class DataTableIconConstants {
+
+ public static final String SORT_ICON_COLOR = "dataTableSortIconColor";
+ public static final String SORT_ICON_BORDER_COLOR = "dataTableSortIconBorderColor";
+
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortAsc.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortAsc.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortAsc.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,37 +1,37 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.iconimages;
-
-import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_BORDER_COLOR;
-import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.renderkit.html.images.TriangleIconUp;
-
-public class DataTableIconSortAsc extends TriangleIconUp {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SORT_ICON_COLOR, ICON_COLOR,
- SORT_ICON_BORDER_COLOR, BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.iconimages;
+
+import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_BORDER_COLOR;
+import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.renderkit.html.images.TriangleIconUp;
+
+public class DataTableIconSortAsc extends TriangleIconUp {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SORT_ICON_COLOR, ICON_COLOR,
+ SORT_ICON_BORDER_COLOR, BORDER_COLOR);
+ }
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortDesc.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortDesc.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortDesc.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,37 +1,37 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.iconimages;
-
-import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_BORDER_COLOR;
-import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.renderkit.html.images.TriangleIconDown;
-
-public class DataTableIconSortDesc extends TriangleIconDown {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SORT_ICON_COLOR, ICON_COLOR,
- SORT_ICON_BORDER_COLOR, BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.iconimages;
+
+import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_BORDER_COLOR;
+import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.renderkit.html.images.TriangleIconDown;
+
+public class DataTableIconSortDesc extends TriangleIconDown {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SORT_ICON_COLOR, ICON_COLOR,
+ SORT_ICON_BORDER_COLOR, BORDER_COLOR);
+ }
+}
Modified: trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortNone.java
===================================================================
--- trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortNone.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/java/org/richfaces/renderkit/html/iconimages/DataTableIconSortNone.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,68 +1,68 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.iconimages;
-
-import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_BORDER_COLOR;
-import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_COLOR;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.ResourceContext;
-import org.richfaces.renderkit.html.images.TriangleIconBase;
-
-public class DataTableIconSortNone extends TriangleIconBase {
-
- public Dimension calculateDimensions() {
- return new Dimension(13, 4);
- }
-
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
- g2d.translate(4, 3);
-
- g2d.setColor(textColor);
- g2d.drawLine(3, 1, 3, 1);
- g2d.drawLine(2, 2, 4, 2);
- g2d.drawLine(1, 3, 5, 3);
-
- g2d.drawLine(3, 7, 3, 7);
- g2d.drawLine(2, 6, 4, 6);
- g2d.drawLine(1, 5, 5, 5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(0, 3, 3, 0);
- g2d.drawLine(3, 0, 6, 3);
- g2d.drawLine(5, 4, 1, 4);
-
- g2d.drawLine(0, 5, 3, 8);
- g2d.drawLine(3, 8, 6, 5);
- }
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SORT_ICON_COLOR, ICON_COLOR,
- SORT_ICON_BORDER_COLOR, BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.iconimages;
+
+import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_BORDER_COLOR;
+import static org.richfaces.renderkit.html.iconimages.DataTableIconConstants.SORT_ICON_COLOR;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.ResourceContext;
+import org.richfaces.renderkit.html.images.TriangleIconBase;
+
+public class DataTableIconSortNone extends TriangleIconBase {
+
+ public Dimension calculateDimensions() {
+ return new Dimension(13, 4);
+ }
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+ g2d.translate(4, 3);
+
+ g2d.setColor(textColor);
+ g2d.drawLine(3, 1, 3, 1);
+ g2d.drawLine(2, 2, 4, 2);
+ g2d.drawLine(1, 3, 5, 3);
+
+ g2d.drawLine(3, 7, 3, 7);
+ g2d.drawLine(2, 6, 4, 6);
+ g2d.drawLine(1, 5, 5, 5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(0, 3, 3, 0);
+ g2d.drawLine(3, 0, 6, 3);
+ g2d.drawLine(5, 4, 1, 4);
+
+ g2d.drawLine(0, 5, 3, 8);
+ g2d.drawLine(3, 8, 6, 5);
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SORT_ICON_COLOR, ICON_COLOR,
+ SORT_ICON_BORDER_COLOR, BORDER_COLOR);
+ }
+}
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/htmlColgroup.jspx
===================================================================
--- trunk/ui/dataTable/src/main/templates/org/richfaces/htmlColgroup.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/templates/org/richfaces/htmlColgroup.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -11,8 +11,8 @@
component="org.richfaces.component.UIColumnGroup"
>
<f:clientid var="clientId"/>
- <tr id="#{clientId}"
+ <tr id="#{clientId}"
x:passThruWithExclusions="id" >
<vcp:body />
</tr>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataDefinitionList.jspx
===================================================================
--- trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataDefinitionList.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataDefinitionList.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -19,4 +19,4 @@
<f:call name="encodeRows"/>
</vcp:body>
</dl>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataGrid.jspx
===================================================================
--- trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataGrid.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataGrid.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -16,7 +16,7 @@
<table id="#{clientId}"
class="dr-table rich-table #{component.attributes['styleClass']}"
x:passThruWithExclusions="value,name,type,class,id"
- >
+ >
<f:call name="encodeCaption" />
<colgroup span="#{component.attributes['columns']}">
</colgroup>
@@ -28,4 +28,4 @@
</vcp:body>
</tbody>
</table>
-</f:root>
+</f:root>
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx
===================================================================
--- trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/templates/org/richfaces/htmlDataTable.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -13,17 +13,17 @@
component="org.richfaces.component.UIDataTable"
>
<h:styles>css/table.xcss</h:styles>
- <h:scripts>
- new org.ajax4jsf.javascript.AjaxScript(),
- new org.ajax4jsf.javascript.PrototypeScript(),
- /org/richfaces/renderkit/html/scripts/data-table.js
+ <h:scripts>
+ new org.ajax4jsf.javascript.AjaxScript(),
+ new org.ajax4jsf.javascript.PrototypeScript(),
+ /org/richfaces/renderkit/html/scripts/data-table.js
</h:scripts>
<f:clientid var="clientId"/>
<table id="#{clientId}"
class="dr-table rich-table #{component.attributes['styleClass']}" style="#{component.attributes['style']}" >
-
- <f:call name="utils.encodePassThruWithExclusions">
- <f:parameter value="value,name,type,id,class,rows,style" />
+
+ <f:call name="utils.encodePassThruWithExclusions">
+ <f:parameter value="value,name,type,id,class,rows,style" />
</f:call>
<f:call name="encodeTableStructure"/>
@@ -32,4 +32,4 @@
<f:call name="encodeTBody"/>
</vcp:body>
</table>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/dataTable/src/main/templates/org/richfaces/htmlSubTable.jspx
===================================================================
--- trunk/ui/dataTable/src/main/templates/org/richfaces/htmlSubTable.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/main/templates/org/richfaces/htmlSubTable.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -15,4 +15,4 @@
x:passThruWithExclusions="value,name,type,id"
>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java
===================================================================
--- trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/test/java/org/richfaces/component/DataTableComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -294,4 +294,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/DataTableRenderingTest.java
===================================================================
--- trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/DataTableRenderingTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/DataTableRenderingTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,406 +1,406 @@
-/**
- * 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.renderkit;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.component.html.HtmlOutputLink;
-import javax.faces.component.html.HtmlOutputText;
-import javax.faces.model.ListDataModel;
-
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.UIColumn;
-import org.richfaces.component.UIColumnGroup;
-import org.richfaces.component.UIDataTable;
-
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-public class DataTableRenderingTest extends AbstractAjax4JsfTestCase {
-
- private UIDataTable dataTable;
-
- private UIColumn column1;
-
- private UIColumn column2;
-
- private UIForm form = null;
-
- private UIColumnGroup columnGroup;
-
- /**
- * Create the test case
- *
- * @param testName
- * name of the test case
- */
- public DataTableRenderingTest(String name) {
- super(name);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
- dataTable = (UIDataTable) application
- .createComponent("org.richfaces.DataTable");
- dataTable.setId("dataTable");
-
- List<Date> list = new ArrayList<Date>();
- for (int i = 1; i <= 5; i++) {
- list.add(new Date((long) Math.random()));
- }
- dataTable.setValue(new ListDataModel(list));
-
- columnGroup = (UIColumnGroup) application
- .createComponent("org.richfaces.ColumnGroup");
- dataTable.getChildren().add(columnGroup);
-
- column1 = (UIColumn) application
- .createComponent("org.richfaces.Column");
- UIOutput cellElement1 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- cellElement1.setValueExpression("column", new ColumnValueExpression());
- column1.getChildren().add(cellElement1);
- columnGroup.getChildren().add(column1);
-
- column2 = (UIColumn) application
- .createComponent("org.richfaces.Column");
- UIOutput cellElement2 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputLink.class.getName(),
- null, null, null);
- cellElement2.setValueExpression("value", new ColumnValueExpression());
- column2.getChildren().add(cellElement2);
- columnGroup.getChildren().add(column2);
-
- javax.faces.component.UIColumn column3 = new javax.faces.component.UIColumn();
- UIOutput cellElement3 = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
- cellElement3.setValue("value");
- column3.getChildren().add(cellElement3);
- dataTable.getChildren().add(column3);
-
- form.getChildren().add(dataTable);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- public void tearDown() throws Exception {
- super.tearDown();
-
- column1 = null;
- column2 = null;
- columnGroup = null;
- dataTable = null;
- }
-
- /**
- * Test DataTable component rendering.
- *
- * @throws Exception
- */
- public void testRenderDataTable() throws Exception {
-
- dataTable.getAttributes().put("columnsWidth", "400px,200px");
-
- UIColumn column3 = (UIColumn) application
- .createComponent("org.richfaces.Column");
- dataTable.getChildren().add(column3);
- UIOutput text = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- text.setValue("Column");
- column3.getChildren().add(text);
- column3.setBreakBefore(true);
-
- UIColumn column4 = (UIColumn) application
- .createComponent("org.richfaces.Column");
- dataTable.getChildren().add(column4);
- UIOutput text2 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- text.setValue("Column2");
- column4.getChildren().add(text2);
- column4.setRendered(false);
-
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement table = page.getHtmlElementById(dataTable
- .getClientId(facesContext));
- assertNotNull(table);
- assertEquals("table", table.getNodeName());
- String classAttr = table.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table rich-table"));
-
- List<HtmlElement> elements = table.getHtmlElementsByTagName("col");
- assertEquals(2, elements.size());
- classAttr = ((HtmlElement) elements.get(0)).getAttributeValue("width");
- assertTrue(classAttr.contains("400px"));
- classAttr = ((HtmlElement) elements.get(1)).getAttributeValue("width");
- assertTrue(classAttr.contains("200px"));
-
- List<HtmlElement> bodies = table.getHtmlElementsByTagName("tbody");
- assertEquals(1, bodies.size());
- List<HtmlElement> trs = ((HtmlElement) bodies.get(0)).getHtmlElementsByTagName("tr");
- assertTrue(trs.size() > 0);
- HtmlElement tr = (HtmlElement) trs.get(0);
- assertNotNull(tr);
- classAttr = tr.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table-firstrow rich-table-firstrow"));
-
- Iterator<HtmlElement> tds = tr.getChildIterator();
- assertTrue(tds.hasNext());
- HtmlElement td = (HtmlElement) tds.next();
- assertNotNull(td);
- classAttr = td.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table-cell rich-table-cell"));
- }
-
- /**
- * Test DataTable component facets rendering.
- *
- * @throws Exception
- */
- public void testRenderDataTableFacets() throws Exception {
-
- UIColumnGroup header1 = (UIColumnGroup) application
- .createComponent("org.richfaces.ColumnGroup");
- header1.getAttributes().put("columnClasses", "cola, colb");
- dataTable.getFacets().put("header", header1);
-
- UIColumn headerColumn1 = (UIColumn) application
- .createComponent("org.richfaces.Column");
- UIOutput headerText1 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- headerText1.setValue("Header Column1");
- headerColumn1.getChildren().add(headerText1);
- header1.getChildren().add(headerColumn1);
-
- UIOutput column1header = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- column1header.setValue("Column1 Header");
- headerColumn1.getFacets().put("header", column1header);
-
- UIColumn headerColumn2 = (UIColumn) application
- .createComponent("org.richfaces.Column");
- UIOutput headerText2 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- headerText2.setValue("Header Column2");
- headerColumn2.getChildren().add(headerText2);
- header1.getChildren().add(headerColumn2);
-
- UIOutput column2header = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- column2header.setValue("Column2 Header");
- headerColumn2.getFacets().put("header", column2header);
-
- UIOutput caption = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- dataTable.getFacets().put("caption", caption);
- caption.setValue("Caption");
-
- UIOutput footer = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- dataTable.getFacets().put("footer", footer);
- footer.setValue("Footer");
-
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement table = page.getHtmlElementById(dataTable
- .getClientId(facesContext));
- assertNotNull(table);
-
- List<HtmlElement> captions = table.getHtmlElementsByTagName("caption");
- assertNotNull(captions);
- assertEquals(1, captions.size());
- String classAttr = ((HtmlElement) captions.get(0))
- .getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table-caption rich-table-caption"));
-
- List<HtmlElement> headers = table.getHtmlElementsByTagName("thead");
- assertNotNull(headers);
- assertEquals(1, headers.size());
- List<HtmlElement> trs = ((HtmlElement) headers.get(0))
- .getHtmlElementsByTagName("tr");
- assertTrue(trs.size() > 0);
- HtmlElement tr = (HtmlElement) trs.get(0);
- assertNotNull(tr);
- classAttr = tr.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table-header rich-table-header"));
-
- Iterator<HtmlElement> tds = tr.getChildIterator();
- assertNotNull(tds);
- assertTrue(tds.hasNext());
- HtmlElement td = tds.next();
- assertNotNull(td);
- classAttr = td.getAttributeValue("class");
- assertTrue(classAttr
- .contains("dr-table-headercell rich-table-headercell"));
- assertTrue(classAttr.contains("cola"));
-
- List<HtmlElement> footers = table.getHtmlElementsByTagName("tfoot");
- assertNotNull(footers);
- assertEquals(1, footers.size());
- trs = ((HtmlElement) footers.get(0)).getHtmlElementsByTagName("tr");
- assertTrue(trs.size() > 0);
- tr = (HtmlElement) trs.get(0);
- assertNotNull(tr);
- classAttr = tr.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table-footer rich-table-footer "));
-
- tds = tr.getChildIterator();
- assertTrue(tds.hasNext());
- td = tds.next();
- assertNotNull(td);
- classAttr = td.getAttributeValue("class");
- assertTrue(classAttr.contains("dr-table-footercell rich-table-footercell "));
-
- Iterator fixedChildren = dataTable.fixedChildren();
- assertNotNull(fixedChildren);
- assertTrue(fixedChildren.hasNext());
- }
-
- /**
- * Test DataTable component rows and columns rendering.
- *
- * @throws Exception
- */
- public void testRenderDataTableRowsAndColumns() throws Exception {
-
- UIOutput caption = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
- null, null, null);
- dataTable.getFacets().put("caption", caption);
- caption.setValue("Caption");
- dataTable.getAttributes().put("captionClass", "captionClass");
- dataTable.getAttributes().put("captionStyle", "captionStyle");
-
- dataTable.getAttributes().put("rowClasses", "row1,row2");
- dataTable.getAttributes().put("columnClasses", "column1,column2");
-
- column1.getAttributes().put("styleClass", "column1StyleClass");
- column2.getAttributes().put("styleClass", "");
-
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement table = page.getHtmlElementById(dataTable
- .getClientId(facesContext));
- assertNotNull(table);
-
- List<HtmlElement> captions = table.getHtmlElementsByTagName("caption");
- assertNotNull(captions);
- assertEquals(1, captions.size());
- String classAttr = ((HtmlElement) captions.get(0))
- .getAttributeValue("class");
- assertTrue(classAttr.contains("captionClass"));
- classAttr = ((HtmlElement) captions.get(0)).getAttributeValue("style");
- assertTrue(classAttr.contains("captionStyle"));
-
- List<HtmlElement> bodies = table.getHtmlElementsByTagName("tbody");
- assertTrue(bodies.size() > 0);
- List<HtmlElement> trs = ((HtmlElement) bodies.get(0)).getHtmlElementsByTagName("tr");
- assertTrue(trs.size() > 0);
- HtmlElement tr = (HtmlElement) trs.get(0);
- assertNotNull(tr);
- classAttr = tr.getAttributeValue("class");
- assertTrue(classAttr.contains("row1"));
-
- List<HtmlElement> tds = tr.getHtmlElementsByTagName("td");
- assertTrue(tds.size() > 0);
- HtmlElement td = (HtmlElement) tds.get(0);
- assertNotNull(td);
- classAttr = td.getAttributeValue("class");
- assertTrue(classAttr.contains("column1"));
- assertTrue(classAttr.contains("column1StyleClass"));
- }
-
- protected class ColumnValueExpression extends ValueExpression {
-
- private static final long serialVersionUID = -4572752019634445014L;
-
- public Class<?> getExpectedType() {
- return null;
- }
-
- public Class<?> getType(ELContext context) {
- return String.class;
- }
-
- public Object getValue(ELContext context) {
- return Long.toString(((Date) dataTable.getValue()).getTime());
- }
-
- public boolean isReadOnly(ELContext context) {
- return false;
- }
-
- public void setValue(ELContext context, Object value) {
-
- }
-
- public boolean equals(Object obj) {
- return false;
- }
-
- public String getExpressionString() {
- return null;
- }
-
- public int hashCode() {
- return 0;
- }
-
- public boolean isLiteralText() {
- return false;
- }
-
- }
-
-}
+/**
+ * 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.renderkit;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputLink;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.model.ListDataModel;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.UIColumn;
+import org.richfaces.component.UIColumnGroup;
+import org.richfaces.component.UIDataTable;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+public class DataTableRenderingTest extends AbstractAjax4JsfTestCase {
+
+ private UIDataTable dataTable;
+
+ private UIColumn column1;
+
+ private UIColumn column2;
+
+ private UIForm form = null;
+
+ private UIColumnGroup columnGroup;
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+ public DataTableRenderingTest(String name) {
+ super(name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+ dataTable = (UIDataTable) application
+ .createComponent("org.richfaces.DataTable");
+ dataTable.setId("dataTable");
+
+ List<Date> list = new ArrayList<Date>();
+ for (int i = 1; i <= 5; i++) {
+ list.add(new Date((long) Math.random()));
+ }
+ dataTable.setValue(new ListDataModel(list));
+
+ columnGroup = (UIColumnGroup) application
+ .createComponent("org.richfaces.ColumnGroup");
+ dataTable.getChildren().add(columnGroup);
+
+ column1 = (UIColumn) application
+ .createComponent("org.richfaces.Column");
+ UIOutput cellElement1 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ cellElement1.setValueExpression("column", new ColumnValueExpression());
+ column1.getChildren().add(cellElement1);
+ columnGroup.getChildren().add(column1);
+
+ column2 = (UIColumn) application
+ .createComponent("org.richfaces.Column");
+ UIOutput cellElement2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputLink.class.getName(),
+ null, null, null);
+ cellElement2.setValueExpression("value", new ColumnValueExpression());
+ column2.getChildren().add(cellElement2);
+ columnGroup.getChildren().add(column2);
+
+ javax.faces.component.UIColumn column3 = new javax.faces.component.UIColumn();
+ UIOutput cellElement3 = (UIOutput) application.createComponent(UIOutput.COMPONENT_TYPE);
+ cellElement3.setValue("value");
+ column3.getChildren().add(cellElement3);
+ dataTable.getChildren().add(column3);
+
+ form.getChildren().add(dataTable);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ column1 = null;
+ column2 = null;
+ columnGroup = null;
+ dataTable = null;
+ }
+
+ /**
+ * Test DataTable component rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderDataTable() throws Exception {
+
+ dataTable.getAttributes().put("columnsWidth", "400px,200px");
+
+ UIColumn column3 = (UIColumn) application
+ .createComponent("org.richfaces.Column");
+ dataTable.getChildren().add(column3);
+ UIOutput text = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ text.setValue("Column");
+ column3.getChildren().add(text);
+ column3.setBreakBefore(true);
+
+ UIColumn column4 = (UIColumn) application
+ .createComponent("org.richfaces.Column");
+ dataTable.getChildren().add(column4);
+ UIOutput text2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ text.setValue("Column2");
+ column4.getChildren().add(text2);
+ column4.setRendered(false);
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement table = page.getHtmlElementById(dataTable
+ .getClientId(facesContext));
+ assertNotNull(table);
+ assertEquals("table", table.getNodeName());
+ String classAttr = table.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table rich-table"));
+
+ List<HtmlElement> elements = table.getHtmlElementsByTagName("col");
+ assertEquals(2, elements.size());
+ classAttr = ((HtmlElement) elements.get(0)).getAttributeValue("width");
+ assertTrue(classAttr.contains("400px"));
+ classAttr = ((HtmlElement) elements.get(1)).getAttributeValue("width");
+ assertTrue(classAttr.contains("200px"));
+
+ List<HtmlElement> bodies = table.getHtmlElementsByTagName("tbody");
+ assertEquals(1, bodies.size());
+ List<HtmlElement> trs = ((HtmlElement) bodies.get(0)).getHtmlElementsByTagName("tr");
+ assertTrue(trs.size() > 0);
+ HtmlElement tr = (HtmlElement) trs.get(0);
+ assertNotNull(tr);
+ classAttr = tr.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table-firstrow rich-table-firstrow"));
+
+ Iterator<HtmlElement> tds = tr.getChildIterator();
+ assertTrue(tds.hasNext());
+ HtmlElement td = (HtmlElement) tds.next();
+ assertNotNull(td);
+ classAttr = td.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table-cell rich-table-cell"));
+ }
+
+ /**
+ * Test DataTable component facets rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderDataTableFacets() throws Exception {
+
+ UIColumnGroup header1 = (UIColumnGroup) application
+ .createComponent("org.richfaces.ColumnGroup");
+ header1.getAttributes().put("columnClasses", "cola, colb");
+ dataTable.getFacets().put("header", header1);
+
+ UIColumn headerColumn1 = (UIColumn) application
+ .createComponent("org.richfaces.Column");
+ UIOutput headerText1 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ headerText1.setValue("Header Column1");
+ headerColumn1.getChildren().add(headerText1);
+ header1.getChildren().add(headerColumn1);
+
+ UIOutput column1header = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ column1header.setValue("Column1 Header");
+ headerColumn1.getFacets().put("header", column1header);
+
+ UIColumn headerColumn2 = (UIColumn) application
+ .createComponent("org.richfaces.Column");
+ UIOutput headerText2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ headerText2.setValue("Header Column2");
+ headerColumn2.getChildren().add(headerText2);
+ header1.getChildren().add(headerColumn2);
+
+ UIOutput column2header = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ column2header.setValue("Column2 Header");
+ headerColumn2.getFacets().put("header", column2header);
+
+ UIOutput caption = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ dataTable.getFacets().put("caption", caption);
+ caption.setValue("Caption");
+
+ UIOutput footer = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ dataTable.getFacets().put("footer", footer);
+ footer.setValue("Footer");
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement table = page.getHtmlElementById(dataTable
+ .getClientId(facesContext));
+ assertNotNull(table);
+
+ List<HtmlElement> captions = table.getHtmlElementsByTagName("caption");
+ assertNotNull(captions);
+ assertEquals(1, captions.size());
+ String classAttr = ((HtmlElement) captions.get(0))
+ .getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table-caption rich-table-caption"));
+
+ List<HtmlElement> headers = table.getHtmlElementsByTagName("thead");
+ assertNotNull(headers);
+ assertEquals(1, headers.size());
+ List<HtmlElement> trs = ((HtmlElement) headers.get(0))
+ .getHtmlElementsByTagName("tr");
+ assertTrue(trs.size() > 0);
+ HtmlElement tr = (HtmlElement) trs.get(0);
+ assertNotNull(tr);
+ classAttr = tr.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table-header rich-table-header"));
+
+ Iterator<HtmlElement> tds = tr.getChildIterator();
+ assertNotNull(tds);
+ assertTrue(tds.hasNext());
+ HtmlElement td = tds.next();
+ assertNotNull(td);
+ classAttr = td.getAttributeValue("class");
+ assertTrue(classAttr
+ .contains("dr-table-headercell rich-table-headercell"));
+ assertTrue(classAttr.contains("cola"));
+
+ List<HtmlElement> footers = table.getHtmlElementsByTagName("tfoot");
+ assertNotNull(footers);
+ assertEquals(1, footers.size());
+ trs = ((HtmlElement) footers.get(0)).getHtmlElementsByTagName("tr");
+ assertTrue(trs.size() > 0);
+ tr = (HtmlElement) trs.get(0);
+ assertNotNull(tr);
+ classAttr = tr.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table-footer rich-table-footer "));
+
+ tds = tr.getChildIterator();
+ assertTrue(tds.hasNext());
+ td = tds.next();
+ assertNotNull(td);
+ classAttr = td.getAttributeValue("class");
+ assertTrue(classAttr.contains("dr-table-footercell rich-table-footercell "));
+
+ Iterator fixedChildren = dataTable.fixedChildren();
+ assertNotNull(fixedChildren);
+ assertTrue(fixedChildren.hasNext());
+ }
+
+ /**
+ * Test DataTable component rows and columns rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderDataTableRowsAndColumns() throws Exception {
+
+ UIOutput caption = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),
+ null, null, null);
+ dataTable.getFacets().put("caption", caption);
+ caption.setValue("Caption");
+ dataTable.getAttributes().put("captionClass", "captionClass");
+ dataTable.getAttributes().put("captionStyle", "captionStyle");
+
+ dataTable.getAttributes().put("rowClasses", "row1,row2");
+ dataTable.getAttributes().put("columnClasses", "column1,column2");
+
+ column1.getAttributes().put("styleClass", "column1StyleClass");
+ column2.getAttributes().put("styleClass", "");
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement table = page.getHtmlElementById(dataTable
+ .getClientId(facesContext));
+ assertNotNull(table);
+
+ List<HtmlElement> captions = table.getHtmlElementsByTagName("caption");
+ assertNotNull(captions);
+ assertEquals(1, captions.size());
+ String classAttr = ((HtmlElement) captions.get(0))
+ .getAttributeValue("class");
+ assertTrue(classAttr.contains("captionClass"));
+ classAttr = ((HtmlElement) captions.get(0)).getAttributeValue("style");
+ assertTrue(classAttr.contains("captionStyle"));
+
+ List<HtmlElement> bodies = table.getHtmlElementsByTagName("tbody");
+ assertTrue(bodies.size() > 0);
+ List<HtmlElement> trs = ((HtmlElement) bodies.get(0)).getHtmlElementsByTagName("tr");
+ assertTrue(trs.size() > 0);
+ HtmlElement tr = (HtmlElement) trs.get(0);
+ assertNotNull(tr);
+ classAttr = tr.getAttributeValue("class");
+ assertTrue(classAttr.contains("row1"));
+
+ List<HtmlElement> tds = tr.getHtmlElementsByTagName("td");
+ assertTrue(tds.size() > 0);
+ HtmlElement td = (HtmlElement) tds.get(0);
+ assertNotNull(td);
+ classAttr = td.getAttributeValue("class");
+ assertTrue(classAttr.contains("column1"));
+ assertTrue(classAttr.contains("column1StyleClass"));
+ }
+
+ protected class ColumnValueExpression extends ValueExpression {
+
+ private static final long serialVersionUID = -4572752019634445014L;
+
+ public Class<?> getExpectedType() {
+ return null;
+ }
+
+ public Class<?> getType(ELContext context) {
+ return String.class;
+ }
+
+ public Object getValue(ELContext context) {
+ return Long.toString(((Date) dataTable.getValue()).getTime());
+ }
+
+ public boolean isReadOnly(ELContext context) {
+ return false;
+ }
+
+ public void setValue(ELContext context, Object value) {
+
+ }
+
+ public boolean equals(Object obj) {
+ return false;
+ }
+
+ public String getExpressionString() {
+ return null;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
+ public boolean isLiteralText() {
+ return false;
+ }
+
+ }
+
+}
Modified: trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/SortableHeaderRenderingTest.java
===================================================================
--- trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/SortableHeaderRenderingTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dataTable/src/test/java/org/richfaces/renderkit/SortableHeaderRenderingTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,383 +1,383 @@
-/**
- * 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.renderkit;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.component.html.HtmlOutputText;
-import javax.faces.model.ListDataModel;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-import org.richfaces.component.UIColumn;
-import org.richfaces.component.UIDataTable;
-import org.richfaces.model.Ordering;
-import org.richfaces.renderkit.html.iconimages.DataTableIconSortAsc;
-
-import com.gargoylesoftware.htmlunit.html.DomText;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class SortableHeaderRenderingTest extends AbstractAjax4JsfTestCase {
- private static final int ROWS_COUNT = 10;
-
- private static Set<String> javaScripts = new HashSet<String>();
- static {
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- javaScripts.add("org/richfaces/renderkit/html/scripts/data-table.js");
- javaScripts.add("scripts/inplaceinput.js");
- javaScripts.add("scripts/utils.js");
- }
-
- ListDataModel model;
-
- private UIDataTable dataTable;
-
- private UIColumn column1;
-
- private UIColumn column2;
-
- private UIForm form = null;
-
- private Comparator<Date> comparator;
-
- /**
- * Create the test case
- *
- * @param testName
- * name of the test case
- */
- public SortableHeaderRenderingTest(String name) {
- super(name);
- }
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
-
- comparator = new SortComparator();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
- dataTable = (UIDataTable) application
- .createComponent("org.richfaces.DataTable");
- dataTable.setId("dataTable");
-
- List<Date> list = new ArrayList<Date>();
- for (int i = 0; i < ROWS_COUNT; i++) {
- list.add(new Date((long) Math.random()));
- }
- model = new ListDataModel(list);
- dataTable.setValue(model);
- dataTable.setVar("var");
-
- column1 = (UIColumn) application.createComponent("org.richfaces.Column");
- UIOutput cellElement1 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
- cellElement1.setValueExpression("value", new ColumnOneExpression());
-
- column1.getChildren().add(cellElement1);
- column1.setId("column1");
- column1.setSortOrder(Ordering.ASCENDING);
- column1.setValueExpression("comparator", new ComparatorExpression());
-
- UIOutput facet1 = new HtmlOutputText();
- facet1.setValue("sort");
- column1.getFacets().put("header", facet1);
-
- dataTable.getChildren().add(column1);
-
- column2 = (UIColumn) application.createComponent("org.richfaces.Column");
- column2.setId("column2");
- UIOutput cellElement2 = (UIOutput) createComponent(
- HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
- cellElement2.setValueExpression("value", new ColumnTwoExpression());
- column2.setFilterValue("filterValue");
- column2.setValueExpression("filterBy", new ColumnTwoExpression());
-
-
- column2.getChildren().add(cellElement2);
- dataTable.getChildren().add(column2);
-
- form.getChildren().add(dataTable);
- }
-
- @Override
- public void tearDown() throws Exception {
- model = null;
- form = null;
- column1 = null;
- column2 = null;
- dataTable = null;
-
- super.tearDown();
- }
-
- /**
- * Test sortable header rendering.
- *
- * @throws Exception
- */
- public void testRenderSortableHeader() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- List<HtmlElement> headers = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.th_ELEM);
- assertNotNull(headers);
- assertEquals(2, headers.size());
-
- HtmlElement th = headers.get(0);
- assertNotNull(th);
- String onclick = th.getAttributeValue(HTML.onclick_ATTRIBUTE);
- assertNotNull(onclick);
- assertTrue(onclick.startsWith("A4J.AJAX.Submit"));
-
- HtmlElement div = (HtmlElement) th.getFirstDomChild();
- assertNotNull(div);
- assertEquals(HTML.DIV_ELEM, div.getTagName());
- assertNull(div.getNextDomSibling());
-
- HtmlElement span = (HtmlElement) div.getFirstDomChild();
- assertNotNull(span);
- assertEquals(HTML.SPAN_ELEM, span.getTagName());
- assertNull(span.getNextDomSibling());
-
- String clazz = span.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- //assertTrue(clazz.contains("dr-table-header-sort-up"));
- assertTrue(clazz.contains("dr-table-sortable-header"));
-
- DomText text = (DomText) span.getFirstDomChild();
- assertNotNull(text);
-
- HtmlElement img = (HtmlElement) text.getNextDomSibling();
- assertNotNull(img);
- assertEquals(HTML.IMG_ELEMENT, img.getTagName());
- assertNull(img.getNextDomSibling());
-
- String src = img.getAttributeValue(HTML.src_ATTRIBUTE);
- assertNotNull(src);
- assertTrue(src.contains(DataTableIconSortAsc.class.getName()));
- }
-
- /**
- * Test filtered header rendering.
- *
- * @throws Exception
- */
- public void testRenderFilteredHeader() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- List<HtmlElement> headers = page.getDocumentElement().getHtmlElementsByTagName(HTML.th_ELEM);
- assertNotNull(headers);
- assertEquals(2, headers.size());
-
- HtmlElement th = headers.get(1);
- assertNotNull(th);
-
- HtmlElement div = (HtmlElement) th.getFirstChild();
- assertNotNull(div);
- assertEquals(HTML.DIV_ELEM, div.getTagName());
- assertNull(div.getFirstChild());
-
- div = (HtmlElement) div.getNextSibling();
- assertNotNull(div);
- assertEquals(HTML.DIV_ELEM, div.getTagName());
- assertNull(div.getNextSibling());
-
- List<HtmlElement> spans= div.getHtmlElementsByTagName(HTML.SPAN_ELEM);
- assertNotNull(spans);
- if (1 == spans.size()) { // inplace input is used
- HtmlElement span = spans.get(0);
- String clazz = span.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue(clazz.contains("rich-inplace-view"));
- } else { // simple inputText
- HtmlElement input = (HtmlElement) div.getFirstChild();
- assertNotNull(input);
- assertEquals(HTML.INPUT_ELEM, input.getTagName());
- }
- }
-
- /**
- * Test filtered data rendering
- *
- * @throws Exception
- */
- public void testRenderFilteredData() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement table = page.getHtmlElementById(dataTable.getClientId(facesContext));
- assertNotNull(table);
-
- HtmlElement tbody = table.getHtmlElementById(dataTable.getClientId(facesContext)+ ":tb");
- assertNotNull(tbody);
- assertNull(tbody.getFirstChild());
-
- tearDown();
- setUp();
-
- column2.setFilterValue(null);
- column2.setValueExpression("filterBy", null);
-
- page = renderView();
- assertNotNull(page);
-
- table = page.getHtmlElementById(dataTable.getClientId(facesContext));
- assertNotNull(table);
-
- tbody = table.getHtmlElementById(dataTable.getClientId(facesContext)+ ":tb");
- assertNotNull(tbody);
- assertNotNull(tbody.getFirstChild());
-
- int count = 0;
- Iterator<HtmlElement> it = tbody.getChildElementsIterator();
- while (it.hasNext()) {
- HtmlElement tr = it.next();
- count++;
- }
- assertEquals(ROWS_COUNT, count);
- }
-
- public void testScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- List<HtmlScript> scripts = page.getDocumentElement().getHtmlElementsByTagName(
- "script");
- int foundCount = 0;
- for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- String srcAttr = item.getSrcAttribute();
-
- if (StringUtils.isNotBlank(srcAttr)) {
- boolean found = false;
- for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
-
- found = srcAttr.contains(src);
- if (found) {
- foundCount++;
- break;
- }
- }
-
- assertTrue(found);
- }
- }
- }
-
- protected class ColumnOneExpression extends ValueExpression {
-
- private static final long serialVersionUID = -60617505361080421L;
-
- @Override
- public Class<?> getExpectedType() {
- return String.class;
- }
-
- @Override
- public Class<?> getType(ELContext context) {
- return String.class;
- }
-
- @Override
- public Object getValue(ELContext context) {
- return ((Date)model.getRowData()).getTime();
- }
-
- @Override
- public boolean isReadOnly(ELContext context) {
- return false;
- }
-
- @Override
- public void setValue(ELContext context, Object value) {
-
- }
-
- @Override
- public boolean equals(Object obj) {
- return false;
- }
-
- @Override
- public String getExpressionString() {
- return null;
- }
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- @Override
- public boolean isLiteralText() {
- return false;
- }
- }
-
- protected class ColumnTwoExpression extends ColumnOneExpression {
-
- private static final long serialVersionUID = -865017340246458449L;
-
- @Override
- public Object getValue(ELContext context) {
- return ((Date)model.getRowData()).getTimezoneOffset();
- }
- }
-
- protected class ComparatorExpression extends ColumnOneExpression {
-
- private static final long serialVersionUID = -865017340246458449L;
-
- @Override
- public Object getValue(ELContext context) {
- return comparator;
- }
- }
-
- protected class SortComparator implements Comparator<Date> {
-
- public int compare(Date o1, Date o2) {
- return o1.compareTo(o2);
- }
-
- }
-
-}
+/**
+ * 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.renderkit;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.model.ListDataModel;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+import org.richfaces.component.UIColumn;
+import org.richfaces.component.UIDataTable;
+import org.richfaces.model.Ordering;
+import org.richfaces.renderkit.html.iconimages.DataTableIconSortAsc;
+
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class SortableHeaderRenderingTest extends AbstractAjax4JsfTestCase {
+ private static final int ROWS_COUNT = 10;
+
+ private static Set<String> javaScripts = new HashSet<String>();
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/data-table.js");
+ javaScripts.add("scripts/inplaceinput.js");
+ javaScripts.add("scripts/utils.js");
+ }
+
+ ListDataModel model;
+
+ private UIDataTable dataTable;
+
+ private UIColumn column1;
+
+ private UIColumn column2;
+
+ private UIForm form = null;
+
+ private Comparator<Date> comparator;
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+ public SortableHeaderRenderingTest(String name) {
+ super(name);
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ comparator = new SortComparator();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+ dataTable = (UIDataTable) application
+ .createComponent("org.richfaces.DataTable");
+ dataTable.setId("dataTable");
+
+ List<Date> list = new ArrayList<Date>();
+ for (int i = 0; i < ROWS_COUNT; i++) {
+ list.add(new Date((long) Math.random()));
+ }
+ model = new ListDataModel(list);
+ dataTable.setValue(model);
+ dataTable.setVar("var");
+
+ column1 = (UIColumn) application.createComponent("org.richfaces.Column");
+ UIOutput cellElement1 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
+ cellElement1.setValueExpression("value", new ColumnOneExpression());
+
+ column1.getChildren().add(cellElement1);
+ column1.setId("column1");
+ column1.setSortOrder(Ordering.ASCENDING);
+ column1.setValueExpression("comparator", new ComparatorExpression());
+
+ UIOutput facet1 = new HtmlOutputText();
+ facet1.setValue("sort");
+ column1.getFacets().put("header", facet1);
+
+ dataTable.getChildren().add(column1);
+
+ column2 = (UIColumn) application.createComponent("org.richfaces.Column");
+ column2.setId("column2");
+ UIOutput cellElement2 = (UIOutput) createComponent(
+ HtmlOutputText.COMPONENT_TYPE, HtmlOutputText.class.getName(),null, null, null);
+ cellElement2.setValueExpression("value", new ColumnTwoExpression());
+ column2.setFilterValue("filterValue");
+ column2.setValueExpression("filterBy", new ColumnTwoExpression());
+
+
+ column2.getChildren().add(cellElement2);
+ dataTable.getChildren().add(column2);
+
+ form.getChildren().add(dataTable);
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ model = null;
+ form = null;
+ column1 = null;
+ column2 = null;
+ dataTable = null;
+
+ super.tearDown();
+ }
+
+ /**
+ * Test sortable header rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderSortableHeader() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List<HtmlElement> headers = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.th_ELEM);
+ assertNotNull(headers);
+ assertEquals(2, headers.size());
+
+ HtmlElement th = headers.get(0);
+ assertNotNull(th);
+ String onclick = th.getAttributeValue(HTML.onclick_ATTRIBUTE);
+ assertNotNull(onclick);
+ assertTrue(onclick.startsWith("A4J.AJAX.Submit"));
+
+ HtmlElement div = (HtmlElement) th.getFirstDomChild();
+ assertNotNull(div);
+ assertEquals(HTML.DIV_ELEM, div.getTagName());
+ assertNull(div.getNextDomSibling());
+
+ HtmlElement span = (HtmlElement) div.getFirstDomChild();
+ assertNotNull(span);
+ assertEquals(HTML.SPAN_ELEM, span.getTagName());
+ assertNull(span.getNextDomSibling());
+
+ String clazz = span.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ //assertTrue(clazz.contains("dr-table-header-sort-up"));
+ assertTrue(clazz.contains("dr-table-sortable-header"));
+
+ DomText text = (DomText) span.getFirstDomChild();
+ assertNotNull(text);
+
+ HtmlElement img = (HtmlElement) text.getNextDomSibling();
+ assertNotNull(img);
+ assertEquals(HTML.IMG_ELEMENT, img.getTagName());
+ assertNull(img.getNextDomSibling());
+
+ String src = img.getAttributeValue(HTML.src_ATTRIBUTE);
+ assertNotNull(src);
+ assertTrue(src.contains(DataTableIconSortAsc.class.getName()));
+ }
+
+ /**
+ * Test filtered header rendering.
+ *
+ * @throws Exception
+ */
+ public void testRenderFilteredHeader() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ List<HtmlElement> headers = page.getDocumentElement().getHtmlElementsByTagName(HTML.th_ELEM);
+ assertNotNull(headers);
+ assertEquals(2, headers.size());
+
+ HtmlElement th = headers.get(1);
+ assertNotNull(th);
+
+ HtmlElement div = (HtmlElement) th.getFirstChild();
+ assertNotNull(div);
+ assertEquals(HTML.DIV_ELEM, div.getTagName());
+ assertNull(div.getFirstChild());
+
+ div = (HtmlElement) div.getNextSibling();
+ assertNotNull(div);
+ assertEquals(HTML.DIV_ELEM, div.getTagName());
+ assertNull(div.getNextSibling());
+
+ List<HtmlElement> spans= div.getHtmlElementsByTagName(HTML.SPAN_ELEM);
+ assertNotNull(spans);
+ if (1 == spans.size()) { // inplace input is used
+ HtmlElement span = spans.get(0);
+ String clazz = span.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue(clazz.contains("rich-inplace-view"));
+ } else { // simple inputText
+ HtmlElement input = (HtmlElement) div.getFirstChild();
+ assertNotNull(input);
+ assertEquals(HTML.INPUT_ELEM, input.getTagName());
+ }
+ }
+
+ /**
+ * Test filtered data rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderFilteredData() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement table = page.getHtmlElementById(dataTable.getClientId(facesContext));
+ assertNotNull(table);
+
+ HtmlElement tbody = table.getHtmlElementById(dataTable.getClientId(facesContext)+ ":tb");
+ assertNotNull(tbody);
+ assertNull(tbody.getFirstChild());
+
+ tearDown();
+ setUp();
+
+ column2.setFilterValue(null);
+ column2.setValueExpression("filterBy", null);
+
+ page = renderView();
+ assertNotNull(page);
+
+ table = page.getHtmlElementById(dataTable.getClientId(facesContext));
+ assertNotNull(table);
+
+ tbody = table.getHtmlElementById(dataTable.getClientId(facesContext)+ ":tb");
+ assertNotNull(tbody);
+ assertNotNull(tbody.getFirstChild());
+
+ int count = 0;
+ Iterator<HtmlElement> it = tbody.getChildElementsIterator();
+ while (it.hasNext()) {
+ HtmlElement tr = it.next();
+ count++;
+ }
+ assertEquals(ROWS_COUNT, count);
+ }
+
+ public void testScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List<HtmlScript> scripts = page.getDocumentElement().getHtmlElementsByTagName(
+ "script");
+ int foundCount = 0;
+ for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ foundCount++;
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ }
+
+ protected class ColumnOneExpression extends ValueExpression {
+
+ private static final long serialVersionUID = -60617505361080421L;
+
+ @Override
+ public Class<?> getExpectedType() {
+ return String.class;
+ }
+
+ @Override
+ public Class<?> getType(ELContext context) {
+ return String.class;
+ }
+
+ @Override
+ public Object getValue(ELContext context) {
+ return ((Date)model.getRowData()).getTime();
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext context) {
+ return false;
+ }
+
+ @Override
+ public void setValue(ELContext context, Object value) {
+
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return false;
+ }
+
+ @Override
+ public String getExpressionString() {
+ return null;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ @Override
+ public boolean isLiteralText() {
+ return false;
+ }
+ }
+
+ protected class ColumnTwoExpression extends ColumnOneExpression {
+
+ private static final long serialVersionUID = -865017340246458449L;
+
+ @Override
+ public Object getValue(ELContext context) {
+ return ((Date)model.getRowData()).getTimezoneOffset();
+ }
+ }
+
+ protected class ComparatorExpression extends ColumnOneExpression {
+
+ private static final long serialVersionUID = -865017340246458449L;
+
+ @Override
+ public Object getValue(ELContext context) {
+ return comparator;
+ }
+ }
+
+ protected class SortComparator implements Comparator<Date> {
+
+ public int compare(Date o1, Date o2) {
+ return o1.compareTo(o2);
+ }
+
+ }
+
+}
Modified: trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx
===================================================================
--- trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/datascroller/src/main/templates/org/richfaces/htmlDatascroller.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -360,4 +360,4 @@
Event.observe('#{clientId}', 'rich:datascroller:onscroll', #{this:getSubmitFunction(context,component)});
</script>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
===================================================================
--- trunk/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -17,7 +17,7 @@
new org.ajax4jsf.javascript.DnDScript(),
/org/richfaces/renderkit/html/scripts/utils.js,
/org/richfaces/renderkit/html/scripts/json/json-dom.js,
- /org/richfaces/renderkit/html/scripts/dnd/dnd-common.js,
+ /org/richfaces/renderkit/html/scripts/dnd/dnd-common.js,
/org/richfaces/renderkit/html/scripts/browser_info.js,
scripts/drag-indicator.js
</h:scripts>
Modified: trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
===================================================================
--- trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,260 +1,260 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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 java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
-import javax.servlet.http.HttpServletResponse;
-
-import org.ajax4jsf.event.EventsQueue;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceBuilderImpl;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.ajax4jsf.tests.MockViewRoot;
-import org.apache.commons.collections.Buffer;
-import org.apache.commons.lang.StringUtils;
-import org.richfaces.renderkit.DraggableRendererContributor;
-import org.richfaces.renderkit.DropzoneRendererContributor;
-
-import com.gargoylesoftware.htmlunit.Page;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-/**
- * Unit test for simple Component.
- */
-public class DragDropTest extends AbstractAjax4JsfTestCase {
-
- private UIDndParam dndparam;
-
- private UIDragIndicator dndindicator;
-
- private UIDragSupport dragsupport;
-
- private UIDropSupport dropsupport;
-
- private UIPanel panel1, panel2;
-
- private UIComponent form;
-
- private static final String CSS_FILE_PATH = "org/richfaces/renderkit/html/css/dragIndicator.xcss";
-
- private static Set javaScripts = new HashSet();
- static {
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- javaScripts.add("scripts/browser_info.js");
- javaScripts.add("org.ajax4jsf.javascript.DnDScript");
- javaScripts.add("scripts/events.js");
- javaScripts.add("scripts/utils.js");
- javaScripts.add("scripts/simple-draggable.js");
- javaScripts.add("scripts/simple-dropzone.js");
- javaScripts.add("scripts/json/json-mini.js");
- javaScripts.add("scripts/json/json-dom.js");
- javaScripts.add("scripts/dnd/dnd-common.js");
- javaScripts.add("scripts/dnd/dnd-dropzone.js");
- javaScripts.add("scripts/dnd/dnd-draggable.js");
- javaScripts.add("scripts/drag-indicator.js");
- }
- private static Set eventsSet = new HashSet();
- static {
- eventsSet.add("org.richfaces.component.html.HtmlDragSupport");
- eventsSet.add("org.richfaces.component.html.HtmlDropSupport");
-
- }
-
- public DragDropTest(String testName) {
- super(testName);
- }
-
- public void setUp() throws Exception {
-
- super.setUp();
-
- form = new HtmlForm();
- assertNotNull(form);
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- panel1 = new UIPanel();
- panel1.setId("panel1");
-
- panel2 = new UIPanel();
- panel2.setId("panel2");
-
- dndparam = (UIDndParam) application
- .createComponent("org.richfaces.DndParam");
- dndparam.setId("dndparam");
-
- dndindicator = (UIDragIndicator) application
- .createComponent(UIDragIndicator.COMPONENT_TYPE);
- dndindicator.setId("dndindicator");
-
- dragsupport = (UIDragSupport) application
- .createComponent("org.richfaces.DragSupport");
- dragsupport.setId("dragsupport");
- dragsupport.setDragType("foto");
- // panel1.getChildren().add(dragsupport);
-
- dropsupport = (UIDropSupport) application
- .createComponent("org.richfaces.DropSupport");
- dropsupport.setId("dropsupport");
- dropsupport.setAcceptedTypes("foto");
- // panel2.getChildren().add(dropsupport);
-
- form.getChildren().add(panel1);
- form.getChildren().add(dndindicator);
- form.getChildren().add(dndparam);
- form.getChildren().add(dragsupport);
- form.getChildren().add(dropsupport);
-
- form.getChildren().add(panel2);
-
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- this.form = null;
- this.dndindicator = null;
- this.dragsupport = null;
- this.dropsupport = null;
- this.dndparam = null;
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- HtmlElement htmlDnDIndicator = page.getHtmlElementById(dndindicator
- .getClientId(facesContext));
- assertTrue(htmlDnDIndicator.getAttributeValue("class").contains(
- "drag_indicator"));
-
- // HtmlElement htmlDnDParam =
- // page.getHtmlElementById(dndparam.getClientId(facesContext));
- // assertTrue(htmlDnDParam.getNodeName().equals("script"));
-
- HtmlElement htmlDragSupport = page.getHtmlElementById(dragsupport
- .getClientId(facesContext));
- assertTrue(htmlDragSupport.getNodeName().equals("script"));
- assertTrue(dragsupport.getDragType().equals("foto"));
-
- HtmlElement htmlDropSupport = page.getHtmlElementById(dropsupport
- .getClientId(facesContext));
- assertTrue(htmlDropSupport.getNodeName().equals("script"));
- assertTrue(dropsupport.getAcceptedTypes().equals("foto"));
- }
-
- public void testScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- List scripts = page.getDocumentElement().getHtmlElementsByTagName(
- "script");
- //System.out.println(page.asXml());
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- String srcAttr = item.getSrcAttribute();
-
- if (StringUtils.isNotBlank(srcAttr)) {
- boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
-
- found = srcAttr.contains(src);
- if (found) {
- break;
- }
- }
-
- assertTrue(found);
- }
- }
-
- }
-
- public void testDecode() throws Exception {
- externalContext.addRequestParameterMap(
- DraggableRendererContributor.DRAG_SOURCE_ID, dragsupport
- .getClientId(facesContext));
- externalContext.addRequestParameterMap(
- DropzoneRendererContributor.DROP_TARGET_ID, dropsupport
- .getClientId(facesContext));
-
- dragsupport.decode(facesContext);
- dropsupport.decode(facesContext);
-
-
-
-
- MockViewRoot root = (MockViewRoot) facesContext.getViewRoot();
- EventsQueue queue = root
- .getEventsQueue(PhaseId.ANY_PHASE);
- assertNotNull(queue);
- while (true) {
- try {
- FacesEvent event = queue.remove();
- boolean found = false;
- for (Iterator srcIt = eventsSet.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
- found = event.toString().contains(src);
- if (found) {
- break;
- }
- }
- assertTrue(found);
- } catch (NoSuchElementException e) {
- break;
- }
- }
-
- }
-
- /**
- * Test style rendering
- *
- * @throws Exception
- */
- public void testRenderStyle() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- List links = page.getDocumentElement().getHtmlElementsByTagName("link");
- assertEquals(1, links.size());
- HtmlElement link = (HtmlElement) links.get(0);
- assertTrue(link.getAttributeValue("href").contains(CSS_FILE_PATH));
-
- assertNotNull(getResourceIfPresent(CSS_FILE_PATH));
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.event.EventsQueue;
+import org.ajax4jsf.resource.InternetResource;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.ResourceBuilderImpl;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockViewRoot;
+import org.apache.commons.collections.Buffer;
+import org.apache.commons.lang.StringUtils;
+import org.richfaces.renderkit.DraggableRendererContributor;
+import org.richfaces.renderkit.DropzoneRendererContributor;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * Unit test for simple Component.
+ */
+public class DragDropTest extends AbstractAjax4JsfTestCase {
+
+ private UIDndParam dndparam;
+
+ private UIDragIndicator dndindicator;
+
+ private UIDragSupport dragsupport;
+
+ private UIDropSupport dropsupport;
+
+ private UIPanel panel1, panel2;
+
+ private UIComponent form;
+
+ private static final String CSS_FILE_PATH = "org/richfaces/renderkit/html/css/dragIndicator.xcss";
+
+ private static Set javaScripts = new HashSet();
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("scripts/browser_info.js");
+ javaScripts.add("org.ajax4jsf.javascript.DnDScript");
+ javaScripts.add("scripts/events.js");
+ javaScripts.add("scripts/utils.js");
+ javaScripts.add("scripts/simple-draggable.js");
+ javaScripts.add("scripts/simple-dropzone.js");
+ javaScripts.add("scripts/json/json-mini.js");
+ javaScripts.add("scripts/json/json-dom.js");
+ javaScripts.add("scripts/dnd/dnd-common.js");
+ javaScripts.add("scripts/dnd/dnd-dropzone.js");
+ javaScripts.add("scripts/dnd/dnd-draggable.js");
+ javaScripts.add("scripts/drag-indicator.js");
+ }
+ private static Set eventsSet = new HashSet();
+ static {
+ eventsSet.add("org.richfaces.component.html.HtmlDragSupport");
+ eventsSet.add("org.richfaces.component.html.HtmlDropSupport");
+
+ }
+
+ public DragDropTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+
+ super.setUp();
+
+ form = new HtmlForm();
+ assertNotNull(form);
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ panel1 = new UIPanel();
+ panel1.setId("panel1");
+
+ panel2 = new UIPanel();
+ panel2.setId("panel2");
+
+ dndparam = (UIDndParam) application
+ .createComponent("org.richfaces.DndParam");
+ dndparam.setId("dndparam");
+
+ dndindicator = (UIDragIndicator) application
+ .createComponent(UIDragIndicator.COMPONENT_TYPE);
+ dndindicator.setId("dndindicator");
+
+ dragsupport = (UIDragSupport) application
+ .createComponent("org.richfaces.DragSupport");
+ dragsupport.setId("dragsupport");
+ dragsupport.setDragType("foto");
+ // panel1.getChildren().add(dragsupport);
+
+ dropsupport = (UIDropSupport) application
+ .createComponent("org.richfaces.DropSupport");
+ dropsupport.setId("dropsupport");
+ dropsupport.setAcceptedTypes("foto");
+ // panel2.getChildren().add(dropsupport);
+
+ form.getChildren().add(panel1);
+ form.getChildren().add(dndindicator);
+ form.getChildren().add(dndparam);
+ form.getChildren().add(dragsupport);
+ form.getChildren().add(dropsupport);
+
+ form.getChildren().add(panel2);
+
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ this.form = null;
+ this.dndindicator = null;
+ this.dragsupport = null;
+ this.dropsupport = null;
+ this.dndparam = null;
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testComponent() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ HtmlElement htmlDnDIndicator = page.getHtmlElementById(dndindicator
+ .getClientId(facesContext));
+ assertTrue(htmlDnDIndicator.getAttributeValue("class").contains(
+ "drag_indicator"));
+
+ // HtmlElement htmlDnDParam =
+ // page.getHtmlElementById(dndparam.getClientId(facesContext));
+ // assertTrue(htmlDnDParam.getNodeName().equals("script"));
+
+ HtmlElement htmlDragSupport = page.getHtmlElementById(dragsupport
+ .getClientId(facesContext));
+ assertTrue(htmlDragSupport.getNodeName().equals("script"));
+ assertTrue(dragsupport.getDragType().equals("foto"));
+
+ HtmlElement htmlDropSupport = page.getHtmlElementById(dropsupport
+ .getClientId(facesContext));
+ assertTrue(htmlDropSupport.getNodeName().equals("script"));
+ assertTrue(dropsupport.getAcceptedTypes().equals("foto"));
+ }
+
+ public void testScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName(
+ "script");
+ //System.out.println(page.asXml());
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+
+ }
+
+ public void testDecode() throws Exception {
+ externalContext.addRequestParameterMap(
+ DraggableRendererContributor.DRAG_SOURCE_ID, dragsupport
+ .getClientId(facesContext));
+ externalContext.addRequestParameterMap(
+ DropzoneRendererContributor.DROP_TARGET_ID, dropsupport
+ .getClientId(facesContext));
+
+ dragsupport.decode(facesContext);
+ dropsupport.decode(facesContext);
+
+
+
+
+ MockViewRoot root = (MockViewRoot) facesContext.getViewRoot();
+ EventsQueue queue = root
+ .getEventsQueue(PhaseId.ANY_PHASE);
+ assertNotNull(queue);
+ while (true) {
+ try {
+ FacesEvent event = queue.remove();
+ boolean found = false;
+ for (Iterator srcIt = eventsSet.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+ found = event.toString().contains(src);
+ if (found) {
+ break;
+ }
+ }
+ assertTrue(found);
+ } catch (NoSuchElementException e) {
+ break;
+ }
+ }
+
+ }
+
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ assertEquals(1, links.size());
+ HtmlElement link = (HtmlElement) links.get(0);
+ assertTrue(link.getAttributeValue("href").contains(CSS_FILE_PATH));
+
+ assertNotNull(getResourceIfPresent(CSS_FILE_PATH));
+ }
+}
Modified: trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
===================================================================
--- trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,64 +1,64 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- baseclass="org.richfaces.renderkit.html.DropDownMenuRendererBase"
- class="org.richfaces.renderkit.html.DropDownMenuRenderer"
- component="org.richfaces.component.UIDropDownMenu">
- <h:styles>css/dropdownmenu.xcss</h:styles>
-
- <f:clientid var="clientId" />
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ baseclass="org.richfaces.renderkit.html.DropDownMenuRendererBase"
+ class="org.richfaces.renderkit.html.DropDownMenuRenderer"
+ component="org.richfaces.component.UIDropDownMenu">
+ <h:styles>css/dropdownmenu.xcss</h:styles>
+
+ <f:clientid var="clientId" />
<jsp:scriptlet>
- <![CDATA[ org.richfaces.component.UIDropDownMenu menu = (org.richfaces.component.UIDropDownMenu) component;
- if (!menu.getSubmitMode().equalsIgnoreCase("none"))
- org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);
+ <![CDATA[ org.richfaces.component.UIDropDownMenu menu = (org.richfaces.component.UIDropDownMenu) component;
+ if (!menu.getSubmitMode().equalsIgnoreCase("none"))
+ org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);
- if (!menu.isDisabled()) {]]>
- </jsp:scriptlet>
- <div id="#{clientId}" style="#{component.attributes['style']}"
- class="dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect #{component.attributes['styleClass']}"
- onmouseover="#{component.attributes['onmouseover']}"
- onmouseout="#{component.attributes['onmouseout']}"
- onmousemove="#{component.attributes['onmousemove']}">
- <jsp:scriptlet>
- <![CDATA[ } else { ]]>
- </jsp:scriptlet>
- <div id="#{clientId}" style="#{component.attributes['style']}"
- class="dr-menu-label dr-menu-label-unselect dr-ddmenu-label-disabled rich-ddmenu-label-disabled rich-ddmenu-label-unselect #{component.attributes['styleClass']} #{component.attributes['disabledLabelClass']}"
- onmouseover="#{component.attributes['onmouseover']}"
- onmouseout="#{component.attributes['onmouseout']}"
- onmousemove="#{component.attributes['onmousemove']}">
+ if (!menu.isDisabled()) {]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}" style="#{component.attributes['style']}"
+ class="dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect #{component.attributes['styleClass']}"
+ onmouseover="#{component.attributes['onmouseover']}"
+ onmouseout="#{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
+ <jsp:scriptlet>
+ <![CDATA[ } else { ]]>
+ </jsp:scriptlet>
+ <div id="#{clientId}" style="#{component.attributes['style']}"
+ class="dr-menu-label dr-menu-label-unselect dr-ddmenu-label-disabled rich-ddmenu-label-disabled rich-ddmenu-label-unselect #{component.attributes['styleClass']} #{component.attributes['disabledLabelClass']}"
+ onmouseover="#{component.attributes['onmouseover']}"
+ onmouseout="#{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
<jsp:scriptlet>
- <![CDATA[ } if (menu.isDisabled() &&
- (component.getFacet("labelDisabled")!=null && component.getFacet("labelDisabled").isRendered())) {]]>
- </jsp:scriptlet> <div class="dr-label-text-decor rich-label-text-decor"> <u:insertFacet
- name="labelDisabled" /> </div> <jsp:scriptlet>
+ <![CDATA[ } if (menu.isDisabled() &&
+ (component.getFacet("labelDisabled")!=null && component.getFacet("labelDisabled").isRendered())) {]]>
+ </jsp:scriptlet> <div class="dr-label-text-decor rich-label-text-decor"> <u:insertFacet
+ name="labelDisabled" /> </div> <jsp:scriptlet>
<![CDATA[} else if(component.getFacet("label")!=null && component.getFacet("label").isRendered()) {]]>
- </jsp:scriptlet> <div class="dr-label-text-decor rich-label-text-decor"> <u:insertFacet
+ </jsp:scriptlet> <div class="dr-label-text-decor rich-label-text-decor"> <u:insertFacet
name="label" /> </div> <jsp:scriptlet>
<![CDATA[} else {]]>
- </jsp:scriptlet> <div id="#{clientId}_span" class="dr-label-text-decor rich-label-text-decor">#{component.attributes['value']}</div>
+ </jsp:scriptlet> <div id="#{clientId}_span" class="dr-label-text-decor rich-label-text-decor">#{component.attributes['value']}</div>
<jsp:scriptlet>
<![CDATA[}]]>
- </jsp:scriptlet>
-
- <div
- style="margin: 0px; padding: 0px; border: 0px; position: absolute; z-index: 100;">
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body></div>
-
- <jsp:scriptlet>
- <![CDATA[if (!((org.richfaces.component.UIDropDownMenu) component).isDisabled()) {]]>
- </jsp:scriptlet>
- </div>
- <jsp:scriptlet>
- <![CDATA[} else {]]>
- </jsp:scriptlet>
- </div>
- <jsp:scriptlet>
+ </jsp:scriptlet>
+
+ <div
+ style="margin: 0px; padding: 0px; border: 0px; position: absolute; z-index: 100;">
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body></div>
+
+ <jsp:scriptlet>
+ <![CDATA[if (!((org.richfaces.component.UIDropDownMenu) component).isDisabled()) {]]>
+ </jsp:scriptlet>
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[} else {]]>
+ </jsp:scriptlet>
+ </div>
+ <jsp:scriptlet>
<![CDATA[}]]>
- </jsp:scriptlet>
-</f:root>
\ No newline at end of file
+ </jsp:scriptlet>
+</f:root>
Modified: trunk/ui/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java
===================================================================
--- trunk/ui/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/dropdown-menu/src/test/java/org/richfaces/component/DropDownMenuComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -217,4 +217,4 @@
assertEquals(ImageInfo.FORMAT_PNG, info.getFormat());
}
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/effect/src/main/templates/effect.jspx
===================================================================
--- trunk/ui/effect/src/main/templates/effect.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/effect/src/main/templates/effect.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -110,4 +110,4 @@
</script>
</c:if>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java
===================================================================
--- trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/extendedDataTable/src/main/java/org/richfaces/renderkit/AbstractExtendedTableRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1784,4 +1784,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
===================================================================
--- trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -51,7 +51,7 @@
<div
id="#{clientId}"
- class="extdt-maindiv rich-extdt-maindiv"
+ class="extdt-maindiv rich-extdt-maindiv"
style="#{component.attributes['style']};width:#{component.attributes['width']};height:#{component.attributes['height']}"
>
@@ -71,8 +71,8 @@
<div id="#{clientId}:innerd" class="extdt-innerdiv" style="height:100%;width:100%;">
<div id="#{clientId}:cs" class="extdt-hsplit" style="display: none;"/>
<table id="#{clientId}:tu"
- class="extdt-table-layout rich-table #{component.attributes['styleClass']}"
- cellpadding="0"
+ class="extdt-table-layout rich-table #{component.attributes['styleClass']}"
+ cellpadding="0"
cellspacing="0"
width="100%"
>
@@ -121,4 +121,4 @@
</div>
<f:call name="encodeTableMenu"/>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/component/UIFileUpload.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,281 +1,281 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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 java.io.InputStream;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.application.Application;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.MethodBinding;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.context.AjaxContextImpl;
-import org.ajax4jsf.request.MultipartRequest;
-import org.richfaces.event.FileUploadListener;
-import org.richfaces.event.UploadEvent;
-import org.richfaces.renderkit.FileUploadRendererBase;
-
-
-
-/**
- * JSF component class
- *
- */
-public abstract class UIFileUpload extends UIInput {
-
- /**
- * <p>
- * The standard component type for this component.
- * </p>
- */
- public static final String COMPONENT_TYPE = "org.richfaces.component.FileUpload";
-
- /**
- * <p>
- * The standard component family for this component.
- * </p>
- */
- public static final String COMPONENT_FAMILY = "org.richfaces.component.FileUpload";
-
- private String localContentType;
-
- private String localFileName;
-
- private Integer localFileSize;
-
- private InputStream localInputStream;
-
- private void setupProgressBarValueExpression(FacesContext context, String uid) {
- FileUploadRendererBase renderer = (FileUploadRendererBase)this.getRenderer(context);
- UIComponent progressBar = renderer.getProgressBar(context, this);
- String percentExpression = FileUploadConstants.PERCENT_BEAN_NAME + "['"+uid+"']";
- ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
- ELContext elContext = context.getELContext();
-
- ValueExpression value = expressionFactory
- .createValueExpression(elContext, "#{" + percentExpression + "}",
- Integer.class);
- progressBar.setValueExpression("value", value);
-
- ValueExpression enabled = expressionFactory
- .createValueExpression(elContext,
- "#{" + percentExpression + " < 100}", //100 - disable progress when upload reaches 100%
- Boolean.class);
-
- progressBar.setValueExpression("enabled", enabled);
- }
-
-
-
- public String getLocalContentType() {
- return localContentType;
- }
-
- public void setLocalContentType(String localContentType) {
- this.localContentType = localContentType;
- }
-
- public String getLocalFileName() {
- return localFileName;
- }
-
- public void setLocalFileName(String localFileName) {
- this.localFileName = localFileName;
- }
-
- public Integer getLocalFileSize() {
- return localFileSize;
- }
-
- public void setLocalFileSize(Integer localFileSize) {
- this.localFileSize = localFileSize;
- }
-
- public InputStream getLocalInputStream() {
- return localInputStream;
- }
-
- public void setLocalInputStream(InputStream localInputStream) {
- this.localInputStream = localInputStream;
- }
-
- public abstract void setAcceptedTypes(String acceptedTypes);
-
- public abstract String getAcceptedTypes();
-
- public abstract Integer getMaxFilesQuantity();
-
- public abstract void setMaxFilesQuantity(Integer maxFilesQuantity);
-
- public abstract String getListHeight();
-
- public abstract void setListHeight(String listHeight);
-
- public abstract String getListWidth();
-
- public abstract void setListWidth(String listWidth);
-
- public abstract String getStyleClass();
-
- public abstract String getStyle();
-
- public abstract void setStyleClass(String styleClass);
-
- public abstract void setStyle(String style);
-
- public abstract Object getLocale();
-
- public abstract void setLocale(Object locale);
-
- public abstract MethodBinding getFileUploadListener();
-
- public abstract void setFileUploadListener(MethodBinding scrollerListener);
-
- public void addFileUploadListener(FileUploadListener listener) {
- addFacesListener(listener);
- }
-
- public FileUploadListener[] getFileUploadListeners() {
- return (FileUploadListener[]) getFacesListeners(FileUploadListener.class);
- }
-
- public void removeFileUploadListener(FileUploadListener listener) {
- removeFacesListener(listener);
- }
-
- public void reset () {
- this.localContentType = null;
- this.localContentType = null;
- this.localFileName = null;
- this.localFileSize = null;
- this.localInputStream = null;
- }
-
- public void broadcast(FacesEvent e) {
-
- if (e instanceof UploadEvent) {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- MethodBinding binding = getFileUploadListener();
- if (binding != null) {
- binding.invoke(facesContext, new Object[] { e });
- }
-
- } else {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- ExternalContext externalContext = facesContext.getExternalContext();
- Map<String, String> requestParameterMap = externalContext.getRequestParameterMap();
-
- String actionString = requestParameterMap.get("action");
-
- if (actionString != null && requestParameterMap.containsKey(this.getClientId(facesContext))) {
- AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(facesContext);
- String uid = requestParameterMap.get(FileUploadConstants.UPLOAD_FILES_ID);
-
- Map<String, Object> sessionMap = externalContext.getSessionMap();
-
- Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) sessionMap
- .get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
- if (sessions != null) {
- MultipartRequest multipartRequest = sessions.get(uid);
- if (multipartRequest != null) {
- if ("progress".equals(actionString)) {
- setupProgressBarValueExpression(facesContext, uid);
- ajaxContext.setResponseData(multipartRequest.getSize());
- } else if ("richfaces_file_upload_action_stop".equals(actionString)) {
- multipartRequest.stop();
- }
- }
- }
- }
- }
-
- }
-
- /**
- *Parse Locale from String.
- *String must be represented as Locale.toString(); xx_XX_XXXX
-*/
-
- public Locale parseLocale(String localeStr){
-
- int length = localeStr.length();
- if(null==localeStr||length<2){
- return Locale.getDefault();
- }
-
- //Lookup index of first '_' in string locale representation.
- int index1 = localeStr.indexOf("_");
- //Get first charters (if exist) from string
- String language = null;
- if(index1!=-1){
- language = localeStr.substring(0, index1);
- }else{
- return new Locale(localeStr);
- }
- //Lookup index of second '_' in string locale representation.
- int index2 = localeStr.indexOf("_", index1+1);
- String country = null;
- if(index2!=-1){
- country = localeStr.substring(index1+1, index2);
- String variant = localeStr.substring(index2+1);
- return new Locale(language, country, variant);
- }else{
- country = localeStr.substring(index1+1);
- return new Locale(language, country);
- }
- }
-
- public Locale getAsLocale(Object locale) {
-
- if (locale instanceof Locale) {
-
- return (Locale) locale;
-
- } else if (locale instanceof String) {
-
- return parseLocale((String) locale);
-
- } else {
-
- FacesContext context = FacesContext.getCurrentInstance();
- Application application = context.getApplication();
- Converter converter = application
- .createConverter(locale.getClass());
- if (null != converter) {
- return parseLocale(converter.getAsString(context, this, locale));
- } else {
- throw new FacesException(
- "Wrong locale attibute type or there is no converter for custom attibute type");
- }
- }
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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 java.io.InputStream;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.context.AjaxContextImpl;
+import org.ajax4jsf.request.MultipartRequest;
+import org.richfaces.event.FileUploadListener;
+import org.richfaces.event.UploadEvent;
+import org.richfaces.renderkit.FileUploadRendererBase;
+
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIFileUpload extends UIInput {
+
+ /**
+ * <p>
+ * The standard component type for this component.
+ * </p>
+ */
+ public static final String COMPONENT_TYPE = "org.richfaces.component.FileUpload";
+
+ /**
+ * <p>
+ * The standard component family for this component.
+ * </p>
+ */
+ public static final String COMPONENT_FAMILY = "org.richfaces.component.FileUpload";
+
+ private String localContentType;
+
+ private String localFileName;
+
+ private Integer localFileSize;
+
+ private InputStream localInputStream;
+
+ private void setupProgressBarValueExpression(FacesContext context, String uid) {
+ FileUploadRendererBase renderer = (FileUploadRendererBase)this.getRenderer(context);
+ UIComponent progressBar = renderer.getProgressBar(context, this);
+ String percentExpression = FileUploadConstants.PERCENT_BEAN_NAME + "['"+uid+"']";
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+ ELContext elContext = context.getELContext();
+
+ ValueExpression value = expressionFactory
+ .createValueExpression(elContext, "#{" + percentExpression + "}",
+ Integer.class);
+ progressBar.setValueExpression("value", value);
+
+ ValueExpression enabled = expressionFactory
+ .createValueExpression(elContext,
+ "#{" + percentExpression + " < 100}", //100 - disable progress when upload reaches 100%
+ Boolean.class);
+
+ progressBar.setValueExpression("enabled", enabled);
+ }
+
+
+
+ public String getLocalContentType() {
+ return localContentType;
+ }
+
+ public void setLocalContentType(String localContentType) {
+ this.localContentType = localContentType;
+ }
+
+ public String getLocalFileName() {
+ return localFileName;
+ }
+
+ public void setLocalFileName(String localFileName) {
+ this.localFileName = localFileName;
+ }
+
+ public Integer getLocalFileSize() {
+ return localFileSize;
+ }
+
+ public void setLocalFileSize(Integer localFileSize) {
+ this.localFileSize = localFileSize;
+ }
+
+ public InputStream getLocalInputStream() {
+ return localInputStream;
+ }
+
+ public void setLocalInputStream(InputStream localInputStream) {
+ this.localInputStream = localInputStream;
+ }
+
+ public abstract void setAcceptedTypes(String acceptedTypes);
+
+ public abstract String getAcceptedTypes();
+
+ public abstract Integer getMaxFilesQuantity();
+
+ public abstract void setMaxFilesQuantity(Integer maxFilesQuantity);
+
+ public abstract String getListHeight();
+
+ public abstract void setListHeight(String listHeight);
+
+ public abstract String getListWidth();
+
+ public abstract void setListWidth(String listWidth);
+
+ public abstract String getStyleClass();
+
+ public abstract String getStyle();
+
+ public abstract void setStyleClass(String styleClass);
+
+ public abstract void setStyle(String style);
+
+ public abstract Object getLocale();
+
+ public abstract void setLocale(Object locale);
+
+ public abstract MethodBinding getFileUploadListener();
+
+ public abstract void setFileUploadListener(MethodBinding scrollerListener);
+
+ public void addFileUploadListener(FileUploadListener listener) {
+ addFacesListener(listener);
+ }
+
+ public FileUploadListener[] getFileUploadListeners() {
+ return (FileUploadListener[]) getFacesListeners(FileUploadListener.class);
+ }
+
+ public void removeFileUploadListener(FileUploadListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void reset () {
+ this.localContentType = null;
+ this.localContentType = null;
+ this.localFileName = null;
+ this.localFileSize = null;
+ this.localInputStream = null;
+ }
+
+ public void broadcast(FacesEvent e) {
+
+ if (e instanceof UploadEvent) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ MethodBinding binding = getFileUploadListener();
+ if (binding != null) {
+ binding.invoke(facesContext, new Object[] { e });
+ }
+
+ } else {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Map<String, String> requestParameterMap = externalContext.getRequestParameterMap();
+
+ String actionString = requestParameterMap.get("action");
+
+ if (actionString != null && requestParameterMap.containsKey(this.getClientId(facesContext))) {
+ AjaxContext ajaxContext = AjaxContextImpl.getCurrentInstance(facesContext);
+ String uid = requestParameterMap.get(FileUploadConstants.UPLOAD_FILES_ID);
+
+ Map<String, Object> sessionMap = externalContext.getSessionMap();
+
+ Map<String, MultipartRequest> sessions = (Map<String, MultipartRequest>) sessionMap
+ .get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
+ if (sessions != null) {
+ MultipartRequest multipartRequest = sessions.get(uid);
+ if (multipartRequest != null) {
+ if ("progress".equals(actionString)) {
+ setupProgressBarValueExpression(facesContext, uid);
+ ajaxContext.setResponseData(multipartRequest.getSize());
+ } else if ("richfaces_file_upload_action_stop".equals(actionString)) {
+ multipartRequest.stop();
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ *Parse Locale from String.
+ *String must be represented as Locale.toString(); xx_XX_XXXX
+*/
+
+ public Locale parseLocale(String localeStr){
+
+ int length = localeStr.length();
+ if(null==localeStr||length<2){
+ return Locale.getDefault();
+ }
+
+ //Lookup index of first '_' in string locale representation.
+ int index1 = localeStr.indexOf("_");
+ //Get first charters (if exist) from string
+ String language = null;
+ if(index1!=-1){
+ language = localeStr.substring(0, index1);
+ }else{
+ return new Locale(localeStr);
+ }
+ //Lookup index of second '_' in string locale representation.
+ int index2 = localeStr.indexOf("_", index1+1);
+ String country = null;
+ if(index2!=-1){
+ country = localeStr.substring(index1+1, index2);
+ String variant = localeStr.substring(index2+1);
+ return new Locale(language, country, variant);
+ }else{
+ country = localeStr.substring(index1+1);
+ return new Locale(language, country);
+ }
+ }
+
+ public Locale getAsLocale(Object locale) {
+
+ if (locale instanceof Locale) {
+
+ return (Locale) locale;
+
+ } else if (locale instanceof String) {
+
+ return parseLocale((String) locale);
+
+ } else {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ Application application = context.getApplication();
+ Converter converter = application
+ .createConverter(locale.getClass());
+ if (null != converter) {
+ return parseLocale(converter.getAsString(context, this, locale));
+ } else {
+ throw new FacesException(
+ "Wrong locale attibute type or there is no converter for custom attibute type");
+ }
+ }
+ }
+}
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,776 +1,776 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.FactoryFinder;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIParameter;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.RenderKit;
-import javax.faces.render.RenderKitFactory;
-import javax.servlet.http.HttpSession;
-
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
-import org.ajax4jsf.javascript.JSLiteral;
-import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.ComponentsVariableResolver;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.request.MultipartRequest;
-import org.ajax4jsf.resource.CountingOutputWriter;
-import org.richfaces.component.FileUploadConstants;
-import org.richfaces.component.UIFileUpload;
-import org.richfaces.component.UIProgressBar;
-import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.event.UploadEvent;
-import org.richfaces.model.UploadItem;
-
-/**
- * Class provides base renderer for upload file component
- *
- * @author "Andrey Markavtsov"
- *
- */
-public abstract class FileUploadRendererBase extends
- TemplateEncoderRendererBase {
-
- /** Attribute name where collection of files uploaded will be stored */
- private static final String _FILES_UPLOADED_ATTRIBUTE_NAME = "uploadData";
-
- /** File upload bundle name */
- private static final String FILE_UPLOAD_BUNDLE = "org.richfaces.renderkit.fileUpload";
-
- /** Bundle prefix */
- private static final String bundlePrefix = "RICH_FILE_UPLOAD_";
-
- /** Bundle postfix */
- private static final String bundlePostfix = "_LABEL";
-
- /** Set of bundles that can be defined */
- private static final String[] bundlesLables = { "add", "upload", "stop",
- "clear_all", "entry_cancel", "entry_clear", "entry_stop", "done",
- "size_error", "transfer_error","progress" };
-
- /** Default labels values */
- private static final String[] defaultLables = { "Add...", "<b>Upload</b>",
- "<b>Stop</b>", "Clear All", "Cancel", "Clear", "Stop",
- "<b>Done</b>", "File size restricted", "Transfer error occurred","uploading"};
-
- /** Set of attributes that can define label's value */
- private static final String[] labelAttribues = { "addControlLabel",
- "uploadControlLabel", "stopControlLabel", "clearAllControlLabel",
- "cancelEntryControlLabel", "clearControlLabel",
- "stopEntryControlLabel", "doneLabel", "sizeErrorLabel", "transferErrorLabel", "progressLabel" };
-
- /**
- * Overrides standard JSF component method.
- *
- * @param context
- * faces context
- * @param component
- * file upload component
- */
- @Override
- @SuppressWarnings("unchecked")
- protected void doDecode(FacesContext context, UIComponent component) {
-
- new AjaxEvent(component).queue();
-
- ExternalContext externalContext = context.getExternalContext();
- Map<String, String> requestParameterMap = externalContext.getRequestParameterMap();
- String fileUploadIndicator = requestParameterMap.get(FileUploadConstants.FILE_UPLOAD_INDICATOR);
-
- if (fileUploadIndicator != null && Boolean.TRUE.toString().equals(fileUploadIndicator)) {
- UIFileUpload fileUpload = (UIFileUpload) component;
- String clientId = component.getClientId(context);
- String id = requestParameterMap.get("id");
-
- if (!clientId.equals(id)) {
- return; // Avoid listener calling for another fileUpload
- }
-
- String uid = requestParameterMap.get(FileUploadConstants.UPLOAD_FILES_ID);
- decreaseFileCounter(context, id);
- Map<String, MultipartRequest> map = (Map<String, MultipartRequest>) externalContext.getSessionMap()
- .get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
-
- MultipartRequest multipartRequest = map.get(uid);
-
- boolean isFlash = (requestParameterMap.get("_richfaces_send_http_error") != null);
-
- List<UploadItem> fileList = multipartRequest.getUploadItems();
-
- if (fileList == null || fileList.size() == 0) {
- return;
- }
-
- boolean formUpload = multipartRequest.isFormUpload();
-
- if (isFlash && !formUpload && fileList.size() > 0) {
- try {
- UploadItem item = fileList.get(0);
- int actualSize = item.getFileSize();
- int clientSize = Integer.parseInt(requestParameterMap.get("_richfaces_size"));
-
- if (actualSize != clientSize) {
- return; // File uploading has been stopped on the client side
- }
- }catch (Exception e) {
- return;
- }
- }
- onUploadComplete(context, fileList, fileUpload, formUpload);
- }
-
- }
-
- /**
- * Put max file count into session scope
- *
- * @param context
- * @param component
- * @param clientId
- * @return
- */
- @SuppressWarnings("unchecked")
- public Integer initMaxFilesCount(FacesContext context,
- UIComponent component, String clientId) {
- Integer max = (Integer) component.getAttributes().get(
- "maxFilesQuantity");
- Object session = context.getExternalContext()
- .getSession(false);
- synchronized (session) {
- Map<String, Integer> map = (Map<String, Integer>) context.getExternalContext().getSessionMap().get(FileUploadConstants.UPLOADED_COUNTER);
- if (map == null) {
- map = Collections
- .synchronizedMap(new HashMap<String, Integer>());
- }
- map.put(clientId, max);
- }
- return max;
- }
-
- /**
- * Gets form id
- *
- * @param context -
- * faces context
- * @param component -
- * component
- * @return String form id
- */
- public String getFormId(FacesContext context, UIComponent component) {
- UIComponent form = AjaxRendererUtils.getNestingForm(component);
- if (form != null) {
- return form.getClientId(context);
- }
- return "";
- }
-
- /**
- * Gets container id
- *
- * @param context -
- * faces context
- * @param component -
- * component
- * @return String container id
- */
- public String getContainerId(FacesContext context, UIComponent component) {
- UIComponent container = (UIComponent) AjaxRendererUtils
- .findAjaxContainer(context, component);
- if (container != null) {
- return container.getClientId(context);
- }
- return null;
- }
-
- /**
- * Generates map with internalized labels to be put into JS
- *
- * @param o
- * map of labels
- * @return javascript hash map
- */
- public Object _getLabels(Object o) {
- return ScriptUtils.toScript(o);
- }
-
- /**
- * Gets internalized labels. At the first system is looking for them in
- * appropriate attributes if they are defined. Next search place is
- * application and file upload bundles. If no result - default label value
- * will be set up.
- *
- * @param context
- * facesContext instance
- * @param component
- * UIComponent
- * @return map of labels
- */
- public Map<String, String> getLabels(FacesContext context,
- UIComponent component) {
- Map<String, String> labelsMap = new HashMap<String, String>();
- ResourceBundle bundle1 = null;
- ResourceBundle bundle2 = null;
- UIFileUpload fileUpload = (UIFileUpload) component;
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- String messageBundle = context.getApplication().getMessageBundle();
- Object locale = fileUpload.getLocale();
- if (locale == null) {
- locale = context.getExternalContext().getRequestLocale();
- }
- if (null != messageBundle) {
- bundle1 = ResourceBundle.getBundle(messageBundle, fileUpload
- .getAsLocale(locale), loader);
- }
- try {
- bundle2 = ResourceBundle.getBundle(FILE_UPLOAD_BUNDLE, fileUpload
- .getAsLocale(locale), loader);
-
- } catch (MissingResourceException e) {
- // No external bundle was found, ignore this exception.
- }
- initLabels(labelsMap, bundle1, bundle2, fileUpload);
- return labelsMap;
- }
-
- /**
- * Sets values for labels.
- *
- * @param map
- * map of labels
- * @param bundle1
- * application bundle
- * @param bundle2
- * file upload bundle
- * @param fileUpload
- */
- private void initLabels(Map<String, String> map, ResourceBundle bundle1,
- ResourceBundle bundle2, UIFileUpload fileUpload) {
- int i = 0;
- for (String name : bundlesLables) {
- boolean found = false;
- if (labelAttribues[i] != null) {
- String attributeName = labelAttribues[i];
- if (fileUpload.getAttributes().get(attributeName) != null) {
- map.put(name, (String) fileUpload.getAttributes().get(
- attributeName));
- found = true;
- }
- }
- if (!found && (bundle1 != null || bundle2 != null)) {
- String label = getFromBundle(name, bundle1, bundle2);
- if (label != null) {
- map.put(name, getFromBundle(name, bundle1, bundle2));
- found = true;
- }
- }
- if (!found) {
- map.put(name, defaultLables[i]);
- }
- i++;
- }
- }
-
- /**
- * Looking for labels name in bundles provided.
- *
- * @param bundle1
- * application bundle
- * @param bundle2
- * file upload bundle
- * @return String label value
- */
- private String getFromBundle(String name, ResourceBundle bundle1,
- ResourceBundle bundle2) {
- name = bundlePrefix + name.toUpperCase() + bundlePostfix;
- String v = null;
- if (bundle1 != null) {
- try {
- v = bundle1.getString(name);
- } catch (Exception e) {
- if (bundle2 != null) {
- try {
- v = bundle2.getString(name);
- } catch (Exception ex) {
- // no value has been found
- }
- }
-
- }
-
- } else if (bundle2 != null) {
- try {
- v = bundle2.getString(name);
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- b.write(v.getBytes());
- b.toString("UTF-8");
- } catch (Exception e) {
- // no value has been found
- }
- }
- return v;
- }
-
- /**
- * Method decrease file counter
- *
- * @param context
- * @param id
- */
- @SuppressWarnings("unchecked")
- private void decreaseFileCounter(FacesContext context, String id) {
- Map<String, Integer> map = (Map<String, Integer>) context.getExternalContext().getSessionMap()
- .get(FileUploadConstants.UPLOADED_COUNTER);
- if (map != null) {
- Integer i = map.get(id);
- if (i == null) {
- i = 0;
- } else {
- i--;
- }
- map.put(id, i);
- }
- }
-
- /**
- * Put uploaded file into data attribute defined
- *
- * @param context
- * @param fileUpload
- * @param file
- */
- @SuppressWarnings("unchecked")
- private void storeData(FacesContext context, UIFileUpload fileUpload,
- List<UploadItem> fileList) {
- ValueExpression data = fileUpload
- .getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
- if (data != null) {
- if (data.getValue(context.getELContext()) instanceof Collection) {
- Collection collection = (Collection) data.getValue(context
- .getELContext());
- collection.addAll(fileList);
- }
- }
- new UploadEvent(fileUpload, fileList).queue();
- }
-
- /**
- * Call with method after uploading completed
- *
- * @param context
- * @param file
- * @param fileUpload
- */
- private void onUploadComplete(FacesContext context, List<UploadItem> fileList,
- UIFileUpload fileUpload, boolean formUpload) {
- storeData(context, fileUpload, fileList);
- try {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- if ((Boolean)fileUpload.getAttributes().get(AjaxRendererUtils.AJAX_SINGLE_ATTR)) {
- ajaxContext.setAjaxSingleClientId(fileUpload.getClientId(context));
- }
-
- ajaxContext.setAjaxRequest(!formUpload);
- } catch (Exception e) {
- e.getMessage();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
- */
- @Override
- protected Class<? extends UIComponent> getComponentClass() {
- return UIFileUpload.class;
- }
-
- /**
- * Generates common JS script by action value
- *
- * @param context
- * @param component
- * @param action
- * @param oncomplete
- * @return
- * @throws IOException
- */
- @SuppressWarnings("unchecked")
- private String getActionScript(FacesContext context, UIComponent component,
- String action, Object oncomplete) throws IOException {
- ComponentVariables variables = ComponentsVariableResolver.getVariables(
- this, component);
- String clientId = component.getClientId(context);
- String containerId = (String) variables.getVariable("containerId");
- JSFunction ajaxFunction = new JSFunction(
- AjaxRendererUtils.AJAX_FUNCTION_NAME);
- ajaxFunction.addParameter(containerId);
- ajaxFunction.addParameter(new JSReference("formId"));
- ajaxFunction.addParameter(new JSReference("event"));
- // AjaxRendererUtils.buildAjaxFunction(
- // component, context);
-
- Map options = AjaxRendererUtils.buildEventOptions(context, component);
- Map parameters = (Map) options.get("parameters");
- parameters.put("action", action);
- parameters.put(FileUploadConstants.UPLOAD_FILES_ID, new JSReference("uid"));
- parameters.put(clientId, clientId);
- parameters.put(AjaxRendererUtils.AJAX_SINGLE_ATTR, clientId);
- if (oncomplete != null) {
- options.put("onbeforedomupdate", oncomplete);
- }
- ajaxFunction.addParameter(options);
-
- JSFunctionDefinition function = new JSFunctionDefinition("uid");
- function.addParameter("formId");
- function.addParameter("event");
- function.addToBody(ajaxFunction.toScript());
-
- return function.toScript();
- }
-
- /**
- * Return accepted types map
- *
- * @param context
- * @param component
- * @return
- */
- public Object getAcceptedTypes(FacesContext context, UIComponent component) {
- String acceptedTypes = (String) component.getAttributes().get(
- "acceptedTypes");
- Map<String, Boolean> accepted = new HashMap<String, Boolean>();
- if (acceptedTypes != null && acceptedTypes.length() > 0) {
- acceptedTypes = acceptedTypes.replaceAll("[\\s]", "");
- String[] types = acceptedTypes.split("[,;|]");
- if (types != null) {
- for (String type : types) {
- accepted.put(type.toLowerCase(), true);
- }
- return ScriptUtils.toScript(accepted);
- }
- }else {
- accepted.put("*", true);
- }
- return ScriptUtils.toScript(accepted);
- }
-
- /**
- * Generates JS script for stopping uploading process
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getStopScript(FacesContext context, UIComponent component)
- throws IOException {
- return getActionScript(context, component, "richfaces_file_upload_action_stop", null);
- }
-
- /**
- * Generates JS script for getting file size from server
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getFileSizeScript(FacesContext context, UIComponent component)
- throws IOException {
- JSFunctionDefinition oncomplete = new JSFunctionDefinition();
- oncomplete.addParameter("request");
- oncomplete.addParameter("event");
- oncomplete.addParameter("data");
- StringBuffer body = new StringBuffer("$('");
- body.append(component.getClientId(context));
- body.append("').component.getFileSize(data);");
- oncomplete.addToBody(body);
- return getActionScript(context, component, "progress", oncomplete);
-
- }
-
- /**
- * Generates progress label markup
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public Object getLabelMarkup(FacesContext context, UIComponent component)
- throws IOException {
- CountingOutputWriter customWriter = new CountingOutputWriter();
- StringBuffer result = null;
- UIComponent label = component.getFacet("label");
- try {
- if (label != null) {
-
- ResponseWriter writer = context.getResponseWriter();
-
- String defaultRenderKitId = context.getApplication()
- .getDefaultRenderKitId();
- if (null == defaultRenderKitId) {
- defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
- }
- RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit = renderKitFactory.getRenderKit(context,
- defaultRenderKitId);
-
- ResponseWriter responseWriter = renderKit.createResponseWriter(
- customWriter, null, "UTF-8");
- context.setResponseWriter(responseWriter);
- writeScriptBody(context, label, false);
- if (writer != null) {
- context.setResponseWriter(writer);
- }
- result = customWriter.getContent();
- }
-
- } catch (Exception e) {
- e.getMessage();
- }
- return (result != null) ? new JSLiteral(result.toString())
- : JSReference.NULL;
- }
-
- /**
- * Gets a string representing css specific height of downloaded file list
- * panel.
- *
- * @param component
- * file upload component
- * @return a string representing css specific height of downloaded file list
- * panel
- */
- public String getFileListHeight(UIFileUpload component) {
- return HtmlUtil.qualifySize(component.getListHeight());
- }
-
- /**
- * Gets a string representing css specific width of downloaded file list
- * panel.
- *
- * @param component
- * file upload component
- * @return a string representing css specific width of downloaded file list
- * panel
- */
- public String getFileListWidth(UIFileUpload component) {
- return HtmlUtil.qualifySize(component.getListWidth());
- }
-
- /**
- * Generate component custom events functions
- *
- * @param context
- * @param component
- * @param attributeName
- * @return
- */
- public String getAsEventHandler(FacesContext context,
- UIComponent component, String attributeName) {
- Object eventHandler = RendererUtils.getInstance().getAsEventHandler(
- context, component, attributeName, "");
- if (eventHandler != null) {
- return eventHandler.toString();
- }
- return JSReference.NULL.toScript();
- }
-
- /**
- * Gets progress bar Id
- *
- * @param context
- * @param component
- * @return
- * @throws IOException
- */
- public String getProgressBarId(FacesContext context, UIComponent component)
- throws IOException {
- return getProgressBar(context, component).getClientId(context);
- }
-
- /**
- * Renders progress bar
- *
- * @param context
- * @param component
- * @throws IOException
- */
- public void renderProgress(FacesContext context, UIComponent component)
- throws IOException {
- UIComponent progressBar = getProgressBar(context, component);
- renderChild(context, progressBar);
- }
-
- /**
- * Creates progress bar component
- *
- * @param context
- * @param fileUpload
- * @return
- */
- private UIComponent createProgressBar(FacesContext context,
- UIComponent fileUpload) {
- UIComponent progressBar = fileUpload.getFacet("progress");
- if (null == progressBar) {
- progressBar = context.getApplication().createComponent(
- UIProgressBar.COMPONENT_TYPE);
- }
- fileUpload.getFacets().put("progress", progressBar);
- return progressBar;
- }
-
- /**
- * Returns progress bar
- *
- * @param context
- * @param component
- * @return
- */
- public UIComponent getProgressBar(FacesContext context,
- UIComponent component) {
- UIComponent progressBar = component.getFacet("progress");
- if (null == progressBar) {
- progressBar = createProgressBar(context, component);
- }
- progressBar.getAttributes().put("minValue", -1);
-
- ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
- ValueExpression falseExpression = expressionFactory.createValueExpression(
- context.getELContext(),
- "#{" + Boolean.FALSE + "}",
- Boolean.class);
-
- progressBar.setValueExpression("enabled", falseExpression);
- progressBar.setTransient(false);
- return progressBar;
- }
-
-
- /**
- * Returns set of children UIParameters
- * @param context
- * @param component
- * @return
- */
- public Object getChildrenParams(FacesContext context, UIComponent component) {
- Map<String, Object> parameters = new HashMap<String, Object>();
- for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) {
- UIComponent child = iterator.next();
- if (child instanceof UIParameter) {
- UIParameter p = (UIParameter)child;
- parameters.put(p.getName(), p.getValue());
- }
- }
-
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- Map<String, Object> commonAjaxParameters = ajaxContext.getCommonAjaxParameters();
- if (commonAjaxParameters != null) {
- parameters.putAll(commonAjaxParameters);
- }
-
- return ((parameters.size() > 0) ? ScriptUtils.toScript(parameters) : JSReference.NULL);
- }
-
- public String getSessionId(FacesContext context, UIComponent component) {
- String id = null;
- Object session = context.getExternalContext().getSession(false);
- if (session != null) {
- if (session instanceof HttpSession) {
- id = ((HttpSession) session).getId();
- } else {
- Class<? extends Object> sesssionClass = session.getClass();
- try {
- Method getIdMethod = sesssionClass.getMethod("getId");
- id = (String) getIdMethod.invoke(session);
- } catch (SecurityException e) {
- throw new FacesException(e.getMessage(), e);
- } catch (NoSuchMethodException e) {
- throw new FacesException(e.getMessage(), e);
- } catch (IllegalArgumentException e) {
- throw new FacesException(e.getMessage(), e);
- } catch (IllegalAccessException e) {
- throw new FacesException(e.getMessage(), e);
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- throw new FacesException(cause.getMessage(), cause);
- }
- }
- }
-
- return id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
- * javax.faces.component.UIComponent)
- */
- @Override
- public void encodeChildren(FacesContext context, UIComponent component)
- throws IOException {
- ; // We should not render children
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.renderkit.RendererBase#doEncodeChildren(javax.faces.context.ResponseWriter,
- * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
- */
- @Override
- public void doEncodeChildren(ResponseWriter writer, FacesContext context,
- UIComponent component) throws IOException {
- ; // We should not render children
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIParameter;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+import javax.servlet.http.HttpSession;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSLiteral;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.request.MultipartRequest;
+import org.ajax4jsf.resource.CountingOutputWriter;
+import org.richfaces.component.FileUploadConstants;
+import org.richfaces.component.UIFileUpload;
+import org.richfaces.component.UIProgressBar;
+import org.richfaces.component.util.HtmlUtil;
+import org.richfaces.event.UploadEvent;
+import org.richfaces.model.UploadItem;
+
+/**
+ * Class provides base renderer for upload file component
+ *
+ * @author "Andrey Markavtsov"
+ *
+ */
+public abstract class FileUploadRendererBase extends
+ TemplateEncoderRendererBase {
+
+ /** Attribute name where collection of files uploaded will be stored */
+ private static final String _FILES_UPLOADED_ATTRIBUTE_NAME = "uploadData";
+
+ /** File upload bundle name */
+ private static final String FILE_UPLOAD_BUNDLE = "org.richfaces.renderkit.fileUpload";
+
+ /** Bundle prefix */
+ private static final String bundlePrefix = "RICH_FILE_UPLOAD_";
+
+ /** Bundle postfix */
+ private static final String bundlePostfix = "_LABEL";
+
+ /** Set of bundles that can be defined */
+ private static final String[] bundlesLables = { "add", "upload", "stop",
+ "clear_all", "entry_cancel", "entry_clear", "entry_stop", "done",
+ "size_error", "transfer_error","progress" };
+
+ /** Default labels values */
+ private static final String[] defaultLables = { "Add...", "<b>Upload</b>",
+ "<b>Stop</b>", "Clear All", "Cancel", "Clear", "Stop",
+ "<b>Done</b>", "File size restricted", "Transfer error occurred","uploading"};
+
+ /** Set of attributes that can define label's value */
+ private static final String[] labelAttribues = { "addControlLabel",
+ "uploadControlLabel", "stopControlLabel", "clearAllControlLabel",
+ "cancelEntryControlLabel", "clearControlLabel",
+ "stopEntryControlLabel", "doneLabel", "sizeErrorLabel", "transferErrorLabel", "progressLabel" };
+
+ /**
+ * Overrides standard JSF component method.
+ *
+ * @param context
+ * faces context
+ * @param component
+ * file upload component
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void doDecode(FacesContext context, UIComponent component) {
+
+ new AjaxEvent(component).queue();
+
+ ExternalContext externalContext = context.getExternalContext();
+ Map<String, String> requestParameterMap = externalContext.getRequestParameterMap();
+ String fileUploadIndicator = requestParameterMap.get(FileUploadConstants.FILE_UPLOAD_INDICATOR);
+
+ if (fileUploadIndicator != null && Boolean.TRUE.toString().equals(fileUploadIndicator)) {
+ UIFileUpload fileUpload = (UIFileUpload) component;
+ String clientId = component.getClientId(context);
+ String id = requestParameterMap.get("id");
+
+ if (!clientId.equals(id)) {
+ return; // Avoid listener calling for another fileUpload
+ }
+
+ String uid = requestParameterMap.get(FileUploadConstants.UPLOAD_FILES_ID);
+ decreaseFileCounter(context, id);
+ Map<String, MultipartRequest> map = (Map<String, MultipartRequest>) externalContext.getSessionMap()
+ .get(FileUploadConstants.REQUESTS_SESSIONS_BEAN_NAME);
+
+ MultipartRequest multipartRequest = map.get(uid);
+
+ boolean isFlash = (requestParameterMap.get("_richfaces_send_http_error") != null);
+
+ List<UploadItem> fileList = multipartRequest.getUploadItems();
+
+ if (fileList == null || fileList.size() == 0) {
+ return;
+ }
+
+ boolean formUpload = multipartRequest.isFormUpload();
+
+ if (isFlash && !formUpload && fileList.size() > 0) {
+ try {
+ UploadItem item = fileList.get(0);
+ int actualSize = item.getFileSize();
+ int clientSize = Integer.parseInt(requestParameterMap.get("_richfaces_size"));
+
+ if (actualSize != clientSize) {
+ return; // File uploading has been stopped on the client side
+ }
+ }catch (Exception e) {
+ return;
+ }
+ }
+ onUploadComplete(context, fileList, fileUpload, formUpload);
+ }
+
+ }
+
+ /**
+ * Put max file count into session scope
+ *
+ * @param context
+ * @param component
+ * @param clientId
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ public Integer initMaxFilesCount(FacesContext context,
+ UIComponent component, String clientId) {
+ Integer max = (Integer) component.getAttributes().get(
+ "maxFilesQuantity");
+ Object session = context.getExternalContext()
+ .getSession(false);
+ synchronized (session) {
+ Map<String, Integer> map = (Map<String, Integer>) context.getExternalContext().getSessionMap().get(FileUploadConstants.UPLOADED_COUNTER);
+ if (map == null) {
+ map = Collections
+ .synchronizedMap(new HashMap<String, Integer>());
+ }
+ map.put(clientId, max);
+ }
+ return max;
+ }
+
+ /**
+ * Gets form id
+ *
+ * @param context -
+ * faces context
+ * @param component -
+ * component
+ * @return String form id
+ */
+ public String getFormId(FacesContext context, UIComponent component) {
+ UIComponent form = AjaxRendererUtils.getNestingForm(component);
+ if (form != null) {
+ return form.getClientId(context);
+ }
+ return "";
+ }
+
+ /**
+ * Gets container id
+ *
+ * @param context -
+ * faces context
+ * @param component -
+ * component
+ * @return String container id
+ */
+ public String getContainerId(FacesContext context, UIComponent component) {
+ UIComponent container = (UIComponent) AjaxRendererUtils
+ .findAjaxContainer(context, component);
+ if (container != null) {
+ return container.getClientId(context);
+ }
+ return null;
+ }
+
+ /**
+ * Generates map with internalized labels to be put into JS
+ *
+ * @param o
+ * map of labels
+ * @return javascript hash map
+ */
+ public Object _getLabels(Object o) {
+ return ScriptUtils.toScript(o);
+ }
+
+ /**
+ * Gets internalized labels. At the first system is looking for them in
+ * appropriate attributes if they are defined. Next search place is
+ * application and file upload bundles. If no result - default label value
+ * will be set up.
+ *
+ * @param context
+ * facesContext instance
+ * @param component
+ * UIComponent
+ * @return map of labels
+ */
+ public Map<String, String> getLabels(FacesContext context,
+ UIComponent component) {
+ Map<String, String> labelsMap = new HashMap<String, String>();
+ ResourceBundle bundle1 = null;
+ ResourceBundle bundle2 = null;
+ UIFileUpload fileUpload = (UIFileUpload) component;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String messageBundle = context.getApplication().getMessageBundle();
+ Object locale = fileUpload.getLocale();
+ if (locale == null) {
+ locale = context.getExternalContext().getRequestLocale();
+ }
+ if (null != messageBundle) {
+ bundle1 = ResourceBundle.getBundle(messageBundle, fileUpload
+ .getAsLocale(locale), loader);
+ }
+ try {
+ bundle2 = ResourceBundle.getBundle(FILE_UPLOAD_BUNDLE, fileUpload
+ .getAsLocale(locale), loader);
+
+ } catch (MissingResourceException e) {
+ // No external bundle was found, ignore this exception.
+ }
+ initLabels(labelsMap, bundle1, bundle2, fileUpload);
+ return labelsMap;
+ }
+
+ /**
+ * Sets values for labels.
+ *
+ * @param map
+ * map of labels
+ * @param bundle1
+ * application bundle
+ * @param bundle2
+ * file upload bundle
+ * @param fileUpload
+ */
+ private void initLabels(Map<String, String> map, ResourceBundle bundle1,
+ ResourceBundle bundle2, UIFileUpload fileUpload) {
+ int i = 0;
+ for (String name : bundlesLables) {
+ boolean found = false;
+ if (labelAttribues[i] != null) {
+ String attributeName = labelAttribues[i];
+ if (fileUpload.getAttributes().get(attributeName) != null) {
+ map.put(name, (String) fileUpload.getAttributes().get(
+ attributeName));
+ found = true;
+ }
+ }
+ if (!found && (bundle1 != null || bundle2 != null)) {
+ String label = getFromBundle(name, bundle1, bundle2);
+ if (label != null) {
+ map.put(name, getFromBundle(name, bundle1, bundle2));
+ found = true;
+ }
+ }
+ if (!found) {
+ map.put(name, defaultLables[i]);
+ }
+ i++;
+ }
+ }
+
+ /**
+ * Looking for labels name in bundles provided.
+ *
+ * @param bundle1
+ * application bundle
+ * @param bundle2
+ * file upload bundle
+ * @return String label value
+ */
+ private String getFromBundle(String name, ResourceBundle bundle1,
+ ResourceBundle bundle2) {
+ name = bundlePrefix + name.toUpperCase() + bundlePostfix;
+ String v = null;
+ if (bundle1 != null) {
+ try {
+ v = bundle1.getString(name);
+ } catch (Exception e) {
+ if (bundle2 != null) {
+ try {
+ v = bundle2.getString(name);
+ } catch (Exception ex) {
+ // no value has been found
+ }
+ }
+
+ }
+
+ } else if (bundle2 != null) {
+ try {
+ v = bundle2.getString(name);
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ b.write(v.getBytes());
+ b.toString("UTF-8");
+ } catch (Exception e) {
+ // no value has been found
+ }
+ }
+ return v;
+ }
+
+ /**
+ * Method decrease file counter
+ *
+ * @param context
+ * @param id
+ */
+ @SuppressWarnings("unchecked")
+ private void decreaseFileCounter(FacesContext context, String id) {
+ Map<String, Integer> map = (Map<String, Integer>) context.getExternalContext().getSessionMap()
+ .get(FileUploadConstants.UPLOADED_COUNTER);
+ if (map != null) {
+ Integer i = map.get(id);
+ if (i == null) {
+ i = 0;
+ } else {
+ i--;
+ }
+ map.put(id, i);
+ }
+ }
+
+ /**
+ * Put uploaded file into data attribute defined
+ *
+ * @param context
+ * @param fileUpload
+ * @param file
+ */
+ @SuppressWarnings("unchecked")
+ private void storeData(FacesContext context, UIFileUpload fileUpload,
+ List<UploadItem> fileList) {
+ ValueExpression data = fileUpload
+ .getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
+ if (data != null) {
+ if (data.getValue(context.getELContext()) instanceof Collection) {
+ Collection collection = (Collection) data.getValue(context
+ .getELContext());
+ collection.addAll(fileList);
+ }
+ }
+ new UploadEvent(fileUpload, fileList).queue();
+ }
+
+ /**
+ * Call with method after uploading completed
+ *
+ * @param context
+ * @param file
+ * @param fileUpload
+ */
+ private void onUploadComplete(FacesContext context, List<UploadItem> fileList,
+ UIFileUpload fileUpload, boolean formUpload) {
+ storeData(context, fileUpload, fileList);
+ try {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if ((Boolean)fileUpload.getAttributes().get(AjaxRendererUtils.AJAX_SINGLE_ATTR)) {
+ ajaxContext.setAjaxSingleClientId(fileUpload.getClientId(context));
+ }
+
+ ajaxContext.setAjaxRequest(!formUpload);
+ } catch (Exception e) {
+ e.getMessage();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ */
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return UIFileUpload.class;
+ }
+
+ /**
+ * Generates common JS script by action value
+ *
+ * @param context
+ * @param component
+ * @param action
+ * @param oncomplete
+ * @return
+ * @throws IOException
+ */
+ @SuppressWarnings("unchecked")
+ private String getActionScript(FacesContext context, UIComponent component,
+ String action, Object oncomplete) throws IOException {
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(
+ this, component);
+ String clientId = component.getClientId(context);
+ String containerId = (String) variables.getVariable("containerId");
+ JSFunction ajaxFunction = new JSFunction(
+ AjaxRendererUtils.AJAX_FUNCTION_NAME);
+ ajaxFunction.addParameter(containerId);
+ ajaxFunction.addParameter(new JSReference("formId"));
+ ajaxFunction.addParameter(new JSReference("event"));
+ // AjaxRendererUtils.buildAjaxFunction(
+ // component, context);
+
+ Map options = AjaxRendererUtils.buildEventOptions(context, component);
+ Map parameters = (Map) options.get("parameters");
+ parameters.put("action", action);
+ parameters.put(FileUploadConstants.UPLOAD_FILES_ID, new JSReference("uid"));
+ parameters.put(clientId, clientId);
+ parameters.put(AjaxRendererUtils.AJAX_SINGLE_ATTR, clientId);
+ if (oncomplete != null) {
+ options.put("onbeforedomupdate", oncomplete);
+ }
+ ajaxFunction.addParameter(options);
+
+ JSFunctionDefinition function = new JSFunctionDefinition("uid");
+ function.addParameter("formId");
+ function.addParameter("event");
+ function.addToBody(ajaxFunction.toScript());
+
+ return function.toScript();
+ }
+
+ /**
+ * Return accepted types map
+ *
+ * @param context
+ * @param component
+ * @return
+ */
+ public Object getAcceptedTypes(FacesContext context, UIComponent component) {
+ String acceptedTypes = (String) component.getAttributes().get(
+ "acceptedTypes");
+ Map<String, Boolean> accepted = new HashMap<String, Boolean>();
+ if (acceptedTypes != null && acceptedTypes.length() > 0) {
+ acceptedTypes = acceptedTypes.replaceAll("[\\s]", "");
+ String[] types = acceptedTypes.split("[,;|]");
+ if (types != null) {
+ for (String type : types) {
+ accepted.put(type.toLowerCase(), true);
+ }
+ return ScriptUtils.toScript(accepted);
+ }
+ }else {
+ accepted.put("*", true);
+ }
+ return ScriptUtils.toScript(accepted);
+ }
+
+ /**
+ * Generates JS script for stopping uploading process
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public String getStopScript(FacesContext context, UIComponent component)
+ throws IOException {
+ return getActionScript(context, component, "richfaces_file_upload_action_stop", null);
+ }
+
+ /**
+ * Generates JS script for getting file size from server
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public String getFileSizeScript(FacesContext context, UIComponent component)
+ throws IOException {
+ JSFunctionDefinition oncomplete = new JSFunctionDefinition();
+ oncomplete.addParameter("request");
+ oncomplete.addParameter("event");
+ oncomplete.addParameter("data");
+ StringBuffer body = new StringBuffer("$('");
+ body.append(component.getClientId(context));
+ body.append("').component.getFileSize(data);");
+ oncomplete.addToBody(body);
+ return getActionScript(context, component, "progress", oncomplete);
+
+ }
+
+ /**
+ * Generates progress label markup
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public Object getLabelMarkup(FacesContext context, UIComponent component)
+ throws IOException {
+ CountingOutputWriter customWriter = new CountingOutputWriter();
+ StringBuffer result = null;
+ UIComponent label = component.getFacet("label");
+ try {
+ if (label != null) {
+
+ ResponseWriter writer = context.getResponseWriter();
+
+ String defaultRenderKitId = context.getApplication()
+ .getDefaultRenderKitId();
+ if (null == defaultRenderKitId) {
+ defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
+ }
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit = renderKitFactory.getRenderKit(context,
+ defaultRenderKitId);
+
+ ResponseWriter responseWriter = renderKit.createResponseWriter(
+ customWriter, null, "UTF-8");
+ context.setResponseWriter(responseWriter);
+ writeScriptBody(context, label, false);
+ if (writer != null) {
+ context.setResponseWriter(writer);
+ }
+ result = customWriter.getContent();
+ }
+
+ } catch (Exception e) {
+ e.getMessage();
+ }
+ return (result != null) ? new JSLiteral(result.toString())
+ : JSReference.NULL;
+ }
+
+ /**
+ * Gets a string representing css specific height of downloaded file list
+ * panel.
+ *
+ * @param component
+ * file upload component
+ * @return a string representing css specific height of downloaded file list
+ * panel
+ */
+ public String getFileListHeight(UIFileUpload component) {
+ return HtmlUtil.qualifySize(component.getListHeight());
+ }
+
+ /**
+ * Gets a string representing css specific width of downloaded file list
+ * panel.
+ *
+ * @param component
+ * file upload component
+ * @return a string representing css specific width of downloaded file list
+ * panel
+ */
+ public String getFileListWidth(UIFileUpload component) {
+ return HtmlUtil.qualifySize(component.getListWidth());
+ }
+
+ /**
+ * Generate component custom events functions
+ *
+ * @param context
+ * @param component
+ * @param attributeName
+ * @return
+ */
+ public String getAsEventHandler(FacesContext context,
+ UIComponent component, String attributeName) {
+ Object eventHandler = RendererUtils.getInstance().getAsEventHandler(
+ context, component, attributeName, "");
+ if (eventHandler != null) {
+ return eventHandler.toString();
+ }
+ return JSReference.NULL.toScript();
+ }
+
+ /**
+ * Gets progress bar Id
+ *
+ * @param context
+ * @param component
+ * @return
+ * @throws IOException
+ */
+ public String getProgressBarId(FacesContext context, UIComponent component)
+ throws IOException {
+ return getProgressBar(context, component).getClientId(context);
+ }
+
+ /**
+ * Renders progress bar
+ *
+ * @param context
+ * @param component
+ * @throws IOException
+ */
+ public void renderProgress(FacesContext context, UIComponent component)
+ throws IOException {
+ UIComponent progressBar = getProgressBar(context, component);
+ renderChild(context, progressBar);
+ }
+
+ /**
+ * Creates progress bar component
+ *
+ * @param context
+ * @param fileUpload
+ * @return
+ */
+ private UIComponent createProgressBar(FacesContext context,
+ UIComponent fileUpload) {
+ UIComponent progressBar = fileUpload.getFacet("progress");
+ if (null == progressBar) {
+ progressBar = context.getApplication().createComponent(
+ UIProgressBar.COMPONENT_TYPE);
+ }
+ fileUpload.getFacets().put("progress", progressBar);
+ return progressBar;
+ }
+
+ /**
+ * Returns progress bar
+ *
+ * @param context
+ * @param component
+ * @return
+ */
+ public UIComponent getProgressBar(FacesContext context,
+ UIComponent component) {
+ UIComponent progressBar = component.getFacet("progress");
+ if (null == progressBar) {
+ progressBar = createProgressBar(context, component);
+ }
+ progressBar.getAttributes().put("minValue", -1);
+
+ ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
+ ValueExpression falseExpression = expressionFactory.createValueExpression(
+ context.getELContext(),
+ "#{" + Boolean.FALSE + "}",
+ Boolean.class);
+
+ progressBar.setValueExpression("enabled", falseExpression);
+ progressBar.setTransient(false);
+ return progressBar;
+ }
+
+
+ /**
+ * Returns set of children UIParameters
+ * @param context
+ * @param component
+ * @return
+ */
+ public Object getChildrenParams(FacesContext context, UIComponent component) {
+ Map<String, Object> parameters = new HashMap<String, Object>();
+ for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) {
+ UIComponent child = iterator.next();
+ if (child instanceof UIParameter) {
+ UIParameter p = (UIParameter)child;
+ parameters.put(p.getName(), p.getValue());
+ }
+ }
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ Map<String, Object> commonAjaxParameters = ajaxContext.getCommonAjaxParameters();
+ if (commonAjaxParameters != null) {
+ parameters.putAll(commonAjaxParameters);
+ }
+
+ return ((parameters.size() > 0) ? ScriptUtils.toScript(parameters) : JSReference.NULL);
+ }
+
+ public String getSessionId(FacesContext context, UIComponent component) {
+ String id = null;
+ Object session = context.getExternalContext().getSession(false);
+ if (session != null) {
+ if (session instanceof HttpSession) {
+ id = ((HttpSession) session).getId();
+ } else {
+ Class<? extends Object> sesssionClass = session.getClass();
+ try {
+ Method getIdMethod = sesssionClass.getMethod("getId");
+ id = (String) getIdMethod.invoke(session);
+ } catch (SecurityException e) {
+ throw new FacesException(e.getMessage(), e);
+ } catch (NoSuchMethodException e) {
+ throw new FacesException(e.getMessage(), e);
+ } catch (IllegalArgumentException e) {
+ throw new FacesException(e.getMessage(), e);
+ } catch (IllegalAccessException e) {
+ throw new FacesException(e.getMessage(), e);
+ } catch (InvocationTargetException e) {
+ Throwable cause = e.getCause();
+ throw new FacesException(cause.getMessage(), cause);
+ }
+ }
+ }
+
+ return id;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.renderkit.TemplateEncoderRendererBase#encodeChildren(javax.faces.context.FacesContext,
+ * javax.faces.component.UIComponent)
+ */
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component)
+ throws IOException {
+ ; // We should not render children
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.renderkit.RendererBase#doEncodeChildren(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)
+ */
+ @Override
+ public void doEncodeChildren(ResponseWriter writer, FacesContext context,
+ UIComponent component) throws IOException {
+ ; // We should not render children
+ }
+
+}
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/html/images/UploadButtonBgLightGradient.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/html/images/UploadButtonBgLightGradient.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/html/images/UploadButtonBgLightGradient.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -27,4 +27,4 @@
public UploadButtonBgLightGradient() {
super(8, 30, 30, "additionalBackgroundColor", "headerGradientColor");
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx
===================================================================
--- trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/fileUpload/src/main/templates/org/richfaces/fileUpload.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -203,4 +203,4 @@
<f:call name="utils.encodeEndFormIfNessesary" />
</div>
</f:root>
-
\ No newline at end of file
+
Modified: trunk/ui/gmap/src/main/templates/gmap.jspx
===================================================================
--- trunk/ui/gmap/src/main/templates/gmap.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/gmap/src/main/templates/gmap.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -29,8 +29,8 @@
<h:styles>css/gmap.xcss</h:styles>
<h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),script/gmap.js</h:scripts>
-<div id="#{clientId}" class="dr-gmap rich-gmap #{component.attributes['styleClass']}" x:passThruWithExclusions="id,class,styleClass">
-
+<div id="#{clientId}" class="dr-gmap rich-gmap #{component.attributes['styleClass']}" x:passThruWithExclusions="id,class,styleClass">
+
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=#{key}&hl=#{locale}" />
<script type="text/javascript">
//<![CDATA[
@@ -41,4 +41,4 @@
//]]>
</script>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx
===================================================================
--- trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/hotKey/src/main/templates/org/richfaces/htmlHotKey.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -115,4 +115,4 @@
new Richfaces.hotKey('#{clientId}','#{key}','#{selector}', #{options}, function(event) { #{attributes['handler']} });
</script>
</span>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/inplaceInput/src/main/java/org/richfaces/component/UIInplaceInput.java
===================================================================
--- trunk/ui/inplaceInput/src/main/java/org/richfaces/component/UIInplaceInput.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/inplaceInput/src/main/java/org/richfaces/component/UIInplaceInput.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -40,4 +40,4 @@
// public static final String VALUE_SUFFIX = "value";
public abstract String getDefaultLabel();
public abstract void setDefaultLabel(String label);
-}
\ No newline at end of file
+}
Modified: trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -137,18 +137,18 @@
<tbody>
<tr>
<td class="rich-inplace-shadow-tl">
- <img width="10" height="1" style="border:0" alt=" " src="#{spacer}"/>
+ <img width="10" height="1" style="border:0" alt="" src="#{spacer}"/>
</td>
<td class="rich-inplace-shadow-tr">
- <img width="1" height="10" style="border:0" alt=" " src="#{spacer}"/>
+ <img width="1" height="10" style="border:0" alt="" src="#{spacer}"/>
</td>
</tr>
<tr>
<td class="rich-inplace-shadow-bl">
- <img width="1" height="10" style="border:0" alt=" " src="#{spacer}"/>
+ <img width="1" height="10" style="border:0" alt="" src="#{spacer}"/>
</td>
<td class="rich-inplace-shadow-br">
- <img width="10" height="1" style="border:0" alt=" " src="#{spacer}"/>
+ <img width="10" height="1" style="border:0" alt="" src="#{spacer}"/>
</td>
</tr>
</tbody>
@@ -218,4 +218,4 @@
<jsp:scriptlet>
}
</jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -156,18 +156,18 @@
<table cellpadding="0" cellspacing="0" border="0" class="rich-inplace-select-shadow-size">
<tr>
<td class="rich-inplace-select-shadow-tl">
- <img src="#{spacer}" width="10" height="1" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="10" height="1" alt="" style="border:0"/><br/>
</td>
<td class="rich-inplace-select-shadow-tr">
- <img src="#{spacer}" width="1" height="10" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="1" height="10" alt="" style="border:0"/><br/>
</td>
</tr>
<tr>
<td class="rich-inplace-select-shadow-bl">
- <img src="#{spacer}" width="1" height="10" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="1" height="10" alt="" style="border:0"/><br/>
</td>
<td class="rich-inplace-select-shadow-br">
- <img src="#{spacer}" width="10" height="1" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="10" height="1" alt="" style="border:0"/><br/>
</td>
</tr>
</table>
@@ -200,18 +200,18 @@
<table id="#{clientId}shadow" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
<tr>
<td class="rich-inplace-select-shadow-tl">
- <img src="#{spacer}" width="10" height="1" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="10" height="1" alt="" style="border:0"/><br/>
</td>
<td class="rich-inplace-select-shadow-tr">
- <img src="#{spacer}" width="1" height="10" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="1" height="10" alt="" style="border:0"/><br/>
</td>
</tr>
<tr>
<td class="rich-inplace-select-shadow-bl">
- <img src="#{spacer}" width="1" height="10" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="1" height="10" alt="" style="border:0"/><br/>
</td>
<td class="rich-inplace-select-shadow-br">
- <img src="#{spacer}" width="10" height="10" alt=" " style="border:0"/><br/>
+ <img src="#{spacer}" width="10" height="10" alt="" style="border:0"/><br/>
</td>
</tr>
</table>
Modified: trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
===================================================================
--- trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -494,7 +494,7 @@
<tbody>
<tr>
<td class="dr-insldr-track-decor-2">
- <img src="#{spacer}" alt=" " style="display: block;" />
+ <img src="#{spacer}" alt="" style="display: block;" />
</td>
</tr>
</tbody>
Modified: trunk/ui/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java
===================================================================
--- trunk/ui/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/inputnumber-slider/src/test/java/org/richfaces/component/InputNumberSliderComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -543,4 +543,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx
===================================================================
--- trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -42,27 +42,27 @@
<input
class="dr-spnr-i rich-spinner-input #{component.attributes['inputClass']}"
- onchange="#{component.attributes['onchange']}"
- onselect="#{component.attributes['onselect']}"
- onfocus="#{component.attributes['onfocus']}"
+ onchange="#{component.attributes['onchange']}"
+ onselect="#{component.attributes['onselect']}"
+ onfocus="#{component.attributes['onfocus']}"
onblur="#{component.attributes['onblur']}"
- type="text"
- size="#{component.attributes['inputSize']}"
- name="#{clientId}"
+ type="text"
+ size="#{component.attributes['inputSize']}"
+ name="#{clientId}"
value="#{this:getInputValue(context, component)}"
- style="#{component.inputStyle}"
- accesskey="#{component.attributes['accesskey']}"
- tabindex="#{component.attributes['tabindex']}"
-
- onclick='#{component.attributes["oninputclick"]}'
- ondblclick='#{component.attributes["oninputdblclick"]}'
- onkeydown='#{component.attributes["oninputkeydown"]}'
- onkeypress='#{component.attributes["oninputkeypress"]}'
- onkeyup='#{component.attributes["oninputkeyup"]}'
- onmousedown='#{component.attributes["oninputmousedown"]}'
- onmousemove='#{component.attributes["oninputmousemove"]}'
- onmouseout='#{component.attributes["oninputmouseout"]}'
- onmouseover='#{component.attributes["oninputmouseover"]}'
+ style="#{component.inputStyle}"
+ accesskey="#{component.attributes['accesskey']}"
+ tabindex="#{component.attributes['tabindex']}"
+
+ onclick='#{component.attributes["oninputclick"]}'
+ ondblclick='#{component.attributes["oninputdblclick"]}'
+ onkeydown='#{component.attributes["oninputkeydown"]}'
+ onkeypress='#{component.attributes["oninputkeypress"]}'
+ onkeyup='#{component.attributes["oninputkeyup"]}'
+ onmousedown='#{component.attributes["oninputmousedown"]}'
+ onmousemove='#{component.attributes["oninputmousemove"]}'
+ onmouseout='#{component.attributes["oninputmouseout"]}'
+ onmouseover='#{component.attributes["oninputmouseover"]}'
onmouseup='#{component.attributes["oninputmouseup"]}'
autocomplete='#{autocomplete}'
/>
@@ -76,25 +76,25 @@
boolean disabled = ((Boolean) component.getAttributes().get("disabled")).booleanValue();
if (! disabled) {
]]></jsp:scriptlet>
- <input
- type="image"
- src="#{up_arrow}"
- class="dr-spnr-bn rich-spinner-button"
- style="border:0"
+ <input
+ type="image"
+ src="#{up_arrow}"
+ class="dr-spnr-bn rich-spinner-button"
+ style="border:0"
onclick="return false"
- onmousedown="this.className='dr-spnr-bp rich-spinner-button'"
- onmouseup="this.className='dr-spnr-bn rich-spinner-button'"
- onmouseout="this.className='dr-spnr-bn rich-spinner-button'"
+ onmousedown="this.className='dr-spnr-bp rich-spinner-button'"
+ onmouseup="this.className='dr-spnr-bn rich-spinner-button'"
+ onmouseout="this.className='dr-spnr-bn rich-spinner-button'"
tabindex="#{component.attributes['tabindex']}" />
<jsp:scriptlet><![CDATA[
} else {
]]></jsp:scriptlet>
- <input
- type="image"
- src="#{up_arrow}"
- class="dr-spnr-bn rich-spinner-button"
- style="border:0"
- onclick="return false"
+ <input
+ type="image"
+ src="#{up_arrow}"
+ class="dr-spnr-bn rich-spinner-button"
+ style="border:0"
+ onclick="return false"
tabindex="#{component.attributes['tabindex']}" />
<jsp:scriptlet><![CDATA[
}
@@ -130,7 +130,7 @@
cycled:#{component.attributes['cycled']},
edited:#{component.attributes['enableManualInput']},
disabled:#{component.attributes['disabled']},
- chameleon:false,
+ chameleon:false,
required: #{component.attributes['required']},
clientErrorMsg: "#{component.attributes['clientErrorMessage']}"
},
Modified: trunk/ui/insert/src/main/java/org/ajax4jsf/renderkit/AbstractInsertRenderer.java
===================================================================
--- trunk/ui/insert/src/main/java/org/ajax4jsf/renderkit/AbstractInsertRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/insert/src/main/java/org/ajax4jsf/renderkit/AbstractInsertRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,165 +1,165 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ajax4jsf.renderkit;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.StringBufferInputStream;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-
-import javax.faces.FacesException;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.Messages;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.ui.component.DummyHighLight;
-import org.richfaces.ui.component.Highlight;
-import org.richfaces.ui.component.HighlightImpl;
-import org.richfaces.ui.component.UIInsert;
-
-/**
- * @author asmirnov
- *
- */
-public abstract class AbstractInsertRenderer extends
- HeaderResourcesRendererBase {
-
- private static final Object ERROR_MESSAGE_CLASS = "dr-insert-error";
-
-
-
- public void renderContent(FacesContext context, UIInsert component)
- throws IOException {
- boolean isSrcAvailable = (component.getSrc() != null);
- boolean isContentAvailable = (component.getContent() != null);
- if (isSrcAvailable && isContentAvailable) {
- throw new FacesException(UIInsert.ILLEGAL_ATTRIBUTE_VALUE_MESSAGE);
- }
-
- if (isSrcAvailable || isContentAvailable) {
- ExternalContext externalContext = context.getExternalContext();
- InputStream inputStream = null;
-
- if (isSrcAvailable) {
- inputStream = externalContext.getResourceAsStream(component.getSrc());
- } else if (isContentAvailable) {
- inputStream = new ByteArrayInputStream(component.getContent().getBytes());
- }
- if (null != inputStream) {
- renderStream(context, component, inputStream);
- } else {
- String errorContent = component.getErrorContent();
- if ((null != errorContent)
- && (null != (inputStream = externalContext.getResourceAsStream(errorContent)))) {
- // Render default content, if src not found.
- renderStream(context, component, inputStream);
- } else {
- // Render error message for a not found resource.
- renderErrorMessage(context, component, "UI_INSERT_RESOURCE_NOT_FOUND");
- }
- }
- } else {
- throw new FacesException("Attribute 'scr' for a component <rich:insert> " + component.getClientId(context)
- + " must be set");
- }
-
- }
-
- /**
- * @param context
- * @param component
- * @param message
- * TODO
- * @throws IOException
- */
- private void renderErrorMessage(FacesContext context, UIInsert component, String message)
- throws IOException {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement(HTML.SPAN_ELEM, component);
- writer.writeAttribute(HTML.class_ATTRIBUTE,
- ERROR_MESSAGE_CLASS, null);
- writer.write(Messages.getMessage(
- message, new Object[] {
- component.getClientId(context),
- component.getSrc() }));
- writer.endElement(HTML.SPAN_ELEM);
- }
-
- /**
- * @param context
- * @param component
- * @param inputStream
- * @throws UnsupportedEncodingException
- * @throws FacesException
- * @throws IOException
- */
- private void renderStream(FacesContext context, UIInsert component,
- InputStream inputStream) throws UnsupportedEncodingException,
- FacesException, IOException {
- ResponseWriter writer = context.getResponseWriter();
- String encoding = component.getEncoding();
- if (null == component.getHighlight()) {
- InputStreamReader in;
- if (null != encoding) {
- in = new InputStreamReader(inputStream, encoding);
- } else {
- in = new InputStreamReader(inputStream);
- }
- char[] temp = new char[1024];
- try {
- int bytes;
- while ((bytes = in.read(temp)) > 0) {
- writer.write(temp, 0, bytes);
- }
- } catch (IOException e) {
- throw new FacesException(e);
- } finally {
- in.close();
- }
- } else {
- Highlight highlighter;
- try {
- highlighter = new HighlightImpl(component.getHighlight());
-
- } catch (NoClassDefFoundError e) {
- renderErrorMessage(context, component, "HIGHLIGHT_LIBRARY_NOT_FOUND");
- highlighter = new DummyHighLight();
- }
- try {
- highlighter.highlight(component.getSrc(), inputStream, writer,
- encoding);
- } catch (IOException e) {
- throw new FacesException(e);
- } finally {
- inputStream.close();
- }
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ajax4jsf.renderkit;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.StringBufferInputStream;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.ui.component.DummyHighLight;
+import org.richfaces.ui.component.Highlight;
+import org.richfaces.ui.component.HighlightImpl;
+import org.richfaces.ui.component.UIInsert;
+
+/**
+ * @author asmirnov
+ *
+ */
+public abstract class AbstractInsertRenderer extends
+ HeaderResourcesRendererBase {
+
+ private static final Object ERROR_MESSAGE_CLASS = "dr-insert-error";
+
+
+
+ public void renderContent(FacesContext context, UIInsert component)
+ throws IOException {
+ boolean isSrcAvailable = (component.getSrc() != null);
+ boolean isContentAvailable = (component.getContent() != null);
+ if (isSrcAvailable && isContentAvailable) {
+ throw new FacesException(UIInsert.ILLEGAL_ATTRIBUTE_VALUE_MESSAGE);
+ }
+
+ if (isSrcAvailable || isContentAvailable) {
+ ExternalContext externalContext = context.getExternalContext();
+ InputStream inputStream = null;
+
+ if (isSrcAvailable) {
+ inputStream = externalContext.getResourceAsStream(component.getSrc());
+ } else if (isContentAvailable) {
+ inputStream = new ByteArrayInputStream(component.getContent().getBytes());
+ }
+ if (null != inputStream) {
+ renderStream(context, component, inputStream);
+ } else {
+ String errorContent = component.getErrorContent();
+ if ((null != errorContent)
+ && (null != (inputStream = externalContext.getResourceAsStream(errorContent)))) {
+ // Render default content, if src not found.
+ renderStream(context, component, inputStream);
+ } else {
+ // Render error message for a not found resource.
+ renderErrorMessage(context, component, "UI_INSERT_RESOURCE_NOT_FOUND");
+ }
+ }
+ } else {
+ throw new FacesException("Attribute 'scr' for a component <rich:insert> " + component.getClientId(context)
+ + " must be set");
+ }
+
+ }
+
+ /**
+ * @param context
+ * @param component
+ * @param message
+ * TODO
+ * @throws IOException
+ */
+ private void renderErrorMessage(FacesContext context, UIInsert component, String message)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement(HTML.SPAN_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE,
+ ERROR_MESSAGE_CLASS, null);
+ writer.write(Messages.getMessage(
+ message, new Object[] {
+ component.getClientId(context),
+ component.getSrc() }));
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+ /**
+ * @param context
+ * @param component
+ * @param inputStream
+ * @throws UnsupportedEncodingException
+ * @throws FacesException
+ * @throws IOException
+ */
+ private void renderStream(FacesContext context, UIInsert component,
+ InputStream inputStream) throws UnsupportedEncodingException,
+ FacesException, IOException {
+ ResponseWriter writer = context.getResponseWriter();
+ String encoding = component.getEncoding();
+ if (null == component.getHighlight()) {
+ InputStreamReader in;
+ if (null != encoding) {
+ in = new InputStreamReader(inputStream, encoding);
+ } else {
+ in = new InputStreamReader(inputStream);
+ }
+ char[] temp = new char[1024];
+ try {
+ int bytes;
+ while ((bytes = in.read(temp)) > 0) {
+ writer.write(temp, 0, bytes);
+ }
+ } catch (IOException e) {
+ throw new FacesException(e);
+ } finally {
+ in.close();
+ }
+ } else {
+ Highlight highlighter;
+ try {
+ highlighter = new HighlightImpl(component.getHighlight());
+
+ } catch (NoClassDefFoundError e) {
+ renderErrorMessage(context, component, "HIGHLIGHT_LIBRARY_NOT_FOUND");
+ highlighter = new DummyHighLight();
+ }
+ try {
+ highlighter.highlight(component.getSrc(), inputStream, writer,
+ encoding);
+ } catch (IOException e) {
+ throw new FacesException(e);
+ } finally {
+ inputStream.close();
+ }
+ }
+ }
+
+}
Modified: trunk/ui/insert/src/main/java/org/richfaces/ui/component/DummyHighLight.java
===================================================================
--- trunk/ui/insert/src/main/java/org/richfaces/ui/component/DummyHighLight.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/insert/src/main/java/org/richfaces/ui/component/DummyHighLight.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,58 +1,58 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.component;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-
-/**
- * @author asmirnov
- *
- */
-public class DummyHighLight implements Highlight {
-
- /* (non-Javadoc)
- * @see org.richfaces.ui.component.Highlight#highlight(java.lang.String, java.io.InputStream, java.io.OutputStream, java.lang.String, boolean)
- */
- public void highlight(String name, InputStream in, ResponseWriter out,
- String encoding) throws IOException {
- out.startElement("pre",null);
- InputStreamReader reader;
- if (null != encoding) {
- reader = new InputStreamReader(in, encoding);
- } else {
- reader = new InputStreamReader(in);
- }
- char[] temp = new char[1024];
- int bytes;
- while ((bytes = reader.read(temp)) > 0) {
- out.writeText(temp, 0, bytes);
- }
- out.endElement("pre");
- }
-
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.component;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class DummyHighLight implements Highlight {
+
+ /* (non-Javadoc)
+ * @see org.richfaces.ui.component.Highlight#highlight(java.lang.String, java.io.InputStream, java.io.OutputStream, java.lang.String, boolean)
+ */
+ public void highlight(String name, InputStream in, ResponseWriter out,
+ String encoding) throws IOException {
+ out.startElement("pre",null);
+ InputStreamReader reader;
+ if (null != encoding) {
+ reader = new InputStreamReader(in, encoding);
+ } else {
+ reader = new InputStreamReader(in);
+ }
+ char[] temp = new char[1024];
+ int bytes;
+ while ((bytes = reader.read(temp)) > 0) {
+ out.writeText(temp, 0, bytes);
+ }
+ out.endElement("pre");
+ }
+
+
+}
Modified: trunk/ui/insert/src/main/java/org/richfaces/ui/component/Highlight.java
===================================================================
--- trunk/ui/insert/src/main/java/org/richfaces/ui/component/Highlight.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/insert/src/main/java/org/richfaces/ui/component/Highlight.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,44 +1,44 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.component;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.faces.context.ResponseWriter;
-
-public interface Highlight {
-
- /**
- * @param name
- * @param in
- * @param out
- * @param encoding
- * @throws IOException
- * @see com.uwyn.jhighlight.renderer.Renderer#highlight(java.lang.String, java.io.InputStream, java.io.OutputStream, java.lang.String, boolean)
- */
- public void highlight(String name, InputStream in, ResponseWriter out,
- String encoding) throws IOException;
-
-
-
-}
\ No newline at end of file
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.component;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.faces.context.ResponseWriter;
+
+public interface Highlight {
+
+ /**
+ * @param name
+ * @param in
+ * @param out
+ * @param encoding
+ * @throws IOException
+ * @see com.uwyn.jhighlight.renderer.Renderer#highlight(java.lang.String, java.io.InputStream, java.io.OutputStream, java.lang.String, boolean)
+ */
+ public void highlight(String name, InputStream in, ResponseWriter out,
+ String encoding) throws IOException;
+
+
+
+}
Modified: trunk/ui/insert/src/main/java/org/richfaces/ui/component/HighlightImpl.java
===================================================================
--- trunk/ui/insert/src/main/java/org/richfaces/ui/component/HighlightImpl.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/insert/src/main/java/org/richfaces/ui/component/HighlightImpl.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,74 +1,74 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.component;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.faces.FacesException;
-import javax.faces.context.ResponseWriter;
-
-import com.uwyn.jhighlight.renderer.Renderer;
-import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class HighlightImpl implements Highlight {
-
-
-
- private Renderer _renderer;
-
- public HighlightImpl(String type) {
- _renderer = XhtmlRendererFactory.getRenderer(type);
- if(null == _renderer){
- throw new FacesException("Unknown type ["+type+"] to highlight source");
- }
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.ui.component.Highlight#highlight(java.lang.String, java.io.InputStream, java.io.OutputStream, java.lang.String, boolean)
- */
- public void highlight(String name, InputStream in, ResponseWriter out,
- String encoding) throws IOException {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- _renderer.highlight(name, in, outStream, encoding, true);
- if(null == encoding){
- out.write(outStream.toString());
- } else {
- out.write(outStream.toString(encoding));
- }
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.ui.component.Highlight#highlight(java.lang.String, java.lang.String, java.lang.String, boolean)
- */
- public String highlight(String name, String in, String encoding) throws IOException {
- return _renderer.highlight(name, in, encoding, true);
- }
-
-
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.component;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.faces.FacesException;
+import javax.faces.context.ResponseWriter;
+
+import com.uwyn.jhighlight.renderer.Renderer;
+import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class HighlightImpl implements Highlight {
+
+
+
+ private Renderer _renderer;
+
+ public HighlightImpl(String type) {
+ _renderer = XhtmlRendererFactory.getRenderer(type);
+ if(null == _renderer){
+ throw new FacesException("Unknown type ["+type+"] to highlight source");
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.ui.component.Highlight#highlight(java.lang.String, java.io.InputStream, java.io.OutputStream, java.lang.String, boolean)
+ */
+ public void highlight(String name, InputStream in, ResponseWriter out,
+ String encoding) throws IOException {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ _renderer.highlight(name, in, outStream, encoding, true);
+ if(null == encoding){
+ out.write(outStream.toString());
+ } else {
+ out.write(outStream.toString(encoding));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.ui.component.Highlight#highlight(java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public String highlight(String name, String in, String encoding) throws IOException {
+ return _renderer.highlight(name, in, encoding, true);
+ }
+
+
+
+}
Modified: trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx
===================================================================
--- trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/insert/src/main/templates/org/richfaces/ui/htmlInsert.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -9,11 +9,11 @@
baseclass="org.ajax4jsf.renderkit.AbstractInsertRenderer"
component="org.richfaces.ui.component.UIInsert"
>
- <h:styles>css/highlight.xcss</h:styles>
+ <h:styles>css/highlight.xcss</h:styles>
<f:clientid var="clientId"/>
<div id="#{clientId}"
x:passThruWithExclusions="value,name,type,id"
- >
- <f:call name="renderContent"/>
+ >
+ <f:call name="renderContent"/>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/jQuery/src/main/templates/jQuery.jspx
===================================================================
--- trunk/ui/jQuery/src/main/templates/jQuery.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/jQuery/src/main/templates/jQuery.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -75,4 +75,4 @@
<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx
===================================================================
--- trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/listShuttle/src/main/templates/org/richfaces/htmlListShuttle.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -29,10 +29,10 @@
</h:scripts>
<f:clientId var="clientId"/>
-
- <table id="#{clientId}" class="rich-list-shuttle #{component.attributes['styleClass']}"
+
+ <table id="#{clientId}" class="rich-list-shuttle #{component.attributes['styleClass']}"
cellspacing="0" cellpadding="0"
- x:passThruWithExclusions="id,class,styleClass">
+ x:passThruWithExclusions="id,class,styleClass">
<tbody>
<vcp:body>
<f:clientId var="clientId"/>
@@ -49,18 +49,18 @@
Boolean switchByClick = (Boolean) component.getAttributes().get("switchByClick");
variables.setVariable("switchByClick", switchByClick);
-
+
variables.setVariable("baseClientId", component.getBaseClientId(context));
]]>
</jsp:scriptlet>
- <tr style="#{this:getCaptionDisplay(context, component)}" >
- <td class="rich-list-shuttle-caption" colspan="2">
- <f:call name="encodeSLCaption"/>
- </td>
- <td class="rich-list-shuttle-caption" colspan="2">
- <f:call name="encodeTLCaption"/>
- </td>
+ <tr style="#{this:getCaptionDisplay(context, component)}" >
+ <td class="rich-list-shuttle-caption" colspan="2">
+ <f:call name="encodeSLCaption"/>
+ </td>
+ <td class="rich-list-shuttle-caption" colspan="2">
+ <f:call name="encodeTLCaption"/>
+ </td>
</tr>
<tr>
<td>
@@ -229,4 +229,4 @@
</vcp:body>
</tbody>
</table>
-</f:root>
+</f:root>
Modified: trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
===================================================================
--- trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,421 +1,421 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.component.html.HtmlOutputText;
-import javax.servlet.http.HttpServletResponse;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.image.ImageInfo;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-import org.richfaces.component.UIListShuttle;
-
-import com.gargoylesoftware.htmlunit.Page;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-public class ListShuttleRenderingTest extends AbstractAjax4JsfTestCase {
- private static final int IMAGE_COUNT = 16;
-
- private UIListShuttle listShuttle = null;
- private UIForm form = null;
- private List<SimpleItem> items = null;
- private HtmlOutputText output1 = null;
- private HtmlOutputText output2 = null;
- private UIColumn column1 = null;
- private UIColumn column2 = null;
-
- private static final Set<String> javaScripts = new HashSet<String>();
- private static final Set<String> imageClasses = new HashSet<String>();
- private static final Set<String> imagePNGClasses = new HashSet<String>();
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("scripts/utils.js");
- javaScripts.add("scripts/ShuttleUtils.js");
- javaScripts.add("scripts/SelectItem.js");
- javaScripts.add("scripts/LayoutManager.js");
- javaScripts.add("scripts/Control.js");
- javaScripts.add("scripts/OrderingList.js");
- javaScripts.add("scripts/ListShuttle.js");
- javaScripts.add("scripts/ListBase.js");
-
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUp");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDownDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTopDisabled");
-
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopy");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyAll");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemove");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDown");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled");
-
- imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient");
- imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient");
- imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient");
-
-
- }
-
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public ListShuttleRenderingTest(String testName) {
- super(testName);
- }
-
- public void setUp() throws Exception {
- super.setUp();
-
- application.addComponent(UIListShuttle.COMPONENT_TYPE, "org.richfaces.component.html.HtmlListShuttle");
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- listShuttle = (UIListShuttle)application.createComponent(UIListShuttle.COMPONENT_TYPE);
- listShuttle.setId("listShuttle");
- listShuttle.setVar("item");
-
- items = new ArrayList<SimpleItem>();
- items.add(new SimpleItem("Michael", 2000));
- items.add(new SimpleItem("John", 500));
- items.add(new SimpleItem("George", 4000));
-
- listShuttle.setSourceValue(items);
-
- output1 = new HtmlOutputText();
- output1.setValueBinding("value", application.createValueBinding("#{item.name}"));
- column1 = new UIColumn();
- column1.getChildren().add(output1);
- listShuttle.getChildren().add(column1);
-
- output2 = new HtmlOutputText();
- output2.setValueBinding("value", application.createValueBinding("#{item.salary}"));
- column2 = new UIColumn();
- column2.getChildren().add(output2);
- listShuttle.getChildren().add(column2);
-
- form.getChildren().add(listShuttle);
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
-
- items = null;
- output1 = null;
- output2 = null;
- column1 = null;
- column2 = null;
- listShuttle = null;
- form = null;
- }
-
- /**
- * Test common rendering
- *
- * @throws Exception
- */
- public void testCommonRendering() throws Exception{
- HtmlPage view = renderView();
- assertNotNull(view);
-
- HtmlElement table = view.getHtmlElementById(listShuttle.getClientId(facesContext));
- assertNotNull(table);
- assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
-
- HtmlElement tbody = (HtmlElement) table.getFirstDomChild();
- assertNotNull(tbody);
- assertEquals(HTML.TBOBY_ELEMENT, tbody.getTagName());
-
- HtmlElement tr = (HtmlElement) tbody.getFirstDomChild();
- assertNotNull(tr);
- String style = tr.getAttributeValue(HTML.style_ATTRIBUTE);
- assertNotNull(style);
- assertTrue(style.contains("display: none;"));
- assertEquals(HTML.TR_ELEMENT, tr.getTagName());
-
- tr = (HtmlElement) tr.getNextDomSibling();
- assertNotNull(tr);
- assertNull(tr.getNextDomSibling());
-
- int childCount = 0;
- for (Iterator<HtmlElement> it = tr.getChildIterator(); it.hasNext();) {
- HtmlElement td = it.next();
- assertNotNull(td);
- assertEquals(HTML.td_ELEM, td.getTagName());
- childCount++;
- }
- assertEquals(4, childCount);
-
- HtmlElement hidden1 = view.getHtmlElementById(listShuttle.getClientId(facesContext) + "focusKeeper");
- assertNotNull(hidden1);
- assertEquals(HTML.INPUT_ELEM, hidden1.getNodeName());
- assertEquals(HTML.BUTTON, hidden1.getAttributeValue(HTML.TYPE_ATTR));
- hidden1.getAttributeValue(HTML.style_ATTRIBUTE).contains("left: -32767px");
-
- List<HtmlElement> inputs = view.getDocumentHtmlElement().
- getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "focusKeeper");
- assertNotNull(inputs);
- assertEquals(1, inputs.size());
- inputs = view.getDocumentHtmlElement().
- getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "tlFocusKeeper");
- assertNotNull(inputs);
- assertEquals(1, inputs.size());
-
- inputs = view.getDocumentHtmlElement().
- getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.NAME_ATTRIBUTE, listShuttle.getClientId(facesContext));
- assertNotNull(inputs);
- assertEquals(4, inputs.size());
- }
-
- /**
- * Test script rendering
- *
- * @throws Exception
- */
- public void testRenderScript() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
- List<HtmlScript> scripts = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
- int foundCount = 0;
- for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = it.next();
- String srcAttr = item.getSrcAttribute();
-
- if (StringUtils.isNotBlank(srcAttr)) {
- boolean found = false;
- for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
-
- found = srcAttr.contains(src);
- if (found) {
- foundCount++;
-
- String uri = "http:" + srcAttr;
- Page page = webClient.getPage(uri);
- assertNotNull(page);
- assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
-
- break;
- }
- }
-
- assertTrue(found);
- }
- }
- assertEquals(javaScripts.size(), foundCount);
- }
-
- /**
- * Test style rendering
- *
- * @throws Exception
- */
- public void testRenderStyle() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
- List<HtmlElement> links = view.getDocumentElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
- assertNotNull(links);
- assertEquals(1, links.size());
- HtmlElement link = links.get(0);
- assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/listShuttle.xcss"));
-
- String uri = "http:" + link.getAttributeValue(HTML.HREF_ATTR);
- Page page = webClient.getPage(uri);
- assertNotNull(page);
- assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
- }
-
- /**
- * Test controls rendering
- *
- * @throws Exception
- */
- public void testRenderControls() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- List<HtmlElement> images = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.IMG_ELEMENT);
- assertNotNull(images);
-
- int foundImages = 0;
- for (Iterator<HtmlElement> it = images.iterator(); it.hasNext(); ) {
- HtmlElement img = it.next();
- assertNotNull(img);
-
- String uri = "http:" + img.getAttributeValue(HTML.src_ATTRIBUTE);
- Page page = webClient.getPage(uri);
- assertNotNull(page);
- assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
-
- if (uri.contains("spacer.gif")) {
- continue;
- }
- foundImages++;
-
- HtmlElement element = (HtmlElement) img.getParentDomNode();
- assertNotNull(element);
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
-
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
-
- if (HTML.a_ELEMENT.equalsIgnoreCase(element.getNodeName())) {
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
- }
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
-
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
- String clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue(clazz.contains("rich-shuttle-control"));
- }
- assertEquals(IMAGE_COUNT, foundImages);
- }
-
- /**
- * Test default images rendering
- *
- * @throws Exception
- */
- public void testRenderImages() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
- String clazz = it.next();
- ImageInfo info = getImageResource(clazz);
- assertNotNull(info);
- assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
- assertTrue(info.getHeight() > 0);
- assertTrue(info.getWidth() > 0);
- }
-
- for (Iterator<String> it = imagePNGClasses.iterator(); it.hasNext(); ) {
- String clazz = it.next();
- ImageInfo info = getImageResource(clazz);
- assertNotNull(info);
- assertEquals(ImageInfo.FORMAT_PNG, info.getFormat());
- assertTrue(info.getHeight() > 0);
- assertTrue(info.getWidth() > 0);
- }
- }
-
- /**
- * Test items rendering
- *
- * @throws Exception
- */
- public void testRenderItems() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- HtmlElement div = view.getHtmlElementById(listShuttle.getClientId(facesContext) + "contentBox");
- assertNotNull(div);
- assertEquals(HTML.DIV_ELEM, div.getNodeName());
-
- HtmlElement table = (HtmlElement)div.getFirstDomChild();
- assertNotNull(table);
- assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
-
- HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
- assertNotNull(tbody);
- assertEquals(HTML.TBOBY_ELEMENT, tbody.getNodeName());
-
- int rowsCount = 0;
- for (Iterator<HtmlElement> it = tbody.getChildIterator(); it.hasNext(); ) {
- HtmlElement tr = it.next();
- assertNotNull(tr);
- assertEquals(HTML.TR_ELEMENT, tr.getNodeName());
-
- String clazz = tr.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue(clazz.contains("rich-shuttle-source-row"));
-
- int cellsCount = 0;
- for (Iterator<HtmlElement> it2 = tr.getChildIterator(); it2.hasNext(); ) {
- HtmlElement td = it2.next();
- assertNotNull(td);
- assertEquals(HTML.td_ELEM, td.getNodeName());
-
- String clazz2 = td.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz2);
- assertTrue(clazz2.contains("rich-shuttle-source-cell"));
-
- cellsCount++;
- }
- assertEquals(2, cellsCount);
-
- rowsCount++;
- }
- assertEquals(items.size(), rowsCount);
- }
-
- protected class SimpleItem {
- String name;
- int salary;
-
- public SimpleItem(String name, int salary) {
- this.name = name;
- this.salary = salary;
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getSalary() {
- return salary;
- }
- public void setSalary(int salary) {
- this.salary = salary;
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.image.ImageInfo;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+import org.richfaces.component.UIListShuttle;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+public class ListShuttleRenderingTest extends AbstractAjax4JsfTestCase {
+ private static final int IMAGE_COUNT = 16;
+
+ private UIListShuttle listShuttle = null;
+ private UIForm form = null;
+ private List<SimpleItem> items = null;
+ private HtmlOutputText output1 = null;
+ private HtmlOutputText output2 = null;
+ private UIColumn column1 = null;
+ private UIColumn column2 = null;
+
+ private static final Set<String> javaScripts = new HashSet<String>();
+ private static final Set<String> imageClasses = new HashSet<String>();
+ private static final Set<String> imagePNGClasses = new HashSet<String>();
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("scripts/utils.js");
+ javaScripts.add("scripts/ShuttleUtils.js");
+ javaScripts.add("scripts/SelectItem.js");
+ javaScripts.add("scripts/LayoutManager.js");
+ javaScripts.add("scripts/Control.js");
+ javaScripts.add("scripts/OrderingList.js");
+ javaScripts.add("scripts/ListShuttle.js");
+ javaScripts.add("scripts/ListBase.js");
+
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUp");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDownDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTopDisabled");
+
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopy");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyAll");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemove");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDown");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled");
+
+ imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient");
+ imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient");
+ imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient");
+
+
+ }
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public ListShuttleRenderingTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent(UIListShuttle.COMPONENT_TYPE, "org.richfaces.component.html.HtmlListShuttle");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ listShuttle = (UIListShuttle)application.createComponent(UIListShuttle.COMPONENT_TYPE);
+ listShuttle.setId("listShuttle");
+ listShuttle.setVar("item");
+
+ items = new ArrayList<SimpleItem>();
+ items.add(new SimpleItem("Michael", 2000));
+ items.add(new SimpleItem("John", 500));
+ items.add(new SimpleItem("George", 4000));
+
+ listShuttle.setSourceValue(items);
+
+ output1 = new HtmlOutputText();
+ output1.setValueBinding("value", application.createValueBinding("#{item.name}"));
+ column1 = new UIColumn();
+ column1.getChildren().add(output1);
+ listShuttle.getChildren().add(column1);
+
+ output2 = new HtmlOutputText();
+ output2.setValueBinding("value", application.createValueBinding("#{item.salary}"));
+ column2 = new UIColumn();
+ column2.getChildren().add(output2);
+ listShuttle.getChildren().add(column2);
+
+ form.getChildren().add(listShuttle);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ items = null;
+ output1 = null;
+ output2 = null;
+ column1 = null;
+ column2 = null;
+ listShuttle = null;
+ form = null;
+ }
+
+ /**
+ * Test common rendering
+ *
+ * @throws Exception
+ */
+ public void testCommonRendering() throws Exception{
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ HtmlElement table = view.getHtmlElementById(listShuttle.getClientId(facesContext));
+ assertNotNull(table);
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
+
+ HtmlElement tbody = (HtmlElement) table.getFirstDomChild();
+ assertNotNull(tbody);
+ assertEquals(HTML.TBOBY_ELEMENT, tbody.getTagName());
+
+ HtmlElement tr = (HtmlElement) tbody.getFirstDomChild();
+ assertNotNull(tr);
+ String style = tr.getAttributeValue(HTML.style_ATTRIBUTE);
+ assertNotNull(style);
+ assertTrue(style.contains("display: none;"));
+ assertEquals(HTML.TR_ELEMENT, tr.getTagName());
+
+ tr = (HtmlElement) tr.getNextDomSibling();
+ assertNotNull(tr);
+ assertNull(tr.getNextDomSibling());
+
+ int childCount = 0;
+ for (Iterator<HtmlElement> it = tr.getChildIterator(); it.hasNext();) {
+ HtmlElement td = it.next();
+ assertNotNull(td);
+ assertEquals(HTML.td_ELEM, td.getTagName());
+ childCount++;
+ }
+ assertEquals(4, childCount);
+
+ HtmlElement hidden1 = view.getHtmlElementById(listShuttle.getClientId(facesContext) + "focusKeeper");
+ assertNotNull(hidden1);
+ assertEquals(HTML.INPUT_ELEM, hidden1.getNodeName());
+ assertEquals(HTML.BUTTON, hidden1.getAttributeValue(HTML.TYPE_ATTR));
+ hidden1.getAttributeValue(HTML.style_ATTRIBUTE).contains("left: -32767px");
+
+ List<HtmlElement> inputs = view.getDocumentHtmlElement().
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "focusKeeper");
+ assertNotNull(inputs);
+ assertEquals(1, inputs.size());
+ inputs = view.getDocumentHtmlElement().
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.id_ATTRIBUTE, listShuttle.getClientId(facesContext) + "tlFocusKeeper");
+ assertNotNull(inputs);
+ assertEquals(1, inputs.size());
+
+ inputs = view.getDocumentHtmlElement().
+ getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.NAME_ATTRIBUTE, listShuttle.getClientId(facesContext));
+ assertNotNull(inputs);
+ assertEquals(4, inputs.size());
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+ List<HtmlScript> scripts = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
+ int foundCount = 0;
+ for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ foundCount++;
+
+ String uri = "http:" + srcAttr;
+ Page page = webClient.getPage(uri);
+ assertNotNull(page);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ assertEquals(javaScripts.size(), foundCount);
+ }
+
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+ List<HtmlElement> links = view.getDocumentElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
+ assertNotNull(links);
+ assertEquals(1, links.size());
+ HtmlElement link = links.get(0);
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/listShuttle.xcss"));
+
+ String uri = "http:" + link.getAttributeValue(HTML.HREF_ATTR);
+ Page page = webClient.getPage(uri);
+ assertNotNull(page);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ }
+
+ /**
+ * Test controls rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderControls() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ List<HtmlElement> images = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.IMG_ELEMENT);
+ assertNotNull(images);
+
+ int foundImages = 0;
+ for (Iterator<HtmlElement> it = images.iterator(); it.hasNext(); ) {
+ HtmlElement img = it.next();
+ assertNotNull(img);
+
+ String uri = "http:" + img.getAttributeValue(HTML.src_ATTRIBUTE);
+ Page page = webClient.getPage(uri);
+ assertNotNull(page);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ if (uri.contains("spacer.gif")) {
+ continue;
+ }
+ foundImages++;
+
+ HtmlElement element = (HtmlElement) img.getParentDomNode();
+ assertNotNull(element);
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+
+ if (HTML.a_ELEMENT.equalsIgnoreCase(element.getNodeName())) {
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+ }
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ String clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue(clazz.contains("rich-shuttle-control"));
+ }
+ assertEquals(IMAGE_COUNT, foundImages);
+ }
+
+ /**
+ * Test default images rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderImages() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
+ String clazz = it.next();
+ ImageInfo info = getImageResource(clazz);
+ assertNotNull(info);
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+ assertTrue(info.getHeight() > 0);
+ assertTrue(info.getWidth() > 0);
+ }
+
+ for (Iterator<String> it = imagePNGClasses.iterator(); it.hasNext(); ) {
+ String clazz = it.next();
+ ImageInfo info = getImageResource(clazz);
+ assertNotNull(info);
+ assertEquals(ImageInfo.FORMAT_PNG, info.getFormat());
+ assertTrue(info.getHeight() > 0);
+ assertTrue(info.getWidth() > 0);
+ }
+ }
+
+ /**
+ * Test items rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderItems() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ HtmlElement div = view.getHtmlElementById(listShuttle.getClientId(facesContext) + "contentBox");
+ assertNotNull(div);
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+
+ HtmlElement table = (HtmlElement)div.getFirstDomChild();
+ assertNotNull(table);
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
+
+ HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
+ assertNotNull(tbody);
+ assertEquals(HTML.TBOBY_ELEMENT, tbody.getNodeName());
+
+ int rowsCount = 0;
+ for (Iterator<HtmlElement> it = tbody.getChildIterator(); it.hasNext(); ) {
+ HtmlElement tr = it.next();
+ assertNotNull(tr);
+ assertEquals(HTML.TR_ELEMENT, tr.getNodeName());
+
+ String clazz = tr.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue(clazz.contains("rich-shuttle-source-row"));
+
+ int cellsCount = 0;
+ for (Iterator<HtmlElement> it2 = tr.getChildIterator(); it2.hasNext(); ) {
+ HtmlElement td = it2.next();
+ assertNotNull(td);
+ assertEquals(HTML.td_ELEM, td.getNodeName());
+
+ String clazz2 = td.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz2);
+ assertTrue(clazz2.contains("rich-shuttle-source-cell"));
+
+ cellsCount++;
+ }
+ assertEquals(2, cellsCount);
+
+ rowsCount++;
+ }
+ assertEquals(items.size(), rowsCount);
+ }
+
+ protected class SimpleItem {
+ String name;
+ int salary;
+
+ public SimpleItem(String name, int salary) {
+ this.name = name;
+ this.salary = salary;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getSalary() {
+ return salary;
+ }
+ public void setSalary(int salary) {
+ this.salary = salary;
+ }
+ }
+
+}
Modified: trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java
===================================================================
--- trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/menu-components/src/main/java/org/richfaces/renderkit/html/MenuItemRendererDelegate.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,190 +1,190 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.RendererBase;
-
-public class MenuItemRendererDelegate extends RendererBase {
-
- protected void initializeStyles(FacesContext context, UIComponent menuItem,
- boolean disabled, ComponentVariables variables) {
- UIComponent parentMenu = getParentMenu(context, menuItem);
-
- Object itemClass = "";
- Object itemStyle = "";
- Object disabledItemClass = "";
- Object disabledItemStyle = "";
- Object selectItemClass = "";
-
- if (parentMenu != null) {
- itemClass = parentMenu.getAttributes().get("itemClass");
- itemStyle = parentMenu.getAttributes().get("itemStyle");
- disabledItemClass = parentMenu.getAttributes().get("disabledItemClass");
- disabledItemStyle = parentMenu.getAttributes().get("disabledItemStyle");
- selectItemClass = parentMenu.getAttributes().get("selectItemClass");
-
- }
- Object selectClass = menuItem.getAttributes().get("selectClass");
- Object styleClass = menuItem.getAttributes().get("styleClass");
- Object style = menuItem.getAttributes().get("style");
- Object labelClass = (String)menuItem.getAttributes().get("labelClass");
- Object disabledLabelClass = (String)menuItem.getAttributes().get("labelClass");
- Object selectedLabelClass = (String)menuItem.getAttributes().get("labelClass");
-
- if (null == labelClass) {
- labelClass = "";
- }
- if (null == disabledLabelClass) {
- disabledLabelClass = "";
- }
- if (null == selectedLabelClass) {
- selectedLabelClass = "";
- }
- if (null == itemClass) {
- itemClass = "";
- }
- if (null == itemStyle) {
- itemStyle = "";
- }
- if (null == disabledItemClass) {
- disabledItemClass = "";
- }
- if (null == disabledItemStyle) {
- disabledItemStyle = "";
- }
- if (null == selectItemClass) {
- selectItemClass = "";
- }
- if (null == styleClass) {
- styleClass = "";
- }
- if (null == selectClass) {
- selectClass = "";
- }
- if (null == style) {
- style = "";
- }
-
- if (disabled) {
- variables.setVariable("menuItemClass",
- "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled " +
- styleClass + " " +
- itemClass + " " + disabledItemClass);
- variables.setVariable("menuItemStyle",
- itemStyle + "; " + disabledItemStyle + "; " + style);
- variables.setVariable("menuItemLabelClass", "rich-menu-item-label rich-menu-item-label-disabled " +
- labelClass + " " + disabledLabelClass);
- variables.setVariable("menuGroupClass", "dr-menu-item dr-menu-item-disabled rich-menu-group rich-menu-group-disabled " +
- itemClass + " " + disabledItemClass + " " + styleClass);
- variables.setVariable("menuItemMouseMove", "");
- variables.setVariable("menuItemItemIconClass", "rich-menu-item-icon-disabled");
- variables.setVariable("menuItemItemLabelClass", "rich-menu-item-label-disabled " + labelClass);
- variables.setVariable("menuItemItemFolderClass", "rich-menu-item-folder-disabled");
- } else {
- variables.setVariable("menuItemClass",
- "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled " +
- styleClass + " " + itemClass);
- variables.setVariable("menuItemStyle", itemStyle + "; " + style);
- variables.setVariable("menuItemHoverClass",
- "this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover " +
- styleClass + " " + selectClass +
- selectItemClass + "';");
- variables.setVariable("menuItemLabelClass", "rich-menu-item-label " + labelClass);
- variables.setVariable("selectLabelClass", selectedLabelClass);
- variables.setVariable("menuGroupClass", "dr-menu-item dr-menu-item-enabled rich-menu-group " +
- itemClass + " " + styleClass);
- variables.setVariable("menuItemMouseMove", menuItem.getAttributes().get("onmousemove"));
- variables.setVariable("menuGroupItemIconClass", "rich-menu-item-icon-enabled rich-menu-group-icon ");
- variables.setVariable("menuGroupItemLabelClass", "rich-menu-item-label rich-menu-group-label " + labelClass);
- variables.setVariable("menuGroupItemFolderClass", "rich-menu-item-folder rich-menu-group-folder ");
- variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context, menuItem, false));
- variables.setVariable("onmouseoverInlineStyles", processInlineStyles(context, menuItem, true));
-
- variables.setVariable("menuGroupHoverClass", "this.className='dr-menu-item dr-menu-item-enabled rich-menu-group " +
- itemClass + " " + selectItemClass + " " + styleClass + "'");
- }
- }
-
- protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean isOnmouseover) {
-
- StringBuffer buffer = new StringBuffer();
- Object style = menuItem.getAttributes().get("style");
- Object selectStyle = menuItem.getAttributes().get("selectStyle");
-
- UIComponent parentMenu = getParentMenu(context, menuItem);
- Object selectItemStyle = null;
- Object itemStyle = null;
- if (parentMenu != null) {
- selectItemStyle = parentMenu.getAttributes().get("selectItemStyle");
- itemStyle = parentMenu.getAttributes().get("itemStyle");
-
- }
-
- if (null == selectStyle) {
- selectStyle = "";
- }
- if (null == selectItemStyle) {
- selectItemStyle = "";
- }
- if (null == itemStyle) {
- itemStyle = "";
- }
-
- selectStyle = itemStyle + "; " + selectItemStyle + "; " + selectStyle;
-
- buffer.append("$('" + menuItem.getClientId(context) + "').style.cssText='");
-
- if (null != style) {
- buffer.append(style.toString() + "; ");
- }
-
- if (isOnmouseover) {
- buffer.append(selectStyle.toString() + ";';");
- } else {
- buffer.append(itemStyle.toString() + ";';");
- }
-
- return buffer.toString();
- }
-
- protected UIComponent getParentMenu(FacesContext context, UIComponent menuItem) {
- UIComponent parent = menuItem.getParent();
- while (null != parent) {
- if (parent instanceof org.richfaces.component.MenuComponent) {
- return parent;
- }
- parent = parent.getParent();
- }
- return null;
-// throw new FacesException( "Parent menu for menu group (id="
-// + menuItem.getClientId(context) + ") has not been found.");
- }
-
- protected Class getComponentClass() {
- return null;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.RendererBase;
+
+public class MenuItemRendererDelegate extends RendererBase {
+
+ protected void initializeStyles(FacesContext context, UIComponent menuItem,
+ boolean disabled, ComponentVariables variables) {
+ UIComponent parentMenu = getParentMenu(context, menuItem);
+
+ Object itemClass = "";
+ Object itemStyle = "";
+ Object disabledItemClass = "";
+ Object disabledItemStyle = "";
+ Object selectItemClass = "";
+
+ if (parentMenu != null) {
+ itemClass = parentMenu.getAttributes().get("itemClass");
+ itemStyle = parentMenu.getAttributes().get("itemStyle");
+ disabledItemClass = parentMenu.getAttributes().get("disabledItemClass");
+ disabledItemStyle = parentMenu.getAttributes().get("disabledItemStyle");
+ selectItemClass = parentMenu.getAttributes().get("selectItemClass");
+
+ }
+ Object selectClass = menuItem.getAttributes().get("selectClass");
+ Object styleClass = menuItem.getAttributes().get("styleClass");
+ Object style = menuItem.getAttributes().get("style");
+ Object labelClass = (String)menuItem.getAttributes().get("labelClass");
+ Object disabledLabelClass = (String)menuItem.getAttributes().get("labelClass");
+ Object selectedLabelClass = (String)menuItem.getAttributes().get("labelClass");
+
+ if (null == labelClass) {
+ labelClass = "";
+ }
+ if (null == disabledLabelClass) {
+ disabledLabelClass = "";
+ }
+ if (null == selectedLabelClass) {
+ selectedLabelClass = "";
+ }
+ if (null == itemClass) {
+ itemClass = "";
+ }
+ if (null == itemStyle) {
+ itemStyle = "";
+ }
+ if (null == disabledItemClass) {
+ disabledItemClass = "";
+ }
+ if (null == disabledItemStyle) {
+ disabledItemStyle = "";
+ }
+ if (null == selectItemClass) {
+ selectItemClass = "";
+ }
+ if (null == styleClass) {
+ styleClass = "";
+ }
+ if (null == selectClass) {
+ selectClass = "";
+ }
+ if (null == style) {
+ style = "";
+ }
+
+ if (disabled) {
+ variables.setVariable("menuItemClass",
+ "dr-menu-item dr-menu-item-disabled rich-menu-item rich-menu-item-disabled " +
+ styleClass + " " +
+ itemClass + " " + disabledItemClass);
+ variables.setVariable("menuItemStyle",
+ itemStyle + "; " + disabledItemStyle + "; " + style);
+ variables.setVariable("menuItemLabelClass", "rich-menu-item-label rich-menu-item-label-disabled " +
+ labelClass + " " + disabledLabelClass);
+ variables.setVariable("menuGroupClass", "dr-menu-item dr-menu-item-disabled rich-menu-group rich-menu-group-disabled " +
+ itemClass + " " + disabledItemClass + " " + styleClass);
+ variables.setVariable("menuItemMouseMove", "");
+ variables.setVariable("menuItemItemIconClass", "rich-menu-item-icon-disabled");
+ variables.setVariable("menuItemItemLabelClass", "rich-menu-item-label-disabled " + labelClass);
+ variables.setVariable("menuItemItemFolderClass", "rich-menu-item-folder-disabled");
+ } else {
+ variables.setVariable("menuItemClass",
+ "dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled " +
+ styleClass + " " + itemClass);
+ variables.setVariable("menuItemStyle", itemStyle + "; " + style);
+ variables.setVariable("menuItemHoverClass",
+ "this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover " +
+ styleClass + " " + selectClass +
+ selectItemClass + "';");
+ variables.setVariable("menuItemLabelClass", "rich-menu-item-label " + labelClass);
+ variables.setVariable("selectLabelClass", selectedLabelClass);
+ variables.setVariable("menuGroupClass", "dr-menu-item dr-menu-item-enabled rich-menu-group " +
+ itemClass + " " + styleClass);
+ variables.setVariable("menuItemMouseMove", menuItem.getAttributes().get("onmousemove"));
+ variables.setVariable("menuGroupItemIconClass", "rich-menu-item-icon-enabled rich-menu-group-icon ");
+ variables.setVariable("menuGroupItemLabelClass", "rich-menu-item-label rich-menu-group-label " + labelClass);
+ variables.setVariable("menuGroupItemFolderClass", "rich-menu-item-folder rich-menu-group-folder ");
+ variables.setVariable("onmouseoutInlineStyles", processInlineStyles(context, menuItem, false));
+ variables.setVariable("onmouseoverInlineStyles", processInlineStyles(context, menuItem, true));
+
+ variables.setVariable("menuGroupHoverClass", "this.className='dr-menu-item dr-menu-item-enabled rich-menu-group " +
+ itemClass + " " + selectItemClass + " " + styleClass + "'");
+ }
+ }
+
+ protected String processInlineStyles(FacesContext context, UIComponent menuItem, boolean isOnmouseover) {
+
+ StringBuffer buffer = new StringBuffer();
+ Object style = menuItem.getAttributes().get("style");
+ Object selectStyle = menuItem.getAttributes().get("selectStyle");
+
+ UIComponent parentMenu = getParentMenu(context, menuItem);
+ Object selectItemStyle = null;
+ Object itemStyle = null;
+ if (parentMenu != null) {
+ selectItemStyle = parentMenu.getAttributes().get("selectItemStyle");
+ itemStyle = parentMenu.getAttributes().get("itemStyle");
+
+ }
+
+ if (null == selectStyle) {
+ selectStyle = "";
+ }
+ if (null == selectItemStyle) {
+ selectItemStyle = "";
+ }
+ if (null == itemStyle) {
+ itemStyle = "";
+ }
+
+ selectStyle = itemStyle + "; " + selectItemStyle + "; " + selectStyle;
+
+ buffer.append("$('" + menuItem.getClientId(context) + "').style.cssText='");
+
+ if (null != style) {
+ buffer.append(style.toString() + "; ");
+ }
+
+ if (isOnmouseover) {
+ buffer.append(selectStyle.toString() + ";';");
+ } else {
+ buffer.append(itemStyle.toString() + ";';");
+ }
+
+ return buffer.toString();
+ }
+
+ protected UIComponent getParentMenu(FacesContext context, UIComponent menuItem) {
+ UIComponent parent = menuItem.getParent();
+ while (null != parent) {
+ if (parent instanceof org.richfaces.component.MenuComponent) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ return null;
+// throw new FacesException( "Parent menu for menu group (id="
+// + menuItem.getClientId(context) + ") has not been found.");
+ }
+
+ protected Class getComponentClass() {
+ return null;
+ }
+
+}
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -8,7 +8,7 @@
xmlns:vcp=" http://jsf.exadel.com/vcp"
baseclass="org.richfaces.renderkit.html.MenuGroupRendererBase"
class="org.richfaces.renderkit.html.MenuGroupRenderer"
- component="org.richfaces.component.UIMenuGroup" >
+ component="org.richfaces.component.UIMenuGroup" >
<h:styles>css/menucomponents.xcss</h:styles>
@@ -18,7 +18,7 @@
</h:scripts>
<f:clientid var="clientId"/>
- <f:call name="initializeResources" />
+ <f:call name="initializeResources" />
<f:call name="initializeStyleClasses" />
<f:resource name="/org/richfaces/renderkit/html/images/spacer.gif" var="spacer" />
@@ -26,42 +26,42 @@
<div id="#{clientId}"
class="#{menuGroupClass}"
style="#{menuItemStyle}"
- onmousemove="#{menuItemMouseMove}"
- onmouseout="if (RichFaces.Menu.isWithin(event, this)) return; this.className='#{menuGroupClass}'; #{onmouseoutInlineStyles}"
+ onmousemove="#{menuItemMouseMove}"
+ onmouseout="if (RichFaces.Menu.isWithin(event, this)) return; this.className='#{menuGroupClass}'; #{onmouseoutInlineStyles}"
onmouseover="if (RichFaces.Menu.isWithin(event, this)) return; #{menuGroupHoverClass}; #{onmouseoverInlineStyles}" >
-
+
<span id="#{clientId}:icon"
class="dr-menu-icon #{menuGroupItemIconClass} #{component.attributes['iconClass']}">
<jsp:scriptlet>
- <![CDATA[
- boolean disabled = ((Boolean) component.getAttributes().get("disabled")).booleanValue();
- String iconName = disabled ? "iconDisabled" : "icon";
+ <![CDATA[
+ boolean disabled = ((Boolean) component.getAttributes().get("disabled")).booleanValue();
+ String iconName = disabled ? "iconDisabled" : "icon";
UIComponent iconFacet = component.getFacet(iconName);
- if (iconFacet !=null && iconFacet.isRendered()) {
+ if (iconFacet !=null && iconFacet.isRendered()) {
renderChild(context, iconFacet);
} else if (component.getAttributes().get(iconName)!=null) {]]>
</jsp:scriptlet>
- <img width="16" height="16" alt=" "
+ <img width="16" height="16" alt=""
style="#{component.attributes['iconStyle']}"
src="#{actualIcon}"/>
<jsp:scriptlet>
<![CDATA[} else {]]>
</jsp:scriptlet>
- <img width="16" height="16" alt=" "
+ <img width="16" height="16" alt=""
style="#{component.attributes['iconStyle']}"
src="#{spacer}"/>
<jsp:scriptlet><![CDATA[}]]></jsp:scriptlet>
</span>
- <span id="#{clientId}:anchor" class="#{menuGroupItemLabelClass}">
- #{component.attributes['value']}
- </span>
+ <span id="#{clientId}:anchor" class="#{menuGroupItemLabelClass}">
+ #{component.attributes['value']}
+ </span>
<jsp:scriptlet>
- <![CDATA[
- String iconFolder = disabled ? "iconFolderDisabled" : "iconFolder";
+ <![CDATA[
+ String iconFolder = disabled ? "iconFolderDisabled" : "iconFolder";
UIComponent iconFolderFacet = component.getFacet(iconFolder);
- if (iconFolderFacet != null && iconFolderFacet.isRendered()) {
+ if (iconFolderFacet != null && iconFolderFacet.isRendered()) {
]]>
</jsp:scriptlet>
<div id="#{clientId}:folder" class="dr-menu-node #{menuGroupItemFolderClass}">
@@ -76,7 +76,7 @@
<![CDATA[} else if (component.getAttributes().get(iconFolder)!=null) {]]>
</jsp:scriptlet>
<div id="#{clientId}:folder" class="dr-menu-node #{menuGroupItemFolderClass} #{component.attributes['iconClass']}">
- <img width="16" height="16" alt=" "
+ <img width="16" height="16" alt=""
style="#{component.attributes['iconStyle']}"
src="#{actualIconFolder}"/>
</div>
@@ -93,4 +93,4 @@
</jsp:scriptlet>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -26,15 +26,15 @@
]]>
</jsp:scriptlet>
- <f:call name="initializeResources" />
-
+ <f:call name="initializeResources" />
+
<f:call name="initializeStyles" />
<f:clientid var="clientId"/>
<jsp:scriptlet><![CDATA[
- if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
+ if (((org.richfaces.component.UIMenuItem) component).isDisabled()) {
]]></jsp:scriptlet>
@@ -56,12 +56,12 @@
<div id="#{clientId}"
class="#{menuItemClass}"
- onmouseout="if (RichFaces.Menu.isWithin(event, this)) return;
+ onmouseout="if (RichFaces.Menu.isWithin(event, this)) return;
this.className='#{menuItemClass}';
#{onmouseoutInlineStyles}
$('#{clientId}:icon').className='dr-menu-icon rich-menu-item-icon #{component.attributes['iconClass']}';
Element.removeClassName($('#{clientId}:anchor'), 'rich-menu-item-label-selected');"
- onmouseover="if (RichFaces.Menu.isWithin(event, this)) return;
+ onmouseover="if (RichFaces.Menu.isWithin(event, this)) return;
#{menuItemHoverClass};
#{onmouseoverInlineStyles}
$('#{clientId}:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected #{component.attributes['iconClass']}';
@@ -90,7 +90,7 @@
} else {
]]></jsp:scriptlet>
- <img width="16" alt=" "
+ <img width="16" alt=""
height="16"
src="#{icon}" />
@@ -118,4 +118,4 @@
<jsp:scriptlet><![CDATA[
}
]]></jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuSeparator.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -16,4 +16,4 @@
<div id="#{clientId}" class="dr-menu-separator rich-menu-separator">
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java
===================================================================
--- trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/menu-components/src/test/java/org/richfaces/component/MenuSeparatorComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -106,4 +106,4 @@
assertEquals(menuSeparator.getClientId(facesContext), classAttr);
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java
===================================================================
--- trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/message/src/main/java/org/richfaces/component/UIRichMessage.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -74,4 +74,4 @@
public abstract void setLevel(String level);
-}
\ No newline at end of file
+}
Modified: trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java
===================================================================
--- trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -206,4 +206,4 @@
return UIMessage.class;
}
}
-
\ No newline at end of file
+
Modified: trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx
===================================================================
--- trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/modal-panel/src/main/templates/org/richfaces/htmlModalPanel.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -17,7 +17,7 @@
</h:styles>
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
- /org/richfaces/renderkit/html/scripts/utils.js,
+ /org/richfaces/renderkit/html/scripts/utils.js,
/org/richfaces/renderkit/html/scripts/browser_info.js,
/org/richfaces/renderkit/html/scripts/modalPanel.js,
/org/richfaces/renderkit/html/scripts/modalPanelBorders.js
@@ -40,14 +40,14 @@
x:passThruWithExclusions="id,style,class,styleClass"
>
<div class="dr-mpnl-mask-div dr-mpnl-mask-div-opaque rich-mpnl-mask-div" id="#{clientId}Div"
- style="z-index: 1;"
- onclick="#{component.attributes['onmaskclick']}"
- ondblclick="#{component.attributes['onmaskdblclick']}"
- oncontextmenu="#{component.attributes['onmaskcontextmenu']}"
- onmouseup="#{component.attributes['onmaskmouseup']}"
- onmousedown="#{component.attributes['onmaskmousedown']}"
- onmousemove="#{component.attributes['onmaskmousemove']}"
- onmouseover="#{component.attributes['onmaskmouseover']}"
+ style="z-index: 1;"
+ onclick="#{component.attributes['onmaskclick']}"
+ ondblclick="#{component.attributes['onmaskdblclick']}"
+ oncontextmenu="#{component.attributes['onmaskcontextmenu']}"
+ onmouseup="#{component.attributes['onmaskmouseup']}"
+ onmousedown="#{component.attributes['onmaskmousedown']}"
+ onmousemove="#{component.attributes['onmaskmousemove']}"
+ onmouseover="#{component.attributes['onmaskmouseover']}"
onmouseout="#{component.attributes['onmaskmouseout']}">
<button class="dr-mpnl-pnl-button" id="#{clientId}FirstHref"></button>
@@ -59,38 +59,38 @@
<div id="#{clientId}ShadowDiv" class="dr-mpnl-shadow rich-mpnl-shadow"
style="#{component.shadowStyle}" >
</div>
-
+
<c:object var="divClass" type="java.lang.String" />
<c:object var="tableStyle" type="java.lang.String" />
-
+
<jsp:scriptlet>
<![CDATA[
if (component.isAutosized()) {
- int minWidth = component.getMinWidth();
+ int minWidth = component.getMinWidth();
int minHeight = component.getMinHeight();
-
+
int width = component.getWidth();
int height = component.getHeight();
-
- if (width < 0 || width < minWidth) {
- width = minWidth;
- }
-
+
+ if (width < 0 || width < minWidth) {
+ width = minWidth;
+ }
+
if (height < 0 || height < minHeight) {
height = minHeight;
}
-
- tableStyle += "width: " + (width > 0 ? width : 1) + "px;";
+
+ tableStyle += "width: " + (width > 0 ? width : 1) + "px;";
tableStyle += "height: " + (height > 0 ? height : 1) + "px;";
-
- divClass = "";
-
+
+ divClass = "";
+
} else {
- tableStyle = "height: 100%; width: 100%;";
+ tableStyle = "height: 100%; width: 100%;";
/*
overflow: hidden;
*/
- divClass = "dr-mpnl-ovf-hd";
+ divClass = "dr-mpnl-ovf-hd";
if (component.isTrimOverlayedElements()) {
/*
position: relative;
@@ -101,18 +101,18 @@
}
]]>
</jsp:scriptlet>
-
+
<div id="#{clientId}ContentDiv" style="#{component.attributes['style']}" class="#{divClass} dr-mpnl-pnl rich-mp-content">
- <jsp:scriptlet>
- <![CDATA[if(component.getFacet("controls")!=null && component.getFacet("controls").isRendered()) {]]>
- </jsp:scriptlet>
- <div class="dr-mpnl-pnl-text rich-mpnl-text rich-mpnl-controls #{component.attributes['controlsClass']}">
- <u:insertFacet name="controls" />
- </div>
- <jsp:scriptlet>
- <![CDATA[}]]>
- </jsp:scriptlet>
-
+ <jsp:scriptlet>
+ <![CDATA[if(component.getFacet("controls")!=null && component.getFacet("controls").isRendered()) {]]>
+ </jsp:scriptlet>
+ <div class="dr-mpnl-pnl-text rich-mpnl-text rich-mpnl-controls #{component.attributes['controlsClass']}">
+ <u:insertFacet name="controls" />
+ </div>
+ <jsp:scriptlet>
+ <![CDATA[}]]>
+ </jsp:scriptlet>
+
<table id="#{clientId}ContentTable" style="#{tableStyle}" border="0" cellpadding="0" cellspacing="0">
<jsp:scriptlet>
<![CDATA[if(component.getFacet("header")!=null && component.getFacet("header").isRendered()) {]]>
@@ -194,11 +194,11 @@
<f:call name="writeEventHandlerFunction"><f:parameter value="onbeforehide" /></f:call>,
keepVisualState: #{component.keepVisualState},
- showWhenRendered: #{component.showWhenRendered},
+ showWhenRendered: #{component.showWhenRendered},
selectBehavior: "#{component.tridentIVEngineSelectBehavior}",
- autosized: #{component.autosized}
-
+ autosized: #{component.autosized}
+
<f:call name="writeVisualOptions" />
});
</script>
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/component/UIOrderingBaseComponent.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -565,4 +565,4 @@
return converter;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListButtonGradient.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListButtonGradient.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListButtonGradient.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,35 +1,35 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.BaseGradient;
-import org.richfaces.skin.Skin;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListButtonGradient extends BaseGradient {
- public OrderingListButtonGradient() {
- super(8, 18, 9, Skin.generalBackgroundColor, "tabBackgroundColor");
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListButtonGradient extends BaseGradient {
+ public OrderingListButtonGradient() {
+ super(8, 18, 9, Skin.generalBackgroundColor, "tabBackgroundColor");
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListClickedGradient.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,45 +1,45 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.gradientimages;
-
-import java.awt.Graphics2D;
-import java.awt.geom.AffineTransform;
-
-import org.ajax4jsf.resource.ResourceContext;
-import org.richfaces.renderkit.html.BaseGradient;
-import org.richfaces.skin.Skin;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListClickedGradient extends BaseGradient {
- protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
- g2d.transform(new AffineTransform(1., 0., 0., -1., 0., 15.));
- super.paint(resourceContext, g2d);
- }
-
- public OrderingListClickedGradient() {
- super(7, 15, 9, "tabBackgroundColor", Skin.generalBackgroundColor);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.gradientimages;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+
+import org.ajax4jsf.resource.ResourceContext;
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListClickedGradient extends BaseGradient {
+ protected void paint(ResourceContext resourceContext, Graphics2D g2d) {
+ g2d.transform(new AffineTransform(1., 0., 0., -1., 0., 15.));
+ super.paint(resourceContext, g2d);
+ }
+
+ public OrderingListClickedGradient() {
+ super(7, 15, 9, "tabBackgroundColor", Skin.generalBackgroundColor);
+ }
+
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListHeaderGradient.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListHeaderGradient.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/gradientimages/OrderingListHeaderGradient.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,35 +1,35 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.gradientimages;
-
-import org.richfaces.renderkit.html.BaseGradient;
-import org.richfaces.skin.Skin;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListHeaderGradient extends BaseGradient {
- public OrderingListHeaderGradient() {
- super(8, 40, 14, Skin.generalBackgroundColor, "tabBackgroundColor");
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.gradientimages;
+
+import org.richfaces.renderkit.html.BaseGradient;
+import org.richfaces.skin.Skin;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListHeaderGradient extends BaseGradient {
+ public OrderingListHeaderGradient() {
+ super(8, 40, 14, Skin.generalBackgroundColor, "tabBackgroundColor");
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottom.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,85 +1,85 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_ICON_COLOR;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconBottom extends TriangleIconBase {
-
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.translate(0, -3);
-
- g2d.setColor(textColor);
- g2d.translate(7, 5);
- paintBaseTriangle(g2d);
- g2d.translate(-7, -5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 10, 5);
- g2d.drawLine(11, 6, 8, 9);
- g2d.drawLine(6, 9, 3, 6);
-
- g2d.translate(0, 4);
- g2d.setColor(textColor);
- g2d.translate(7, 5);
- paintBaseTriangle(g2d);
- g2d.translate(-7, -5);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 6, 5);
- g2d.drawLine(8, 5, 10, 5);
- g2d.drawLine(11, 6, 8, 9);
- g2d.drawLine(6, 9, 3, 6);
-
- g2d.translate(0, 4);
-
- g2d.setColor(borderColor);
- g2d.drawLine(4, 5, 6, 5);
- g2d.drawLine(8, 5, 10, 5);
-
- g2d.drawLine(11, 6, 10, 7);
- g2d.drawLine(4, 7, 3, 6);
- g2d.drawLine(4, 7, 10, 7);
-
- g2d.setColor(textColor);
- g2d.drawLine(4, 6, 10, 6);
- }
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_ICON_COLOR, ICON_COLOR,
- SELECT_LIST_BORDER_COLOR, BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_ICON_COLOR;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconBottom extends TriangleIconBase {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, -3);
+
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 10, 5);
+ g2d.drawLine(11, 6, 8, 9);
+ g2d.drawLine(6, 9, 3, 6);
+
+ g2d.translate(0, 4);
+ g2d.setColor(textColor);
+ g2d.translate(7, 5);
+ paintBaseTriangle(g2d);
+ g2d.translate(-7, -5);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 6, 5);
+ g2d.drawLine(8, 5, 10, 5);
+ g2d.drawLine(11, 6, 8, 9);
+ g2d.drawLine(6, 9, 3, 6);
+
+ g2d.translate(0, 4);
+
+ g2d.setColor(borderColor);
+ g2d.drawLine(4, 5, 6, 5);
+ g2d.drawLine(8, 5, 10, 5);
+
+ g2d.drawLine(11, 6, 10, 7);
+ g2d.drawLine(4, 7, 3, 6);
+ g2d.drawLine(4, 7, 10, 7);
+
+ g2d.setColor(textColor);
+ g2d.drawLine(4, 6, 10, 6);
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_ICON_COLOR, ICON_COLOR,
+ SELECT_LIST_BORDER_COLOR, BORDER_COLOR);
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconBottomDisabled.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,41 +1,41 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
- SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconBottomDisabled extends OrderingListIconBottom {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
+ SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
+ }
+
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDown.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,39 +1,39 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconDown extends TriangleIconDown {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_ICON_COLOR, ICON_COLOR,
- SELECT_LIST_BORDER_COLOR, BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconDown extends TriangleIconDown {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_ICON_COLOR, ICON_COLOR,
+ SELECT_LIST_BORDER_COLOR, BORDER_COLOR);
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconDownDisabled.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,39 +1,39 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconDownDisabled extends OrderingListIconDown {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
- SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconDownDisabled extends OrderingListIconDown {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
+ SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTop.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,44 +1,44 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-
-import org.ajax4jsf.resource.ResourceContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconTop extends OrderingListIconBottom {
-
- protected void paintImage(ResourceContext context, Graphics2D g2d,
- Color textColor, Color borderColor) {
-
- g2d.translate(0, 14);
- g2d.scale(1, -1);
-
- super.paintImage(context, g2d, textColor, borderColor);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+
+import org.ajax4jsf.resource.ResourceContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconTop extends OrderingListIconBottom {
+
+ protected void paintImage(ResourceContext context, Graphics2D g2d,
+ Color textColor, Color borderColor) {
+
+ g2d.translate(0, 14);
+ g2d.scale(1, -1);
+
+ super.paintImage(context, g2d, textColor, borderColor);
+ }
+
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconTopDisabled.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,39 +1,39 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconTopDisabled extends OrderingListIconTop {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
- SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconTopDisabled extends OrderingListIconTop {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
+ SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUp.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,39 +1,39 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconUp extends TriangleIconUp {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_ICON_COLOR, ICON_COLOR,
- SELECT_LIST_BORDER_COLOR, BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconUp extends TriangleIconUp {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_ICON_COLOR, ICON_COLOR,
+ SELECT_LIST_BORDER_COLOR, BORDER_COLOR);
+ }
+}
Modified: trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java
===================================================================
--- trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/java/org/richfaces/renderkit/html/images/OrderingListIconUpDisabled.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,39 +1,39 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.images;
-
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
-import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListIconUpDisabled extends OrderingListIconUp {
-
- protected Object getDataToStore(FacesContext context, Object data) {
- return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
- SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
- }
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.images;
+
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_BORDER_COLOR;
+import static org.richfaces.renderkit.html.images.OrderingListIconConstants.SELECT_LIST_DISABLED_ICON_COLOR;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListIconUpDisabled extends OrderingListIconUp {
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ return super.getDataToStore(context, SELECT_LIST_DISABLED_ICON_COLOR, DISABLED_ICON_COLOR,
+ SELECT_LIST_DISABLED_BORDER_COLOR, DISABLED_BORDER_COLOR);
+ }
+}
Modified: trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx
===================================================================
--- trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/main/templates/org/richfaces/htmlOrderingList.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -52,18 +52,18 @@
}
]]></jsp:scriptlet>
</tr>
- <tr>
- <jsp:scriptlet><![CDATA[
- if ("left".equals(component.getAttributes().get("controlsHorizontalAlign"))) {
- ]]></jsp:scriptlet>
- <td class="rich-ordering-list-button-valign" style="vertical-align: #{component.attributes['controlsVerticalAlign']}" >
- <div class="rich-ordering-list-button-layout">
- <f:call name="encodeControlsFacets" />
- </div>
- </td>
- <jsp:scriptlet><![CDATA[
- }
+ <tr>
+ <jsp:scriptlet><![CDATA[
+ if ("left".equals(component.getAttributes().get("controlsHorizontalAlign"))) {
]]></jsp:scriptlet>
+ <td class="rich-ordering-list-button-valign" style="vertical-align: #{component.attributes['controlsVerticalAlign']}" >
+ <div class="rich-ordering-list-button-layout">
+ <f:call name="encodeControlsFacets" />
+ </div>
+ </td>
+ <jsp:scriptlet><![CDATA[
+ }
+ ]]></jsp:scriptlet>
<td>
<div id="#{clientId}headerBox" class="rich-ordering-list-output">
<jsp:scriptlet><![CDATA[
@@ -100,17 +100,17 @@
</div>
</div>
</td>
- <jsp:scriptlet><![CDATA[
- if (!"left".equals(component.getAttributes().get("controlsHorizontalAlign"))) {
- ]]></jsp:scriptlet>
- <td class="rich-ordering-list-button-valign" style="vertical-align: #{component.attributes['controlsVerticalAlign']}" >
- <div class="rich-ordering-list-button-layout">
- <f:call name="encodeControlsFacets" />
- </div>
- </td>
- <jsp:scriptlet><![CDATA[
- }
+ <jsp:scriptlet><![CDATA[
+ if (!"left".equals(component.getAttributes().get("controlsHorizontalAlign"))) {
]]></jsp:scriptlet>
+ <td class="rich-ordering-list-button-valign" style="vertical-align: #{component.attributes['controlsVerticalAlign']}" >
+ <div class="rich-ordering-list-button-layout">
+ <f:call name="encodeControlsFacets" />
+ </div>
+ </td>
+ <jsp:scriptlet><![CDATA[
+ }
+ ]]></jsp:scriptlet>
</tr>
</tbody>
</table>
@@ -132,4 +132,4 @@
#{this:getRowClassesAsJSArray(context, component)});
</script>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
===================================================================
--- trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,397 +1,397 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.faces.component.UIColumn;
-import javax.faces.component.UIForm;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.component.html.HtmlOutputText;
-import javax.servlet.http.HttpServletResponse;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.image.ImageInfo;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.apache.commons.lang.StringUtils;
-import org.richfaces.component.UIOrderingList;
-
-import com.gargoylesoftware.htmlunit.Page;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlScript;
-
-/**
- * @author Siarhej Chalipau
- *
- */
-public class OrderingListRenderingTest extends AbstractAjax4JsfTestCase {
- private static Set<String> javaScripts = new HashSet<String>();
- private static Set<String> imageClasses = new HashSet<String>();
- private static Set<String> imagePNGClasses = new HashSet<String>();
-
- static {
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("scripts/utils.js");
- javaScripts.add("scripts/ShuttleUtils.js");
- javaScripts.add("scripts/SelectItem.js");
- javaScripts.add("scripts/LayoutManager.js");
- javaScripts.add("scripts/Control.js");
- javaScripts.add("scripts/OrderingList.js");
- javaScripts.add("scripts/ListBase.js");
-
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUp");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDownDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTopDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDown");
-
- imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient");
- imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient");
- imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient");
-
- }
-
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public OrderingListRenderingTest( String testName )
- {
- super( testName );
- }
-
- private final static int ROWS_COUNT = 3;
-
- private UIForm form = null;
- private UIOrderingList orderingList = null;
- private List<SimpleItem> items = null;
- private HtmlOutputText output1 = null;
- private HtmlOutputText output2 = null;
- private UIColumn column1 = null;
- private UIColumn column2 = null;
- private HtmlOutputText caption = null;
-
- public void setUp() throws Exception {
- super.setUp();
-
- application.addComponent("org.richfaces.OrderingList", "org.richfaces.component.html.HtmlOrderingList");
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- orderingList = (UIOrderingList)application.createComponent("org.richfaces.OrderingList");
- orderingList.setId("orderingList");
- orderingList.setControlsType("link");
- orderingList.setVar("item");
-
- caption = new HtmlOutputText();
- caption.setValue("caption");
- orderingList.getFacets().put("caption", caption);
-
- items = new ArrayList<SimpleItem>();
- items.add(new SimpleItem("Michael", 2000));
- items.add(new SimpleItem("John", 500));
- items.add(new SimpleItem("George", 4000));
-
- orderingList.setValue(items);
-
- output1 = new HtmlOutputText();
- output1.setValueBinding("value", application.createValueBinding("#{item.name}"));
- column1 = new UIColumn();
- column1.getChildren().add(output1);
- orderingList.getChildren().add(column1);
-
- output2 = new HtmlOutputText();
- output2.setValueBinding("value", application.createValueBinding("#{item.salary}"));
- column2 = new UIColumn();
- column2.getChildren().add(output2);
- orderingList.getChildren().add(column2);
-
- form.getChildren().add(orderingList);
- }
-
- public void tearDown() throws Exception {
- items = null;
- output1 = null;
- output2 = null;
- column1 = null;
- column2 = null;
- orderingList = null;
- form = null;
-
- super.tearDown();
- }
-
- /**
- * Test script rendering
- *
- * @throws Exception
- */
- public void testRenderScript() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- List<HtmlScript> scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
- int foundCount = 0;
- for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = it.next();
- String srcAttr = item.getSrcAttribute();
-
- if (StringUtils.isNotBlank(srcAttr)) {
- boolean found = false;
- for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = srcIt.next();
-
- found = srcAttr.contains(src);
- if (found) {
- foundCount++;
- break;
- }
- }
-
- assertTrue(found);
- }
- }
- assertEquals(foundCount, javaScripts.size());
- }
-
- /**
- * Test default images rendering
- *
- * @throws Exception
- */
- public void testRenderImages() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
- String clazz = it.next();
- ImageInfo info = getImageResource(clazz);
- assertNotNull(info);
- assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
- assertTrue(info.getHeight() > 0);
- assertTrue(info.getWidth() > 0);
- }
-
- for (Iterator<String> it = imagePNGClasses.iterator(); it.hasNext(); ) {
- String clazz = it.next();
- ImageInfo info = getImageResource(clazz);
- assertNotNull(info);
- assertEquals(ImageInfo.FORMAT_PNG, info.getFormat());
- assertTrue(info.getHeight() > 0);
- assertTrue(info.getWidth() > 0);
- }
- }
-
- /**
- * Test style rendering
- *
- * @throws Exception
- */
- public void testRenderStyle() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
- List<HtmlElement> links = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
- assertNotNull(links);
- assertEquals(1, links.size());
- HtmlElement link = links.get(0);
- assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/orderingList.xcss"));
-
- String uri = "http:" + link.getAttributeValue(HTML.HREF_ATTR);
- Page page = webClient.getPage(uri);
- assertNotNull(page);
- assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
- }
-
- /**
- * Test controls rendering
- *
- * @throws Exception
- */
- public void testRenderControls() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- List<HtmlElement> images = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.IMG_ELEMENT);
- assertNotNull(images);
-
- int generatedCount = 0;
- for (Iterator<HtmlElement> it = images.iterator(); it.hasNext(); ) {
- HtmlElement img = it.next();
- assertNotNull(img);
-
- String uri = "http:" + img.getAttributeValue(HTML.src_ATTRIBUTE);
- Page page = webClient.getPage(uri);
- assertNotNull(page);
- assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
-
- if (uri.contains("spacer.gif")) {
- continue;
- }
- generatedCount++;
-
- HtmlElement element = (HtmlElement) img.getParentDomNode();
- assertNotNull(element);
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
- String clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue("rich-ordering-list-button-content".equals(clazz));
-
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
- if (HTML.a_ELEMENT.equalsIgnoreCase(element.getNodeName())) {
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
- }
-
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
-
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
-
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
- clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue(clazz.contains("rich-ordering-control-"));
-
- element = (HtmlElement) element.getParentDomNode();
- assertNotNull(element);
- assertEquals(HTML.DIV_ELEM, element.getNodeName());
- clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue(clazz.contains("rich-ordering-list-button-layout"));
- }
- assertEquals(8, generatedCount);
- }
-
- /**
- * Test items rendering
- *
- * @throws Exception
- */
- public void testRenderItems() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- HtmlElement div = view.getHtmlElementById(orderingList.getClientId(facesContext) + "contentBox");
- assertNotNull(div);
- assertEquals(HTML.DIV_ELEM, div.getNodeName());
-
- HtmlElement table = (HtmlElement)div.getFirstDomChild();
- assertNotNull(table);
- assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
-
- HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
- assertNotNull(tbody);
- assertEquals(HTML.TBOBY_ELEMENT, tbody.getNodeName());
-
- int rowsCount = 0;
- for (Iterator<HtmlElement> it = tbody.getChildIterator(); it.hasNext(); ) {
- HtmlElement tr = it.next();
- assertNotNull(tr);
- assertEquals(HTML.TR_ELEMENT, tr.getNodeName());
-
- String clazz = tr.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz);
- assertTrue(clazz.contains("rich-ordering-list-row"));
-
- int cellsCount = 0;
- for (Iterator<HtmlElement> it2 = tr.getChildIterator(); it2.hasNext(); ) {
- HtmlElement td = it2.next();
- assertNotNull(td);
- assertEquals(HTML.td_ELEM, td.getNodeName());
-
- String clazz2 = td.getAttributeValue(HTML.class_ATTRIBUTE);
- assertNotNull(clazz2);
- assertTrue(clazz2.contains("rich-ordering-list-cell"));
-
- cellsCount++;
- }
- assertEquals(2, cellsCount);
-
- rowsCount++;
- }
- assertEquals(items.size(), rowsCount);
- }
-
- /**
- * Test common rendering
- *
- * @throws Exception
- */
- public void testRender() throws Exception {
- HtmlPage view = renderView();
- assertNotNull(view);
-
- HtmlElement div = view.getHtmlElementById(orderingList.getClientId(facesContext));
- assertNotNull(div);
- assertEquals(HTML.DIV_ELEM, div.getNodeName());
-
- HtmlElement hidden1 = view.getHtmlElementById(orderingList.getClientId(facesContext) + "focusKeeper");
- assertNotNull(hidden1);
- assertEquals(HTML.INPUT_ELEM, hidden1.getNodeName());
- assertEquals(HTML.BUTTON, hidden1.getAttributeValue(HTML.TYPE_ATTR));
- hidden1.getAttributeValue(HTML.style_ATTRIBUTE).contains("left: -32767px");
-
- List<HtmlElement> hiddens = view.getDocumentHtmlElement()
- .getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.NAME_ATTRIBUTE, orderingList.getClientId(facesContext));
- assertNotNull(hiddens);
- assertEquals(ROWS_COUNT, hiddens.size());
- for (Iterator<HtmlElement> it = hiddens.iterator(); it.hasNext(); ) {
- HtmlElement hidden2 = it.next();
- assertEquals(HTML.INPUT_ELEM, hidden2.getNodeName());
- assertEquals(HTML.INPUT_TYPE_HIDDEN, hidden2.getAttributeValue(HTML.TYPE_ATTR));
- }
- }
-
- protected class SimpleItem {
- String name;
- int salary;
-
- public SimpleItem(String name, int salary) {
- this.name = name;
- this.salary = salary;
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getSalary() {
- return salary;
- }
- public void setSalary(int salary) {
- this.salary = salary;
- }
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlOutputText;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.image.ImageInfo;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.commons.lang.StringUtils;
+import org.richfaces.component.UIOrderingList;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+
+/**
+ * @author Siarhej Chalipau
+ *
+ */
+public class OrderingListRenderingTest extends AbstractAjax4JsfTestCase {
+ private static Set<String> javaScripts = new HashSet<String>();
+ private static Set<String> imageClasses = new HashSet<String>();
+ private static Set<String> imagePNGClasses = new HashSet<String>();
+
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("scripts/utils.js");
+ javaScripts.add("scripts/ShuttleUtils.js");
+ javaScripts.add("scripts/SelectItem.js");
+ javaScripts.add("scripts/LayoutManager.js");
+ javaScripts.add("scripts/Control.js");
+ javaScripts.add("scripts/OrderingList.js");
+ javaScripts.add("scripts/ListBase.js");
+
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUp");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDownDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTopDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled");
+ imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDown");
+
+ imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient");
+ imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient");
+ imagePNGClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient");
+
+ }
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public OrderingListRenderingTest( String testName )
+ {
+ super( testName );
+ }
+
+ private final static int ROWS_COUNT = 3;
+
+ private UIForm form = null;
+ private UIOrderingList orderingList = null;
+ private List<SimpleItem> items = null;
+ private HtmlOutputText output1 = null;
+ private HtmlOutputText output2 = null;
+ private UIColumn column1 = null;
+ private UIColumn column2 = null;
+ private HtmlOutputText caption = null;
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent("org.richfaces.OrderingList", "org.richfaces.component.html.HtmlOrderingList");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ orderingList = (UIOrderingList)application.createComponent("org.richfaces.OrderingList");
+ orderingList.setId("orderingList");
+ orderingList.setControlsType("link");
+ orderingList.setVar("item");
+
+ caption = new HtmlOutputText();
+ caption.setValue("caption");
+ orderingList.getFacets().put("caption", caption);
+
+ items = new ArrayList<SimpleItem>();
+ items.add(new SimpleItem("Michael", 2000));
+ items.add(new SimpleItem("John", 500));
+ items.add(new SimpleItem("George", 4000));
+
+ orderingList.setValue(items);
+
+ output1 = new HtmlOutputText();
+ output1.setValueBinding("value", application.createValueBinding("#{item.name}"));
+ column1 = new UIColumn();
+ column1.getChildren().add(output1);
+ orderingList.getChildren().add(column1);
+
+ output2 = new HtmlOutputText();
+ output2.setValueBinding("value", application.createValueBinding("#{item.salary}"));
+ column2 = new UIColumn();
+ column2.getChildren().add(output2);
+ orderingList.getChildren().add(column2);
+
+ form.getChildren().add(orderingList);
+ }
+
+ public void tearDown() throws Exception {
+ items = null;
+ output1 = null;
+ output2 = null;
+ column1 = null;
+ column2 = null;
+ orderingList = null;
+ form = null;
+
+ super.tearDown();
+ }
+
+ /**
+ * Test script rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderScript() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List<HtmlScript> scripts = page.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.SCRIPT_ELEM);
+ int foundCount = 0;
+ for (Iterator<HtmlScript> it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = it.next();
+ String srcAttr = item.getSrcAttribute();
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator<String> srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = srcIt.next();
+
+ found = srcAttr.contains(src);
+ if (found) {
+ foundCount++;
+ break;
+ }
+ }
+
+ assertTrue(found);
+ }
+ }
+ assertEquals(foundCount, javaScripts.size());
+ }
+
+ /**
+ * Test default images rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderImages() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
+ String clazz = it.next();
+ ImageInfo info = getImageResource(clazz);
+ assertNotNull(info);
+ assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
+ assertTrue(info.getHeight() > 0);
+ assertTrue(info.getWidth() > 0);
+ }
+
+ for (Iterator<String> it = imagePNGClasses.iterator(); it.hasNext(); ) {
+ String clazz = it.next();
+ ImageInfo info = getImageResource(clazz);
+ assertNotNull(info);
+ assertEquals(ImageInfo.FORMAT_PNG, info.getFormat());
+ assertTrue(info.getHeight() > 0);
+ assertTrue(info.getWidth() > 0);
+ }
+ }
+
+ /**
+ * Test style rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderStyle() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+ List<HtmlElement> links = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.LINK_ELEMENT);
+ assertNotNull(links);
+ assertEquals(1, links.size());
+ HtmlElement link = links.get(0);
+ assertTrue(link.getAttributeValue(HTML.HREF_ATTR).contains("css/orderingList.xcss"));
+
+ String uri = "http:" + link.getAttributeValue(HTML.HREF_ATTR);
+ Page page = webClient.getPage(uri);
+ assertNotNull(page);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ }
+
+ /**
+ * Test controls rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderControls() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ List<HtmlElement> images = view.getDocumentHtmlElement().getHtmlElementsByTagName(HTML.IMG_ELEMENT);
+ assertNotNull(images);
+
+ int generatedCount = 0;
+ for (Iterator<HtmlElement> it = images.iterator(); it.hasNext(); ) {
+ HtmlElement img = it.next();
+ assertNotNull(img);
+
+ String uri = "http:" + img.getAttributeValue(HTML.src_ATTRIBUTE);
+ Page page = webClient.getPage(uri);
+ assertNotNull(page);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ if (uri.contains("spacer.gif")) {
+ continue;
+ }
+ generatedCount++;
+
+ HtmlElement element = (HtmlElement) img.getParentDomNode();
+ assertNotNull(element);
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ String clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue("rich-ordering-list-button-content".equals(clazz));
+
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+ if (HTML.a_ELEMENT.equalsIgnoreCase(element.getNodeName())) {
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+ }
+
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue(clazz.contains("rich-ordering-control-"));
+
+ element = (HtmlElement) element.getParentDomNode();
+ assertNotNull(element);
+ assertEquals(HTML.DIV_ELEM, element.getNodeName());
+ clazz = element.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue(clazz.contains("rich-ordering-list-button-layout"));
+ }
+ assertEquals(8, generatedCount);
+ }
+
+ /**
+ * Test items rendering
+ *
+ * @throws Exception
+ */
+ public void testRenderItems() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ HtmlElement div = view.getHtmlElementById(orderingList.getClientId(facesContext) + "contentBox");
+ assertNotNull(div);
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+
+ HtmlElement table = (HtmlElement)div.getFirstDomChild();
+ assertNotNull(table);
+ assertEquals(HTML.TABLE_ELEMENT, table.getNodeName());
+
+ HtmlElement tbody = (HtmlElement)table.getFirstDomChild();
+ assertNotNull(tbody);
+ assertEquals(HTML.TBOBY_ELEMENT, tbody.getNodeName());
+
+ int rowsCount = 0;
+ for (Iterator<HtmlElement> it = tbody.getChildIterator(); it.hasNext(); ) {
+ HtmlElement tr = it.next();
+ assertNotNull(tr);
+ assertEquals(HTML.TR_ELEMENT, tr.getNodeName());
+
+ String clazz = tr.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz);
+ assertTrue(clazz.contains("rich-ordering-list-row"));
+
+ int cellsCount = 0;
+ for (Iterator<HtmlElement> it2 = tr.getChildIterator(); it2.hasNext(); ) {
+ HtmlElement td = it2.next();
+ assertNotNull(td);
+ assertEquals(HTML.td_ELEM, td.getNodeName());
+
+ String clazz2 = td.getAttributeValue(HTML.class_ATTRIBUTE);
+ assertNotNull(clazz2);
+ assertTrue(clazz2.contains("rich-ordering-list-cell"));
+
+ cellsCount++;
+ }
+ assertEquals(2, cellsCount);
+
+ rowsCount++;
+ }
+ assertEquals(items.size(), rowsCount);
+ }
+
+ /**
+ * Test common rendering
+ *
+ * @throws Exception
+ */
+ public void testRender() throws Exception {
+ HtmlPage view = renderView();
+ assertNotNull(view);
+
+ HtmlElement div = view.getHtmlElementById(orderingList.getClientId(facesContext));
+ assertNotNull(div);
+ assertEquals(HTML.DIV_ELEM, div.getNodeName());
+
+ HtmlElement hidden1 = view.getHtmlElementById(orderingList.getClientId(facesContext) + "focusKeeper");
+ assertNotNull(hidden1);
+ assertEquals(HTML.INPUT_ELEM, hidden1.getNodeName());
+ assertEquals(HTML.BUTTON, hidden1.getAttributeValue(HTML.TYPE_ATTR));
+ hidden1.getAttributeValue(HTML.style_ATTRIBUTE).contains("left: -32767px");
+
+ List<HtmlElement> hiddens = view.getDocumentHtmlElement()
+ .getHtmlElementsByAttribute(HTML.INPUT_ELEM, HTML.NAME_ATTRIBUTE, orderingList.getClientId(facesContext));
+ assertNotNull(hiddens);
+ assertEquals(ROWS_COUNT, hiddens.size());
+ for (Iterator<HtmlElement> it = hiddens.iterator(); it.hasNext(); ) {
+ HtmlElement hidden2 = it.next();
+ assertEquals(HTML.INPUT_ELEM, hidden2.getNodeName());
+ assertEquals(HTML.INPUT_TYPE_HIDDEN, hidden2.getAttributeValue(HTML.TYPE_ATTR));
+ }
+ }
+
+ protected class SimpleItem {
+ String name;
+ int salary;
+
+ public SimpleItem(String name, int salary) {
+ this.name = name;
+ this.salary = salary;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getSalary() {
+ return salary;
+ }
+ public void setSalary(int salary) {
+ this.salary = salary;
+ }
+ }
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/component/UIPanelMenuItem.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,62 +1,62 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.component.AjaxActionComponent;
-
-public abstract class UIPanelMenuItem extends AjaxActionComponent {
-
- public static final String COMPONENT_TYPE = "org.richfaces.panelMenuItem";
-
- public abstract String getMode();
- public abstract void setMode(String mode);
- public abstract String getIcon();
- public abstract void setIcon(String icon);
- public abstract String getIconDisabled();
- public abstract void setIconDisabled(String iconDisabled);
- public abstract boolean isDisabled();
- public abstract void setDisabled(boolean disabled);
- public abstract Object getLabel();
- public abstract void setLabel(Object label);
- public abstract String getHoverClass();
- public abstract void setHoverClass(String hoverClass);
- public abstract String getHoverStyle();
- public abstract void setHoverStyle(String hoverStyle);
- public abstract String getDisabledClass();
- public abstract void setDisabledClass(String disabledClass);
- public abstract String getDisabledStyle();
- public abstract void setDisabledStyle(String disabledStyle);
- public abstract String getStyleClass();
- public abstract void setStyleClass(String styleClass);
- public abstract String getStyle();
- public abstract void setStyle(String style);
- public abstract String getIconClass();
- public abstract void setIconClass(String iconClass);
- public abstract String getIconStyle();
- public abstract void setIconStyle(String iconStyle);
- public abstract String getTarget();
- public abstract void setTarget(String target);
-
- public abstract void setName(String string);
- public abstract String getName();
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.component.AjaxActionComponent;
+
+public abstract class UIPanelMenuItem extends AjaxActionComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.panelMenuItem";
+
+ public abstract String getMode();
+ public abstract void setMode(String mode);
+ public abstract String getIcon();
+ public abstract void setIcon(String icon);
+ public abstract String getIconDisabled();
+ public abstract void setIconDisabled(String iconDisabled);
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+ public abstract Object getLabel();
+ public abstract void setLabel(Object label);
+ public abstract String getHoverClass();
+ public abstract void setHoverClass(String hoverClass);
+ public abstract String getHoverStyle();
+ public abstract void setHoverStyle(String hoverStyle);
+ public abstract String getDisabledClass();
+ public abstract void setDisabledClass(String disabledClass);
+ public abstract String getDisabledStyle();
+ public abstract void setDisabledStyle(String disabledStyle);
+ public abstract String getStyleClass();
+ public abstract void setStyleClass(String styleClass);
+ public abstract String getStyle();
+ public abstract void setStyle(String style);
+ public abstract String getIconClass();
+ public abstract void setIconClass(String iconClass);
+ public abstract String getIconStyle();
+ public abstract void setIconStyle(String iconStyle);
+ public abstract String getTarget();
+ public abstract void setTarget(String target);
+
+ public abstract void setName(String string);
+ public abstract String getName();
+
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevron.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -39,4 +39,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronDown.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -38,4 +38,4 @@
path.closePath();
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronLeft.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,38 +1,38 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.iconimages;
-
-import java.awt.geom.GeneralPath;
-
-public class PanelMenuIconChevronLeft extends PanelMenuIconChevronBasic {
-
- void draw(GeneralPath path) {
- path.moveTo(61,1);
- path.lineTo(45,1);
- path.lineTo(15,31);
- path.lineTo(45,61);
- path.lineTo(61,61);
- path.lineTo(30,31);
- path.closePath();
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.iconimages;
+
+import java.awt.geom.GeneralPath;
+
+public class PanelMenuIconChevronLeft extends PanelMenuIconChevronBasic {
+
+ void draw(GeneralPath path) {
+ path.moveTo(61,1);
+ path.lineTo(45,1);
+ path.lineTo(15,31);
+ path.lineTo(45,61);
+ path.lineTo(61,61);
+ path.lineTo(30,31);
+ path.closePath();
+ }
+
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconChevronUp.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -39,4 +39,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconDisc.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -48,4 +48,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconGrid.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -64,4 +64,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconSpacer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -32,4 +32,4 @@
protected void paintImage(ResourceContext context, Graphics2D g2d, Color color) {
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangle.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -38,4 +38,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java
===================================================================
--- trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/java/org/richfaces/renderkit/html/iconimages/PanelMenuIconTriangleLeft.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,38 +1,38 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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.renderkit.html.iconimages;
-
-import java.awt.Graphics2D;
-import java.awt.geom.GeneralPath;
-
-public class PanelMenuIconTriangleLeft extends PanelMenuIconTriangleBasic {
-
- void draw(GeneralPath path, Graphics2D g2d) {
- g2d.translate(47,30);
- path.moveTo(33,0);
- path.lineTo(0,33);
- path.lineTo(0,34);
- path.lineTo(33,67);
- path.closePath();
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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.renderkit.html.iconimages;
+
+import java.awt.Graphics2D;
+import java.awt.geom.GeneralPath;
+
+public class PanelMenuIconTriangleLeft extends PanelMenuIconTriangleBasic {
+
+ void draw(GeneralPath path, Graphics2D g2d) {
+ g2d.translate(47,30);
+ path.moveTo(33,0);
+ path.lineTo(0,33);
+ path.lineTo(0,34);
+ path.lineTo(33,67);
+ path.closePath();
+ }
+
+}
Modified: trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx
===================================================================
--- trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenu.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http:/jsf.exadel.com/template"
- xmlns:h=" http://ajax4jsf.org/cdk/headers"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
- class="org.richfaces.renderkit.html.HtmlPanelMenuRenderer"
- baseclass="org.richfaces.renderkit.html.PanelMenuRenderer"
- component="org.richfaces.component.UIPanelMenu" >
-
- <h:styles>
- /org/richfaces/renderkit/html/css/panelMenu.xcss
- </h:styles>
- <h:scripts>
- new org.ajax4jsf.javascript.PrototypeScript(),
- new org.ajax4jsf.javascript.AjaxScript(),
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http:/jsf.exadel.com/template"
+ xmlns:h=" http://ajax4jsf.org/cdk/headers"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.HtmlPanelMenuRenderer"
+ baseclass="org.richfaces.renderkit.html.PanelMenuRenderer"
+ component="org.richfaces.component.UIPanelMenu" >
+
+ <h:styles>
+ /org/richfaces/renderkit/html/css/panelMenu.xcss
+ </h:styles>
+ <h:scripts>
+ new org.ajax4jsf.javascript.PrototypeScript(),
+ new org.ajax4jsf.javascript.AjaxScript(),
/org/richfaces/renderkit/html/scripts/utils.js,
/org/ajax4jsf/javascript/scripts/form.js,
- /org/richfaces/renderkit/html/scripts/form.js
- /org/richfaces/renderkit/html/scripts/panelMenu.js,
- </h:scripts>
-
+ /org/richfaces/renderkit/html/scripts/form.js
+ /org/richfaces/renderkit/html/scripts/panelMenu.js,
+ </h:scripts>
+
<f:clientid var="clientId"/>
<jsp:scriptlet>
@@ -35,23 +35,23 @@
variables.setVariable("style", style);
]]>
</jsp:scriptlet>
-
-
- <f:call name="utils.encodeBeginFormIfNessesary"/>
- <div style="width:#{component.width}; #{style}" class="rich-pmenu #{component.styleClass}"
- id="#{clientId}"
- onclick="#{component.onclick}"
- ondblclick="#{component.ondblclick}"
- onmousemove="#{component.onmousemove}"
- onmouseout="#{component.onmouseout}"
- onmouseover="#{component.onmouseover}" >
- <input type="hidden" id="#{clientId}selectedItemName" name="#{clientId}selectedItemName" value="" />
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- <div style="display:none">
- <f:call name="insertScript"/>
- </div>
- </div>
- <f:call name="utils.encodeEndFormIfNessesary"/>
+
+
+ <f:call name="utils.encodeBeginFormIfNessesary"/>
+ <div style="width:#{component.width}; #{style}" class="rich-pmenu #{component.styleClass}"
+ id="#{clientId}"
+ onclick="#{component.onclick}"
+ ondblclick="#{component.ondblclick}"
+ onmousemove="#{component.onmousemove}"
+ onmouseout="#{component.onmouseout}"
+ onmouseover="#{component.onmouseover}" >
+ <input type="hidden" id="#{clientId}selectedItemName" name="#{clientId}selectedItemName" value="" />
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ <div style="display:none">
+ <f:call name="insertScript"/>
+ </div>
+ </div>
+ <f:call name="utils.encodeEndFormIfNessesary"/>
</f:root>
Modified: trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx
===================================================================
--- trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuGroup.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,59 +1,59 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
- class="org.richfaces.renderkit.html.HtmlPanelMenuGroupRenderer"
- baseclass="org.richfaces.renderkit.html.PanelMenuGroupRenderer"
- component="org.richfaces.component.UIPanelMenuGroup"
- >
-
- <f:clientid var="clientId"/>
-
- <div id="#{clientId}" style="#{this:getHideStyle(context, component)}"
- class="#{this:getDivClass(context, component)}" >
- <jsp:scriptlet>
- <![CDATA[
- String isNodeOpened = isOpened(context, component) ? "opened" : "closed";
- ]]>
- </jsp:scriptlet>
- <table cellspacing="0" cellpadding="0" border="0"
- id="tablehide#{clientId}"
- class="#{this:getTableClass(context, component)} rich-pmenu-group #{this:getFullStyleClass( context, component )} "
- style="#{this:getFullStyle( context, component )}" >
-
- <f:call name="utils.encodePassThru" />
-
- <tbody>
- <tr id="row_#{clientId}"
- class="#{this:getSelectedClass( context, component )}" >
- <td class="dr-pmenu-nowrap #{this:getIconClass( context, component,'left')}">
- <f:call name="insertSpacerImages" />
- <f:call name="insertImage">
- <f:parameter value="left" />
- </f:call>
- </td>
- <td style="width:100%" id="icon#{clientId}" class="dr-pmenu-group-self-label #{this:getLabelClass( context, component )}" >
- <input type="hidden" name="panelMenuState#{clientId}"
- value="#{isNodeOpened}" />
-
- <input type="hidden" name="panelMenuAction#{clientId}"
- value="" />
- <f:call name="insertLabel"/>
- </td>
- <td class="#{this:getIconClass( context, component,'right')}">
- <f:call name="insertImage">
- <f:parameter value="right" />
- </f:call>
- </td>
- </tr>
- </tbody>
- </table>
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- </div>
-</f:root>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.HtmlPanelMenuGroupRenderer"
+ baseclass="org.richfaces.renderkit.html.PanelMenuGroupRenderer"
+ component="org.richfaces.component.UIPanelMenuGroup"
+ >
+
+ <f:clientid var="clientId"/>
+
+ <div id="#{clientId}" style="#{this:getHideStyle(context, component)}"
+ class="#{this:getDivClass(context, component)}" >
+ <jsp:scriptlet>
+ <![CDATA[
+ String isNodeOpened = isOpened(context, component) ? "opened" : "closed";
+ ]]>
+ </jsp:scriptlet>
+ <table cellspacing="0" cellpadding="0" border="0"
+ id="tablehide#{clientId}"
+ class="#{this:getTableClass(context, component)} rich-pmenu-group #{this:getFullStyleClass( context, component )} "
+ style="#{this:getFullStyle( context, component )}" >
+
+ <f:call name="utils.encodePassThru" />
+
+ <tbody>
+ <tr id="row_#{clientId}"
+ class="#{this:getSelectedClass( context, component )}" >
+ <td class="dr-pmenu-nowrap #{this:getIconClass( context, component,'left')}">
+ <f:call name="insertSpacerImages" />
+ <f:call name="insertImage">
+ <f:parameter value="left" />
+ </f:call>
+ </td>
+ <td style="width:100%" id="icon#{clientId}" class="dr-pmenu-group-self-label #{this:getLabelClass( context, component )}" >
+ <input type="hidden" name="panelMenuState#{clientId}"
+ value="#{isNodeOpened}" />
+
+ <input type="hidden" name="panelMenuAction#{clientId}"
+ value="" />
+ <f:call name="insertLabel"/>
+ </td>
+ <td class="#{this:getIconClass( context, component,'right')}">
+ <f:call name="insertImage">
+ <f:parameter value="right" />
+ </f:call>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ </div>
+</f:root>
Modified: trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx
===================================================================
--- trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/panelmenu/src/main/templates/org/richfaces/htmlPanelMenuItem.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,51 +1,51 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
- class="org.richfaces.renderkit.html.HtmlPanelMenuItemRenderer"
- baseclass="org.richfaces.renderkit.html.PanelMenuItemRenderer"
- component="org.richfaces.component.UIPanelMenuItem"
- >
-
- <f:clientid var="clientId"/>
-
- <div id="#{clientId}" style="#{this:getHideStyle(context, component)}" >
- <table cellspacing="0" cellpadding="0" border="0"
- id="tablehide#{clientId}"
- class="dr-pmenu-item rich-pmenu-item #{this:getFullStyleClass( context, component )} "
- style="#{this:getFullStyle( context, component )}" >
-
- <f:call name="utils.encodeAttributes">
- <f:parameter value="onclick,onmousedown,onmouseup,onmousemove" />
- </f:call>
-
- <tbody>
- <tr id="row_#{clientId}"
- class="#{this:getSelectedClass( context, component )}" >
- <td class="dr-pmenu-nowrap #{this:getIconClass( context, component,'left')}">
- <f:call name="insertSpacerImages" />
- <f:call name="insertImage">
- <f:parameter value="left" />
- </f:call>
- </td>
- <td style="width:100%" id="icon#{clientId}" class="dr-pmenu-group-self-label #{this:getLabelClass( context, component )}" >
- <input type="hidden" name="panelMenuAction#{clientId}" value=""/>
- <f:call name="insertLabel"/>
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- </td>
- <td class="#{this:getIconClass( context, component,'right')}">
- <f:call name="insertImage">
- <f:parameter value="right" />
- </f:call>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-</f:root>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
+ class="org.richfaces.renderkit.html.HtmlPanelMenuItemRenderer"
+ baseclass="org.richfaces.renderkit.html.PanelMenuItemRenderer"
+ component="org.richfaces.component.UIPanelMenuItem"
+ >
+
+ <f:clientid var="clientId"/>
+
+ <div id="#{clientId}" style="#{this:getHideStyle(context, component)}" >
+ <table cellspacing="0" cellpadding="0" border="0"
+ id="tablehide#{clientId}"
+ class="dr-pmenu-item rich-pmenu-item #{this:getFullStyleClass( context, component )} "
+ style="#{this:getFullStyle( context, component )}" >
+
+ <f:call name="utils.encodeAttributes">
+ <f:parameter value="onclick,onmousedown,onmouseup,onmousemove" />
+ </f:call>
+
+ <tbody>
+ <tr id="row_#{clientId}"
+ class="#{this:getSelectedClass( context, component )}" >
+ <td class="dr-pmenu-nowrap #{this:getIconClass( context, component,'left')}">
+ <f:call name="insertSpacerImages" />
+ <f:call name="insertImage">
+ <f:parameter value="left" />
+ </f:call>
+ </td>
+ <td style="width:100%" id="icon#{clientId}" class="dr-pmenu-group-self-label #{this:getLabelClass( context, component )}" >
+ <input type="hidden" name="panelMenuAction#{clientId}" value=""/>
+ <f:call name="insertLabel"/>
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ </td>
+ <td class="#{this:getIconClass( context, component,'right')}">
+ <f:call name="insertImage">
+ <f:parameter value="right" />
+ </f:call>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</f:root>
Modified: trunk/ui/pickList/src/main/templates/htmlPickList.jspx
===================================================================
--- trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/pickList/src/main/templates/htmlPickList.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -29,10 +29,10 @@
</h:scripts>
<f:clientId var="clientId"/>
-
- <table id="#{clientId}" class="rich-list-picklist #{component.attributes['styleClass']}"
+
+ <table id="#{clientId}" class="rich-list-picklist #{component.attributes['styleClass']}"
cellspacing="0" cellpadding="0"
- x:passThruWithExclusions="id, class, styleClass">
+ x:passThruWithExclusions="id, class, styleClass">
<tbody>
<vcp:body>
<f:clientId var="clientId"/>
@@ -49,7 +49,7 @@
Boolean switchByClick = (Boolean) component.getAttributes().get("switchByClick");
variables.setVariable("switchByClick", switchByClick);
-
+
variables.setVariable("baseClientId", component.getBaseClientId(context));
]]>
</jsp:scriptlet>
@@ -171,4 +171,4 @@
"#{clientId}valueKeeper");
</script>
</span>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
===================================================================
--- trunk/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -53,4 +53,4 @@
}
]]>
</jsp:scriptlet>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java
===================================================================
--- trunk/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,144 +1,144 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.sandbox;
-
-import javax.faces.component.UIForm;
-import javax.faces.component.UIOutput;
-import javax.faces.component.html.HtmlForm;
-
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.UIProgressBar;
-
-import com.gargoylesoftware.htmlunit.html.DomText;
-import com.gargoylesoftware.htmlunit.html.HtmlElement;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.sun.org.apache.bcel.internal.generic.NEW;
-
-/**
- * Unit test for Progress bar component.
- */
-public class ProgressBarComponentTest extends AbstractAjax4JsfTestCase {
-
- /** Form component */
- private UIForm form = null;
-
- /** Progress bar component */
- private UIProgressBar progressBar = null;
-
- /** Child component for progres bar */
- private UIOutput output = null;
-
- /**
- * TODO Description goes here.
- *
- * @param name
- */
- public ProgressBarComponentTest(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
- */
- @Override
- public void setUp() throws Exception {
- // TODO Auto-generated method stub
- super.setUp();
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- progressBar = (UIProgressBar) application
- .createComponent("org.richfaces.ProgressBar");
- progressBar.setId("prgs");
- progressBar.setValue(50);
- progressBar.setInterval(1000);
-
-// MockValueExpression expression = new MockValueExpression("50%");
-// ValueExpression exp = application.getExpressionFactory()
-// .createValueExpression(facesContext.getELContext(), "#{persent}", Object.class);
- output = (UIOutput)application.createComponent("javax.faces.Output");
- output.setValue("{value}%");
-// output.setValueExpression("value", expression);
-
- progressBar.getChildren().add(output);
-
- form.getChildren().add(progressBar);
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
- */
- @Override
- public void tearDown() throws Exception {
- // TODO Auto-generated method stub
- super.tearDown();
- }
-
- /**
- * Method tests progress bar component
- * @throws Exception
- */
- public void testProgressBar() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
-
- String clientId = progressBar.getClientId(facesContext);
-
- HtmlElement progress = page.getHtmlElementById(clientId);
- assertNotNull(progress);
- assertEquals("div", progress.getNodeName());
-
- String classAttr = progress.getAttributeValue("class");
- assertTrue(classAttr.contains("rich-progress-bar"));
-
- HtmlElement node = (HtmlElement)progress.getHtmlElementById(clientId + ":remain");
- assertTrue(node.getAttributeValue("class").indexOf("rich-progress-bar-remained") != -1);
-
- node = (HtmlElement) progress.getLastChild();
- assertTrue("span".equalsIgnoreCase(node.getTagName()));
-
- node = (HtmlElement) node.getLastChild();
- assertTrue("script".equalsIgnoreCase(node.getTagName()));
-
- DomText text = (DomText) node.getFirstChild();
- assertTrue(text.getData().contains("$('" + clientId + "').component"));
- assertTrue(text.getData().contains("renderLabel"));
-
- assertEquals(1L, progressBar.getNumber(1));
- assertEquals(new Double(1), progressBar.getNumber("1"));
- assertEquals(0, progressBar.getNumber(null));
-
- facesContext.getExternalContext().getRequestParameterMap().put("percent", "100");
- facesContext.getExternalContext().getRequestParameterMap().put(progressBar.getClientId(facesContext), progressBar.getClientId(facesContext));
-
- progressBar.broadcast(new AjaxEvent(progressBar));
-
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.sandbox;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.UIOutput;
+import javax.faces.component.html.HtmlForm;
+
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.UIProgressBar;
+
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.sun.org.apache.bcel.internal.generic.NEW;
+
+/**
+ * Unit test for Progress bar component.
+ */
+public class ProgressBarComponentTest extends AbstractAjax4JsfTestCase {
+
+ /** Form component */
+ private UIForm form = null;
+
+ /** Progress bar component */
+ private UIProgressBar progressBar = null;
+
+ /** Child component for progres bar */
+ private UIOutput output = null;
+
+ /**
+ * TODO Description goes here.
+ *
+ * @param name
+ */
+ public ProgressBarComponentTest(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ @Override
+ public void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ progressBar = (UIProgressBar) application
+ .createComponent("org.richfaces.ProgressBar");
+ progressBar.setId("prgs");
+ progressBar.setValue(50);
+ progressBar.setInterval(1000);
+
+// MockValueExpression expression = new MockValueExpression("50%");
+// ValueExpression exp = application.getExpressionFactory()
+// .createValueExpression(facesContext.getELContext(), "#{persent}", Object.class);
+ output = (UIOutput)application.createComponent("javax.faces.Output");
+ output.setValue("{value}%");
+// output.setValueExpression("value", expression);
+
+ progressBar.getChildren().add(output);
+
+ form.getChildren().add(progressBar);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ @Override
+ public void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+ }
+
+ /**
+ * Method tests progress bar component
+ * @throws Exception
+ */
+ public void testProgressBar() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+
+ String clientId = progressBar.getClientId(facesContext);
+
+ HtmlElement progress = page.getHtmlElementById(clientId);
+ assertNotNull(progress);
+ assertEquals("div", progress.getNodeName());
+
+ String classAttr = progress.getAttributeValue("class");
+ assertTrue(classAttr.contains("rich-progress-bar"));
+
+ HtmlElement node = (HtmlElement)progress.getHtmlElementById(clientId + ":remain");
+ assertTrue(node.getAttributeValue("class").indexOf("rich-progress-bar-remained") != -1);
+
+ node = (HtmlElement) progress.getLastChild();
+ assertTrue("span".equalsIgnoreCase(node.getTagName()));
+
+ node = (HtmlElement) node.getLastChild();
+ assertTrue("script".equalsIgnoreCase(node.getTagName()));
+
+ DomText text = (DomText) node.getFirstChild();
+ assertTrue(text.getData().contains("$('" + clientId + "').component"));
+ assertTrue(text.getData().contains("renderLabel"));
+
+ assertEquals(1L, progressBar.getNumber(1));
+ assertEquals(new Double(1), progressBar.getNumber("1"));
+ assertEquals(0, progressBar.getNumber(null));
+
+ facesContext.getExternalContext().getRequestParameterMap().put("percent", "100");
+ facesContext.getExternalContext().getRequestParameterMap().put(progressBar.getClientId(facesContext), progressBar.getClientId(facesContext));
+
+ progressBar.broadcast(new AjaxEvent(progressBar));
+
+ }
+
+}
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -66,4 +66,4 @@
return functionDefinition;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableOptions.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -95,4 +95,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconSplit.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconSplit.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/iconimages/ScrollableDataTableIconSplit.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,121 +1,121 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit.html.iconimages;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.util.Date;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.resource.GifRenderer;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.resource.ResourceContext;
-import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.Zipper;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-public class ScrollableDataTableIconSplit extends Java2Dresource {
-
- public ScrollableDataTableIconSplit() {
- setRenderer(new GifRenderer());
- setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
- }
-
- public Dimension calculateDimensions() {
- return new Dimension(2, 13);
- }
-
- protected void paint(ResourceContext context, Graphics2D g2d) {
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
-
- Object [] data = (Object[]) restoreData(context);
- Color col1 = (Color)data[0];
- Color col2 = (Color)data[1];
-
- g2d.setColor(col2);
- g2d.drawLine(0, 0, 0, 12);
- g2d.setColor(col1);
- g2d.drawLine(1, 0, 1, 12);
- }
-
- public Dimension getDimensions(FacesContext facesContext, Object data) {
- return calculateDimensions();
- }
- protected Dimension getDimensions(ResourceContext resourceContext) {
- return calculateDimensions();
- }
-
- protected Object deserializeData(byte[] objectArray) {
- if (objectArray == null) {
- return null;
- }
-
- Object [] stored = new Object[2];
- stored[0] = new Color(Zipper.unzip(objectArray, 0));
- stored[1] = new Color(Zipper.unzip(objectArray, 3));
-
- return stored;
- }
-
- protected Object getDataToStore(FacesContext context, Object data) {
- Skin skin = SkinFactory.getInstance().getSkin(context);
- Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
-
- Color col = null;
-
- String skinParameter = "headerTextColor";
- String headerTextColor = (String) skin.getParameter(context, skinParameter);
- if (null == headerTextColor || "".equals(headerTextColor))
- headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
-
- if (headerTextColor == null) {
- return null;
- }
-
- col = HtmlColor.decode(headerTextColor);
-
- byte[] ret = new byte[6];
- Zipper.zip(ret, col.getRGB(), 0);
-
- skinParameter = "headerBackgroundColor";
- String headerBackgroundColor = (String) skin.getParameter(context, skinParameter);
- if (null == headerBackgroundColor || "".equals(headerBackgroundColor))
- headerBackgroundColor = (String) defaultSkin.getParameter(context, skinParameter);
-
- if (headerBackgroundColor == null) {
- return null;
- }
-
- col = HtmlColor.decode(headerBackgroundColor);
-
- Zipper.zip(ret, col.getRGB(), 3);
-
- return ret;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit.html.iconimages;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+public class ScrollableDataTableIconSplit extends Java2Dresource {
+
+ public ScrollableDataTableIconSplit() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ public Dimension calculateDimensions() {
+ return new Dimension(2, 13);
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+
+ Object [] data = (Object[]) restoreData(context);
+ Color col1 = (Color)data[0];
+ Color col2 = (Color)data[1];
+
+ g2d.setColor(col2);
+ g2d.drawLine(0, 0, 0, 12);
+ g2d.setColor(col1);
+ g2d.drawLine(1, 0, 1, 12);
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return calculateDimensions();
+ }
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return calculateDimensions();
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+
+ Object [] stored = new Object[2];
+ stored[0] = new Color(Zipper.unzip(objectArray, 0));
+ stored[1] = new Color(Zipper.unzip(objectArray, 3));
+
+ return stored;
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data) {
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance().getDefaultSkin(context);
+
+ Color col = null;
+
+ String skinParameter = "headerTextColor";
+ String headerTextColor = (String) skin.getParameter(context, skinParameter);
+ if (null == headerTextColor || "".equals(headerTextColor))
+ headerTextColor = (String) defaultSkin.getParameter(context, skinParameter);
+
+ if (headerTextColor == null) {
+ return null;
+ }
+
+ col = HtmlColor.decode(headerTextColor);
+
+ byte[] ret = new byte[6];
+ Zipper.zip(ret, col.getRGB(), 0);
+
+ skinParameter = "headerBackgroundColor";
+ String headerBackgroundColor = (String) skin.getParameter(context, skinParameter);
+ if (null == headerBackgroundColor || "".equals(headerBackgroundColor))
+ headerBackgroundColor = (String) defaultSkin.getParameter(context, skinParameter);
+
+ if (headerBackgroundColor == null) {
+ return null;
+ }
+
+ col = HtmlColor.decode(headerBackgroundColor);
+
+ Zipper.zip(ret, col.getRGB(), 3);
+
+ return ret;
+ }
+
+}
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-cell.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -17,4 +17,4 @@
</div>
</td>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-footer-cell.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -17,4 +17,4 @@
</div>
</th>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-cell.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -35,4 +35,4 @@
<span column="#{cell_index}" id="#{client_id}:hsep_#{cell_index}" style="left: #{offset}px;" class="dr-sdt-hsep rich-sdt-hsep" />
</th>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table-header-itself.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -27,4 +27,4 @@
</div>
<ajax:update>#{client_id}:hcb_#{cell_index}</ajax:update>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx
===================================================================
--- trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/main/templates/org/richfaces/scrollable-data-table.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -240,4 +240,4 @@
</f:root>
-
\ No newline at end of file
+
Modified: trunk/ui/scrollableDataTable/src/test/java/org/richfaces/model/internal/TestObj.java
===================================================================
--- trunk/ui/scrollableDataTable/src/test/java/org/richfaces/model/internal/TestObj.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/test/java/org/richfaces/model/internal/TestObj.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -43,4 +43,4 @@
public String getName() {
return name;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/JSFComponentTest.java
===================================================================
--- trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/JSFComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/scrollableDataTable/src/test/java/org/richfaces/renderkit/html/JSFComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,48 +1,48 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.renderkit.html;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.renderkit.html;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for simple Component.
+ */
+public class JSFComponentTest extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public JSFComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testComponent()
+ {
+ assertTrue( true );
+ }
+}
Modified: trunk/ui/separator/src/main/templates/separator.jspx
===================================================================
--- trunk/ui/separator/src/main/templates/separator.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/separator/src/main/templates/separator.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -9,7 +9,7 @@
baseclass="org.richfaces.renderkit.html.SeparatorRendererBase"
component="org.richfaces.component.UISeparator"
>
- <f:clientid var="clientId"/>
+ <f:clientid var="clientId"/>
<h:styles>css/separator.xcss</h:styles>
<div id="#{clientId}" style="font-size: 0px;"
x:passThruWithExclusions="id,width,height,style,class,align,styleClass">
Modified: trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/component/UISimpleTogglePanel.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,218 +1,218 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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 java.util.Iterator;
-
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.component.AjaxActionComponent;
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.event.AjaxSource;
-import org.richfaces.event.SimpleToggleEvent;
-
-
-/**
- * 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 transient Boolean openedSet = null;
-
- private transient Boolean wasOpened = null;
-
- protected boolean isWasOpened() {
- if (wasOpened == null) {
- if (CLIENT_SWITCH_TYPE.equals(getSwitchType())) {
- wasOpened = Boolean.TRUE;
- } else {
- wasOpened = isOpened();
- }
- }
-
- return wasOpened;
- }
-
- public abstract void setSwitchType(String switchType);
-
- public abstract String getSwitchType();
-
- public void setOpened(boolean opened) {
- setValue(new Boolean(opened).toString());
- }
-
- public boolean isOpened() {
- Object value = getValue();
- if (value instanceof Boolean) {
- return ((Boolean)value).booleanValue();
- } else if (value instanceof String) {
- String s = (String) value;
- return Boolean.parseBoolean(s);
- }
- return true;
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- /**
- * @throws NullPointerException {@inheritDoc}
- */
- public void processDecodes(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
- if (isWasOpened()) {
- // Process all facets and children of this component
- Iterator<UIComponent> kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = kids.next();
- kid.processDecodes(context);
- }
- }
-
- // Process this component itself
- try {
- decode(context);
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
-
- }
- @Override
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if(event instanceof SimpleToggleEvent) {
- SimpleToggleEvent simpleToggleEvent = (SimpleToggleEvent) event;
- setOpened(simpleToggleEvent.isIsOpen());
- }
- super.broadcast(event);
- }
-
-
- /**
- * @throws NullPointerException {@inheritDoc}
- */
- public void processValidators(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
- if (isWasOpened()) {
- // Process all the facets and children of this component
- Iterator<UIComponent> kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = kids.next();
- kid.processValidators(context);
- }
- }
- }
-
-
- /**
- * @throws NullPointerException {@inheritDoc}
- */
- public void processUpdates(FacesContext context) {
-
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
-// updateModel();
-
- if (isWasOpened()) {
- // Process all facets and children of this component
- Iterator<UIComponent> kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = kids.next();
- kid.processUpdates(context);
- }
- }
- }
-
-// private void updateModel () {
-// if (openedSet != null) {
-// setOpened(openedSet);
-// }
-// }
-
-// public boolean isOpenedSet() {
-// return openedSet;
-// }
-
-// /**
-// * @param openedSet the openedSet to set
-// */
-// public void setOpenedSet(boolean openedSet) {
-// this.openedSet = openedSet;
-// }
-
-/*
- * 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());
- // }
- //}
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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 java.util.Iterator;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.component.AjaxActionComponent;
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.event.AjaxSource;
+import org.richfaces.event.SimpleToggleEvent;
+
+
+/**
+ * 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 transient Boolean openedSet = null;
+
+ private transient Boolean wasOpened = null;
+
+ protected boolean isWasOpened() {
+ if (wasOpened == null) {
+ if (CLIENT_SWITCH_TYPE.equals(getSwitchType())) {
+ wasOpened = Boolean.TRUE;
+ } else {
+ wasOpened = isOpened();
+ }
+ }
+
+ return wasOpened;
+ }
+
+ public abstract void setSwitchType(String switchType);
+
+ public abstract String getSwitchType();
+
+ public void setOpened(boolean opened) {
+ setValue(new Boolean(opened).toString());
+ }
+
+ public boolean isOpened() {
+ Object value = getValue();
+ if (value instanceof Boolean) {
+ return ((Boolean)value).booleanValue();
+ } else if (value instanceof String) {
+ String s = (String) value;
+ return Boolean.parseBoolean(s);
+ }
+ return true;
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public void processDecodes(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ if (isWasOpened()) {
+ // Process all facets and children of this component
+ Iterator<UIComponent> kids = getFacetsAndChildren();
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processDecodes(context);
+ }
+ }
+
+ // Process this component itself
+ try {
+ decode(context);
+ } catch (RuntimeException e) {
+ context.renderResponse();
+ throw e;
+ }
+
+ }
+ @Override
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if(event instanceof SimpleToggleEvent) {
+ SimpleToggleEvent simpleToggleEvent = (SimpleToggleEvent) event;
+ setOpened(simpleToggleEvent.isIsOpen());
+ }
+ super.broadcast(event);
+ }
+
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public void processValidators(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+ if (isWasOpened()) {
+ // Process all the facets and children of this component
+ Iterator<UIComponent> kids = getFacetsAndChildren();
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processValidators(context);
+ }
+ }
+ }
+
+
+ /**
+ * @throws NullPointerException {@inheritDoc}
+ */
+ public void processUpdates(FacesContext context) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // Skip processing if our rendered flag is false
+ if (!isRendered()) {
+ return;
+ }
+
+// updateModel();
+
+ if (isWasOpened()) {
+ // Process all facets and children of this component
+ Iterator<UIComponent> kids = getFacetsAndChildren();
+ while (kids.hasNext()) {
+ UIComponent kid = kids.next();
+ kid.processUpdates(context);
+ }
+ }
+ }
+
+// private void updateModel () {
+// if (openedSet != null) {
+// setOpened(openedSet);
+// }
+// }
+
+// public boolean isOpenedSet() {
+// return openedSet;
+// }
+
+// /**
+// * @param openedSet the openedSet to set
+// */
+// public void setOpenedSet(boolean openedSet) {
+// this.openedSet = openedSet;
+// }
+
+/*
+ * 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/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
--- trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -222,4 +222,4 @@
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/spacer/src/main/templates/spacer.jspx
===================================================================
--- trunk/ui/spacer/src/main/templates/spacer.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/spacer/src/main/templates/spacer.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -21,4 +21,4 @@
x:passThruWithExclusions="id,width,height,title,styleClass,class"
>
</img>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/state/src/main/java/org/richfaces/el/StateELResolver.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/el/StateELResolver.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/el/StateELResolver.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,239 +1,239 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.el;
-
-import java.beans.FeatureDescriptor;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-
-import javax.el.ELContext;
-import javax.el.ELResolver;
-import javax.el.FunctionMapper;
-import javax.el.PropertyNotFoundException;
-import javax.el.PropertyNotWritableException;
-import javax.el.ValueExpression;
-import javax.el.VariableMapper;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.ui.model.State;
-
-/**
- * @author asmirnov
- *
- */
-public class StateELResolver extends ELResolver {
-
- private static final class ELContextWrapper extends ELContext {
- private final ELContext context;
-
- private boolean resolved = false;
-
- private ELContextWrapper(ELContext context) {
- this.context = context;
- }
-
- @Override
- public ELResolver getELResolver() {
- return context.getELResolver();
- }
-
- @Override
- public FunctionMapper getFunctionMapper() {
- return context.getFunctionMapper();
- }
-
- @Override
- public VariableMapper getVariableMapper() {
- return context.getVariableMapper();
- }
-
- /**
- * @param key
- * @return
- * @see javax.el.ELContext#getContext(java.lang.Class)
- */
- public Object getContext(Class key) {
- return context.getContext(key);
- }
-
- /**
- * @return
- * @see javax.el.ELContext#getLocale()
- */
- public Locale getLocale() {
- return context.getLocale();
- }
-
- /**
- * @return
- * @see javax.el.ELContext#isPropertyResolved()
- */
- public boolean isPropertyResolved() {
- return resolved;
- }
-
- /**
- * @param key
- * @param contextObject
- * @see javax.el.ELContext#putContext(java.lang.Class, java.lang.Object)
- */
- public void putContext(Class key, Object contextObject) {
- context.putContext(key, contextObject);
- }
-
- /**
- * @param locale
- * @see javax.el.ELContext#setLocale(java.util.Locale)
- */
- public void setLocale(Locale locale) {
- context.setLocale(locale);
- }
-
- /**
- * @param resolved
- * @see javax.el.ELContext#setPropertyResolved(boolean)
- */
- public void setPropertyResolved(boolean resolved) {
- this.resolved = resolved;
- }
- }
-
- private static List<FeatureDescriptor> stateFeatureDescriptors;
- static {
- FeatureDescriptor descriptor = new FeatureDescriptor();
- descriptor.setDisplayName("Page state");
- descriptor.setExpert(false);
- descriptor.setName("state");
- descriptor.setHidden(false);
- stateFeatureDescriptors = Collections.singletonList(descriptor);
- }
-
- /* (non-Javadoc)
- * @see javax.el.ELResolver#getCommonPropertyType(javax.el.ELContext, java.lang.Object)
- */
- @Override
- public Class<?> getCommonPropertyType(ELContext context, Object base) {
- if (null != base && base instanceof State) {
- return String.class;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.el.ELResolver#getFeatureDescriptors(javax.el.ELContext, java.lang.Object)
- */
- @Override
- public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
- Object base) {
- if (null != base && base instanceof State) {
- return stateFeatureDescriptors.iterator();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.el.ELResolver#getType(javax.el.ELContext, java.lang.Object, java.lang.Object)
- */
- @Override
- public Class<?> getType(ELContext context, Object base, Object property) {
- if (null != base && base instanceof State) {
- if (property == null) {
- throw new PropertyNotFoundException("Null property");
- }
- State state = (State)base;
- Object stateProperty = state.get(property.toString());
- if (stateProperty == null) {
- throw new PropertyNotFoundException("State Property ["+property+"] not found ");
- }
- context.setPropertyResolved(true);
- if (stateProperty instanceof ValueExpression) {
- ValueExpression propertyExpression = (ValueExpression) stateProperty;
- FacesContext facesContext = FacesContext.getCurrentInstance();
- return propertyExpression.getType(facesContext.getELContext());
- }
- return stateProperty.getClass();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.el.ELResolver#getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)
- */
- @Override
- public Object getValue(final ELContext context, Object base, Object property) {
- if (null != base && base instanceof State) {
- if (property == null) {
- throw new PropertyNotFoundException("Null property");
- }
- State state = (State)base;
- Object stateProperty = state.get(property.toString());
- if (stateProperty == null) {
- throw new PropertyNotFoundException("State Property ["+property+"] not found ");
- }
- context.setPropertyResolved(true);
- if (stateProperty instanceof ValueExpression) {
- ValueExpression propertyExpression = (ValueExpression) stateProperty;
- FacesContext facesContext = FacesContext.getCurrentInstance();
- ELContext tempContext = new ELContextWrapper(context);
- return propertyExpression.getValue(tempContext);
- }
- return stateProperty;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.el.ELResolver#isReadOnly(javax.el.ELContext, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean isReadOnly(ELContext context, Object base, Object property) {
- if (null != base && base instanceof State){
- if (property == null) {
- throw new PropertyNotFoundException("Null property");
- }
- State state = (State)base;
- Object stateProperty = state.get(property.toString());
- if (stateProperty == null) {
- throw new PropertyNotFoundException("State Property ["+property+"] not found ");
- }
- context.setPropertyResolved(true);
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.el.ELResolver#setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)
- */
- @Override
- public void setValue(ELContext context, Object base, Object property,
- Object value) {
- if (null != base && base instanceof State){
- if (property == null) {
- throw new PropertyNotFoundException("Null property");
- }
- throw new PropertyNotWritableException((String) property);
- }
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.el;
+
+import java.beans.FeatureDescriptor;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.FunctionMapper;
+import javax.el.PropertyNotFoundException;
+import javax.el.PropertyNotWritableException;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.ui.model.State;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateELResolver extends ELResolver {
+
+ private static final class ELContextWrapper extends ELContext {
+ private final ELContext context;
+
+ private boolean resolved = false;
+
+ private ELContextWrapper(ELContext context) {
+ this.context = context;
+ }
+
+ @Override
+ public ELResolver getELResolver() {
+ return context.getELResolver();
+ }
+
+ @Override
+ public FunctionMapper getFunctionMapper() {
+ return context.getFunctionMapper();
+ }
+
+ @Override
+ public VariableMapper getVariableMapper() {
+ return context.getVariableMapper();
+ }
+
+ /**
+ * @param key
+ * @return
+ * @see javax.el.ELContext#getContext(java.lang.Class)
+ */
+ public Object getContext(Class key) {
+ return context.getContext(key);
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#getLocale()
+ */
+ public Locale getLocale() {
+ return context.getLocale();
+ }
+
+ /**
+ * @return
+ * @see javax.el.ELContext#isPropertyResolved()
+ */
+ public boolean isPropertyResolved() {
+ return resolved;
+ }
+
+ /**
+ * @param key
+ * @param contextObject
+ * @see javax.el.ELContext#putContext(java.lang.Class, java.lang.Object)
+ */
+ public void putContext(Class key, Object contextObject) {
+ context.putContext(key, contextObject);
+ }
+
+ /**
+ * @param locale
+ * @see javax.el.ELContext#setLocale(java.util.Locale)
+ */
+ public void setLocale(Locale locale) {
+ context.setLocale(locale);
+ }
+
+ /**
+ * @param resolved
+ * @see javax.el.ELContext#setPropertyResolved(boolean)
+ */
+ public void setPropertyResolved(boolean resolved) {
+ this.resolved = resolved;
+ }
+ }
+
+ private static List<FeatureDescriptor> stateFeatureDescriptors;
+ static {
+ FeatureDescriptor descriptor = new FeatureDescriptor();
+ descriptor.setDisplayName("Page state");
+ descriptor.setExpert(false);
+ descriptor.setName("state");
+ descriptor.setHidden(false);
+ stateFeatureDescriptors = Collections.singletonList(descriptor);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELResolver#getCommonPropertyType(javax.el.ELContext, java.lang.Object)
+ */
+ @Override
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
+ if (null != base && base instanceof State) {
+ return String.class;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELResolver#getFeatureDescriptors(javax.el.ELContext, java.lang.Object)
+ */
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
+ Object base) {
+ if (null != base && base instanceof State) {
+ return stateFeatureDescriptors.iterator();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELResolver#getType(javax.el.ELContext, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public Class<?> getType(ELContext context, Object base, Object property) {
+ if (null != base && base instanceof State) {
+ if (property == null) {
+ throw new PropertyNotFoundException("Null property");
+ }
+ State state = (State)base;
+ Object stateProperty = state.get(property.toString());
+ if (stateProperty == null) {
+ throw new PropertyNotFoundException("State Property ["+property+"] not found ");
+ }
+ context.setPropertyResolved(true);
+ if (stateProperty instanceof ValueExpression) {
+ ValueExpression propertyExpression = (ValueExpression) stateProperty;
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ return propertyExpression.getType(facesContext.getELContext());
+ }
+ return stateProperty.getClass();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELResolver#getValue(javax.el.ELContext, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public Object getValue(final ELContext context, Object base, Object property) {
+ if (null != base && base instanceof State) {
+ if (property == null) {
+ throw new PropertyNotFoundException("Null property");
+ }
+ State state = (State)base;
+ Object stateProperty = state.get(property.toString());
+ if (stateProperty == null) {
+ throw new PropertyNotFoundException("State Property ["+property+"] not found ");
+ }
+ context.setPropertyResolved(true);
+ if (stateProperty instanceof ValueExpression) {
+ ValueExpression propertyExpression = (ValueExpression) stateProperty;
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ELContext tempContext = new ELContextWrapper(context);
+ return propertyExpression.getValue(tempContext);
+ }
+ return stateProperty;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELResolver#isReadOnly(javax.el.ELContext, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean isReadOnly(ELContext context, Object base, Object property) {
+ if (null != base && base instanceof State){
+ if (property == null) {
+ throw new PropertyNotFoundException("Null property");
+ }
+ State state = (State)base;
+ Object stateProperty = state.get(property.toString());
+ if (stateProperty == null) {
+ throw new PropertyNotFoundException("State Property ["+property+"] not found ");
+ }
+ context.setPropertyResolved(true);
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.el.ELResolver#setValue(javax.el.ELContext, java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) {
+ if (null != base && base instanceof State){
+ if (property == null) {
+ throw new PropertyNotFoundException("Null property");
+ }
+ throw new PropertyNotWritableException((String) property);
+ }
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplication.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplication.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplication.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,467 +1,467 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import javax.el.ELContextListener;
-import javax.el.ELException;
-import javax.el.ELResolver;
-import javax.el.ExpressionFactory;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.application.Application;
-import javax.faces.application.NavigationHandler;
-import javax.faces.application.StateManager;
-import javax.faces.application.ViewHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.PropertyResolver;
-import javax.faces.el.ReferenceSyntaxException;
-import javax.faces.el.ValueBinding;
-import javax.faces.el.VariableResolver;
-import javax.faces.event.ActionListener;
-import javax.faces.validator.Validator;
-
-/**
- * @author asmirnov
- *
- */
-public class StateApplication extends Application {
-
- private final Application parent;
- private final ExpressionFactory exprFactory;
-
- /**
- * @param parent
- */
- public StateApplication(Application parentApp) {
- super();
- this.parent = parentApp;
- this.exprFactory = new StateExpressionFactory(){
- @Override
- public ExpressionFactory getDefaultFactory() {
- return parent.getExpressionFactory();
- }
- };
- }
-
- /**
- * @param componentType
- * @param componentClass
- * @see javax.faces.application.Application#addComponent(java.lang.String, java.lang.String)
- */
- public void addComponent(String componentType, String componentClass) {
- parent.addComponent(componentType, componentClass);
- }
-
- /**
- * @param targetClass
- * @param converterClass
- * @see javax.faces.application.Application#addConverter(java.lang.Class, java.lang.String)
- */
- public void addConverter(Class targetClass, String converterClass) {
- parent.addConverter(targetClass, converterClass);
- }
-
- /**
- * @param converterId
- * @param converterClass
- * @see javax.faces.application.Application#addConverter(java.lang.String, java.lang.String)
- */
- public void addConverter(String converterId, String converterClass) {
- parent.addConverter(converterId, converterClass);
- }
-
- /**
- * @param listener
- * @see javax.faces.application.Application#addELContextListener(javax.el.ELContextListener)
- */
- public void addELContextListener(ELContextListener listener) {
- parent.addELContextListener(listener);
- }
-
- /**
- * @param resolver
- * @see javax.faces.application.Application#addELResolver(javax.el.ELResolver)
- */
- public void addELResolver(ELResolver resolver) {
- parent.addELResolver(resolver);
- }
-
- /**
- * @param validatorId
- * @param validatorClass
- * @see javax.faces.application.Application#addValidator(java.lang.String, java.lang.String)
- */
- public void addValidator(String validatorId, String validatorClass) {
- parent.addValidator(validatorId, validatorClass);
- }
-
- /**
- * @param componentType
- * @return
- * @throws FacesException
- * @see javax.faces.application.Application#createComponent(java.lang.String)
- */
- public UIComponent createComponent(String componentType)
- throws FacesException {
- return parent.createComponent(componentType);
- }
-
- /**
- * @param componentBinding
- * @param context
- * @param componentType
- * @return
- * @throws FacesException
- * @deprecated
- * @see javax.faces.application.Application#createComponent(javax.faces.el.ValueBinding, javax.faces.context.FacesContext, java.lang.String)
- */
- public UIComponent createComponent(ValueBinding componentBinding,
- FacesContext context, String componentType) throws FacesException {
- return parent.createComponent(componentBinding, context, componentType);
- }
-
- /**
- * @param componentExpression
- * @param context
- * @param componentType
- * @return
- * @throws FacesException
- * @see javax.faces.application.Application#createComponent(javax.el.ValueExpression, javax.faces.context.FacesContext, java.lang.String)
- */
- public UIComponent createComponent(ValueExpression componentExpression,
- FacesContext context, String componentType) throws FacesException {
- return parent.createComponent(componentExpression, context,
- componentType);
- }
-
- /**
- * @param targetClass
- * @return
- * @see javax.faces.application.Application#createConverter(java.lang.Class)
- */
- public Converter createConverter(Class targetClass) {
- return parent.createConverter(targetClass);
- }
-
- /**
- * @param converterId
- * @return
- * @see javax.faces.application.Application#createConverter(java.lang.String)
- */
- public Converter createConverter(String converterId) {
- return parent.createConverter(converterId);
- }
-
- /**
- * @param ref
- * @param params
- * @return
- * @throws ReferenceSyntaxException
- * @deprecated
- * @see javax.faces.application.Application#createMethodBinding(java.lang.String, java.lang.Class[])
- */
- public MethodBinding createMethodBinding(String ref, Class[] params)
- throws ReferenceSyntaxException {
- return parent.createMethodBinding(ref, params);
- }
-
- /**
- * @param validatorId
- * @return
- * @throws FacesException
- * @see javax.faces.application.Application#createValidator(java.lang.String)
- */
- public Validator createValidator(String validatorId) throws FacesException {
- return parent.createValidator(validatorId);
- }
-
- /**
- * @param ref
- * @return
- * @throws ReferenceSyntaxException
- * @deprecated
- * @see javax.faces.application.Application#createValueBinding(java.lang.String)
- */
- public ValueBinding createValueBinding(String ref)
- throws ReferenceSyntaxException {
- return parent.createValueBinding(ref);
- }
-
- /**
- * @param context
- * @param expression
- * @param expectedType
- * @return
- * @throws ELException
- * @see javax.faces.application.Application#evaluateExpressionGet(javax.faces.context.FacesContext, java.lang.String, java.lang.Class)
- */
- public Object evaluateExpressionGet(FacesContext context,
- String expression, Class expectedType) throws ELException {
- return parent.evaluateExpressionGet(context, expression, expectedType);
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getActionListener()
- */
- public ActionListener getActionListener() {
- return parent.getActionListener();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getComponentTypes()
- */
- public Iterator<String> getComponentTypes() {
- return parent.getComponentTypes();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getConverterIds()
- */
- public Iterator<String> getConverterIds() {
- return parent.getConverterIds();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getConverterTypes()
- */
- public Iterator<Class> getConverterTypes() {
- return parent.getConverterTypes();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getDefaultLocale()
- */
- public Locale getDefaultLocale() {
- return parent.getDefaultLocale();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getDefaultRenderKitId()
- */
- public String getDefaultRenderKitId() {
- return parent.getDefaultRenderKitId();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getELContextListeners()
- */
- public ELContextListener[] getELContextListeners() {
- return parent.getELContextListeners();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getELResolver()
- */
- public ELResolver getELResolver() {
- return parent.getELResolver();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getExpressionFactory()
- */
- public ExpressionFactory getExpressionFactory() {
- return this.exprFactory;
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getMessageBundle()
- */
- public String getMessageBundle() {
- return parent.getMessageBundle();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getNavigationHandler()
- */
- public NavigationHandler getNavigationHandler() {
- return parent.getNavigationHandler();
- }
-
- /**
- * @return
- * @deprecated
- * @see javax.faces.application.Application#getPropertyResolver()
- */
- public PropertyResolver getPropertyResolver() {
- return parent.getPropertyResolver();
- }
-
- /**
- * @param ctx
- * @param name
- * @return
- * @see javax.faces.application.Application#getResourceBundle(javax.faces.context.FacesContext, java.lang.String)
- */
- public ResourceBundle getResourceBundle(FacesContext ctx, String name) {
- return parent.getResourceBundle(ctx, name);
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getStateManager()
- */
- public StateManager getStateManager() {
- return parent.getStateManager();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getSupportedLocales()
- */
- public Iterator<Locale> getSupportedLocales() {
- return parent.getSupportedLocales();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getValidatorIds()
- */
- public Iterator<String> getValidatorIds() {
- return parent.getValidatorIds();
- }
-
- /**
- * @return
- * @deprecated
- * @see javax.faces.application.Application#getVariableResolver()
- */
- public VariableResolver getVariableResolver() {
- return parent.getVariableResolver();
- }
-
- /**
- * @return
- * @see javax.faces.application.Application#getViewHandler()
- */
- public ViewHandler getViewHandler() {
- return parent.getViewHandler();
- }
-
- /**
- * @param listener
- * @see javax.faces.application.Application#removeELContextListener(javax.el.ELContextListener)
- */
- public void removeELContextListener(ELContextListener listener) {
- parent.removeELContextListener(listener);
- }
-
- /**
- * @param listener
- * @see javax.faces.application.Application#setActionListener(javax.faces.event.ActionListener)
- */
- public void setActionListener(ActionListener listener) {
- parent.setActionListener(listener);
- }
-
- /**
- * @param locale
- * @see javax.faces.application.Application#setDefaultLocale(java.util.Locale)
- */
- public void setDefaultLocale(Locale locale) {
- parent.setDefaultLocale(locale);
- }
-
- /**
- * @param renderKitId
- * @see javax.faces.application.Application#setDefaultRenderKitId(java.lang.String)
- */
- public void setDefaultRenderKitId(String renderKitId) {
- parent.setDefaultRenderKitId(renderKitId);
- }
-
- /**
- * @param bundle
- * @see javax.faces.application.Application#setMessageBundle(java.lang.String)
- */
- public void setMessageBundle(String bundle) {
- parent.setMessageBundle(bundle);
- }
-
- /**
- * @param handler
- * @see javax.faces.application.Application#setNavigationHandler(javax.faces.application.NavigationHandler)
- */
- public void setNavigationHandler(NavigationHandler handler) {
- parent.setNavigationHandler(handler);
- }
-
- /**
- * @param resolver
- * @deprecated
- * @see javax.faces.application.Application#setPropertyResolver(javax.faces.el.PropertyResolver)
- */
- public void setPropertyResolver(PropertyResolver resolver) {
- parent.setPropertyResolver(resolver);
- }
-
- /**
- * @param manager
- * @see javax.faces.application.Application#setStateManager(javax.faces.application.StateManager)
- */
- public void setStateManager(StateManager manager) {
- parent.setStateManager(manager);
- }
-
- /**
- * @param locales
- * @see javax.faces.application.Application#setSupportedLocales(java.util.Collection)
- */
- public void setSupportedLocales(Collection<Locale> locales) {
- parent.setSupportedLocales(locales);
- }
-
- /**
- * @param resolver
- * @deprecated
- * @see javax.faces.application.Application#setVariableResolver(javax.faces.el.VariableResolver)
- */
- public void setVariableResolver(VariableResolver resolver) {
- parent.setVariableResolver(resolver);
- }
-
- /**
- * @param handler
- * @see javax.faces.application.Application#setViewHandler(javax.faces.application.ViewHandler)
- */
- public void setViewHandler(ViewHandler handler) {
- parent.setViewHandler(handler);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.el.ELContextListener;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.NavigationHandler;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.PropertyResolver;
+import javax.faces.el.ReferenceSyntaxException;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.ActionListener;
+import javax.faces.validator.Validator;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateApplication extends Application {
+
+ private final Application parent;
+ private final ExpressionFactory exprFactory;
+
+ /**
+ * @param parent
+ */
+ public StateApplication(Application parentApp) {
+ super();
+ this.parent = parentApp;
+ this.exprFactory = new StateExpressionFactory(){
+ @Override
+ public ExpressionFactory getDefaultFactory() {
+ return parent.getExpressionFactory();
+ }
+ };
+ }
+
+ /**
+ * @param componentType
+ * @param componentClass
+ * @see javax.faces.application.Application#addComponent(java.lang.String, java.lang.String)
+ */
+ public void addComponent(String componentType, String componentClass) {
+ parent.addComponent(componentType, componentClass);
+ }
+
+ /**
+ * @param targetClass
+ * @param converterClass
+ * @see javax.faces.application.Application#addConverter(java.lang.Class, java.lang.String)
+ */
+ public void addConverter(Class targetClass, String converterClass) {
+ parent.addConverter(targetClass, converterClass);
+ }
+
+ /**
+ * @param converterId
+ * @param converterClass
+ * @see javax.faces.application.Application#addConverter(java.lang.String, java.lang.String)
+ */
+ public void addConverter(String converterId, String converterClass) {
+ parent.addConverter(converterId, converterClass);
+ }
+
+ /**
+ * @param listener
+ * @see javax.faces.application.Application#addELContextListener(javax.el.ELContextListener)
+ */
+ public void addELContextListener(ELContextListener listener) {
+ parent.addELContextListener(listener);
+ }
+
+ /**
+ * @param resolver
+ * @see javax.faces.application.Application#addELResolver(javax.el.ELResolver)
+ */
+ public void addELResolver(ELResolver resolver) {
+ parent.addELResolver(resolver);
+ }
+
+ /**
+ * @param validatorId
+ * @param validatorClass
+ * @see javax.faces.application.Application#addValidator(java.lang.String, java.lang.String)
+ */
+ public void addValidator(String validatorId, String validatorClass) {
+ parent.addValidator(validatorId, validatorClass);
+ }
+
+ /**
+ * @param componentType
+ * @return
+ * @throws FacesException
+ * @see javax.faces.application.Application#createComponent(java.lang.String)
+ */
+ public UIComponent createComponent(String componentType)
+ throws FacesException {
+ return parent.createComponent(componentType);
+ }
+
+ /**
+ * @param componentBinding
+ * @param context
+ * @param componentType
+ * @return
+ * @throws FacesException
+ * @deprecated
+ * @see javax.faces.application.Application#createComponent(javax.faces.el.ValueBinding, javax.faces.context.FacesContext, java.lang.String)
+ */
+ public UIComponent createComponent(ValueBinding componentBinding,
+ FacesContext context, String componentType) throws FacesException {
+ return parent.createComponent(componentBinding, context, componentType);
+ }
+
+ /**
+ * @param componentExpression
+ * @param context
+ * @param componentType
+ * @return
+ * @throws FacesException
+ * @see javax.faces.application.Application#createComponent(javax.el.ValueExpression, javax.faces.context.FacesContext, java.lang.String)
+ */
+ public UIComponent createComponent(ValueExpression componentExpression,
+ FacesContext context, String componentType) throws FacesException {
+ return parent.createComponent(componentExpression, context,
+ componentType);
+ }
+
+ /**
+ * @param targetClass
+ * @return
+ * @see javax.faces.application.Application#createConverter(java.lang.Class)
+ */
+ public Converter createConverter(Class targetClass) {
+ return parent.createConverter(targetClass);
+ }
+
+ /**
+ * @param converterId
+ * @return
+ * @see javax.faces.application.Application#createConverter(java.lang.String)
+ */
+ public Converter createConverter(String converterId) {
+ return parent.createConverter(converterId);
+ }
+
+ /**
+ * @param ref
+ * @param params
+ * @return
+ * @throws ReferenceSyntaxException
+ * @deprecated
+ * @see javax.faces.application.Application#createMethodBinding(java.lang.String, java.lang.Class[])
+ */
+ public MethodBinding createMethodBinding(String ref, Class[] params)
+ throws ReferenceSyntaxException {
+ return parent.createMethodBinding(ref, params);
+ }
+
+ /**
+ * @param validatorId
+ * @return
+ * @throws FacesException
+ * @see javax.faces.application.Application#createValidator(java.lang.String)
+ */
+ public Validator createValidator(String validatorId) throws FacesException {
+ return parent.createValidator(validatorId);
+ }
+
+ /**
+ * @param ref
+ * @return
+ * @throws ReferenceSyntaxException
+ * @deprecated
+ * @see javax.faces.application.Application#createValueBinding(java.lang.String)
+ */
+ public ValueBinding createValueBinding(String ref)
+ throws ReferenceSyntaxException {
+ return parent.createValueBinding(ref);
+ }
+
+ /**
+ * @param context
+ * @param expression
+ * @param expectedType
+ * @return
+ * @throws ELException
+ * @see javax.faces.application.Application#evaluateExpressionGet(javax.faces.context.FacesContext, java.lang.String, java.lang.Class)
+ */
+ public Object evaluateExpressionGet(FacesContext context,
+ String expression, Class expectedType) throws ELException {
+ return parent.evaluateExpressionGet(context, expression, expectedType);
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getActionListener()
+ */
+ public ActionListener getActionListener() {
+ return parent.getActionListener();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getComponentTypes()
+ */
+ public Iterator<String> getComponentTypes() {
+ return parent.getComponentTypes();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getConverterIds()
+ */
+ public Iterator<String> getConverterIds() {
+ return parent.getConverterIds();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getConverterTypes()
+ */
+ public Iterator<Class> getConverterTypes() {
+ return parent.getConverterTypes();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getDefaultLocale()
+ */
+ public Locale getDefaultLocale() {
+ return parent.getDefaultLocale();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getDefaultRenderKitId()
+ */
+ public String getDefaultRenderKitId() {
+ return parent.getDefaultRenderKitId();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getELContextListeners()
+ */
+ public ELContextListener[] getELContextListeners() {
+ return parent.getELContextListeners();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getELResolver()
+ */
+ public ELResolver getELResolver() {
+ return parent.getELResolver();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getExpressionFactory()
+ */
+ public ExpressionFactory getExpressionFactory() {
+ return this.exprFactory;
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getMessageBundle()
+ */
+ public String getMessageBundle() {
+ return parent.getMessageBundle();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getNavigationHandler()
+ */
+ public NavigationHandler getNavigationHandler() {
+ return parent.getNavigationHandler();
+ }
+
+ /**
+ * @return
+ * @deprecated
+ * @see javax.faces.application.Application#getPropertyResolver()
+ */
+ public PropertyResolver getPropertyResolver() {
+ return parent.getPropertyResolver();
+ }
+
+ /**
+ * @param ctx
+ * @param name
+ * @return
+ * @see javax.faces.application.Application#getResourceBundle(javax.faces.context.FacesContext, java.lang.String)
+ */
+ public ResourceBundle getResourceBundle(FacesContext ctx, String name) {
+ return parent.getResourceBundle(ctx, name);
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getStateManager()
+ */
+ public StateManager getStateManager() {
+ return parent.getStateManager();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getSupportedLocales()
+ */
+ public Iterator<Locale> getSupportedLocales() {
+ return parent.getSupportedLocales();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getValidatorIds()
+ */
+ public Iterator<String> getValidatorIds() {
+ return parent.getValidatorIds();
+ }
+
+ /**
+ * @return
+ * @deprecated
+ * @see javax.faces.application.Application#getVariableResolver()
+ */
+ public VariableResolver getVariableResolver() {
+ return parent.getVariableResolver();
+ }
+
+ /**
+ * @return
+ * @see javax.faces.application.Application#getViewHandler()
+ */
+ public ViewHandler getViewHandler() {
+ return parent.getViewHandler();
+ }
+
+ /**
+ * @param listener
+ * @see javax.faces.application.Application#removeELContextListener(javax.el.ELContextListener)
+ */
+ public void removeELContextListener(ELContextListener listener) {
+ parent.removeELContextListener(listener);
+ }
+
+ /**
+ * @param listener
+ * @see javax.faces.application.Application#setActionListener(javax.faces.event.ActionListener)
+ */
+ public void setActionListener(ActionListener listener) {
+ parent.setActionListener(listener);
+ }
+
+ /**
+ * @param locale
+ * @see javax.faces.application.Application#setDefaultLocale(java.util.Locale)
+ */
+ public void setDefaultLocale(Locale locale) {
+ parent.setDefaultLocale(locale);
+ }
+
+ /**
+ * @param renderKitId
+ * @see javax.faces.application.Application#setDefaultRenderKitId(java.lang.String)
+ */
+ public void setDefaultRenderKitId(String renderKitId) {
+ parent.setDefaultRenderKitId(renderKitId);
+ }
+
+ /**
+ * @param bundle
+ * @see javax.faces.application.Application#setMessageBundle(java.lang.String)
+ */
+ public void setMessageBundle(String bundle) {
+ parent.setMessageBundle(bundle);
+ }
+
+ /**
+ * @param handler
+ * @see javax.faces.application.Application#setNavigationHandler(javax.faces.application.NavigationHandler)
+ */
+ public void setNavigationHandler(NavigationHandler handler) {
+ parent.setNavigationHandler(handler);
+ }
+
+ /**
+ * @param resolver
+ * @deprecated
+ * @see javax.faces.application.Application#setPropertyResolver(javax.faces.el.PropertyResolver)
+ */
+ public void setPropertyResolver(PropertyResolver resolver) {
+ parent.setPropertyResolver(resolver);
+ }
+
+ /**
+ * @param manager
+ * @see javax.faces.application.Application#setStateManager(javax.faces.application.StateManager)
+ */
+ public void setStateManager(StateManager manager) {
+ parent.setStateManager(manager);
+ }
+
+ /**
+ * @param locales
+ * @see javax.faces.application.Application#setSupportedLocales(java.util.Collection)
+ */
+ public void setSupportedLocales(Collection<Locale> locales) {
+ parent.setSupportedLocales(locales);
+ }
+
+ /**
+ * @param resolver
+ * @deprecated
+ * @see javax.faces.application.Application#setVariableResolver(javax.faces.el.VariableResolver)
+ */
+ public void setVariableResolver(VariableResolver resolver) {
+ parent.setVariableResolver(resolver);
+ }
+
+ /**
+ * @param handler
+ * @see javax.faces.application.Application#setViewHandler(javax.faces.application.ViewHandler)
+ */
+ public void setViewHandler(ViewHandler handler) {
+ parent.setViewHandler(handler);
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplicationFactory.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplicationFactory.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StateApplicationFactory.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,67 +1,67 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import javax.faces.application.Application;
-import javax.faces.application.ApplicationFactory;
-
-/**
- * @author asmirnov
- *
- */
-public class StateApplicationFactory extends ApplicationFactory {
-
- private ApplicationFactory parent;
-
- private Application application;
-
- /**
- * @param parent
- */
- public StateApplicationFactory(ApplicationFactory parent) {
- super();
- this.parent = parent;
- }
-
-
- /* (non-Javadoc)
- * @see javax.faces.application.ApplicationFactory#getApplication()
- */
- @Override
- public Application getApplication() {
- if (application == null) {
- application = new StateApplication(parent.getApplication());
-
- }
-
- return application;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.application.ApplicationFactory#setApplication(javax.faces.application.Application)
- */
- @Override
- public void setApplication(Application application) {
- parent.setApplication(application);
- this.application = new StateApplication(application);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateApplicationFactory extends ApplicationFactory {
+
+ private ApplicationFactory parent;
+
+ private Application application;
+
+ /**
+ * @param parent
+ */
+ public StateApplicationFactory(ApplicationFactory parent) {
+ super();
+ this.parent = parent;
+ }
+
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.ApplicationFactory#getApplication()
+ */
+ @Override
+ public Application getApplication() {
+ if (application == null) {
+ application = new StateApplication(parent.getApplication());
+
+ }
+
+ return application;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.application.ApplicationFactory#setApplication(javax.faces.application.Application)
+ */
+ @Override
+ public void setApplication(Application application) {
+ parent.setApplication(application);
+ this.application = new StateApplication(application);
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StateExpressionFactory.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StateExpressionFactory.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StateExpressionFactory.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,91 +1,91 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-
-/**
- * @author asmirnov
- *
- */
-public abstract class StateExpressionFactory extends ExpressionFactory {
-
-
- /**
- * @param obj
- * @param targetType
- * @return
- * @see javax.el.ExpressionFactory#coerceToType(java.lang.Object, java.lang.Class)
- */
- public Object coerceToType(Object obj, Class<?> targetType) {
- return getDefaultFactory().coerceToType(obj, targetType);
- }
-
- /**
- * @param context
- * @param expression
- * @param expectedReturnType
- * @param expectedParamTypes
- * @return
- * @see javax.el.ExpressionFactory#createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class, java.lang.Class<?>[])
- */
- public MethodExpression createMethodExpression(ELContext context,
- String expression, Class<?> expectedReturnType,
- Class<?>[] expectedParamTypes) {
- MethodExpression methodExpression = getDefaultFactory().createMethodExpression(context, expression,
- expectedReturnType, expectedParamTypes);
- ValueExpression valueExpression = getDefaultFactory().createValueExpression(context, expression, MethodExpression.class);
- return new StateMethodExpressionWrapper(methodExpression,valueExpression);
- }
-
- /**
- * @param context
- * @param expression
- * @param expectedType
- * @return
- * @see javax.el.ExpressionFactory#createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class)
- */
- public ValueExpression createValueExpression(ELContext context,
- String expression, Class<?> expectedType) {
- return getDefaultFactory().createValueExpression(context, expression,
- expectedType);
- }
-
- /**
- * @param instance
- * @param expectedType
- * @return
- * @see javax.el.ExpressionFactory#createValueExpression(java.lang.Object, java.lang.Class)
- */
- public ValueExpression createValueExpression(Object instance,
- Class<?> expectedType) {
- return getDefaultFactory().createValueExpression(instance, expectedType);
- }
-
- /**
- * @return the defaultFactory
- */
- public abstract ExpressionFactory getDefaultFactory() ;
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import javax.el.ELContext;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+
+/**
+ * @author asmirnov
+ *
+ */
+public abstract class StateExpressionFactory extends ExpressionFactory {
+
+
+ /**
+ * @param obj
+ * @param targetType
+ * @return
+ * @see javax.el.ExpressionFactory#coerceToType(java.lang.Object, java.lang.Class)
+ */
+ public Object coerceToType(Object obj, Class<?> targetType) {
+ return getDefaultFactory().coerceToType(obj, targetType);
+ }
+
+ /**
+ * @param context
+ * @param expression
+ * @param expectedReturnType
+ * @param expectedParamTypes
+ * @return
+ * @see javax.el.ExpressionFactory#createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class, java.lang.Class<?>[])
+ */
+ public MethodExpression createMethodExpression(ELContext context,
+ String expression, Class<?> expectedReturnType,
+ Class<?>[] expectedParamTypes) {
+ MethodExpression methodExpression = getDefaultFactory().createMethodExpression(context, expression,
+ expectedReturnType, expectedParamTypes);
+ ValueExpression valueExpression = getDefaultFactory().createValueExpression(context, expression, MethodExpression.class);
+ return new StateMethodExpressionWrapper(methodExpression,valueExpression);
+ }
+
+ /**
+ * @param context
+ * @param expression
+ * @param expectedType
+ * @return
+ * @see javax.el.ExpressionFactory#createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class)
+ */
+ public ValueExpression createValueExpression(ELContext context,
+ String expression, Class<?> expectedType) {
+ return getDefaultFactory().createValueExpression(context, expression,
+ expectedType);
+ }
+
+ /**
+ * @param instance
+ * @param expectedType
+ * @return
+ * @see javax.el.ExpressionFactory#createValueExpression(java.lang.Object, java.lang.Class)
+ */
+ public ValueExpression createValueExpression(Object instance,
+ Class<?> expectedType) {
+ return getDefaultFactory().createValueExpression(instance, expectedType);
+ }
+
+ /**
+ * @return the defaultFactory
+ */
+ public abstract ExpressionFactory getDefaultFactory() ;
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StateMethodExpressionWrapper.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StateMethodExpressionWrapper.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StateMethodExpressionWrapper.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,122 +1,122 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import javax.el.ELContext;
-import javax.el.MethodExpression;
-import javax.el.MethodInfo;
-import javax.el.MethodNotFoundException;
-import javax.el.ValueExpression;
-import javax.faces.context.FacesContext;
-
-/**
- * @author asmirnov
- *
- */
-public class StateMethodExpressionWrapper extends MethodExpression {
-
- private MethodExpression parent;
-
- private ValueExpression baseObjectExpression = null;
-
- /**
- * @param parent
- */
- public StateMethodExpressionWrapper(MethodExpression parent,ValueExpression baseObject) {
- this.parent = parent;
- this.baseObjectExpression = baseObject;
- }
-
- /**
- * @return
- * @see javax.el.Expression#getExpressionString()
- */
- public String getExpressionString() {
- return parent.getExpressionString();
- }
-
- /**
- * @param context
- * @return
- * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext)
- */
- public MethodInfo getMethodInfo(ELContext context) {
- MethodInfo methodInfo = parent.getMethodInfo(context);
- return methodInfo;
- }
-
- /**
- * @param context
- * @param params
- * @return
- * @see javax.el.MethodExpression#invoke(javax.el.ELContext,
- * java.lang.Object[])
- */
- public Object invoke(ELContext context, Object[] params) {
- Object result;
- try {
- result = parent.invoke(context, params);
- } catch (MethodNotFoundException e) {
- Object base = baseObjectExpression.getValue(context);
- if (base instanceof MethodExpression) {
- MethodExpression referencedMethod = (MethodExpression) base;
- result = referencedMethod.invoke(context, params);
- } else {
- throw e;
- }
- }
- return result;
- }
-
- /**
- * @return
- * @see javax.el.Expression#isLiteralText()
- */
- public boolean isLiteralText() {
- return parent.isLiteralText();
- }
-
- /**
- * @param obj
- * @return
- * @see javax.el.Expression#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return parent.equals(obj);
- }
-
- /**
- * @return
- * @see javax.el.Expression#hashCode()
- */
- public int hashCode() {
- return parent.hashCode();
- }
-
- /**
- * @return
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return parent.toString();
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import javax.el.ELContext;
+import javax.el.MethodExpression;
+import javax.el.MethodInfo;
+import javax.el.MethodNotFoundException;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateMethodExpressionWrapper extends MethodExpression {
+
+ private MethodExpression parent;
+
+ private ValueExpression baseObjectExpression = null;
+
+ /**
+ * @param parent
+ */
+ public StateMethodExpressionWrapper(MethodExpression parent,ValueExpression baseObject) {
+ this.parent = parent;
+ this.baseObjectExpression = baseObject;
+ }
+
+ /**
+ * @return
+ * @see javax.el.Expression#getExpressionString()
+ */
+ public String getExpressionString() {
+ return parent.getExpressionString();
+ }
+
+ /**
+ * @param context
+ * @return
+ * @see javax.el.MethodExpression#getMethodInfo(javax.el.ELContext)
+ */
+ public MethodInfo getMethodInfo(ELContext context) {
+ MethodInfo methodInfo = parent.getMethodInfo(context);
+ return methodInfo;
+ }
+
+ /**
+ * @param context
+ * @param params
+ * @return
+ * @see javax.el.MethodExpression#invoke(javax.el.ELContext,
+ * java.lang.Object[])
+ */
+ public Object invoke(ELContext context, Object[] params) {
+ Object result;
+ try {
+ result = parent.invoke(context, params);
+ } catch (MethodNotFoundException e) {
+ Object base = baseObjectExpression.getValue(context);
+ if (base instanceof MethodExpression) {
+ MethodExpression referencedMethod = (MethodExpression) base;
+ result = referencedMethod.invoke(context, params);
+ } else {
+ throw e;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return
+ * @see javax.el.Expression#isLiteralText()
+ */
+ public boolean isLiteralText() {
+ return parent.isLiteralText();
+ }
+
+ /**
+ * @param obj
+ * @return
+ * @see javax.el.Expression#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ return parent.equals(obj);
+ }
+
+ /**
+ * @return
+ * @see javax.el.Expression#hashCode()
+ */
+ public int hashCode() {
+ return parent.hashCode();
+ }
+
+ /**
+ * @return
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return parent.toString();
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StateNavigationHandler.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StateNavigationHandler.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StateNavigationHandler.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,69 +1,69 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import java.util.Map;
-
-import javax.faces.application.NavigationHandler;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.ui.model.States;
-
-/**
- * @author asmirnov
- *
- */
-public class StateNavigationHandler extends NavigationHandler {
-
- private NavigationHandler parent;
-
- /**
- * @param parent
- */
- public StateNavigationHandler(NavigationHandler parent) {
- super();
- this.parent = parent;
- }
-
- /**
- * @param context
- * @param fromAction
- * @param outcome
- * @see javax.faces.application.NavigationHandler#handleNavigation(javax.faces.context.FacesContext, java.lang.String, java.lang.String)
- */
- public void handleNavigation(FacesContext context, String fromAction,
- String outcome) {
- if(null != outcome){
- Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
- for (Object bean : requestMap.values()) {
- if (bean instanceof States) {
- States state = (States) bean;
- String navigation = state.getNavigation(outcome);
- if(null != navigation){
- state.setCurrentState(navigation);
- }
- }
- }
- }
- parent.handleNavigation(context, fromAction, outcome);
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import java.util.Map;
+
+import javax.faces.application.NavigationHandler;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.ui.model.States;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateNavigationHandler extends NavigationHandler {
+
+ private NavigationHandler parent;
+
+ /**
+ * @param parent
+ */
+ public StateNavigationHandler(NavigationHandler parent) {
+ super();
+ this.parent = parent;
+ }
+
+ /**
+ * @param context
+ * @param fromAction
+ * @param outcome
+ * @see javax.faces.application.NavigationHandler#handleNavigation(javax.faces.context.FacesContext, java.lang.String, java.lang.String)
+ */
+ public void handleNavigation(FacesContext context, String fromAction,
+ String outcome) {
+ if(null != outcome){
+ Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
+ for (Object bean : requestMap.values()) {
+ if (bean instanceof States) {
+ States state = (States) bean;
+ String navigation = state.getNavigation(outcome);
+ if(null != navigation){
+ state.setCurrentState(navigation);
+ }
+ }
+ }
+ }
+ parent.handleNavigation(context, fromAction, outcome);
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StatePropertyResolver.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StatePropertyResolver.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StatePropertyResolver.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,113 +1,113 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import javax.faces.el.EvaluationException;
-import javax.faces.el.PropertyNotFoundException;
-import javax.faces.el.PropertyResolver;
-
-/**
- * @author asmirnov
- *
- */
-public class StatePropertyResolver extends PropertyResolver {
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#getType(java.lang.Object, java.lang.Object)
- */
-
- public Class getType(Object arg0, Object arg1) throws EvaluationException,
- PropertyNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#getType(java.lang.Object, int)
- */
-
- public Class getType(Object arg0, int arg1) throws EvaluationException,
- PropertyNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#getValue(java.lang.Object, java.lang.Object)
- */
-
- public Object getValue(Object arg0, Object arg1)
- throws EvaluationException, PropertyNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#getValue(java.lang.Object, int)
- */
-
- public Object getValue(Object arg0, int arg1) throws EvaluationException,
- PropertyNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#isReadOnly(java.lang.Object, java.lang.Object)
- */
-
- public boolean isReadOnly(Object arg0, Object arg1)
- throws EvaluationException, PropertyNotFoundException {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#isReadOnly(java.lang.Object, int)
- */
-
- public boolean isReadOnly(Object arg0, int arg1)
- throws EvaluationException, PropertyNotFoundException {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#setValue(java.lang.Object, java.lang.Object, java.lang.Object)
- */
-
- public void setValue(Object arg0, Object arg1, Object arg2)
- throws EvaluationException, PropertyNotFoundException {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see javax.faces.el.PropertyResolver#setValue(java.lang.Object, int, java.lang.Object)
- */
-
- public void setValue(Object arg0, int arg1, Object arg2)
- throws EvaluationException, PropertyNotFoundException {
- // TODO Auto-generated method stub
-
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.PropertyResolver;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StatePropertyResolver extends PropertyResolver {
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#getType(java.lang.Object, java.lang.Object)
+ */
+
+ public Class getType(Object arg0, Object arg1) throws EvaluationException,
+ PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#getType(java.lang.Object, int)
+ */
+
+ public Class getType(Object arg0, int arg1) throws EvaluationException,
+ PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#getValue(java.lang.Object, java.lang.Object)
+ */
+
+ public Object getValue(Object arg0, Object arg1)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#getValue(java.lang.Object, int)
+ */
+
+ public Object getValue(Object arg0, int arg1) throws EvaluationException,
+ PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#isReadOnly(java.lang.Object, java.lang.Object)
+ */
+
+ public boolean isReadOnly(Object arg0, Object arg1)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#isReadOnly(java.lang.Object, int)
+ */
+
+ public boolean isReadOnly(Object arg0, int arg1)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#setValue(java.lang.Object, java.lang.Object, java.lang.Object)
+ */
+
+ public void setValue(Object arg0, Object arg1, Object arg2)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.PropertyResolver#setValue(java.lang.Object, int, java.lang.Object)
+ */
+
+ public void setValue(Object arg0, int arg1, Object arg2)
+ throws EvaluationException, PropertyNotFoundException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/application/StateResolver.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/application/StateResolver.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/application/StateResolver.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,42 +1,42 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.application;
-
-import javax.faces.context.FacesContext;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.VariableResolver;
-
-/**
- * @author asmirnov
- *
- */
-public class StateResolver extends VariableResolver {
-
- /* (non-Javadoc)
- * @see javax.faces.el.VariableResolver#resolveVariable(javax.faces.context.FacesContext, java.lang.String)
- */
- public Object resolveVariable(FacesContext arg0, String arg1)
- throws EvaluationException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.application;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.VariableResolver;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateResolver extends VariableResolver {
+
+ /* (non-Javadoc)
+ * @see javax.faces.el.VariableResolver#resolveVariable(javax.faces.context.FacesContext, java.lang.String)
+ */
+ public Object resolveVariable(FacesContext arg0, String arg1)
+ throws EvaluationException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/model/State.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/model/State.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/model/State.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,35 +1,35 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.model;
-
-import java.util.Map;
-
-/**
- * @author asmirnov
- *
- */
-public interface State extends Map<String, Object>{
-
- public String getNavigation(String outcome);
-
- public void setNavigation(String outcome, String navigation);
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.model;
+
+import java.util.Map;
+
+/**
+ * @author asmirnov
+ *
+ */
+public interface State extends Map<String, Object>{
+
+ public String getNavigation(String outcome);
+
+ public void setNavigation(String outcome, String navigation);
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/model/StateImpl.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/model/StateImpl.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/model/StateImpl.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,56 +1,56 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author asmirnov
- *
- */
-public class StateImpl extends HashMap<String, Object> implements State {
-
- /**
- *
- */
- private static final long serialVersionUID = 5521648998682443502L;
-
- private Map<String,String>navigations = new HashMap<String, String>();
-
-
-
- /* (non-Javadoc)
- * @see org.richfaces.ui.model.State#getNavigation(java.lang.String)
- */
- public String getNavigation(String outcome) {
- // TODO Auto-generated method stub
- return navigations.get(outcome);
- }
-
-
- public void setNavigation(String outcome, String navigation) {
- navigations.put(outcome, navigation);
-
- }
-
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class StateImpl extends HashMap<String, Object> implements State {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5521648998682443502L;
+
+ private Map<String,String>navigations = new HashMap<String, String>();
+
+
+
+ /* (non-Javadoc)
+ * @see org.richfaces.ui.model.State#getNavigation(java.lang.String)
+ */
+ public String getNavigation(String outcome) {
+ // TODO Auto-generated method stub
+ return navigations.get(outcome);
+ }
+
+
+ public void setNavigation(String outcome, String navigation) {
+ navigations.put(outcome, navigation);
+
+ }
+
+
+}
Modified: trunk/ui/state/src/main/java/org/richfaces/ui/model/States.java
===================================================================
--- trunk/ui/state/src/main/java/org/richfaces/ui/model/States.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/java/org/richfaces/ui/model/States.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,155 +1,155 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.ui.model;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.ajax4jsf.model.KeepAlive;
-
-/**
- * @author asmirnov
- *
- */
-@KeepAlive
-public class States implements State, Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 8593398262385876975L;
-
- private static final String DEFAULT_STATE = "DEFAULT";
-
- private final Map<String, State> states;
-
- private State currentState;
-
- private String currentStateName;
-
- public States() {
- states = new HashMap<String, State>();
- }
-
- /**
- * HACK - bean property setter for a initialisation from faces-config.xml.
- * @param stateConfig
- */
- public void setConfig(String stateConfig){
- // TODO - parse configuration.
- }
-
- /**
- * Copy all states from an initial state configuration. Use to init state bean from faces-config.xml
- * @param initial
- */
- public void setStates(States initial){
- this.states.clear();
- this.states.putAll(initial.states);
- this.currentState = initial.currentState;
- this.currentStateName = initial.currentStateName;
- }
-
- public void setCurrentState(String name) {
- State state = states.get(name);
- if (null == state) {
- state = new StateImpl();
- states.put(name, state);
- }
- currentStateName = name;
- currentState = state;
- }
-
- public String getCurrentState(){
- return currentStateName;
- }
-
- public void setState(String name, State state) {
- states.put(name, state);
- currentStateName = name;
- currentState = state;
- }
-
- public void clear() {
- currentState.clear();
- }
-
- public boolean containsKey(Object key) {
- return currentState.containsKey(key);
- }
-
- public boolean containsValue(Object value) {
- return currentState.containsValue(value);
- }
-
- public Set<Entry<String, Object>> entrySet() {
- return currentState.entrySet();
- }
-
- public Object get(Object key) {
- return currentState.get(key);
- }
-
- public String getNavigation(String outcome) {
- return currentState.getNavigation(outcome);
- }
-
- /**
- * @param outcome
- * @param navigation
- * @see org.richfaces.ui.model.State#setNavigation(java.lang.String, java.lang.String)
- */
- public void setNavigation(String outcome, String navigation) {
- currentState.setNavigation(outcome, navigation);
- }
-
- public boolean isEmpty() {
- return currentState.isEmpty();
- }
-
- public Set<String> keySet() {
- return currentState.keySet();
- }
-
- public Object put(String key, Object value) {
- return currentState.put(key, value);
- }
-
- public void putAll(Map<? extends String, ? extends Object> t) {
- currentState.putAll(t);
- }
-
- public Object remove(Object key) {
- return currentState.remove(key);
- }
-
- public int size() {
- return currentState.size();
- }
-
- public Collection<Object> values() {
- return currentState.values();
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.ui.model;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.ajax4jsf.model.KeepAlive;
+
+/**
+ * @author asmirnov
+ *
+ */
+@KeepAlive
+public class States implements State, Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8593398262385876975L;
+
+ private static final String DEFAULT_STATE = "DEFAULT";
+
+ private final Map<String, State> states;
+
+ private State currentState;
+
+ private String currentStateName;
+
+ public States() {
+ states = new HashMap<String, State>();
+ }
+
+ /**
+ * HACK - bean property setter for a initialisation from faces-config.xml.
+ * @param stateConfig
+ */
+ public void setConfig(String stateConfig){
+ // TODO - parse configuration.
+ }
+
+ /**
+ * Copy all states from an initial state configuration. Use to init state bean from faces-config.xml
+ * @param initial
+ */
+ public void setStates(States initial){
+ this.states.clear();
+ this.states.putAll(initial.states);
+ this.currentState = initial.currentState;
+ this.currentStateName = initial.currentStateName;
+ }
+
+ public void setCurrentState(String name) {
+ State state = states.get(name);
+ if (null == state) {
+ state = new StateImpl();
+ states.put(name, state);
+ }
+ currentStateName = name;
+ currentState = state;
+ }
+
+ public String getCurrentState(){
+ return currentStateName;
+ }
+
+ public void setState(String name, State state) {
+ states.put(name, state);
+ currentStateName = name;
+ currentState = state;
+ }
+
+ public void clear() {
+ currentState.clear();
+ }
+
+ public boolean containsKey(Object key) {
+ return currentState.containsKey(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return currentState.containsValue(value);
+ }
+
+ public Set<Entry<String, Object>> entrySet() {
+ return currentState.entrySet();
+ }
+
+ public Object get(Object key) {
+ return currentState.get(key);
+ }
+
+ public String getNavigation(String outcome) {
+ return currentState.getNavigation(outcome);
+ }
+
+ /**
+ * @param outcome
+ * @param navigation
+ * @see org.richfaces.ui.model.State#setNavigation(java.lang.String, java.lang.String)
+ */
+ public void setNavigation(String outcome, String navigation) {
+ currentState.setNavigation(outcome, navigation);
+ }
+
+ public boolean isEmpty() {
+ return currentState.isEmpty();
+ }
+
+ public Set<String> keySet() {
+ return currentState.keySet();
+ }
+
+ public Object put(String key, Object value) {
+ return currentState.put(key, value);
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> t) {
+ currentState.putAll(t);
+ }
+
+ public Object remove(Object key) {
+ return currentState.remove(key);
+ }
+
+ public int size() {
+ return currentState.size();
+ }
+
+ public Collection<Object> values() {
+ return currentState.values();
+ }
+
+}
Modified: trunk/ui/state/src/main/templates/org/richfaces/ui/htmlState.jspx
===================================================================
--- trunk/ui/state/src/main/templates/org/richfaces/ui/htmlState.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/templates/org/richfaces/ui/htmlState.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -14,4 +14,4 @@
x:passThruWithExclusions="value,name,type,id"
>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/state/src/main/templates/org/richfaces/ui/htmlStates.jspx
===================================================================
--- trunk/ui/state/src/main/templates/org/richfaces/ui/htmlStates.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/state/src/main/templates/org/richfaces/ui/htmlStates.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -14,4 +14,4 @@
x:passThruWithExclusions="value,name,type,id"
>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java
===================================================================
--- trunk/ui/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/suggestionbox/src/main/java/org/richfaces/taglib/SuggestionBoxTagHandler.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,143 +1,143 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * 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.taglib;
-
-import org.richfaces.component.UISuggestionBox;
-
-import com.sun.facelets.FaceletContext;
-import com.sun.facelets.tag.MetaRule;
-import com.sun.facelets.tag.MetaRuleset;
-import com.sun.facelets.tag.Metadata;
-import com.sun.facelets.tag.MetadataTarget;
-import com.sun.facelets.tag.TagAttribute;
-import com.sun.facelets.tag.jsf.ComponentConfig;
-
-/**
- * Component tag handler for Facelets.
- *
- * @author shura (latest modification by $Author: ishabalov $)
- * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
- */
-public class SuggestionBoxTagHandler
- extends com.sun.facelets.tag.jsf.ComponentHandler {
-
- /**
- * Meta rule for tag handler.
- */
- private static final SuggestionBoxTagHandlerMetaRule metaRule =
- new SuggestionBoxTagHandlerMetaRule();
-
- /**
- * Constructor.
- *
- * @param config {@link com.sun.facelets.tag.jsf.ComponentConfig}
- */
- public SuggestionBoxTagHandler(final ComponentConfig config) {
- super(config);
- }
-
- /**
- * Creates metarules.
- *
- * @param type Class
- * @return {@link com.sun.facelets.tag.MetaRuleset}
- */
- protected final MetaRuleset createMetaRuleset(final Class type) {
- MetaRuleset m = super.createMetaRuleset(type);
- m.addRule(metaRule);
- return m;
- }
-
- /**
- * Meta rule implementation.
- *
- * @author shura (latest modification by $Author: ishabalov $)
- * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
- */
- static class SuggestionBoxTagHandlerMetaRule extends MetaRule {
-
- /**
- * Apply rule.
- *
- * @param name rule name
- * @param attribute {@link com.sun.facelets.tag.TagAttribute}
- * @param meta {@link com.sun.facelets.tag.TagAttribute}
- * @return metadata {@link com.sun.facelets.tag.Metadata}
- *
- * @see {@link com.sun.facelets.tag.MetaRule#applyRule(String,
- * com.sun.facelets.tag.TagAttribute,
- * com.sun.facelets.tag.MetadataTarget)}
- */
- public Metadata applyRule(final String name,
- final TagAttribute attribute,
- final MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UISuggestionBox.class)) {
- if ("suggestionAction".equals(name)) {
- return new SuggestionActionMapper(attribute);
- }
-
- }
- return null;
- }
- }
-
- /**
- * Meta data implementation.
- */
- static class SuggestionActionMapper extends Metadata {
- /**
- * Signature.
- */
- private static final Class[] SIGNATURE =
- new Class[]{java.lang.Object.class};
-
- /**
- * Action attribute.
- */
- private final TagAttribute action;
-
- /**
- * Sets attribute.
- *
- * @param attribute {@link com.sun.facelets.tag.TagAttribute}
- */
- public SuggestionActionMapper(final TagAttribute attribute) {
- action = attribute;
- }
-
- /**
- * Apply metadata.
-
- * @param context {@link javax.faces.context.FacesContext}
- * @param instance {@link java.lang.Object}
- *
- * @see {@link com.sun.facelets.tag.Metadata#applyMetadata(
- * com.sun.facelets.FaceletContext, Object)}
- */
- public void applyMetadata(final FaceletContext context,
- final Object instance) {
- ((UISuggestionBox) instance)
- .setSuggestionAction(this.action
- .getMethodExpression(context, null, SIGNATURE));
- }
- }
-}
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.taglib;
+
+import org.richfaces.component.UISuggestionBox;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRule;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.Metadata;
+import com.sun.facelets.tag.MetadataTarget;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+
+/**
+ * Component tag handler for Facelets.
+ *
+ * @author shura (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
+ */
+public class SuggestionBoxTagHandler
+ extends com.sun.facelets.tag.jsf.ComponentHandler {
+
+ /**
+ * Meta rule for tag handler.
+ */
+ private static final SuggestionBoxTagHandlerMetaRule metaRule =
+ new SuggestionBoxTagHandlerMetaRule();
+
+ /**
+ * Constructor.
+ *
+ * @param config {@link com.sun.facelets.tag.jsf.ComponentConfig}
+ */
+ public SuggestionBoxTagHandler(final ComponentConfig config) {
+ super(config);
+ }
+
+ /**
+ * Creates metarules.
+ *
+ * @param type Class
+ * @return {@link com.sun.facelets.tag.MetaRuleset}
+ */
+ protected final MetaRuleset createMetaRuleset(final Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(metaRule);
+ return m;
+ }
+
+ /**
+ * Meta rule implementation.
+ *
+ * @author shura (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:03 $
+ */
+ static class SuggestionBoxTagHandlerMetaRule extends MetaRule {
+
+ /**
+ * Apply rule.
+ *
+ * @param name rule name
+ * @param attribute {@link com.sun.facelets.tag.TagAttribute}
+ * @param meta {@link com.sun.facelets.tag.TagAttribute}
+ * @return metadata {@link com.sun.facelets.tag.Metadata}
+ *
+ * @see {@link com.sun.facelets.tag.MetaRule#applyRule(String,
+ * com.sun.facelets.tag.TagAttribute,
+ * com.sun.facelets.tag.MetadataTarget)}
+ */
+ public Metadata applyRule(final String name,
+ final TagAttribute attribute,
+ final MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(UISuggestionBox.class)) {
+ if ("suggestionAction".equals(name)) {
+ return new SuggestionActionMapper(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Meta data implementation.
+ */
+ static class SuggestionActionMapper extends Metadata {
+ /**
+ * Signature.
+ */
+ private static final Class[] SIGNATURE =
+ new Class[]{java.lang.Object.class};
+
+ /**
+ * Action attribute.
+ */
+ private final TagAttribute action;
+
+ /**
+ * Sets attribute.
+ *
+ * @param attribute {@link com.sun.facelets.tag.TagAttribute}
+ */
+ public SuggestionActionMapper(final TagAttribute attribute) {
+ action = attribute;
+ }
+
+ /**
+ * Apply metadata.
+
+ * @param context {@link javax.faces.context.FacesContext}
+ * @param instance {@link java.lang.Object}
+ *
+ * @see {@link com.sun.facelets.tag.Metadata#applyMetadata(
+ * com.sun.facelets.FaceletContext, Object)}
+ */
+ public void applyMetadata(final FaceletContext context,
+ final Object instance) {
+ ((UISuggestionBox) instance)
+ .setSuggestionAction(this.action
+ .getMethodExpression(context, null, SIGNATURE));
+ }
+ }
+}
Modified: trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/templates/table.jspx
===================================================================
--- trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/templates/table.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/templates/table.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -49,9 +49,9 @@
</f:if>
<tbody>
<u:insertChildren context="rows">
- <tr>
- <f:attribute name="class">
- <f:call name="getEntryClass"/>
+ <tr>
+ <f:attribute name="class">
+ <f:call name="getEntryClass"/>
</f:attribute>
<f:if property="fetchValue">
<td style="display: none;"><f:attribute name="class"
@@ -65,10 +65,10 @@
<u:insertChild/></td>
</u:insertChildren>
</tr>
- </u:insertChildren>
-
- <f:call name="insertNothingLabel" />
+ </u:insertChildren>
+ <f:call name="insertNothingLabel" />
+
</tbody>
</table>
</f:template>
Modified: trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabClassBuilder.java
===================================================================
--- trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabClassBuilder.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tabPanel/src/main/java/org/richfaces/renderkit/TabClassBuilder.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -177,4 +177,4 @@
protected String getSpecificTabClassFromPane(UITab tab, UITabPanel pane) {
return "";
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/tabPanel/src/main/templates/tab.jspx
===================================================================
--- trunk/ui/tabPanel/src/main/templates/tab.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tabPanel/src/main/templates/tab.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -27,4 +27,4 @@
</tr>
</table>
</td>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/tabPanel/src/main/templates/tabHeader.jspx
===================================================================
--- trunk/ui/tabPanel/src/main/templates/tabHeader.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tabPanel/src/main/templates/tabHeader.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -20,7 +20,7 @@
<f:call name="encodeTabLabel" />
<tr>
- <td class="dr-tbpnl-tbbrdr rich-tabhdr-side-border"><img src="#{spacer}" width="1" height="1" alt=" " style="border:0" /></td>
+ <td class="dr-tbpnl-tbbrdr rich-tabhdr-side-border"><img src="#{spacer}" width="1" height="1" alt="" style="border:0" /></td>
<td class="dr-tbpnl-tbtopbrdr rich-tabhdr-side-cell" style="#{this:encodeTabLabelWidth(context, component)}">
<table style="height: 100%; width: 100%;" border="0" cellpadding="0" cellspacing="0" >
<tr>
@@ -40,12 +40,12 @@
</tr>
</table>
</td>
- <td class="dr-tbpnl-tbbrdr rich-tabhdr-side-border"><img src="#{spacer}" width="1" height="1" alt=" " style="border:0" /></td>
+ <td class="dr-tbpnl-tbbrdr rich-tabhdr-side-border"><img src="#{spacer}" width="1" height="1" alt="" style="border:0" /></td>
</tr>
</table>
</td>
- <td><img src="#{spacer}" height="1" alt=" " style="#{this:encodeHeaderSpacing(context, component)};border:0"/></td>
+ <td><img src="#{spacer}" height="1" alt="" style="#{this:encodeHeaderSpacing(context, component)};border:0"/></td>
</f:root>
Modified: trunk/ui/tabPanel/src/main/templates/tabPanel.jspx
===================================================================
--- trunk/ui/tabPanel/src/main/templates/tabPanel.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tabPanel/src/main/templates/tabPanel.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<f:root xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
- xmlns:ui=" http://ajax4jsf.org/cdk/ui"
- xmlns:u=" http://ajax4jsf.org/cdk/u"
- xmlns:x=" http://ajax4jsf.org/cdk/x"
- xmlns:h="http://jsf.exadel.com/header"
- xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
- baseclass="org.richfaces.renderkit.TabPanelRendererBase"
- class="org.richfaces.renderkit.html.TabPanelRenderer"
- component="org.richfaces.component.UITabPanel">
-
- <h:styles>css/tabPanel.xcss</h:styles>
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ xmlns:h="http://jsf.exadel.com/header"
+ xmlns:vcp="http://ajax4jsf.org/cdk/vcp"
+ baseclass="org.richfaces.renderkit.TabPanelRendererBase"
+ class="org.richfaces.renderkit.html.TabPanelRenderer"
+ component="org.richfaces.component.UITabPanel">
+
+ <h:styles>css/tabPanel.xcss</h:styles>
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
@@ -18,32 +18,32 @@
/org/richfaces/renderkit/html/scripts/browser_info.js,
/org/ajax4jsf/javascript/scripts/form.js,
scripts/tabPanel.js
- </h:scripts>
-
- <f:clientid var="clientId" />
-
- <f:resource name="images/spacer.gif" var="spacer" />
+ </h:scripts>
+
+ <f:clientid var="clientId" />
+
+ <f:resource name="images/spacer.gif" var="spacer" />
<f:call name="encodeTabPanelScript"/>
- <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}"
- class="rich-tabpanel #{component.attributes['styleClass']}"
- style="#{this:encodeStyles(context, component)}">
- <f:call name="utils.encodePassThruWithExclusions">
- <f:parameter value="width,height,styleClass,class,style,id" />
- </f:call>
-
- <tbody>
- <tr>
+ <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}"
+ class="rich-tabpanel #{component.attributes['styleClass']}"
+ style="#{this:encodeStyles(context, component)}">
+ <f:call name="utils.encodePassThruWithExclusions">
+ <f:parameter value="width,height,styleClass,class,style,id" />
+ </f:call>
+
+ <tbody>
+ <tr>
<td align="#{component.attributes['headerAlignment']}" class="dr-bottom-line rich-tab-bottom-line #{component.attributes['headerClass']}">
- <f:call name="utils.encodeBeginFormIfNessesary" />
+ <f:call name="utils.encodeBeginFormIfNessesary" />
<!--table border="0" cellpadding="0" cellspacing="0" style="position:relative;top:1px"-->
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
- <img src="#{spacer}" height="1" alt=" "
+ <img src="#{spacer}" height="1" alt=""
style="#{this:encodeHeaderSpacing(context, component)};border:0" />
</td>
@@ -53,26 +53,26 @@
</table>
-
+
<div style="display: none;">
<c:if test="#{clientSide}">
- <input type="hidden"
+ <input type="hidden"
id="#{clientId}_input"
- name="#{clientId}"
+ name="#{clientId}"
value="#{this:getValueAsString(context, component)}" />
</c:if>
<f:call name="encodeTabsScript" />
- </div>
+ </div>
<f:call name="utils.encodeEndFormIfNessesary" />
- </td>
+ </td>
</tr>
- <tr>
- <vcp:body>
- <f:call name="renderChildren" />
- </vcp:body>
- </tr>
- </tbody>
- </table>
-</f:root>
-
-
+ <tr>
+ <vcp:body>
+ <f:call name="renderChildren" />
+ </vcp:body>
+ </tr>
+ </tbody>
+ </table>
+</f:root>
+
+
Modified: trunk/ui/togglePanel/src/main/java/org/richfaces/component/UIToggleControl.java
===================================================================
--- trunk/ui/togglePanel/src/main/java/org/richfaces/component/UIToggleControl.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/togglePanel/src/main/java/org/richfaces/component/UIToggleControl.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -264,4 +264,4 @@
}
*/
}
-
\ No newline at end of file
+
Modified: trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
--- trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -163,4 +163,4 @@
return component != null ? component.getClientId(context) : null;
}
*/
-}
\ No newline at end of file
+}
Modified: trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/togglePanel/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -173,4 +173,4 @@
// panel.setValue(value);
// }
// }
-}
\ No newline at end of file
+}
Modified: trunk/ui/togglePanel/src/main/templates/toggleControl.jspx
===================================================================
--- trunk/ui/togglePanel/src/main/templates/toggleControl.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/togglePanel/src/main/templates/toggleControl.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -26,4 +26,4 @@
<f:call name="renderChildren" />
</vcp:body>
</a>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/togglePanel/src/main/templates/togglePanel.jspx
===================================================================
--- trunk/ui/togglePanel/src/main/templates/togglePanel.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/togglePanel/src/main/templates/togglePanel.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -22,4 +22,4 @@
<vcp:body/>
<f:call name="handleFacets"/>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java
===================================================================
--- trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/toolBar/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -74,4 +74,4 @@
area.subtract(new Area(inSquare));
g2d.fill(area);
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/tooltip/src/main/java/org/richfaces/taglib/ToolTipTagHandlerBase.java
===================================================================
--- trunk/ui/tooltip/src/main/java/org/richfaces/taglib/ToolTipTagHandlerBase.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tooltip/src/main/java/org/richfaces/taglib/ToolTipTagHandlerBase.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -53,4 +53,4 @@
}
return ruleset;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
===================================================================
--- trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -12,10 +12,10 @@
component="org.richfaces.component.UIToolTip" >
<f:clientid var="clientId"/>
- <span id="#{clientId}" style="z-index:#{component.attributes['zorder']}; #{component.attributes['style']}"
+ <span id="#{clientId}" style="z-index:#{component.attributes['zorder']}; #{component.attributes['style']}"
class="dr-rich-tool-tip rich-tool-tip #{component.attributes['styleClass']}">
- <f:call name="utils.encodePassThruWithExclusions">
- <f:parameter value="id,style,class,disabled" />
+ <f:call name="utils.encodePassThruWithExclusions">
+ <f:parameter value="id,style,class,disabled" />
</f:call>
<jsp:scriptlet>
<![CDATA[if("ajax".equals(component.getMode()) && component.getFacet("defaultContent")!=null) {]]>
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1352,4 +1352,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -24,7 +24,7 @@
/org/richfaces/renderkit/html/scripts/tree-selection.js,
/org/richfaces/renderkit/html/scripts/tree-item.js,
/org/richfaces/renderkit/html/scripts/tree-item-dnd.js,
- /org/richfaces/renderkit/html/scripts/drag-indicator.js,
+ /org/richfaces/renderkit/html/scripts/drag-indicator.js,
/org/richfaces/renderkit/html/scripts/browser_info.js
</h:scripts>
Modified: trunk/ui/tree/src/main/templates/htmlTreeNode.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTreeNode.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tree/src/main/templates/htmlTreeNode.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -35,10 +35,10 @@
<tbody>
<tr id="#{clientId}:mainRow" onclick="#{component.attributes['onclick']} #{this:getToggleScript(context, component, 'mainRow')}" >
- <f:call name="encodeAttributeParameters" />
-
- <f:call name="utils.encodePassThruWithExclusions">
- <f:parameter value="id,onclick"/>
+ <f:call name="encodeAttributeParameters" />
+
+ <f:call name="utils.encodePassThruWithExclusions">
+ <f:parameter value="id,onclick"/>
</f:call>
<td class="dr-tree-h-ic rich-tree-node-handleicon #{line}" id="#{clientId}:handles">
<jsp:scriptlet>
@@ -55,12 +55,12 @@
<div>
<jsp:scriptlet>
- <![CDATA[
+ <![CDATA[
boolean leaf = component.getUITree().isLeaf();
if (leaf) {
]]>
</jsp:scriptlet>
- <img id="#{clientId}:handle:img" src="#{spacer}" alt=" " class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
+ <img id="#{clientId}:handle:img" src="#{spacer}" alt="" class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
<jsp:scriptlet>
<![CDATA[
} else {
@@ -93,7 +93,7 @@
<img id="#{clientId}:handle:img:collapsed"
src="#{collapsed}" class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img rich-tree-node-handleicon-collapsed"
- style="#{this:getHandleCollapsedDisplayStyle(context, component)};border:0" alt=" " />
+ style="#{this:getHandleCollapsedDisplayStyle(context, component)};border:0" alt="" />
<jsp:scriptlet>
<![CDATA[
@@ -125,7 +125,7 @@
</jsp:scriptlet>
<img id="#{clientId}:handle:img:expanded" src="#{expanded}"
style="#{this:getHandleExpandedDisplayStyle(context, component)};border:0"
- class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img rich-tree-node-handleicon-expanded" alt=" " />
+ class="dr-tree-pointer-cursor dr-tree-h-ic-img-md dr-tree-h-ic-img rich-tree-node-handleicon-expanded" alt="" />
<jsp:scriptlet>
<![CDATA[
}
@@ -196,7 +196,7 @@
} else {
]]>
</jsp:scriptlet>
- <img src="#{leaf}" alt=" " class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
+ <img src="#{leaf}" alt="" class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
<jsp:scriptlet>
<![CDATA[
}
@@ -221,7 +221,7 @@
} else {
]]>
</jsp:scriptlet>
- <img src="#{folder}" alt=" " class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
+ <img src="#{folder}" alt="" class="dr-tree-h-ic-img-md dr-tree-h-ic-img" />
<jsp:scriptlet>
<![CDATA[
}
@@ -238,4 +238,4 @@
</tbody>
</table>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/ui/tree/src/test/java/org/richfaces/component/TreeNodeTest.java
===================================================================
--- trunk/ui/tree/src/test/java/org/richfaces/component/TreeNodeTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tree/src/test/java/org/richfaces/component/TreeNodeTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -1,107 +1,107 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - 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 java.util.Iterator;
-
-import org.richfaces.model.TreeNode;
-import org.richfaces.model.TreeNodeImpl;
-
-import junit.framework.TestCase;
-
-/**
- * @author hans
- *
- */
-public class TreeNodeTest extends TestCase {
-
- private final static Object NODE_ID = new Integer(0);
-
- protected TreeNode node = null;
- protected static final int TEST_CHILDREN_COUNT = 7;
-
- /**
- * @param arg0
- */
- public TreeNodeTest(String arg0) {
- super(arg0);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- node = new TreeNodeImpl();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- node = null;
- }
-
- public void testChildrenNew() {
- assertFalse(node.getChildren().hasNext());
- }
-
- public void testChildrenCount() {
- for (int i = 0; i < TEST_CHILDREN_COUNT; i++)
- node.addChild(new Integer(i), new TreeNodeImpl());
- Iterator it = node.getChildren();
- int count = 0;
- for (; it.hasNext(); it.next())
- count++;
- assertEquals(count, TEST_CHILDREN_COUNT);
- }
-
- public void testIsLeafNew() {
- assertTrue(node.isLeaf());
- }
-
- public void testIsLeaf() {
- node.addChild(NODE_ID, new TreeNodeImpl());
- assertFalse(node.isLeaf());
- }
-
- public void testParent() {
- TreeNode child = new TreeNodeImpl();
- node.addChild(NODE_ID, child);
- assertEquals(child.getParent(), node);
- }
-
- public void testGetChild() {
- TreeNode firstNode = new TreeNodeImpl();
- firstNode.setData("First Node");
- TreeNode secondNode = new TreeNodeImpl();
- secondNode.setData("Second Node");
- node.addChild(NODE_ID, firstNode);
- node.addChild("second", secondNode);
- node.addChild("third", new TreeNodeImpl());
- assertTrue(node.getChild("second").getData().equals("Second Node"));
- }
-
- public void testRemove() {
- assertTrue(node.isLeaf());
- node.addChild(NODE_ID, new TreeNodeImpl());
- assertFalse(node.isLeaf());
- node.removeChild(NODE_ID);
- assertTrue(node.isLeaf());
- }
-
-}
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - 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 java.util.Iterator;
+
+import org.richfaces.model.TreeNode;
+import org.richfaces.model.TreeNodeImpl;
+
+import junit.framework.TestCase;
+
+/**
+ * @author hans
+ *
+ */
+public class TreeNodeTest extends TestCase {
+
+ private final static Object NODE_ID = new Integer(0);
+
+ protected TreeNode node = null;
+ protected static final int TEST_CHILDREN_COUNT = 7;
+
+ /**
+ * @param arg0
+ */
+ public TreeNodeTest(String arg0) {
+ super(arg0);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ node = new TreeNodeImpl();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ node = null;
+ }
+
+ public void testChildrenNew() {
+ assertFalse(node.getChildren().hasNext());
+ }
+
+ public void testChildrenCount() {
+ for (int i = 0; i < TEST_CHILDREN_COUNT; i++)
+ node.addChild(new Integer(i), new TreeNodeImpl());
+ Iterator it = node.getChildren();
+ int count = 0;
+ for (; it.hasNext(); it.next())
+ count++;
+ assertEquals(count, TEST_CHILDREN_COUNT);
+ }
+
+ public void testIsLeafNew() {
+ assertTrue(node.isLeaf());
+ }
+
+ public void testIsLeaf() {
+ node.addChild(NODE_ID, new TreeNodeImpl());
+ assertFalse(node.isLeaf());
+ }
+
+ public void testParent() {
+ TreeNode child = new TreeNodeImpl();
+ node.addChild(NODE_ID, child);
+ assertEquals(child.getParent(), node);
+ }
+
+ public void testGetChild() {
+ TreeNode firstNode = new TreeNodeImpl();
+ firstNode.setData("First Node");
+ TreeNode secondNode = new TreeNodeImpl();
+ secondNode.setData("Second Node");
+ node.addChild(NODE_ID, firstNode);
+ node.addChild("second", secondNode);
+ node.addChild("third", new TreeNodeImpl());
+ assertTrue(node.getChild("second").getData().equals("Second Node"));
+ }
+
+ public void testRemove() {
+ assertTrue(node.isLeaf());
+ node.addChild(NODE_ID, new TreeNodeImpl());
+ assertFalse(node.isLeaf());
+ node.removeChild(NODE_ID);
+ assertTrue(node.isLeaf());
+ }
+
+}
Modified: trunk/ui/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java
===================================================================
--- trunk/ui/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/tree/src/test/java/org/richfaces/component/events/TreeEventsListenersTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -116,4 +116,4 @@
public FacesEvent getEvent() {
return event;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/treeModel/src/test/java/org/richfaces/component/TreeModelComponentTest.java
===================================================================
--- trunk/ui/treeModel/src/test/java/org/richfaces/component/TreeModelComponentTest.java 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/treeModel/src/test/java/org/richfaces/component/TreeModelComponentTest.java 2008-12-23 18:34:51 UTC (rev 12000)
@@ -258,4 +258,4 @@
return null;
}
-}
\ No newline at end of file
+}
Modified: trunk/ui/virtualEarth/src/main/templates/virtualEarth.jspx
===================================================================
--- trunk/ui/virtualEarth/src/main/templates/virtualEarth.jspx 2008-12-23 18:14:24 UTC (rev 11999)
+++ trunk/ui/virtualEarth/src/main/templates/virtualEarth.jspx 2008-12-23 18:34:51 UTC (rev 12000)
@@ -37,4 +37,4 @@
//]]>
</script>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
16 years
JBoss Rich Faces SVN: r11999 - trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-12-23 13:14:24 -0500 (Tue, 23 Dec 2008)
New Revision: 11999
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
https://jira.jboss.org/jira/browse/RF-5104
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-12-23 17:22:53 UTC (rev 11998)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-12-23 18:14:24 UTC (rev 11999)
@@ -492,7 +492,7 @@
public boolean shouldRenderAttribute(String attributeName, Object attributeVal) {
if (!requiredAttributes.contains(attributeName)) {
- shouldRenderAttribute(attributeVal);
+ return shouldRenderAttribute(attributeVal);
} else {
if (null == attributeVal) {
return false;
16 years
JBoss Rich Faces SVN: r11998 - trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-12-23 12:22:53 -0500 (Tue, 23 Dec 2008)
New Revision: 11998
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
Log:
https://jira.jboss.org/jira/browse/RF-5104
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-12-23 16:54:44 UTC (rev 11997)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/renderkit/RendererUtils.java 2008-12-23 17:22:53 UTC (rev 11998)
@@ -25,8 +25,10 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.application.ViewHandler;
@@ -66,9 +68,12 @@
* Substitutions for components properies names and HTML attributes names.
*/
private static Map<String, String> substitutions = new HashMap<String, String>();
+
+ private static Set<String> requiredAttributes = new HashSet<String>();
static {
substitutions.put(HTML.class_ATTRIBUTE, "styleClass");
+ requiredAttributes.add(HTML.alt_ATTRIBUTE);
Arrays.sort(HTML.PASS_THRU);
Arrays.sort(HTML.PASS_THRU_BOOLEAN);
Arrays.sort(HTML.PASS_THRU_URI);
@@ -387,7 +392,7 @@
ResponseWriter writer, String attribute) throws IOException {
Object value = attributeValue(attribute, attributes
.get(getComponentAttributeName(attribute)));
- if (null != value && shouldRenderAttribute(value)) {
+ if (null != value && shouldRenderAttribute(attribute, value)) {
if (Arrays.binarySearch(HTML.PASS_THRU_URI, attribute) >= 0) {
String url = context.getApplication().getViewHandler()
.getResourceURL(context, value.toString());
@@ -439,7 +444,7 @@
Object property, String attributeName) throws IOException {
ResponseWriter writer = context.getResponseWriter();
Object value = component.getAttributes().get(property);
- if (shouldRenderAttribute(value)) {
+ if (shouldRenderAttribute(attributeName, value)) {
writer.writeAttribute(attributeName, value, property.toString());
}
@@ -461,7 +466,7 @@
*/
public void writeAttribute(ResponseWriter writer, String attribute,
Object value) throws IOException {
- if (shouldRenderAttribute(value)) {
+ if (shouldRenderAttribute(attribute, value)) {
writer.writeAttribute(attribute, value.toString(), attribute);
}
}
@@ -484,6 +489,17 @@
} else
return isValidProperty(attributeVal);
}
+
+ public boolean shouldRenderAttribute(String attributeName, Object attributeVal) {
+ if (!requiredAttributes.contains(attributeName)) {
+ shouldRenderAttribute(attributeVal);
+ } else {
+ if (null == attributeVal) {
+ return false;
+ }
+ }
+ return true;
+ }
/**
* Test for valid value of property. by default, for non-setted properties
16 years
JBoss Rich Faces SVN: r11997 - in trunk/docs: migrationguide/en/src/main/docbook and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-12-23 11:54:44 -0500 (Tue, 23 Dec 2008)
New Revision: 11997
Added:
trunk/docs/migrationguide/en/src/main/docbook/included/dataTableAjax.xml
Modified:
trunk/docs/common-resources/en/src/main/css/html-common.css
trunk/docs/migrationguide/en/src/main/docbook/master.xml
Log:
RF-3048 - Migration issues were added
Modified: trunk/docs/common-resources/en/src/main/css/html-common.css
===================================================================
--- trunk/docs/common-resources/en/src/main/css/html-common.css 2008-12-23 16:08:35 UTC (rev 11996)
+++ trunk/docs/common-resources/en/src/main/css/html-common.css 2008-12-23 16:54:44 UTC (rev 11997)
@@ -22,11 +22,6 @@
color: #334D69;
}
-
-div.chapter, div.section {
- padding-top:3em;
-}
-
div.book, div.chapter, div.section{
width:1000px;
margin:0 auto;
@@ -38,6 +33,10 @@
font-size:10px;
}
+.docnav{
+ padding:1em 0 3em;
+}
+
.docnav li.previous strong, .docnav li.next strong {
width: 200px;
height:22px;
Added: trunk/docs/migrationguide/en/src/main/docbook/included/dataTableAjax.xml
===================================================================
--- trunk/docs/migrationguide/en/src/main/docbook/included/dataTableAjax.xml (rev 0)
+++ trunk/docs/migrationguide/en/src/main/docbook/included/dataTableAjax.xml 2008-12-23 16:54:44 UTC (rev 11997)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section id="dataTableAjax" role="new">
+ <?dbhtml filename="dataTableAjax.html"?>
+ <sectioninfo>
+ <keywordset>
+ <keyword>dataTable</keyword>
+ <keyword>ajax</keyword>
+ </keywordset>
+ </sectioninfo>
+ <title>Ajax request calls encode() method of <rich:dataTable> even if it is not necessary</title>
+ <section>
+ <title>Description</title>
+ <para>
+ Any Ajax request reloads the list that is related to the <emphasis role="bold"><property><rich:dataTable></property></emphasis> component even if the Ajax request is related to another bean.
+It happens because the Ajax request checks whether the <emphasis role="bold"><property><rich:dataTable></property></emphasis> has nested <emphasis role="bold"><property><h:outputPanel></property></emphasis> or <emphasis role="bold"><property><h:messages></property></emphasis> components that should be updated.
+If there are no <emphasis role="bold"><property><h:outputPanel></property></emphasis>, <emphasis role="bold"><property><h:messages></property></emphasis> components inside the <emphasis role="bold"><property><rich:dataTable></property></emphasis> is not updated, but anyway the <code>encode()</code> method is called by the Ajax request.
+ </para>
+ </section>
+ <section>
+ <title>Links</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <ulink url="https://jira.jboss.org/jira/browse/RF-3341">Jira</ulink>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197996#...">RichFaces Forum</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section>
+ <title>How to reproduce</title>
+ <para>
+ Place the following code on a page and click the button. The list in <code>myBean1.myList</code> will be reloaded.
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<h:form id="form1">
+ <rich:dataTable id="myTable" value="#{myBean1.myList}" var="comp">
+ ...
+ </rich:dataTable>
+</h:form>
+<h:form id="form2">
+ <h:outputText value="#{myBean2.test}"/>
+ <a4j:commandButton event="onclick" reRender="form2" />
+</h:form>
+...]]></programlisting>
+ </section>
+ <section>
+ <title>Causes</title>
+ <para>
+ Bug is caused by <emphasis role="bold"><property><rich:dataTable></property></emphasis> implementation peculiarity.
+ </para>
+ </section>
+
+ <section>
+ <title>Workarounds</title>
+ <para>
+ Wrap the zone of a page that should be processed and updated in the <emphasis role="bold"><property><a4j:region></property></emphasis> component with <code>renderRegionOnly="true"</code>. The <emphasis role="bold"><property><rich:dataTable></property></emphasis> should be outside of the <emphasis role="bold"><property><a4j:region></property></emphasis>.
+ </para>
+ </section>
+</section>
Property changes on: trunk/docs/migrationguide/en/src/main/docbook/included/dataTableAjax.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/docs/migrationguide/en/src/main/docbook/master.xml
===================================================================
--- trunk/docs/migrationguide/en/src/main/docbook/master.xml 2008-12-23 16:08:35 UTC (rev 11996)
+++ trunk/docs/migrationguide/en/src/main/docbook/master.xml 2008-12-23 16:54:44 UTC (rev 11997)
@@ -23,6 +23,7 @@
<!ENTITY asClientId SYSTEM "included/asClientId.xml">
<!ENTITY panelGridClass SYSTEM "included/panelGridClass.xml">
+ <!ENTITY dataTableAjax SYSTEM "included/dataTableAjax.xml">
]>
<book>
@@ -155,7 +156,8 @@
However, most of the problems can be positively solved.
This section covers the most significant issues you can potentially encounter, providing ways to handle the cases.
</para>
-&panelGridClass;
+&panelGridClass;
+&dataTableAjax;
</section>
<section id="ThirdPartyFrameworks32to33">
<?dbhtml filename="ThirdPartyFrameworks32to33.html"?>
16 years
JBoss Rich Faces SVN: r11996 - in trunk/ui/editor/src/main/java/org/richfaces: convert/seamtext and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-12-23 11:08:35 -0500 (Tue, 23 Dec 2008)
New Revision: 11996
Modified:
trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java
trunk/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
trunk/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java
Log:
Editor code review results committed
Modified: trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-12-23 16:06:54 UTC (rev 11995)
+++ trunk/ui/editor/src/main/java/org/richfaces/component/UIEditor.java 2008-12-23 16:08:35 UTC (rev 11996)
@@ -48,6 +48,7 @@
/** Id suffix of textarea which used as target element for tinyMCE scripts*/
public static final String EDITOR_TEXT_AREA_ID_SUFFIX = "TextArea";
+ //TODO nick - it's a bad idea to create converterFactory instance for each component
private SeamTextConverterFactory converterFactory = new SeamTextConverterFactory();
public abstract void setType(String type);
@@ -142,6 +143,8 @@
if(isUseSeamText() && converter == null) {
return converterFactory.getConverter();
}
+
+ //TODO nick - check that converter is instance of SeamTextConverter if we use SeamText
return converter;
}
Modified: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2008-12-23 16:06:54 UTC (rev 11995)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/DefaultSeamTextConverter.java 2008-12-23 16:08:35 UTC (rev 11996)
@@ -51,10 +51,11 @@
/** The converter id for this converter. */
public static final String CONVERTER_ID = DefaultSeamTextConverter.class.getName();
-
+ //TODO nick - let everybody create instance of this class
private DefaultSeamTextConverter() {
}
+ //TODO nick - this class is not necessary
private static class DefaultConverterHolder {
private static final SeamTextConverter INSTANCE = new DefaultSeamTextConverter();
}
@@ -66,7 +67,7 @@
public Object getAsObject(FacesContext context, UIComponent component,
String value) {
try {
-
+ //TODO nick - value can be null here - see JavaDoc
Reader r = new StringReader(value);
HtmlSeamTextLexer lexer = new HtmlSeamTextLexer(r);
HtmlSeamTextParser parser = new HtmlSeamTextParser(lexer);
Modified: trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java 2008-12-23 16:06:54 UTC (rev 11995)
+++ trunk/ui/editor/src/main/java/org/richfaces/convert/seamtext/SeamTextConverterFactory.java 2008-12-23 16:08:35 UTC (rev 11996)
@@ -44,9 +44,11 @@
public SeamTextConverter createSeamTextConverter() {
try {
-
+ //TODO nick - use ThreadCCL
Class clazz = Class.forName("org.richfaces.convert.seamtext.DefaultSeamTextConverter");
Method method = clazz.getMethod("getInstance");
+
+ //TODO nick - static method doesn't need any argument, better pass null
return (SeamTextConverter) method.invoke(clazz);
} catch(Exception e) {
Modified: trunk/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-12-23 16:06:54 UTC (rev 11995)
+++ trunk/ui/editor/src/main/java/org/richfaces/renderkit/EditorRendererBase.java 2008-12-23 16:08:35 UTC (rev 11996)
@@ -82,6 +82,7 @@
* @param value - component value
* @return converted to String model value
*/
+ //TODO nick - do we really need this method?
protected String getConvertedStringValue(FacesContext context,
UIEditor component, Object value) {
return InputUtils.getConvertedStringValue(context, component, value);
@@ -151,6 +152,8 @@
InternetResource resource = getResource(resourceName);
String resourceUri = resource.getUri(context, null);
String suffix = resourceUri.substring(resourceUri.indexOf(resourceName) + resourceName.length());
+
+ //TODO nick - I doubt suffix can be null
if(suffix == null){
suffix = "";
}
@@ -176,6 +179,8 @@
try {
ClassLoader loader = Thread.currentThread()
.getContextClassLoader();
+
+ //TODO nick - use org.ajax4jsf.resource.util.URLToStreamHelper.urlToStream(URL)
InputStream is = loader.getResourceAsStream(configName
+ ".properties");
if (is == null) {
@@ -184,6 +189,8 @@
+ configName
+ "' was not found in class path");
}
+
+ //TODO nick - streams should be closed, in finally block
parameters.load(is);
writer.writeText(this.convertProperties(parameters), null);
writer.writeText(";\n", null);
@@ -204,6 +211,7 @@
* @param component - Editor component instance
* @throws IOException
*/
+ //TODO nick - merge with writeEditorConfigurationParameters() method
public void writeEditorCustomPluginsParameters(FacesContext context,
UIEditor component) throws IOException {
ResponseWriter writer = context.getResponseWriter();
@@ -325,6 +333,8 @@
+ ScriptUtils.toScript(component.getHeight())
+ ";\n", null);
}
+
+ //TODO nick - use local variables
if (component.getOninit() != null && component.getOninit().length() > 0) {
writer.writeText("tinyMceParams.oninit = function (event) {\n"
+ component.getOninit() + "\n" + "};\n", null);
@@ -405,6 +415,7 @@
* @return true if needed or false if only target textarea should be rendered
*/
public boolean shouldRenderTinyMCE(UIEditor component) {
+ //TODO nick - use TINY_MCE_DISABLED_MODE.equalsIgnoreCase(component.getViewMode())
if (component.getViewMode() != null
&& component.getViewMode().equalsIgnoreCase(
TINY_MCE_DISABLED_MODE)) {
Modified: trunk/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java
===================================================================
--- trunk/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java 2008-12-23 16:06:54 UTC (rev 11995)
+++ trunk/ui/editor/src/main/java/org/richfaces/renderkit/resources/EditorHTMLRenderer.java 2008-12-23 16:08:35 UTC (rev 11996)
@@ -117,7 +117,11 @@
int total = 0;
BufferedReader br = new BufferedReader(new InputStreamReader(in));
+
+ //TODO nick - why we need BufferedWriter?
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
+
+ //TODO nick - cannot be changed in runtime, cache in private field
String scriptSuffix = getSriptMappingSuffix();
String cssSuffix = getCssMappingSuffix();
@@ -156,6 +160,7 @@
total += line.getBytes().length;
}
} finally {
+ //TODO nick - close always flushes, no need to do that explicitly
bw.flush();
br.close();
bw.close();
16 years
JBoss Rich Faces SVN: r11995 - trunk/ui/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-12-23 11:06:54 -0500 (Tue, 23 Dec 2008)
New Revision: 11995
Modified:
trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
Log:
https://jira.jboss.org/jira/browse/RF-2516
Modified: trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx
===================================================================
--- trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-12-23 15:52:11 UTC (rev 11994)
+++ trunk/ui/menu-components/src/main/templates/org/richfaces/htmlMenuItem.jspx 2008-12-23 16:06:54 UTC (rev 11995)
@@ -68,9 +68,10 @@
Element.addClassName($('#{clientId}:anchor'), 'rich-menu-item-label-selected');"
style="#{menuItemStyle}"
onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled #{component.attributes['styleClass']}'; #{onselect} #{onclick};"
- onmouseup="Event.stop(event); #{component.attributes['onmouseup']}">
+ onmouseup="Event.stop(event); #{component.attributes['onmouseup']}"
+ onmousedown="Event.stop(event); #{component.attributes['onmousedown']}">
<f:call name="utils.encodeAttributes">
- <f:parameter value="onmousedown,onmousemove" />
+ <f:parameter value="onmousemove" />
</f:call>
<jsp:scriptlet><![CDATA[
16 years
JBoss Rich Faces SVN: r11994 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/modalPanel and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-12-23 10:52:11 -0500 (Tue, 23 Dec 2008)
New Revision: 11994
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/modalPanel/testTrimOverlayedElements.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/Configurator.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ModalPanelTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java
Log:
trimOverlayed test; template parameters
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/Configurator.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/Configurator.java 2008-12-23 14:26:04 UTC (rev 11993)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/Configurator.java 2008-12-23 15:52:11 UTC (rev 11994)
@@ -20,6 +20,11 @@
*/
package org.ajax4jsf.bean;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.ajax4jsf.template.Template;
+
public class Configurator {
private static final String[] LOAD_STRATEGIES = new String[] {"DEFAULT", "ALL"};
@@ -30,6 +35,8 @@
private static int currentStrategyIndex = 0;
+ private static Object[][] templates = null;
+
public Configurator() {}
public String getLoadScriptStrategy() {
@@ -47,5 +54,35 @@
public static void setLoadStyleStrategy(String strategy) {
loadStyleStrategy = strategy;
}
+
+ /**
+ * @return the templates
+ */
+ public static Object[][] getTemplates() {
+ return templates;
+ }
+
+ /**
+ * @param templates the templates to set
+ */
+ public static void setTemplates(String templateExpr) {
+ if (templateExpr != null) {
+ String[] array = new String[]{};
+ if(null != templateExpr) {
+ array = templateExpr.split(",");
+ }
+
+ List<Object[]> list = new ArrayList<Object[]>();
+ for (String string : array) {
+ Object[] elem = new Object[] {Template.valueOf(string.toUpperCase())};
+ list.add(elem);
+ }
+
+ templates = (Object[][]) list.toArray(new Object[0][0]);
+ }else {
+ templates = new Object[][] { { Template.SIMPLE }, { Template.DATA_TABLE }, { Template.DATA_TABLE2 }, { Template.MODAL_PANEL } };
+ }
+
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ModalPanelTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ModalPanelTestBean.java 2008-12-23 14:26:04 UTC (rev 11993)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ModalPanelTestBean.java 2008-12-23 15:52:11 UTC (rev 11994)
@@ -33,6 +33,7 @@
private Boolean resizeable = true;
private Boolean autosized = false;
private Boolean keepVisualState = false;
+ private Boolean trimOverlayedElements = true;
private String input;
/**
* @return the rendered
@@ -108,6 +109,11 @@
return null;
}
+ public String changeTrimOverlayed() {
+ trimOverlayedElements = false;
+ return null;
+ }
+
public String reset(){
rendered = true;
showWhenRendered = false;
@@ -116,6 +122,7 @@
input = null;
autosized = false;
keepVisualState = false;
+ trimOverlayedElements = true;
return null;
}
@@ -155,5 +162,17 @@
public void setKeepVisualState(Boolean keepVisualState) {
this.keepVisualState = keepVisualState;
}
+ /**
+ * @return the trimOverlayedElements
+ */
+ public Boolean getTrimOverlayedElements() {
+ return trimOverlayedElements;
+ }
+ /**
+ * @param trimOverlayedElements the trimOverlayedElements to set
+ */
+ public void setTrimOverlayedElements(Boolean trimOverlayedElements) {
+ this.trimOverlayedElements = trimOverlayedElements;
+ }
}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/modalPanel/testTrimOverlayedElements.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/modalPanel/testTrimOverlayedElements.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/modalPanel/testTrimOverlayedElements.xhtml 2008-12-23 15:52:11 UTC (rev 11994)
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="style">
+ </ui:define>
+ <ui:define name="component">
+ <rich:modalPanel id="test_panel"
+ top="101"
+ left="102"
+ width="103"
+ height="104"
+ zindex="12"
+ showWhenRendered="false"
+ minWidth="70"
+ minHeight="70"
+ trimOverlayedElements="#{modalPanelBean.trimOverlayedElements}"
+ styleClass="noclass">
+ <f:facet name="header">
+ <h:outputText id="header" value="header" />
+ </f:facet>
+ <div style="position: absolute; width: 50px; left: -20px; top: 18px; color: red">
+ Richfaces
+ </div>
+ <h:form id="_f">
+ <h:outputText value="Richfaces modal panel" /><br/><br/>
+ <h:inputText id="input" value="#{modalPanelBean.input}" style="width: 20px"></h:inputText><br/>
+ <h:commandLink id="hide" onclick="Richfaces.hideModalPanel('test_panel'); return false;" value="Hide panel" /><br/>
+ <h:commandLink id="submit" value="Submit"></h:commandLink>
+ </h:form>
+ </rich:modalPanel>
+ <h:form id="form">
+ <a href="#" id="show" onclick="Richfaces.showModalPanel('test_panel'); return false;">Open</a>
+ <h:selectBooleanCheckbox id="trimOverlayed" value="#{modalPanelBean.trimOverlayedElements}"></h:selectBooleanCheckbox>
+ <h:commandButton id="submit" value="Submit"></h:commandButton>
+ </h:form>
+
+
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-12-23 14:26:04 UTC (rev 11993)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-12-23 15:52:11 UTC (rev 11994)
@@ -40,6 +40,7 @@
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import com.thoughtworks.selenium.DefaultSelenium;
@@ -130,7 +131,8 @@
@DataProvider(name = "templates")
protected Object[][] templates() {
- return new Object[][] { { Template.SIMPLE }, { Template.DATA_TABLE }, { Template.DATA_TABLE2 }, { Template.MODAL_PANEL } };
+ //return new Object[][] { { Template.SIMPLE }, { Template.DATA_TABLE }, { Template.DATA_TABLE2 }, { Template.MODAL_PANEL } };
+ return Configurator.getTemplates();
//return this.data;
}
@@ -212,10 +214,11 @@
}
@BeforeTest
- @Parameters({"loadStyleStrategy", "loadScriptStrategy"})
- protected void loadConfiguration(String loadStyleStrategy, String loadScriptStrategy) throws Exception {
- Configurator.setLoadScriptStrategy(loadScriptStrategy);
+ @Parameters({"loadStyleStrategy", "loadScriptStrategy", "templates"})
+ protected void loadConfiguration(String loadStyleStrategy, String loadScriptStrategy, @Optional String templates) throws Exception {
+ Configurator.setLoadScriptStrategy(loadScriptStrategy);
Configurator.setLoadStyleStrategy(loadStyleStrategy);
+ Configurator.setTemplates(templates);
}
/**
@@ -1369,7 +1372,7 @@
public void assertStyleAttributes(String id, Map<String, String> styleAttrs) {
for (String a : styleAttrs.keySet()) {
String actualStyle = getStyleAttributeString(id, a);
- Assert.assertEquals(actualStyle, styleAttrs.get(a), "Style attribute invalid. Expected ["+styleAttrs.get(a)+"]. But was ["+actualStyle+"]");
+ Assert.assertEquals(actualStyle, styleAttrs.get(a), "Style attribute invalid. Expected ["+ a + "="+ styleAttrs.get(a)+"]. But was ["+a + "=" + actualStyle+"]");
}
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java 2008-12-23 14:26:04 UTC (rev 11993)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ModalPanelTest.java 2008-12-23 15:52:11 UTC (rev 11994)
@@ -20,6 +20,9 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
@@ -32,6 +35,7 @@
*/
public class ModalPanelTest extends SeleniumTestBase {
+ static final String TRIM_OVERLAYED_TEST = "pages/modalPanel/testTrimOverlayedElements.xhtml";
private final static String PANEL_ID="test_panel";
private final static String FORM_ID="form:";
private final static String FORM2_ID="_f:";
@@ -57,8 +61,35 @@
public String getTestUrl() {
return "pages/modalPanel/modalPanelTest.xhtml";
}
+
+ @Test
+ public void testTrimOverlayedElementsAttribute(Template template) {
+ renderPage(TRIM_OVERLAYED_TEST, template, RESET_METHOD_NAME);
+
+ String booleanId = getParentId() + FORM_ID + "trimOverlayed";
+ String submitId = getParentId() +FORM_ID + "submit";
+ String showButtonId = "show";
+
+ clickById(showButtonId);
+
+ Map<String, String> styles = new HashMap<String, String>();
+ styles.put("position", "relative");
+ styles.put("z-index", "0");
+
+ assertStyleAttributes(getParentId() + PANEL_CONTENT_DIV_ID, styles);
+
+ selenium.click(booleanId);
+ //selenium.check(booleanId);
+ clickCommandAndWait(submitId);
+ clickById(showButtonId);
+
+ styles.clear();
+ styles.put("position", "static");
+
+ assertStyleAttributes(getParentId() + PANEL_CONTENT_DIV_ID, styles);
+ }
- @Test
+ //@Test
public void testModalPanel(Template template) throws Exception {
renderPage(template, RESET_METHOD_NAME);
writeStatus("Testing modal panel");
@@ -80,7 +111,7 @@
}
- @Test
+ //@Test
public void testRenderedAttribute(Template template) throws Exception {
renderPage(template, RESET_METHOD_NAME);
writeStatus("Testing rendered attribute");
@@ -95,7 +126,7 @@
}
- @Test
+ //@Test
public void testShowWhenRenderedAttribute(Template template) throws Exception {
renderPage(template, RESET_METHOD_NAME);
writeStatus("Testing showWhenRendered attribute");
@@ -111,7 +142,7 @@
AssertVisible(panelId);
}
- @Test
+ //@Test
public void testNotResizeableAndNotMoveable(Template template) {
renderPage(template, RESET_METHOD_NAME);
writeStatus("Testing not resizeable panel");
@@ -144,7 +175,7 @@
}
- @Test
+ //@Test
public void testJSApi(Template template) {
renderPage(template, RESET_METHOD_NAME);
String panelId = getParentId() + PANEL_CONTAINER_DIV_ID;
@@ -159,7 +190,7 @@
AssertNotVisible(panelId, "Modal panel has not closed by JS API");
}
- @Test
+ //@Test
public void testLayoutAttributes(Template template) throws Exception {
renderPage(template, RESET_METHOD_NAME);
writeStatus("Testing layout attribute");
@@ -195,7 +226,7 @@
assertClassNames(panelContainerId, new String [] {"rich-modalpanel"}, "", true);
}
- @Test
+ //@Test
public void testDragByHeader(Template template) {
renderPage(template, RESET_METHOD_NAME);
@@ -219,7 +250,7 @@
}
- @Test
+ // @Test
public void testMinWidthAndMinHeight(Template template) {
renderPage(template, RESET_METHOD_NAME);
@@ -238,7 +269,7 @@
}
- @Test
+ //@Test
public void testNestedInputAndCommand(Template template) {
renderPage(template, RESET_METHOD_NAME);
@@ -263,7 +294,7 @@
}
- @Test
+ //@Test
public void testAutosized(Template template) {
renderPage(template, RESET_METHOD_NAME);
@@ -304,7 +335,7 @@
}
- @Test
+ // @Test
public void testKeepVisualState(Template template) {
renderPage(template, RESET_METHOD_NAME);
String message = "KeepVisualState attribute does not work";
16 years