JBoss Rich Faces SVN: r16181 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-12-21 11:37:02 -0500 (Mon, 21 Dec 2009)
New Revision: 16181
Removed:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
Log:
rename containThead method
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-12-21 16:03:12 UTC (rev 16180)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-12-21 16:37:02 UTC (rev 16181)
@@ -184,7 +184,7 @@
boolean columnFacetPresent = isColumnFacetPresent(dataTable, "footer");
if ((footer != null && footer.isRendered()) || columnFacetPresent) {
- boolean encodeTfoot = containThead();
+ boolean encodeTfoot = containsThead();
if (encodeTfoot) {
writer.startElement(HTML.TFOOT_ELEMENT, dataTable);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-tfoot", null);
@@ -252,7 +252,7 @@
UIComponent header = dataTable.getHeader();
boolean isEncodeHeaders = isEncodeHeaders(dataTable);
- boolean encodeThead = containThead();
+ boolean encodeThead = containsThead();
if ((header != null && header.isRendered()) || isEncodeHeaders) {
@@ -377,5 +377,5 @@
public abstract HeaderEncodeStrategy getHeaderEncodeStrategy(UIComponent column, String tableFacetName);
- public abstract boolean containThead();
+ public abstract boolean containsThead();
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2009-12-21 16:03:12 UTC (rev 16180)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2009-12-21 16:37:02 UTC (rev 16181)
@@ -235,7 +235,7 @@
}
@Override
- public boolean containThead() {
+ public boolean containsThead() {
return true;
}
}
Deleted: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java 2009-12-21 16:03:12 UTC (rev 16180)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ElementEncodeListener.java 2009-12-21 16:37:02 UTC (rev 16181)
@@ -1,55 +0,0 @@
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.richfaces.component.UIDataTableBase;
-
-public interface ElementEncodeListener {
-
- public void encodeRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException;
-
- public void encodeRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException;
-
- public void encodeCellStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException;
-
- public void encodeCellEnd(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException;
-
- // public void encodeHeaderCellStart(ResponseWriter writer, FacesContext context, UIComponent component, String
- // styleClass) throws IOException;
- //
- // public void encodeHeaderCellEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws
- // IOException;
-
- public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException;
-
- public void encodeFirstRowEnd(ResponseWriter writer, FacesContext context, UIComponent component)
- throws IOException;
-
- public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
- throws IOException;
-
- public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
- throws IOException;
-
- public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
- throws IOException;
-
- public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
- throws IOException;
-
- // public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws
- // IOException;
-
- public void encodeHeader(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
-
- public void encodeFooter(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException;
-
-}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-12-21 16:03:12 UTC (rev 16180)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-12-21 16:37:02 UTC (rev 16181)
@@ -354,7 +354,7 @@
}
@Override
- public boolean containThead() {
+ public boolean containsThead() {
return false;
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2009-12-21 16:03:12 UTC (rev 16180)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2009-12-21 16:37:02 UTC (rev 16181)
@@ -68,7 +68,7 @@
}
@Override
- public boolean containThead() {
+ public boolean containsThead() {
return false;
}
15 years, 4 months
JBoss Rich Faces SVN: r16180 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-12-21 11:03:12 -0500 (Mon, 21 Dec 2009)
New Revision: 16180
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java
Log:
remove properties execute, render
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java 2009-12-21 15:42:02 UTC (rev 16179)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java 2009-12-21 16:03:12 UTC (rev 16180)
@@ -5,19 +5,13 @@
import javax.faces.component.UIComponentBase;
-import org.omg.CORBA.REBIND;
-
public abstract class UIToggleControl extends UIComponentBase {
public static final String COMPONENT_TYPE = "org.richfaces.ToggleControl";
public static final String COMPONENT_FAMILY = "org.richfaces.ToggleControl";
- private Collection<String> execute;
- private Collection<String> render;
-
-
enum PropertyKeys {
expandControl, collapseControl, forId, event, execute, render
}
15 years, 4 months
JBoss Rich Faces SVN: r16179 - root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-12-21 10:42:02 -0500 (Mon, 21 Dec 2009)
New Revision: 16179
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
Log:
remove encodeAll
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-12-21 15:22:25 UTC (rev 16178)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-12-21 15:42:02 UTC (rev 16179)
@@ -193,12 +193,6 @@
}
@Override
- public void encodeAll(FacesContext context) throws IOException {
- super.encodeAll(context);
-
- }
-
- @Override
public void queueEvent(FacesEvent event) {
if (event instanceof ToggleEvent) {
if(getSwichType().equals(SWITCH_TYPE_AJAX)) {
15 years, 4 months
JBoss Rich Faces SVN: r16178 - root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-12-21 10:22:25 -0500 (Mon, 21 Dec 2009)
New Revision: 16178
Modified:
root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java
Log:
Modified: root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java 2009-12-21 15:19:30 UTC (rev 16177)
+++ root/ui-sandbox/trunk/components/tables/api/src/main/java/org/richfaces/component/Row.java 2009-12-21 15:22:25 UTC (rev 16178)
@@ -44,11 +44,5 @@
public void setRowKey(FacesContext context, Object rowKey);
public void walk(FacesContext context, DataVisitor visitor, Object argument);
-
- public String getCellSkinClass();
-
- public String getRowSkinClass();
-
- public String getFirstRowSkinClass();
-
+
}
15 years, 4 months
JBoss Rich Faces SVN: r16177 - in root/ui-sandbox/trunk/components/tables/ui/src/main: java/org/richfaces/component and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-12-21 10:19:30 -0500 (Mon, 21 Dec 2009)
New Revision: 16177
Added:
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/SortingFilteringVisualModelImpl.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
Modified:
root/ui-sandbox/trunk/components/tables/ui/src/main/config/faces-config.xml
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/DataTableVisualModel.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/DataTableVisualModelImpl.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java
root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java
root/ui-sandbox/trunk/components/tables/ui/src/main/old_configs/component/tables.xml
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/toggler.js
root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml
Log:
add subTable, columnGroup renderers, expand/collapse subTables on AJAX
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/config/faces-config.xml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/config/faces-config.xml 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/config/faces-config.xml 2009-12-21 15:19:30 UTC (rev 16177)
@@ -49,7 +49,7 @@
</component-extension>
</component>
<component>
- <component-type>org.richfaces.Colgroup</component-type>
+ <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</cdk:generate>
@@ -78,6 +78,16 @@
<renderer-class>org.richfaces.renderkit.DataTableRenderer</renderer-class>
</renderer>
<renderer>
+ <component-family>org.richfaces.SubTable</component-family>
+ <renderer-type>org.richfaces.SubTableRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.SubTableRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.ColumnGroup</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>
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumn.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -1,7 +1,11 @@
package org.richfaces.component;
+import org.richfaces.model.Ordering;
+
public abstract class UIColumn extends javax.faces.component.UIColumn implements Column {
+ private Ordering sortOrder;
+
public abstract int getRowspan();
public abstract void setRowspan(int rowspan);
@@ -9,5 +13,12 @@
public abstract int getColspan();
public abstract void setColspan(int colspan);
-
+
+ public Ordering getSortOrder() {
+ return null;
+ }
+
+ public void setSortOrder(Ordering sortOrder) {
+
+ }
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -28,7 +28,7 @@
import javax.faces.context.FacesContext;
import org.ajax4jsf.model.DataVisitor;
-import org.richfaces.renderkit.RowHolder;
+import org.richfaces.renderkit.RowHolderBase;
/**
* JSF component class
@@ -36,9 +36,9 @@
*/
public abstract class UIColumnGroup extends UIPanel implements Row, Column {
- public static final String COMPONENT_TYPE = "org.richfaces.Colgroup";
+ public static final String COMPONENT_TYPE = "org.richfaces.ColumnGroup";
- public static final String COMPONENT_FAMILY = "org.richfaces.Colgroup";
+ public static final String COMPONENT_FAMILY = "org.richfaces.ColumnGroup";
public Iterator<UIComponent> columns() {
return new ColumnsIterator(this);
@@ -57,22 +57,16 @@
}
public void walk(FacesContext context, DataVisitor visitor, Object argument) {
- if (!(argument instanceof RowHolder)) {
+ if (!(argument instanceof RowHolderBase)) {
return;
}
visitor.process(context, null, argument);
}
-
- public String getCellSkinClass() {
- return null;
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
}
- public String getRowSkinClass() {
- return null;
- }
-
- public String getFirstRowSkinClass() {
- return null;
- }
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTable.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -1,11 +1,17 @@
package org.richfaces.component;
+import java.util.Collection;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
import javax.faces.component.UIComponent;
import org.ajax4jsf.model.DataComponentState;
import org.richfaces.component.state.DataTableState;
import org.richfaces.model.visual.DataTableVisualModel;
+import org.richfaces.model.visual.SortingFilteringVisualModel;
import org.richfaces.model.visual.impl.DataTableVisualModelImpl;
+import org.richfaces.model.visual.impl.SortingFilteringVisualModelImpl;
/**
* @author Anton Belevich
@@ -14,89 +20,179 @@
public abstract class UIDataTable extends UIDataTableBase {
+ private DataTableVisualModel visualModel;
+
+ private String sortMode;
+
+ private Collection<String> sortPriority;
+
enum PropertyKeys {
- visualModel
+ sortingFilteringVisualModel
}
-
+
+ public void setVisualModel(DataTableVisualModel visualModel) {
+ this.visualModel = visualModel;
+ }
+
+ public DataTableState getCurrentComponentState() {
+ return (DataTableState) getComponentState();
+ }
+
+ public void setSortingFilteringVisualModel(SortingFilteringVisualModel sortingFilteringVisualModel){
+ getStateHelper().put(PropertyKeys.sortingFilteringVisualModel, sortingFilteringVisualModel);
+ }
+
+ public SortingFilteringVisualModel getSortingFilteringVisualModel(){
+ return (SortingFilteringVisualModel)getStateHelper().eval(PropertyKeys.sortingFilteringVisualModel);
+ }
+
public DataTableVisualModel getVisualModel() {
- return (DataTableVisualModel) getStateHelper().eval(PropertyKeys.visualModel);
+
+ DataTableState dataTableState = getCurrentComponentState();
+ DataTableVisualModel model = dataTableState.getVisualModel();
+
+ if(model == null) {
+
+ if(visualModel == null) {
+
+ ELContext elContext = getFacesContext().getELContext();
+ ValueExpression modelExpression = getValueExpression("visualModel");
+
+ if(modelExpression != null) {
+ model = (DataTableVisualModel) modelExpression.getValue(elContext);
+ }
+
+ if(model == null) {
+ model = new DataTableVisualModelImpl();
+
+ if ((modelExpression != null) && (!modelExpression.isReadOnly(elContext))) {
+ modelExpression.setValue(elContext, model);
+ }
+ }
+
+ } else {
+ model = visualModel;
+ }
+
+ if(model.getSortingFilteringVisualModel() == null) {
+ model.setSortingFilteringVisualModel(initSortingFilteringVisualModel());
+ }
+ }
+
+ dataTableState.setVisualModel(model);
+
+ return model;
}
-
- public void setVisualModel(DataTableVisualModel dataTableVisualModel) {
- getStateHelper().put(PropertyKeys.visualModel, dataTableVisualModel);
+
+ protected SortingFilteringVisualModel initSortingFilteringVisualModel() {
+ SortingFilteringVisualModel sortingFilteringVisualModel = getSortingFilteringVisualModel();
+ if(sortingFilteringVisualModel == null) {
+ sortingFilteringVisualModel = new SortingFilteringVisualModelImpl();
+ }
+
+ sortingFilteringVisualModel.setSortMode(sortMode);
+ sortingFilteringVisualModel.setSortPriority(sortPriority);
+
+ return sortingFilteringVisualModel;
}
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public String getSortMode() {
+ return getVisualModel().getSortingFilteringVisualModel().getSortMode();
+ }
+
+ public void setSortPriority(Collection<String> sortPriority){
+ this.sortPriority = sortPriority;
+ }
+
+ public Collection<String> getSortPriority() {
+ return getVisualModel().getSortingFilteringVisualModel().getSortPriority();
+ }
@Override
protected DataComponentState createComponentState() {
- DataTableState state = new DataTableState(getFirst(), getRows());
- DataTableVisualModel model = getVisualModel();
-
- if (model == null) {
- model = new DataTableVisualModelImpl();
- }
- state.setVisualModel(model);
-
- return state;
+ return new DataTableState(getFirst(), getRows());
}
+
+ public UIComponent getCaption() {
+ return getFacet("caption");
+ }
+
+ public String getTableSkinClass() {
+ return "rich-table";
+ }
- public String getCellSkinClass() {
- return "rich-table-cell";
+ public String getCaptionSkinClass() {
+ return "rich-table-caption";
}
+
+ @Override
+ public String getFirstRowSkinClass() {
+ return "rich-table-first-row";
+ }
+ @Override
public String getRowSkinClass() {
return "rich-table-row";
}
+
+ public String getCellSkinClass() {
+ return "rich-table-cell";
+ }
- public String getFirstRowSkinClass() {
- return "rich-table-firstrow";
+ public String getHeaderSkinClass() {
+ return "rich-table-header";
}
-
+
+ @Override
+ public String getHeaderFirstSkinClass() {
+ return "rich-table-header-first";
+ }
+
public String getHeaderCellSkinClass() {
return "rich-table-header-cell";
}
-
- public String getHeaderRowSkinClass() {
- return "rich-table-header-continue";
+
+ public String getColumnHeaderSkinClass() {
+ return "rich-table-subheader";
}
-
- public String getHeaderFirstRowSkinClass() {
- return "rich-table-header";
+
+ @Override
+ public String getColumnHeaderFirstSkinClass() {
+ return "rich-table-subheader-first";
}
public String getColumnHeaderCellSkinClass() {
return "rich-table-subheader-cell";
}
-
- public String getColumnHeaderSkinClass() {
- return "rich-table-subheader";
+
+ public String getColumnFooterSkinClass() {
+ return "rich-table-subfooter";
}
-
+
@Override
- public String getFooterCellSkinClass() {
- return "rich-table-footer-cell";
+ public String getColumnFooterFirstSkinClass() {
+ return "rich-table-subfooter-first";
}
- @Override
- public String getFooterRowSkinClass() {
- return "rich-table-footer-continue";
+ public String getColumnFooterCellSkinClass() {
+ return "rich-table-subfooter-cell";
}
- @Override
- public String getFooterFirstRowSkinClass() {
+ public String getFooterSkinClass() {
return "rich-table-footer";
}
@Override
- public String getColumnFooterCellSkinClass() {
- return "rich-table-subfooter-cell";
+ public String getFooterFirstSkinClass() {
+ return "rich-table-footer-first";
}
- @Override
- public String getColumnFooterSkinClass() {
- return "rich-table-subfooter-cell";
+ public String getFooterCellSkinClass() {
+ return "rich-table-footer-cell";
}
-
- public UIComponent getCaption() {
- return getFacet("caption");
- }
+
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -29,29 +29,41 @@
return getFacet("footer");
}
- public abstract String getHeaderCellSkinClass();
+ @Override
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public abstract String getTableSkinClass();
+
+ public abstract String getFirstRowSkinClass();
- public abstract String getHeaderRowSkinClass();
+ public abstract String getRowSkinClass();
+
+ public abstract String getHeaderCellSkinClass();
- public abstract String getHeaderFirstRowSkinClass();
+ public abstract String getHeaderSkinClass();
- public abstract String getColumnHeaderCellSkinClass();
+ public abstract String getHeaderFirstSkinClass();
+
+ public abstract String getColumnHeaderCellSkinClass();
- public abstract String getColumnHeaderSkinClass();
+ public abstract String getColumnHeaderSkinClass();
+
+ public abstract String getColumnHeaderFirstSkinClass();
- public abstract String getFooterCellSkinClass();
+ public abstract String getFooterCellSkinClass();
- public abstract String getFooterRowSkinClass();
+ public abstract String getFooterSkinClass();
+
+ public abstract String getFooterFirstSkinClass();
- public abstract String getFooterFirstRowSkinClass();
+ public abstract String getColumnFooterCellSkinClass();
- public abstract String getColumnFooterCellSkinClass();
+ public abstract String getColumnFooterSkinClass();
+
+ public abstract String getColumnFooterFirstSkinClass();
+
+ public abstract String getCellSkinClass();
- public abstract String getColumnFooterSkinClass();
-
- @Override
- public boolean getRendersChildren() {
- return true;
- }
-
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UISubTable.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -21,6 +21,8 @@
package org.richfaces.component;
+import java.io.IOException;
+
import javax.el.ELContext;
import javax.el.MethodExpression;
import javax.el.ValueExpression;
@@ -31,7 +33,6 @@
import javax.faces.event.PhaseId;
import org.ajax4jsf.model.DataComponentState;
-import org.ajax4jsf.model.DataVisitor;
import org.richfaces.component.state.DataTableState;
import org.richfaces.component.state.SubTableState;
import org.richfaces.event.ToggleEvent;
@@ -68,6 +69,7 @@
public SubTableVisualModel getVisualModel() {
// TODO refactor
+
SubTableVisualModel model = getCurrentComponentState().getCurrentRowModel();
if (model == null) {
@@ -119,11 +121,11 @@
throw new IllegalArgumentException("subtable is not sortable element");
}
- @Override
- public void walk(FacesContext context, DataVisitor visitor, Object argument) {
- resetDataModel(context);
- super.walk(context, visitor, argument);
- }
+// @Override
+// public void walk(FacesContext context, DataVisitor visitor, Object argument) {
+// resetDataModel(context);
+// super.walk(context, visitor, argument);
+// }
public String getSwichType() {
return (String) getStateHelper().eval(PropertyKeys.switchType, SWITCH_TYPE_SERVER);
@@ -134,14 +136,12 @@
}
public SubTableState getCurrentComponentState() {
- DataComponentState dataComponentState = getComponentState();
- if (dataComponentState instanceof SubTableState) {
- DataTableState parentState = getParentState();
- parentState.addSubTableState((SubTableState) dataComponentState);
-
- return (SubTableState) dataComponentState;
- }
- return null;
+ DataComponentState dataComponentState = (SubTableState)getComponentState();
+
+ DataTableState parentState = getParentState();
+ parentState.addSubTableState((SubTableState) dataComponentState);
+
+ return (SubTableState) dataComponentState;
}
public DataTableState getParentState() {
@@ -191,11 +191,21 @@
public MethodExpression getToggleListener() {
return (MethodExpression) getStateHelper().eval(PropertyKeys.toggleExpression);
}
-
+
@Override
+ public void encodeAll(FacesContext context) throws IOException {
+ super.encodeAll(context);
+
+ }
+
+ @Override
public void queueEvent(FacesEvent event) {
if (event instanceof ToggleEvent) {
- event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
+ if(getSwichType().equals(SWITCH_TYPE_AJAX)) {
+ event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ } else {
+ event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
+ }
}
super.queueEvent(event);
}
@@ -234,34 +244,41 @@
@Override
public boolean getRendersChildren() {
- // TODO nick - why "false"?
- return false;
+ return true;
}
-
- public String getCellSkinClass() {
- return "rich-subtable-cell";
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
}
-
+
+ @Override
public String getRowSkinClass() {
return "rich-subtable-row";
}
+ @Override
public String getFirstRowSkinClass() {
return "rich-subtable-first-row";
}
- public String getHeaderCellSkinClass() {
- return "rich-subtable-header-cell";
- }
-
public String getHeaderRowSkinClass() {
return "rich-subtable-header-row";
}
public String getHeaderFirstRowSkinClass() {
- return "rich-subtable-header-first-row";
+ return "rich-subtable-header-first";
}
+ public String getCellSkinClass() {
+ return "rich-subtable-cell";
+ }
+
+ public String getHeaderCellSkinClass() {
+ return "rich-subtable-header-cell";
+ }
+
+
public String getColumnHeaderCellSkinClass() {
return "rich-subtable-subheader-cell";
}
@@ -270,29 +287,57 @@
return "rich-subtable-subheader";
}
- @Override
public String getFooterCellSkinClass() {
return "rich-subtable-footer-cell";
}
- @Override
- public String getFooterRowSkinClass() {
- return "rich-subtable-footer-continue";
+ public String getFooterSkinClass() {
+ return "rich-subtable-footer";
}
- @Override
public String getFooterFirstRowSkinClass() {
- return "rich-subtable-footer";
+ return "rich-subtable-footer-first";
}
- @Override
public String getColumnFooterCellSkinClass() {
return "rich-subtable-subfooter-cell";
}
- @Override
public String getColumnFooterSkinClass() {
return "rich-subtable-subfooter-cell";
}
+
+ public String getTableSkinClass() {
+ return null;
+ }
+
+ public String getTableHeadSkinClass() {
+ return null;
+ }
+ @Override
+ public String getColumnFooterFirstSkinClass() {
+ return "rich-subtable-subfooter-first"; }
+
+ @Override
+ public String getColumnHeaderFirstSkinClass() {
+ return "rich-subtable-subheader-first";
+ }
+
+ @Override
+ public String getFooterFirstSkinClass() {
+ return "rich-subtable-footer-first";
+ }
+
+ @Override
+ public String getHeaderFirstSkinClass() {
+ return "rich-subtable-header-first";
+ }
+
+ @Override
+ public String getHeaderSkinClass() {
+ return "rich-subtable-header";
+ }
}
+
+
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/component/UIToggleControl.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -1,15 +1,25 @@
package org.richfaces.component;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
import javax.faces.component.UIComponentBase;
+import org.omg.CORBA.REBIND;
+
public abstract class UIToggleControl extends UIComponentBase {
public static final String COMPONENT_TYPE = "org.richfaces.ToggleControl";
public static final String COMPONENT_FAMILY = "org.richfaces.ToggleControl";
-
+
+ private Collection<String> execute;
+
+ private Collection<String> render;
+
+
enum PropertyKeys {
- expandControl, collapseControl, forId, event
+ expandControl, collapseControl, forId, event, execute, render
}
@Override
@@ -49,4 +59,33 @@
public void setEvent(String event) {
getStateHelper().put(PropertyKeys.event, event);
}
+ public Collection<String> getExecute() {
+ Collection<String> execute = (Collection<String>)getStateHelper().get(PropertyKeys.execute);
+ if(execute == null) {
+ execute = new LinkedHashSet<String>();
+ execute.add("@this");
+ getStateHelper().put(PropertyKeys.execute, execute);
+ }
+ return execute;
+ }
+
+ public void addExecuteId(String id){
+ ((Collection<String>)getStateHelper().get(PropertyKeys.execute)).add(id);
+ }
+
+
+ public Collection<String> getRender() {
+ Collection<String> render = (Collection<String>)getStateHelper().get(PropertyKeys.render);
+ if(render == null) {
+ render = new LinkedHashSet<String>();
+ render.add("@this");
+ getStateHelper().put(PropertyKeys.render, render);
+ }
+ return render;
+ }
+
+ public void addRenderId(String id){
+ ((Collection<String>)getStateHelper().get(PropertyKeys.render)).add(id);
+ }
+
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/DataTableVisualModel.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/DataTableVisualModel.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/DataTableVisualModel.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -5,4 +5,9 @@
*
*/
public interface DataTableVisualModel {
+
+ public SortingFilteringVisualModel getSortingFilteringVisualModel();
+
+ public void setSortingFilteringVisualModel(SortingFilteringVisualModel sortingFilteringVisualModel);
+
}
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/SortingFilteringVisualModel.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -0,0 +1,15 @@
+package org.richfaces.model.visual;
+
+import java.util.Collection;
+
+public interface SortingFilteringVisualModel {
+
+ public String getSortMode();
+
+ public void setSortMode(String sortMode);
+
+ public Collection<String> getSortPriority();
+
+ public void setSortPriority(Collection<String> sortPriority);
+
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/DataTableVisualModelImpl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/DataTableVisualModelImpl.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/DataTableVisualModelImpl.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -1,13 +1,24 @@
package org.richfaces.model.visual.impl;
import org.richfaces.model.visual.DataTableVisualModel;
+import org.richfaces.model.visual.SortingFilteringVisualModel;
/**
* @author Anton Belevich
*
*/
public class DataTableVisualModelImpl implements DataTableVisualModel {
-
+
+ private SortingFilteringVisualModel sortingFilteringVisualModel;
+
public DataTableVisualModelImpl() {
}
+
+ public SortingFilteringVisualModel getSortingFilteringVisualModel() {
+ return sortingFilteringVisualModel;
+ }
+
+ public void setSortingFilteringVisualModel(SortingFilteringVisualModel sortingFilteringVisualModel) {
+ this.sortingFilteringVisualModel = sortingFilteringVisualModel;
+ }
}
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/SortingFilteringVisualModelImpl.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/SortingFilteringVisualModelImpl.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/model/visual/impl/SortingFilteringVisualModelImpl.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -0,0 +1,29 @@
+package org.richfaces.model.visual.impl;
+
+import java.util.Collection;
+
+import org.richfaces.model.visual.SortingFilteringVisualModel;
+
+public class SortingFilteringVisualModelImpl implements SortingFilteringVisualModel {
+
+ private String sortMode;
+
+ private Collection<String> sortPriority;
+
+ public String getSortMode() {
+ return sortMode;
+ }
+
+ public Collection<String> getSortPriority() {
+ return sortPriority;
+ }
+
+ public void setSortMode(String sortMode) {
+ this.sortMode = sortMode;
+ }
+
+ public void setSortPriority(Collection<String> sortPriority) {
+ this.sortPriority = sortPriority;
+ }
+
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -23,7 +23,9 @@
import java.io.IOException;
+import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import org.ajax4jsf.model.DataVisitResult;
import org.ajax4jsf.model.DataVisitor;
@@ -41,29 +43,60 @@
* {"onmouseup","onRowMouseUp"}, {"onmousedown","onRowMouseDown"}, {"onmouseover","onRowMouseOver"},
* {"onmouseout","onRowMouseOut"} };
*/
-
- public abstract void encodeRow(RowHolderBase rowHolder) throws IOException;
-
+
public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
RowHolderBase holder = (RowHolderBase) argument;
Row row = holder.getRow();
row.setRowKey(context, rowKey);
try {
+ encodeRowBegin(context, holder);
encodeRow(holder);
+ encodeRowEnd(context, holder);
} catch (IOException e) {
// TODO: seems we need add throws IOException ???
}
holder.nextRow();
return DataVisitResult.CONTINUE;
}
-
+
protected void encodeRows(RowHolderBase rowHolder) throws IOException {
rowHolder.getRow().walk(rowHolder.getContext(), this, rowHolder);
}
+
+ public void encodeRowsBegin(ResponseWriter writer, FacesContext context, RowHolderBase holder) throws IOException {
+ }
+
+ public void encodeRowsEnd(ResponseWriter writer, FacesContext context, RowHolderBase holder) throws IOException {
+ }
+
+ public abstract void encodeRow(RowHolderBase rowHolder) throws IOException;
+
+ public void encodeRowBegin(FacesContext context, RowHolderBase holder) throws IOException {
+ }
+
+ public void encodeRowEnd(FacesContext context, RowHolderBase holder) throws IOException {
+ }
+ @Override
+ protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException {
+ RowHolderBase rowHolder = createRowHolder(context, component);
+ encodeRowsBegin(writer, context, rowHolder);
+ encodeRows(rowHolder);
+ encodeRowsEnd(writer, context, rowHolder);
+ }
+
+ public abstract RowHolderBase createRowHolder(FacesContext context, UIComponent component);
+
+ protected boolean isEmpty(String style) {
+ return !((style != null) && (style.trim().length() != 0));
+ }
+
+
public boolean getRendersChildren() {
return true;
}
+
/*
* protected void encodeRowEvents(FacesContext context, UIDataAdaptor table) throws IOException {
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -1,20 +1,32 @@
package org.richfaces.renderkit;
+import java.io.IOException;
import java.util.Iterator;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.Column;
import org.richfaces.component.Row;
import org.richfaces.component.UIDataTableBase;
+import org.richfaces.component.UISubTable;
@ResourceDependencies(value = { @ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js") })
-public abstract class AbstractTableRenderer extends AbstractRowsRenderer {
-
+public abstract class AbstractTableRenderer extends DataTableRowsRenderer {
+
+ public static final String ROW_CLASS = "rowClass";
+
+ public static final String FIRST_ROW_CLASS = "firstRowClass";
+
+ public static final String CELL_CLASS = "cellClass";
+
+
public boolean isColumnFacetPresent(UIDataTableBase table, String facetName) {
Iterator<UIComponent> columns = table.columns();
boolean result = false;
@@ -56,12 +68,11 @@
// check for exact value in component
Integer span = (Integer) table.getAttributes().get("columns");
int count = (null != span && span.intValue() != Integer.MIN_VALUE) ? span.intValue()
- : calculateRowColumns(table.columns());
+ : getColumnsCount(table.columns());
return count;
}
- // TODO nick - rename method
- protected int calculateRowColumns(Iterator<UIComponent> col) {
+ protected int getColumnsCount(Iterator<UIComponent> col) {
int count = 0;
int currentLength = 0;
while (col.hasNext()) {
@@ -73,7 +84,7 @@
count = currentLength;
}
// Calculate number of columns in row.
- currentLength = calculateRowColumns(((Row) component).columns());
+ currentLength = getColumnsCount(((Row) component).columns());
// Store max calculated value
if (currentLength > count) {
count = currentLength;
@@ -107,4 +118,264 @@
}
return count;
}
+
+
+ public void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+ }
+
+ public void encodeTableFacets(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+
+ Object key = dataTable.getRowKey();
+ dataTable.captureOrigValue(context);
+ dataTable.setRowKey(context, null);
+
+ encodeTableStructure(writer, context, dataTable);
+ saveToRequest(context, CELL_ELEMENT_KEY, HTML.TH_ELEM);
+ encodeHeaderFacet(writer, context, dataTable);
+ encodeFooterFacet(writer, context, dataTable);
+ saveToRequest(context, CELL_ELEMENT_KEY, HTML.TD_ELEM);
+ dataTable.setRowKey(context, key);
+ dataTable.restoreOrigValue(context);
+
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ UIDataTableBase dataTable = (UIDataTableBase) component;
+ encodeTableStart(writer, context, dataTable);
+ encodeTableFacets(writer, context, dataTable);
+ }
+
+ public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+ writer.startElement(HTML.TABLE_ELEMENT, component);
+ String styleClass = component.getTableSkinClass();
+ encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
+ }
+
+ public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+ writer.endElement(HTML.TABLE_ELEMENT);
+ }
+
+ public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
+ throws IOException {
+ writer.startElement(HTML.TBOBY_ELEMENT, dataTable);
+ getUtils().encodeId(context, dataTable);
+
+ String predefinedStyles = null;
+ if (dataTable instanceof UISubTable) {
+ UISubTable subTable = (UISubTable) dataTable;
+ if (!subTable.isExpanded()) {
+ predefinedStyles = "display: none;";
+ }
+ }
+
+ encodeStyle(writer, context, dataTable, predefinedStyles);
+ }
+
+ public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTableBase component) throws IOException {
+ writer.endElement(HTML.TBOBY_ELEMENT);
+ }
+
+ public abstract RowHolderBase createRowHolder(FacesContext context, UIComponent component);
+
+ public void encodeFooterFacet(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+
+ UIComponent footer = dataTable.getFooter();
+ boolean columnFacetPresent = isColumnFacetPresent(dataTable, "footer");
+
+ if ((footer != null && footer.isRendered()) || columnFacetPresent) {
+ boolean encodeTfoot = containThead();
+ if (encodeTfoot) {
+ writer.startElement(HTML.TFOOT_ELEMENT, dataTable);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-tfoot", null);
+ }
+
+ int columns = getColumnsCount(dataTable);
+
+ if (columnFacetPresent) {
+
+
+ String rowClass = dataTable.getColumnFooterSkinClass();
+ String cellClass = dataTable.getColumnFooterCellSkinClass();
+ String firstClass = dataTable.getColumnFooterFirstSkinClass();
+
+ rowClass = mergeStyleClasses("columnFooterClass", rowClass, dataTable);
+ cellClass = mergeStyleClasses("columnFooterCellClass", cellClass, dataTable);
+ firstClass = mergeStyleClasses("firstColumnFooterClass", firstClass, dataTable);
+
+ saveRowStyles(context, firstClass, rowClass, cellClass);
+
+ writer.startElement(HTML.TR_ELEMENT, dataTable);
+ encodeStyleClass(writer, context, dataTable, null, rowClass);
+ encodeColumnFacet(context, writer, dataTable.columns(), "footer",columns, cellClass);
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+
+ if (footer != null && footer.isRendered()) {
+
+ String rowClass = dataTable.getFooterSkinClass();
+ String cellClass = dataTable.getFooterCellSkinClass();
+ String firstClass = dataTable.getFooterFirstSkinClass();
+
+ rowClass = mergeStyleClasses("footerClass", rowClass, dataTable);
+ cellClass = mergeStyleClasses("footerCellClass", cellClass, dataTable);
+ firstClass = mergeStyleClasses("footerFirstClass", firstClass, dataTable);
+ // TODO nick - rename method "encodeTableHeaderFacet"
+ saveRowStyles(context, firstClass, rowClass, cellClass);
+ encodeTableFacet(context, writer, columns, footer, "footer", rowClass, cellClass);
+ }
+
+ if (encodeTfoot) {
+ writer.endElement(HTML.TFOOT_ELEMENT);
+ }
+ }
+
+ }
+
+ protected String mergeStyleClasses(String classAttribibute, String skinClass, UIComponent component) {
+ String styleClass = null;
+ String resultClass = skinClass;
+
+ if(classAttribibute != null && component != null ) {
+ styleClass = (String)component.getAttributes().get(classAttribibute);
+ }
+
+ if(styleClass != null && styleClass.trim().length() > 0) {
+ resultClass = resultClass + " " + styleClass;
+ }
+
+ return resultClass;
+ }
+
+ public void encodeHeaderFacet(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+
+ UIComponent header = dataTable.getHeader();
+ boolean isEncodeHeaders = isEncodeHeaders(dataTable);
+
+ boolean encodeThead = containThead();
+
+ if ((header != null && header.isRendered()) || isEncodeHeaders) {
+
+ if (encodeThead) {
+ writer.startElement(HTML.THEAD_ELEMENT, dataTable);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-thead", null);
+ }
+
+ int columns = getColumnsCount(dataTable);
+
+ if (header != null && header.isRendered()) {
+
+ String rowClass = dataTable.getHeaderSkinClass();
+ String cellClass = dataTable.getHeaderCellSkinClass();
+ String firstClass = dataTable.getHeaderFirstSkinClass();
+
+ rowClass = mergeStyleClasses("headerClass", rowClass, dataTable);
+ cellClass = mergeStyleClasses("headerCellClass", cellClass, dataTable);
+ firstClass = mergeStyleClasses("headerFirstClass", firstClass, dataTable);
+ saveRowStyles(context, firstClass, rowClass, cellClass);
+
+ encodeTableFacet(context, writer, columns, header, "header", rowClass, cellClass);
+ }
+
+ if (isEncodeHeaders) {
+
+ String rowClass = dataTable.getColumnHeaderSkinClass();
+ String cellClass = dataTable.getColumnHeaderCellSkinClass();
+ String firstClass = dataTable.getColumnHeaderFirstSkinClass();
+
+ rowClass = mergeStyleClasses("columnHeaderClass", rowClass, dataTable);
+ cellClass = mergeStyleClasses("columnHeaderCellClass", cellClass, dataTable);
+ firstClass = mergeStyleClasses("columnHeaderFirstClass", firstClass, dataTable);
+ saveRowStyles(context, firstClass, rowClass, cellClass);
+
+ writer.startElement(HTML.TR_ELEMENT, dataTable);
+ encodeStyleClass(writer, context, dataTable, null, rowClass);
+
+ encodeColumnFacet(context, writer, dataTable.columns(), "header", columns, cellClass);
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+
+ if (encodeThead) {
+ writer.endElement(HTML.THEAD_ELEMENT);
+ }
+ }
+
+ }
+
+ protected void encodeColumnFacet(FacesContext context, ResponseWriter writer, Iterator<UIComponent> headers, String facetName, int colCount, String cellClass) throws IOException {
+
+ int tColCount = 0;
+ String element = getCellElement(context);
+
+ while (headers.hasNext()) {
+ UIComponent column = headers.next();
+ if (!column.isRendered()) {
+ continue;
+ }
+
+ Integer colspan = (Integer) column.getAttributes().get("colspan");
+ if (colspan != null && colspan.intValue() > 0) {
+ tColCount += colspan.intValue();
+ } else {
+ tColCount++;
+ }
+
+ if (tColCount > colCount) {
+ break;
+ }
+
+ writer.startElement(element, column);
+
+ encodeStyleClass(writer, context, column, null, cellClass);
+
+ writer.writeAttribute("scope", "col", null);
+ getUtils().encodeAttribute(context, column, "colspan");
+
+ HeaderEncodeStrategy strategy = getHeaderEncodeStrategy(column, facetName);
+ strategy.encodeBegin(context, writer, column, facetName);
+
+ UIComponent facet = column.getFacet(facetName);
+ if (facet != null && facet.isRendered()) {
+ renderChild(context, facet);
+ }
+
+ strategy.encodeEnd(context, writer, column, facetName);
+
+ writer.endElement(element);
+ }
+ }
+
+ protected void encodeTableFacet(FacesContext context,ResponseWriter writer, int columns, UIComponent footer, String facetName, String rowClass, String cellClass) throws IOException {
+
+ boolean isColumnGroup = (footer instanceof Row);
+ String element = getCellElement(context);
+
+ if(!isColumnGroup) {
+ writer.startElement(HTML.TR_ELEMENT, footer);
+
+ encodeStyleClass(writer, context, footer, null, rowClass);
+
+ writer.startElement(element, footer);
+
+ encodeStyleClass(writer, context, footer, null, cellClass);
+
+ if (columns > 0) {
+ writer.writeAttribute("colspan", String.valueOf(columns), null);
+ }
+
+ writer.writeAttribute("scope", "colgroup", null);
+ }
+
+ renderChild(context, footer);
+
+ if(!isColumnGroup){
+ writer.endElement(element);
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+ }
+
+ public abstract HeaderEncodeStrategy getHeaderEncodeStrategy(UIComponent column, String tableFacetName);
+
+
+ public abstract boolean containThead();
}
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -0,0 +1,38 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.richfaces.component.UIColumnGroup;
+
+public class ColumnGroupRenderer extends DataTableRowsRenderer {
+
+ @Override
+ public void encodeRow(RowHolderBase holder) throws IOException {
+ RowHolder rowHolder = (RowHolder) holder;
+
+ UIColumnGroup row = (UIColumnGroup)rowHolder.getRow();
+ rowHolder.setRowStart(true);
+
+ Iterator<UIComponent> components = row.columns();
+ FacesContext context = rowHolder.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+
+ while(components.hasNext()){
+ UIComponent component = components.next();
+ rowHolder.lastColumn(!components.hasNext());
+ rowHolder = encodeColumn(context, (UIColumn)component, writer, rowHolder);
+ }
+ }
+
+ @Override
+ public RowHolderBase createRowHolder(FacesContext context, UIComponent component) {
+ return new RowHolder(context, (UIColumnGroup)component);
+ }
+
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -12,27 +12,24 @@
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTableBase;
import org.richfaces.component.UIDataTable;
+import org.richfaces.component.UIDataTableBase;
import org.richfaces.component.UISubTable;
+import org.richfaces.component.util.FormUtil;
@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name = "jsf-uncompressed.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "datatable.js"), @ResourceDependency(name = "table.css") })
-public class DataTableRenderer extends AbstractTableRenderer implements ElementEncodeListener {
+public class DataTableRenderer extends AbstractTableRenderer {
@Override
protected void doDecode(FacesContext context, UIComponent component) {
System.out.println("DataTableRenderer.doDecode()");
}
- protected void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
+ public void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
throws IOException {
-
- Object key = dataTable.getRowKey();
- dataTable.captureOrigValue(context);
- dataTable.setRowKey(context, null);
-
+
if (dataTable instanceof UIDataTable) {
encodeCaption(writer, context, (UIDataTable) dataTable);
// TODO nick - do we need this element if "columnsWidth" is absent?
@@ -54,146 +51,60 @@
writer.endElement("colgroup");
}
-
- encodeHeader(writer, context, dataTable);
- encodeFooter(writer, context, dataTable);
-
- dataTable.setRowKey(context, key);
- dataTable.restoreOrigValue(context);
+
}
-
- public void encodeRows(FacesContext context, UIDataTableBase dataTable) throws IOException {
-
- RowHolder holder = new RowHolder(context, dataTable);
- holder.setCellClass(dataTable.getCellSkinClass());
- holder.setRowClass(dataTable.getRowSkinClass());
- holder.setFirstRowClass(dataTable.getFirstRowSkinClass());
- holder.setHeaderRow(false);
- holder.setCellElement(HTML.TD_ELEM);
-
- encodeRows(holder);
+
+ @Override
+ public RowHolder createRowHolder(FacesContext context, UIComponent component) {
+ return new RowHolder(context, (UIDataTable)component);
}
-
- // TODO: refactor
+
+ @Override
+ public void encodeRowBegin(FacesContext context, RowHolderBase holder) throws IOException {
+ UIDataTable dataTable = (UIDataTable)holder.getRow();
+
+ String rowClass = dataTable.getRowSkinClass();
+ String cellClass = dataTable.getCellSkinClass();
+ String firstClass = dataTable.getFirstRowSkinClass();
+
+ rowClass = mergeStyleClasses("rowClass", rowClass, dataTable);
+ cellClass = mergeStyleClasses("cellClass", cellClass, dataTable);
+ firstClass = mergeStyleClasses("firstRowClass", firstClass, dataTable);
+
+ saveRowStyles(context, firstClass, rowClass, cellClass);
+ }
+
public void encodeRow(RowHolderBase holder) throws IOException {
+
FacesContext context = holder.getContext();
- RowHolder rowHolder = (RowHolder) holder;
- boolean rowStart = true;
- boolean bodyStart = false;
+
+ RowHolder rowHolder = (RowHolder)holder;
+
+ rowHolder.setRowStart(true);
+ rowHolder.resetProcessCell();
- int processCell = 0;
-
Row row = rowHolder.getRow();
- int processRow = rowHolder.getCurrentRow();
ResponseWriter writer = context.getResponseWriter();
+ encodeTableBodyStart(writer, context, (UIDataTable) row);
- if (rowHolder.isDataTable()) {
- encodeTableBodyStart(writer, context, (UIDataTable) row);
- bodyStart = true;
- }
-
- Iterator<UIComponent> iterator = row.columns();
- while (iterator.hasNext()) {
-
- UIComponent child = iterator.next();
+ Iterator<UIComponent> components = row.columns();
+ while (components.hasNext()) {
+
+ UIComponent child = components.next();
if (child instanceof Row) {
-
- Row childRow = (Row) child;
- RowHolder childRowHolder = new RowHolder(context, childRow);
- childRowHolder.setCurrentRow(processRow);
- childRowHolder.setCellElement(rowHolder.getCellElement());
-
- if (rowHolder.isHeaderRow()) {
- childRowHolder.setRowClass(rowHolder.getRowClass());
- childRowHolder.setFirstRowClass(rowHolder.getFirstRowClass());
- childRowHolder.setCellClass(rowHolder.getCellClass());
- childRowHolder.setCellElement(HTML.TH_ELEM);
- } else {
- childRowHolder.setRowClass(childRow.getRowSkinClass());
- childRowHolder.setFirstRowClass(childRow.getFirstRowSkinClass());
- childRowHolder.setCellClass(childRow.getCellSkinClass());
- childRowHolder.setCellElement(HTML.TD_ELEM);
+ encodeTableBodyEnd(writer, context, (UIDataTable) row);
+ renderChild(context, (UISubTable) child);
+ if (components.hasNext()) {
+ encodeTableBodyStart(writer, context, (UIDataTable) row);
}
- childRowHolder.setHeaderRow(rowHolder.isHeaderRow());
-
- if (child instanceof UISubTable) {
- // ecode subTable header facet
- UISubTable subTable = (UISubTable) child;
-
- if (bodyStart) {
- encodeTableBodyEnd(writer, context, (UIDataTableBase) row);
- bodyStart = false;
- }
- // subTable.setRowKey(childRowHolder.getCurrentRow());
-
- /*
- * Object key = subTable.getRowKey(); subTable.captureOrigValue(context);
- * subTable.setRowKey(context, null);
- */
-
- encodeTableBodyStart(writer, context, subTable);
- encodeHeader(writer, context, subTable);
-
- encodeRows(childRowHolder);
-
- encodeFooter(writer, context, subTable);
-
- /*
- * subTable.setRowKey(context, key); subTable.restoreOrigValue(context);
- */
-
- // encodeHiddenInput(context, writer, subTable);
- encodeTableBodyEnd(writer, context, subTable);
-
- bodyStart = false;
- if (iterator.hasNext()) {
- encodeTableBodyStart(writer, context, (UIDataTableBase) row);
- bodyStart = true;
- }
-
- } else {
- encodeRows(childRowHolder);
- }
-
} else if (child instanceof UIColumn) {
-
- if (child instanceof org.richfaces.component.UIColumn) {
- org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) child;
- if (column.isBreakBefore() && processCell != 0) {
- encodeRowEnd(writer, context, column);
- rowHolder.nextRow();
- rowStart = true;
- }
- }
-
- if (rowStart) {
- if (processRow == 0) {
- encodeFirstRowStart(writer, context, child, rowHolder);
- } else {
- encodeRowStart(writer, context, child, rowHolder);
- }
-
- rowStart = false;
- }
-
- encodeCellStart(writer, context, child, rowHolder);
- encodeCellEnd(writer, context, child, rowHolder);
-
- if (!iterator.hasNext()) {
- if (processRow == 0) {
- encodeFirstRowEnd(writer, context, child);
- } else {
- encodeRowEnd(writer, context, child);
- }
- }
- processCell++;
- }
+ rowHolder.lastColumn(!components.hasNext());
+ rowHolder = encodeColumn(context, (UIColumn)child, writer, rowHolder);
+ }
}
- if (bodyStart && rowHolder.isDataTable()) {
- encodeTableBodyEnd(writer, context, (UIDataTableBase) row);
- }
+ encodeTableBodyEnd(writer, context, (UIDataTableBase) row);
}
/*
@@ -209,31 +120,6 @@
*/
@Override
- protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- if (!shouldProceed(component)) {
- return;
- }
- UIDataTableBase dataTable = (UIDataTableBase) component;
- encodeTableStart(writer, context, dataTable);
- encodeTableStructure(writer, context, dataTable);
- }
-
- @Override
- protected void doEncodeChildren(ResponseWriter writer, FacesContext context, UIComponent component)
- throws IOException {
-
- if (!shouldProceed(component)) {
- return;
- }
-
- UIDataTableBase dataTable = (UIDataTableBase) component;
- // encodeTableBodyStart(writer, context, dataTable);
- encodeRows(context, dataTable);
- // encodeTableBodyEnd(writer, context, dataTable);
-
- }
-
- @Override
protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
if (!shouldProceed(component)) {
@@ -252,93 +138,7 @@
protected Class<? extends UIComponent> getComponentClass() {
return UIDataTable.class;
}
-
- public void encodeCellEnd(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException {
- writer.endElement(holder.getCellElement());
- }
-
- public void encodeCellStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException {
- // anton - TODO: scope attribute
- writer.startElement(holder.getCellElement(), component);
- String cellClass = holder.getCellClass();
- encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
-
- if (component instanceof org.richfaces.component.UIColumn) {
- org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) component;
-
- int rowspan = column.getRowspan();
- if (rowspan != Integer.MIN_VALUE) {
- writer.writeAttribute("rowspan", Integer.valueOf(rowspan), null);
- }
-
- int colspan = column.getColspan();
- if (colspan != Integer.MIN_VALUE) {
- writer.writeAttribute("colspan", Integer.valueOf(colspan), null);
- }
- }
- renderChildren(context, component);
- }
-
- public void encodeFirstRowEnd(ResponseWriter writer, FacesContext context, UIComponent component)
- throws IOException {
- writer.endElement(HTML.TR_ELEMENT);
- }
-
- public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException {
- writer.startElement(HTML.TR_ELEMENT, component);
- getUtils().encodeId(context, component);
- String styleClass = holder.getRowClass() + " " + holder.getFirstRowClass();
- encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
- }
-
- public void encodeRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
- writer.endElement(HTML.TR_ELEMENT);
- }
-
- public void encodeRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolder holder)
- throws IOException {
- writer.startElement(HTML.TR_ELEMENT, component);
- getUtils().encodeId(context, component);
- String styleClass = holder.getRowClass();
- encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
- }
-
- public void encodeTableBodyEnd(ResponseWriter writer, FacesContext context, UIDataTableBase component)
- throws IOException {
- writer.endElement(HTML.TBOBY_ELEMENT);
- }
-
- public void encodeTableBodyStart(ResponseWriter writer, FacesContext context, UIDataTableBase component)
- throws IOException {
- writer.startElement(HTML.TBOBY_ELEMENT, component);
- getUtils().encodeId(context, component);
-
- String predefinedStyles = null;
- if (component instanceof UISubTable) {
- UISubTable subTable = (UISubTable) component;
- if (!subTable.isExpanded()) {
- predefinedStyles = "display: none;";
- }
- }
-
- encodeStyle(writer, context, component, predefinedStyles);
- }
-
- public void encodeTableEnd(ResponseWriter writer, FacesContext context, UIDataTableBase component)
- throws IOException {
- writer.endElement(HTML.TABLE_ELEMENT);
- }
-
- public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTableBase component)
- throws IOException {
- writer.startElement(HTML.TABLE_ELEMENT, component);
- String styleClass = getTableSkinClass();
- encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
- }
-
+
public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException {
UIComponent caption = dataTable.getCaption();
@@ -354,7 +154,7 @@
writer.startElement(HTML.CAPTION_ELEMENT, dataTable);
String captionClass = (String) dataTable.getAttributes().get("captionClass");
- String captionSkinClass = getCaptionSkinClass();
+ String captionSkinClass = dataTable.getCaptionSkinClass();
captionClass = captionClass != null ? captionClass + " " + captionClass : captionSkinClass;
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, captionClass, "captionClass");
@@ -369,250 +169,73 @@
writer.endElement(HTML.CAPTION_ELEMENT);
}
-
- public void encodeFooter(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
-
- Iterator<UIComponent> tableColumns = dataTable.columns();
-
- UIComponent footer = dataTable.getFooter();
- boolean columnFacetPresent = isColumnFacetPresent(dataTable, "footer");
-
- if ((footer != null && footer.isRendered()) || columnFacetPresent) {
- boolean encodeTfoot = (dataTable instanceof UIDataTable);
- String cellElement = HTML.TD_ELEM;
-
- if (encodeTfoot) {
- writer.startElement(HTML.TFOOT_ELEMENT, dataTable);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-tfoot", null);
- cellElement = HTML.TH_ELEM;
- }
-
- String footerClass = (String) dataTable.getAttributes().get("footerClass");
- int columns = getColumnsCount(dataTable);
-
- if (columnFacetPresent) {
- writer.startElement(HTML.TR_ELEMENT, dataTable);
-
- encodeStyleClass(writer, context, dataTable, "footerClass", dataTable.getColumnFooterSkinClass());
- // TODO nick - rename method "encodeHeaderFacets"
- encodeHeaderFacets(context, writer, tableColumns, dataTable.getColumnFooterCellSkinClass(),
- footerClass, "footer", cellElement, columns);
- writer.endElement(HTML.TR_ELEMENT);
- }
-
- if (footer != null && footer.isRendered()) {
- // TODO nick - rename method "encodeTableHeaderFacet"
- encodeTableHeaderFacet(context, columns, writer, footer, dataTable.getFooterFirstRowSkinClass(),
- dataTable.getFooterRowSkinClass(), dataTable.getFooterCellSkinClass(), footerClass, cellElement);
- }
-
- if (encodeTfoot) {
- writer.endElement(HTML.TFOOT_ELEMENT);
- }
- }
-
+
+
+ @Override
+ public HeaderEncodeStrategy getHeaderEncodeStrategy(UIComponent column, String tableFacetName) {
+
+ return ((column instanceof org.richfaces.component.UIColumn && "header".equals(tableFacetName)) ?
+ new RichHeaderEncodeStrategy() : new SimpleHeaderEncodeStrategy());
}
+
+ protected class RichHeaderEncodeStrategy implements HeaderEncodeStrategy {
- public void encodeHeader(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
-
- UIComponent header = dataTable.getHeader();
- boolean isEncodeHeaders = isEncodeHeaders(dataTable);
-
- boolean encodeThead = (dataTable instanceof UIDataTable);
-
- if ((header != null && header.isRendered()) || isEncodeHeaders) {
-
- String cellElement = HTML.TD_ELEM;
-
- if (encodeThead) {
- writer.startElement(HTML.THEAD_ELEMENT, dataTable);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-thead", null);
- cellElement = HTML.TH_ELEM;
-
+ public void encodeBegin(FacesContext context, ResponseWriter writer, UIComponent column, String facetName)
+ throws IOException {
+
+ org.richfaces.component.UIColumn col = (org.richfaces.component.UIColumn) column;
+
+ String columnClientId = col.getClientId(context);
+ String clientId = columnClientId + facetName;
+ writer.writeAttribute("id", clientId, null);
+ boolean sortableColumn = isSortable(col);
+
+ if (sortableColumn && col.isSelfSorted()) {
+ FormUtil.throwEnclFormReqExceptionIfNeed(context, column.getParent());
+ writer.writeAttribute(HTML.ONCLICK_ATTRIBUTE, createFunction(context, col) , null);
+ writer.writeAttribute(HTML.STYLE_ATTRIBUTE, "cursor: pointer;", null);
}
- // TODO anton - maybe we should have separate css class for column header???
- String headerClass = (String) dataTable.getAttributes().get("headerClass");
-
- int columns = getColumnsCount(dataTable);
-
- if (header != null && header.isRendered()) {
-
- encodeTableHeaderFacet(context, columns, writer, header, dataTable.getHeaderFirstRowSkinClass(),
- dataTable.getHeaderRowSkinClass(), dataTable.getHeaderCellSkinClass(),
- // "rich-table-header",
- // TODO nick - rename classes!!!
- // "rich-table-header-continue",
- // "rich-table-headercell",
- headerClass, cellElement);
+
+ writer.startElement(HTML.DIV_ELEM, column);
+// writer.writeAttribute(HTML.ID_ATTRIBUTE, clientId + SORT_DIV, null);
+
+ if (sortableColumn) {
+ writer.startElement(HTML.SPAN_ELEM, column);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rich-table-sortable-header", null);
}
-
- if (isEncodeHeaders) {
- writer.startElement(HTML.TR_ELEMENT, dataTable);
- encodeStyleClass(writer, context, dataTable, "headerClass", dataTable.getColumnHeaderSkinClass());// "rich-table-subheader");
- encodeHeaderFacets(context, writer, dataTable.columns(),
- dataTable.getColumnHeaderCellSkinClass()/* "rich-table-subheadercell" */, headerClass, "header",
- cellElement, columns);
- writer.endElement(HTML.TR_ELEMENT);
- }
-
- if (encodeThead) {
- writer.endElement(HTML.THEAD_ELEMENT);
- }
}
- }
+ public void encodeEnd(FacesContext context, ResponseWriter writer, UIComponent column, String facetName)
+ throws IOException {
- protected void encodeTableHeaderFacet(FacesContext context, int columns, ResponseWriter writer, UIComponent footer,
- String skinFirstRowClass, String skinRowClass, String skinCellClass, String footerClass, String element)
- throws IOException {
-
- if (footer instanceof Row) {
- Row row = (Row) footer;
-
- RowHolder holder = new RowHolder(context, row);
- holder.setCellElement(element);
- holder.setFirstRowClass(skinFirstRowClass);
- holder.setRowClass(skinRowClass);
- holder.setCellClass(skinCellClass);
- // holder.resetCurrentRow();
- holder.setHeaderRow(true);
-
- encodeRows(holder);
-
- } else {
- writer.startElement(HTML.TR_ELEMENT, footer);
-
- String rowClass = skinFirstRowClass;
- String cellClass = skinCellClass;
- if (footerClass != null && footerClass.trim().length() != 0) {
- rowClass = rowClass + " " + footerClass;
- cellClass = cellClass + " " + footerClass;
- }
-
- encodeStyleClass(writer, context, footer, null, rowClass);
-
- writer.startElement(element, footer);
-
- encodeStyleClass(writer, context, footer, null, cellClass);
-
- if (columns > 0) {
- writer.writeAttribute("colspan", String.valueOf(columns), null);
- }
-
- writer.writeAttribute("scope", "colgroup", null);
-
- renderChild(context, footer);
-
- writer.endElement(element);
- writer.endElement(HTML.TR_ELEMENT);
}
- }
- protected void encodeHeaderFacets(FacesContext context, ResponseWriter writer, Iterator<UIComponent> headers,
- String skinCellClass, String headerClass, String facetName, String element, int colCount) throws IOException {
-
- int tColCount = 0;
-
- while (headers.hasNext()) {
- UIComponent column = headers.next();
- if (!column.isRendered()) {
- continue;
- }
-
- Integer colspan = (Integer) column.getAttributes().get("colspan");
- if (colspan != null && colspan.intValue() > 0) {
- tColCount += colspan.intValue();
- } else {
- tColCount++;
- }
-
- if (tColCount > colCount) {
- break;
- }
-
- String classAttribute = facetName + "Class";
-
- String columnHeaderClass = (String) column.getAttributes().get(classAttribute);
-
- String styleClass = skinCellClass;
- if (headerClass != null && headerClass.trim().length() != 0) {
- styleClass = styleClass + " " + headerClass;
- }
-
- if (columnHeaderClass != null && columnHeaderClass.trim().length() != 0) {
- styleClass = styleClass + " " + columnHeaderClass;
- }
-
- writer.startElement(element, column);
-
- encodeStyleClass(writer, context, column, null, styleClass);
-
- writer.writeAttribute("scope", "col", null);
- getUtils().encodeAttribute(context, column, "colspan");
-
- UIComponent facet = column.getFacet(facetName);
- if (facet != null && facet.isRendered()) {
- renderChild(context, facet);
- }
-
- writer.endElement(element);
+ public boolean isSortable(UIColumn column) {
+ return (column.getAttributes().get("sortBy") != null);
}
- }
-
- protected void encodeStyleClass(ResponseWriter writer, FacesContext context, UIComponent component,
- String styleClassAttribute, String styleClass) throws IOException {
- boolean isEmpty = isEmptyAttr(component, styleClassAttribute);
- if (isEmpty && !(styleClass != null && styleClass.trim().length() != 0)) {
- return;
+
+ public String createFunction(FacesContext context, org.richfaces.component.UIColumn column) {
+ //build script
+ return null;
}
- String componentStyleClass = isEmpty ? styleClass : styleClass + " "
- + component.getAttributes().get(styleClassAttribute);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, componentStyleClass, null);
}
+
+ protected class SimpleHeaderEncodeStrategy implements HeaderEncodeStrategy {
- protected boolean isEmptyAttr(UIComponent component, String attribute) {
- if (attribute == null) {
- return true;
- }
- String value = (String) component.getAttributes().get(attribute);
- return !(value != null && value.trim().length() != 0);
- }
+ public void encodeBegin(FacesContext context, ResponseWriter writer, UIComponent column, String facetName)
+ throws IOException {
- protected void encodeStyle(ResponseWriter writer, FacesContext context, UIComponent component,
- String predefinedStyles) throws IOException {
- StringBuffer toEncode = new StringBuffer();
-
- if (!isEmptyAttr(component, HTML.STYLE_ATTRIBUTE)) {
- String style = ((String) component.getAttributes().get(HTML.STYLE_ATTRIBUTE)).trim();
- style = style.endsWith(";") ? style : style + ";";
- toEncode.append(style);
}
- if (!isEmpty(predefinedStyles)) {
- String style = predefinedStyles.endsWith(";") ? predefinedStyles : predefinedStyles + ";";
- toEncode.append(style);
- }
+ public void encodeEnd(FacesContext context, ResponseWriter writer, UIComponent column, String facetName)
+ throws IOException {
- if (toEncode.length() > 0) {
- writer.writeAttribute(HTML.STYLE_ATTRIBUTE, toEncode.toString(), null);
}
}
- protected boolean isEmpty(String style) {
- return !((style != null) && (style.trim().length() != 0));
+ @Override
+ public boolean containThead() {
+ return true;
}
-
- protected String getTableSkinClass() {
- return "rich-table";
- }
-
- protected String getTableHeadSkinClass() {
- return "rich-table-head";
- }
-
- protected String getCaptionSkinClass() {
- return "rich-table-caption";
- }
-
}
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/DataTableRowsRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -0,0 +1,180 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+
+
+public abstract class DataTableRowsRenderer extends AbstractRowsRenderer {
+
+ public static final String ROW_CLASS_KEY = "rowClass";
+
+ public static final String FIRST_ROW_CLASS_KEY = "firstRowClass";
+
+ public static final String CELL_CLASS_KEY = "cellClass";
+
+ public static final String CELL_ELEMENT_KEY = "cellElement";
+
+
+ public RowHolder encodeColumn(FacesContext context, UIColumn component, ResponseWriter writer, RowHolder holder) throws IOException {
+
+ if (component instanceof org.richfaces.component.UIColumn) {
+ org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) component;
+ if (column.isBreakBefore() && holder.getProcessCell() != 0) {
+ encodeRowEnd(writer, context, column);
+ holder.nextRow();
+ holder.setRowStart(true);
+ }
+ }
+
+ if (holder.isRowStart()) {
+ if (holder.getCurrentRow() == 0) {
+ encodeFirstRowStart(writer, context, component, holder);
+ } else {
+ encodeRowStart(writer, context, component, holder);
+ }
+
+ holder.setRowStart(false);
+ }
+
+ encodeColumnStart(writer, context, component, holder);
+ renderChildren(context, component);
+ encodeColumnEnd(writer, context, component, holder);
+
+ if (holder.isLastColumn()) {
+ if (holder.getCurrentRow() == 0) {
+ encodeFirstRowEnd(writer, context, component);
+ } else {
+ encodeRowEnd(writer, context, component);
+ }
+ }
+ holder.nextCell();
+
+ return holder;
+ }
+
+ public void encodeColumnStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolderBase holder) throws IOException {
+ writer.startElement(getCellElement(context), component);
+ String cellClass = getCellClass(holder.getContext());
+ encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
+
+ if (component instanceof org.richfaces.component.UIColumn) {
+ org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) component;
+
+ int rowspan = column.getRowspan();
+ if (rowspan != Integer.MIN_VALUE) {
+ writer.writeAttribute("rowspan", Integer.valueOf(rowspan), null);
+ }
+
+ int colspan = column.getColspan();
+ if (colspan != Integer.MIN_VALUE) {
+ writer.writeAttribute("colspan", Integer.valueOf(colspan), null);
+ }
+ }
+ }
+
+ public void encodeColumnEnd(ResponseWriter writer, FacesContext context, UIComponent component, RowHolderBase holder) throws IOException {
+ writer.endElement(getCellElement(context));
+ }
+
+ public void encodeFirstRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolderBase holder) throws IOException {
+ writer.startElement(HTML.TR_ELEMENT, component);
+ getUtils().encodeId(context, component);
+ String styleClass = getFirstRowClass(holder.getContext());
+ encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
+ }
+
+ public void encodeFirstRowEnd(ResponseWriter writer, FacesContext context, UIComponent component)throws IOException {
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+
+ public void encodeRowStart(ResponseWriter writer, FacesContext context, UIComponent component, RowHolderBase holder) throws IOException {
+ writer.startElement(HTML.TR_ELEMENT, component);
+ getUtils().encodeId(context, component);
+ String styleClass = getRowClass(holder.getContext());
+ encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, styleClass);
+ }
+
+ public void encodeRowEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.endElement(HTML.TR_ELEMENT);
+ }
+
+
+ protected String getFirstRowClass(FacesContext context) {
+ return getFromRequest(context, FIRST_ROW_CLASS_KEY);
+ }
+
+ protected String getRowClass(FacesContext context) {
+ return getFromRequest(context, ROW_CLASS_KEY);
+ }
+
+ protected String getCellClass(FacesContext context) {
+ return getFromRequest(context, CELL_CLASS_KEY);
+ }
+
+ protected String getCellElement(FacesContext context) {
+ return getFromRequest(context, CELL_ELEMENT_KEY);
+ }
+
+ private String getFromRequest(FacesContext context, String key) {
+ return (String)context.getExternalContext().getRequestMap().get(key);
+ }
+
+ protected void saveToRequest(FacesContext context, String key, String value) {
+ context.getExternalContext().getRequestMap().put(key, value);
+ }
+
+ protected void saveRowStyles(FacesContext context, String firstRowClass, String rowClass, String cellClass) {
+ saveToRequest(context, FIRST_ROW_CLASS_KEY, firstRowClass);
+ saveToRequest(context, ROW_CLASS_KEY, rowClass);
+ saveToRequest(context, CELL_CLASS_KEY, cellClass);
+ }
+
+ public void encodeStyleClass(ResponseWriter writer, FacesContext context, UIComponent component,
+ String styleClassAttribute, String styleClass) throws IOException {
+
+ boolean isEmpty = isEmptyAttr(component, styleClassAttribute);
+ if (isEmpty && !(styleClass != null && styleClass.trim().length() != 0)) {
+ return;
+ }
+
+ String componentStyleClass = isEmpty ? styleClass : styleClass + " "
+ + component.getAttributes().get(styleClassAttribute);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, componentStyleClass, null);
+ }
+
+ protected boolean isEmptyAttr(UIComponent component, String attribute) {
+ if (attribute == null) {
+ return true;
+ }
+
+ String value = (String) component.getAttributes().get(attribute);
+ return !(value != null && value.trim().length() != 0);
+ }
+
+ protected void encodeStyle(ResponseWriter writer, FacesContext context, UIComponent component,
+ String predefinedStyles) throws IOException {
+
+ StringBuffer toEncode = new StringBuffer();
+
+ if (!isEmptyAttr(component, HTML.STYLE_ATTRIBUTE)) {
+ String style = ((String) component.getAttributes().get(HTML.STYLE_ATTRIBUTE)).trim();
+ style = style.endsWith(";") ? style : style + ";";
+ toEncode.append(style);
+ }
+
+ if (!isEmpty(predefinedStyles)) {
+ String style = predefinedStyles.endsWith(";") ? predefinedStyles : predefinedStyles + ";";
+ toEncode.append(style);
+ }
+
+ if (toEncode.length() > 0) {
+ writer.writeAttribute(HTML.STYLE_ATTRIBUTE, toEncode.toString(), null);
+ }
+ }
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -330,4 +330,36 @@
}
return width;
}
+
+
+
+ @Override
+ public void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
+ throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public RowHolder createRowHolder(FacesContext context, UIComponent component) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected void encodeTableFacet(FacesContext context, ResponseWriter writer, int columns, UIComponent facet,
+ String facetName, String rowClass, String cellClass) throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean containThead() {
+ return false;
+ }
+
+ @Override
+ public HeaderEncodeStrategy getHeaderEncodeStrategy(UIComponent column, String tableFacetName) {
+ return null;
+ }
}
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/HeaderEncodeStrategy.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+public interface HeaderEncodeStrategy {
+
+ public abstract void encodeBegin(FacesContext context, ResponseWriter writer,
+ UIComponent column, String facetName) throws IOException;
+
+ public abstract void encodeEnd(FacesContext context, ResponseWriter writer,
+ UIComponent column, String facetName) throws IOException;
+
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolder.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -3,87 +3,60 @@
import javax.faces.context.FacesContext;
import org.richfaces.component.Row;
-import org.richfaces.component.UIColumnGroup;
-import org.richfaces.component.UIDataTable;
-import org.richfaces.component.UISubTable;
public class RowHolder extends RowHolderBase {
- private String cellElement;
+ private Row row;
+
+ private int processCell;
+
+ private boolean isLastColumn;
+
+ private boolean isRowStart;
- private String cellClass;
-
- private String rowClass;
-
- private String firstRowClass;
-
- private boolean headerRow;
- private Row row;
-
+ public Row getRow() {
+ return this.row;
+ }
+
public RowHolder(FacesContext context, Row row) {
+ this(context, row, 0, true);
+
+ }
+
+ public RowHolder(FacesContext context, Row row, int processCell, boolean isRowStart) {
super(context);
this.row = row;
+ this.processCell = processCell;
+ this.isRowStart = isRowStart;
}
- public boolean isHeaderRow() {
- return headerRow;
+ public int getProcessCell() {
+ return processCell;
}
- public void setHeaderRow(boolean headerRow) {
- this.headerRow = headerRow;
+ public void resetProcessCell() {
+ this.processCell = 0;
}
-
- public String getCellClass() {
- return this.cellClass;
+
+ public void nextCell(){
+ processCell++;
}
-
- public void setCellClass(String cellClass) {
- this.cellClass = cellClass;
+
+ public boolean isLastColumn() {
+ return isLastColumn;
}
- public String getRowClass() {
- return this.rowClass;
+ public void lastColumn(boolean lastColumn) {
+ this.isLastColumn = lastColumn;
}
-
- public void setRowClass(String rowClass) {
- this.rowClass = rowClass;
+
+ public boolean isRowStart() {
+ return isRowStart;
}
- public String getFirstRowClass() {
- return this.firstRowClass;
+ public void setRowStart(boolean isRowStart) {
+ this.isRowStart = isRowStart;
}
-
- public void setFirstRowClass(String firstRowClass) {
- this.firstRowClass = firstRowClass;
- }
-
- public String getCellElement() {
- return cellElement;
- }
-
- public void setCellElement(String cellElement) {
- this.cellElement = cellElement;
- }
-
- public Row getRow() {
- return this.row;
- }
-
- public void setRow(Row row) {
- this.row = row;
- }
-
- public boolean isColGroup() {
- return row instanceof UIColumnGroup;
- }
-
- public boolean isSubTable() {
- return row instanceof UISubTable;
- }
-
- public boolean isDataTable() {
- return row instanceof UIDataTable;
- }
-
+
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/RowHolderBase.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -8,10 +8,15 @@
private FacesContext context;
- private int currentRow = 0;
+ private int currentRow;
public RowHolderBase(FacesContext context) {
+ this(context, 0);
+ }
+
+ public RowHolderBase(FacesContext context, int currentRow) {
this.context = context;
+ currentRow = 0;
}
public FacesContext getContext() {
Added: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java (rev 0)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -0,0 +1,80 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.Row;
+import org.richfaces.component.UIDataTableBase;
+import org.richfaces.component.UISubTable;
+
+public class SubTableRenderer extends AbstractTableRenderer {
+
+ @Override
+ public void encodeTableFacets(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
+ throws IOException {
+ UISubTable subTable = (UISubTable)dataTable;
+
+ encodeHeaderFacet(writer, context, subTable);
+
+ String rowClass = subTable.getRowSkinClass();
+ String cellClass = subTable.getCellSkinClass();
+ String firstClass = subTable.getFirstRowSkinClass();
+
+ rowClass = mergeStyleClasses("rowClass", rowClass, subTable);
+ cellClass = mergeStyleClasses("cellClass", cellClass, subTable);
+ firstClass = mergeStyleClasses("firstRowClass", firstClass, subTable);
+
+ saveRowStyles(context, firstClass, rowClass, cellClass);
+ }
+
+ @Override
+ public void encodeTableStart(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
+ saveToRequest(context, CELL_ELEMENT_KEY, HTML.TD_ELEM);
+ UISubTable subTable = (UISubTable)dataTable;
+ encodeTableBodyStart(writer, context, subTable);
+ }
+
+ @Override
+ public RowHolderBase createRowHolder(FacesContext context, UIComponent component) {
+ return new RowHolder(context, (UISubTable)component);
+ }
+
+ @Override
+ public void encodeRow(RowHolderBase holder) throws IOException {
+ RowHolder rowHolder = (RowHolder)holder;
+ Row row = rowHolder.getRow();
+ Iterator<UIComponent> components = row.columns();
+ FacesContext context = rowHolder.getContext();
+ ResponseWriter writer = context.getResponseWriter();
+
+ while(components.hasNext()) {
+ UIColumn column = (UIColumn)components.next();
+ rowHolder.lastColumn(!components.hasNext());
+ encodeColumn(context, column, writer, rowHolder);
+ }
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ UISubTable subTable = (UISubTable)component;
+ encodeFooterFacet(writer, context, subTable);
+ encodeTableBodyEnd(writer, context, subTable);
+ }
+
+ @Override
+ public boolean containThead() {
+ return false;
+ }
+
+ @Override
+ public HeaderEncodeStrategy getHeaderEncodeStrategy(UIComponent column, String tableFacetName) {
+ // TODO implement column header facet
+ return null;
+ }
+}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/java/org/richfaces/renderkit/ToggleControlRendererBase.java 2009-12-21 15:19:30 UTC (rev 16177)
@@ -13,6 +13,7 @@
import javax.faces.context.ResponseWriter;
import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.Expandable;
@@ -25,7 +26,7 @@
*
*/
@ResourceDependencies( {@ResourceDependency(library = "javax.faces", name = "jsf-uncompressed.js"),
- @ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "toggler.js")})
+ @ResourceDependency(name = "richfaces.js"), @ResourceDependency(name="richfaces-queue.js"), @ResourceDependency(name = "toggler.js")})
public abstract class ToggleControlRendererBase extends RendererBase {
private static final String MANAGER_SCRIPT = "RichFaces.ui.ToggleManager.addToggler(new RichFaces.ui.Toggle(''{0}'', {1}));";
@@ -61,11 +62,15 @@
boolean newState = Boolean.valueOf(state).booleanValue();
UIComponent processed = findComponent(context, toggle);
if (processed instanceof Expandable) {
-
+
boolean prevState = ((Expandable) processed).isExpanded();
if (newState != prevState) {
new ToggleEvent(processed, newState).queue();
}
+// toggle.getExecute().add((String)processed.getAttributes().get("clientId"));
+// toggle.getRender().add((String)processed.getAttributes().get("clientId"));
+ toggle.addExecuteId((String)processed.getAttributes().get("clientId"));
+ toggle.addRenderId((String)processed.getAttributes().get("clientId"));
}
}
}
@@ -146,6 +151,10 @@
options.put("formId", formId);
options.put("forId", forId);
options.put("initialState", (Boolean) subTable.isExpanded());
+ options.put("eventName", toggleControl.getEvent());
+ if(subTable.getSwichType().equals(UISubTable.SWITCH_TYPE_AJAX)) {
+ options.put("ajax", AjaxRendererUtils.buildEventOptions(context, subTable));
+ }
return ScriptUtils.toScript(options);
}
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/old_configs/component/tables.xml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/old_configs/component/tables.xml 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/old_configs/component/tables.xml 2009-12-21 15:19:30 UTC (rev 16177)
@@ -29,7 +29,7 @@
<classname>org.richfaces.component.html.HtmlToggleControl</classname>
<superclass>org.richfaces.component.UIToggleControl</superclass>
- <renderer generate="true" override="true">
+ <renderer>
<name>org.richfaces.renderkit.html.ToggleControlRenderer</name>
<template>org/richfaces/renderkit/html/toggle-control.template.xml</template>
</renderer>
@@ -43,14 +43,10 @@
</component>
<component>
- <name>org.richfaces.Colgroup</name>
- <family>org.richfaces.Colgroup</family>
+ <name>org.richfaces.ColumnGroup</name>
+ <family>org.richfaces.ColumnGroup</family>
<classname>org.richfaces.component.html.HtmlColumnGroup</classname>
<superclass>org.richfaces.component.UIColumnGroup</superclass>
- <renderer generate="true">
- <name>org.richfaces.renderkit.html.SimpleColgroupRenderer</name>
- <template>org/richfaces/renderkit/html/colgroup.template.xml</template>
- </renderer>
<tag>
<name>colGroup</name>
<classname>
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/table.css 2009-12-21 15:19:30 UTC (rev 16177)
@@ -9,7 +9,7 @@
.rich-table-row{
}
-.rich-table-firstrow{
+.rich-table-first-row{
}
.rich-table-cell{
@@ -41,7 +41,7 @@
.rich-table-header{
}
-.rich-table-header-continue{
+.rich-table-header-first {
}
.rich-table-header-cell{
@@ -58,6 +58,9 @@
.rich-table-subheader{
}
+.rich-table-subheader-first {
+}
+
.rich-table-subheader-cell{
border-bottom:1px solid #C0C0C0;
border-right:1px solid #C0C0C0;
@@ -67,6 +70,12 @@
padding:4px;
}
+.rich-table-subfooter {
+}
+
+.rich-table-subfooter-first {
+}
+
.rich-table-subfooter-cell{
border-bottom:1px solid #C0C0C0;
border-right:1px solid #C0C0C0;
@@ -83,7 +92,7 @@
.rich-table-footer{
}
-.rich-table-footer-continue{
+.rich-table-footer-first{
}
.rich-table-footer-cell{
@@ -97,7 +106,8 @@
text-align:left;
}
-.rich-subtable-footer{
+/*--------------------------------------------*/
+.rich-subtable-footer {
background-color: #7878B4;
}
@@ -114,7 +124,6 @@
.rich-subtable-header-row {
background-color: grey;
-
}
.rich-subtable-header-cell {
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/toggler.js
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/toggler.js 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/resources/toggler.js 2009-12-21 15:19:30 UTC (rev 16177)
@@ -121,13 +121,13 @@
},
ajaxToggle: function(expand){
- if(richfaces.ajax && typeof richfaces.ajax == 'function') {
this.saveState(expand);
var source = this.id;
var event = this.options.eventName;
var params = this.options.ajax;
+ params['org.richfaces.ajax.component'] = source;
jsf.ajax.request(source, event, params);
- }
+
},
command: function(name, element){
Modified: root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml
===================================================================
--- root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml 2009-12-21 07:22:35 UTC (rev 16176)
+++ root/ui-sandbox/trunk/components/tables/ui/src/main/resources/META-INF/tables.taglib.xml 2009-12-21 15:19:30 UTC (rev 16177)
@@ -27,15 +27,15 @@
<tag>
<tag-name>colGroup</tag-name>
<component>
- <component-type>org.richfaces.Colgroup</component-type>
- <!-- renderer-type>org.richfaces.ColumnGroupRenderer</renderer-type -->
+ <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.renderkit.SubTableRenderer</renderer-type-->
+ <renderer-type>org.richfaces.SubTableRenderer</renderer-type>
<handler-class>org.richfaces.taglib.SubTableHandler</handler-class>
</component>
</tag>
15 years, 4 months
JBoss Rich Faces SVN: r16176 - in root/docs/trunk/Component_Reference/en-US: extras and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2009-12-21 02:22:35 -0500 (Mon, 21 Dec 2009)
New Revision: 16176
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample
Log:
Fixed rendering errors
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-21 07:03:04 UTC (rev 16175)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-21 07:22:35 UTC (rev 16176)
@@ -62,7 +62,7 @@
The <acronym>JSF</acronym> <methodname>javax.faces.component.UIViewRoot.setLocale()</methodname> method can be used to update the locale through a Java class:
</para>
-<programlisting language="java" role="JAVA">
+<programlisting language="Java" role="JAVA">
<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</step>
@@ -230,7 +230,7 @@
The <varname>createContent</varname> attribute points to the method used for generating the displayed content. If necessary, the <varname>value</varname> attribute can be used to pass input data to the content generation method specified with <varname>createContent</varname>. The <varname>cacheable</varname> attribute specifies whether the resulting content will be cached or not.
</para>
<para>
- The <varname>mimeType</varname> attribute describes the type of output content, and corresponds to the type in the header of the <acronym>HTTP</acronym> request. The <varname>element</varname> attribute defines <attribute>XHTML</attribute> element used to display the content:
+ The <varname>mimeType</varname> attribute describes the type of output content, and corresponds to the type in the header of the <acronym>HTTP</acronym> request. The <varname>element</varname> attribute defines <acronym>XHTML</acronym> element used to display the content:
</para>
<itemizedlist>
<listitem>
@@ -277,39 +277,41 @@
The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <methodname>MediaBean.paint</methodname> method to create the image. The method generates a random number, which is then converted into an output stream and rendered to a <acronym>JPEG</acronym> image. The <classname>MediaBean</classname> class is as follows:
</para>
-<programlisting language="XML" role="XML">
+<programlisting language="Java" role="JAVA">
<xi:include href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
<para>
Another class, <classname>MediaData</classname> is required by the <varname>value</varname> attribute for keeping data to be used as input for the content creation method. The <classname>MediaData</classname> class is as follows:
</para>
-<programlisting language="XML" role="XML">
+<programlisting language="Java" role="JAVA">
<xi:include href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
+ <para>
+ The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <classname>MediaBean</classname> and <classname>MediaData</classname> classes to generate a new image on each page refresh, which appears as shown in <xref linkend="figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result" />
+ </para>
+ <blockquote>
+ <figure id="figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result">
+ <title><sgmltag><a4j:mediaOutput></sgmltag> example result</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The generated image containing a random verification number.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+ </blockquote>
</example>
<note>
- <title>Note</title>
+ <title><classname>Serializable</classname> interface</title>
<para>
A bean class passed using the <varname>value</varname> attribute of <sgmltag><a4j:mediaOutput></sgmltag> should implement the <classname>Serializable</classname> interface so that it will be encoded to the <acronym>URL</acronym> of the resource.
</para>
</note>
- <para>
- The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <classname>MediaBean</classname> and <classname>MediaData</classname> classes to generate a new image on each page refresh, which appears as
- </para>
- <figure id="figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result">
- <title><sgmltag><a4j:mediaOutput></sgmltag> example result</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png" format="PNG" />
- </imageobject>
- <textobject>
- <para>
- The generated image containing a random verification number.
- </para>
- </textobject>
- </mediaobject>
- </figure>
</section>
</chapter>
Modified: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample 2009-12-21 07:22:35 UTC (rev 16176)
@@ -1,9 +1,9 @@
<application>
- <locale-config>
- <default-locale>en</default-locale>
- <supported-locale>en</supported-locale>
- <supported-locale>de</supported-locale>
- <supported-locale>it</supported-locale>
- </locale-config>
- <message-bundle>demo.message</message-bundle>
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>en</supported-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>it</supported-locale>
+ </locale-config>
+ <message-bundle>demo.message</message-bundle>
</application>
Modified: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js 2009-12-21 07:03:04 UTC (rev 16175)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js 2009-12-21 07:22:35 UTC (rev 16176)
@@ -1,44 +1,29 @@
package demo;
+import java.util.Locale;
+import javax.faces.context.FacesContext;
- import java.util.Locale;
+public class ChangeLocale {
- import javax.faces.context.FacesContext;
+ public String germanAction() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ context.getViewRoot().setLocale(Locale.GERMAN);
+ return null;
+ }
- public class ChangeLocale {
- public String germanAction() {
+ public String englishAction() {
- FacesContext context = FacesContext.getCurrentInstance();
+ FacesContext context = FacesContext.getCurrentInstance();
+ context.getViewRoot().setLocale(Locale.ENGLISH);
+ return null;
+ }
- context.getViewRoot().setLocale(Locale.GERMAN);
+ public String italianAction() {
- return null;
-
- }
-
-
- public String englishAction() {
-
- FacesContext context = FacesContext.getCurrentInstance();
-
- context.getViewRoot().setLocale(Locale.ENGLISH);
-
- return null;
-
- }
-
-
-
- public String italianAction() {
-
- FacesContext context = FacesContext.getCurrentInstance();
-
- context.getViewRoot().setLocale(Locale.ITALIAN);
-
- return null;
-
- }
-
+ FacesContext context = FacesContext.getCurrentInstance();
+ context.getViewRoot().setLocale(Locale.ITALIAN);
+ return null;
+ }
}
Modified: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample 2009-12-21 07:22:35 UTC (rev 16176)
@@ -1,8 +1,8 @@
<h:form>
- <a4j:loadBundle var="msg" basename="demo.message"/>
- <h:outputText id="messageBundle" value="#{msg.greeting}"/>
- <a4j:commandLink value="De" action="#{changeLocale.germanAction}" reRender="messageBundle" />
- <a4j:commandLink value="Eng" action="#{changeLocale.englishAction}" reRender="messageBundle" />
- <a4j:commandLink value="It" action="#{changeLocale.italianAction}" reRender="messageBundle" />
+ <a4j:loadBundle var="msg" basename="demo.message"/>
+ <h:outputText id="messageBundle" value="#{msg.greeting}"/>
+ <a4j:commandLink value="De" action="#{changeLocale.germanAction}" reRender="messageBundle" />
+ <a4j:commandLink value="Eng" action="#{changeLocale.englishAction}" reRender="messageBundle" />
+ <a4j:commandLink value="It" action="#{changeLocale.italianAction}" reRender="messageBundle" />
</h:form>
15 years, 4 months
JBoss Rich Faces SVN: r16175 - in root/docs/trunk/Component_Reference/en-US: extras and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2009-12-21 02:03:04 -0500 (Mon, 21 Dec 2009)
New Revision: 16175
Added:
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png
Removed:
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-0.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xmlt
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xmlt
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png
Modified:
root/docs/trunk/Component_Reference/en-US/Author_Group.xml
root/docs/trunk/Component_Reference/en-US/Book_Info.xml
root/docs/trunk/Component_Reference/en-US/Component_Reference.xml
root/docs/trunk/Component_Reference/en-US/Preface.xml
root/docs/trunk/Component_Reference/en-US/Revision_History.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_Ajax_attributes.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_features.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Drag_and_drop.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functionality_extension.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Introduction.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Layout_and_appearance.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Menus_and_toolbars.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Output_and_messages.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Panels_and_containers.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Portals.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Processing_management.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Rich_inputs.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Trees.xml
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml
root/docs/trunk/Component_Reference/en-US/fallback_content/Conventions.xml
root/docs/trunk/Component_Reference/en-US/fallback_content/Feedback.xml
root/docs/trunk/Component_Reference/en-US/fallback_content/Legal_Notice.xml
Log:
Fixed file names
Modified: root/docs/trunk/Component_Reference/en-US/Author_Group.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Author_Group.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/Author_Group.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<authorgroup>
<author>
<firstname>Sean</firstname>
Modified: root/docs/trunk/Component_Reference/en-US/Book_Info.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Book_Info.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/Book_Info.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<bookinfo id="book-Component_Reference-Component_Reference">
<title>Component Reference</title>
<subtitle>A reference guide to the components of the RichFaces &VERSION_LONG;<remark> (draft)</remark>
@@ -13,25 +10,28 @@
<edition>0</edition>
<pubsnumber>1</pubsnumber>
<abstract>
- <para>This book details each component in the RichFaces &VERSION;
-framework, including examples of their use in applications.</para></abstract>
- <corpauthor>
- <inlinemediaobject>
- <imageobject>
- <imagedata fileref="./images/rf_logo.png" format="PNG" scalefit="1" />
- </imageobject>
- <textobject>
- <phrase>Logo</phrase>
- </textobject>
- </inlinemediaobject>
- </corpauthor>
- <copyright>
- <year>&YEAR;</year>
- <holder>&HOLDER;</holder>
- </copyright>
- <!-- FOR PUBLICAN --><xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK: --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- </xi:fallback>
- </xi:include>
- <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- </bookinfo>
-
+ <para>
+This book details each component in the RichFaces &VERSION;
+framework, including examples of their use in applications.
+</para>
+ </abstract>
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="./images/rf_logo.png" format="PNG" scalefit="1" />
+ </imageobject>
+ <textobject>
+ <phrase>Logo</phrase>
+ </textobject>
+ </inlinemediaobject>
+ </corpauthor>
+ <copyright>
+ <year>&YEAR;</year>
+ <holder>&HOLDER;</holder>
+ </copyright>
+ <!-- FOR PUBLICAN --><xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK: --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </xi:fallback>
+ </xi:include>
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</bookinfo>
+
Modified: root/docs/trunk/Component_Reference/en-US/Component_Reference.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Component_Reference.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/Component_Reference.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,38 +1,34 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<book status="draft">
- <xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <!--
+ <xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!--
<xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- -->
- <xi:include href="chap-Component_Reference-Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Common_Ajax_attributes.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Common_features.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ --><xi:include href="chap-Component_Reference-Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Common_Ajax_attributes.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Common_features.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<part id="part-Component_Reference-a4j_tag_library">
<title>a4j tag library</title>
- <xi:include href="chap-Component_Reference-Actions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Resources.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Processing_management.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="chap-Component_Reference-Actions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Resources.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Processing_management.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</part>
<part id="part-Component_Reference-rich_tag_library">
<title>rich tag library</title>
- <xi:include href="chap-Component_Reference-Rich_inputs.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Panels_and_containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Tables_and_grids.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Trees.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Menus_and_toolbars.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Output_and_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Drag_and_drop.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Layout_and_appearance.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="chap-Component_Reference-Functionality_extension.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="chap-Component_Reference-Rich_inputs.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Panels_and_containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Tables_and_grids.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Trees.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Menus_and_toolbars.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Output_and_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Drag_and_drop.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Layout_and_appearance.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Functions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="chap-Component_Reference-Functionality_extension.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</part>
- <xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
Modified: root/docs/trunk/Component_Reference/en-US/Preface.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Preface.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/Preface.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,28 +1,15 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<preface id="pref-Component_Reference-Preface">
<title>Preface</title>
- <!-- FOR JDOCBOOK -->
- <xi:include href="Common_Content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
- <!-- FOR PUBLICAN -->
- <xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="fallback_content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- </xi:fallback>
+ <!-- FOR JDOCBOOK --><xi:include href="Common_Content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR PUBLICAN --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Conventions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </xi:fallback>
</xi:include>
- <!-- PUBLICAN'S ORIGINAL XINCLUDES -->
- <xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="Common_Content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
- <!-- FOR JDOCBOOK -->
- <xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="fallback_content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- </xi:fallback>
- </xi:include>
- </xi:fallback>
+ <!-- PUBLICAN'S ORIGINAL XINCLUDES --><xi:include href="Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="Common_Content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"><!-- FOR JDOCBOOK --><xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"><xi:include href="fallback_content/Feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </xi:fallback>
</xi:include>
+ </xi:fallback>
+ </xi:include>
</preface>
Modified: root/docs/trunk/Component_Reference/en-US/Revision_History.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/Revision_History.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/Revision_History.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<appendix id="appe-Component_Reference-Revision_History">
<title>Revision History</title>
<simpara>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Actions.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Actions">
<title>Actions</title>
<para>
@@ -51,11 +48,13 @@
</para>
<example id="exam-Component_Reference-a4jactionParam-a4jactionParam_example">
<title><a4j:actionParam> example</title>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text" href="extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xmlt" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
+
<programlisting language="Java" role="JAVA">
-<xi:include parse="text" href="extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</example>
<para>
@@ -254,7 +253,7 @@
<title><a4j:jsFunction> example</title>
<programlisting language="XML" role="XML">
-<xi:include href="extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xmlt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+<xi:include href="extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</example>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_Ajax_attributes.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_Ajax_attributes.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_Ajax_attributes.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Common_Ajax_attributes">
<title>Common Ajax attributes</title>
<para>
@@ -17,7 +14,7 @@
<section id="sect-Component_Reference-Rendering-render">
<title><varname>render</varname></title>
<para>
- The <varname>render</varname> attribute provides a reference to one or more areas on the page that need updating after an Ajax interaction. It uses the <methodname>UIComponent.findComponent()</methodname> algorithm to find the components in the component tree using their <varname>id</varname> attributes as a reference. Components can be referenced by their <varname>id</varname> attribute alone, or by a hierarchy of components' <varname>id</varname> attributes to make locating components more efficient. <xref linkend="exam-Component_Reference-render-render_example" /> shows both ways of referencing components. Each command button will correctly render the referenced panel grids, but the second button locates the references more efficiently with explicit hierarchy paths.
+ The <varname>render</varname> attribute provides a reference to one or more areas on the page that need updating after an Ajax interaction. It uses the <methodname>UIComponent.findComponent()</methodname> algorithm to find the components in the component tree using their <varname>id</varname> attributes as a reference. Components can be referenced by their <varname>id</varname> attribute alone, or by a hierarchy of components' <varname>id</varname> attributes to make locating components more efficient. <xref linkend="exam-Component_Reference-render-render_example" /> shows both ways of referencing components. Each command button will correctly render the referenced panel grids, but the second button locates the references more efficiently with explicit hierarchy paths.
</para>
<example id="exam-Component_Reference-render-render_example">
<title>render example</title>
@@ -40,12 +37,12 @@
</programlisting>
</example>
<para>
- The value of the <varname>render</varname> attribute can also be an expression written using JavaServer Faces' Expression Language (<acronym>EL</acronym>); this can either be a <type>Set</type>, <type>Collection</type>, <type>Array</type>, or <type>String</type>.
+ The value of the <varname>render</varname> attribute can also be an expression written using JavaServer Faces' Expression Language (<acronym>EL</acronym>); this can either be a <type>Set</type>, <type>Collection</type>, <type>Array</type>, or <type>String</type>.
</para>
<important>
<title>Important</title>
<para>
- A common problem with using <varname>render</varname> occurs when the referenced component has a <varname>rendered</varname> attribute. <acronym>JSF</acronym> does not mark the place in the browser's Document Object Model (<acronym>DOM</acronym>) where the rendered component would be placed in case the <varname>rendered</varname> attribute returns <literal>false</literal>. As such, when RichFaces sends the render code to the client, the page does not update as the place for the update is not known.
+ A common problem with using <varname>render</varname> occurs when the referenced component has a <varname>rendered</varname> attribute. <acronym>JSF</acronym> does not mark the place in the browser's Document Object Model (<acronym>DOM</acronym>) where the rendered component would be placed in case the <varname>rendered</varname> attribute returns <literal>false</literal>. As such, when RichFaces sends the render code to the client, the page does not update as the place for the update is not known.
</para>
<para>
To work around this issue, wrap the component to be rendered in an <sgmltag><a4j:outputPanel></sgmltag> with <code>layout="none"</code>. The <sgmltag><a4j:outputPanel></sgmltag> will receive the update and render the component as required.
@@ -56,7 +53,7 @@
<section id="sect-Component_Reference-Rendering-ajaxRendered">
<title>ajaxRendered</title>
<para>
- A component with <code>ajaxRendered="true"</code> will be re-rendered with <emphasis>every</emphasis> Ajax request, even when not referenced by the requesting component's <varname>render</varname> attribute. This can be useful for updating a status display or error message without explicitly requesting it.
+ A component with <code>ajaxRendered="true"</code> will be re-rendered with <emphasis>every</emphasis> Ajax request, even when not referenced by the requesting component's <varname>render</varname> attribute. This can be useful for updating a status display or error message without explicitly requesting it.
</para>
<para>
Rendering of components in this way can be repressed by adding <code>limitRender="true"</code> to the requesting component, as described in <xref linkend="sect-Component_Reference-Rendering-limitRender" />.
@@ -69,7 +66,7 @@
A component with <code>limitRender="true"</code> specified will <emphasis>not</emphasis> cause components with <code>ajaxRendered="true"</code> to re-render, and only those components listed in the <varname>render</varname> attribute will be updated. This essentially overrides the <varname>ajaxRendered</varname> attribute in other components.
</para>
<para>
- <xref linkend="exam-Component_Reference-data-Data_reference_example" /> describes two command buttons, a panel grid rendered by the buttons, and an output panel showing error messages. When the first button is clicked, the output panel is rendered even though it is not explicitly referenced with the <varname>render</varname> attribute. The second button, however, uses <code>limitRender="true"</code> to override the output panel's rendering and only render the panel grid.
+ <xref linkend="exam-Component_Reference-data-Data_reference_example" /> describes two command buttons, a panel grid rendered by the buttons, and an output panel showing error messages. When the first button is clicked, the output panel is rendered even though it is not explicitly referenced with the <varname>render</varname> attribute. The second button, however, uses <code>limitRender="true"</code> to override the output panel's rendering and only render the panel grid.
</para>
<example id="exam-Component_Reference-limitRender-Rendering_example">
<title>Rendering example</title>
@@ -124,7 +121,7 @@
<section id="sect-Component_Reference-Common_Ajax_attributes-Data_processing">
<title>Data processing</title>
<para>
- RichFaces uses a form-based approach for sending Ajax requests. As such, each time a request is sent the data from the requesting component's parent <acronym>JSF</acronym> form is submitted along with the <acronym>XMLHTTPRequest</acronym> object. The form data contains values from the input element and auxiliary information such as state-saving data.
+ RichFaces uses a form-based approach for sending Ajax requests. As such, each time a request is sent the data from the requesting component's parent <acronym>JSF</acronym> form is submitted along with the <acronym>XMLHTTPRequest</acronym> object. The form data contains values from the input element and auxiliary information such as state-saving data.
</para>
<section id="sect-Component_Reference-Data_processing-process">
<title>process</title>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_features.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_features.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Common_features.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Common_features">
<title>Common features</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Containers.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Containers">
<title>Containers</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Drag_and_drop.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Drag_and_drop.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Drag_and_drop.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Drag_and_drop">
<title>Drag and drop</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functionality_extension.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functionality_extension.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functionality_extension.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Functionality_extension">
<title>Functionality extension</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Functions.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Functions">
<title>Functions</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Introduction.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Introduction.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Introduction.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Introduction">
<title>Introduction</title>
<para>
@@ -15,7 +12,7 @@
<section id="sect-Component_Reference-Introduction-Libraries">
<title>Libraries</title>
<para>
- The RichFaces framework as it now stands is made up of two tag libraries: the <classname>a4j</classname> library and the <classname>rich</classname> library. The <classname>a4j</classname> tag library represents Ajax4jsf, which provides page-level Ajax support with core Ajax components. This allows developers to make use of custom Ajax behavior with existing components. The <classname>rich</classname> tag library provides Ajax support at the component level instead, and includes ready-made, self-contained components. These components don't require additional configuration in order to send requests or update.
+ The RichFaces framework as it now stands is made up of two tag libraries: the <classname>a4j</classname> library and the <classname>rich</classname> library. The <classname>a4j</classname> tag library represents Ajax4jsf, which provides page-level Ajax support with core Ajax components. This allows developers to make use of custom Ajax behavior with existing components. The <classname>rich</classname> tag library provides Ajax support at the component level instead, and includes ready-made, self-contained components. These components don't require additional configuration in order to send requests or update.
</para>
<note>
<title>Note</title>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Layout_and_appearance.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Layout_and_appearance.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Layout_and_appearance.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Layout_and_appearance">
<title>Layout and appearance</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Menus_and_toolbars.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Menus_and_toolbars.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Menus_and_toolbars.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Menus_and_toolbars">
<title>Menus and toolbars</title>
<para>
@@ -47,7 +44,7 @@
<section id="sect-Component_Reference-Menus_and_toolbars-richpanelMenu">
<title><rich:panelMenu></title>
<para>
- The <classname><rich:panelMenu></classname> component can be used in conjunction with <classname><rich:panelMenuItem></classname> and <classname><rich:panelMenuGroup></classname> to create an expanding, hierarchical menu. The <classname><rich:panelMenu></classname> component's appearance can be highly customized, and the hierarchy can stretch to any number of sub-levels.
+ The <classname><rich:panelMenu></classname> component can be used in conjunction with <classname><rich:panelMenuItem></classname> and <classname><rich:panelMenuGroup></classname> to create an expanding, hierarchical menu. The <classname><rich:panelMenu></classname> component's appearance can be highly customized, and the hierarchy can stretch to any number of sub-levels.
</para>
<para>
The <code>selectedChild</code> attribute is used to point to the name of the currently selected menu item.
@@ -83,7 +80,7 @@
The <classname><rich:panelMenuGroup></classname> component defines a group of <classname><rich:panelMenuItem></classname> components inside a <classname><rich:panelMenu></classname>.
</para>
<para>
- If the <code>expandMode</code> is unspecified, the submission behavior for the group is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>expandMode</code> setting is used instead of the parent's behavior.
+ If the <code>expandMode</code> is unspecified, the submission behavior for the group is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>expandMode</code> setting is used instead of the parent's behavior.
</para>
<para>
Icons for the menu group can be chosen from a set of standard icons. There are three attributes that relate to the different menu states that the icon represents: <code>iconExpanded</code>, <code>iconCollapsed</code>, and <code>iconDisabled</code>. The standard icons are shown in <xref linkend="figu-Component_Reference-richpanelMenuGroup-Standard_icons" />.
@@ -118,7 +115,7 @@
The <classname><rich:panelMenuItem></classname> component represents a single item inside a <classname><rich:panelMenuGroup></classname> component, which is in turn part of a <classname><rich:panelMenu></classname> component.
</para>
<para>
- If the <code>mode</code> is unspecified, the submission behavior for the item is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>mode</code> setting is used instead of the parent's behavior.
+ If the <code>mode</code> is unspecified, the submission behavior for the item is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>mode</code> setting is used instead of the parent's behavior.
</para>
<para>
Icons for menu items can be chosen from a set of standard icons. There are two attributes that relate to the different menu states that the icon represents: <code>icon</code> and <code>iconDisabled</code>. The standard icons are shown in <xref linkend="figu-Component_Reference-richcolumn-Basic_column_example" />.
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Output_and_messages.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Output_and_messages.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Output_and_messages.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Output_and_messages">
<title>Output and messages</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Panels_and_containers.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Panels_and_containers.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Panels_and_containers.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Panels_and_containers">
<title>Panels and containers</title>
<para>
@@ -30,10 +27,10 @@
<title><rich:modalPanel> example</title>
<programlisting language="XML" role="XML">
-<a onclick="Richfaces.showModalPanel('pnl');" href="#">Show ModalPanel</a>
+<a onclick="Richfaces.showModalPanel('pnl');" href="#">Show ModalPanel</a>
<a4j:form>
<rich:modalPanel id="pnl" >
- <a onclick="Richfaces.hideModalPanel('pnl');" href="#">Hide ModalPanel</a>
+ <a onclick="Richfaces.hideModalPanel('pnl');" href="#">Hide ModalPanel</a>
</rich:modalPanel>
</a4j:form>
</programlisting>
@@ -142,7 +139,7 @@
<section id="sect-Component_Reference-Panels_and_containers-richtab">
<title><rich:tab></title>
<para>
- The <sgmltag><rich:tab></sgmltag> component represents an individual tab inside a <sgmltag><rich:tabPanel></sgmltag> component, including the tab's content. Clicking on the tab header will bring its corresponding content to the front of other tabs.
+ The <sgmltag><rich:tab></sgmltag> component represents an individual tab inside a <sgmltag><rich:tabPanel></sgmltag> component, including the tab's content. Clicking on the tab header will bring its corresponding content to the front of other tabs.
</para>
<para>
Basic usage of the <sgmltag><rich:tab></sgmltag> component requires the <code>label</code> attribute, which provides the text on the tab header. The content of the tab is then detailed inside the <sgmltag><rich:tab></sgmltag> tags.
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Portals.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Portals.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Portals.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Portals">
<title>Portals</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Processing_management.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Processing_management.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Processing_management.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Processing_management">
<title>Processing management</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Resources">
<title>Resources</title>
<para>
@@ -37,46 +34,50 @@
<para>
Resource bundles are registered in the Faces configuration file, <filename>faces-config.xml</filename>.
</para>
- <example id="exam-Component_Reference-Resources-a4jloadBundle">
+ <example id="exam-Component_Reference-a4jloadBundle-a4jloadBundle_example">
<title><sgmltag><a4j:loadBundle></sgmltag> example</title>
<para>
This example shows a simple application capable of switching between different localized languages.
</para>
<procedure>
- <step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Create_resource_bundles">
<title>Create resource bundles</title>
<para>
String resource bundles are contained in files with a <filename class="extension">.properties</filename> extension. The files consist of a list of entries, each with a unique name and a corresponding value. A seperate file is required for each language. Append the filename with the locale identifier (<literal>en</literal> for English, for example).
</para>
</step>
- <step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Register_bundles_in_Faces_configuration_file">
<title>Register bundles in Faces configuration file</title>
<para>
The resource bundles need to be registered in the Faces configuration file, <filename>faces-config.xml</filename>. The filename is defined with the <sgmltag><message-bundle></sgmltag> tag, without the locale code and without the extension. The supported locale codes are listed with <sgmltag><supported-locale></sgmltag> tags.
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jloadBundle-0.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</step>
- <step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Create_method_to_set_locale">
<title>Create method to set locale</title>
<para>
The <acronym>JSF</acronym> <methodname>javax.faces.component.UIViewRoot.setLocale()</methodname> method can be used to update the locale through a Java class:
</para>
+
<programlisting language="java" role="JAVA">
-<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jloadBundle-1.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</step>
- <step>
+ <step id="step-Component_Reference-a4jloadBundle_example-Add_a4jloadBundle_to_the_JSP_page">
<title>Add <sgmltag><a4j:loadBundle></sgmltag> to the <acronym>JSP</acronym> page</title>
<para>
The <sgmltag><a4j:loadBundle></sgmltag> component is added to the application, and links to change the locale will update the displayed text.
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</step>
</procedure>
+
<para>
Clicking on the different links will render the localized string as appropriate.
</para>
@@ -113,8 +114,9 @@
<para>
The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.
</para>
- <example id="exam-Component_Reference-Resources-a4jloadScript_example">
+ <example id="exam-Component_Reference-a4jloadScript-a4jloadScript_example">
<title><sgmltag><a4j:loadScript></sgmltag> example</title>
+
<programlisting language="XML" role="XML">
<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js" />
</programlisting>
@@ -151,8 +153,9 @@
<para>
The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.
</para>
- <example id="exam-Component_Reference-Resources-a4jloadStyle_example">
+ <example id="exam-Component_Reference-a4jloadStyle-a4jloadStyle_example">
<title><sgmltag><a4j:loadStyle></sgmltag> example</title>
+
<programlisting language="XML" role="XML">
<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js" />
</programlisting>
@@ -187,8 +190,9 @@
<para>
The <varname>beanName</varname> attribute uses JSF Expression Language (<acronym>EL</acronym>) to define the request scope bean name to keep alive. The expression must resolve to a managed bean instance. The <varname>ajaxOnly</varname> attribute determines whether or not the value of the bean should be available during non-Ajaxx requests; if <code>ajaxOnly="true"</code>, the request-scope bean keeps its value during Ajax requests, but any non-Ajax requests will re-create the bean as a regular request-scope bean.
</para>
- <example id="exam-Component_Reference-Resources-a4jkeepAlive_example">
+ <example id="exam-Component_Reference-a4jkeepAlive-a4jkeepAlive_example">
<title><sgmltag><a4j:keepAlive></sgmltag> example</title>
+
<programlisting language="XML" role="XML">
<a4j:keepAlive beanName="#{myClass.testBean}" />
</programlisting>
@@ -226,7 +230,7 @@
The <varname>createContent</varname> attribute points to the method used for generating the displayed content. If necessary, the <varname>value</varname> attribute can be used to pass input data to the content generation method specified with <varname>createContent</varname>. The <varname>cacheable</varname> attribute specifies whether the resulting content will be cached or not.
</para>
<para>
- The <varname>mimeType</varname> attribute describes the type of output content, and corresponds to the type in the header of the <acronym>HTTP</acronym> request. The <varname>element</varname> attribute defines <attribute>XHTML</attribute> element used to display the content:
+ The <varname>mimeType</varname> attribute describes the type of output content, and corresponds to the type in the header of the <acronym>HTTP</acronym> request. The <varname>element</varname> attribute defines <attribute>XHTML</attribute> element used to display the content:
</para>
<itemizedlist>
<listitem>
@@ -260,25 +264,28 @@
</para>
</listitem>
</itemizedlist>
- <example id="exam-Component_Reference-Resources-a4jmediaOutput_example">
+ <example id="exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example">
<title><sgmltag><a4j:mediaOutput></sgmltag> example</title>
<para>
This example uses the <sgmltag><a4j:mediaOutput></sgmltag> component to generate a <acronym>JPEG</acronym> image of verification digits. The code on the application page is a single element:
</para>
+
<programlisting language="XML" role="XML">
<a4j:mediaOutput element="img" cacheable="false" session="false" createContent="#{mediaBean.paint}" value="#{mediaData}" mimeType="image/jpeg" />
</programlisting>
<para>
The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <methodname>MediaBean.paint</methodname> method to create the image. The method generates a random number, which is then converted into an output stream and rendered to a <acronym>JPEG</acronym> image. The <classname>MediaBean</classname> class is as follows:
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
<para>
Another class, <classname>MediaData</classname> is required by the <varname>value</varname> attribute for keeping data to be used as input for the content creation method. The <classname>MediaData</classname> class is as follows:
</para>
+
<programlisting language="XML" role="XML">
-<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" />
</programlisting>
</example>
<note>
@@ -288,13 +295,13 @@
</para>
</note>
<para>
- The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <classname>MediaBean</classname> and <classname>MediaData</classname> classes to generate a new image on each page refresh, which appears as
+ The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <classname>MediaBean</classname> and <classname>MediaData</classname> classes to generate a new image on each page refresh, which appears as
</para>
- <figure id="figu-Component_Reference-Resources-a4jmediaOutput_example_result">
+ <figure id="figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result">
<title><sgmltag><a4j:mediaOutput></sgmltag> example result</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png" format="PNG" />
+ <imagedata fileref="images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png" format="PNG" />
</imageobject>
<textobject>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Rich_inputs.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Rich_inputs.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Rich_inputs.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Rich_inputs">
<title>Rich inputs</title>
<para>
@@ -24,7 +21,7 @@
The position at which the pop-up calendar displays relative to the text field and button can be configured using the <varname>jointPoint</varname> and <varname>direction</varname> attributes. The <varname>jointPoint</varname> attribute refers to the corner of the text field and button with which the calendar will be aligned and the <varname>direction</varname> specifies which direction the pop-up calendar will span relative to the joint point. The default settings are <code>jointPoint="bottom-left"</code> and <code>direction="bottom-right"</code>, causing the pop-up calendar to align with the bottom-left corner of the text field and span to the bottom-right, underneath the text field and button. The diagram shows the joint points and directions that can be used. Alternatively, both <varname>jointPoint</varname> and <varname>direction</varname> can be set to <literal>auto</literal> to allow smart pop-up positioning.
</para>
<para>
- The calendar features a <guibutton>Today</guibutton> button for locating today's date on the calendar. This can be set to three different values using the <varname>todayControlMode</varname> attribute:
+ The calendar features a <guibutton>Today</guibutton> button for locating today's date on the calendar. This can be set to three different values using the <varname>todayControlMode</varname> attribute:
</para>
<itemizedlist>
<listitem>
@@ -34,12 +31,12 @@
</listitem>
<listitem>
<para>
- <literal>select</literal>, the default setting, which scrolls the calendar to the current month and selects today's date; and
+ <literal>select</literal>, the default setting, which scrolls the calendar to the current month and selects today's date; and
</para>
</listitem>
<listitem>
<para>
- <literal>scroll</literal>, which scrolls the calendar to the current month but does not select today's date.
+ <literal>scroll</literal>, which scrolls the calendar to the current month but does not select today's date.
</para>
</listitem>
</itemizedlist>
@@ -143,7 +140,7 @@
</listitem>
</itemizedlist>
<para>
- Users can type into the combo-box's text field to enter a value, which also searches through the suggestion items in the drop-down box. By default, the first suggestion item is selected as the user types. This behavior can be deactivated by setting <code>selectFirstOnUpdate="false"</code>. Setting <code>directInputSuggestions="true"</code> causes the combo-box to fill the text field box with a matching suggestion as the user types. Alternatively, the text field can be disabled by setting <code>enableManualInput="false"</code>, which forces the users to pick from items in the drop-down box.
+ Users can type into the combo-box's text field to enter a value, which also searches through the suggestion items in the drop-down box. By default, the first suggestion item is selected as the user types. This behavior can be deactivated by setting <code>selectFirstOnUpdate="false"</code>. Setting <code>directInputSuggestions="true"</code> causes the combo-box to fill the text field box with a matching suggestion as the user types. Alternatively, the text field can be disabled by setting <code>enableManualInput="false"</code>, which forces the users to pick from items in the drop-down box.
</para>
<para>
The <sgmltag><rich:comboBox></sgmltag> component has two unique event handlers:
@@ -165,7 +162,7 @@
<section id="sect-Component_Reference-Rich_inputs-richeditor">
<title><rich:editor></title>
<para>
- The <sgmltag><rich:editor></sgmltag> component provides a fully-featured word processor. It features manageable global configurations, and support for Seam text, custom plug-ins, and a customized look and feel. The editor is fully based on the TinyMCE JavaScript editor control, supporting all TinyMCE's parameters, and is adapted for the <acronym>JSF</acronym> environment with some additional capabilities.
+ The <sgmltag><rich:editor></sgmltag> component provides a fully-featured word processor. It features manageable global configurations, and support for Seam text, custom plug-ins, and a customized look and feel. The editor is fully based on the TinyMCE JavaScript editor control, supporting all TinyMCE's parameters, and is adapted for the <acronym>JSF</acronym> environment with some additional capabilities.
</para>
</section>
@@ -355,7 +352,7 @@
<section id="sect-Component_Reference-Rich_inputs-richinputNumberSlider">
<title><rich:inputNumberSlider></title>
<para>
- The <sgmltag><rich:inputNumberSlider></sgmltag> component provides a slider for changing numerical values. Optional features include a tool-tip to display the value while sliding, and a text field for typing the numerical value which can then be validated against the slider's range.
+ The <sgmltag><rich:inputNumberSlider></sgmltag> component provides a slider for changing numerical values. Optional features include a tool-tip to display the value while sliding, and a text field for typing the numerical value which can then be validated against the slider's range.
</para>
<para>
Basic use of the component with no attributes specified will render a slider with a minimum value of 0, a maximum of 100, and a gradient step of 1, together with a text field for typing the desired numerical value. The text field can be removed by setting <code>showInput="false"</code>, and the properties of the slider can be set with the attributes <varname>minValue</varname>, <varname>maxValue</varname>, and <varname>step</varname>. The slider is labeled with the minimum and maximum boundary values, and a tool-tip showing the current value is shown while sliding the slider; these items can be turned off by setting <code>showBoundaryValues="false"</code> and <code>showToolTip="false"</code> respectively.
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Tables_and_grids.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Tables_and_grids">
<title>Tables and grids</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Trees.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Trees.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Trees.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Trees">
<title>Trees</title>
<para>
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Validation.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<chapter id="chap-Component_Reference-Validation">
<title>Validation</title>
<para>
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-0.xml_sample
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-0.xml_sample 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-0.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +0,0 @@
-<application>
- <locale-config>
- <default-locale>en</default-locale>
- <supported-locale>en</supported-locale>
- <supported-locale>de</supported-locale>
- <supported-locale>it</supported-locale>
- </locale-config>
- <message-bundle>demo.message</message-bundle>
-</application>
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,44 +0,0 @@
-package demo;
-
-
- import java.util.Locale;
-
- import javax.faces.context.FacesContext;
-
-
- public class ChangeLocale {
-
- public String germanAction() {
-
- FacesContext context = FacesContext.getCurrentInstance();
-
- context.getViewRoot().setLocale(Locale.GERMAN);
-
- return null;
-
- }
-
-
- public String englishAction() {
-
- FacesContext context = FacesContext.getCurrentInstance();
-
- context.getViewRoot().setLocale(Locale.ENGLISH);
-
- return null;
-
- }
-
-
-
- public String italianAction() {
-
- FacesContext context = FacesContext.getCurrentInstance();
-
- context.getViewRoot().setLocale(Locale.ITALIAN);
-
- return null;
-
- }
-
-}
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,8 +0,0 @@
-<h:form>
- <a4j:loadBundle var="msg" basename="demo.message"/>
- <h:outputText id="messageBundle" value="#{msg.greeting}"/>
- <a4j:commandLink value="De" action="#{changeLocale.germanAction}" reRender="messageBundle" />
- <a4j:commandLink value="Eng" action="#{changeLocale.englishAction}" reRender="messageBundle" />
- <a4j:commandLink value="It" action="#{changeLocale.italianAction}" reRender="messageBundle" />
-</h:form>
-
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,31 +0,0 @@
-package demo;
-
-import java.awt.Graphics2D;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Random;
-import javax.imageio.ImageIO;
-
-public class MediaBean {
-
- public void paint(OutputStream out, Object data) throws IOException {
-
- Integer high = 9999;
- Integer low = 1000;
- Random generator = new Random();
- Integer digits = generator.nextInt(high - low + 1) + low;
-
- if (data instanceof MediaData) {
- MediaData paintData = (MediaData) data;
- BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
- Graphics2D graphics2D = img.createGraphics();
- graphics2D.setBackground(paintData.getBackground());
- graphics2D.setColor(paintData.getDrawColor());
- graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
- graphics2D.setFont(paintData.getFont());
- graphics2D.drawString(digits.toString(), 20, 35);
- ImageIO.write(img,"png",out);
- }
- }
-}
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,22 +0,0 @@
-package demo;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.io.Serializable;
-
-public class MediaData implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- Integer Width=110;
- Integer Height=50;
-
- Color Background=new Color(190, 214, 248);
- Color DrawColor=new Color(0,0,0);
-
- Font font = new Font("Serif", Font.TRUETYPE_FONT, 30);
-
- /* Corresponding getters and setters */
- ...
-
-}
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xml_sample (from rev 16173, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xmlt)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xml_sample (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,6 @@
+<h:form id="form">
+ <a4j:commandButton value="Set name to Alex" reRender="rep">
+ <a4j:actionparam name="username" value="Alex" assignTo="#{actionparamBean.name}"/>
+ </a4j:commandButton>
+ <h:outputText id="rep" value="Name: #{actionparamBean.name}"/>
+</h:form>
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xmlt
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xmlt 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jactionParam-a4jactionParam_example.xmlt 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,6 +0,0 @@
-<h:form id="form">
- <a4j:commandButton value="Set name to Alex" reRender="rep">
- <a4j:actionparam name="username" value="Alex" assignTo="#{actionparamBean.name}"/>
- </a4j:commandButton>
- <h:outputText id="rep" value="Name: #{actionparamBean.name}"/>
-</h:form>
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xml_sample (from rev 16173, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xmlt)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xml_sample (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,7 @@
+<h:form>
+ ...
+ <a4j:jsFunction name="callScript" data="#{bean.someProperty1}" reRender="someComponent" oncomplete="myScript(data.subProperty1, data.subProperty2)">
+ <a4j:actionParam name="param_name" assignTo="#{bean.someProperty2}"/>
+ </a4j:jsFunction>
+ ...
+</h:form>
Deleted: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xmlt
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xmlt 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jjsFunction-a4jjsFunction_example.xmlt 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,7 +0,0 @@
-<h:form>
- ...
- <a4j:jsFunction name="callScript" data="#{bean.someProperty1}" reRender="someComponent" oncomplete="myScript(data.subProperty1, data.subProperty2)">
- <a4j:actionParam name="param_name" assignTo="#{bean.someProperty2}"/>
- </a4j:jsFunction>
- ...
-</h:form>
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample (from rev 16173, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-0.xml_sample)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-0.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,9 @@
+<application>
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>en</supported-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>it</supported-locale>
+ </locale-config>
+ <message-bundle>demo.message</message-bundle>
+</application>
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js (from rev 16174, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-1.js 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,44 @@
+package demo;
+
+
+ import java.util.Locale;
+
+ import javax.faces.context.FacesContext;
+
+
+ public class ChangeLocale {
+
+ public String germanAction() {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.getViewRoot().setLocale(Locale.GERMAN);
+
+ return null;
+
+ }
+
+
+ public String englishAction() {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.getViewRoot().setLocale(Locale.ENGLISH);
+
+ return null;
+
+ }
+
+
+
+ public String italianAction() {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.getViewRoot().setLocale(Locale.ITALIAN);
+
+ return null;
+
+ }
+
+}
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample (from rev 16174, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jloadBundle-a4jloadBundle_example-2.xml_sample 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,8 @@
+<h:form>
+ <a4j:loadBundle var="msg" basename="demo.message"/>
+ <h:outputText id="messageBundle" value="#{msg.greeting}"/>
+ <a4j:commandLink value="De" action="#{changeLocale.germanAction}" reRender="messageBundle" />
+ <a4j:commandLink value="Eng" action="#{changeLocale.englishAction}" reRender="messageBundle" />
+ <a4j:commandLink value="It" action="#{changeLocale.italianAction}" reRender="messageBundle" />
+</h:form>
+
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js (from rev 16174, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-0.js 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,31 @@
+package demo;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Random;
+import javax.imageio.ImageIO;
+
+public class MediaBean {
+
+ public void paint(OutputStream out, Object data) throws IOException {
+
+ Integer high = 9999;
+ Integer low = 1000;
+ Random generator = new Random();
+ Integer digits = generator.nextInt(high - low + 1) + low;
+
+ if (data instanceof MediaData) {
+ MediaData paintData = (MediaData) data;
+ BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics2D = img.createGraphics();
+ graphics2D.setBackground(paintData.getBackground());
+ graphics2D.setColor(paintData.getDrawColor());
+ graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
+ graphics2D.setFont(paintData.getFont());
+ graphics2D.drawString(digits.toString(), 20, 35);
+ ImageIO.write(img,"png",out);
+ }
+ }
+}
Copied: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js (from rev 16174, root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js)
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-a4jmediaOutput-a4jmediaOutput_example-1.js 2009-12-21 07:03:04 UTC (rev 16175)
@@ -0,0 +1,22 @@
+package demo;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.Serializable;
+
+public class MediaData implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ Integer Width=110;
+ Integer Height=50;
+
+ Color Background=new Color(190, 214, 248);
+ Color DrawColor=new Color(0,0,0);
+
+ Font font = new Font("Serif", Font.TRUETYPE_FONT, 30);
+
+ /* Corresponding getters and setters */
+ ...
+
+}
Modified: root/docs/trunk/Component_Reference/en-US/fallback_content/Conventions.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/fallback_content/Conventions.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/fallback_content/Conventions.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "../Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<section id="sect-Component_Reference-Document_Conventions">
<title>Document Conventions</title>
<para>
@@ -71,7 +68,7 @@
The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in Proportional Bold and all distinguishable by context.
</para>
<para>
- Note the <guimenu>></guimenu> shorthand used to indicate traversal through a menu and its sub-menus. This is to avoid the difficult-to-follow 'Select <guimenuitem>Mouse</guimenuitem> from the <guimenu>Preferences</guimenu> sub-menu in the <guimenu>System</guimenu> menu of the main menu bar' approach.
+ Note the <guimenu>></guimenu> shorthand used to indicate traversal through a menu and its sub-menus. This is to avoid the difficult-to-follow 'Select <guimenuitem>Mouse</guimenuitem> from the <guimenu>Preferences</guimenu> sub-menu in the <guimenu>System</guimenu> menu of the main menu bar' approach.
</para>
<para>
<command><replaceable>Mono-spaced Bold Italic</replaceable></command> or <application><replaceable>Proportional Bold Italic</replaceable></application>
@@ -137,7 +134,7 @@
System.out.println("Created Echo");
- System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
+ System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
}
}
@@ -158,7 +155,7 @@
<important>
<title>Important</title>
<para>
- Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring Important boxes won't cause data loss but may cause irritation and frustration.
+ Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring Important boxes won't cause data loss but may cause irritation and frustration.
</para>
</important>
<warning>
Modified: root/docs/trunk/Component_Reference/en-US/fallback_content/Feedback.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/fallback_content/Feedback.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/fallback_content/Feedback.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "../Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<section id="sect-Component_Reference-We_Need_Feedback">
<title>We Need Feedback!</title>
<indexterm>
@@ -14,7 +11,7 @@
If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: <ulink url="http://bugzilla.redhat.com/bugzilla/">http://bugzilla.redhat.com/bugzilla/</ulink> against the product <application>&PRODUCT;.</application>
</para>
<para>
- When submitting a bug report, be sure to mention the manual's identifier: <citetitle>&BOOKID;</citetitle>
+ When submitting a bug report, be sure to mention the manual's identifier: <citetitle>&BOOKID;</citetitle>
</para>
<para>
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.
Modified: root/docs/trunk/Component_Reference/en-US/fallback_content/Legal_Notice.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/fallback_content/Legal_Notice.xml 2009-12-21 06:48:31 UTC (rev 16174)
+++ root/docs/trunk/Component_Reference/en-US/fallback_content/Legal_Notice.xml 2009-12-21 07:03:04 UTC (rev 16175)
@@ -1,9 +1,6 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE legalnotice PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "../Component_Reference.ent">
-%BOOK_ENTITIES;
]>
-
<legalnotice>
<para>
Copyright <trademark class="copyright"></trademark> &YEAR; &HOLDER;. This material may only be distributed subject to the terms and conditions set forth in the Open Publication License, V1.0, (the latest version is presently available at <ulink url="http://www.opencontent.org/openpub/">http://www.opencontent.org/openpub/</ulink>).
Deleted: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png
===================================================================
(Binary files differ)
Copied: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-a4jmediaOutput-a4jmediaOutput_example_result.png (from rev 16174, root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png)
===================================================================
(Binary files differ)
15 years, 4 months
JBoss Rich Faces SVN: r16174 - in root/docs/trunk/Component_Reference/en-US: extras and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2009-12-21 01:48:31 -0500 (Mon, 21 Dec 2009)
New Revision: 16174
Added:
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js
root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js
root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png
Modified:
root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
Log:
Finished resources
Modified: root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml
===================================================================
--- root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-18 19:38:13 UTC (rev 16173)
+++ root/docs/trunk/Component_Reference/en-US/chap-Component_Reference-Resources.xml 2009-12-21 06:48:31 UTC (rev 16174)
@@ -111,8 +111,14 @@
The <sgmltag><a4j:loadScript></sgmltag> component allows scripts to be loaded from external sources such as <filename>jar</filename> files.
</para>
<para>
- The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource:///</code> prefix can be used to access a file in the RichFaces resource framework.
+ The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.
</para>
+ <example id="exam-Component_Reference-Resources-a4jloadScript_example">
+ <title><sgmltag><a4j:loadScript></sgmltag> example</title>
+<programlisting language="XML" role="XML">
+<a4j:loadScript src="resource:///org/mycompany/assets/script/focus.js" />
+</programlisting>
+ </example>
</section>
<section id="sect-Component_Reference-Resources-a4jloadStyle">
@@ -120,28 +126,37 @@
<itemizedlist>
<listitem>
<para>
- component-type: <classname>org.ajax4jsf.Push</classname>
+ component-type: <classname>org.ajax4jsf.LoadStyle</classname>
</para>
</listitem>
<listitem>
<para>
- component-family: <classname>org.ajax4jsf.components.AjaxPush</classname>
+ component-family: <classname>org.ajax4jsf.LoadStyle</classname>
</para>
</listitem>
<listitem>
<para>
- component-class: <classname>org.ajax4jsf.component.html.AjaxPush</classname>
+ component-class: <classname>org.ajax4jsf.component.html.HtmlLoadStyle</classname>
</para>
</listitem>
<listitem>
<para>
- renderer-type: <classname>org.ajax4jsf.components.AjaxPushRenderer</classname>
+ renderer-type: <classname>org.ajax4jsf.LoadStyleRenderer</classname>
</para>
</listitem>
</itemizedlist>
<para>
- Incomplete
+ The <sgmltag><a4j:loadStyle></sgmltag> component allows a style sheet to be loaded from an external source, such as a <filename>jar</filename> file. The style sheet links are inserted into the head element.
</para>
+ <para>
+ The required <varname>src</varname> attribute defines the path to the script. A leading slash (<literal>/</literal>) represents the root of the web context. The <code>resource://</code> prefix can be used to access a file in the RichFaces resource framework. The path is passed to the <methodname>getResourceURL()</methodname> method of the application's <classname>ViewHandler</classname>, with the result then being passed through the <methodname>encodeResourceURL()</methodname> method of <classname>ExternalContext</classname>.
+ </para>
+ <example id="exam-Component_Reference-Resources-a4jloadStyle_example">
+ <title><sgmltag><a4j:loadStyle></sgmltag> example</title>
+<programlisting language="XML" role="XML">
+<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js" />
+</programlisting>
+ </example>
</section>
<section id="sect-Component_Reference-Resources-a4jkeepAlive">
@@ -149,28 +164,35 @@
<itemizedlist>
<listitem>
<para>
- component-type: <classname>org.ajax4jsf.Push</classname>
+ component-type: <classname>org.ajax4jsf.components.KeepAlive</classname>
</para>
</listitem>
<listitem>
<para>
- component-family: <classname>org.ajax4jsf.components.AjaxPush</classname>
+ component-family: <classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
</para>
</listitem>
<listitem>
<para>
- component-class: <classname>org.ajax4jsf.component.html.AjaxPush</classname>
+ component-class: <classname>org.ajax4jsf.components.AjaxKeepAlive</classname>
</para>
</listitem>
- <listitem>
- <para>
- renderer-type: <classname>org.ajax4jsf.components.AjaxPushRenderer</classname>
- </para>
- </listitem>
</itemizedlist>
<para>
- Incomplete
+ The <sgmltag><a4j:keepAlive></sgmltag> component allows the state of a managed bean to be retained between Ajax requests.
</para>
+ <para>
+ Managed beans can be declared with the <literal>request</literal> scope in the <filename>faces-config.xml</filename> configuration file, using the <sgmltag><managed-bean-scope></sgmltag> tag. Any references to the bean instance after the request has ended will cause the server to throw an illegal argument exception. The <sgmltag><a4j:keepAlive></sgmltag> component avoids this be maintaining the state of the whole bean object for subsequent requests.
+ </para>
+ <para>
+ The <varname>beanName</varname> attribute uses JSF Expression Language (<acronym>EL</acronym>) to define the request scope bean name to keep alive. The expression must resolve to a managed bean instance. The <varname>ajaxOnly</varname> attribute determines whether or not the value of the bean should be available during non-Ajaxx requests; if <code>ajaxOnly="true"</code>, the request-scope bean keeps its value during Ajax requests, but any non-Ajax requests will re-create the bean as a regular request-scope bean.
+ </para>
+ <example id="exam-Component_Reference-Resources-a4jkeepAlive_example">
+ <title><sgmltag><a4j:keepAlive></sgmltag> example</title>
+<programlisting language="XML" role="XML">
+<a4j:keepAlive beanName="#{myClass.testBean}" />
+</programlisting>
+ </example>
</section>
<section id="sect-Component_Reference-Resources-a4jmediaOutput">
@@ -198,8 +220,89 @@
</listitem>
</itemizedlist>
<para>
- Incomplete
+ The <sgmltag><a4j:mediaOutput></sgmltag> component is used for generating images, video, sounds, and other resources defined on the fly.
</para>
+ <para>
+ The <varname>createContent</varname> attribute points to the method used for generating the displayed content. If necessary, the <varname>value</varname> attribute can be used to pass input data to the content generation method specified with <varname>createContent</varname>. The <varname>cacheable</varname> attribute specifies whether the resulting content will be cached or not.
+ </para>
+ <para>
+ The <varname>mimeType</varname> attribute describes the type of output content, and corresponds to the type in the header of the <acronym>HTTP</acronym> request. The <varname>element</varname> attribute defines <attribute>XHTML</attribute> element used to display the content:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>img</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>object</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>applet</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>script</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>link</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>a</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <example id="exam-Component_Reference-Resources-a4jmediaOutput_example">
+ <title><sgmltag><a4j:mediaOutput></sgmltag> example</title>
+ <para>
+ This example uses the <sgmltag><a4j:mediaOutput></sgmltag> component to generate a <acronym>JPEG</acronym> image of verification digits. The code on the application page is a single element:
+ </para>
+<programlisting language="XML" role="XML">
+<a4j:mediaOutput element="img" cacheable="false" session="false" createContent="#{mediaBean.paint}" value="#{mediaData}" mimeType="image/jpeg" />
+</programlisting>
+ <para>
+ The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <methodname>MediaBean.paint</methodname> method to create the image. The method generates a random number, which is then converted into an output stream and rendered to a <acronym>JPEG</acronym> image. The <classname>MediaBean</classname> class is as follows:
+ </para>
+<programlisting language="XML" role="XML">
+<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ <para>
+ Another class, <classname>MediaData</classname> is required by the <varname>value</varname> attribute for keeping data to be used as input for the content creation method. The <classname>MediaData</classname> class is as follows:
+ </para>
+<programlisting language="XML" role="XML">
+<xi:include parse="text" href="extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+ </example>
+ <note>
+ <title>Note</title>
+ <para>
+ A bean class passed using the <varname>value</varname> attribute of <sgmltag><a4j:mediaOutput></sgmltag> should implement the <classname>Serializable</classname> interface so that it will be encoded to the <acronym>URL</acronym> of the resource.
+ </para>
+ </note>
+ <para>
+ The <sgmltag><a4j:mediaOutput></sgmltag> component uses the <classname>MediaBean</classname> and <classname>MediaData</classname> classes to generate a new image on each page refresh, which appears as
+ </para>
+ <figure id="figu-Component_Reference-Resources-a4jmediaOutput_example_result">
+ <title><sgmltag><a4j:mediaOutput></sgmltag> example result</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ The generated image containing a random verification number.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
</section>
</chapter>
Added: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-1.js 2009-12-21 06:48:31 UTC (rev 16174)
@@ -0,0 +1,44 @@
+package demo;
+
+
+ import java.util.Locale;
+
+ import javax.faces.context.FacesContext;
+
+
+ public class ChangeLocale {
+
+ public String germanAction() {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.getViewRoot().setLocale(Locale.GERMAN);
+
+ return null;
+
+ }
+
+
+ public String englishAction() {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.getViewRoot().setLocale(Locale.ENGLISH);
+
+ return null;
+
+ }
+
+
+
+ public String italianAction() {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ context.getViewRoot().setLocale(Locale.ITALIAN);
+
+ return null;
+
+ }
+
+}
Added: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jloadBundle-2.xml_sample 2009-12-21 06:48:31 UTC (rev 16174)
@@ -0,0 +1,8 @@
+<h:form>
+ <a4j:loadBundle var="msg" basename="demo.message"/>
+ <h:outputText id="messageBundle" value="#{msg.greeting}"/>
+ <a4j:commandLink value="De" action="#{changeLocale.germanAction}" reRender="messageBundle" />
+ <a4j:commandLink value="Eng" action="#{changeLocale.englishAction}" reRender="messageBundle" />
+ <a4j:commandLink value="It" action="#{changeLocale.italianAction}" reRender="messageBundle" />
+</h:form>
+
Added: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-0.js 2009-12-21 06:48:31 UTC (rev 16174)
@@ -0,0 +1,31 @@
+package demo;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Random;
+import javax.imageio.ImageIO;
+
+public class MediaBean {
+
+ public void paint(OutputStream out, Object data) throws IOException {
+
+ Integer high = 9999;
+ Integer low = 1000;
+ Random generator = new Random();
+ Integer digits = generator.nextInt(high - low + 1) + low;
+
+ if (data instanceof MediaData) {
+ MediaData paintData = (MediaData) data;
+ BufferedImage img = new BufferedImage(paintData.getWidth(),paintData.getHeight(),BufferedImage.TYPE_INT_RGB);
+ Graphics2D graphics2D = img.createGraphics();
+ graphics2D.setBackground(paintData.getBackground());
+ graphics2D.setColor(paintData.getDrawColor());
+ graphics2D.clearRect(0,0,paintData.getWidth(),paintData.getHeight());
+ graphics2D.setFont(paintData.getFont());
+ graphics2D.drawString(digits.toString(), 20, 35);
+ ImageIO.write(img,"png",out);
+ }
+ }
+}
Added: root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js
===================================================================
--- root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js (rev 0)
+++ root/docs/trunk/Component_Reference/en-US/extras/exam-Component_Reference-Resources-a4jmediaOutput_example-1.js 2009-12-21 06:48:31 UTC (rev 16174)
@@ -0,0 +1,22 @@
+package demo;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.Serializable;
+
+public class MediaData implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ Integer Width=110;
+ Integer Height=50;
+
+ Color Background=new Color(190, 214, 248);
+ Color DrawColor=new Color(0,0,0);
+
+ Font font = new Font("Serif", Font.TRUETYPE_FONT, 30);
+
+ /* Corresponding getters and setters */
+ ...
+
+}
Added: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png
===================================================================
(Binary files differ)
Property changes on: root/docs/trunk/Component_Reference/en-US/images/figu-Component_Reference-Resources-a4jmediaOutput_example_result.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 4 months
JBoss Rich Faces SVN: r16173 - in root/cdk/trunk/plugins: attributes and 17 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-12-18 14:38:13 -0500 (Fri, 18 Dec 2009)
New Revision: 16173
Added:
root/cdk/trunk/plugins/attributes/
root/cdk/trunk/plugins/attributes/pom.xml
root/cdk/trunk/plugins/attributes/src/
root/cdk/trunk/plugins/attributes/src/main/
root/cdk/trunk/plugins/attributes/src/main/java/
root/cdk/trunk/plugins/attributes/src/main/java/org/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java
root/cdk/trunk/plugins/attributes/src/test/
root/cdk/trunk/plugins/attributes/src/test/java/
root/cdk/trunk/plugins/attributes/src/test/java/org/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/
root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
root/cdk/trunk/plugins/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-7732
Property changes on: root/cdk/trunk/plugins/attributes
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: root/cdk/trunk/plugins/attributes/pom.xml
===================================================================
--- root/cdk/trunk/plugins/attributes/pom.xml (rev 0)
+++ root/cdk/trunk/plugins/attributes/pom.xml 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>maven-plugins</artifactId>
+ <groupId>org.richfaces.cdk</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>attributes</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <description>That project contains JAXB bindings for model classes representing schema attributes data</description>
+ <name>attributes</name>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Adapters.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class Adapters {
+
+ private abstract static class XmlTypeAdapter<KeyType extends KeyedType, ValueType extends ContainerType<KeyType>>
+ extends XmlAdapter<ValueType, Map<String, KeyType>> {
+
+ private Class<? extends ValueType> valueTypeClass;
+
+ public XmlTypeAdapter(Class<? extends ValueType> valueTypeClass) {
+ super();
+ this.valueTypeClass = valueTypeClass;
+ }
+
+ @Override
+ public ValueType marshal(Map<String, KeyType> v) throws Exception {
+ ValueType valueType = valueTypeClass.newInstance();
+ valueType.setChildren(v.values());
+ return valueType;
+ }
+
+ @Override
+ public Map<String, KeyType> unmarshal(ValueType v) throws Exception {
+ Map<String, KeyType> result = new TreeMap<String, KeyType>();
+
+ Collection<? extends KeyType> items = v.getChildren();
+ for (KeyType keyedType : items) {
+ result.put(keyedType.getKey(), keyedType);
+ }
+
+ return result;
+ }
+ }
+
+ public static final class SchemaAdapter extends XmlTypeAdapter<Schema, Schema.Type> {
+
+ public SchemaAdapter() {
+ super(Schema.Type.class);
+ }
+
+ }
+
+ public static final class ElementAdapter extends XmlTypeAdapter<Element, Element.Type> {
+
+ public ElementAdapter() {
+ super(Element.Type.class);
+ }
+
+ }
+
+ public static final class AttributeAdapter extends XmlTypeAdapter<Attribute, Attribute.Type> {
+
+ public AttributeAdapter() {
+ super(Attribute.Type.class);
+ }
+
+ }
+
+ private Adapters() {
+ }
+}
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Attribute implements KeyedType {
+
+ @XmlRootElement(name = "attributes")
+ @XmlType(name = "AttributesType")
+ public static final class Type implements ContainerType<Attribute> {
+
+ private Collection<Attribute> children = new HashSet<Attribute>();
+
+ @XmlElement(name = "attribute")
+ public Collection<Attribute> getChildren() {
+ return children;
+ }
+
+ @Override
+ public void setChildren(Collection<Attribute> values) {
+ this.children = values;
+ }
+ }
+
+ private String name;
+
+ private boolean required;
+
+ private String defaultValue;
+
+ private boolean uri;
+
+ public Attribute() {
+ super();
+ }
+
+ public Attribute(String name) {
+ super();
+ this.name = name;
+ }
+
+ /**
+ * @return the name
+ */
+ @XmlElement
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getKey() {
+ return getName();
+ }
+
+ /**
+ * @return the required
+ */
+ @XmlElement
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * @param required the required to set
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * @return the defaultValue
+ */
+ @XmlElement(name = "default-value")
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the uri
+ */
+ @XmlElement
+ public boolean isUri() {
+ return uri;
+ }
+
+ /**
+ * @param uri the uri to set
+ */
+ public void setUri(boolean uri) {
+ this.uri = uri;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Attribute other = (Attribute) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+}
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/ContainerType.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.util.Collection;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ContainerType<V> {
+
+ public Collection<V> getChildren();
+
+ public void setChildren(Collection<V> values);
+
+}
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Element.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Element implements KeyedType {
+
+ @XmlRootElement(name = "elements")
+ @XmlType(name = "ElementsType")
+ public static final class Type implements ContainerType<Element> {
+
+ private Collection<Element> children = new HashSet<Element>();
+
+ @XmlElement(name = "element")
+ public Collection<Element> getChildren() {
+ return children;
+ }
+
+ @Override
+ public void setChildren(Collection<Element> values) {
+ this.children = values;
+ }
+ }
+
+ private String name;
+
+ private Map<String, Attribute> attributes = new TreeMap<String, Attribute>();
+
+ public Element() {
+ super();
+ }
+
+ public Element(String name) {
+ super();
+ this.name = name;
+ }
+
+ /**
+ * @return the name
+ */
+ @XmlElement
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getKey() {
+ return getName();
+ }
+
+ public void addAttribute(Attribute attribute) {
+ attributes.put(attribute.getName(), attribute);
+ }
+
+ /**
+ * @return the attributes
+ */
+ @XmlJavaTypeAdapter(Adapters.AttributeAdapter.class)
+ public Map<String, Attribute> getAttributes() {
+ return attributes;
+ }
+
+ /**
+ * @param attributes the attributes to set
+ */
+ public void setAttributes(Map<String, Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Element other = (Element) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/KeyedType.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface KeyedType {
+
+ public String getKey();
+}
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Schema.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class Schema implements KeyedType {
+
+ @XmlRootElement(name = "schemas")
+ @XmlType(name = "SchemasType")
+ public static final class Type implements ContainerType<Schema> {
+
+ private Collection<Schema> children = new HashSet<Schema>();
+
+ @XmlElement(name = "schema")
+ public Collection<Schema> getChildren() {
+ return children;
+ }
+
+ @Override
+ public void setChildren(Collection<Schema> values) {
+ this.children = values;
+ }
+ }
+
+ private String namespace;
+
+ private Map<String, Element> elements = new TreeMap<String, Element>();
+
+ public Schema() {
+ super();
+ }
+
+ public Schema(String namespace) {
+ super();
+ this.namespace = namespace;
+ }
+
+ /**
+ * @return the namespace
+ */
+ @XmlElement
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * @param namespace the namespace to set
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ @Override
+ public String getKey() {
+ return getNamespace();
+ }
+
+ public void addElement(Element element) {
+ elements.put(element.getName(), element);
+ }
+
+ /**
+ * @return the elements
+ */
+ @XmlJavaTypeAdapter(Adapters.ElementAdapter.class)
+ public Map<String, Element> getElements() {
+ return elements;
+ }
+
+ /**
+ * @param elements the elements to set
+ */
+ public void setElements(Map<String, Element> elements) {
+ this.elements = elements;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Schema other = (Schema) obj;
+ if (namespace == null) {
+ if (other.namespace != null) {
+ return false;
+ }
+ } else if (!namespace.equals(other.namespace)) {
+ return false;
+ }
+ return true;
+ }
+
+}
Added: root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/SchemaSet.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@XmlRootElement(name = "schema-set")
+@XmlSeeAlso({
+ Schema.class,
+ Element.class,
+ Attribute.class
+})
+public class SchemaSet {
+
+ private Map<String, Schema> schemas = new TreeMap<String, Schema>();
+
+ public SchemaSet() {
+ super();
+ }
+
+ public void addSchema(Schema schema) {
+ schemas.put(schema.getNamespace(), schema);
+ }
+
+ /**
+ * @return the schemas
+ */
+ @XmlJavaTypeAdapter(Adapters.SchemaAdapter.class)
+ public Map<String, Schema> getSchemas() {
+ return schemas;
+ }
+
+ /**
+ * @param schemas the schemas to set
+ */
+ public void setSchemas(Map<String, Schema> schemas) {
+ this.schemas = schemas;
+ }
+
+}
Added: root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java
===================================================================
--- root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java (rev 0)
+++ root/cdk/trunk/plugins/attributes/src/test/java/org/richfaces/cdk/attributes/AttributesTest.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.cdk.attributes;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.junit.Test;
+
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class AttributesTest {
+
+ @Test
+ public void testStub() throws Exception {
+ JAXBContext jc = JAXBContext.newInstance(SchemaSet.class);
+ Marshaller marshaller = jc.createMarshaller();
+
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ SchemaSet schemaSet = new SchemaSet();
+ Schema schema = new Schema("abc");
+ schemaSet.addSchema(schema);
+ Element element = new Element("ele");
+ schema.addElement(element);
+ Attribute attribute = new Attribute("attr");
+ element.addAttribute(attribute);
+
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(schemaSet, writer);
+
+ System.out.println(writer.toString());
+
+ jc.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
+ }
+}
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/pom.xml 2009-12-18 19:38:13 UTC (rev 16173)
@@ -21,9 +21,9 @@
<version>20081112</version>
</dependency>
<dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-xjc</artifactId>
- <version>2.0.3</version>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
+ <version>1.0-rc3</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -33,18 +33,18 @@
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
- <version>1.0-rc-5</version>
+ <version>1.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
- <goal>execute</goal>
+ <goal>execute</goal>
</goals>
<configuration>
<properties>
<sourceSchema>src/main/resources/META-INF/schema/xhtml-el.xsd</sourceSchema>
<targetNamespace>http://richfaces.org/xhtml-el</targetNamespace>
- <outputFile>META-INF/schema/attributes.ser</outputFile>
+ <outputFile>META-INF/cdk/attributes/xhtml-el.xml</outputFile>
</properties>
<classpath>
<element>
@@ -52,8 +52,8 @@
<artifactId>xsom</artifactId>
</element>
<element>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-xjc</artifactId>
+ <groupId>com.google.collections</groupId>
+ <artifactId>google-collections</artifactId>
</element>
</classpath>
<source>${project.basedir}/src/main/script/SchemaAttributesParserTask.groovy</source>
@@ -64,7 +64,7 @@
<dependency>
<groupId>org.codehaus.groovy.maven.runtime</groupId>
<artifactId>gmaven-runtime-1.6</artifactId>
- <version>1.0-rc-5</version>
+ <version>1.0</version>
</dependency>
</dependencies>
</plugin>
@@ -112,6 +112,11 @@
</dependency>
<dependency>
<groupId>org.richfaces.cdk</groupId>
+ <artifactId>attributes</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
<artifactId>xinclude</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>
@@ -146,6 +151,12 @@
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<!--
<dependency> <groupId>com.google.collections</groupId>
@@ -168,12 +179,21 @@
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
- <version>1.0-rc3</version>
</dependency>
<dependency>
+ <groupId>com.sun.xsom</groupId>
+ <artifactId>xsom</artifactId>
+ </dependency>
+ <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassGenerator.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -36,6 +36,7 @@
import org.richfaces.cdk.model.RenderKit;
import org.richfaces.cdk.model.Renderer;
import org.richfaces.cdk.templatecompiler.model.Template;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
import freemarker.template.TemplateException;
@@ -88,7 +89,7 @@
Template template = renderer.getTemplate();
if (null != template) {
RendererClassVisitor visitor = new RendererClassVisitor(
- template.getInterface(), context.getLoader());
+ template.getInterface(), context.getLoader(), context.getWorker(JAXBBinding.class));
try {
// TODO - put real parameters.
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2009-12-18 19:38:13 UTC (rev 16173)
@@ -24,15 +24,13 @@
package org.richfaces.cdk.templatecompiler;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.TreeMap;
import javax.annotation.Generated;
import javax.faces.component.UIComponent;
@@ -51,6 +49,10 @@
import org.richfaces.cdk.CdkException;
import org.richfaces.cdk.Logger;
import org.richfaces.cdk.LoggerFactory;
+import org.richfaces.cdk.attributes.Attribute;
+import org.richfaces.cdk.attributes.Element;
+import org.richfaces.cdk.attributes.Schema;
+import org.richfaces.cdk.attributes.SchemaSet;
import org.richfaces.cdk.parser.el.ELParserUtils;
import org.richfaces.cdk.parser.el.ELVisitor;
import org.richfaces.cdk.parser.el.ParsingException;
@@ -69,12 +71,14 @@
import org.richfaces.cdk.templatecompiler.model.Template;
import org.richfaces.cdk.templatecompiler.model.TemplateVisitor;
import org.richfaces.cdk.util.Strings;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
import com.google.common.collect.Lists;
/**
- * <p class="changed_added_4_0"></p>
- *
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @author asmirnov(a)exadel.com
*/
public class RendererClassVisitor implements TemplateVisitor {
@@ -111,7 +115,7 @@
static final String RENDERER_UTILS_CLASS_NAME = "org.ajax4jsf.renderkit.RendererUtils";
private static final Logger LOG = LoggerFactory.getLogger();
-
+
private static final Set<String> DEFAULT_NAMESPACES = new HashSet<String>();
static {
@@ -119,10 +123,9 @@
DEFAULT_NAMESPACES.add("http://www.w3.org/1999/xhtml");
}
- private static final Map<String, Set<String>> ELEMENTS_ATTRIBUTES;
+ private MethodBodyStatementsContainer currentStatement;
- protected MethodBodyStatementsContainer currentStatement;
-
+ private Schema attributesSchema = null;
private JavaClass generatedClass;
private CompositeInterface compositeInterface;
@@ -134,34 +137,13 @@
private boolean isAddedMethodForCheckingEmptiness;
private Type lastCompiledExpressionType;
-
- static {
- InputStream serializedAttributesStream =
- RendererClassVisitor.class.getResourceAsStream("/META-INF/schema/attributes.ser");
- try {
-
- // TODO read default attributes values
- // TODO detect URI and boolean attributes
- ObjectInputStream ois = new ObjectInputStream(serializedAttributesStream);
-
- @SuppressWarnings("unchecked")
- Map<String, Set<String>> attributes = (Map<String, Set<String>>) ois.readObject();
- ELEMENTS_ATTRIBUTES = attributes;
- } catch (Exception e) {
- throw new IllegalStateException(e.getMessage(), e);
- } finally {
- try {
- serializedAttributesStream.close();
- } catch (IOException e) {
- throw new IllegalStateException(e.getMessage(), e);
- }
- }
- }
-
- public RendererClassVisitor(CompositeInterface compositeInterface, ClassLoader classLoader) {
+ public RendererClassVisitor(CompositeInterface compositeInterface, ClassLoader classLoader, JAXBBinding jaxbBinding) {
this.compositeInterface = compositeInterface;
this.classLoader = classLoader;
+
+ SchemaSet schemaSet = jaxbBinding.unmarshal("urn:attributes:xhtml-el.xml", null, SchemaSet.class);
+ this.attributesSchema = schemaSet.getSchemas().get("http://richfaces.org/xhtml-el");
}
private void initializeJavaClass() {
@@ -175,9 +157,9 @@
this.generatedClass.addImport(RENDERER_UTILS_CLASS_NAME);
this.generatedClass.addAnnotation(Generated.class, "\"RichFaces CDK\"");
- //TODO remove this after improving Java model
+ // TODO remove this after improving Java model
this.generatedClass.addImport(Generated.class);
-
+
this.createMethodContext();
}
@@ -185,8 +167,8 @@
if (!isAddedMethodForConversionToString) {
isAddedMethodForConversionToString = true;
- JavaMethod conversionMethod = new JavaMethod("convertToString", String.class,
- new Argument("object", Object.class));
+ JavaMethod conversionMethod = new JavaMethod("convertToString", String.class, new Argument("object",
+ Object.class));
conversionMethod.addModifier(JavaModifier.PRIVATE);
conversionMethod.addModifier(JavaModifier.FINAL);
@@ -203,8 +185,7 @@
if (!isAddedMethodForCheckingEmptiness) {
isAddedMethodForCheckingEmptiness = true;
- JavaMethod checkingMethod = new JavaMethod("isEmpty", boolean.class,
- new Argument("object", Object.class));
+ JavaMethod checkingMethod = new JavaMethod("isEmpty", boolean.class, new Argument("object", Object.class));
checkingMethod.addModifier(JavaModifier.PRIVATE);
checkingMethod.addModifier(JavaModifier.FINAL);
@@ -221,7 +202,7 @@
try {
ELVisitor elVisitor = new ELVisitor();
elVisitor.parse(expression, localsTypesMap);
-
+
lastCompiledExpressionType = elVisitor.getVariableType();
String parsedExpression = elVisitor.getParsedExpression();
@@ -242,7 +223,7 @@
}
private boolean isDefaultNamespace(String namespaceURI) {
- //TODO - another namespaces
+ // TODO - another namespaces
if (Strings.isEmpty(namespaceURI)) {
return true;
}
@@ -256,7 +237,7 @@
private Type createTypeOfKnownClass(JavaClass initialClass, Class<?> knownSuperClass) {
assert !knownSuperClass.isInterface();
-
+
Type result = null;
JavaClass javaClass = initialClass;
@@ -266,17 +247,17 @@
result = type;
break;
}
-
+
javaClass = javaClass.getSuperClass();
}
-
+
if (result == null) {
result = TypesFactory.getType(knownSuperClass);
}
-
+
return result;
}
-
+
private void createMethodContext() {
this.currentStatement = new MethodBody();
this.localsTypesMap = new HashMap<String, Type>();
@@ -284,12 +265,12 @@
localsTypesMap.put(RESPONSE_WRITER_VARIABLE, TypesFactory.getType(ResponseWriter.class));
localsTypesMap.put(CLIENT_ID_VARIABLE, TypesFactory.getType(String.class));
- //TODO: try load component class
+ // TODO: try load component class
localsTypesMap.put(COMPONENT_VARIABLE, TypesFactory.getType(UIComponent.class));
-
+
Type generatedClassType = createTypeOfKnownClass(generatedClass, Renderer.class);
localsTypesMap.put(THIS_VARIABLE, generatedClassType);
-
+
Type generatedClassSuperType = createTypeOfKnownClass(generatedClass.getSuperClass(), Renderer.class);
localsTypesMap.put(SUPER_VARIABLE, generatedClassSuperType);
}
@@ -309,10 +290,10 @@
methodBody.addStatement(0, new EncodeMethodPrefaceStatement());
generatedClass.addMethod(javaMethod);
-
+
Collection<Type> variableTypes = localsTypesMap.values();
for (Type variableType : variableTypes) {
-
+
Collection<Class<?>> importsList = variableType.getImportsList();
if (importsList != null) {
for (Class<?> importedClass : importsList) {
@@ -356,24 +337,29 @@
}
/**
- * <p class="changed_added_4_0"></p>
- *
+ * <p class="changed_added_4_0">
+ * </p>
+ *
* @return the rendererClass
*/
public JavaClass getGeneratedClass() {
return this.generatedClass;
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
+ */
@Override
public void startElement(CdkBodyElement cdkBodyElement) throws CdkException {
flushToEncodeMethod("encodeBegin");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #endElement(org.richfaces.cdk.templatecompiler.model.CdkBodyElement)
*/
@@ -382,7 +368,9 @@
flushToEncodeMethod("encodeChildren");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #startElement(org.richfaces.cdk.templatecompiler.model.AnyElement)
*/
@@ -392,52 +380,69 @@
Map<QName, Object> elementAttributes = anyElement.getAttributes();
if (!isDefaultNamespace(elementName.getNamespaceURI())) {
- //TODO: add support
+ // TODO: add support
}
currentStatement.addStatement(new StartElementStatement(elementName.getLocalPart()));
if (elementAttributes != null) {
+ Set<String> writtenAttributes = new HashSet<String>();
+ boolean shouldEncodePassThrough = false;
+ String[] passThroughExclusions = null;
+
for (Map.Entry<QName, Object> attribute : elementAttributes.entrySet()) {
QName attributeName = attribute.getKey();
Object attributeValue = attribute.getValue();
if (!isDefaultNamespace(attributeName.getNamespaceURI())) {
- //TODO: add support
-
- //TODO: optimize batch attributes encoding
+ // TODO: add support
if (Template.CDK_NAMESPACE.equals(attributeName.getNamespaceURI())
&& "passThroughWithExclusions".equals(attributeName.getLocalPart())) {
- //TODO check element namespace
- Set<String> attributeSet = ELEMENTS_ATTRIBUTES.get(elementName.getLocalPart());
- if (attributeSet != null) {
- //make a copy of original set
- TreeSet<String> actualAttributesSet = new TreeSet<String>(attributeSet);
+ shouldEncodePassThrough = true;
+ if (attributeValue != null) {
+ passThroughExclusions = attributeValue.toString().split("\\s+");
+ }
+ }
+ } else {
+ String attributeLocalName = attributeName.getLocalPart();
+ if (writtenAttributes.add(attributeLocalName)) {
+ currentStatement.addStatement(new WriteAttributeStatement(attributeLocalName, compileEl(
+ attributeValue.toString(), String.class)));
+ }
+ }
+ }
- if (attributeValue != null) {
- String[] exclusions = attributeValue.toString().split("\\s+");
- for (String exclusion : exclusions) {
- actualAttributesSet.remove(exclusion);
- }
- }
+ if (shouldEncodePassThrough) {
+ Element attributesElement = attributesSchema.getElements().get(elementName.getLocalPart());
+ if (attributesElement != null) {
+ // make a copy of original set
+ TreeMap<String, Attribute> actualAttributesMap = new TreeMap<String, Attribute>(
+ attributesElement.getAttributes());
- if (!actualAttributesSet.isEmpty()) {
- currentStatement.addStatement(new WriteAttributesSetStatement(actualAttributesSet));
- }
+ if (passThroughExclusions != null) {
+ for (String passThroughExclusion : passThroughExclusions) {
+ actualAttributesMap.remove(passThroughExclusion);
}
}
-
- //TODO: cdk:passThrough
- } else {
- currentStatement.addStatement(new WriteAttributeStatement(attributeName.getLocalPart(),
- compileEl(attributeValue.toString(), String.class)));
+
+ for (String writtenAttribute : writtenAttributes) {
+ actualAttributesMap.remove(writtenAttribute);
+ }
+
+ if (!actualAttributesMap.isEmpty()) {
+ // TODO: optimize batch attributes encoding
+ currentStatement.addStatement(new WriteAttributesSetStatement(actualAttributesMap
+ .keySet()));
+ }
}
}
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #endElement(org.richfaces.cdk.templatecompiler.model.AnyElement)
*/
@@ -447,7 +452,9 @@
currentStatement.addStatement(new EndElementStatement(elementName.getLocalPart()));
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor#visitElement(java.lang.String)
*/
@Override
@@ -460,7 +467,9 @@
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #visitElement(org.richfaces.cdk.templatecompiler.model.CdkCallElement)
*/
@@ -469,7 +478,9 @@
currentStatement.addStatement(cdkCallElement.getExpression() + ";");
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
* #startElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
*/
@@ -481,38 +492,46 @@
pushStatement(new IfStatement(compiledTestExpression));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkIfElement)
+ */
@Override
public void endElement(CdkIfElement cdkIfElement) {
popStatement();
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ */
@Override
public void startElement(CdkChooseElement cdkChooseElement) {
pushStatement(new IfElseStatement());
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkChooseElement)
+ */
@Override
public void endElement(CdkChooseElement cdkChooseElement) {
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+ */
@Override
public void startElement(CdkWhenElement cdkWhenElement) {
String compiledTestExpression = compileEl(cdkWhenElement.getTest(), Boolean.class);
@@ -520,37 +539,45 @@
pushStatement(new IfStatement(compiledTestExpression));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkWhenElement)
+ */
@Override
public void endElement(CdkWhenElement cdkWhenElement) {
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+ */
@Override
public void startElement(CdkOtherwiseElement cdkOtherwiseElement) {
pushStatement(new IfStatement(""));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkOtherwiseElement)
+ */
@Override
public void endElement(CdkOtherwiseElement cdkOtherwiseElement) {
popStatement();
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #visitElement(org.richfaces.cdk.templatecompiler.model.CdkObjectElement)
+ */
@Override
public void visitElement(CdkObjectElement cdkObjectElement) {
String name = cdkObjectElement.getName();
@@ -563,15 +590,15 @@
String typeString = cdkObjectElement.getType();
String typeArgumentsString = cdkObjectElement.getTypeArguments();
if (!Strings.isEmpty(typeArgumentsString)) {
- //TODO: generic arrays
+ // TODO: generic arrays
typeString += "<" + typeArgumentsString + ">";
}
-
+
Type type = null;
if (!Strings.isEmpty(typeString)) {
type = TypesFactory.getType(typeString, classLoader);
}
-
+
if (!Strings.isEmpty(value)) {
value = compileEl(value, Object.class);
if (type == null) {
@@ -582,33 +609,37 @@
if (type == null) {
type = TypesFactory.getType(Object.class);
}
-
+
defineObject(type, name, value);
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #startElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #startElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
+ */
@Override
public void startElement(CdkForEachElement cdkForEachElement) {
String items = cdkForEachElement.getItems();
String itemsExpression = compileEl(items, Iterable.class);
-
- //TODO - review
+
+ // TODO - review
Class<?> collectionElementClass = lastCompiledExpressionType.getContainerType().getRawType();
if (collectionElementClass == null) {
collectionElementClass = Object.class;
}
-
- pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(),
- collectionElementClass.getName()));
+
+ pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(), collectionElementClass
+ .getName()));
}
- /* (non-Javadoc)
- * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
- * #endElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
- */
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.cdk.templatecompiler.model.TemplateVisitor
+ * #endElement(org.richfaces.cdk.templatecompiler.model.CdkForEachElement)
+ */
@Override
public void endElement(CdkForEachElement cdkForEachElement) {
popStatement();
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2009-12-18 19:38:13 UTC (rev 16173)
@@ -150,4 +150,5 @@
<xs:attribute name="var" type="literalExpression" default="clientId" />
</xs:complexType>
</xs:element>
+
</xs:schema>
Modified: root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/xhtml-el.xsd 2009-12-18 19:38:13 UTC (rev 16173)
@@ -27,7 +27,8 @@
<xs:schema version="1.0" xml:lang="en"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://richfaces.org/xhtml-el"
xmlns="http://richfaces.org/xhtml-el" xmlns:xml="http://www.w3.org/XML/1998/namespace"
- elementFormDefault="qualified" xmlns:cdk="http://richfaces.org/cdk">
+ elementFormDefault="qualified" xmlns:cdk="http://richfaces.org/cdk"
+ xmlns:cdk-schema-info="http://richfaces.org/cdk-schema-info">
<xs:import schemaLocation="cdk-template.xsd" namespace="http://richfaces.org/cdk" />
@@ -1637,6 +1638,11 @@
<xs:attribute name="lang" type="LanguageCode" />
<xs:attribute ref="xml:lang" />
<xs:attribute name="dir" use="required">
+ <xs:annotation>
+ <xs:appinfo>
+ <cdk-schema-info:default-value>ltr</cdk-schema-info:default-value>
+ </xs:appinfo>
+ </xs:annotation>
<xs:simpleType>
<xs:union memberTypes="simpleType.dir cdk:elMixedExpression" />
</xs:simpleType>
Modified: root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2009-12-18 19:38:13 UTC (rev 16173)
@@ -1,90 +1,34 @@
import java.lang.Exception
-import java.net.URL;
-import java.io.*;
-import java.util.*;
+import com.sun.xml.xsom.XSSchemaSet
+import com.sun.xml.xsom.parser.XSOMParser
+import com.sun.xml.xsom.util.DomAnnotationParserFactory
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import com.sun.xml.xsom.*;
-import com.sun.xml.xsom.parser.*;
-
-/**
- * This class reads possible attributes from schema and writes serialized map of attributes
- * for each element
- */
-class SchemaParser {
-
- Map<String, Set<String>> attributes = new HashMap<String, Set<String>>();
-
- private Set<String> getAttributesSet(String elementName) {
- Set<String> attributesSet = attributes.get(elementName);
- if (attributesSet == null) {
- attributesSet = new HashSet<String>();
- attributes.put(elementName, attributesSet);
- }
-
- return attributesSet;
- }
-
- public void serialize(OutputStream os) throws Exception {
- ObjectOutputStream oos = null;
- try {
- oos = new ObjectOutputStream(os);
- oos.writeObject(attributes);
- } finally {
- try {
- if (oos != null) {
- oos.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- public void parse(String schemaSource, String namespace) throws Exception {
- XSOMParser parser = new XSOMParser();
- File schemaSourceFile = new File(schemaSource);
-
- def entityResolver = {String publicId, systemId ->
- def fileProtocolMatch = (systemId =~ /^file:.+/);
- if (!fileProtocolMatch || !new File(fileProtocolMatch[0]).exists()) {
- String schemaFileName = (systemId =~ /\/[^\/]+$/)[0];
-
- File entityLocation = new File(schemaSourceFile.getParentFile(), schemaFileName);
- return new InputSource(entityLocation.toURI().toString());
- }
+XSSchemaSet parse(String schemaSource) throws Exception {
+ XSOMParser parser = new XSOMParser();
+ parser.setAnnotationParser(new DomAnnotationParserFactory());
+
+ File schemaSourceFile = new File(schemaSource);
+
+ def entityResolver = {String publicId, systemId ->
+ def fileProtocolMatch = (systemId =~ /^file:.+/);
+ if (!fileProtocolMatch || !new File(fileProtocolMatch[0]).exists()) {
+ String schemaFileName = (systemId =~ /\/[^\/]+$/)[0];
- return new InputSource(systemId);
- } as EntityResolver;
-
- parser.setEntityResolver(entityResolver);
- parser.parse(schemaSourceFile);
-
- XSSchemaSet sset = parser.getResult();
- XSSchema cdkXhtmlSchema = sset.getSchema(namespace);
-
- Iterator<XSElementDecl> elements = cdkXhtmlSchema.iterateElementDecls();
- while (elements.hasNext()) {
- XSElementDecl element = elements.next();
- XSComplexType complexType = element.getType().asComplexType();
- if (complexType != null) {
- Set<String> attributesSet = getAttributesSet(element.getName());
-
- Collection<? extends XSAttributeUse> uses = complexType.getAttributeUses();
- for (XSAttributeUse xsAttributeUse : uses) {
- XSAttributeDecl attributeDecl = xsAttributeUse.getDecl();
- String attributeNamespace = attributeDecl.getTargetNamespace();
- if (namespace.equals(attributeNamespace) || attributeNamespace.length() == 0) {
- attributesSet.add(attributeDecl.getName());
- }
- }
- }
+ File entityLocation = new File(schemaSourceFile.getParentFile(), schemaFileName);
+ return new InputSource(entityLocation.toURI().toString());
}
- }
-}
+
+ return new InputSource(systemId);
+ } as EntityResolver;
+
+ parser.setEntityResolver(entityResolver);
+ parser.parse(schemaSourceFile);
+
+ return parser.getResult();
+}
try {
def targetNamespaceParam = project.properties['targetNamespace'];
@@ -96,7 +40,7 @@
String outputFileName = project.build.outputDirectory + '/' + outputFileParam;
log.info("Parsing: " + sourceSchemaFileName);
- log.info("Writing serialized attributes to: " + outputFileName);
+ log.info("Writing attributes XML data to: " + outputFileName);
File outputFile = new File(outputFileName);
@@ -109,11 +53,14 @@
} else {
outputFile.getParentFile().mkdirs();
}
+
outputFile.createNewFile();
- SchemaParser parser = new SchemaParser();
- parser.parse(sourceSchemaFileName, targetNamespaceParam);
- parser.serialize(new FileOutputStream(outputFileName));
+ XSSchemaSet schemaSet = parse(sourceSchemaFileName);
+ SchemaProcessor schemaProcessor = new SchemaProcessor(schemaSet, targetNamespaceParam);
+ schemaProcessor.buildModel();
+ schemaProcessor.serializeModel(new FileOutputStream(outputFileName));
+
} catch (Exception e) {
fail(e);
}
Added: root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessor.groovy 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,192 @@
+
+
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.richfaces.cdk.attributes.Attribute;
+import org.richfaces.cdk.attributes.Element;
+import org.richfaces.cdk.attributes.Schema;
+import org.richfaces.cdk.attributes.SchemaSet;
+import org.w3c.dom.Node;
+
+import com.sun.xml.xsom.XSAnnotation;
+import com.sun.xml.xsom.XSAttributeDecl;
+import com.sun.xml.xsom.XSAttributeUse;
+import com.sun.xml.xsom.XSComplexType;
+import com.sun.xml.xsom.XSElementDecl;
+import com.sun.xml.xsom.XSListSimpleType;
+import com.sun.xml.xsom.XSSchema;
+import com.sun.xml.xsom.XSSchemaSet;
+import com.sun.xml.xsom.XSSimpleType;
+import com.sun.xml.xsom.XSType;
+import com.sun.xml.xsom.XSUnionSimpleType;
+
+final class SchemaProcessor {
+
+ private NamespaceContext CDK_NAMESPACES_CONTEXT = new SchemaProcessorNamespaceContext();
+
+ private XSSchema schema;
+
+ private String namespace;
+
+ private XSSimpleType anyURIType;
+
+ private XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ private SchemaSet modelSchemaSet;
+
+ public SchemaProcessor(XSSchemaSet schemaSet, String namespace) {
+ super();
+
+ this.namespace = namespace;
+ this.schema = schemaSet.getSchema(namespace);
+ this.anyURIType = schemaSet.getSimpleType("http://www.w3.org/2001/XMLSchema", "anyURI");
+ }
+
+ private XPath createXPath() {
+ XPath xPath = xPathFactory.newXPath();
+ xPath.setNamespaceContext(CDK_NAMESPACES_CONTEXT);
+
+ return xPath;
+ }
+
+ private String getDefaultValue(XSAttributeUse attributeUse) throws XPathExpressionException {
+ String defaultValue = null;
+
+ XSAttributeDecl attributeDecl = attributeUse.getDecl();
+ XSAnnotation annotation = attributeDecl.getAnnotation();
+ if (annotation != null) {
+ Object annotationElement = annotation.getAnnotation();
+ if (annotationElement != null) {
+ XPath xPath = createXPath();
+ Node node = (Node) xPath.evaluate("xs:appinfo/cdk-schema-info:default-value", annotationElement,
+ XPathConstants.NODE);
+ if (node != null) {
+ defaultValue = xPath.evaluate("text()", node);
+ }
+ }
+ }
+
+ return defaultValue;
+ }
+
+ private boolean isURIType(XSSimpleType simpleType) {
+ return isURIType(simpleType, new HashSet<XSType>());
+ }
+
+ private boolean isURIType(XSSimpleType simpleType, Set<XSType> processedTypes) {
+ if (simpleType == null) {
+ return false;
+ }
+
+ if (!processedTypes.add(simpleType)) {
+ return false;
+ }
+
+ if (simpleType.isDerivedFrom(anyURIType)) {
+ return true;
+ }
+
+ if (isURIType(simpleType.getSimpleBaseType(), processedTypes)) {
+ return true;
+ }
+
+ if (isURIType(simpleType.getPrimitiveType(), processedTypes)) {
+ return true;
+ }
+
+ if (simpleType.isUnion()) {
+ XSUnionSimpleType unionSimpleType = simpleType.asUnion();
+ int memberSize = unionSimpleType.getMemberSize();
+ for (int i = 0; i < memberSize; i++) {
+ XSSimpleType unionMemberType = unionSimpleType.getMember(i);
+ if (isURIType(unionMemberType, processedTypes)) {
+ return true;
+ }
+ }
+ } else if (simpleType.isRestriction()) {
+ // do nothing
+ } else if (simpleType.isList()) {
+ XSListSimpleType listSimpleType = simpleType.asList();
+ XSSimpleType listItemType = listSimpleType.getItemType();
+ if (isURIType(listItemType, processedTypes)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void buildModel() throws Exception {
+ modelSchemaSet = new SchemaSet();
+ Schema modelSchema = new Schema(namespace);
+ modelSchemaSet.addSchema(modelSchema);
+
+ Iterator<XSElementDecl> elements = schema.iterateElementDecls();
+ while (elements.hasNext()) {
+ XSElementDecl element = elements.next();
+
+ Element modelElement = new Element(element.getName());
+ modelSchema.addElement(modelElement);
+
+ XSComplexType complexType = element.getType().asComplexType();
+ if (complexType != null) {
+ Collection<? extends XSAttributeUse> uses = complexType.getAttributeUses();
+ for (XSAttributeUse xsAttributeUse : uses) {
+ XSAttributeDecl attributeDecl = xsAttributeUse.getDecl();
+ String attributeNamespace = attributeDecl.getTargetNamespace();
+ if (namespace.equals(attributeNamespace) || attributeNamespace.length() == 0) {
+ Attribute modelAttribute = new Attribute(attributeDecl.getName());
+ modelElement.addAttribute(modelAttribute);
+ modelAttribute.setUri(isURIType(attributeDecl.getType()));
+ modelAttribute.setRequired(xsAttributeUse.isRequired());
+ modelAttribute.setDefaultValue(getDefaultValue(xsAttributeUse));
+ }
+ }
+ }
+ }
+ }
+
+ public void serializeModel(OutputStream outputStream) throws IOException {
+ try {
+ JAXBContext jc = JAXBContext.newInstance(modelSchemaSet.getClass());
+ Marshaller marshaller = jc.createMarshaller();
+
+ marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+
+ marshaller.marshal(modelSchemaSet, outputStream);
+ } finally {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+ /**
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ Class<?> testxsom = SchemaProcessor.class.getClassLoader().loadClass("TestXSom");
+ XSSchemaSet schemaSet = (XSSchemaSet) testxsom.getMethod("parse2").invoke(null);
+
+ SchemaProcessor testXSOM2 = new SchemaProcessor(schemaSet, "http://richfaces.org/xhtml-el");
+ testXSOM2.buildModel();
+ testXSOM2.serializeModel(System.out);
+ }
+
+}
Added: root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/script/SchemaProcessorNamespaceContext.groovy 2009-12-18 19:38:13 UTC (rev 16173)
@@ -0,0 +1,62 @@
+import java.util.Iterator;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+
+import javax.xml.namespace.NamespaceContext;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
+ */
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+class SchemaProcessorNamespaceContext implements NamespaceContext {
+ private BiMap<String, String> biMap;
+
+ SchemaProcessorNamespaceContext() {
+ biMap = HashBiMap.create();
+ biMap.put("http://www.w3.org/2001/XMLSchema", "xs");
+ biMap.put("http://richfaces.org/cdk-schema-info", "cdk-schema-info");
+ }
+
+ @Override
+ public Iterator getPrefixes(String namespaceURI) {
+ String prefix = biMap.get(namespaceURI);
+ if (prefix != null) {
+ return Iterators.forArray(prefix);
+ } else {
+ return Iterators.emptyIterator();
+ }
+ }
+
+ @Override
+ public String getPrefix(String namespaceURI) {
+ return biMap.get(namespaceURI);
+ }
+
+ @Override
+ public String getNamespaceURI(String prefix) {
+ return biMap.inverse().get(prefix);
+ }
+}
Modified: root/cdk/trunk/plugins/pom.xml
===================================================================
--- root/cdk/trunk/plugins/pom.xml 2009-12-18 16:36:45 UTC (rev 16172)
+++ root/cdk/trunk/plugins/pom.xml 2009-12-18 19:38:13 UTC (rev 16173)
@@ -14,11 +14,12 @@
<name>maven plugin CDK plugins</name>
- <modules>
+ <modules>
<module>annotations</module>
+ <module>attributes</module>
<module>xinclude</module>
- <module>generator</module>
- <module>maven-cdk-plugin</module>
+ <module>generator</module>
+ <module>maven-cdk-plugin</module>
</modules>
</project>
\ No newline at end of file
15 years, 4 months
JBoss Rich Faces SVN: r16172 - branches/community/3.3.X/samples/richfaces-demo/functional-test.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-12-18 11:36:45 -0500 (Fri, 18 Dec 2009)
New Revision: 16172
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
Log:
- RF-demo Ftest - typo in last commit - ${container.version}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2009-12-18 15:16:45 UTC (rev 16171)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2009-12-18 16:36:45 UTC (rev 16172)
@@ -463,7 +463,7 @@
</property>
</activation>
<properties>
- <container.home>${project.build.directory}/installs/apache-tomcat-r.version}/apache-tomcat-${container.version}</container.home>
+ <container.home>${project.build.directory}/installs/apache-tomcat-${container.version}/apache-tomcat-${container.version}</container.home>
</properties>
<build>
<plugins>
15 years, 4 months