Author: abelevich
Date: 2010-08-13 07:33:47 -0400 (Fri, 13 Aug 2010)
New Revision: 18612
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage.resource
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/down_icon.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/reorderMarker.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/up_icon.gif
trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml
Removed:
trunk/ui/iteration/ui/src/main/config/
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/html/
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java
trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml
trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/down_icon.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/reorderMarker.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/up_icon.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml
trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml
trunk/ui/iteration/ui/src/main/templates/org/
trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java
Log:
migrate iteraation components to the CDK annotations
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -32,7 +32,7 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
-import org.richfaces.component.UIDataScroller;
+import org.richfaces.component.AbstractDataScroller;
public final class DataScrollerUtils {
@@ -88,8 +88,8 @@
return parent;
}
- public static List<UIDataScroller> findDataScrollers(UIComponent dataTable) {
- List<UIDataScroller> datascrollers = new
ArrayList<UIDataScroller>();
+ public static List<AbstractDataScroller> findDataScrollers(UIComponent
dataTable) {
+ List<AbstractDataScroller> datascrollers = new
ArrayList<AbstractDataScroller>();
Map<String, UIComponent> facets = dataTable.getFacets();
Set<Entry<String, UIComponent>> entries = facets.entrySet();
@@ -105,9 +105,9 @@
return datascrollers;
}
- protected static void findBelow(UIComponent component, List<UIDataScroller>
result) {
- if ((component instanceof UIDataScroller) && component.isRendered()) {
- result.add((UIDataScroller) component);
+ protected static void findBelow(UIComponent component,
List<AbstractDataScroller> result) {
+ if ((component instanceof AbstractDataScroller) &&
component.isRendered()) {
+ result.add((AbstractDataScroller) component);
} else {
for (UIComponent child : component.getChildren()) {
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstarctSubTableToggleControl.COMPONENT_TYPE,
+ family = AbstarctSubTableToggleControl.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UISubTableToggleControl",
+ renderer = @JsfRenderer(type = "org.richfaces.SubTableRenderer"),
+ tag = @Tag( name = "subTableToggleControl")
+ )
+public abstract class AbstarctSubTableToggleControl extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.SubTableToggleControl";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.SubTableToggleControl";
+
+ public static final String DEFAULT_EVENT = "onclick";
+
+ enum PropertyKeys {
+ forId
+ }
+
+ @Attribute
+ public abstract String getExpandLabel();
+
+ @Attribute
+ public abstract String getCollapseLabel();
+
+ @Attribute
+ public abstract String getExpandIcon();
+
+ @Attribute
+ public abstract String getCollapseIcon();
+
+ @Attribute(defaultValue = DEFAULT_EVENT)
+ public abstract String getEvent();
+
+ public String getFor() {
+ return (String)getStateHelper().eval(PropertyKeys.forId);
+ }
+
+ public void setFor(String forId) {
+ getStateHelper().put(PropertyKeys.forId, forId);
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Comparator;
+
+import javax.el.ValueExpression;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.model.Filter;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.SortField;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractColumn.COMPONENT_TYPE,
+ family = AbstractColumn.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIColumn",
+ tag = @Tag(name="column")
+)
+public abstract class AbstractColumn extends javax.faces.component.UIColumn implements
Column {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Column";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Column";
+
+
+ @Attribute
+ public abstract boolean isBreakRowBefore();
+
+ @Attribute(defaultValue="SortOrder.unsorted")
+ public abstract SortOrder getSortOrder();
+
+ @Attribute
+ public abstract Filter<?> getFilter();
+
+ @Attribute
+ public abstract Object getFilterValue();
+
+ @Attribute
+ public abstract Object getRowspan();
+
+ @Attribute
+ public abstract Object getColspan();
+
+ @Attribute
+ public abstract Comparator<?> getComparator();
+
+ public FilterField getFilterField() {
+ FilterField field = null;
+ Filter<?> filter = getFilter();
+ ValueExpression filterExpression =
getValueExpression("filterExpression");
+ if (filter != null || filterExpression != null) {
+ field = new FilterField(filterExpression, filter, getFilterValue());
+ }
+ return field;
+ }
+
+ public SortField getSortField() {
+ SortField field = null;
+ SortOrder sortOrder = getSortOrder();
+ if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
+ Comparator<?> comparator = getComparator();
+ ValueExpression sortBy = getValueExpression("sortBy");
+ if (comparator != null || sortBy != null) {
+ field = new SortField(sortBy, comparator, sortOrder);
+ }
+ }
+ return field;
+ }
+
+}
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.renderkit.RowHolderBase;
+
+@JsfComponent(
+ type = AbstractColumnGroup.COMPONENT_TYPE,
+ family = AbstractColumnGroup.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIColumnGroup",
+ renderer = @JsfRenderer(type = "org.richfaces.ColumnGroupRenderer"),
+ tag = @Tag(name="columnGroup")
+)
+public abstract class AbstractColumnGroup extends UIPanel implements Row, Column {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.ColumnGroup";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.ColumnGroup";
+
+
+ public Iterator<UIComponent> columns() {
+ return new DataTableColumnsIterator(this);
+ }
+
+ public void setBreakBefore(boolean newBreakBefore) {
+ throw new IllegalStateException("Property 'breakBefore' for subtable
is read-only");
+ }
+
+ public void setRowKey(FacesContext context, Object rowKey) {
+ // columnGroup doesn't have data model
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Object argument) {
+ if (!(argument instanceof RowHolderBase)) {
+ return;
+ }
+
+ //TODO nick - implement in the proper way
+ visitor.process(context, null, argument);
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PreRenderComponentEvent;
+
+import org.richfaces.cdk.annotations.Alias;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.renderkit.MetaComponentRenderer;
+import org.slf4j.Logger;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractDataGrid.COMPONENT_TYPE,
+ family = AbstractDataGrid.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDataGrid",
+ renderer = @JsfRenderer(type = "org.richfaces.DataGridRenderer"),
+ tag = @Tag(name="dataGrid",
handler="org.richfaces.taglib.DataGridHandler", type=TagType.Facelets)
+)
+public abstract class AbstractDataGrid extends UISequence implements Row,
MetaComponentResolver, MetaComponentEncoder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DataGrid";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String HEADER_FACET_NAME = "header";
+ public static final String FOOTER_FACET_NAME = "footer";
+ public static final String CAPTION_FACET_NAME = "caption";
+ public static final String NODATA_FACET_NAME = "noData";
+
+ public static final String HEADER = "header";
+ public static final String FOOTER = "footer";
+ public static final String BODY = "body";
+
+ private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
+
+ private static final Set<String> SUPPORTED_META_COMPONENTS = new
HashSet<String>();
+
+ static {
+ SUPPORTED_META_COMPONENTS.add(HEADER);
+ SUPPORTED_META_COMPONENTS.add(FOOTER);
+ SUPPORTED_META_COMPONENTS.add(BODY);
+ }
+
+
+ enum PropertyKeys {
+ columns
+ }
+
+ @Attribute(aliases = @Alias(value="rows"))
+ public abstract int getElements();
+
+ public UIComponent getHeaderFacet() {
+ return getFacets().get(HEADER_FACET_NAME);
+ }
+
+ public UIComponent getFooterFacet() {
+ return getFacets().get(FOOTER_FACET_NAME);
+ }
+
+ public UIComponent getCaptionFacet() {
+ return getFacets().get(CAPTION_FACET_NAME);
+ }
+
+ public UIComponent getNoDataFacet() {
+ return getFacets().get(NODATA_FACET_NAME);
+ }
+
+ public int getColumns() {
+ int columns = (Integer)getStateHelper().eval(PropertyKeys.columns, 1);
+ return (columns < 1 ? 1 : columns);
+ }
+
+ public void setColumns(int count) {
+ getStateHelper().put(PropertyKeys.columns, count);
+ }
+
+ public Iterator<UIComponent> columns() {
+ //DataGrid doesn't work with column components
+ return null;
+ }
+
+ //TODO: copy from UIDataTableBase
+ public void encodeMetaComponent(FacesContext context, String metaComponentId) throws
IOException {
+ context.getApplication().publishEvent(context, PreRenderComponentEvent.class,
this);
+ MetaComponentRenderer renderer = (MetaComponentRenderer) getRenderer(context);
+ renderer.encodeMetaComponent(context, this, metaComponentId);
+ }
+
+ protected boolean visitFixedChildren(VisitContext visitContext, VisitCallback
callback) {
+ if (visitContext instanceof ExtendedVisitContext) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext)
visitContext;
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER)
{
+ //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
+ VisitResult visitResult;
+
+ visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this,
callback, HEADER);
+
+ if (visitResult == VisitResult.ACCEPT){
+ //TODO:
+ } else if (visitResult == VisitResult.COMPLETE) {
+ return true;
+ }
+
+ visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this,
callback, FOOTER);
+
+ if (visitResult == VisitResult.ACCEPT) {
+ //TODO nick - visit footer?
+ } else if (visitResult == VisitResult.COMPLETE) {
+ return true;
+ }
+
+ if (visitResult == VisitResult.REJECT) {
+ return false;
+ }
+ }
+ }
+
+ return super.visitFixedChildren(visitContext, callback);
+ }
+
+ protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback
callback, boolean visitRows) {
+ if (visitContext instanceof ExtendedVisitContext && visitRows) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext)
visitContext;
+
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER)
{
+ //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
+ setRowKey(visitContext.getFacesContext(), null);
+
+ VisitResult result =
extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, BODY);
+
+ if (result == VisitResult.ACCEPT) {
+ //TODO nick - visit body?
+ } else {
+ return result == VisitResult.COMPLETE;
+ }
+ }
+ }
+
+ return super.visitDataChildren(visitContext, callback, visitRows);
+ }
+
+
+ public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
+ if (SUPPORTED_META_COMPONENTS.contains(metaComponentId)) {
+ Object oldRowKey = getRowKey();
+
+ try {
+ setRowKey(facesContext, null);
+ return getClientId(facesContext) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
+ } finally {
+ try {
+ setRowKey(facesContext, oldRowKey);
+ } catch (Exception e) {
+ RENDERKIT_LOG.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ return null;
+ }
+}
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,391 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.component.IterationStateHolder;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.DataScrollerUtils;
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.component.util.MessageUtil;
+import org.richfaces.event.DataScrollerEvent;
+import org.richfaces.event.DataScrollerListener;
+import org.richfaces.event.DataScrollerSource;
+
+
+@JsfComponent(
+ type = AbstractDataScroller.COMPONENT_TYPE,
+ family = AbstractDataScroller.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDataScroller",
+ renderer = @JsfRenderer(type = "org.richfaces.DataScrollerRenderer"),
+ tag = @Tag(name="dataScroller",
handler="org.richfaces.taglib.DataScrollerHandler", type=TagType.Facelets)
+)
+public abstract class AbstractDataScroller extends UIComponentBase implements
DataScrollerSource, IterationStateHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DataScroller";
+
+ public static final String COMPONENT_FAMILY =
"org.richfaces.DataScroller";
+
+ public static final String SCROLLER_STATE_ATTRIBUTE = COMPONENT_TYPE +
":page";
+
+ public static final String FIRST_FACET_NAME = "first";
+
+ public static final String LAST_FACET_NAME = "last";
+
+ public static final String FAST_FORWARD_FACET_NAME = "fastforward";
+
+ public static final String FAST_REWIND_FACET_NAME = "fastrewind";
+
+ public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
+
+ public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
+
+ public static final String PAGEMODE_FULL = "full";
+
+ public static final String PAGEMODE_SHORT = "short";
+
+ private Integer page;
+
+ protected enum PropertyKeys {
+ boundaryControls, fastControls, fastStep, forComponent, inactiveStyle,
selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode,
maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
+ }
+
+ @Attribute
+ public abstract String getLastPageMode();
+
+ @Attribute(defaultValue="0")
+ public abstract int getFastStep();
+
+ @Attribute
+ public abstract String getForComponent();
+
+ @Attribute(defaultValue="10")
+ public abstract int getMaxPages();
+
+ @Attribute(defaultValue="show")
+ public abstract String getBoundaryControls();
+
+ @Attribute(defaultValue="show")
+ public abstract String getFastControls();
+
+ public void addScrollerListener(DataScrollerListener listener) {
+ addFacesListener(listener);
+ }
+
+ public DataScrollerListener[] getScrollerListeners() {
+ return (DataScrollerListener[]) getFacesListeners(DataScrollerListener.class);
+ }
+
+ public void removeScrollerListener(DataScrollerListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof DataScrollerEvent) {
+ DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
+
+ updateModel(dataScrollerEvent.getPage());
+
+ FacesContext facesContext = getFacesContext();
+
+ UIComponent dataTable = getDataTable();
+
+ List<AbstractDataScroller> dataScrollers =
DataScrollerUtils.findDataScrollers(dataTable);
+ for (AbstractDataScroller dataScroller : dataScrollers) {
+
facesContext.getPartialViewContext().getRenderIds().add(dataScroller.getClientId(facesContext));
+ }
+
+ String dataTableId = null;
+ if (dataTable instanceof MetaComponentResolver) {
+ dataTableId = ((MetaComponentResolver)
dataTable).resolveClientId(facesContext, dataTable, "body");
+ }
+
+ if (dataTableId == null) {
+ dataTableId = dataTable.getClientId(facesContext);
+ }
+
+ facesContext.getPartialViewContext().getRenderIds().add(dataTableId);
+
+ //add datascroller to render
+ String dataScrollerId = getClientId(facesContext);
+
if(!facesContext.getPartialViewContext().getRenderIds().contains(dataScrollerId)) {
+ facesContext.getPartialViewContext().getRenderIds().add(dataScrollerId);
+ }
+
+ }
+
+ super.broadcast(event);
+ }
+
+ /**
+ * Finds the dataTable which id is mapped to the "for" property
+ *
+ * @return the dataTable component
+ */
+
+ public UIComponent getDataTable() {
+ String forAttribute = (String)
getAttributes().get(PropertyKeys.forComponent.toString());
+ UIComponent forComp;
+
+ if (forAttribute == null) {
+ forComp = this;
+
+ while ((forComp = forComp.getParent()) != null) {
+ if (forComp instanceof UIData || forComp instanceof UIDataAdaptor) {
+ getStateHelper().put(PropertyKeys.forComponent, forComp.getId());
+ return forComp;
+ }
+ }
+ throw new FacesException("could not find dataTable for datascroller
" + this.getId());
+
+ } else {
+ forComp = RendererUtils.getInstance().findComponentFor(this, forAttribute);
+ }
+
+ if (forComp == null) {
+ throw new IllegalArgumentException("could not find dataTable with id
'" + forAttribute + "'");
+ } else if (!((forComp instanceof UIData) || (forComp instanceof UIDataAdaptor)))
{
+
+ throw new IllegalArgumentException("component with id '" +
forAttribute + "' must be of type "
+ + UIData.class.getName() + " or " + UIDataAdaptor.class +
", not type " + forComp.getClass().getName());
+ }
+
+ return forComp;
+ }
+
+ private int getFastStepOrDefault() {
+ return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
+ }
+
+ public int getPageForFacet(String facetName) {
+ if (facetName == null) {
+ throw new NullPointerException();
+ }
+
+ int newPage = 1;
+ int pageCount = getPageCount();
+
+ if (FIRST_FACET_NAME.equals(facetName)) {
+ newPage = 1;
+ } else if (LAST_FACET_NAME.equals(facetName)) {
+ newPage = pageCount > 0 ? pageCount : 1;
+ } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
+ newPage = getPage() + getFastStepOrDefault();
+ } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
+ newPage = getPage() - getFastStepOrDefault();
+ } else {
+ try {
+ newPage = Integer.parseInt(facetName.toString());
+ } catch (NumberFormatException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
+
+ if (newPage >= 1 && newPage <= pageCount) {
+ return newPage;
+ } else {
+ return 0;
+ }
+ }
+
+ public int getPageCount(UIComponent data) {
+ int rowCount = getRowCount(data);
+ int rows = getRows(data);
+ return getPageCount(data, rowCount, rows);
+ }
+
+ public int getPageCount(UIComponent data, int rowCount, int rows) {
+ return DataScrollerUtils.getPageCount(data, rowCount, rows);
+ }
+
+ /** @return the page count of the uidata */
+ public int getPageCount() {
+ return getPageCount(getDataTable());
+ }
+
+ public int getRowCount(UIComponent data) {
+ return (Integer) data.getAttributes().get("rowCount");
+ }
+
+ /** @return int */
+ public int getRowCount() {
+ return getRowCount(getDataTable());
+ }
+
+ public int getRows(UIComponent data) {
+ return DataScrollerUtils.getRows(data);
+ }
+
+ // facet getter methods
+ public UIComponent getFirst() {
+ return getFacet(FIRST_FACET_NAME);
+ }
+
+ public UIComponent getLast() {
+ return getFacetByKey(LAST_FACET_NAME);
+ }
+
+ public UIComponent getFastForward() {
+ return getFacetByKey(FAST_FORWARD_FACET_NAME);
+ }
+
+ public UIComponent getFastRewind() {
+ return getFacetByKey(FAST_REWIND_FACET_NAME);
+ }
+
+ private UIComponent getFacetByKey(String key) {
+ return getFacet(key.toString());
+ }
+
+ private static boolean isRendered(UIComponent component) {
+ UIComponent c = component;
+ while (c != null) {
+ if (!c.isRendered()) {
+ return false;
+ }
+ c = c.getParent();
+ }
+
+ return true;
+ }
+
+ public void setPage(int newPage) {
+ this.page = newPage;
+ }
+
+ public int getPage() {
+
+ UIComponent dataTable = getDataTable();
+ Map<String, Object> attributes = dataTable.getAttributes();
+
+ FacesContext facesContext = getFacesContext();
+ Integer state = (Integer) attributes.get(dataTable.getClientId(facesContext) +
SCROLLER_STATE_ATTRIBUTE);
+
+ if (state != null) {
+ return state;
+ }
+
+ if (this.page != null) {
+ return page;
+ }
+
+ ValueExpression ve = getValueExpression("page");
+ if (ve != null) {
+ try {
+ Integer pageObject = (Integer)
ve.getValue(getFacesContext().getELContext());
+
+ if (pageObject != null) {
+ return pageObject;
+ }
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ }
+
+ return 1;
+ }
+
+ private void updateModel(int newPage) {
+
+ FacesContext facesContext = getFacesContext();
+ UIComponent dataTable = getDataTable();
+
+ if (isRendered(dataTable)) {
+ dataTable.getAttributes().put("first", (newPage - 1) *
getRows(dataTable));
+ }
+
+ Map<String, Object> attributes = dataTable.getAttributes();
+ attributes.put(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE,
newPage);
+
+ ValueExpression ve = getValueExpression("page");
+ if (ve != null) {
+ try {
+ ve.setValue(facesContext.getELContext(), newPage);
+ attributes.remove(dataTable.getClientId(facesContext) +
SCROLLER_STATE_ATTRIBUTE);
+ } catch (ELException e) {
+ String messageStr = e.getMessage();
+ Throwable result = e.getCause();
+ while (null != result &&
result.getClass().isAssignableFrom(ELException.class)) {
+ messageStr = result.getMessage();
+ result = result.getCause();
+ }
+ FacesMessage message;
+ if (null == messageStr) {
+ message = MessageUtil.getMessage(facesContext,
UIInput.UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(facesContext, this) });
+ } else {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr,
messageStr);
+ }
+ facesContext.getExternalContext().log(message.getSummary(), result);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ } catch (IllegalArgumentException e) {
+ FacesMessage message = MessageUtil.getMessage(facesContext,
UIInput.UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(facesContext, this) });
+ facesContext.getExternalContext().log(message.getSummary(), e);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ } catch (Exception e) {
+ FacesMessage message = MessageUtil.getMessage(facesContext,
UIInput.UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(facesContext, this) });
+ facesContext.getExternalContext().log(message.getSummary(), e);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ }
+ }
+ }
+
+ public boolean isLocalPageSet() {
+ return page != null;
+ }
+
+ public void resetLocalPage() {
+ page = null;
+ }
+
+ public Object getIterationState() {
+ return this.page;
+ }
+
+ public void setIterationState(Object state) {
+ this.page = (Integer) state;
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractDataTable.COMPONENT_TYPE,
+ family = AbstractDataTable.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDataTable",
+ renderer = @JsfRenderer(type = "org.richfaces.DataTableRenderer"),
+ tag = @Tag(name="dataTable",
handler="org.richfaces.taglib.DataTableHandler", type=TagType.Facelets)
+)
+public abstract class AbstractDataTable extends UIDataTableBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DataTable";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String CAPTION_FACET_NAME = "caption";
+
+
+ public UIComponent getCaption() {
+ return getFacets().get(CAPTION_FACET_NAME);
+ }
+
+}
+
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,190 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+
+
+@JsfComponent(
+ type = AbstractExtendedDataTable.COMPONENT_TYPE,
+ family = AbstractExtendedDataTable.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIExtendedDataTable",
+ renderer = @JsfRenderer(type = "org.richfaces.ExtendedDataTableRenderer"),
+ tag = @Tag(name = "extendedDataTable")
+)
+public abstract class AbstractExtendedDataTable extends UIDataTableBase implements
MetaComponentResolver, MetaComponentEncoder {
+
+ public static final String COMPONENT_TYPE =
"org.richfaces.ExtendedDataTable";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String SCROLL = "scroll";
+
+ public static final String SUBMITTED_CLIENT_FIRST =
"submittedClientFirst";
+
+ public static final String OLD_CLIENT_FIRST = "oldClientFirst";
+
+ private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
+
+ protected enum PropertyKeys {
+ clientFirst, clientRows
+ }
+
+ public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
+ if (SCROLL.equals(metaComponentId)) {
+ Object oldRowKey = getRowKey();
+
+ try {
+ setRowKey(facesContext, null);
+ return getClientId(facesContext) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
+ } finally {
+ try {
+ setRowKey(facesContext, oldRowKey);
+ } catch (Exception e) {
+ RENDERKIT_LOG.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ return super.resolveClientId(facesContext, contextComponent, metaComponentId);
+ }
+
+ public void encodeMetaComponent(FacesContext context, String metaComponentId) throws
IOException {
+ if (SCROLL.equals(metaComponentId)) {
+ Map<String, Object> attributes = getAttributes();
+ Integer submittedClientFirst = (Integer)
attributes.remove(SUBMITTED_CLIENT_FIRST);
+ if (submittedClientFirst != null) {
+ attributes.put(OLD_CLIENT_FIRST, getClientFirst());
+ setClientFirst(submittedClientFirst);
+ }
+ }
+
+ super.encodeMetaComponent(context, metaComponentId);
+ }
+
+ protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback
callback, boolean visitRows) {
+ if (visitContext instanceof ExtendedVisitContext && visitRows) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext)
visitContext;
+
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER)
{
+ //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
+ setRowKey(visitContext.getFacesContext(), null);
+
+ VisitResult result;
+
+ result = extendedVisitContext.invokeMetaComponentVisitCallback(this,
callback, SCROLL);
+
+ if (result == VisitResult.ACCEPT) {
+ //TODO nick - visit scroll?
+ } else if (result == VisitResult.COMPLETE) {
+ return true;
+ }
+ }
+ }
+
+ return super.visitDataChildren(visitContext, callback, visitRows);
+ }
+
+ protected int getActualFirst() {
+ return getFirst() + getClientFirst();
+ }
+
+ protected int getActualRows() {
+ int rows = getClientRows();
+
+ if (rows > 0) {
+ int r = getRows();
+ if (r > 0 && r < rows) {
+ rows = r;
+ }
+ } else {
+ rows = getRows();
+ }
+
+ return rows;
+ }
+
+ public int getClientFirst() {
+ return (Integer) getStateHelper().eval(PropertyKeys.clientFirst, 0);
+ }
+
+ public void setClientFirst(int clientFirst) {
+ getStateHelper().put(PropertyKeys.clientFirst, clientFirst);
+ updateState();
+ }
+
+ public void setFirst(int first) {
+ super.setFirst(first);
+ setClientFirst(0);
+ }
+
+ public int getClientRows() {
+ return (Integer) getStateHelper().eval(PropertyKeys.clientRows, 0);
+ }
+
+ public void setClientRows(int clientRows) {
+ getStateHelper().put(PropertyKeys.clientRows, clientRows);
+
+ updateState();
+ }
+
+ public void setValueBinding(String name, javax.faces.el.ValueBinding binding) {
+ super.setValueBinding(name, binding);
+
+ //TODO nick - clientFirst?
+ if ("clientRows".equals(name)) {
+ updateState();
+ }
+ }
+
+ public void setValueExpression(String name, ValueExpression binding) {
+ super.setValueExpression(name, binding);
+
+ //TODO nick - clientFirst?
+ if ("clientRows".equals(name)) {
+ updateState();
+ }
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+import org.richfaces.event.ToggleEvent;
+import org.richfaces.event.ToggleListener;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+@JsfComponent(
+ type = AbstractSubTable.COMPONENT_TYPE,
+ family = AbstractSubTable.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UISubTable",
+ renderer = @JsfRenderer(type = "org.richfaces.SubTableRenderer"),
+ tag = @Tag(name = "subTable", handler =
"org.richfaces.taglib.SubTableHandler", type = TagType.Facelets)
+)
+public abstract class AbstractSubTable extends UIDataTableBase implements Column,
Expandable {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.SubTable";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String MODE_AJAX = "ajax";
+
+ public static final String MODE_SERVER = "server";
+
+ public static final String MODE_CLIENT = "client";
+
+ public static final int EXPAND_STATE = 1;
+
+ public static final int COLLAPSE_STATE = 0;
+
+
+ enum PropertyKeys {
+ expanded
+ }
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isExpanded();
+
+ @Attribute(defaultValue = MODE_CLIENT)
+ public abstract String getExpandMode();
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof ToggleEvent) {
+ ToggleEvent toggleEvent = (ToggleEvent) event;
+ boolean newValue = toggleEvent.isExpanded();
+ getStateHelper().put(PropertyKeys.expanded, newValue);
+
+ FacesContext facesContext = getFacesContext();
+ ELContext elContext = facesContext.getELContext();
+
+ ValueExpression valueExpression =
getValueExpression(PropertyKeys.expanded.toString());
+ if (valueExpression != null &&
!valueExpression.isReadOnly(elContext)) {
+ valueExpression.setValue(elContext, newValue);
+ }
+
+ if(getFacesContext().getPartialViewContext().isAjaxRequest()) {
+ String render = resolveClientId(facesContext, this, BODY);
+
+ getFacesContext().getPartialViewContext().getRenderIds().add(render);
+
+ String togglerId = toggleEvent.getTogglerId();
+ if(togglerId != null) {
+
getFacesContext().getPartialViewContext().getRenderIds().add(togglerId);
+ }
+ }
+
+ }
+ super.broadcast(event);
+ }
+
+ public boolean isBreakBefore() {
+ return true;
+ }
+
+ public void setBreakBefore(boolean newBreakBefore) {
+ throw new IllegalStateException("Property 'breakBefore' for subtable
is read-only");
+ }
+
+ public String getSortExpression() {
+ // SubTable is not sortable element.
+ return null;
+ }
+
+ public void setSortExpression(String sortExpression) {
+ throw new IllegalArgumentException("subtable is not sortable
element");
+ }
+
+ public void addToggleListener(ToggleListener listener) {
+ addFacesListener(listener);
+ }
+
+ public void removeToggleListener(ToggleListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public ToggleListener[] getToggleListeners() {
+ return (ToggleListener[]) getFacesListeners(ToggleListener.class);
+ }
+
+ public void setIterationState(Object stateObject) {
+ Object[] state = (Object[]) stateObject;
+ if (state != null) {
+ super.setIterationState(state[0]);
+ getStateHelper().put(PropertyKeys.expanded, state[1]);
+ } else {
+ super.setIterationState(null);
+ getStateHelper().put(PropertyKeys.expanded, null);
+ }
+ }
+
+ public Object getIterationState() {
+ Object [] state = new Object[2];
+ state[0] = super.getIterationState();
+ state[1] = getStateHelper().get(PropertyKeys.expanded);
+ return state;
+ }
+}
+
+
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -43,7 +43,7 @@
UIComponent nextColumn = null;
while (nextColumn == null && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if ((child instanceof UIColumn) || (child instanceof Column)) {
+ if ((child instanceof AbstractColumn) || (child instanceof Column)) {
nextColumn = child;
}
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -47,7 +47,7 @@
Iterator<UIComponent> childrenIterator = getChildrenIterator();
while (next == null && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if ((child instanceof UIColumn) && child.isRendered()) {
+ if ((child instanceof AbstractColumn) && child.isRendered()) {
currentColumnIterator = getChildFacetIterator(child);
next = nextItem();
}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Comparator;
-
-import javax.el.ValueExpression;
-
-import org.richfaces.model.Filter;
-import org.richfaces.model.FilterField;
-import org.richfaces.model.SortField;
-
-public class UIColumn extends javax.faces.component.UIColumn implements Column {
-
- protected enum PropertyKeys {
- filter, filterValue, comparator, sortOrder, breakRowBefore
- }
-
- public void setBreakRowBefore(boolean breakRowBefore) {
- getStateHelper().put(PropertyKeys.breakRowBefore, breakRowBefore);
- }
-
- public boolean getBreakRowBefore() {
- return (Boolean) getStateHelper().eval(PropertyKeys.breakRowBefore, false);
- }
-
- public void setSortOrder(SortOrder sortOrder) {
- getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
- }
-
- public SortOrder getSortOrder() {
- return (SortOrder) getStateHelper().eval(PropertyKeys.sortOrder,
SortOrder.unsorted);
- }
-
- public void setFilter(Filter<?> filter) {
- getStateHelper().put(PropertyKeys.filter, filter);
- }
-
- public Filter<?> getFilter() {
- return (Filter<?>) getStateHelper().eval(PropertyKeys.filter);
- }
-
- public void setFilterValue(Object filterValue) {
- getStateHelper().put(PropertyKeys.filterValue, filterValue);
- }
-
- public Object getFilterValue() {
- return getStateHelper().eval(PropertyKeys.filterValue);
- }
-
- public void setComparator(Comparator<?> comparator) {
- getStateHelper().put(PropertyKeys.comparator, comparator);
- }
-
- public Comparator<?> getComparator() {
- return (Comparator<?>) getStateHelper().eval(PropertyKeys.comparator);
- }
-
- public FilterField getFilterField() {
- FilterField field = null;
- Filter<?> filter = getFilter();
- ValueExpression filterExpression =
getValueExpression("filterExpression");
- if (filter != null || filterExpression != null) {
- field = new FilterField(filterExpression, filter, getFilterValue());
- }
- return field;
- }
-
- public SortField getSortField() {
- SortField field = null;
- SortOrder sortOrder = getSortOrder();
- if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
- Comparator<?> comparator = getComparator();
- ValueExpression sortBy = getValueExpression("sortBy");
- if (comparator != null || sortBy != null) {
- field = new SortField(sortBy, comparator, sortOrder);
- }
- }
- return field;
- }
-
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.richfaces.renderkit.RowHolderBase;
-
-public abstract class UIColumnGroup extends UIPanel implements Row, Column {
-
- public Iterator<UIComponent> columns() {
- return new DataTableColumnsIterator(this);
- }
-
- public void setBreakBefore(boolean newBreakBefore) {
- throw new IllegalStateException("Property 'breakBefore' for subtable
is read-only");
- }
-
- public void setRowKey(FacesContext context, Object rowKey) {
- // columnGroup doesn't have data model
- }
-
- public void walk(FacesContext context, DataVisitor visitor, Object argument) {
- if (!(argument instanceof RowHolderBase)) {
- return;
- }
-
- //TODO nick - implement in the proper way
- visitor.process(context, null, argument);
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,190 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitResult;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PreRenderComponentEvent;
-
-import org.richfaces.context.ExtendedVisitContext;
-import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.renderkit.MetaComponentRenderer;
-import org.slf4j.Logger;
-
-/**
- * @author Anton Belevich
- *
- */
-public class UIDataGrid extends UISequence implements Row, MetaComponentResolver,
MetaComponentEncoder {
-
- public static final String HEADER_FACET_NAME = "header";
- public static final String FOOTER_FACET_NAME = "footer";
- public static final String CAPTION_FACET_NAME = "caption";
- public static final String NODATA_FACET_NAME = "noData";
-
- public static final String HEADER = "header";
- public static final String FOOTER = "footer";
- public static final String BODY = "body";
-
- private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- private static final Set<String> SUPPORTED_META_COMPONENTS = new
HashSet<String>();
-
- static {
- SUPPORTED_META_COMPONENTS.add(HEADER);
- SUPPORTED_META_COMPONENTS.add(FOOTER);
- SUPPORTED_META_COMPONENTS.add(BODY);
- }
-
-
- enum PropertyKeys {
- columns, elements
- }
-
- public int getColumns() {
- int columns = (Integer)getStateHelper().eval(PropertyKeys.columns, 1);
- return (columns < 1 ? 1 : columns);
- }
-
- public void setColumns(int count) {
- getStateHelper().put(PropertyKeys.columns, count);
- }
-
- public int getElements() {
- return (Integer)getStateHelper().eval(PropertyKeys.elements);
- }
-
- public void setElements(int count) {
- getStateHelper().put(PropertyKeys.elements, count);
- }
-
- public Iterator<UIComponent> columns() {
- //DataGrid doesn't work with column components
- return null;
- }
-
- public UIComponent getHeaderFacet() {
- return getFacet(HEADER_FACET_NAME);
- }
-
- public UIComponent getFooterFacet() {
- return getFacet(FOOTER_FACET_NAME);
- }
-
- public UIComponent getCaptionFacet() {
- return getFacet(CAPTION_FACET_NAME);
- }
-
- public UIComponent getNoDataFacet() {
- return getFacet(NODATA_FACET_NAME);
- }
-
- //TODO: copy from UIDataTableBase
- public void encodeMetaComponent(FacesContext context, String metaComponentId) throws
IOException {
- context.getApplication().publishEvent(context, PreRenderComponentEvent.class,
this);
- MetaComponentRenderer renderer = (MetaComponentRenderer) getRenderer(context);
- renderer.encodeMetaComponent(context, this, metaComponentId);
- }
-
- protected boolean visitFixedChildren(VisitContext visitContext, VisitCallback
callback) {
- if (visitContext instanceof ExtendedVisitContext) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext)
visitContext;
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER)
{
- //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
- VisitResult visitResult;
-
- visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this,
callback, HEADER);
-
- if (visitResult == VisitResult.ACCEPT){
- //TODO:
- } else if (visitResult == VisitResult.COMPLETE) {
- return true;
- }
-
- visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this,
callback, FOOTER);
-
- if (visitResult == VisitResult.ACCEPT) {
- //TODO nick - visit footer?
- } else if (visitResult == VisitResult.COMPLETE) {
- return true;
- }
-
- if (visitResult == VisitResult.REJECT) {
- return false;
- }
- }
- }
-
- return super.visitFixedChildren(visitContext, callback);
- }
-
- protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback
callback, boolean visitRows) {
- if (visitContext instanceof ExtendedVisitContext && visitRows) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext)
visitContext;
-
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER)
{
- //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
- setRowKey(visitContext.getFacesContext(), null);
-
- VisitResult result =
extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, BODY);
-
- if (result == VisitResult.ACCEPT) {
- //TODO nick - visit body?
- } else {
- return result == VisitResult.COMPLETE;
- }
- }
- }
-
- return super.visitDataChildren(visitContext, callback, visitRows);
- }
-
-
- public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
- if (SUPPORTED_META_COMPONENTS.contains(metaComponentId)) {
- Object oldRowKey = getRowKey();
-
- try {
- setRowKey(facesContext, null);
- return getClientId(facesContext) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
- } finally {
- try {
- setRowKey(facesContext, oldRowKey);
- } catch (Exception e) {
- RENDERKIT_LOG.error(e.getMessage(), e);
- }
- }
- }
-
- return null;
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,418 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIData;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.component.IterationStateHolder;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.DataScrollerUtils;
-import org.richfaces.component.util.MessageUtil;
-import org.richfaces.event.DataScrollerEvent;
-import org.richfaces.event.DataScrollerListener;
-import org.richfaces.event.DataScrollerSource;
-
-public class UIDataScroller extends UIComponentBase implements DataScrollerSource,
IterationStateHolder {
-
- public static final String COMPONENT_TYPE = "org.richfaces.DataScroller";
-
- public static final String COMPONENT_FAMILY =
"org.richfaces.DataScroller";
-
- public static final String SCROLLER_STATE_ATTRIBUTE = COMPONENT_TYPE +
":page";
-
- public static final String FIRST_FACET_NAME = "first";
-
- public static final String LAST_FACET_NAME = "last";
-
- public static final String FAST_FORWARD_FACET_NAME = "fastforward";
-
- public static final String FAST_REWIND_FACET_NAME = "fastrewind";
-
- public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
-
- public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
-
- public static final String PAGEMODE_FULL = "full";
-
- public static final String PAGEMODE_SHORT = "short";
-
- private static final int MAX_PAGES_DEFAULT = 10;
-
- private Integer page;
-
- protected enum PropertyKeys {
- boundaryControls, fastControls, fastStep, forComponent, inactiveStyle,
selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode,
maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
- }
-
- public String getLastPageMode() {
- return (String) getStateHelper().eval(PropertyKeys.lastPageMode);
- }
-
- public void setLastPageMode(String lastPageMode) {
- getStateHelper().put(PropertyKeys.lastPageMode, lastPageMode);
- }
-
- public int getFastStep() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 0);
- }
-
- public void setFastStep(int fastStep) {
- getStateHelper().put(PropertyKeys.fastStep, fastStep);
- }
-
- public String getForComponent() {
- return (String) getStateHelper().eval(PropertyKeys.forComponent);
- }
-
- public void setForComponent(String forComponent) {
- getStateHelper().put(PropertyKeys.forComponent, forComponent);
- }
-
- public int getMaxPages() {
- return (Integer) getStateHelper().eval(PropertyKeys.maxPages,
MAX_PAGES_DEFAULT);
- }
-
- public void setMaxPages(int maxPages) {
- getStateHelper().put(PropertyKeys.maxPages, maxPages);
- }
-
- public String getBoundaryControls() {
- return (String) getStateHelper().eval(PropertyKeys.boundaryControls,
"show");
- }
-
- public void setBoundaryControls(String boundaryControls) {
- getStateHelper().put(PropertyKeys.boundaryControls, boundaryControls);
- }
-
- public String getFastControls() {
- return (String) getStateHelper().eval(PropertyKeys.fastControls,
"show");
- }
-
- public void setFastControls(String fastControls) {
- getStateHelper().put(PropertyKeys.fastControls, fastControls);
- }
-
- public void addScrollerListener(DataScrollerListener listener) {
- addFacesListener(listener);
- }
-
- public DataScrollerListener[] getScrollerListeners() {
- return (DataScrollerListener[]) getFacesListeners(DataScrollerListener.class);
- }
-
- public void removeScrollerListener(DataScrollerListener listener) {
- removeFacesListener(listener);
- }
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
-
-
- if (event instanceof DataScrollerEvent) {
- DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
-
- updateModel(dataScrollerEvent.getPage());
-
- FacesContext facesContext = getFacesContext();
-
- UIComponent dataTable = getDataTable();
-
- List<UIDataScroller> dataScrollers =
DataScrollerUtils.findDataScrollers(dataTable);
- for (UIDataScroller dataScroller : dataScrollers) {
-
facesContext.getPartialViewContext().getRenderIds().add(dataScroller.getClientId(facesContext));
- }
-
- String dataTableId = null;
- if (dataTable instanceof MetaComponentResolver) {
- dataTableId = ((MetaComponentResolver)
dataTable).resolveClientId(facesContext, dataTable, "body");
- }
-
- if (dataTableId == null) {
- dataTableId = dataTable.getClientId(facesContext);
- }
-
- facesContext.getPartialViewContext().getRenderIds().add(dataTableId);
-
- //add datascroller to render
- String dataScrollerId = getClientId(facesContext);
-
if(!facesContext.getPartialViewContext().getRenderIds().contains(dataScrollerId)) {
- facesContext.getPartialViewContext().getRenderIds().add(dataScrollerId);
- }
-
- }
-
- super.broadcast(event);
- }
-
- /**
- * Finds the dataTable which id is mapped to the "for" property
- *
- * @return the dataTable component
- */
-
- public UIComponent getDataTable() {
- String forAttribute = (String)
getAttributes().get(PropertyKeys.forComponent.toString());
- UIComponent forComp;
-
- if (forAttribute == null) {
- forComp = this;
-
- while ((forComp = forComp.getParent()) != null) {
- if (forComp instanceof UIData || forComp instanceof UIDataAdaptor) {
- getStateHelper().put(PropertyKeys.forComponent, forComp.getId());
- return forComp;
- }
- }
- throw new FacesException("could not find dataTable for datascroller
" + this.getId());
-
- } else {
- forComp = RendererUtils.getInstance().findComponentFor(this, forAttribute);
- }
-
- if (forComp == null) {
- throw new IllegalArgumentException("could not find dataTable with id
'" + forAttribute + "'");
- } else if (!((forComp instanceof UIData) || (forComp instanceof UIDataAdaptor)))
{
-
- throw new IllegalArgumentException("component with id '" +
forAttribute + "' must be of type "
- + UIData.class.getName() + " or " + UIDataAdaptor.class +
", not type " + forComp.getClass().getName());
- }
-
- return forComp;
- }
-
- private int getFastStepOrDefault() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
- }
-
- public int getPageForFacet(String facetName) {
- if (facetName == null) {
- throw new NullPointerException();
- }
-
- int newPage = 1;
- int pageCount = getPageCount();
-
- if (FIRST_FACET_NAME.equals(facetName)) {
- newPage = 1;
- } else if (LAST_FACET_NAME.equals(facetName)) {
- newPage = pageCount > 0 ? pageCount : 1;
- } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- newPage = getPage() + getFastStepOrDefault();
- } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- newPage = getPage() - getFastStepOrDefault();
- } else {
- try {
- newPage = Integer.parseInt(facetName.toString());
- } catch (NumberFormatException e) {
- throw new FacesException(e.getLocalizedMessage(), e);
- }
- }
-
- if (newPage >= 1 && newPage <= pageCount) {
- return newPage;
- } else {
- return 0;
- }
- }
-
- public int getPageCount(UIComponent data) {
- int rowCount = getRowCount(data);
- int rows = getRows(data);
- return getPageCount(data, rowCount, rows);
- }
-
- public int getPageCount(UIComponent data, int rowCount, int rows) {
- return DataScrollerUtils.getPageCount(data, rowCount, rows);
- }
-
- /** @return the page count of the uidata */
- public int getPageCount() {
- return getPageCount(getDataTable());
- }
-
- public int getRowCount(UIComponent data) {
- return (Integer) data.getAttributes().get("rowCount");
- }
-
- /** @return int */
- public int getRowCount() {
- return getRowCount(getDataTable());
- }
-
- public int getRows(UIComponent data) {
- return DataScrollerUtils.getRows(data);
- }
-
- // facet getter methods
- public UIComponent getFirst() {
- return getFacet(FIRST_FACET_NAME);
- }
-
- public UIComponent getLast() {
- return getFacetByKey(LAST_FACET_NAME);
- }
-
- public UIComponent getFastForward() {
- return getFacetByKey(FAST_FORWARD_FACET_NAME);
- }
-
- public UIComponent getFastRewind() {
- return getFacetByKey(FAST_REWIND_FACET_NAME);
- }
-
- private UIComponent getFacetByKey(String key) {
- return getFacet(key.toString());
- }
-
- private static boolean isRendered(UIComponent component) {
- UIComponent c = component;
- while (c != null) {
- if (!c.isRendered()) {
- return false;
- }
- c = c.getParent();
- }
-
- return true;
- }
-
- public void setPage(int newPage) {
- this.page = newPage;
- }
-
- public int getPage() {
-
- UIComponent dataTable = getDataTable();
- Map<String, Object> attributes = dataTable.getAttributes();
-
- FacesContext facesContext = getFacesContext();
- Integer state = (Integer) attributes.get(dataTable.getClientId(facesContext) +
SCROLLER_STATE_ATTRIBUTE);
-
- if (state != null) {
- return state;
- }
-
- if (this.page != null) {
- return page;
- }
-
- ValueExpression ve = getValueExpression("page");
- if (ve != null) {
- try {
- Integer pageObject = (Integer)
ve.getValue(getFacesContext().getELContext());
-
- if (pageObject != null) {
- return pageObject;
- }
- } catch (ELException e) {
- throw new FacesException(e);
- }
- }
-
- return 1;
- }
-
- private void updateModel(int newPage) {
-
- FacesContext facesContext = getFacesContext();
- UIComponent dataTable = getDataTable();
-
- if (isRendered(dataTable)) {
- dataTable.getAttributes().put("first", (newPage - 1) *
getRows(dataTable));
- }
-
- Map<String, Object> attributes = dataTable.getAttributes();
- attributes.put(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE,
newPage);
-
- ValueExpression ve = getValueExpression("page");
- if (ve != null) {
- try {
- ve.setValue(facesContext.getELContext(), newPage);
- attributes.remove(dataTable.getClientId(facesContext) +
SCROLLER_STATE_ATTRIBUTE);
- } catch (ELException e) {
- String messageStr = e.getMessage();
- Throwable result = e.getCause();
- while (null != result &&
result.getClass().isAssignableFrom(ELException.class)) {
- messageStr = result.getMessage();
- result = result.getCause();
- }
- FacesMessage message;
- if (null == messageStr) {
- message = MessageUtil.getMessage(facesContext,
UIInput.UPDATE_MESSAGE_ID,
- new Object[] {MessageUtil.getLabel(facesContext, this) });
- } else {
- message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr,
messageStr);
- }
- facesContext.getExternalContext().log(message.getSummary(), result);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- } catch (IllegalArgumentException e) {
- FacesMessage message = MessageUtil.getMessage(facesContext,
UIInput.UPDATE_MESSAGE_ID,
- new Object[] {MessageUtil.getLabel(facesContext, this) });
- facesContext.getExternalContext().log(message.getSummary(), e);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- } catch (Exception e) {
- FacesMessage message = MessageUtil.getMessage(facesContext,
UIInput.UPDATE_MESSAGE_ID,
- new Object[] {MessageUtil.getLabel(facesContext, this) });
- facesContext.getExternalContext().log(message.getSummary(), e);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- }
- }
- }
-
- public boolean isLocalPageSet() {
- return page != null;
- }
-
- public void resetLocalPage() {
- page = null;
- }
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- public Object getIterationState() {
- return this.page;
- }
-
-
- public void setIterationState(Object state) {
- this.page = (Integer) state;
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import javax.faces.component.UIComponent;
-
-/**
- * @author Anton Belevich
- *
- */
-
-public class UIDataTable extends UIDataTableBase {
-
- public UIComponent getCaption() {
- return getFacet("caption");
- }
-
-}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -44,6 +44,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
+import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.event.FilteringEvent;
@@ -61,10 +62,20 @@
import org.richfaces.renderkit.MetaComponentRenderer;
import org.slf4j.Logger;
-public class UIDataTableBase extends UISequence implements Row, MetaComponentResolver,
MetaComponentEncoder {
+public abstract class UIDataTableBase extends UISequence implements Row,
MetaComponentResolver, MetaComponentEncoder {
+ public static final String COMPONENT_FAMILY = "org.richfaces.Data";
+
+ public static final String HEADER_FACET_NAME = "header";
+
+ public static final String FOOTER_FACET_NAME = "footer";
+
+ public static final String NODATA_FACET_NAME = "noData";
+
public static final String HEADER = "header";
+
public static final String FOOTER = "footer";
+
public static final String BODY = "body";
private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
@@ -78,9 +89,36 @@
}
protected enum PropertyKeys {
- filterVar, sortPriority, sortMode, first, rows, noDataLabel, selection
+ filterVar, sortPriority, sortMode, first, rows, noDataLabel, selection, header
}
+ public UIComponent getHeader() {
+ return getFacet(HEADER_FACET_NAME);
+ }
+
+ public UIComponent getFooter() {
+ return getFacet(FOOTER_FACET_NAME);
+ }
+
+ public UIComponent getNoData() {
+ return getFacet(NODATA_FACET_NAME);
+ }
+
+ @Attribute
+ public abstract String getNoDataLabel();
+
+ @Attribute
+ public abstract String getFilterVar();
+
+ @Attribute
+ public abstract Collection<Object> getSelection();
+
+ @Attribute
+ public abstract Collection<?> getSortPriority();
+
+ @Attribute
+ public abstract SortMode getSortMode();
+
public Iterator<UIComponent> columns() {
return new DataTableColumnsIterator(this);
}
@@ -93,26 +131,6 @@
return new DataTableDataIterator(this);
}
- public UIComponent getHeader() {
- return getFacet(HEADER);
- }
-
- public UIComponent getFooter() {
- return getFacet(FOOTER);
- }
-
- public UIComponent getNoData() {
- return getFacet("noData");
- }
-
- public String getNoDataLabel() {
- return (String)getStateHelper().eval(PropertyKeys.noDataLabel);
- }
-
- public void setNoDataLabel(String noDataLabel) {
- getStateHelper().put(PropertyKeys.noDataLabel, noDataLabel);
- }
-
public boolean isColumnFacetPresent(String facetName) {
Iterator<UIComponent> columns = columns();
boolean result = false;
@@ -157,8 +175,8 @@
Map<Object, SortField> sortFieldsMap = new LinkedHashMap<Object,
SortField>();
for (Iterator<UIComponent> iterator = columns(); iterator.hasNext();) {
UIComponent component = iterator.next();
- if (component instanceof UIColumn && component.isRendered()) {
- UIColumn column = (UIColumn) component;
+ if (component instanceof AbstractColumn && component.isRendered()) {
+ AbstractColumn column = (AbstractColumn) component;
FilterField filterField = column.getFilterField();
if (filterField != null) {
filterFields.add(filterField);
@@ -205,40 +223,7 @@
setRowKey(faces, key);
restoreOrigValue(faces);
}
-
- public String getFilterVar() {
- return (String) getStateHelper().eval(PropertyKeys.filterVar);
- }
-
- public void setFilterVar(String filterVar) {
- getStateHelper().put(PropertyKeys.filterVar, filterVar);
- }
-
- @SuppressWarnings("unchecked")
- public Collection<Object> getSelection() {
- return (Collection<Object>) getStateHelper().eval(PropertyKeys.selection);
- }
-
- public void setSelection(Collection<Object> selection) {
- getStateHelper().put(PropertyKeys.selection, selection);
- }
-
- public Collection<?> getSortPriority() {
- return (Collection<?>) getStateHelper().eval(PropertyKeys.sortPriority);
- }
-
- public void setSortPriority(Collection<?> sortPriority) {
- getStateHelper().put(PropertyKeys.sortPriority, sortPriority);
- }
-
- public SortMode getSortMode() {
- return (SortMode) getStateHelper().eval(PropertyKeys.sortMode, SortMode.single);
- }
-
- public void setSortMode(SortMode sortMode) {
- getStateHelper().put(PropertyKeys.sortMode, sortMode);
- }
-
+
public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
if (SUPPORTED_META_COMPONENTS.contains(metaComponentId)) {
Object oldRowKey = getRowKey();
@@ -327,7 +312,6 @@
removeFacesListener(listener);
}
-
public void addFilteringListener(FilteringListener listener) {
addFacesListener(listener);
}
Deleted:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,175 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitResult;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.context.ExtendedVisitContext;
-import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class UIExtendedDataTable extends UIDataTableBase implements
MetaComponentResolver, MetaComponentEncoder {
-
- public static final String SCROLL = "scroll";
-
- public static final String SUBMITTED_CLIENT_FIRST =
"submittedClientFirst";
-
- public static final String OLD_CLIENT_FIRST = "oldClientFirst";
-
- private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- protected enum PropertyKeys {
- clientFirst, clientRows
- }
-
- public String resolveClientId(FacesContext facesContext, UIComponent
contextComponent, String metaComponentId) {
- if (SCROLL.equals(metaComponentId)) {
- Object oldRowKey = getRowKey();
-
- try {
- setRowKey(facesContext, null);
- return getClientId(facesContext) +
MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
- } finally {
- try {
- setRowKey(facesContext, oldRowKey);
- } catch (Exception e) {
- RENDERKIT_LOG.error(e.getMessage(), e);
- }
- }
- }
-
- return super.resolveClientId(facesContext, contextComponent, metaComponentId);
- }
-
- public void encodeMetaComponent(FacesContext context, String metaComponentId) throws
IOException {
- if (SCROLL.equals(metaComponentId)) {
- Map<String, Object> attributes = getAttributes();
- Integer submittedClientFirst = (Integer)
attributes.remove(SUBMITTED_CLIENT_FIRST);
- if (submittedClientFirst != null) {
- attributes.put(OLD_CLIENT_FIRST, getClientFirst());
- setClientFirst(submittedClientFirst);
- }
- }
-
- super.encodeMetaComponent(context, metaComponentId);
- }
-
- protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback
callback, boolean visitRows) {
- if (visitContext instanceof ExtendedVisitContext && visitRows) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext)
visitContext;
-
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER)
{
- //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
- setRowKey(visitContext.getFacesContext(), null);
-
- VisitResult result;
-
- result = extendedVisitContext.invokeMetaComponentVisitCallback(this,
callback, SCROLL);
-
- if (result == VisitResult.ACCEPT) {
- //TODO nick - visit scroll?
- } else if (result == VisitResult.COMPLETE) {
- return true;
- }
- }
- }
-
- return super.visitDataChildren(visitContext, callback, visitRows);
- }
-
- protected int getActualFirst() {
- return getFirst() + getClientFirst();
- }
-
- protected int getActualRows() {
- int rows = getClientRows();
-
- if (rows > 0) {
- int r = getRows();
- if (r > 0 && r < rows) {
- rows = r;
- }
- } else {
- rows = getRows();
- }
-
- return rows;
- }
-
- public int getClientFirst() {
- return (Integer) getStateHelper().eval(PropertyKeys.clientFirst, 0);
- }
-
- public void setClientFirst(int clientFirst) {
- getStateHelper().put(PropertyKeys.clientFirst, clientFirst);
-
- updateState();
- }
-
- public void setFirst(int first) {
- super.setFirst(first);
- setClientFirst(0);
- }
-
- public int getClientRows() {
- return (Integer) getStateHelper().eval(PropertyKeys.clientRows, 0);
- }
-
- public void setClientRows(int clientRows) {
- getStateHelper().put(PropertyKeys.clientRows, clientRows);
-
- updateState();
- }
-
- public void setValueBinding(String name, javax.faces.el.ValueBinding binding) {
- super.setValueBinding(name, binding);
-
- //TODO nick - clientFirst?
- if ("clientRows".equals(name)) {
- updateState();
- }
- }
-
- public void setValueExpression(String name, ValueExpression binding) {
- super.setValueExpression(name, binding);
-
- //TODO nick - clientFirst?
- if ("clientRows".equals(name)) {
- updateState();
- }
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.application.ResourceDependency;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.richfaces.event.ToggleEvent;
-import org.richfaces.event.ToggleListener;
-
-
-@ResourceDependency(name = "subtable.js")
-public class UISubTable extends UIDataTableBase implements Column, Expandable {
-
- public static final String MODE_AJAX = "ajax";
-
- public static final String MODE_SERVER = "server";
-
- public static final String MODE_CLIENT = "client";
-
- public static final int EXPAND_STATE = 1;
-
- public static final int COLLAPSE_STATE = 0;
-
-
- enum PropertyKeys {
- expandMode, expanded, toggleExpression
- }
-
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (event instanceof ToggleEvent) {
- ToggleEvent toggleEvent = (ToggleEvent) event;
- boolean newValue = toggleEvent.isExpanded();
- getStateHelper().put(PropertyKeys.expanded, newValue);
-
- FacesContext facesContext = getFacesContext();
- ELContext elContext = facesContext.getELContext();
-
- ValueExpression valueExpression =
getValueExpression(PropertyKeys.expanded.toString());
- if (valueExpression != null &&
!valueExpression.isReadOnly(elContext)) {
- valueExpression.setValue(elContext, newValue);
- }
-
- if(getFacesContext().getPartialViewContext().isAjaxRequest()) {
- String render = resolveClientId(facesContext, this, BODY);
-
- getFacesContext().getPartialViewContext().getRenderIds().add(render);
-
- String togglerId = toggleEvent.getTogglerId();
- if(togglerId != null) {
-
getFacesContext().getPartialViewContext().getRenderIds().add(togglerId);
- }
- }
-
- }
- super.broadcast(event);
- }
-
- public boolean isExpanded() {
- return (Boolean) getStateHelper().eval(PropertyKeys.expanded, true);
- }
-
- public void setExpanded(boolean expanded) {
- getStateHelper().put(PropertyKeys.expanded, expanded);
- }
-
- public boolean isBreakBefore() {
- return true;
- }
-
- public void setBreakBefore(boolean newBreakBefore) {
- throw new IllegalStateException("Property 'breakBefore' for subtable
is read-only");
- }
-
- public String getSortExpression() {
- // SubTable is not sortable element.
- return null;
- }
-
- public void setSortExpression(String sortExpression) {
- throw new IllegalArgumentException("subtable is not sortable
element");
- }
-
- public void addToggleListener(ToggleListener listener) {
- addFacesListener(listener);
- }
-
- public void removeToggleListener(ToggleListener listener) {
- removeFacesListener(listener);
- }
-
- public ToggleListener[] getToggleListeners() {
- return (ToggleListener[]) getFacesListeners(ToggleListener.class);
- }
-
- public String getExpandMode() {
- return (String) getStateHelper().eval(PropertyKeys.expandMode, MODE_CLIENT);
- }
-
- public void setExpandMode(String expandMode) {
- getStateHelper().put(PropertyKeys.expandMode, expandMode);
- }
-
- public void setIterationState(Object stateObject) {
- Object[] state = (Object[]) stateObject;
- if (state != null) {
- super.setIterationState(state[0]);
- getStateHelper().put(PropertyKeys.expanded, state[1]);
- } else {
- super.setIterationState(null);
- getStateHelper().put(PropertyKeys.expanded, null);
- }
- }
-
- public Object getIterationState() {
- Object [] state = new Object[2];
- state[0] = super.getIterationState();
- state[1] = getStateHelper().get(PropertyKeys.expanded);
- return state;
- }
-}
-
-
Deleted:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.richfaces.component;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author Anton Belevich
- *
- */
-public class UISubTableToggleControl extends UIComponentBase {
-
- public static final String COMPONENT_TYPE =
"org.richfaces.SubTableToggleControl";
-
- public static final String COMPONENT_FAMILY =
"org.richfaces.SubTableToggleControl";
-
- enum PropertyKeys {
- expandIcon, collapseIcon, expandLabel, collapseLabel, forId, event
- }
-
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- public String getExpandLabel() {
- return (String)getStateHelper().eval(PropertyKeys.expandLabel);
- }
-
- public void setExpandLabel(String expandLabel) {
- getStateHelper().put(PropertyKeys.expandLabel, expandLabel);
- }
-
- public String getCollapseLabel() {
- return (String)getStateHelper().eval(PropertyKeys.collapseLabel);
- }
-
- public void setCollapseLabel(String collapseLabel) {
- getStateHelper().put(PropertyKeys.collapseLabel, collapseLabel);
- }
-
- public String getExpandIcon() {
- return (String) getStateHelper().eval(PropertyKeys.expandIcon, null);
- }
-
- public void setExpandIcon(String expandIcon) {
- getStateHelper().put(PropertyKeys.expandIcon, expandIcon);
- }
-
- public String getCollapseIcon() {
- return (String) getStateHelper().eval(PropertyKeys.collapseIcon, null);
- }
-
- public void setCollapseIcon(String collapseIcon) {
- getStateHelper().put(PropertyKeys.collapseIcon, collapseIcon);
- }
-
- public String getFor() {
- return (String) getStateHelper().eval(PropertyKeys.forId, null);
- }
-
- public void setFor(String forId) {
- getStateHelper().put(PropertyKeys.forId, forId);
- }
-
- public String getEvent() {
- return (String) getStateHelper().eval(PropertyKeys.event, "onclick");
-
- }
-
- public void setEvent(String event) {
- getStateHelper().put(PropertyKeys.event, event);
- }
-}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -38,7 +38,7 @@
import org.ajax4jsf.Messages;
import org.richfaces.DataScrollerUtils;
import org.richfaces.component.UIDataAdaptor;
-import org.richfaces.component.UIDataScroller;
+import org.richfaces.component.AbstractDataScroller;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
@@ -51,12 +51,12 @@
return ((source instanceof UIDataAdaptor) || (source instanceof UIData));
}
- public UIDataScroller processActiveDatascroller(FacesContext facesContext,
List<UIDataScroller> dataScrollers,
+ public AbstractDataScroller processActiveDatascroller(FacesContext facesContext,
List<AbstractDataScroller> dataScrollers,
UIComponent dataTable) {
- UIDataScroller activeComponent = null;
+ AbstractDataScroller activeComponent = null;
List<Object> values = new ArrayList<Object>(dataScrollers.size());
- String stateKey = dataTable.getClientId(facesContext) +
UIDataScroller.SCROLLER_STATE_ATTRIBUTE;
+ String stateKey = dataTable.getClientId(facesContext) +
AbstractDataScroller.SCROLLER_STATE_ATTRIBUTE;
Map<String, Object> attributes = dataTable.getAttributes();
Object pageValue = attributes.get(stateKey);
@@ -64,7 +64,7 @@
if (pageValue == null) {
- for (UIDataScroller datascroller : dataScrollers) {
+ for (AbstractDataScroller datascroller : dataScrollers) {
Object nextPageValue = null;
if (datascroller.isLocalPageSet()) {
@@ -103,13 +103,13 @@
public void processEvent(SystemEvent event) throws AbortProcessingException {
UIComponent dataTable = (UIComponent) event.getSource();
- List<UIDataScroller> dataScrollers =
DataScrollerUtils.findDataScrollers(dataTable);
+ List<AbstractDataScroller> dataScrollers =
DataScrollerUtils.findDataScrollers(dataTable);
if (!dataScrollers.isEmpty()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
- UIDataScroller activeComponent = processActiveDatascroller(facesContext,
dataScrollers, dataTable);
+ AbstractDataScroller activeComponent =
processActiveDatascroller(facesContext, dataScrollers, dataTable);
int rowCount = DataScrollerUtils.getRowCount(dataTable);
int rows = DataScrollerUtils.getRows(dataTable);
@@ -134,7 +134,7 @@
page = newPage;
dataTable.getAttributes().put(
- dataTable.getClientId(facesContext) +
UIDataScroller.SCROLLER_STATE_ATTRIBUTE, page);
+ dataTable.getClientId(facesContext) +
AbstractDataScroller.SCROLLER_STATE_ATTRIBUTE, page);
}
int first;
@@ -142,13 +142,13 @@
String lastPageMode = activeComponent.getLastPageMode();
if (lastPageMode == null) {
- lastPageMode = UIDataScroller.PAGEMODE_SHORT;
- } else if (!UIDataScroller.PAGEMODE_SHORT.equals(lastPageMode)
- && !UIDataScroller.PAGEMODE_FULL.equals(lastPageMode)) {
+ lastPageMode = AbstractDataScroller.PAGEMODE_SHORT;
+ } else if (!AbstractDataScroller.PAGEMODE_SHORT.equals(lastPageMode)
+ && !AbstractDataScroller.PAGEMODE_FULL.equals(lastPageMode)) {
throw new IllegalArgumentException("Illegal value of
'lastPageMode' attribute: '" + lastPageMode + "'");
}
- if (page != pageCount || UIDataScroller.PAGEMODE_SHORT.equals(lastPageMode))
{
+ if (page != pageCount ||
AbstractDataScroller.PAGEMODE_SHORT.equals(lastPageMode)) {
first = (page - 1) * rows;
} else {
first = rowCount - rows;
@@ -160,14 +160,14 @@
}
}
- private String getPageDifferentMessage(FacesContext facesContext, UIDataScroller
activeComponent,
- List<UIDataScroller> dataScrollers, List<Object> values) {
+ private String getPageDifferentMessage(FacesContext facesContext,
AbstractDataScroller activeComponent,
+ List<AbstractDataScroller> dataScrollers, List<Object> values) {
StringBuilder builder = new StringBuilder("\n[");
- Iterator<UIDataScroller> scrollerItr = dataScrollers.iterator();
+ Iterator<AbstractDataScroller> scrollerItr = dataScrollers.iterator();
Iterator<Object> valueItr = values.iterator();
while (scrollerItr.hasNext()) {
- UIDataScroller next = scrollerItr.next();
+ AbstractDataScroller next = scrollerItr.next();
builder.append(MessageUtil.getLabel(facesContext, next));
builder.append(": ");
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,5 +1,5 @@
/**
- * Implementation of RichFaces data lists
+ * Implementation of RichFaces iteration components
*/
-@org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/lists",
shortName="lists")
+@org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/iteration",
shortName="iteration")
package org.richfaces;
\ No newline at end of file
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -25,6 +25,8 @@
import java.io.IOException;
import javax.faces.FacesException;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -38,6 +40,12 @@
* @author Anton Belevich
*
*/
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+})
public abstract class AbstractRowsRenderer extends RendererBase implements DataVisitor {
public abstract void encodeRow(ResponseWriter writer, FacesContext facesContext,
RowHolderBase rowHolder) throws IOException;
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -54,7 +54,7 @@
public void encodeColumn(FacesContext context, ResponseWriter writer, UIColumn
component, RowHolder rowHolder) throws IOException {
String parentId = rowHolder.getParentClientId();
- if (component instanceof org.richfaces.component.UIColumn) {
+ if (component instanceof org.richfaces.component.AbstractColumn) {
Map<String, Object> attributes = component.getAttributes();
if (Boolean.TRUE.equals(attributes.get(BREAK_ROW_BEFORE)) &&
rowHolder.getProcessCell() != 0) {
encodeRowEnd(writer);
@@ -89,17 +89,17 @@
String cellClass = getCellClass(context, parentId);
encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
- if (component instanceof org.richfaces.component.UIColumn) {
+ if (component instanceof org.richfaces.component.AbstractColumn) {
Map<String, Object> attributes = component.getAttributes();
- int rowspan = (Integer) attributes.get(HTML.ROWSPAN_ATTRIBUTE);
- if (rowspan != Integer.MIN_VALUE) {
- writer.writeAttribute(HTML.ROWSPAN_ATTRIBUTE, Integer.valueOf(rowspan),
null);
+ Integer rowspan = (Integer) attributes.get(HTML.ROWSPAN_ATTRIBUTE);
+ if (rowspan != null && rowspan != Integer.MIN_VALUE) {
+ writer.writeAttribute(HTML.ROWSPAN_ATTRIBUTE, rowspan, null);
}
- int colspan = (Integer) attributes.get(HTML.COLSPAN_ATTRIBUTE);
- if (colspan != Integer.MIN_VALUE) {
- writer.writeAttribute(HTML.COLSPAN_ATTRIBUTE, Integer.valueOf(colspan),
null);
+ Integer colspan = (Integer) attributes.get(HTML.COLSPAN_ATTRIBUTE);
+ if (colspan != null && colspan != Integer.MIN_VALUE) {
+ writer.writeAttribute(HTML.COLSPAN_ATTRIBUTE, colspan, null);
}
}
}
@@ -216,7 +216,7 @@
count = currentLength;
}
currentLength = 0;
- } else if (component instanceof org.richfaces.component.UIColumn) {
+ } else if (component instanceof org.richfaces.component.AbstractColumn)
{
// For new row, save length of previsous.
Map<String, Object> attributes = component.getAttributes();
if (Boolean.TRUE.equals(attributes.get(BREAK_ROW_BEFORE))) {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -40,8 +40,10 @@
* @author Anton Belevich
*
*/
-@ResourceDependencies(value = { @ResourceDependency(library = "javax.faces",
name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"), @ResourceDependency(name = "richfaces-event.js")})
+
+@ResourceDependencies({
+ @ResourceDependency(name = "richfaces-event.js")
+})
public abstract class AbstractTableRenderer extends AbstractTableBaseRenderer implements
MetaComponentRenderer {
public static final String HIDDEN_CONTAINER_ID =":sc";
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -31,19 +31,22 @@
import javax.faces.context.ResponseWriter;
import javax.faces.event.AbortProcessingException;
-import org.richfaces.component.UIColumnGroup;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractColumnGroup;
import org.richfaces.component.UIDataTableBase;
/**
* @author Anton Belevich
*
*/
+
+(a)JsfRenderer(type="org.richfaces.ColumnGroupRenderer",
family=AbstractColumnGroup.COMPONENT_FAMILY)
public class ColumnGroupRenderer extends AbstractTableBaseRenderer {
public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase
holder) throws IOException {
RowHolder rowHolder = (RowHolder) holder;
- UIColumnGroup row = (UIColumnGroup)rowHolder.getRow();
+ AbstractColumnGroup row = (AbstractColumnGroup)rowHolder.getRow();
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
@@ -64,7 +67,7 @@
throw new AbortProcessingException("UIColumnGroup should be a child of
UIDataTable or UISubTable");
}
- RowHolder rowHolder = new RowHolder(context, (UIColumnGroup)component);
+ RowHolder rowHolder = new RowHolder(context, (AbstractColumnGroup)component);
rowHolder.setParentClientId(parent.getClientId());
return rowHolder;
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -33,8 +33,9 @@
import org.ajax4jsf.model.DataVisitResult;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDataGrid;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataGrid;
import org.richfaces.component.UIDataTableBase;
/**
@@ -42,17 +43,19 @@
*
*/
+@JsfRenderer(type = "org.richfaces.DataGridRenderer", family =
AbstractDataGrid.COMPONENT_FAMILY)
+
@ResourceDependencies({@ResourceDependency(library = "javax.faces", name =
"jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"), @ResourceDependency(name
= "richfaces-base-component.js"),
- @ResourceDependency(name = "datagrid.ecss")})
+ @ResourceDependency(library="org.richfaces", name =
"datagrid.ecss")})
public class DataGridRenderer extends AbstractRowsRenderer implements
MetaComponentRenderer {
private static final EncodeStrategy THEAD = new EncodeStrategy () {
public void begin(ResponseWriter writer, FacesContext context, UIComponent
component, Object[] params)
throws IOException {
- UIDataGrid dataGrid = (UIDataGrid)component;
+ AbstractDataGrid dataGrid = (AbstractDataGrid)component;
String clientId = dataGrid.getClientId(context) + ":h";
boolean partial = (Boolean)(Boolean)params[0];
@@ -90,7 +93,7 @@
public void begin(ResponseWriter writer, FacesContext context, UIComponent
component, Object[] params)
throws IOException {
- UIDataGrid dataGrid = (UIDataGrid)component;
+ AbstractDataGrid dataGrid = (AbstractDataGrid)component;
String clientId = dataGrid.getClientId(context) + ":f";
int columns = dataGrid.getColumns();
@@ -154,7 +157,7 @@
@Override
public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase
rowHolder) throws IOException {
- UIDataGrid dataGrid = (UIDataGrid) rowHolder.getRow();
+ AbstractDataGrid dataGrid = (AbstractDataGrid) rowHolder.getRow();
int columns = dataGrid.getColumns();
int processCell = rowHolder.getProcessCell();
@@ -175,27 +178,27 @@
writer.endElement(HTML.TD_ELEM);
}
- public void encodeHeader(ResponseWriter writer, FacesContext facesContext,
UIDataGrid dataGrid, boolean partial) throws IOException {
+ public void encodeHeader(ResponseWriter writer, FacesContext facesContext,
AbstractDataGrid dataGrid, boolean partial) throws IOException {
UIComponent headerFacet = dataGrid.getHeaderFacet();
encodeFacet(writer, facesContext, headerFacet, THEAD, dataGrid, new Object[]
{partial});
}
- public void encodeFooter(ResponseWriter writer, FacesContext facesContext, UIDataGrid
dataGrid, boolean partial) throws IOException {
+ public void encodeFooter(ResponseWriter writer, FacesContext facesContext,
AbstractDataGrid dataGrid, boolean partial) throws IOException {
UIComponent footerFacet = dataGrid.getFooterFacet();
encodeFacet(writer, facesContext, footerFacet, TFOOT, dataGrid, new Object[]
{partial});
}
- public void encodeCaption(ResponseWriter writer, FacesContext facesContext,
UIDataGrid dataGrid) throws IOException {
+ public void encodeCaption(ResponseWriter writer, FacesContext facesContext,
AbstractDataGrid dataGrid) throws IOException {
UIComponent captionFacet = dataGrid.getCaptionFacet();
encodeFacet(writer, facesContext, captionFacet, CAPTION, dataGrid, null);
}
- public void encodeNoData(ResponseWriter writer, FacesContext facesContext, UIDataGrid
dataGrid) throws IOException {
+ public void encodeNoData(ResponseWriter writer, FacesContext facesContext,
AbstractDataGrid dataGrid) throws IOException {
UIComponent noDataFacet = dataGrid.getNoDataFacet();
encodeFacet(writer, facesContext, noDataFacet, NODATA, dataGrid, null);
}
- public void encodeFacet(ResponseWriter writer, FacesContext facesContext, UIComponent
facet, EncodeStrategy strategy, UIDataGrid dataGrid, Object [] params) throws
IOException{
+ public void encodeFacet(ResponseWriter writer, FacesContext facesContext, UIComponent
facet, EncodeStrategy strategy, AbstractDataGrid dataGrid, Object [] params) throws
IOException{
if(facet != null && facet.isRendered()) {
strategy.begin(writer, facesContext, dataGrid, params);
facet.encodeAll(facesContext);
@@ -203,7 +206,7 @@
}
}
- public void encodeTBody(ResponseWriter writer, FacesContext facesContext, UIDataGrid
dataGrid, boolean partial) throws IOException {
+ public void encodeTBody(ResponseWriter writer, FacesContext facesContext,
AbstractDataGrid dataGrid, boolean partial) throws IOException {
String clientId = dataGrid.getClientId(facesContext) + ":dgb";
if(partial) {
@@ -227,7 +230,7 @@
@Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext,
UIComponent component)
throws IOException {
- UIDataGrid dataGrid = (UIDataGrid)component;
+ AbstractDataGrid dataGrid = (AbstractDataGrid)component;
writer.startElement(HTML.TABLE_ELEMENT, dataGrid);
writer.writeAttribute(HTML.ID_ATTRIBUTE, dataGrid.getClientId(facesContext),
null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-dg", null);
@@ -242,17 +245,17 @@
@Override
public RowHolderBase createRowHolder(FacesContext context, UIComponent component,
Object[] options) {
- return new RowHolder(context, (UIDataGrid)component);
+ return new RowHolder(context, (AbstractDataGrid)component);
}
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIDataGrid.class;
+ return AbstractDataGrid.class;
}
public void encodeMetaComponent(FacesContext context, UIComponent component, String
metaComponentId)
throws IOException {
- UIDataGrid table = (UIDataGrid) component;
+ AbstractDataGrid table = (AbstractDataGrid) component;
if (UIDataTableBase.HEADER.equals(metaComponentId)) {
encodeHeader(context.getResponseWriter(), context, table, true);
@@ -268,7 +271,7 @@
@Override
protected void doCleanup(FacesContext context, RowHolderBase rowHolder) throws
IOException {
ResponseWriter writer = context.getResponseWriter();
- UIDataGrid dataGrid = (UIDataGrid)rowHolder.getRow();
+ AbstractDataGrid dataGrid = (AbstractDataGrid)rowHolder.getRow();
int cell = rowHolder.getProcessCell();
int columns = dataGrid.getColumns();
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -41,7 +41,7 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIDataScroller;
+import org.richfaces.component.AbstractDataScroller;
import org.richfaces.event.DataScrollerEvent;
@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name =
"jsf-uncompressed.js"),
@@ -62,7 +62,7 @@
if (param != null) {
- UIDataScroller scroller = (UIDataScroller) component;
+ AbstractDataScroller scroller = (AbstractDataScroller) component;
int newPage = scroller.getPageForFacet(param);
int page = scroller.getPage();
@@ -246,19 +246,19 @@
String clientId = component.getClientId(context);
if (controlsState.getFirstRendered() && controlsState.getFirstEnabled())
{
- left.put(clientId + "_ds_f", UIDataScroller.FIRST_FACET_NAME);
+ left.put(clientId + "_ds_f",
AbstractDataScroller.FIRST_FACET_NAME);
}
if (controlsState.getFastRewindRendered() &&
controlsState.getFastRewindEnabled()) {
- left.put(clientId + "_ds_fr",
UIDataScroller.FAST_REWIND_FACET_NAME);
+ left.put(clientId + "_ds_fr",
AbstractDataScroller.FAST_REWIND_FACET_NAME);
}
if (controlsState.getFastForwardRendered() &&
controlsState.getFastForwardEnabled()) {
- right.put(clientId + "_ds_ff",
UIDataScroller.FAST_FORWARD_FACET_NAME);
+ right.put(clientId + "_ds_ff",
AbstractDataScroller.FAST_FORWARD_FACET_NAME);
}
if (controlsState.getLastRendered() && controlsState.getLastEnabled()) {
- right.put(clientId + "_ds_l", UIDataScroller.LAST_FACET_NAME);
+ right.put(clientId + "_ds_l",
AbstractDataScroller.LAST_FACET_NAME);
}
if (!left.isEmpty()) {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -38,24 +38,28 @@
import org.ajax4jsf.renderkit.AjaxEventOptions;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDataTable;
+import org.richfaces.component.AbstractSubTable;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UISubTable;
import org.richfaces.component.util.HtmlUtil;
/**
* @author Anton Belevich
*/
-@ResourceDependencies({@ResourceDependency(library = "javax.faces", name =
"jsf.js"),
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
- @ResourceDependency(name = "richfaces-event.js"), @ResourceDependency(name
= "richfaces-base-component.js"),
- @ResourceDependency(name = "datatable.js"), @ResourceDependency(name =
"datatable.ecss")})
+
+@JsfRenderer(type = "org.richfaces.DataTableRenderer", family =
AbstractDataTable.COMPONENT_FAMILY)
+@ResourceDependencies({
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library="org.richfaces", name =
"datatable.js"),
+ @ResourceDependency(library="org.richfaces", name =
"datatable.ecss")
+})
public class DataTableRenderer extends AbstractTableRenderer {
private class DataTableHiddenEncodeStrategy implements EncodeStrategy {
public void begin(ResponseWriter writer, FacesContext context, UIComponent
component, Object[] params) throws IOException {
- UIDataTable dataTable = (UIDataTable)component;
+ AbstractDataTable dataTable = (AbstractDataTable)component;
writer.startElement(HTML.TBODY_ELEMENT, dataTable);
writer.writeAttribute(HTML.ID_ATTRIBUTE, dataTable.getClientId(context) +
HIDDEN_CONTAINER_ID, null);
@@ -74,7 +78,7 @@
private class RichHeaderEncodeStrategy implements EncodeStrategy {
public void begin(ResponseWriter writer, FacesContext context, UIComponent
component, Object [] params) throws IOException {
- org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)
component;
+ org.richfaces.component.AbstractColumn column =
(org.richfaces.component.AbstractColumn) component;
writer.writeAttribute(HTML.ID_ATTRIBUTE, column.getClientId(context), null);
if (isSortable(column)) {
@@ -85,7 +89,7 @@
}
public void end(ResponseWriter writer, FacesContext context, UIComponent
component, Object [] params) throws IOException {
- org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn)
component;
+ org.richfaces.component.AbstractColumn column =
(org.richfaces.component.AbstractColumn) component;
if (isSortable(column)) {
writer.endElement(HTML.SPAN_ELEM);
}
@@ -94,8 +98,8 @@
public void encodeTableStructure(ResponseWriter writer, FacesContext context,
UIDataTableBase dataTable)
throws IOException {
- if (dataTable instanceof UIDataTable) {
- encodeCaption(writer, context, (UIDataTable) dataTable);
+ if (dataTable instanceof AbstractDataTable) {
+ encodeCaption(writer, context, (AbstractDataTable) dataTable);
// TODO nick - do we need this element if "columnsWidth" is
absent?
writer.startElement(HTML.COLGROUP_ELEMENT, dataTable);
@@ -143,7 +147,7 @@
RowHolder rowHolder = (RowHolder) holder;
Row row = rowHolder.getRow();
- UIDataTable dataTable = (UIDataTable)row;
+ AbstractDataTable dataTable = (AbstractDataTable)row;
boolean partialUpdate = rowHolder.isUpdatePartial();
boolean parentTbodyStart = rowHolder.isEncodeParentTBody();
@@ -156,7 +160,7 @@
UIComponent child = components.next();
if(child instanceof Row) {
- boolean isSubtable = (child instanceof UISubTable);
+ boolean isSubtable = (child instanceof AbstractSubTable);
//new row -> close </tr>
if (rowHolder.getProcessCell() != 0) {
encodeRowEnd(writer);
@@ -235,10 +239,10 @@
}
protected Class<? extends UIComponent> getComponentClass() {
- return UIDataTable.class;
+ return AbstractDataTable.class;
}
- public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTable
dataTable) throws IOException {
+ public void encodeCaption(ResponseWriter writer, FacesContext context,
AbstractDataTable dataTable) throws IOException {
UIComponent caption = dataTable.getCaption();
if (caption == null) {
@@ -268,7 +272,7 @@
}
public EncodeStrategy getHeaderEncodeStrategy(UIComponent column, String facetName)
{
- return (column instanceof org.richfaces.component.UIColumn &&
UIDataTableBase.HEADER.equals(facetName)) ? new RichHeaderEncodeStrategy() : new
SimpleHeaderEncodeStrategy();
+ return (column instanceof org.richfaces.component.AbstractColumn &&
UIDataTableBase.HEADER.equals(facetName)) ? new RichHeaderEncodeStrategy() : new
SimpleHeaderEncodeStrategy();
}
public boolean containsThead() {
@@ -276,15 +280,15 @@
}
public boolean isSortable(UIColumn column) {
- if (column instanceof org.richfaces.component.UIColumn) {
+ if (column instanceof org.richfaces.component.AbstractColumn) {
//TODO: anton - add check for the "comparator" property
- return ((org.richfaces.component.UIColumn)
column).getValueExpression("sortBy") != null;
+ return ((org.richfaces.component.AbstractColumn)
column).getValueExpression("sortBy") != null;
}
return false;
}
public void encodeClientScript(ResponseWriter writer, FacesContext facesContext,
UIDataTableBase dataTableBase) throws IOException {
- UIDataTable dataTable = (UIDataTable) dataTableBase;
+ AbstractDataTable dataTable = (AbstractDataTable) dataTableBase;
writer.startElement(HTML.SCRIPT_ELEM, dataTable);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.JAVASCRIPT_TYPE, null);
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -54,8 +54,9 @@
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractExtendedDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.context.OnOffResponseWriter;
import org.richfaces.model.SelectionMode;
@@ -64,10 +65,14 @@
* @author Konstantin Mishin
*
*/
-@ResourceDependencies({@ResourceDependency(name = "extendedDataTable.ecss"),
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "jquery.position.js"), @ResourceDependency(name
= "richfaces.js"),
- @ResourceDependency(name = "extendedDataTable.js") })
+
+
+@JsfRenderer(type = "org.richfaces.ExtendedDataTableRenderer", family =
AbstractExtendedDataTable.COMPONENT_FAMILY)
+@ResourceDependencies({
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(library="org.richfaces", name =
"extendedDataTable.ecss"),
+ @ResourceDependency(library="org.richfaces", name =
"extendedDataTable.js")
+})
public class ExtendedDataTableRenderer extends SelectionRenderer implements
MetaComponentRenderer {
private static enum PartName {
@@ -437,16 +442,16 @@
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIExtendedDataTable.class;
+ return AbstractExtendedDataTable.class;
}
public void encodeMetaComponent(FacesContext context, UIComponent component, String
metaComponentId)
throws IOException {
- UIExtendedDataTable table = (UIExtendedDataTable) component;
- if (UIExtendedDataTable.SCROLL.equals(metaComponentId)) {
+ AbstractExtendedDataTable table = (AbstractExtendedDataTable) component;
+ if (AbstractExtendedDataTable.SCROLL.equals(metaComponentId)) {
final PartialResponseWriter writer =
context.getPartialViewContext().getPartialResponseWriter();
int clientFirst = table.getClientFirst();
- Integer oldClientFirst = (Integer)
table.getAttributes().remove(UIExtendedDataTable.OLD_CLIENT_FIRST);
+ Integer oldClientFirst = (Integer)
table.getAttributes().remove(AbstractExtendedDataTable.OLD_CLIENT_FIRST);
if (oldClientFirst == null) {
oldClientFirst = clientFirst;
}
@@ -821,9 +826,9 @@
Integer value = Integer.valueOf(clientFirst);
Map<String, Object> attributes = component.getAttributes();
if (!value.equals(attributes.get("clientFirst"))) {
- attributes.put(UIExtendedDataTable.SUBMITTED_CLIENT_FIRST, value);
+ attributes.put(AbstractExtendedDataTable.SUBMITTED_CLIENT_FIRST, value);
context.getPartialViewContext().getRenderIds().add(
- component.getClientId(context) + "@" +
UIExtendedDataTable.SCROLL);
+ component.getClientId(context) + "@" +
AbstractExtendedDataTable.SCROLL);
}
}
}
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -43,6 +43,7 @@
* @author Anton Belevich
*
*/
+
public abstract class SortingFilteringRowsRenderer extends AbstractRowsRenderer {
private static final String FILTERING_STRING = "rich:filtering";
@@ -58,7 +59,6 @@
private static final String SEPARATOR = ":";
protected void decodeSortingFiltering(FacesContext context, UIComponent component) {
-
if(component instanceof UIDataTableBase) {
UIDataTableBase dataTableBase = (UIDataTableBase)component;
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -28,6 +28,7 @@
import java.util.Iterator;
import java.util.Map;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -37,16 +38,20 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDataTable;
+import org.richfaces.component.AbstractSubTable;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UISubTable;
import org.richfaces.event.ToggleEvent;
/**
* @author Anton Belevich
*
*/
+
+@JsfRenderer(type = "org.richfaces.SubTableRenderer", family =
AbstractSubTable.COMPONENT_FAMILY)
+(a)ResourceDependency(library="org.richfaces", name = "subtable.js")
public class SubTableRenderer extends AbstractTableRenderer {
public static final String TB_ROW = ":c";
@@ -60,7 +65,7 @@
private class SubTableHiddenEncodeStrategy implements EncodeStrategy {
public void begin(ResponseWriter writer, FacesContext context, UIComponent
component, Object[] params) throws IOException {
- UISubTable subTable = (UISubTable)component;
+ AbstractSubTable subTable = (AbstractSubTable)component;
writer.startElement(HTML.TR_ELEMENT, subTable);
writer.writeAttribute(HTML.ID_ATTRIBUTE, subTable.getClientId(context) +
HIDDEN_CONTAINER_ID, null);
writer.writeAttribute(HTML.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
@@ -82,7 +87,7 @@
};
protected void doDecode(FacesContext facesContext, UIComponent component) {
- UISubTable subTable = (UISubTable)component;
+ AbstractSubTable subTable = (AbstractSubTable)component;
String clientId = subTable.getClientId(facesContext);
Map<String, String> requestMap =
facesContext.getExternalContext().getRequestParameterMap();
@@ -124,7 +129,7 @@
}
public void encodeTableFacets(ResponseWriter writer, FacesContext context,
UIDataTableBase dataTable) throws IOException {
- UISubTable subTable = (UISubTable)dataTable;
+ AbstractSubTable subTable = (AbstractSubTable)dataTable;
encodeHeaderFacet(writer, context, subTable, false);
@@ -141,10 +146,10 @@
@Override
public void encodeTableBodyStart(ResponseWriter writer, FacesContext facesContext,
UIDataTableBase dataTableBase) throws IOException {
- UISubTable subTable = (UISubTable)dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable)dataTableBase;
UIDataTableBase component = findParent(subTable);
- if(component instanceof UIDataTable) {
+ if(component instanceof AbstractDataTable) {
writer.startElement(HTML.TBODY_ELEMENT, null);
writer.writeAttribute(HTML.ID_ATTRIBUTE,
component.getRelativeClientId(facesContext) + ":" + subTable.getId() + TB_ROW,
null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, getTableSkinClass(), null);
@@ -156,14 +161,14 @@
@Override
public void encodeBeforeRows(ResponseWriter writer, FacesContext facesContext,
UIDataTableBase dataTableBase, boolean encodeParentTBody, boolean partialUpdate) throws
IOException {
- UISubTable subTable = (UISubTable)dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable)dataTableBase;
encodeTableBodyStart(writer, facesContext, subTable);
encodeSubTableDomElement(writer, facesContext, subTable);
setupTableStartElement(facesContext, subTable);
encodeHeaderFacet(writer, facesContext, subTable, false);
}
- private void encodeSubTableDomElement(ResponseWriter writer, FacesContext
facesContext, UISubTable subTable) throws IOException{
+ private void encodeSubTableDomElement(ResponseWriter writer, FacesContext
facesContext, AbstractSubTable subTable) throws IOException{
writer.startElement(HTML.TR_ELEMENT, subTable);
writer.writeAttribute(HTML.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
writer.writeAttribute(HTML.ID_ATTRIBUTE, subTable.getClientId(facesContext),
null);
@@ -179,7 +184,7 @@
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
if (rowHolder.isUpdatePartial()) {
- partialStart(facesContext,((UISubTable)
row).getRelativeClientId(facesContext) + ":b");
+ partialStart(facesContext,((AbstractSubTable)
row).getRelativeClientId(facesContext) + ":b");
}
while (components.hasNext()) {
@@ -188,7 +193,7 @@
if(component instanceof UIColumn) {
encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
- } else if (component instanceof UISubTable) {
+ } else if (component instanceof AbstractSubTable) {
if(component.isRendered()) {
encodeRowEnd(writer);
}
@@ -208,19 +213,19 @@
@Override
public void encodeAfterRows(ResponseWriter writer, FacesContext facesContext,
UIDataTableBase dataTableBase,
boolean encodeParentTBody, boolean partialUpdate) throws IOException {
- UISubTable subTable = (UISubTable)dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable)dataTableBase;
encodeFooterFacet(writer, facesContext, subTable, false);
}
@Override
public boolean encodeParentTBody(UIDataTableBase dataTableBase) {
- UIDataTableBase parent = findParent((UISubTable)dataTableBase);
- return (parent instanceof UIDataTable);
+ UIDataTableBase parent = findParent((AbstractSubTable)dataTableBase);
+ return (parent instanceof AbstractDataTable);
}
public void encodeHiddenInput(ResponseWriter writer, FacesContext facesContext,
UIDataTableBase dataTableBase)
throws IOException {
- UISubTable subTable = (UISubTable) dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable) dataTableBase;
String stateId = subTable.getClientId(facesContext) + STATE;
@@ -229,7 +234,7 @@
writer.writeAttribute(HTML.NAME_ATTRIBUTE, stateId, null);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- int state = subTable.isExpanded() ? UISubTable.EXPAND_STATE :
UISubTable.COLLAPSE_STATE;
+ int state = subTable.isExpanded() ? AbstractSubTable.EXPAND_STATE :
AbstractSubTable.COLLAPSE_STATE;
writer.writeAttribute(HTML.VALUE_ATTRIBUTE, state, null);
writer.endElement(HTML.INPUT_ELEM);
@@ -255,7 +260,7 @@
public void encodeClientScript(ResponseWriter writer, FacesContext facesContext,
UIDataTableBase component)
throws IOException {
- UISubTable subTable = (UISubTable) component;
+ AbstractSubTable subTable = (AbstractSubTable) component;
String id = subTable.getClientId(facesContext);
@@ -362,10 +367,10 @@
@Override
public void encodeMetaComponent(FacesContext facesContext, UIComponent component,
String metaComponentId)
throws IOException {
- UISubTable subTable = (UISubTable)component;
+ AbstractSubTable subTable = (AbstractSubTable)component;
setupTableStartElement(facesContext, subTable);
- if(UISubTable.BODY.equals(metaComponentId)) {
+ if(AbstractSubTable.BODY.equals(metaComponentId)) {
ResponseWriter writer = facesContext.getResponseWriter();
UIDataTableBase dataTableBase = findParent(subTable);
@@ -386,7 +391,7 @@
setupTableStartElement(context, component, HTML.TD_ELEM);
}
- protected UIDataTableBase findParent(UISubTable subTable) {
+ protected UIDataTableBase findParent(AbstractSubTable subTable) {
UIComponent parent = subTable.getParent();
while(parent != null && !(parent instanceof UIDataTableBase)) {
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -35,21 +35,23 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UISubTable;
-import org.richfaces.component.UISubTableToggleControl;
+import org.richfaces.component.AbstractSubTable;
+import org.richfaces.component.AbstarctSubTableToggleControl;
/**
* @author Anton Belevich
*/
+
+
@ResourceDependencies({@ResourceDependency(library = "javax.faces", name =
"jsf.js"),
@ResourceDependency(name = "richfaces.js"), @ResourceDependency(name =
"subtable-toggler.js")})
public class SubTableToggleControlRendererBase extends RendererBase {
private static final String DISPLAY_NONE = "display: none;";
- private static final String UP_ICON_URL = "up_icon.gif";
+ private static final String UP_ICON_URL = "org.richfaces:up_icon.gif";
- private static final String DOWN_ICON_URL = "down_icon.gif";
+ private static final String DOWN_ICON_URL = "org.richfaces:down_icon.gif";
private static final String EXPAND_STATE = "expand";
@@ -61,8 +63,8 @@
}
protected void encodeControl(FacesContext context, UIComponent component) throws
IOException {
- UISubTableToggleControl toggleControl = (UISubTableToggleControl) component;
- UISubTable subTable = findComponent(context, toggleControl);
+ AbstarctSubTableToggleControl toggleControl = (AbstarctSubTableToggleControl)
component;
+ AbstractSubTable subTable = findComponent(context, toggleControl);
if (subTable != null) {
String switchType = subTable.getExpandMode();
@@ -84,7 +86,7 @@
}
}
- protected void encodeControl(FacesContext context, ResponseWriter writer,
UISubTableToggleControl control,
+ protected void encodeControl(FacesContext context, ResponseWriter writer,
AbstarctSubTableToggleControl control,
String switchType, boolean expanded, boolean visible)
throws IOException {
String state = getState(expanded);
String styleClass = getStyleClass(context, control);
@@ -155,7 +157,7 @@
writer.endElement(HTML.SPAN_ELEM);
}
- public HashMap<String, Object> encodeOptions(FacesContext context,
UISubTableToggleControl toggleControl, UISubTable subTable) {
+ public HashMap<String, Object> encodeOptions(FacesContext context,
AbstarctSubTableToggleControl toggleControl, AbstractSubTable subTable) {
String forId = subTable.getClientId(context);
String toggleControlId = toggleControl.getClientId(context);
@@ -170,21 +172,21 @@
return options;
}
- public String getStyleClass(FacesContext context, UISubTableToggleControl control) {
+ public String getStyleClass(FacesContext context, AbstarctSubTableToggleControl
control) {
return null;
}
- public String getStyle(FacesContext context, UISubTableToggleControl control) {
+ public String getStyle(FacesContext context, AbstarctSubTableToggleControl control)
{
return null;
}
- protected UISubTable findComponent(FacesContext context, UISubTableToggleControl
toggleControl) {
+ protected AbstractSubTable findComponent(FacesContext context,
AbstarctSubTableToggleControl toggleControl) {
String forId = toggleControl.getFor();
if (forId != null && forId.length() > 0) {
UIComponent subTable = getUtils().findComponentFor(context, toggleControl,
forId);
- if (subTable instanceof UISubTable) {
- return (UISubTable) subTable;
+ if (subTable instanceof AbstractSubTable) {
+ return (AbstractSubTable) subTable;
}
}
return null;
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
(rev 0)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.taglib;
+
+import javax.el.ValueExpression;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractDataScroller;
+
+/**
+ * Created 11.03.2008
+ *
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class DataScrollerHandler extends ComponentHandler {
+
+ private static final MetaRule PAGERULE = new MetaRule() {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
+ if ("page".equals(name)) {
+ return new PageMapper(attribute);
+ } else {
+ return null;
+ }
+ }
+ };
+
+ private static final MetaRule SCROLL_LISTENER_RULE = new MetaRule() {
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
+ if (meta.isTargetInstanceOf(AbstractDataScroller.class)) {
+ if ("scrollListener".equals(name)) {
+ return new ScrollListenerMapper(attribute);
+ }
+ }
+ return null;
+ }
+
+ };
+
+ private static final class ScrollListenerMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] {
org.richfaces.event.DataScrollerEvent.class };
+
+ private final TagAttribute attribute;
+
+ public ScrollListenerMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+
+ ((AbstractDataScroller) instance).addScrollerListener((new
MethodExpressionScrollListener(this.attribute
+ .getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+
+ private static final class PageMapper extends Metadata {
+
+ private final TagAttribute page;
+
+ public PageMapper(TagAttribute attribute) {
+ page = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ AbstractDataScroller datascroller = (AbstractDataScroller) instance;
+
+ ValueExpression ve = page.getValueExpression(ctx, int.class);
+ if (ve.isLiteralText()) {
+ Integer value = (Integer)
ve.getValue(ctx.getFacesContext().getELContext());
+ datascroller.setPage(value);
+ } else {
+ datascroller.setValueExpression("page", ve);
+ }
+ }
+
+ }
+
+ public DataScrollerHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset ruleset = super.createMetaRuleset(type);
+ ruleset.addRule(PAGERULE);
+ ruleset.addRule(SCROLL_LISTENER_RULE);
+ ruleset.alias("for", "forComponent");
+ return ruleset;
+ }
+}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -32,7 +32,7 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.UIDataTable;
+import org.richfaces.component.AbstractDataTable;
/**
* @author Anton Belevich
@@ -55,7 +55,7 @@
static class SortingFilteringRule extends MetaRule {
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if(meta.isTargetInstanceOf(UIDataTable.class)) {
+ if(meta.isTargetInstanceOf(AbstractDataTable.class)) {
if("sortingListener".equals(name)) {
return new SortingListenerMapper(attribute);
@@ -81,7 +81,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIDataTable) instance).addSortingListener(new
MethodExpressionSortingListener(this.attribute.getMethodExpression(ctx, null,
SIGNATURE)));
+ ((AbstractDataTable) instance).addSortingListener(new
MethodExpressionSortingListener(this.attribute.getMethodExpression(ctx, null,
SIGNATURE)));
}
}
@@ -96,7 +96,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIDataTable) instance).addFilteringListener(new
MethodExpressionFilteringListener(this.attribute.getMethodExpression(ctx, null,
SIGNATURE)));
+ ((AbstractDataTable) instance).addFilteringListener(new
MethodExpressionFilteringListener(this.attribute.getMethodExpression(ctx, null,
SIGNATURE)));
}
}
}
Deleted:
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.taglib;
-
-import javax.el.ValueExpression;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-
-import org.richfaces.component.UIDataScroller;
-
-/**
- * Created 11.03.2008
- *
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public class DatascrollerTagHandler extends ComponentHandler {
-
- private static final MetaRule PAGERULE = new MetaRule() {
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if ("page".equals(name)) {
- return new PageMapper(attribute);
- } else {
- return null;
- }
- }
- };
-
- private static final MetaRule SCROLL_LISTENER_RULE = new MetaRule() {
-
- @Override
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if (meta.isTargetInstanceOf(UIDataScroller.class)) {
- if ("scrollListener".equals(name)) {
- return new ScrollListenerMapper(attribute);
- }
- }
- return null;
- }
-
- };
-
- private static final class ScrollListenerMapper extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] {
org.richfaces.event.DataScrollerEvent.class };
-
- private final TagAttribute attribute;
-
- public ScrollListenerMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- @Override
- public void applyMetadata(FaceletContext ctx, Object instance) {
-
- ((UIDataScroller) instance).addScrollerListener((new
MethodExpressionScrollListener(this.attribute
- .getMethodExpression(ctx, null, SIGNATURE))));
- }
- }
-
- private static final class PageMapper extends Metadata {
-
- private final TagAttribute page;
-
- public PageMapper(TagAttribute attribute) {
- page = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- UIDataScroller datascroller = (UIDataScroller) instance;
-
- ValueExpression ve = page.getValueExpression(ctx, int.class);
- if (ve.isLiteralText()) {
- Integer value = (Integer)
ve.getValue(ctx.getFacesContext().getELContext());
- datascroller.setPage(value);
- } else {
- datascroller.setValueExpression("page", ve);
- }
- }
-
- }
-
- public DatascrollerTagHandler(ComponentConfig config) {
- super(config);
- }
-
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset ruleset = super.createMetaRuleset(type);
- ruleset.addRule(PAGERULE);
- ruleset.addRule(SCROLL_LISTENER_RULE);
- ruleset.alias("for", "forComponent");
- return ruleset;
- }
-}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java
===================================================================
---
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -32,7 +32,7 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.UISubTable;
+import org.richfaces.component.AbstractSubTable;
/**
* @author Anton Belevich
@@ -56,7 +56,7 @@
static class SubTableHandlerMetaRule extends MetaRule {
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget
meta) {
- if (meta.isTargetInstanceOf(UISubTable.class) &&
"toggleListener".equals(name)) {
+ if (meta.isTargetInstanceOf(AbstractSubTable.class) &&
"toggleListener".equals(name)) {
return new SubTableMapper(attribute);
}
return null;
@@ -75,7 +75,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UISubTable) instance).addToggleListener((new
MethodExpressionToggleListener(this.attribute.getMethodExpression(ctx, null,
SIGNATURE))));
+ ((AbstractSubTable) instance).addToggleListener((new
MethodExpressionToggleListener(this.attribute.getMethodExpression(ctx, null,
SIGNATURE))));
}
}
}
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
-<faces-config version="2.0" metadata-complete="false"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:cdk="http://richfaces.org/cdk/extensions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <name>richfaces</name>
- <application>
- <system-event-listener>
- <system-event-listener-class>org.richfaces.event.DataTablePreRenderListener</system-event-listener-class>
- <system-event-class>javax.faces.event.PreRenderComponentEvent</system-event-class>
- </system-event-listener>
- </application>
- <render-kit>
- <render-kit-id>HTML_BASIC</render-kit-id>
- <renderer>
- <component-family>org.richfaces.DataScroller</component-family>
- <renderer-type>org.richfaces.DataScrollerRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.DataScrollerRenderer</renderer-class>
- </renderer>
- </render-kit>
-</faces-config>
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<facelet-taglib
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
- version="2.0" id="a4j">
- <
namespace>http://richfaces.org/datascroller</namespace>
- <tag>
- <tag-name>dataScroller</tag-name>
- <component>
- <component-type>org.richfaces.DataScroller</component-type>
- <renderer-type>org.richfaces.DataScrollerRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.DatascrollerTagHandler</handler-class>
- </component>
- </tag>
-</facelet-taglib>
Deleted:
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage
===================================================================
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage.resource
===================================================================
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,100 +0,0 @@
-.rf-dg{
- background-color:'#{richSkin.tableBackgroundColor}';
- border-collapse:collapse;
- border-left-width:'#{richSkin.tableBorderWidth}';
- border-left-style:solid;
- border-left-color:'#{richSkin.tableBorderColor}';
- border-top-width:'#{richSkin.tableBorderWidth}';
- border-top-style:solid;
- border-top-color:'#{richSkin.tableBorderColor}';
- empty-cells:show;
-}
-
-.rf-dg-nd-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-
-.rf-dg-cap{
-}
-
-.rf-dg-r{
-}
-
-.rf-dg-f-r{
-}
-
-.rf-dg-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-dg-h{
-}
-
-.rf-dg-h-f{
-}
-
-.rf-dg-h-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color : '#{richSkin.tableHeaderBackgroundColor}';
- background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
- background-position: top left;
- color:'#{richSkin.tableHeaderTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-dg-th{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
-}
-
-.rf-dg-f {
-
-}
-
-.rf-dg-f-f{
-}
-
-.rf-dg-f-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableFooterBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,271 +0,0 @@
-.rf-dt{
- background-color:'#{richSkin.tableBackgroundColor}';
- border-collapse:collapse;
- border-left-width:'#{richSkin.tableBorderWidth}';
- border-left-style:solid;
- border-left-color:'#{richSkin.tableBorderColor}';
- border-top-width:'#{richSkin.tableBorderWidth}';
- border-top-style:solid;
- border-top-color:'#{richSkin.tableBorderColor}';
- empty-cells:show;
-}
-
-.rf-dt-cap{
-}
-
-.rf-dt-r{
-}
-
-.rf-dt-f-r{
-}
-
-.rf-dt-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-dt-nd-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-dt-h{
-}
-
-.rf-dt-h-f{
-}
-
-.rf-dt-h-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color : '#{richSkin.tableHeaderBackgroundColor}';
- background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
- background-position: top left;
- color:'#{richSkin.tableHeaderTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-dt-sh {
-}
-
-.rf-dt-sh-f {
-}
-
-.rf-dt-sh-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color : '#{richSkin.tableHeaderBackgroundColor}';
- background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
- background-position: top left;
- color:'#{richSkin.tableHeaderTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-dt-sf{
-}
-
-.rf-dt-sf-f{
-}
-
-.rf-dt-sf-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubfooterBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-
-
-}
-
-.rf-dt-th{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
-}
-
-.rf-dt-f {
-
-}
-
-.rf-dt-f-f{
-}
-
-.rf-dt-f-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableFooterBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-st{
-}
-
-.rf-st-r{
-}
-
-.rf-st-f-r{
-}
-
-.rf-st-h-r{
-}
-
-.rf-st-h-f-r{
-}
-
-.rf-st-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-st-h-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:left;
-}
-
-.rf-st-sh-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
-}
-
-.rf-st-sh{
-}
-
-.rf-st-f {
-}
-
-.rf-st-f-c{
- border-bottom-width:3px;
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubfooterBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size: '#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:left;
-}
-
-.rf-st-sf-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubfooterBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-st-sf{
-}
-
-.rf-st-sf-f{
-}
-
-.rf-st-sh-f{
-}
-
-.rf-st-f-f{
-}
-
-.rf-st-h-f{
-}
-
-.rf-st-h{
-}
-
-
-/*should be generated in M1*/
-.rf-stt-exp{
- background-image: url("#{resource['up_icon.gif']}");
-}
-
-.rf-stt-col{
- background-image: url("#{resource['down_icon.gif']}");
-}
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,105 +0,0 @@
-(function ($, richfaces) {
-
- richfaces.ui = richfaces.ui || {};
-
- richfaces.ui.DataTable = function(id, options) {
- this.id = id;
- this.options = options;
- $super.constructor.call(this,id);
- this.attachToDom(id);
-
- };
-
- var $super = richfaces.BaseComponent.extend(richfaces.ui.DataTable);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.DataTable, {});
- var $super = richfaces.ui.DataTable.$super;
-
- $.extend(richfaces.ui.DataTable, {
- SORTING: "rich:sorting",
- FILTERING: "rich:filtering",
- SUBTABLE_SELECTOR:".rich-subtable"
- });
-
- $.extend(richfaces.ui.DataTable.prototype, ( function () {
-
- var invoke = function(event, attributes) {
- richfaces.ajax(this.id, event, {"parameters" : attributes});
- };
-
- var createParameters = function(type, id, arg1, arg2) {
- var parameters = {};
- var key = this.id + type;
- parameters[key] = ((id || "") + ":" + (arg1 ||
"") + ":" + (arg2 || true));
-
- var eventOptions = this.options.ajaxEventOption;
- for (key in eventOptions) {
- if(!parameters[key]) {
- parameters[key] = eventOptions[key];
- }
- }
- return parameters;
- };
-
-
- return {
-
- name : "RichFaces.ui.DataTable",
-
- sort: function(columnId, direction, isClear) {
-
invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.SORTING,
columnId, direction, isClear));
- },
-
- filter: function(columnId, filterValue, isClear) {
-
invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.FILTERING,
columnId, filterValue, isClear));
- },
-
- expandAllSubTables: function() {
- this.invokeOnSubTables('expand');
- },
-
- collapseAllSubTables: function() {
- this.invokeOnSubTables('collapse');
- },
-
- switchSubTable: function(id) {
- this.getSubTable(id).toggle();
- },
-
- getSubTable: function(id) {
- return richfaces.$(id);
- },
-
- invokeOnSubTables: function(funcName) {
- var elements =
$(document.getElementById(this.id)).children(richfaces.ui.DataTable.SUBTABLE_SELECTOR);
- var invokeOnComponent = this.invokeOnComponent;
- elements.each(
- function(){
- if(this.richfaces && this.richfaces.component) {
- var component = this.richfaces.component;
- if(component instanceof RichFaces.ui.SubTable) {
- invokeOnComponent(component, funcName);
- }
- }
- }
- );
- },
-
- invokeOnSubTable: function(id, funcName) {
- var subtable = this.getSubTable(id);
- this.invokeOnComponent(subtable, funcName);
- },
-
- invokeOnComponent: function(component, funcName) {
- if(component) {
- var func = component[funcName];
- if(typeof func == 'function') {
- func.call(component);
- }
- }
- }
- }
-
- })());
-
-})(jQuery, window.RichFaces);
-
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/down_icon.gif
===================================================================
(Binary files differ)
Deleted:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-.rf-edt {
- overflow: hidden;
- background-color: '#{richSkin.tableBackgroundColor}';
- border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-h, .rf-edt-th {
- background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
-}
-
-.rf-edt-th {
- border-bottom: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
-}
-
-.rf-edt-b {
- overflow-x: hidden;
- overflow-y: auto;
- width: 100%;
-}
-
-.rf-edt-s {
- height: 0px;
- font-size: 0px; /*for IE7 only*/
-}
-
-.rf-edt-f, .rf-edt-tf {
- border-top: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
- background-color: '#{richSkin.tableFooterBackgroundColor}';
-}
-
-.rf-edt-fa {
- vertical-align: top;
-}
-
-.rf-edt-p {
- overflow: hidden;
-}
-
-.rf-edt-fp {
- overflow-x: auto;
- overflow-y: visible;
-}
-
-.rf-edt-rsh {
- left : 0px;
- position: relative;
- height: 0px;
-}
-
-.rf-edt-rs {
- background-image: url("#{resource['spacer.gif']}");
- cursor: e-resize;
- height: 20px; /*TODO*/
- position: absolute;
- left: 100%;
- margin-left: -3px;
- width: 6px;
-}
-
-.rf-edt-d {
- cursor: e-resize;
- position: absolute;
- border-left: '1px dotted #{richSkin.generalTextColor}';
- /*background-color: #848089;*/
- width: 1px;
- display: none;
-}
-
-.rf-edt-ro {
- position: absolute;
- border-collapse: collapse;
- display: none;
-}
-
-.rf-edt-ro th {
- width: 20px;
- height: 5px;
- font-size: 1px;
- background-color: '#{richSkin.tableHeaderBackgroundColor}';
- border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-ro td {
- width: 20px;
- height: 5px;
- font-size: 1px;
- background-color: '#{richSkin.tableBackgroundColor}';
- border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-c, .rf-edt-hc, .rf-edt-fc {
- height: 20px;
- overflow: hidden;
- border-bottom: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
- border-right: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
-}
-
-.rf-edt-efc {
- border-right: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
- height: 1px;
-}
-
-.rf-edt-cc, .rf-edt-hcc, .rf-edt-fcc, .rf-edt-th, .rf-edt-tf {
- padding: 3px 7px;
- white-space: nowrap;
- font-family: '#{richSkin.generalFamilyFont}';
- font-size: '#{richSkin.generalSizeFont}';
-}
-
-.rf-edt-hcc, .rf-edt-th, .rf-edt-fcc, .rf-edt-tf {
- font-weight: bold;
- text-align: center;
-}
-
-.rf-edt-hcc, .rf-edt-th {
- color: '#{richSkin.tableHeaderTextColor}';
-}
-
-.rf-edt-cc, .rf-edt-fcc, .rf-edt-tf {
- color: '#{richSkin.generalTextColor}';
-}
-
-.rf-edt-rom {
- position: absolute;
- height: 9px;
- font-size: 9px;
- width: 9px;
- background-image: url("#{resource['reorderMarker.gif']}");
- display: none;
-}
-
-.rf-edt-r-s {
- background-color: '#{richSkin.additionalBackgroundColor}'; /*TODO Probably use
other skin property.*/
-}
-
-.rf-edt-r-a {
- font-weight: bold; /*TODO Probably use other property.*/
-}
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,694 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-(function(richfaces, jQuery) {
- richfaces.utils = richfaces.utils || {};
-
- richfaces.utils.getCSSRule = function (className) {
- var rule = null;
- var sheets = document.styleSheets;
- for (var j = 0; !rule && j < sheets.length; j++) {
- var rules = sheets[j].cssRules ? sheets[j].cssRules : sheets[j].rules;
- for (var i = 0; !rule && i < rules.length; i++) {
- if (rules[i].selectorText && rules[i].selectorText.toLowerCase() ==
className.toLowerCase()) {
- rule = rules[i];
- }
- }
- }
- return rule;
- };
-
- richfaces.utils.Ranges = function() {
- this.ranges = [];
- };
-
- richfaces.utils.Ranges.prototype = {
-
- add: function(index) {
- var i = 0;
- while(i < this.ranges.length && index >= this.ranges[i++][1]);
- i--;
- if(this.ranges[i-1] && index==(this.ranges[i-1][1]+1) ) {
- if(index==(this.ranges[i][0]-1)) {
- this.ranges[i-1][1] = this.ranges[i][1];
- this.ranges.splice(i, 1);
- } else {
- this.ranges[i-1][1]++;
- }
- } else {
- if(this.ranges[i]){
- if(this.ranges[i] && index==(this.ranges[i][0]-1)) {
- this.ranges[i][0]--;
- } else {
- if(index==(this.ranges[i][1]+1)){
- this.ranges[i][1]++;
- } else {
- if(index<this.ranges[i][1]){
- this.ranges.splice(i, 0, [index, index]);
- } else {
- this.ranges.splice(i + 1, 0, [index, index]);
- }
- }
- }
- } else {
- this.ranges.splice(i, 0, [index, index]);
- }
- }
- },
-
- remove: function(index) {
- var i = 0;
- while(i < this.ranges.length && index > this.ranges[i++][1]);
- i--;
- if(this.ranges[i]) {
- if(index==(this.ranges[i][1]) ) {
- if(index==(this.ranges[i][0])){
- this.ranges.splice(i, 1);
- } else {
- this.ranges[i][1]--;
- }
- } else {
- if(index==(this.ranges[i][0])){
- this.ranges[i][0]++;
- } else {
- this.ranges.splice(i+1, 0, [index+1, this.ranges[i][1]]);
- this.ranges[i][1] = index-1;
- }
- }
- }
- },
-
- clear: function() {
- this.ranges = [];
- },
-
- contains: function(index) {
- var i = 0;
- while(i < this.ranges.length && index >= this.ranges[i][0]) {
- if(index >= this.ranges[i][0] && index <= this.ranges[i][1]) {
- return true;
- } else {
- i++;
- }
- }
- return false;
- },
-
- toString: function() {
- var ret = new Array(this.ranges.length);
- for (var i = 0; i < this.ranges.length; i++) {
- ret[i] = this.ranges[i].join();
- }
- return ret.join(";");
- }
- };
-
- richfaces.ExtendedDataTable = function(id, rowCount, ajaxFunction, options) {
- var WIDTH_CLASS_NAME_BASE = "rf-edt-cw-";
- var MIN_WIDTH = 20;
-
- options = options || {};
- var ranges = new richfaces.utils.Ranges();
- var element = document.getElementById(id);
- var bodyElement, contentElement, spacerElement, dataTableElement, rows, rowHeight,
parts, tbodies, shiftIndex,
- activeIndex, selectionFlag;
- var dragElement = document.getElementById(id + ":d");
- var reorderElement = document.getElementById(id + ":r");
- var reorderMarkerElement = document.getElementById(id + ":rm");
- var widthInput = document.getElementById(id + ":wi");
- var selectionInput = document.getElementById(id + ":si");
- var normalPartStyle = richfaces.utils.getCSSRule(".rf-edt-pw").style;
- var header = jQuery(element).children(".rf-edt-h");
- var resizerHolders = header.find(".rf-edt-rsh");
-
- var frozenHeaderPartElement = document.getElementById(id + ":frozenHeader");
- var frozenColumnCount = frozenHeaderPartElement ?
frozenHeaderPartElement.firstChild.rows[0].cells.length : 0;//TODO
Richfaces.firstDescendant;
-
- var scrollElement = document.getElementById(id + ":footer");
-
- var resizeData = {};
- var idOfReorderingColumn = "";
- var newWidths = {};
-
- var timeoutId = null;
-
- var sendAjax = function(event, map) {
- for (key in options.parameters) {
- if(!map[key]) {
- map[key] = options.parameters[key];
- }
- }
- ajaxFunction(event, map);
- };
-
- var updateLayout = function() {
- normalPartStyle.width = "auto";
- var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
- var width = Math.max(0, element.clientWidth - offsetWidth);
- if (width) {
- if (parts.width() > width) {
- normalPartStyle.width = width + "px";
- }
- normalPartStyle.display = "block";
- if (scrollElement.clientWidth < scrollElement.scrollWidth
- && scrollElement.scrollHeight == scrollElement.offsetHeight) {
- scrollElement.style.overflowX = "scroll";
- } else {
- scrollElement.style.overflowX = "";
- }
- var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
- if (delta) {
- scrollElement.style.height = scrollElement.offsetHeight + delta;
- }
- } else {
- normalPartStyle.display = "none";
- }
- var height = element.clientHeight;
- var el = element.firstChild;
- while (el) {
- if(el.nodeName && el.nodeName.toUpperCase() == "DIV" && el
!= bodyElement) {
- height -= el.offsetHeight;
- }
- el = el.nextSibling;
- }
- if (bodyElement.offsetHeight > height) {
- bodyElement.style.height = height + "px";
- }
- };
-
- var adjustResizers = function() {
- var scrollLeft = scrollElement ? scrollElement.scrollLeft : 0;
- var clientWidth = element.clientWidth - 3;
- var i = 0;
- for (; i < frozenColumnCount; i++) {
- if (clientWidth > 0) {
- resizerHolders[i].style.display = "none";
- resizerHolders[i].style.display = "";
- clientWidth -= resizerHolders[i].offsetWidth;
- }
- if (clientWidth <= 0) {
- resizerHolders[i].style.display = "none";
- }
- }
- scrollLeft -= 3;
- for (; i < resizerHolders.length; i++) {
- if (clientWidth > 0) {
- resizerHolders[i].style.display = "none";
- if (scrollLeft > 0) {
- resizerHolders[i].style.display = "";
- scrollLeft -= resizerHolders[i].offsetWidth;
- if (scrollLeft > 0) {
- resizerHolders[i].style.display = "none";
- } else {
- clientWidth += scrollLeft;
- }
- } else {
- resizerHolders[i].style.display = "";
- clientWidth -= resizerHolders[i].offsetWidth;
- }
- }
- if (clientWidth <= 0) {
- resizerHolders[i].style.display = "none";
- }
- }
- };
-
- var updateScrollPosition = function() {
- if (scrollElement) {
- var scrollLeft = scrollElement.scrollLeft;
- parts.each(function() {
- this.scrollLeft = scrollLeft;
- });
- }
- adjustResizers();
- };
-
- var initialize = function() {
- bodyElement = document.getElementById(id + ":b");
- bodyElement.tabIndex = -1; //TODO don't use tabIndex.
- var bodyJQuery = jQuery(bodyElement);
- contentElement = bodyJQuery.children("div:first")[0];
- if (contentElement) {
- spacerElement = contentElement.firstChild;//TODO this.marginElement =
Richfaces.firstDescendant(this.contentElement);
- dataTableElement = contentElement.lastChild;//TODO this.dataTableElement =
Richfaces.lastDescendant(this.contentElement);
- tbodies = jQuery(document.getElementById(id +
":tbf")).add(document.getElementById(id + ":tbn"));
- rows = tbodies[0].rows.length;
- rowHeight = dataTableElement.offsetHeight / rows;
- if (rowCount != rows) {
- contentElement.style.height = (rowCount * rowHeight) + "px";
- }
- bodyJQuery.bind("scroll", bodyScrollListener);
- if (options.selectionMode != "none") {
- tbodies.bind("click", selectionClickListener);
- bodyJQuery.bind(window.opera ? "keypress" : "keydown",
selectionKeyDownListener);
- initializeSelection();
- }
- } else {
- spacerElement = null;
- dataTableElement = null;
- }
- parts = jQuery(element).find(".rf-edt-p");
- updateLayout();
- updateScrollPosition(); //TODO Restore horizontal scroll position
- };
-
- var drag = function(event) {
- jQuery(dragElement).setPosition({left:Math.max(resizeData.left + MIN_WIDTH,
event.pageX)});
- return false;
- };
-
- var beginResize = function(event) {
- var id = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
- resizeData = {
- id : id,
- left : jQuery(this).parent().offset().left
- };
- dragElement.style.height = element.offsetHeight + "px";
- jQuery(dragElement).setPosition({top:jQuery(element).offset().top,
left:event.pageX});
- dragElement.style.display = "block";
- jQuery(document).bind("mousemove", drag);
- jQuery(document).one("mouseup", endResize);
- return false;
- };
-
- var setColumnWidth = function(id, width) {
- width = width + "px";
- richfaces.utils.getCSSRule("." + WIDTH_CLASS_NAME_BASE + id).style.width =
width;
- newWidths[id] = width;
- var widthsArray = new Array();
- for (var id in newWidths) {
- widthsArray.push(id + ":" + newWidths[id]);
- }
- widthInput.value = widthsArray.toString();
- updateLayout();
- adjustResizers();
- sendAjax(); // TODO Maybe, event model should be used here.
- };
-
- var endResize = function(event) {
- jQuery(document).unbind("mousemove", drag);
- dragElement.style.display = "none";
- var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left);
- setColumnWidth(resizeData.id, width);
- };
-
- var reorder = function(event) {
- jQuery(reorderElement).setPosition(event, {offset:[5,5]});
- reorderElement.style.display = "block";
- return false;
- };
-
- var beginReorder = function(event) {
- idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
- jQuery(document).bind("mousemove", reorder);
- header.find(".rf-edt-hc").bind("mouseover", overReorder);
- jQuery(document).one("mouseup", cancelReorder);
- return false;
- };
-
- var overReorder = function(event) {
- if (idOfReorderingColumn != this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1]) {
- var thisElement = jQuery(this);
- var offset = thisElement.offset();
- jQuery(reorderMarkerElement).setPosition({top:offset.top + thisElement.height(),
left:offset.left - 5});
- reorderMarkerElement.style.display = "block";
- thisElement.one("mouseout", outReorder);
- thisElement.one("mouseup", endReorder);
- }
- };
-
- var outReorder = function(event) {
- reorderMarkerElement.style.display = "";
- jQuery(this).unbind("mouseup", endReorder);
- };
-
- var endReorder = function(event) {
- reorderMarkerElement.style.display = "";
- jQuery(this).unbind("mouseout", outReorder);
- var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
- var colunmsOrder = "";
- header.find(".rf-edt-hc").each(function() {
- var i = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
- if (i == id) {
- colunmsOrder += idOfReorderingColumn + "," + id + ",";
- } else if (i != idOfReorderingColumn) {
- colunmsOrder += i + ",";
- }
- });
- sendAjax(event, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event
model should be used here.
- };
-
- var cancelReorder = function(event) {
- jQuery(document).unbind("mousemove", reorder);
- header.find(".rf-edt-hc").unbind("mouseover", overReorder);
- reorderElement.style.display = "none";
- };
-
- var loadData = function(event) {
- var clientFirst = Math.round((bodyElement.scrollTop + bodyElement.clientHeight / 2) /
(rowHeight) - rows / 2);
- if (clientFirst <= 0) {
- clientFirst = 0;
- } else {
- clientFirst = Math.min(rowCount - rows, clientFirst);
- }
- sendAjax(event, {"rich:clientFirst" : clientFirst});// TODO Maybe, event
model should be used here.
- }
-
- var bodyScrollListener = function(event) {
- if(timeoutId) {
- window.clearTimeout(timeoutId);
- timeoutId = null;
- }
- if (Math.max(this.scrollTop - rowHeight, 0) < spacerElement.offsetHeight
- || Math.min(this.scrollTop + rowHeight + this.clientHeight, this.scrollHeight) >
spacerElement.offsetHeight + dataTableElement.offsetHeight) {
- timeoutId = window.setTimeout(function (event) {loadData(event)}, 1000);
- }
- };
-
- var showActiveRow = function() {
- if (bodyElement.scrollTop > activeIndex * rowHeight + spacerElement.offsetHeight) {
//UP
- bodyElement.scrollTop = Math.max(bodyElement.scrollTop - rowHeight, 0);
- } else if (bodyElement.scrollTop + bodyElement.clientHeight
- < (activeIndex + 1) * rowHeight + spacerElement.offsetHeight) { //DOWN
- bodyElement.scrollTop = Math.min(bodyElement.scrollTop + rowHeight,
bodyElement.scrollHeight - bodyElement.clientHeight);
- }
- }
-
- var selectRow = function(index) {
- ranges.add(index);
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[index]).addClass("rf-edt-r-s");
- }
- }
-
- var deselectRow = function (index) {
- ranges.remove(index);
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[index]).removeClass("rf-edt-r-s");
- }
- }
-
- var setActiveRow = function (index) {
- if(typeof activeIndex == "number") {
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[activeIndex]).removeClass("rf-edt-r-a");
- }
-
- }
- activeIndex = index;
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[activeIndex]).addClass("rf-edt-r-a");
- }
- }
-
- var resetShiftRow = function () {
- if(typeof shiftIndex == "number") {
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[shiftIndex]).removeClass("rf-edt-r-t");
- }
-
- }
- shiftIndex = null;
- }
-
- var setShiftRow = function (index) {
- resetShiftRow();
- shiftIndex = index;
- if(typeof index == "number") {
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[shiftIndex]).addClass("rf-edt-r-t");
- }
- }
- }
-
- var initializeSelection = function() {
- ranges.clear();
- var strings = selectionInput.value.split("|");
- activeIndex = strings[1] || null;
- shiftIndex = strings[2] || null;
- selectionFlag = null;
- var rows = tbodies[0].rows;
- for (var i = 0; i < rows.length; i++) {
- var row = jQuery(rows[i]);
- if (row.hasClass("rf-edt-r-s")) {
- ranges.add(row[0].rowIndex)
- }
- if (row.hasClass("rf-edt-r-a")) {
- activeIndex = row[0].rowIndex;
- }
- if (row.hasClass("rf-edt-r-t")) {
- shiftIndex = row[0].rowIndex;
- }
- }
- writeSelection();
- }
-
- var writeSelection = function() {
- selectionInput.value = [ranges, activeIndex, shiftIndex,
selectionFlag].join("|");
- }
-
- var selectRows = function(range) {
- if (typeof range == "number") {
- range = [range, range];
- }
- var changed;
- var i = 0;
- for (; i < range[0]; i++) {
- if (ranges.contains(i)) {
- deselectRow(i);
- changed = true;
- }
- }
- for (; i <= range[1]; i++) {
- if (!ranges.contains(i)) {
- selectRow(i);
- changed = true;
- }
- }
- for (; i < rows; i++) {
- if (ranges.contains(i)) {
- deselectRow(i);
- changed = true;
- }
- }
- selectionFlag = typeof shiftIndex == "string" ? shiftIndex : "x";
- return changed;
- }
-
- var processSlectionWithShiftKey = function(index) {
- if(shiftIndex == null) {
- setShiftRow(activeIndex != null ? activeIndex : index);
- }
- var range;
- if ("u" == shiftIndex) {
- range = [0, index];
- } else if ("d" == shiftIndex) {
- range = [index, rows - 1];
- } else if (index >= shiftIndex) {
- range = [shiftIndex, index];
- } else {
- range = [index, shiftIndex];
- }
- return selectRows(range);
- }
-
- var onbeforeselectionchange = function (event) {
- return !options.onbeforeselectionchange ||
options.onbeforeselectionchange.call(element, event) !== false;
- }
-
- var onselectionchange = function (event, index, changed) {
- if(!event.shiftKey) {
- resetShiftRow();
- }
- if (activeIndex != index) {
- setActiveRow(index);
- showActiveRow();
- }
- if (changed) {
- writeSelection();
- if (options.onselectionchange) {
- options.onselectionchange.call(element, event);
- }
- }
- }
-
- var selectionClickListener = function (event) {
- if (!onbeforeselectionchange(event)) {
- return;
- }
- var changed;
- if (event.shiftKey || event.ctrlKey) {
- if (window.getSelection) { //TODO Try to find other way.
- window.getSelection().removeAllRanges();
- } else if (document.selection) {
- document.selection.empty();
- }
- }
- var tr = event.target;
- while (tbodies.index(tr.parentNode) == -1) {
- tr = tr.parentNode;
- }
- var index = tr.rowIndex;
- if (options.selectionMode == "single" || (options.selectionMode !=
"multipleKeyboardFree"
- && !event.shiftKey && !event.ctrlKey)) {
- changed = selectRows(index);
- } else if (options.selectionMode == "multipleKeyboardFree" ||
(!event.shiftKey && event.ctrlKey)) {
- if (ranges.contains(index)) {
- deselectRow(index);
- } else {
- selectRow(index);
- }
- changed = true;
- } else {
- changed = processSlectionWithShiftKey(index);
- }
- onselectionchange(event, index, changed);
- }
-
- var selectionKeyDownListener = function(event) {
- if (event.ctrlKey && options.selectionMode != "single" &&
(event.keyCode == 65 || event.keyCode == 97) //Ctrl-A
- && onbeforeselectionchange(event)) {
- selectRows([0, rows]);
- selectionFlag = "a";
- onselectionchange(event, activeIndex, true); //TODO Is there a way to know that
selection haven't changed?
- event.preventDefault();
- } else {
- var index;
- if (event.keyCode == 38) { //UP
- index = -1;
- } else if (event.keyCode == 40) { //DOWN
- index = 1;
- }
- if (index != null && onbeforeselectionchange(event)) {
- if (typeof activeIndex == "number") {
- index += activeIndex;
- if (index >= 0 && index < rows ) {
- var changed;
- if (options.selectionMode == "single" || (!event.shiftKey &&
!event.ctrlKey)) {
- changed = selectRows(index);
- } else if (event.shiftKey) {
- changed = processSlectionWithShiftKey(index);
- }
- onselectionchange(event, index, changed);
- }
- }
- event.preventDefault();
- }
- }
- }
-
- var ajaxComplete = function (event, data) {
- if (data.reinitializeHeader) {
- bindHeaderHandlers();
- } else {
- selectionInput = document.getElementById(id + ":si");
- if (data.reinitializeBody) {
- rowCount = data.rowCount;
- initialize();
- } else if (options.selectionMode != "none") {
- initializeSelection();
- }
- if (spacerElement) {
- spacerElement.style.height = (data.first * rowHeight) + "px";
- }
- }
- };
-
- jQuery(document).ready(initialize);
- jQuery(window).bind("resize", updateLayout);
- jQuery(scrollElement).bind("scroll", updateScrollPosition);
- var bindHeaderHandlers = function () {
- header.find(".rf-edt-rs").bind("mousedown", beginResize);
- header.find(".rf-edt-hc").bind("mousedown", beginReorder);
- }
- bindHeaderHandlers();
- jQuery(element).bind("rich:onajaxcomplete", ajaxComplete);
-
- //JS API
- element["richfaces"] = element["richfaces"] || {}; // TODO
ExtendedDataTable should extend richfaces.BaseComponent instead of using it.
- element.richfaces.component = this;
-
- this.getColumnPosition = function(id) {
- var position;
- var headers = header.find(".rf-edt-hc");
- for (var i = 0; i < headers.length; i++) {
- if (id == headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1]) {
- position = i;
- }
- }
- return position;
- }
-
- this.setColumnPosition = function(id, position) {
- var colunmsOrder = "";
- var before;
- var headers = header.find(".rf-edt-hc");
- for (var i = 0; i < headers.length; i++) {
- var current = headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
- if (i == position) {
- if (before) {
- colunmsOrder += current + "," + id + ",";
- } else {
- colunmsOrder += id + "," + current + ",";
- }
- } else {
- if (id != current) {
- colunmsOrder += current + ",";
- } else {
- before = true;
- }
- }
- }
- sendAjax(null, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event
model should be used here.
- }
-
- this.setColumnWidth = function(id, width) {
- setColumnWidth(id, width);
- }
-
- this.filter = function(colunmId, filterValue, isClear) {
- if (typeof(filterValue) == "undefined" || filterValue == null) {
- filterValue = "";
- }
- var map = {}
- map[id + "rich:filtering"] = colunmId + ":" + filterValue +
":" + isClear;
- sendAjax(null, map); // TODO Maybe, event model should be used here.
- }
-
- this.clearFiltering = function() {
- this.filter("", "", true);
- }
-
- this.sort = function(colunmId, sortOrder, isClear) {
- if (typeof(sortOrder) == "string") {
- sortOrder = sortOrder.toUpperCase();
- }
- var map = {}
- map[id + "rich:sorting"] = colunmId + ":" + sortOrder +
":" + isClear;
- sendAjax(null, map); // TODO Maybe, event model should be used here.
- }
-
- this.clearSorting = function() {
- this.filter("", "", true);
- }
- };
-}(window.RichFaces, jQuery));
-
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,100 @@
+.rf-dg{
+ background-color:'#{richSkin.tableBackgroundColor}';
+ border-collapse:collapse;
+ border-left-width:'#{richSkin.tableBorderWidth}';
+ border-left-style:solid;
+ border-left-color:'#{richSkin.tableBorderColor}';
+ border-top-width:'#{richSkin.tableBorderWidth}';
+ border-top-style:solid;
+ border-top-color:'#{richSkin.tableBorderColor}';
+ empty-cells:show;
+}
+
+.rf-dg-nd-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+
+.rf-dg-cap{
+}
+
+.rf-dg-r{
+}
+
+.rf-dg-f-r{
+}
+
+.rf-dg-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-dg-h{
+}
+
+.rf-dg-h-f{
+}
+
+.rf-dg-h-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color : '#{richSkin.tableHeaderBackgroundColor}';
+ background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+ background-position: top left;
+ color:'#{richSkin.tableHeaderTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-dg-th{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+}
+
+.rf-dg-f {
+
+}
+
+.rf-dg-f-f{
+}
+
+.rf-dg-f-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
\ No newline at end of file
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,271 @@
+.rf-dt{
+ background-color:'#{richSkin.tableBackgroundColor}';
+ border-collapse:collapse;
+ border-left-width:'#{richSkin.tableBorderWidth}';
+ border-left-style:solid;
+ border-left-color:'#{richSkin.tableBorderColor}';
+ border-top-width:'#{richSkin.tableBorderWidth}';
+ border-top-style:solid;
+ border-top-color:'#{richSkin.tableBorderColor}';
+ empty-cells:show;
+}
+
+.rf-dt-cap{
+}
+
+.rf-dt-r{
+}
+
+.rf-dt-f-r{
+}
+
+.rf-dt-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-dt-nd-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-dt-h{
+}
+
+.rf-dt-h-f{
+}
+
+.rf-dt-h-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color : '#{richSkin.tableHeaderBackgroundColor}';
+ background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+ background-position: top left;
+ color:'#{richSkin.tableHeaderTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-dt-sh {
+}
+
+.rf-dt-sh-f {
+}
+
+.rf-dt-sh-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color : '#{richSkin.tableHeaderBackgroundColor}';
+ background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+ background-position: top left;
+ color:'#{richSkin.tableHeaderTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-dt-sf{
+}
+
+.rf-dt-sf-f{
+}
+
+.rf-dt-sf-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubfooterBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+
+
+}
+
+.rf-dt-th{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+}
+
+.rf-dt-f {
+
+}
+
+.rf-dt-f-f{
+}
+
+.rf-dt-f-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-st{
+}
+
+.rf-st-r{
+}
+
+.rf-st-f-r{
+}
+
+.rf-st-h-r{
+}
+
+.rf-st-h-f-r{
+}
+
+.rf-st-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-st-h-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:left;
+}
+
+.rf-st-sh-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+}
+
+.rf-st-sh{
+}
+
+.rf-st-f {
+}
+
+.rf-st-f-c{
+ border-bottom-width:3px;
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubfooterBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:left;
+}
+
+.rf-st-sf-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubfooterBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-st-sf{
+}
+
+.rf-st-sf-f{
+}
+
+.rf-st-sh-f{
+}
+
+.rf-st-f-f{
+}
+
+.rf-st-h-f{
+}
+
+.rf-st-h{
+}
+
+
+/*should be generated in M1*/
+.rf-stt-exp{
+ background-image: url("#{resource['org.richfaces:up_icon.gif']}");
+}
+
+.rf-stt-col{
+ background-image: url("#{resource['org.richfaces:down_icon.gif']}");
+}
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,105 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.DataTable = function(id, options) {
+ this.id = id;
+ this.options = options;
+ $super.constructor.call(this,id);
+ this.attachToDom(id);
+
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.DataTable);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.DataTable, {});
+ var $super = richfaces.ui.DataTable.$super;
+
+ $.extend(richfaces.ui.DataTable, {
+ SORTING: "rich:sorting",
+ FILTERING: "rich:filtering",
+ SUBTABLE_SELECTOR:".rich-subtable"
+ });
+
+ $.extend(richfaces.ui.DataTable.prototype, ( function () {
+
+ var invoke = function(event, attributes) {
+ richfaces.ajax(this.id, event, {"parameters" : attributes});
+ };
+
+ var createParameters = function(type, id, arg1, arg2) {
+ var parameters = {};
+ var key = this.id + type;
+ parameters[key] = ((id || "") + ":" + (arg1 ||
"") + ":" + (arg2 || true));
+
+ var eventOptions = this.options.ajaxEventOption;
+ for (key in eventOptions) {
+ if(!parameters[key]) {
+ parameters[key] = eventOptions[key];
+ }
+ }
+ return parameters;
+ };
+
+
+ return {
+
+ name : "RichFaces.ui.DataTable",
+
+ sort: function(columnId, direction, isClear) {
+
invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.SORTING,
columnId, direction, isClear));
+ },
+
+ filter: function(columnId, filterValue, isClear) {
+
invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.FILTERING,
columnId, filterValue, isClear));
+ },
+
+ expandAllSubTables: function() {
+ this.invokeOnSubTables('expand');
+ },
+
+ collapseAllSubTables: function() {
+ this.invokeOnSubTables('collapse');
+ },
+
+ switchSubTable: function(id) {
+ this.getSubTable(id).toggle();
+ },
+
+ getSubTable: function(id) {
+ return richfaces.$(id);
+ },
+
+ invokeOnSubTables: function(funcName) {
+ var elements =
$(document.getElementById(this.id)).children(richfaces.ui.DataTable.SUBTABLE_SELECTOR);
+ var invokeOnComponent = this.invokeOnComponent;
+ elements.each(
+ function(){
+ if(this.richfaces && this.richfaces.component) {
+ var component = this.richfaces.component;
+ if(component instanceof RichFaces.ui.SubTable) {
+ invokeOnComponent(component, funcName);
+ }
+ }
+ }
+ );
+ },
+
+ invokeOnSubTable: function(id, funcName) {
+ var subtable = this.getSubTable(id);
+ this.invokeOnComponent(subtable, funcName);
+ },
+
+ invokeOnComponent: function(component, funcName) {
+ if(component) {
+ var func = component[funcName];
+ if(typeof func == 'function') {
+ func.call(component);
+ }
+ }
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
+
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/down_icon.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/down_icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+.rf-edt {
+ overflow: hidden;
+ background-color: '#{richSkin.tableBackgroundColor}';
+ border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-h, .rf-edt-th {
+ background-image :
"url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+}
+
+.rf-edt-th {
+ border-bottom: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
+}
+
+.rf-edt-b {
+ overflow-x: hidden;
+ overflow-y: auto;
+ width: 100%;
+}
+
+.rf-edt-s {
+ height: 0px;
+ font-size: 0px; /*for IE7 only*/
+}
+
+.rf-edt-f, .rf-edt-tf {
+ border-top: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+ background-color: '#{richSkin.tableFooterBackgroundColor}';
+}
+
+.rf-edt-fa {
+ vertical-align: top;
+}
+
+.rf-edt-p {
+ overflow: hidden;
+}
+
+.rf-edt-fp {
+ overflow-x: auto;
+ overflow-y: visible;
+}
+
+.rf-edt-rsh {
+ left : 0px;
+ position: relative;
+ height: 0px;
+}
+
+.rf-edt-rs {
+ background-image: url("#{resource['spacer.gif']}");
+ cursor: e-resize;
+ height: 20px; /*TODO*/
+ position: absolute;
+ left: 100%;
+ margin-left: -3px;
+ width: 6px;
+}
+
+.rf-edt-d {
+ cursor: e-resize;
+ position: absolute;
+ border-left: '1px dotted #{richSkin.generalTextColor}';
+ /*background-color: #848089;*/
+ width: 1px;
+ display: none;
+}
+
+.rf-edt-ro {
+ position: absolute;
+ border-collapse: collapse;
+ display: none;
+}
+
+.rf-edt-ro th {
+ width: 20px;
+ height: 5px;
+ font-size: 1px;
+ background-color: '#{richSkin.tableHeaderBackgroundColor}';
+ border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-ro td {
+ width: 20px;
+ height: 5px;
+ font-size: 1px;
+ background-color: '#{richSkin.tableBackgroundColor}';
+ border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-c, .rf-edt-hc, .rf-edt-fc {
+ height: 20px;
+ overflow: hidden;
+ border-bottom: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
+ border-right: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
+}
+
+.rf-edt-efc {
+ border-right: '#{richSkin.tableBorderWidth} solid
#{richSkin.tableBorderColor}';
+ height: 1px;
+}
+
+.rf-edt-cc, .rf-edt-hcc, .rf-edt-fcc, .rf-edt-th, .rf-edt-tf {
+ padding: 3px 7px;
+ white-space: nowrap;
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+}
+
+.rf-edt-hcc, .rf-edt-th, .rf-edt-fcc, .rf-edt-tf {
+ font-weight: bold;
+ text-align: center;
+}
+
+.rf-edt-hcc, .rf-edt-th {
+ color: '#{richSkin.tableHeaderTextColor}';
+}
+
+.rf-edt-cc, .rf-edt-fcc, .rf-edt-tf {
+ color: '#{richSkin.generalTextColor}';
+}
+
+.rf-edt-rom {
+ position: absolute;
+ height: 9px;
+ font-size: 9px;
+ width: 9px;
+ background-image: url("#{resource['reorderMarker.gif']}");
+ display: none;
+}
+
+.rf-edt-r-s {
+ background-color: '#{richSkin.additionalBackgroundColor}'; /*TODO Probably use
other skin property.*/
+}
+
+.rf-edt-r-a {
+ font-weight: bold; /*TODO Probably use other property.*/
+}
\ No newline at end of file
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,694 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+(function(richfaces, jQuery) {
+ richfaces.utils = richfaces.utils || {};
+
+ richfaces.utils.getCSSRule = function (className) {
+ var rule = null;
+ var sheets = document.styleSheets;
+ for (var j = 0; !rule && j < sheets.length; j++) {
+ var rules = sheets[j].cssRules ? sheets[j].cssRules : sheets[j].rules;
+ for (var i = 0; !rule && i < rules.length; i++) {
+ if (rules[i].selectorText && rules[i].selectorText.toLowerCase() ==
className.toLowerCase()) {
+ rule = rules[i];
+ }
+ }
+ }
+ return rule;
+ };
+
+ richfaces.utils.Ranges = function() {
+ this.ranges = [];
+ };
+
+ richfaces.utils.Ranges.prototype = {
+
+ add: function(index) {
+ var i = 0;
+ while(i < this.ranges.length && index >= this.ranges[i++][1]);
+ i--;
+ if(this.ranges[i-1] && index==(this.ranges[i-1][1]+1) ) {
+ if(index==(this.ranges[i][0]-1)) {
+ this.ranges[i-1][1] = this.ranges[i][1];
+ this.ranges.splice(i, 1);
+ } else {
+ this.ranges[i-1][1]++;
+ }
+ } else {
+ if(this.ranges[i]){
+ if(this.ranges[i] && index==(this.ranges[i][0]-1)) {
+ this.ranges[i][0]--;
+ } else {
+ if(index==(this.ranges[i][1]+1)){
+ this.ranges[i][1]++;
+ } else {
+ if(index<this.ranges[i][1]){
+ this.ranges.splice(i, 0, [index, index]);
+ } else {
+ this.ranges.splice(i + 1, 0, [index, index]);
+ }
+ }
+ }
+ } else {
+ this.ranges.splice(i, 0, [index, index]);
+ }
+ }
+ },
+
+ remove: function(index) {
+ var i = 0;
+ while(i < this.ranges.length && index > this.ranges[i++][1]);
+ i--;
+ if(this.ranges[i]) {
+ if(index==(this.ranges[i][1]) ) {
+ if(index==(this.ranges[i][0])){
+ this.ranges.splice(i, 1);
+ } else {
+ this.ranges[i][1]--;
+ }
+ } else {
+ if(index==(this.ranges[i][0])){
+ this.ranges[i][0]++;
+ } else {
+ this.ranges.splice(i+1, 0, [index+1, this.ranges[i][1]]);
+ this.ranges[i][1] = index-1;
+ }
+ }
+ }
+ },
+
+ clear: function() {
+ this.ranges = [];
+ },
+
+ contains: function(index) {
+ var i = 0;
+ while(i < this.ranges.length && index >= this.ranges[i][0]) {
+ if(index >= this.ranges[i][0] && index <= this.ranges[i][1]) {
+ return true;
+ } else {
+ i++;
+ }
+ }
+ return false;
+ },
+
+ toString: function() {
+ var ret = new Array(this.ranges.length);
+ for (var i = 0; i < this.ranges.length; i++) {
+ ret[i] = this.ranges[i].join();
+ }
+ return ret.join(";");
+ }
+ };
+
+ richfaces.ExtendedDataTable = function(id, rowCount, ajaxFunction, options) {
+ var WIDTH_CLASS_NAME_BASE = "rf-edt-cw-";
+ var MIN_WIDTH = 20;
+
+ options = options || {};
+ var ranges = new richfaces.utils.Ranges();
+ var element = document.getElementById(id);
+ var bodyElement, contentElement, spacerElement, dataTableElement, rows, rowHeight,
parts, tbodies, shiftIndex,
+ activeIndex, selectionFlag;
+ var dragElement = document.getElementById(id + ":d");
+ var reorderElement = document.getElementById(id + ":r");
+ var reorderMarkerElement = document.getElementById(id + ":rm");
+ var widthInput = document.getElementById(id + ":wi");
+ var selectionInput = document.getElementById(id + ":si");
+ var normalPartStyle = richfaces.utils.getCSSRule(".rf-edt-pw").style;
+ var header = jQuery(element).children(".rf-edt-h");
+ var resizerHolders = header.find(".rf-edt-rsh");
+
+ var frozenHeaderPartElement = document.getElementById(id + ":frozenHeader");
+ var frozenColumnCount = frozenHeaderPartElement ?
frozenHeaderPartElement.firstChild.rows[0].cells.length : 0;//TODO
Richfaces.firstDescendant;
+
+ var scrollElement = document.getElementById(id + ":footer");
+
+ var resizeData = {};
+ var idOfReorderingColumn = "";
+ var newWidths = {};
+
+ var timeoutId = null;
+
+ var sendAjax = function(event, map) {
+ for (key in options.parameters) {
+ if(!map[key]) {
+ map[key] = options.parameters[key];
+ }
+ }
+ ajaxFunction(event, map);
+ };
+
+ var updateLayout = function() {
+ normalPartStyle.width = "auto";
+ var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
+ var width = Math.max(0, element.clientWidth - offsetWidth);
+ if (width) {
+ if (parts.width() > width) {
+ normalPartStyle.width = width + "px";
+ }
+ normalPartStyle.display = "block";
+ if (scrollElement.clientWidth < scrollElement.scrollWidth
+ && scrollElement.scrollHeight == scrollElement.offsetHeight) {
+ scrollElement.style.overflowX = "scroll";
+ } else {
+ scrollElement.style.overflowX = "";
+ }
+ var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
+ if (delta) {
+ scrollElement.style.height = scrollElement.offsetHeight + delta;
+ }
+ } else {
+ normalPartStyle.display = "none";
+ }
+ var height = element.clientHeight;
+ var el = element.firstChild;
+ while (el) {
+ if(el.nodeName && el.nodeName.toUpperCase() == "DIV" && el
!= bodyElement) {
+ height -= el.offsetHeight;
+ }
+ el = el.nextSibling;
+ }
+ if (bodyElement.offsetHeight > height) {
+ bodyElement.style.height = height + "px";
+ }
+ };
+
+ var adjustResizers = function() {
+ var scrollLeft = scrollElement ? scrollElement.scrollLeft : 0;
+ var clientWidth = element.clientWidth - 3;
+ var i = 0;
+ for (; i < frozenColumnCount; i++) {
+ if (clientWidth > 0) {
+ resizerHolders[i].style.display = "none";
+ resizerHolders[i].style.display = "";
+ clientWidth -= resizerHolders[i].offsetWidth;
+ }
+ if (clientWidth <= 0) {
+ resizerHolders[i].style.display = "none";
+ }
+ }
+ scrollLeft -= 3;
+ for (; i < resizerHolders.length; i++) {
+ if (clientWidth > 0) {
+ resizerHolders[i].style.display = "none";
+ if (scrollLeft > 0) {
+ resizerHolders[i].style.display = "";
+ scrollLeft -= resizerHolders[i].offsetWidth;
+ if (scrollLeft > 0) {
+ resizerHolders[i].style.display = "none";
+ } else {
+ clientWidth += scrollLeft;
+ }
+ } else {
+ resizerHolders[i].style.display = "";
+ clientWidth -= resizerHolders[i].offsetWidth;
+ }
+ }
+ if (clientWidth <= 0) {
+ resizerHolders[i].style.display = "none";
+ }
+ }
+ };
+
+ var updateScrollPosition = function() {
+ if (scrollElement) {
+ var scrollLeft = scrollElement.scrollLeft;
+ parts.each(function() {
+ this.scrollLeft = scrollLeft;
+ });
+ }
+ adjustResizers();
+ };
+
+ var initialize = function() {
+ bodyElement = document.getElementById(id + ":b");
+ bodyElement.tabIndex = -1; //TODO don't use tabIndex.
+ var bodyJQuery = jQuery(bodyElement);
+ contentElement = bodyJQuery.children("div:first")[0];
+ if (contentElement) {
+ spacerElement = contentElement.firstChild;//TODO this.marginElement =
Richfaces.firstDescendant(this.contentElement);
+ dataTableElement = contentElement.lastChild;//TODO this.dataTableElement =
Richfaces.lastDescendant(this.contentElement);
+ tbodies = jQuery(document.getElementById(id +
":tbf")).add(document.getElementById(id + ":tbn"));
+ rows = tbodies[0].rows.length;
+ rowHeight = dataTableElement.offsetHeight / rows;
+ if (rowCount != rows) {
+ contentElement.style.height = (rowCount * rowHeight) + "px";
+ }
+ bodyJQuery.bind("scroll", bodyScrollListener);
+ if (options.selectionMode != "none") {
+ tbodies.bind("click", selectionClickListener);
+ bodyJQuery.bind(window.opera ? "keypress" : "keydown",
selectionKeyDownListener);
+ initializeSelection();
+ }
+ } else {
+ spacerElement = null;
+ dataTableElement = null;
+ }
+ parts = jQuery(element).find(".rf-edt-p");
+ updateLayout();
+ updateScrollPosition(); //TODO Restore horizontal scroll position
+ };
+
+ var drag = function(event) {
+ jQuery(dragElement).setPosition({left:Math.max(resizeData.left + MIN_WIDTH,
event.pageX)});
+ return false;
+ };
+
+ var beginResize = function(event) {
+ var id = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
+ resizeData = {
+ id : id,
+ left : jQuery(this).parent().offset().left
+ };
+ dragElement.style.height = element.offsetHeight + "px";
+ jQuery(dragElement).setPosition({top:jQuery(element).offset().top,
left:event.pageX});
+ dragElement.style.display = "block";
+ jQuery(document).bind("mousemove", drag);
+ jQuery(document).one("mouseup", endResize);
+ return false;
+ };
+
+ var setColumnWidth = function(id, width) {
+ width = width + "px";
+ richfaces.utils.getCSSRule("." + WIDTH_CLASS_NAME_BASE + id).style.width =
width;
+ newWidths[id] = width;
+ var widthsArray = new Array();
+ for (var id in newWidths) {
+ widthsArray.push(id + ":" + newWidths[id]);
+ }
+ widthInput.value = widthsArray.toString();
+ updateLayout();
+ adjustResizers();
+ sendAjax(); // TODO Maybe, event model should be used here.
+ };
+
+ var endResize = function(event) {
+ jQuery(document).unbind("mousemove", drag);
+ dragElement.style.display = "none";
+ var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left);
+ setColumnWidth(resizeData.id, width);
+ };
+
+ var reorder = function(event) {
+ jQuery(reorderElement).setPosition(event, {offset:[5,5]});
+ reorderElement.style.display = "block";
+ return false;
+ };
+
+ var beginReorder = function(event) {
+ idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
+ jQuery(document).bind("mousemove", reorder);
+ header.find(".rf-edt-hc").bind("mouseover", overReorder);
+ jQuery(document).one("mouseup", cancelReorder);
+ return false;
+ };
+
+ var overReorder = function(event) {
+ if (idOfReorderingColumn != this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1]) {
+ var thisElement = jQuery(this);
+ var offset = thisElement.offset();
+ jQuery(reorderMarkerElement).setPosition({top:offset.top + thisElement.height(),
left:offset.left - 5});
+ reorderMarkerElement.style.display = "block";
+ thisElement.one("mouseout", outReorder);
+ thisElement.one("mouseup", endReorder);
+ }
+ };
+
+ var outReorder = function(event) {
+ reorderMarkerElement.style.display = "";
+ jQuery(this).unbind("mouseup", endReorder);
+ };
+
+ var endReorder = function(event) {
+ reorderMarkerElement.style.display = "";
+ jQuery(this).unbind("mouseout", outReorder);
+ var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
+ var colunmsOrder = "";
+ header.find(".rf-edt-hc").each(function() {
+ var i = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
+ if (i == id) {
+ colunmsOrder += idOfReorderingColumn + "," + id + ",";
+ } else if (i != idOfReorderingColumn) {
+ colunmsOrder += i + ",";
+ }
+ });
+ sendAjax(event, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event
model should be used here.
+ };
+
+ var cancelReorder = function(event) {
+ jQuery(document).unbind("mousemove", reorder);
+ header.find(".rf-edt-hc").unbind("mouseover", overReorder);
+ reorderElement.style.display = "none";
+ };
+
+ var loadData = function(event) {
+ var clientFirst = Math.round((bodyElement.scrollTop + bodyElement.clientHeight / 2) /
(rowHeight) - rows / 2);
+ if (clientFirst <= 0) {
+ clientFirst = 0;
+ } else {
+ clientFirst = Math.min(rowCount - rows, clientFirst);
+ }
+ sendAjax(event, {"rich:clientFirst" : clientFirst});// TODO Maybe, event
model should be used here.
+ }
+
+ var bodyScrollListener = function(event) {
+ if(timeoutId) {
+ window.clearTimeout(timeoutId);
+ timeoutId = null;
+ }
+ if (Math.max(this.scrollTop - rowHeight, 0) < spacerElement.offsetHeight
+ || Math.min(this.scrollTop + rowHeight + this.clientHeight, this.scrollHeight) >
spacerElement.offsetHeight + dataTableElement.offsetHeight) {
+ timeoutId = window.setTimeout(function (event) {loadData(event)}, 1000);
+ }
+ };
+
+ var showActiveRow = function() {
+ if (bodyElement.scrollTop > activeIndex * rowHeight + spacerElement.offsetHeight) {
//UP
+ bodyElement.scrollTop = Math.max(bodyElement.scrollTop - rowHeight, 0);
+ } else if (bodyElement.scrollTop + bodyElement.clientHeight
+ < (activeIndex + 1) * rowHeight + spacerElement.offsetHeight) { //DOWN
+ bodyElement.scrollTop = Math.min(bodyElement.scrollTop + rowHeight,
bodyElement.scrollHeight - bodyElement.clientHeight);
+ }
+ }
+
+ var selectRow = function(index) {
+ ranges.add(index);
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[index]).addClass("rf-edt-r-s");
+ }
+ }
+
+ var deselectRow = function (index) {
+ ranges.remove(index);
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[index]).removeClass("rf-edt-r-s");
+ }
+ }
+
+ var setActiveRow = function (index) {
+ if(typeof activeIndex == "number") {
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[activeIndex]).removeClass("rf-edt-r-a");
+ }
+
+ }
+ activeIndex = index;
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[activeIndex]).addClass("rf-edt-r-a");
+ }
+ }
+
+ var resetShiftRow = function () {
+ if(typeof shiftIndex == "number") {
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[shiftIndex]).removeClass("rf-edt-r-t");
+ }
+
+ }
+ shiftIndex = null;
+ }
+
+ var setShiftRow = function (index) {
+ resetShiftRow();
+ shiftIndex = index;
+ if(typeof index == "number") {
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[shiftIndex]).addClass("rf-edt-r-t");
+ }
+ }
+ }
+
+ var initializeSelection = function() {
+ ranges.clear();
+ var strings = selectionInput.value.split("|");
+ activeIndex = strings[1] || null;
+ shiftIndex = strings[2] || null;
+ selectionFlag = null;
+ var rows = tbodies[0].rows;
+ for (var i = 0; i < rows.length; i++) {
+ var row = jQuery(rows[i]);
+ if (row.hasClass("rf-edt-r-s")) {
+ ranges.add(row[0].rowIndex)
+ }
+ if (row.hasClass("rf-edt-r-a")) {
+ activeIndex = row[0].rowIndex;
+ }
+ if (row.hasClass("rf-edt-r-t")) {
+ shiftIndex = row[0].rowIndex;
+ }
+ }
+ writeSelection();
+ }
+
+ var writeSelection = function() {
+ selectionInput.value = [ranges, activeIndex, shiftIndex,
selectionFlag].join("|");
+ }
+
+ var selectRows = function(range) {
+ if (typeof range == "number") {
+ range = [range, range];
+ }
+ var changed;
+ var i = 0;
+ for (; i < range[0]; i++) {
+ if (ranges.contains(i)) {
+ deselectRow(i);
+ changed = true;
+ }
+ }
+ for (; i <= range[1]; i++) {
+ if (!ranges.contains(i)) {
+ selectRow(i);
+ changed = true;
+ }
+ }
+ for (; i < rows; i++) {
+ if (ranges.contains(i)) {
+ deselectRow(i);
+ changed = true;
+ }
+ }
+ selectionFlag = typeof shiftIndex == "string" ? shiftIndex : "x";
+ return changed;
+ }
+
+ var processSlectionWithShiftKey = function(index) {
+ if(shiftIndex == null) {
+ setShiftRow(activeIndex != null ? activeIndex : index);
+ }
+ var range;
+ if ("u" == shiftIndex) {
+ range = [0, index];
+ } else if ("d" == shiftIndex) {
+ range = [index, rows - 1];
+ } else if (index >= shiftIndex) {
+ range = [shiftIndex, index];
+ } else {
+ range = [index, shiftIndex];
+ }
+ return selectRows(range);
+ }
+
+ var onbeforeselectionchange = function (event) {
+ return !options.onbeforeselectionchange ||
options.onbeforeselectionchange.call(element, event) !== false;
+ }
+
+ var onselectionchange = function (event, index, changed) {
+ if(!event.shiftKey) {
+ resetShiftRow();
+ }
+ if (activeIndex != index) {
+ setActiveRow(index);
+ showActiveRow();
+ }
+ if (changed) {
+ writeSelection();
+ if (options.onselectionchange) {
+ options.onselectionchange.call(element, event);
+ }
+ }
+ }
+
+ var selectionClickListener = function (event) {
+ if (!onbeforeselectionchange(event)) {
+ return;
+ }
+ var changed;
+ if (event.shiftKey || event.ctrlKey) {
+ if (window.getSelection) { //TODO Try to find other way.
+ window.getSelection().removeAllRanges();
+ } else if (document.selection) {
+ document.selection.empty();
+ }
+ }
+ var tr = event.target;
+ while (tbodies.index(tr.parentNode) == -1) {
+ tr = tr.parentNode;
+ }
+ var index = tr.rowIndex;
+ if (options.selectionMode == "single" || (options.selectionMode !=
"multipleKeyboardFree"
+ && !event.shiftKey && !event.ctrlKey)) {
+ changed = selectRows(index);
+ } else if (options.selectionMode == "multipleKeyboardFree" ||
(!event.shiftKey && event.ctrlKey)) {
+ if (ranges.contains(index)) {
+ deselectRow(index);
+ } else {
+ selectRow(index);
+ }
+ changed = true;
+ } else {
+ changed = processSlectionWithShiftKey(index);
+ }
+ onselectionchange(event, index, changed);
+ }
+
+ var selectionKeyDownListener = function(event) {
+ if (event.ctrlKey && options.selectionMode != "single" &&
(event.keyCode == 65 || event.keyCode == 97) //Ctrl-A
+ && onbeforeselectionchange(event)) {
+ selectRows([0, rows]);
+ selectionFlag = "a";
+ onselectionchange(event, activeIndex, true); //TODO Is there a way to know that
selection haven't changed?
+ event.preventDefault();
+ } else {
+ var index;
+ if (event.keyCode == 38) { //UP
+ index = -1;
+ } else if (event.keyCode == 40) { //DOWN
+ index = 1;
+ }
+ if (index != null && onbeforeselectionchange(event)) {
+ if (typeof activeIndex == "number") {
+ index += activeIndex;
+ if (index >= 0 && index < rows ) {
+ var changed;
+ if (options.selectionMode == "single" || (!event.shiftKey &&
!event.ctrlKey)) {
+ changed = selectRows(index);
+ } else if (event.shiftKey) {
+ changed = processSlectionWithShiftKey(index);
+ }
+ onselectionchange(event, index, changed);
+ }
+ }
+ event.preventDefault();
+ }
+ }
+ }
+
+ var ajaxComplete = function (event, data) {
+ if (data.reinitializeHeader) {
+ bindHeaderHandlers();
+ } else {
+ selectionInput = document.getElementById(id + ":si");
+ if (data.reinitializeBody) {
+ rowCount = data.rowCount;
+ initialize();
+ } else if (options.selectionMode != "none") {
+ initializeSelection();
+ }
+ if (spacerElement) {
+ spacerElement.style.height = (data.first * rowHeight) + "px";
+ }
+ }
+ };
+
+ jQuery(document).ready(initialize);
+ jQuery(window).bind("resize", updateLayout);
+ jQuery(scrollElement).bind("scroll", updateScrollPosition);
+ var bindHeaderHandlers = function () {
+ header.find(".rf-edt-rs").bind("mousedown", beginResize);
+ header.find(".rf-edt-hc").bind("mousedown", beginReorder);
+ }
+ bindHeaderHandlers();
+ jQuery(element).bind("rich:onajaxcomplete", ajaxComplete);
+
+ //JS API
+ element["richfaces"] = element["richfaces"] || {}; // TODO
ExtendedDataTable should extend richfaces.BaseComponent instead of using it.
+ element.richfaces.component = this;
+
+ this.getColumnPosition = function(id) {
+ var position;
+ var headers = header.find(".rf-edt-hc");
+ for (var i = 0; i < headers.length; i++) {
+ if (id == headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1]) {
+ position = i;
+ }
+ }
+ return position;
+ }
+
+ this.setColumnPosition = function(id, position) {
+ var colunmsOrder = "";
+ var before;
+ var headers = header.find(".rf-edt-hc");
+ for (var i = 0; i < headers.length; i++) {
+ var current = headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE +
"([^\\W]*)"))[1];
+ if (i == position) {
+ if (before) {
+ colunmsOrder += current + "," + id + ",";
+ } else {
+ colunmsOrder += id + "," + current + ",";
+ }
+ } else {
+ if (id != current) {
+ colunmsOrder += current + ",";
+ } else {
+ before = true;
+ }
+ }
+ }
+ sendAjax(null, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event
model should be used here.
+ }
+
+ this.setColumnWidth = function(id, width) {
+ setColumnWidth(id, width);
+ }
+
+ this.filter = function(colunmId, filterValue, isClear) {
+ if (typeof(filterValue) == "undefined" || filterValue == null) {
+ filterValue = "";
+ }
+ var map = {}
+ map[id + "rich:filtering"] = colunmId + ":" + filterValue +
":" + isClear;
+ sendAjax(null, map); // TODO Maybe, event model should be used here.
+ }
+
+ this.clearFiltering = function() {
+ this.filter("", "", true);
+ }
+
+ this.sort = function(colunmId, sortOrder, isClear) {
+ if (typeof(sortOrder) == "string") {
+ sortOrder = sortOrder.toUpperCase();
+ }
+ var map = {}
+ map[id + "rich:sorting"] = colunmId + ":" + sortOrder +
":" + isClear;
+ sendAjax(null, map); // TODO Maybe, event model should be used here.
+ }
+
+ this.clearSorting = function() {
+ this.filter("", "", true);
+ }
+ };
+}(window.RichFaces, jQuery));
+
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/reorderMarker.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/reorderMarker.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,54 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.SubTableToggler = function(id, options) {
+ this.id = id;
+ this.eventName = options.eventName;
+ this.expandControl = options.expandControl;
+ this.collapseControl = options.collapseControl;
+ this.forId = options.forId;
+
+ richfaces.Event.bindById(this.id, this.eventName, this.toggle, this);
+ };
+
+ $.extend(richfaces.ui.SubTableToggler.prototype, (function () {
+
+ var getElementById= function(id) {
+ return $(document.getElementById(id))
+ }
+
+ return {
+
+ toggle: function(e) {
+ var subtable = richfaces.$(this.forId);
+ if(subtable) {
+ var mode = subtable.getMode();
+
+ if(richfaces.ui.SubTable.MODE_CLNT == mode) {
+ this.toggleControl(subtable.isExpand());
+ }
+
+ subtable.setOption(this.id);
+ subtable.toggle(e);
+ }
+ },
+
+ toggleControl: function(expanded) {
+ var expandControl = getElementById(this.expandControl);
+ var collapseControl = getElementById(this.collapseControl);
+
+ if(expanded) {
+ collapseControl.hide();
+ expandControl.show();
+ } else {
+ expandControl.hide();
+ collapseControl.show();
+ }
+ }
+
+ };
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js
(rev 0)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,115 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.SubTable = function(id, f, options) {
+ this.id = id;
+ this.stateInput = options.stateInput;
+ this.optionsInput = options.optionsInput;
+ this.expandMode = options.expandMode;
+ this.eventOptions = options.eventOptions;
+ this.formId = f;
+
+ $super.constructor.call(this, id);
+ this.attachToDom(id);
+ };
+
+ $.extend(richfaces.ui.SubTable, {
+ MODE_AJAX: "ajax",
+ MODE_SRV: "server",
+ MODE_CLNT: "client",
+ collapse: 0,
+ expand: 1
+ })
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.SubTable);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.SubTable, {});
+ var $super = richfaces.ui.SubTable.$super;
+
+ $.extend(richfaces.ui.SubTable.prototype, (function () {
+
+ var element = function() {
+ //use parent tbody as parent dom elem
+ return $(document.getElementById(this.id)).parent();
+ };
+
+ var stateInputElem = function() {
+ return $(document.getElementById(this.stateInput));
+ };
+
+ var optionsInputElem = function() {
+ return $(document.getElementById(this.optionsInput));
+ };
+
+ var ajax = function(e, options) {
+ this.switchState();
+ richfaces.ajax(this.id, e, options);
+ };
+
+ var server = function(options) {
+ this.switchState();
+ $(document.getElementById(this.formId)).submit();
+ };
+
+ var client = function(options) {
+ if(this.isExpand()) {
+ this.collapse(options);
+ } else {
+ this.expand(options);
+ }
+ };
+
+
+ return {
+
+ name: "RichFaces.ui.SubTable",
+
+ toggle: function(e, options) {
+ if(this.expandMode == richfaces.ui.SubTable.MODE_AJAX) {
+ ajax.call(this, e, this.eventOptions, options);
+ }else if(this.expandMode == richfaces.ui.SubTable.MODE_SRV) {
+ server.call(this, options);
+ }else if(this.expandMode == richfaces.ui.SubTable.MODE_CLNT) {
+ client.call(this, options);
+ }
+ },
+
+ collapse: function(options) {
+ this.setState(richfaces.ui.SubTable.collapse);
+ element.call(this).hide();
+ },
+
+ expand: function(options) {
+ this.setState(richfaces.ui.SubTable.expand);
+ element.call(this).show();
+ },
+
+ isExpand: function() {
+ return (this.getState() > richfaces.ui.SubTable.collapse);
+ },
+
+ switchState: function(options) {
+ var state = this.isExpand() ? richfaces.ui.SubTable.collapse :
richfaces.ui.SubTable.expand;
+ this.setState(state);
+ },
+
+ getState: function() {
+ return stateInputElem.call(this).val();
+ },
+
+ setState: function(state) {
+ stateInputElem.call(this).val(state)
+ },
+
+ setOption: function(option) {
+ optionsInputElem.call(this).val(option);
+ },
+
+ getMode: function() {
+ return this.expandMode;
+ }
+ };
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Added:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/up_icon.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/up_icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/reorderMarker.gif
===================================================================
(Binary files differ)
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js
===================================================================
---
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,54 +0,0 @@
-(function ($, richfaces) {
-
- richfaces.ui = richfaces.ui || {};
-
- richfaces.ui.SubTableToggler = function(id, options) {
- this.id = id;
- this.eventName = options.eventName;
- this.expandControl = options.expandControl;
- this.collapseControl = options.collapseControl;
- this.forId = options.forId;
-
- richfaces.Event.bindById(this.id, this.eventName, this.toggle, this);
- };
-
- $.extend(richfaces.ui.SubTableToggler.prototype, (function () {
-
- var getElementById= function(id) {
- return $(document.getElementById(id))
- }
-
- return {
-
- toggle: function(e) {
- var subtable = richfaces.$(this.forId);
- if(subtable) {
- var mode = subtable.getMode();
-
- if(richfaces.ui.SubTable.MODE_CLNT == mode) {
- this.toggleControl(subtable.isExpand());
- }
-
- subtable.setOption(this.id);
- subtable.toggle(e);
- }
- },
-
- toggleControl: function(expanded) {
- var expandControl = getElementById(this.expandControl);
- var collapseControl = getElementById(this.collapseControl);
-
- if(expanded) {
- collapseControl.hide();
- expandControl.show();
- } else {
- expandControl.hide();
- collapseControl.show();
- }
- }
-
- };
-
- })());
-
-})(jQuery, window.RichFaces);
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,115 +0,0 @@
-(function ($, richfaces) {
-
- richfaces.ui = richfaces.ui || {};
-
- richfaces.ui.SubTable = function(id, f, options) {
- this.id = id;
- this.stateInput = options.stateInput;
- this.optionsInput = options.optionsInput;
- this.expandMode = options.expandMode;
- this.eventOptions = options.eventOptions;
- this.formId = f;
-
- $super.constructor.call(this, id);
- this.attachToDom(id);
- };
-
- $.extend(richfaces.ui.SubTable, {
- MODE_AJAX: "ajax",
- MODE_SRV: "server",
- MODE_CLNT: "client",
- collapse: 0,
- expand: 1
- })
-
- var $super = richfaces.BaseComponent.extend(richfaces.ui.SubTable);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.SubTable, {});
- var $super = richfaces.ui.SubTable.$super;
-
- $.extend(richfaces.ui.SubTable.prototype, (function () {
-
- var element = function() {
- //use parent tbody as parent dom elem
- return $(document.getElementById(this.id)).parent();
- };
-
- var stateInputElem = function() {
- return $(document.getElementById(this.stateInput));
- };
-
- var optionsInputElem = function() {
- return $(document.getElementById(this.optionsInput));
- };
-
- var ajax = function(e, options) {
- this.switchState();
- richfaces.ajax(this.id, e, options);
- };
-
- var server = function(options) {
- this.switchState();
- $(document.getElementById(this.formId)).submit();
- };
-
- var client = function(options) {
- if(this.isExpand()) {
- this.collapse(options);
- } else {
- this.expand(options);
- }
- };
-
-
- return {
-
- name: "RichFaces.ui.SubTable",
-
- toggle: function(e, options) {
- if(this.expandMode == richfaces.ui.SubTable.MODE_AJAX) {
- ajax.call(this, e, this.eventOptions, options);
- }else if(this.expandMode == richfaces.ui.SubTable.MODE_SRV) {
- server.call(this, options);
- }else if(this.expandMode == richfaces.ui.SubTable.MODE_CLNT) {
- client.call(this, options);
- }
- },
-
- collapse: function(options) {
- this.setState(richfaces.ui.SubTable.collapse);
- element.call(this).hide();
- },
-
- expand: function(options) {
- this.setState(richfaces.ui.SubTable.expand);
- element.call(this).show();
- },
-
- isExpand: function() {
- return (this.getState() > richfaces.ui.SubTable.collapse);
- },
-
- switchState: function(options) {
- var state = this.isExpand() ? richfaces.ui.SubTable.collapse :
richfaces.ui.SubTable.expand;
- this.setState(state);
- },
-
- getState: function() {
- return stateInputElem.call(this).val();
- },
-
- setState: function(state) {
- stateInputElem.call(this).val(state)
- },
-
- setOption: function(option) {
- optionsInputElem.call(this).val(option);
- },
-
- getMode: function() {
- return this.expandMode;
- }
- };
-
- })());
-
-})(jQuery, window.RichFaces);
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/up_icon.gif
===================================================================
(Binary files differ)
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,114 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
-JBoss, Home of Professional Open Source
-Copyright ${year}, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-
-This software 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 software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site:
http://www.fsf.org.
--->
-<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
- version="2.0">
-
- <component>
- <component-type>org.richfaces.DataTable</component-type>
- <component-class>org.richfaces.component.html.HtmlDataTable</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
-
- <component>
- <component-type>org.richfaces.ExtendedDataTable</component-type>
- <component-class>org.richfaces.component.html.HtmlExtendedDataTable</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.Column</component-type>
- <component-class>org.richfaces.component.html.HtmlColumn</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.ColumnGroup</component-type>
- <component-class>org.richfaces.component.html.HtmlColumnGroup</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.SubTable</component-type>
- <component-class>org.richfaces.component.html.HtmlSubTable</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.SubTableToggleControl</component-type>
- <component-class>org.richfaces.component.html.HtmlSubTableToggleControl</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.DataGrid</component-type>
- <component-class>org.richfaces.component.html.HtmlDataGrid</component-class>
- <component-extension>
- <cdk:generate
xmlns:cdk="http://richfaces.org/cdk/extensions">false</cd...
- </component-extension>
- </component>
-
-
- <render-kit>
- <render-kit-id>HTML_BASIC</render-kit-id>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.DataTableRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.DataTableRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.SubTableRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.SubTableRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Column</component-family>
- <renderer-type>org.richfaces.ColumnGroupRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.ColumnGroupRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.ExtendedDataTableRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.ExtendedDataTableRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.SubTableToggleControl</component-family>
- <renderer-type>org.richfaces.SubTableToggleControl</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.SubTableToggleControlRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.DataGridRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.DataGridRenderer</renderer-class>
- </renderer>
- </render-kit>
-</faces-config>
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml 2010-08-13
10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<facelet-taglib version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee" id="a4j">
- <
namespace>http://richfaces.org/rich</namespace>
-
- <tag>
- <tag-name>dataTable</tag-name>
- <component>
- <component-type>org.richfaces.DataTable</component-type>
- <renderer-type>org.richfaces.DataTableRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>extendedDataTable</tag-name>
- <component>
- <component-type>org.richfaces.ExtendedDataTable</component-type>
- <renderer-type>org.richfaces.ExtendedDataTableRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>column</tag-name>
- <component>
- <component-type>org.richfaces.Column</component-type>
- </component>
-
- </tag>
- <tag>
- <tag-name>columnGroup</tag-name>
- <component>
- <component-type>org.richfaces.ColumnGroup</component-type>
- <renderer-type>org.richfaces.ColumnGroupRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>subTable</tag-name>
- <component>
- <component-type>org.richfaces.SubTable</component-type>
- <renderer-type>org.richfaces.SubTableRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.SubTableHandler</handler-class>
- </component>
- </tag>
- <tag>
- <tag-name>subTableToggleControl</tag-name>
- <component>
- <component-type>org.richfaces.SubTableToggleControl</component-type>
- <renderer-type>org.richfaces.SubTableToggleControlRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>dataGrid</tag-name>
- <component>
- <component-type>org.richfaces.DataGrid</component-type>
- <renderer-type>org.richfaces.DataGridRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.DataGridHandler</handler-class>
- </component>
- </tag>
-
-</facelet-taglib>
Added: trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml
(rev 0)
+++ trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml 2010-08-13
11:33:47 UTC (rev 18612)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<cdk:root
xmlns="http://richfaces.org/cdk/xhtml-el"
xmlns:cdk="http://richfaces.org/cdk/core"
+
xmlns:c="http://richfaces.org/cdk/jstl/core"
xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+
xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.SubTableToggleControlRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.SubTableToggleControlRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.SubTableToggleControl</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.SubTableToggleControlRenderer</cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <span id="#{clientId}"
class="#{component.attributes['styleClass']}">
+ <cdk:call expression="encodeControl(facesContext, component);" />
+ </span>
+ </cc:implementation>
+
+</cdk:root>
\ No newline at end of file
Deleted:
trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
===================================================================
---
trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-08-13
10:24:21 UTC (rev 18611)
+++
trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-08-13
11:33:47 UTC (rev 18612)
@@ -1,274 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-import org.jboss.test.faces.AbstractFacesTest;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.richfaces.model.Arrangeable;
-import org.richfaces.model.ArrangeableState;
-import org.richfaces.model.FilterField;
-import org.richfaces.model.SortField;
-import org.richfaces.model.SortMode;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class UIDataTableBaseTest extends AbstractFacesTest {
-
- private class MockArrangeableModel extends ExtendedDataModel<Object> implements
Arrangeable {
-
- private ArrangeableState state;
- @Override
- public Object getRowKey() {
- return null;
- }
-
- @Override
- public void setRowKey(Object key) {
- }
-
- @Override
- public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) {
- }
-
- @Override
- public int getRowCount() {
- return 0;
- }
-
- @Override
- public Object getRowData() {
- return null;
- }
-
- @Override
- public int getRowIndex() {
- return 0;
- }
-
- @Override
- public Object getWrappedData() {
- return null;
- }
-
- @Override
- public boolean isRowAvailable() {
- return false;
- }
-
- @Override
- public void setRowIndex(int rowIndex) {
- }
-
- @Override
- public void setWrappedData(Object data) {
- }
-
- public void arrange(FacesContext context, ArrangeableState state) {
- this.state = state;
- }
-
- public ArrangeableState getState() {
- return state;
- }
-
- }
- private UIDataTableBase table = null;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- super.setUp();
- setupFacesRequest();
- table = new UIDataTableBase();
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- table = null;
- super.tearDown();
- }
-
- /**
- * Test method for {@link
org.richfaces.component.UIDataTableBase#getRendersChildren()}.
- */
- @Test
- public void testGetRendersChildren() {
- Assert.assertTrue(table.getRendersChildren());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#dataChildren()}.
- */
- @Test
- public void testDataChildren() {
- Assert.assertTrue(table.dataChildren() instanceof DataTableDataIterator);
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#fixedChildren()}.
- */
- @Test
- public void testFixedChildren() {
- Assert.assertTrue(table.fixedChildren() instanceof
DataTableFixedChildrenIterator);
- }
-
- /**
- * Test method for {@link
org.richfaces.component.UIDataTableBase#createExtendedDataModel()}.
- */
- @Test
- public void testCreateExtendedDataModel() {
- Assert.assertFalse(table.createExtendedDataModel() instanceof Arrangeable);
- List<String> sortPriority = Arrays.asList("id2", "id0",
"id1");
- List<UIComponent> children = table.getChildren();
- ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
- ELContext elContext = facesContext.getELContext();
- UIColumn column = new UIColumn();
- column.setRendered(false);
- children.add(column);
- for (int i = 0; i < sortPriority.size(); i++) {
- UIColumn child = new UIColumn();
- child.setId("id" + i);
- child.setValueExpression("filterExpression", expressionFactory
- .createValueExpression(elContext, "#{'id" + i +
"'}", Object.class));
- child.setValueExpression("sortBy", expressionFactory
- .createValueExpression(elContext, "#{'id" + i +
"'}", Object.class));
- child.setSortOrder(SortOrder.ascending);
- children.add(child);
- }
- Assert.assertTrue(table.createExtendedDataModel() instanceof Arrangeable);
- MockArrangeableModel model = new MockArrangeableModel();
- table.setValue(model);
- table.setSortPriority(sortPriority);
- Assert.assertSame(model, table.createExtendedDataModel());
- ArrangeableState state = model.getState();
- List<FilterField> filterFields = state.getFilterFields();
- for (int i = 0; i < sortPriority.size(); i++) {
- Assert.assertEquals("id" + i ,
filterFields.get(i).getFilterExpression().getValue(elContext));
- }
- List<SortField> sortFields = state.getSortFields();
- for (int i = 0; i < sortPriority.size(); i++) {
- Assert.assertEquals(sortPriority.get(i),
sortFields.get(i).getSortBy().getValue(elContext));
- }
- Assert.assertEquals(facesContext.getViewRoot().getLocale(), state.getLocale());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#columns()}.
- */
- @Test
- public void testColumns() {
- Assert.assertTrue(table.columns() instanceof DataTableColumnsIterator);
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getHeader()}.
- */
- @Test
- public void testGetHeader() {
- UIOutput component = new UIOutput();
- table.getFacets().put("header", component);
- Assert.assertSame(component, table.getHeader());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getFooter()}.
- */
- @Test
- public void testGetFooter() {
- UIOutput component = new UIOutput();
- table.getFacets().put("footer", component);
- Assert.assertSame(component, table.getFooter());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getFilterVar()}
and
- * {@link org.richfaces.component.UIDataTableBase#setFilterVar(java.lang.String)}.
- */
- @Test
- public void testFilterVar() {
- String string = "fv";
- table.setFilterVar(string);
- Assert.assertEquals(string, table.getFilterVar());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getSortPriority()}
and
- * {@link
org.richfaces.component.UIDataTableBase#setSortPriority(java.util.Collection)}.
- */
- @Test
- public void testSortPriority() {
- table.setSortPriority(Collections.EMPTY_LIST);
- Assert.assertEquals(Collections.EMPTY_LIST, table.getSortPriority());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getSortMode()} and
- * {@link
org.richfaces.component.UIDataTableBase#setSortMode(org.richfaces.model.SortMode)}.
- */
- @Test
- public void testSortMode() {
- table.setSortMode(SortMode.multi);
- Assert.assertEquals(SortMode.multi, table.getSortMode());
- }
-
- /**
- * Test method for {@link
org.richfaces.component.UIDataTableBase#isColumnFacetPresent(java.lang.String)}.
- */
- @Test
- public void testIsColumnFacetPresent() {
- String facetName = "header";
- Assert.assertFalse(table.isColumnFacetPresent(facetName));
- UIColumn child = new UIColumn();
- List<UIComponent> children = table.getChildren();
- children.add(new UIColumn());
- children.add(child);
- Assert.assertFalse(table.isColumnFacetPresent(facetName));
- child.getFacets().put(facetName, new UIOutput());
- Assert.assertTrue(table.isColumnFacetPresent(facetName));
- child.setRendered(false);
- Assert.assertFalse(table.isColumnFacetPresent(facetName));
- }
-}