JBoss Rich Faces SVN: r1735 - in trunk/sandbox: ui/calendar/src/main/java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-20 09:12:47 -0400 (Fri, 20 Jul 2007)
New Revision: 1735
Modified:
trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/index.jsp
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
Source code optimized
Modified: trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/index.jsp 2007-07-20 12:55:55 UTC (rev 1734)
+++ trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/index.jsp 2007-07-20 13:12:47 UTC (rev 1735)
@@ -10,7 +10,9 @@
<h:form>
<calendar:calendar id="calendar" data="#{calendarDataModel}" locale="#{calendarBean.locale}">
<f:facet name="header">
- {nextMonthControl} | {previousMonthControl}
+ <f:verbatim>
+ {previousMonthControl} | {nextMonthControl}
+ </f:verbatim>
</f:facet>
<f:facet name="weekNumber">
<h:outputText style="font-weight: bold;" value="{weekNumber}" />
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-20 12:55:55 UTC (rev 1734)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-20 13:12:47 UTC (rev 1735)
@@ -51,6 +51,8 @@
public static final String DATE_SCROLL = "DateScroll";
+ protected static final String MARKUP_SUFFIX = "Markup";
+
/*
* (non-Javadoc)
*
@@ -115,14 +117,21 @@
public void writeMarkupScriptBody(FacesContext context,
UIComponent component, boolean children) throws IOException {
- ResponseWriter responseWriter = context.getResponseWriter();
- responseWriter
- .write("function (context) { return this.invoke('getContent', context).join('')");
- responseWriter.write("}.bind(");
writeScriptBody(context, component, children);
- responseWriter.write(")");
}
+ public void writeFacetMarkupScriptBody(FacesContext context,
+ UIComponent component, String facetName) throws IOException {
+
+ UIComponent facet = component.getFacet(facetName);
+ if (facet != null && facet.isRendered()) {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.writeText(", " + facetName + MARKUP_SUFFIX + ": ", null);
+ writeMarkupScriptBody(context, facet, false);
+ }
+ }
+
+
public void writePreloadBody(FacesContext context, UICalendar calendar)
throws IOException {
Object preload = calendar.getPreload();
Modified: trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-20 12:55:55 UTC (rev 1734)
+++ trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-20 13:12:47 UTC (rev 1735)
@@ -34,40 +34,18 @@
minDaysInFirstWeek: 4,
headerOptionalMarkup: [new E('b',{},[new T('User defined header')])],
footerOptionalMarkup: [new E('b',{},[new T('User defined header')])],
- dayListMarkup:
- <jsp:scriptlet>/*<![CDATA[*/
- if (component.getChildCount() != 0) {
- writeMarkupScriptBody(context, component, true);
- } else {
- /*]]>*/</jsp:scriptlet>
- Calendar.getDayView
- <jsp:scriptlet>/*<![CDATA[*/
- }
- /*]]>*/</jsp:scriptlet>
- ,
-
- weekDayMarkup: <jsp:scriptlet>/*<![CDATA[*/
- UIComponent weekDayFacet = component.getFacet("weekDay");
- if (weekDayFacet != null && weekDayFacet.isRendered()) {
- writeMarkupScriptBody(context, weekDayFacet, false);
- } else {
- /*]]>*/</jsp:scriptlet>
- Calendar.getWeekDayView
- <jsp:scriptlet>/*<![CDATA[*/
- }
- /*]]>*/</jsp:scriptlet>
- ,
-
- weekNumberMarkup: <jsp:scriptlet>/*<![CDATA[*/
- UIComponent weekNumberFacet = component.getFacet("weekNumber");
- if (weekNumberFacet != null && weekNumberFacet.isRendered()) {
- writeMarkupScriptBody(context, weekNumberFacet, false);
- } else {
- /*]]>*/</jsp:scriptlet>
- Calendar.getWeekNumberView
- <jsp:scriptlet>/*<![CDATA[*/
- }
- /*]]>*/</jsp:scriptlet>
+ <jsp:scriptlet>/*<![CDATA[*/
+ if (component.getChildCount() != 0) {
+ /*]]>*/</jsp:scriptlet>
+ dayListMarkup:
+ <jsp:scriptlet>/*<![CDATA[*/
+ writeMarkupScriptBody(context, component, true);
+ }
+ /*]]>*/</jsp:scriptlet>
+ <f:call name="writeFacetMarkupScriptBody"><f:parameter value="weekDay" /></f:call>
+ <f:call name="writeFacetMarkupScriptBody"><f:parameter value="weekNumber" /></f:call>
+ <f:call name="writeFacetMarkupScriptBody"><f:parameter value="header" /></f:call>
+ <f:call name="writeFacetMarkupScriptBody"><f:parameter value="footer" /></f:call>
}).load(
<jsp:scriptlet>/*<![CDATA[*/
writePreloadBody(context, component);
17 years, 5 months
JBoss Rich Faces SVN: r1734 - in trunk/sandbox/ui/calendar/src/main: templates/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-07-20 08:55:55 -0400 (Fri, 20 Jul 2007)
New Revision: 1734
Modified:
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
Modified: trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-07-20 12:30:34 UTC (rev 1733)
+++ trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-07-20 12:55:55 UTC (rev 1734)
@@ -132,8 +132,8 @@
// showWeekDaysBar - show WeekDays Bar [default value is true]
// showWeeksBar - show Weeks numbers bar [default value is true]
- // headerHtml - user defined header (optional)
- // footeHtml - user defined footer (optional)
+ // headerOptionalMarkup - user defined header (optional)
+ // footerOptionalMarkup - user defined footer (optional)
// direction - [top-left, top-right, bottom-left, bottom-right, auto]
// jointPoint
@@ -172,10 +172,10 @@
'<input id="'+this.id+'InputCurrentDate" name="'+this.id+'InputCurrentDate" type="hidden" value="'+this.getCurrentDate().format("MM/y")+'"/>\n' +
'<table border="0" cellpadding="0" cellspacing="0" class="calendar_exterior"><tbody>\n';
var colspan = (this.params.showWeeksBar ? "8" : "7");
- var htmlHeaderOptional = (this.params.headerHtml && this.params.headerHtml!='') ? '<tr><td class="calendar_header" colspan="'+colspan+'">'+this.params.headerHtml+'</td></tr>' : '';
- var htmlFooterOptional = (this.params.footerHtml && this.params.footerHtml!='') ? '<tr><td class="calendar_footer" colspan="'+colspan+'">'+this.params.footerHtml+'</td></tr>' : '';
- var htmlControlsHeader = '<tr><td colspan="'+colspan+'" id="'+this.id+':header"></td></tr>'
- var htmlControlsFooter = '<tr><td colspan="'+colspan+'" id="'+this.id+':footer"></td></tr>'
+ var htmlHeaderOptional = (this.params.headerOptionalMarkup) ? '<tr><td class="calendar_header" colspan="'+colspan+'" id="'+this.id+'HeaderOptional"></td></tr>' : '';
+ var htmlFooterOptional = (this.params.footerOptionalMarkup) ? '<tr><td class="calendar_footer" colspan="'+colspan+'" id="'+this.id+'FooterOptional"></td></tr>' : '';
+ var htmlControlsHeader = (Calendar.header) ? '<tr><td colspan="'+colspan+'" id="'+this.id+'Header"></td></tr>' : '';
+ var htmlControlsFooter = (Calendar.footer) ? '<tr><td colspan="'+colspan+'" id="'+this.id+'Footer"></td></tr>' : '';
var htmlTextFooter = '</tbody></table>\n';
// days bar creation
@@ -189,7 +189,7 @@
var weekDayCounter = this.params.firstWeekDay;
for (var i=0;i<7;i++)
{
- var weekDayHtml = this.params.weekDayMarkup( {weekDayLabel: this.params.weekDayLabels[weekDayCounter], weekDayNumber:weekDayCounter, componentId:this.getWeekDayComponentId(i)} );
+ var weekDayHtml = this.evaluateMarkup(this.params.weekDayMarkup, {weekDayLabel: this.params.weekDayLabels[weekDayCounter], weekDayNumber:weekDayCounter, componentId:this.getWeekDayComponentId(i)} );
if (weekDayCounter==6) weekDayCounter=0; else weekDayCounter++;
styleClass = (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber ? "Weekendclass" : "calendar_days");
@@ -208,7 +208,7 @@
htmlTextWeek+='<tr id="'+this.params.weekNumberBarId+k+'">';
if (this.params.showWeeksBar)
{
- var weekNumberHtml = this.params.weekNumberMarkup( {weekNumber: k, componentId:this.getWeekNumberComponentId(k-1)} );
+ var weekNumberHtml = this.evaluateMarkup(this.params.weekNumberMarkup, {weekNumber: k, componentId:this.getWeekNumberComponentId(k-1)} );
htmlTextWeek+='<td class="calendar_week">'+weekNumberHtml+'</td>';
}
@@ -481,6 +481,8 @@
// render
this.renderHeader();
this.renderFooter();
+ this.renderHeaderOptional();
+ this.renderFooterOptional();
//days render
p=0;
@@ -513,7 +515,7 @@
wn=1;
weekflag=false;
}
- element.innerHTML = this.params.weekNumberMarkup( {weekNumber: wn++, componentId:this.getWeekNumberComponentId(k-1)} );
+ element.innerHTML = this.evaluateMarkup(this.params.weekNumberMarkup, {weekNumber: wn++, componentId:this.getWeekNumberComponentId(k-1)} );
if (k==1&&wn>52) wn=1;
element = element.nextSibling;
}
@@ -526,7 +528,7 @@
element.data=dataobj.day;
dataobj.componentId=this.getDateComponentId(p);
- element.innerHTML = this.params.dayListMarkup( dataobj );
+ element.innerHTML = this.evaluateMarkup(this.params.dayListMarkup, dataobj );
// class styles
e = Element.classNames(element);
@@ -549,22 +551,40 @@
},
renderHeader: function()
{
- var header = $(this.id+":header");
- if (header)
- {
- header.innerHTML = Calendar.header.getContent(this.calendarContext);
- }
+ this.renderMarkup(Calendar.header, this.id+"Header", this.calendarContext);
},
renderFooter: function()
{
- var footer = $(this.id+":footer");
- if (footer)
- {
- footer.innerHTML = Calendar.footer.getContent(this.calendarContext);
- }
+ this.renderMarkup(Calendar.footer, this.id+"Footer", this.calendarContext);
},
+
+ renderHeaderOptional: function()
+ {
+ this.renderMarkup(this.params.headerOptionalMarkup, this.id+"HeaderOptional", this.calendarContext);
+ },
+
+ renderFooterOptional: function()
+ {
+ this.renderMarkup(this.params.footerOptionalMarkup, this.id+"FooterOptional", this.calendarContext);
+ },
+ renderMarkup: function (markup, elementId, context)
+ {
+ if (!markup) return;
+
+ var e = $(elementId);
+ if (!e) return;
+
+ e.innerHTML = markup.invoke('getContent', context).join('');
+ },
+
+ evaluateMarkup: function(markup, context)
+ {
+ if (!markup) return "";
+ return markup.invoke('getContent', context).join('');
+ },
+
onUpdate: function()
{
var formattedDate = this.getCurrentDate().format("MM/y");
@@ -677,7 +697,7 @@
};
-Calendar.header =
+Calendar.header = [
new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
[
new E('tbody',{},
@@ -707,9 +727,9 @@
])
])
]
- );
+ )];
-Calendar.footer =
+Calendar.footer = [
new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
[
new E('tbody',{},
@@ -731,7 +751,7 @@
])
])
]
- );
+ )];
CalendarContext = Class.create();
Modified: trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-20 12:30:34 UTC (rev 1733)
+++ trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-20 12:55:55 UTC (rev 1734)
@@ -32,8 +32,8 @@
monthLabelsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
firstWeekDay: 0,
minDaysInFirstWeek: 4,
- headerHtml: '<b>User defined header</b>',
- footerHtml: 'User defined footer',
+ headerOptionalMarkup: [new E('b',{},[new T('User defined header')])],
+ footerOptionalMarkup: [new E('b',{},[new T('User defined header')])],
dayListMarkup:
<jsp:scriptlet>/*<![CDATA[*/
if (component.getChildCount() != 0) {
17 years, 5 months
JBoss Rich Faces SVN: r1733 - trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-20 08:30:34 -0400 (Fri, 20 Jul 2007)
New Revision: 1733
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/ParameterProcessor.java
Log:
Incorrect processing of f:parameter tags fixed
Modified: trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/ParameterProcessor.java
===================================================================
--- trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/ParameterProcessor.java 2007-07-20 12:07:19 UTC (rev 1732)
+++ trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/ParameterProcessor.java 2007-07-20 12:30:34 UTC (rev 1733)
@@ -55,7 +55,8 @@
&& (childNode.getNodeName().equals(PARAMETER_NODE_NAME))) {
element.removeChild(childNode);
-
+ iElement--;
+
NamedNodeMap attributes = childNode.getAttributes();
if (attributes != null) {
17 years, 5 months
JBoss Rich Faces SVN: r1732 - in trunk/sandbox/ui/scrollable-grid/src: main/java/org/richfaces/component and 12 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-07-20 08:07:19 -0400 (Fri, 20 Jul 2007)
New Revision: 1732
Added:
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortField.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/config/component/scrollable-grid.xml
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ColumnWalker.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/utils/TemplateLoader.java
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
trunk/sandbox/ui/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/component/html/HtmlScrollableGridComponentTest.java
trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java
Log:
rendering of sort icons moved to server
Modified: trunk/sandbox/ui/scrollable-grid/src/main/config/component/scrollable-grid.xml
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/config/component/scrollable-grid.xml 2007-07-20 12:07:19 UTC (rev 1732)
@@ -199,6 +199,10 @@
<renderer generate="true">
<template>org/richfaces/scrollable-grid-footer-cell.jspx</template>
</renderer>
+
+ <renderer generate="true">
+ <template>org/richfaces/scrollable-grid-header-itself.jspx</template>
+ </renderer>
<converter generate="false">
<classname>org.richfaces.model.selection.ClientSelectionConverter</classname>
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Selectable.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,15 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import org.richfaces.model.selection.Selection;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Selectable {
+ public Selection getSelection();
+ public void setSelection (Selection selection);
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/Sortable.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,23 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source: /cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/component/Sortable.java,v $
+ * $Revision: 1.1 $
+ */
+
+package org.richfaces.component;
+
+import org.richfaces.model.SortOrder;
+
+
+/**
+ * @author Maksim Kaszynski
+ * Base interface for sort capable components
+ */
+public interface Sortable {
+ public SortOrder getSortOrder();
+ public void setSortOrder(SortOrder sortOrder);
+}
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGrid.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -52,7 +52,10 @@
public static final String SORT_SINGLE = "single";
public static final String SORT_MULTI = "multi";
+ public static String ASC_ICON = "ascIcon";
+ public static String DESC_ICON = "descIcon";
+
private boolean MODEL_RANGE = false;
private final static Log log = LogFactory.getLog(UIScrollableGrid.class);
@@ -385,4 +388,29 @@
public abstract void setSortMode(String mode);
+ public UIComponent getAscIcon() {
+ return getFacet(ASC_ICON);
+ }
+
+ public void setAscIcon(UIComponent component) {
+ if (component == null) {
+ getFacets().remove(ASC_ICON);
+ } else {
+ getFacets().put(ASC_ICON, component);
+ }
+ }
+
+ public UIComponent getDescIcon() {
+ return getFacet(DESC_ICON);
+ }
+
+ public void setDescIcon(UIComponent component) {
+ if (component == null) {
+ getFacets().remove(DESC_ICON);
+ } else {
+ getFacets().put(DESC_ICON, component);
+ }
+ }
+
+
}
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/component/UIScrollableGridColumn.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -5,6 +5,8 @@
import java.util.Iterator;
+import javax.faces.component.UIComponent;
+
import org.richfaces.event.sort.SortListener;
import org.richfaces.event.sort.SortSource;
@@ -42,4 +44,40 @@
public abstract void setName(String name);
+ public UIScrollableGrid getGrid() {
+ return (UIScrollableGrid) getParent();
+ }
+
+ public UIComponent getAscIcon() {
+ UIComponent facet = getFacet(UIScrollableGrid.ASC_ICON);
+ if (facet == null) {
+ facet = getGrid().getAscIcon();
+ }
+ return facet;
+ }
+
+ public void setAscIcon(UIComponent component) {
+ if (component == null) {
+ getFacets().remove(UIScrollableGrid.ASC_ICON);
+ } else {
+ getFacets().put(UIScrollableGrid.ASC_ICON, component);
+ }
+ }
+
+ public UIComponent getDescIcon() {
+ UIComponent facet = getFacet(UIScrollableGrid.DESC_ICON);
+ if (facet == null) {
+ facet = getGrid().getDescIcon();
+ }
+ return facet;
+ }
+
+ public void setDescIcon(UIComponent component) {
+ if (component == null) {
+ getFacets().remove(UIScrollableGrid.DESC_ICON);
+ } else {
+ getFacets().put(UIScrollableGrid.DESC_ICON, component);
+ }
+ }
+
}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/scroll/ScrollEvent.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.richfaces.event.scroll;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class ScrollEvent extends FacesEvent {
+
+ private static final long serialVersionUID = 3786221668771853810L;
+
+ private int rows;
+
+ private int first;
+
+ public ScrollEvent(UIComponent component, int rows, int first){
+ super(component);
+ this.rows = rows;
+ this.first = first;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ }
+
+ public int getFirst() {
+ return first;
+ }
+
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public int getRows() {
+ return rows;
+ }
+
+ public void setRows(int rows) {
+ this.rows = rows;
+ }
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/MultiColumnSortListener.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,88 @@
+/**
+ *
+ */
+package org.richfaces.event.sort;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIScrollableGrid;
+import org.richfaces.component.UIScrollableGridColumn;
+import org.richfaces.model.SortField;
+import org.richfaces.model.SortOrder;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class MultiColumnSortListener implements SortListener {
+
+ public static final MultiColumnSortListener INSTANCE = new MultiColumnSortListener();
+
+ private MultiColumnSortListener() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.event.sort.SortListener#processSort(org.richfaces.event.sort.SortEvent)
+ */
+ public void processSort(SortEvent e) {
+ UIScrollableGrid grid = (UIScrollableGrid) e.getComponent();
+ int columnIndex = e.getSortColumn();
+ UIScrollableGridColumn column =
+ (UIScrollableGridColumn) grid.getChildren().get(columnIndex);
+ String name = column.getName();
+
+ SortOrder sortOrder = grid.getSortOrder();
+ if (sortOrder == null) {
+ sortOrder = new SortOrder();
+ grid.setSortOrder(sortOrder);
+
+ if (grid.getValueBinding("sortOrder") != null) {
+ grid.getValueBinding("sortOrder").setValue(FacesContext.getCurrentInstance(), sortOrder);
+ }
+
+ }
+
+ SortField[] fields = sortOrder.getFields();
+
+ if (fields == null) {
+ //If no sorting was applied at all, set sorting to current
+ fields = new SortField[] {new SortField(name, columnIndex, Boolean.TRUE)};
+ } else {
+
+ List newFields = new LinkedList(Arrays.asList(fields));
+ SortField newField = null;
+
+ for (Iterator iterator = newFields.iterator(); iterator.hasNext() && newField == null; ) {
+ SortField sortField = (SortField) iterator.next();
+ if (sortField.getIndex() == columnIndex ||
+ (sortField.getName() != null &&
+ name != null &&
+ name.equals(sortField.getName()))) {
+
+ Boolean asc = sortField.getAscending();
+ asc = Boolean.TRUE.equals(asc) ? Boolean.FALSE : Boolean.TRUE;
+
+ newField = new SortField(name, columnIndex, asc);
+ iterator.remove();
+
+ }
+ }
+
+ if (newField == null) {
+ newField = new SortField(name, columnIndex, Boolean.TRUE);
+ }
+
+ newFields.add(newField);
+ fields = (SortField[]) newFields.toArray(new SortField[newFields.size()]);
+ }
+
+ sortOrder.setFields(fields);
+ }
+
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SingleColumnSortListener.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package org.richfaces.event.sort;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIScrollableGrid;
+import org.richfaces.component.UIScrollableGridColumn;
+import org.richfaces.model.SortField;
+import org.richfaces.model.SortOrder;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SingleColumnSortListener implements SortListener {
+
+ public static final SingleColumnSortListener INSTANCE = new SingleColumnSortListener();
+
+ private SingleColumnSortListener() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.event.sort.SortListener#processSort(org.richfaces.event.sort.SortEvent)
+ */
+ public void processSort(SortEvent e) {
+ UIScrollableGrid grid = (UIScrollableGrid) e.getComponent();
+ int columnIndex = e.getSortColumn();
+ UIScrollableGridColumn column =
+ (UIScrollableGridColumn) grid.getChildren().get(columnIndex);
+ String name = column.getName();
+
+ SortOrder sortOrder = grid.getSortOrder();
+ if (sortOrder == null) {
+ sortOrder = new SortOrder();
+ grid.setSortOrder(sortOrder);
+
+ if (grid.getValueBinding("sortOrder") != null) {
+ grid.getValueBinding("sortOrder").setValue(FacesContext.getCurrentInstance(), sortOrder);
+ }
+
+ }
+
+ SortField[] fields = sortOrder.getFields();
+
+ SortField newField = new SortField(name, columnIndex, Boolean.TRUE);
+
+ if (fields != null) {
+ for (int i = 0; i < fields.length; i++) {
+ SortField sortField = fields[i];
+ if (sortField.getIndex() == columnIndex ||
+ (sortField.getName() != null &&
+ name != null &&
+ name.equals(sortField.getName()))) {
+
+ Boolean asc = sortField.getAscending();
+ asc = Boolean.TRUE.equals(asc) ? Boolean.FALSE : Boolean.TRUE;
+
+ newField = new SortField(name, columnIndex, asc);
+ break;
+
+ }
+ }
+ }
+
+ sortOrder.setFields(new SortField[] {newField});
+ }
+
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortEvent.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,95 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source: /cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/event/sort/SortEvent.java,v $
+ * $Revision: 1.2 $
+ */
+
+package org.richfaces.event.sort;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Maksim Kaszynski
+ * @modified by Anton Belevich
+ *
+ */
+public class SortEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -1453867412542792281L;
+
+ private int sortColumn;
+
+ private int startRow;
+
+ private int dataIndex;
+
+ private boolean asc;
+
+
+ public SortEvent(
+ UIComponent component, int sortColumn, int startRow, int dataIndex, boolean asc) {
+
+ super(component);
+ this.asc = asc;
+ this.sortColumn = sortColumn;
+ this.startRow = startRow;
+ this.dataIndex = dataIndex;
+
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return (listener instanceof SortListener);
+ }
+
+ public void processListener(FacesListener listener) {
+ ((SortListener) listener).processSort(this);
+ }
+
+ /**
+ * @return the sortField
+ */
+ public int getSortColumn() {
+ return sortColumn;
+ }
+
+ /**
+ * @see java.util.EventObject#toString()
+ */
+ public String toString() {
+ return "SortEvent: {sortColumn: " + sortColumn + "}";
+ }
+
+ public boolean isAsc() {
+ return asc;
+ }
+
+ public void setAsc(boolean asc) {
+ this.asc = asc;
+ }
+
+ public int getDataIndex() {
+ return dataIndex;
+ }
+
+ public void setDataIndex(int dataIndex) {
+ this.dataIndex = dataIndex;
+ }
+
+ public int getStartRow() {
+ return startRow;
+ }
+
+ public void setStartRow(int startRow) {
+ this.startRow = startRow;
+ }
+
+ public void setSortColumn(int sortColumn) {
+ this.sortColumn = sortColumn;
+ }
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortListener.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,21 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source: /cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/event/sort/SortListener.java,v $
+ * $Revision: 1.1 $
+ */
+
+package org.richfaces.event.sort;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface SortListener extends FacesListener {
+ public void processSort(SortEvent e);
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/event/sort/SortSource.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,21 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source: /cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/event/sort/SortSource.java,v $
+ * $Revision: 1.1 $
+ */
+
+package org.richfaces.event.sort;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface SortSource {
+ public void addSortListener(SortListener listener);
+ public void removeSortListener(SortListener listener);
+ public SortListener[] getSortListeners();
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/DataModelCache.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,186 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.DataModelListener;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.ajax.repeat.Range;
+import org.ajax4jsf.ajax.repeat.SerializableDataModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Implementation stores last loaded data, so no additional requests to db will be performed
+ * Acts as a proxy between the component and original data model
+ * @author Maksim Kaszynski
+ *
+ */
+public class DataModelCache extends GridDataModel {
+
+ private static Log log = LogFactory.getLog(DataModelCache.class);
+
+ private static class DataRange {
+ private int startRow;
+ private int endRow;
+ private SortOrder sortOrder;
+ private List loadedData;
+
+ public DataRange(int startRow, int endRow, SortOrder sortOrder,
+ List loadedData) {
+ super();
+ this.startRow = startRow;
+ this.endRow = endRow;
+ this.sortOrder = sortOrder;
+ this.loadedData = loadedData;
+ }
+
+ public boolean match(int s, int e, SortOrder sortOrder) {
+ return s == startRow
+ && e == endRow
+ && sortOrdersMatch(sortOrder, this.sortOrder);
+ }
+
+ private boolean sortOrdersMatch(SortOrder sortOrder1, SortOrder sortOrder2) {
+ boolean result = sortOrder1 == sortOrder2;
+
+ if (sortOrder1 != null && sortOrder2 != null) {
+ result = sortOrder1.equals(sortOrder2);
+ }
+
+ return result;
+ }
+
+ }
+
+ private Map secondaryMapping = new HashMap();
+
+ private DataRange dataRange;
+
+ private GridDataModel gridDataModel;
+
+ private int rowCount = Integer.MIN_VALUE;
+
+ public DataModelCache(GridDataModel gridDataModel) {
+ super();
+ this.gridDataModel = gridDataModel;
+
+ if (log.isTraceEnabled()) {
+ log.trace("initializing with " + gridDataModel);
+ }
+ }
+
+ public void addDataModelListener(DataModelListener listener) {
+ gridDataModel.addDataModelListener(listener);
+ }
+
+ public DataModelListener[] getDataModelListeners() {
+ return gridDataModel.getDataModelListeners();
+ }
+
+ public Object getObjectById(Object id) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Trying to get object by id" + id);
+ }
+ //First try to find data in inner cache
+ //If not found - get it from original model
+ Object cached = secondaryMapping.get(id);
+
+ if (cached == null) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Cache miss " + id + " falling back to original model");
+ }
+
+ cached = gridDataModel.getObjectById(id);
+ secondaryMapping.put(id, cached);
+
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("At last found element " + cached);
+ }
+
+ return cached;
+ }
+
+ public int getRowCount() {
+ if (rowCount == Integer.MIN_VALUE) {
+ rowCount = gridDataModel.getRowCount();
+ }
+ return rowCount;
+ }
+
+ public Object getRowData() {
+ Object secondaryMapped = secondaryMapping.get(getRowKey());
+
+ if (secondaryMapped == null) {
+ secondaryMapped = super.getRowData();
+ }
+ return secondaryMapped;
+ }
+
+ public int getRowIndex() {
+ return gridDataModel.getRowIndex();
+ }
+
+ public Object getRowKey() {
+ return gridDataModel.getRowKey();
+ }
+
+ public SerializableDataModel getSerializableModel(Range range) {
+ return gridDataModel.getSerializableModel(range);
+ }
+
+ public Object getWrappedData() {
+ return gridDataModel.getWrappedData();
+ }
+
+ public boolean isRowAvailable() {
+ return secondaryMapping.containsKey(getRowKey()) || super.isRowAvailable();
+ }
+
+ public List loadData(int startRow, int endRow, SortOrder sortOrder) {
+ if (dataRange == null || !dataRange.match(startRow, endRow, sortOrder)) {
+ List data = gridDataModel.loadData(startRow, endRow, sortOrder);
+ dataRange = new DataRange(startRow, endRow, sortOrder, data);
+ }
+ return dataRange.loadedData;
+ }
+
+ public void removeDataModelListener(DataModelListener listener) {
+ gridDataModel.removeDataModelListener(listener);
+ }
+
+ public void setRowIndex(int arg0) {
+ gridDataModel.setRowIndex(arg0);
+ }
+
+ public void setRowKey(Object key) {
+ gridDataModel.setRowKey(key);
+ super.setRowKey(key);
+ }
+
+ public void setWrappedData(Object arg0) {
+ gridDataModel.setWrappedData(arg0);
+ }
+
+ public Object getId(Object o) {
+ return gridDataModel.getId(o);
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+ // TODO Auto-generated method stub
+ super.walk(context, visitor, range, argument);
+ }
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/GridDataModel.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,208 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.ajax.repeat.DataVisitor;
+import org.ajax4jsf.ajax.repeat.ExtendedDataModel;
+import org.ajax4jsf.ajax.repeat.Range;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Base class for data models
+ * Subclasses must implement {@link #loadData(int, int, SortOrder)}
+ * For certain features (like selection and sorting) to work correctly together,
+ * {@link #getId(Object)} and {@link #getObjectById(Object)}
+ * methods need to be overriden
+ *
+ * @author Maksim Kaszynski
+ *
+ */
+public abstract class GridDataModel extends ExtendedDataModel {
+
+ /**
+ * Simple implementation - index-based row key
+ * @author Maksim Kaszynski
+ *
+ */
+ private static class SimpleRowKey implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+ private int i;
+
+ public SimpleRowKey(int i) {
+ super();
+ this.i = i;
+ }
+
+ public int intValue() {
+ return i;
+ }
+
+ public String toString() {
+ return String.valueOf(i);
+ }
+ }
+
+
+ private static final Log log = LogFactory.getLog(GridDataModel.class);
+
+ private Object rowKey;
+
+ private Map mapping;
+
+ private SortOrder lastSortOrder;
+
+ /**
+ * Load range of data items from the source.
+ * Starting from startRow, and up to but excluding endRow
+ * @param startRow
+ * @param endRow
+ * @param sortOrder
+ * @return list of ordered data
+ */
+ public abstract List loadData(int startRow, int endRow, SortOrder sortOrder);
+
+
+ /**
+ * Load data range, and iterate over it
+ */
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ if (log.isTraceEnabled()) {
+ log.trace("Starting walk");
+ }
+
+ ScrollableGridRange sequenceRange = (ScrollableGridRange) range;
+
+ int startIndex = sequenceRange.getFirst();
+ int last = sequenceRange.getLast();
+
+ lastSortOrder = sequenceRange.getSortOrder();
+
+ List objects = loadData(startIndex, last, lastSortOrder);
+
+ mapping = new HashMap();
+
+ for (int i = 0; i < objects.size(); i++,startIndex++) {
+ Object data = objects.get(i);
+ Object key = getId(data);
+
+ if (key == null) {
+ key = new SimpleRowKey(startIndex);
+ }
+
+ mapping.put(key, data);
+
+ visitor.process(context, key, argument);
+
+ }
+
+ if (log.isTraceEnabled()) {
+ log.trace("Ending walk");
+ }
+
+ }
+
+
+ /**
+ * This method is the reverse of {@link #getId(Object)}
+ * If you override this method, you need to override {@link #getId(Object)} as well
+ * @param id
+ * @return
+ */
+ public Object getObjectById(Object id) {
+
+ if (id instanceof SimpleRowKey) {
+ int i = ((SimpleRowKey) id).intValue();
+
+ List l = loadData(i, i + 1, lastSortOrder);
+
+ return l.get(0);
+
+ }
+
+ return null;
+ }
+
+ /**
+ * To get rid of Entity interface, method is introduced
+ * Implementations may override it to provide domain-specific searches
+ * Id should be serializable
+ * Default implementation returns <code>null</code> anyway
+ * If you override this method, you need to override {@link #getObjectById(Object)} as well
+ * @param o
+ * @return
+ */
+ public Object getId(Object o) {
+ return null;
+ }
+
+
+ public Object getRowData() {
+
+ if (mapping != null && mapping.containsKey(rowKey)) {
+ return mapping.get(rowKey);
+ } else {
+ return loadAndMap(rowKey);
+ }
+
+ }
+
+ /**
+ * Row indexes navigation is no longer supported
+ */
+ public int getRowIndex() {
+ throw new UnsupportedOperationException("getRowIndex");
+ }
+
+ /**
+ * Quite simple implementation - data will be cached, so the call will be cheap
+ */
+ public boolean isRowAvailable() {
+ return getRowData() != null;
+ }
+
+ /**
+ * Row indexes navigation is no longer supported
+ */
+ public void setRowIndex(int arg0) {
+ throw new UnsupportedOperationException("setRowIndex");
+ }
+
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ public void setRowKey(Object key) {
+ rowKey = key;
+ }
+
+ private Object loadAndMap(Object id) {
+
+ if (log.isTraceEnabled()) {
+ log.trace("loadAndMap " + id);
+ }
+
+ Object o = getObjectById(id);
+ if (o != null) {
+ if (mapping == null) {
+ mapping = new HashMap();
+ }
+ mapping.put(id, o);
+ }
+ return o;
+ }
+
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/ScrollableGridRange.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,93 @@
+/*
+ * Copyright
+ * Copyright (c) Exadel,Inc. 2006
+ * All rights reserved.
+ *
+ * History
+ * $Source: /cvs-master/intralinks-jsf-comps/components/data-view-grid/src/component/com/exadel/jsf/model/ScrollableGridRange.java,v $
+ * $Revision: 1.7 $
+ */
+
+package org.richfaces.model;
+
+import java.io.Serializable;
+
+import org.ajax4jsf.ajax.repeat.Range;
+
+
+
+/**
+ * @author Maksim Kaszynski
+ * @modified by Anton Belevich
+ */
+public class ScrollableGridRange implements Range, Serializable{
+
+ private static final long serialVersionUID = -6675002421400464892L;
+
+ private int first = 0;
+ private int last = 0;
+ private SortOrder sortOrder;
+
+ public ScrollableGridRange(int first, int last, SortOrder sortOrder) {
+ super();
+ this.first = first;
+ this.last = last;
+ this.sortOrder = sortOrder;
+ }
+
+ /**
+ * @return the bufferSize
+ */
+ public int getLast() {
+ return last;
+ }
+ /**
+ * @param bufferSize the bufferSize to set
+ */
+ public void setLast(int lastRow) {
+ this.last = lastRow;
+ }
+ /**
+ * @return the first
+ */
+ public int getFirst() {
+ return first;
+ }
+ /**
+ * @param first the first to set
+ */
+ public void setFirst(int first) {
+ this.first = first;
+ }
+
+ public SortOrder getSortOrder() {
+ return sortOrder;
+ }
+
+ public void setSortOrder(SortOrder sortOrder) {
+ this.sortOrder = sortOrder;
+ }
+
+ public boolean equals(Object obj) {
+
+ if(!(obj instanceof ScrollableGridRange)){
+ return super.equals(obj);
+ }
+
+ ScrollableGridRange ref = (ScrollableGridRange)obj;
+
+ boolean ret = (this.first == ref.first)&&(this.last == ref.last );
+
+ if(this.sortOrder != null){
+ ret = ret && this.sortOrder.equals(ref.sortOrder);
+ } else {
+ ret = (ret && (ref.sortOrder == null));
+ }
+
+ return ret;
+ }
+
+ public int hashCode() {
+ return super.hashCode();
+ }
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortField.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortField.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/SortField.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.Serializable;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SortField implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String name = null;
+ private int index = -1;
+ private Boolean ascending = null;
+
+
+
+ public SortField(String name, int index, Boolean ascending) {
+ super();
+ this.name = name;
+ this.index = index;
+ this.ascending = ascending;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public Boolean getAscending() {
+ return ascending;
+ }
+
+ public void setAscending(Boolean ascending) {
+ this.ascending = ascending;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((ascending == null) ? 0 : ascending.hashCode());
+ result = prime * result + index;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final SortField other = (SortField) obj;
+ if (ascending == null) {
+ if (other.ascending != null)
+ return false;
+ } else if (!ascending.equals(other.ascending))
+ return false;
+ if (index != other.index)
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/ClientSelection.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,129 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class ClientSelection implements Serializable{
+
+ private static final long serialVersionUID = 5855157282287053681L;
+
+ public static final String FLAG_RESET = "x";
+
+ public static final String FLAG_ALL = "a";
+
+ private String selectionFlag;
+
+ private List ranges = new ArrayList();
+
+ public ClientSelection() {
+ }
+
+
+ public void addRange(SelectionRange range) {
+ ranges.add(range);
+ }
+
+ public boolean isSelected(int i) {
+ boolean result = false;
+ Iterator iterator = ranges.iterator();
+ while (iterator.hasNext() && !result) {
+ result |= ((SelectionRange) iterator.next()).within(i);
+ }
+ return result;
+ }
+
+ public List getRanges() {
+ return ranges;
+ }
+
+ public void addIndex(int j) {
+ if(this.isSelected(j)) return;
+
+
+
+ SelectionRange firstRange = null;
+
+ int s = ranges.size();
+
+ int insertPosition = 0;
+
+ for(int i = 0; i < s && insertPosition >= 0 ; i++) {
+
+ firstRange = (SelectionRange) ranges.get(i);
+
+ if (firstRange.getStartIndex() == j + 1) {
+
+ firstRange.setStartIndex(j);
+ insertPosition = -1;
+
+ } else if (firstRange.getEndIndex() == j - 1) {
+
+ firstRange.setEndIndex(j);
+
+ if (i + 1 < s) {
+ SelectionRange range2 = (SelectionRange) ranges.get(i + 1);
+
+ if (range2.getStartIndex() == j || range2.getStartIndex() == j + 1) {
+
+ ranges.remove(i + 1);
+
+ firstRange.setEndIndex(range2.getEndIndex());
+ }
+ }
+
+ insertPosition = -1;
+
+ } else if (firstRange.getStartIndex() > j) {
+ insertPosition = i;
+ }
+
+ }
+
+ if (insertPosition >= 0) {
+ firstRange = new SelectionRange(j,j);
+ ranges.add(insertPosition, firstRange);
+
+ return;
+ }
+
+
+ }
+
+ private boolean reset = false;
+ public boolean isReset() {
+ return reset;
+ }
+
+ private boolean selectAll = false;
+ public boolean isSelectAll() {
+ return selectAll;
+ }
+
+
+ public String getSelectionFlag() {
+ return selectionFlag;
+ }
+
+
+ public void setSelectionFlag(String selectionFlag) {
+ this.selectionFlag = selectionFlag;
+
+ reset = false;
+ selectAll = false;
+
+ if (FLAG_ALL.equals(selectionFlag)) {
+ selectAll = true;
+ } else if (FLAG_RESET.equals(selectionFlag)) {
+ reset = true;
+ }
+ }
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/Selection.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public interface Selection extends Serializable {
+
+ public Iterator getKeys();
+
+ public int size();
+
+ public boolean isSelected(Object rowKey);
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SelectionRange.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,64 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SelectionRange {
+ private int startIndex = -1;;
+ private int endIndex = -1;
+
+ public SelectionRange(int startIndex, int endIndex) {
+ super();
+ this.startIndex = startIndex;
+ this.endIndex = endIndex;
+ }
+
+ public int getStartIndex() {
+ return startIndex;
+ }
+
+ public void setStartIndex(int startIndex) {
+ this.startIndex = startIndex;
+ }
+
+ public int getEndIndex() {
+ return endIndex;
+ }
+
+ public void setEndIndex(int endIndex) {
+ this.endIndex = endIndex;
+ }
+
+ public boolean within(int index) {
+ return startIndex <= index && endIndex >= index;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + endIndex;
+ result = prime * result + startIndex;
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final SelectionRange other = (SelectionRange) obj;
+ if (endIndex != other.endIndex)
+ return false;
+ if (startIndex != other.startIndex)
+ return false;
+ return true;
+ }
+
+
+}
Added: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java (rev 0)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+package org.richfaces.model.selection;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * @author Maksim Kaszynski
+ *
+ */
+public class SimpleSelection implements Selection {
+
+ private static final long serialVersionUID = 1L;
+
+ private Set keys = new HashSet();
+
+ public boolean addKey(Object rowKey) {
+ return keys.add(rowKey);
+ }
+
+ public boolean removeKey(Object rowKey) {
+ return keys.remove(rowKey);
+ }
+
+ public Iterator getKeys() {
+ return keys.iterator();
+ }
+
+ public int size() {
+ return keys.size();
+ }
+
+ public boolean isSelected(Object rowKey) {
+ return keys.contains(rowKey);
+ }
+
+ public void clear() {
+ keys.clear();
+ }
+}
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/AjaxFunctionBuilder.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -5,7 +5,7 @@
import javax.faces.context.FacesContext;
-import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.framework.renderer.RendererBase;
import org.ajax4jsf.framework.util.javascript.JSFunction;
import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
import org.ajax4jsf.framework.util.javascript.JSReference;
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ColumnWalker.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ColumnWalker.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ColumnWalker.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -32,20 +32,38 @@
return 0;
}
- if(component instanceof UIScrollableGrid){
- for (Iterator iter = component.getChildren().iterator(); iter.hasNext(); ) {
- UIComponent kid = (UIComponent) iter.next();
- if (kid.isRendered()) {
- if (kid instanceof UIScrollableGridColumn){
- UIScrollableGridColumn column = (UIScrollableGridColumn)kid;
- columnsCount += visitor.visit(context, column, writer, state);
- state.nextCell();
+ if (visitor instanceof ContextualColumnVisitor) {
+ ContextualColumnVisitor contextualColumnVisitor =
+ (ContextualColumnVisitor) visitor;
+
+ contextualColumnVisitor.setUp(context, state);
+ }
+ try {
+
+ if(component instanceof UIScrollableGrid){
+ for (Iterator iter = component.getChildren().iterator(); iter.hasNext(); ) {
+ UIComponent kid = (UIComponent) iter.next();
+ if (kid.isRendered()) {
+ if (kid instanceof UIScrollableGridColumn){
+ UIScrollableGridColumn column = (UIScrollableGridColumn)kid;
+ columnsCount += visitor.visit(context, column, writer, state);
+ state.nextCell();
+ }
}
}
+ state.setCellIndex(0);
}
- state.setCellIndex(0);
+
+ } finally {
+ if (visitor instanceof ContextualColumnVisitor) {
+ ContextualColumnVisitor contextualColumnVisitor =
+ (ContextualColumnVisitor) visitor;
+
+ contextualColumnVisitor.tearDown(context, state);
+ }
}
+
return columnsCount;
}
}
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/ScrollableGridBaseRenderer.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -6,6 +6,7 @@
import java.util.Map;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -26,6 +27,8 @@
import org.richfaces.component.UIScrollableGridColumn;
import org.richfaces.event.scroll.ScrollEvent;
import org.richfaces.event.sort.SortEvent;
+import org.richfaces.model.SortField;
+import org.richfaces.model.SortOrder;
import org.richfaces.renderkit.CompositeRenderer;
import org.richfaces.renderkit.RendererContributor;
import org.richfaces.renderkit.ScriptOptions;
@@ -51,12 +54,16 @@
private final String COLUMN_NORMAL_TYPE = "normal";
+ private static final String ASC_ICON_CREATED = "ASC_ICON_CREATED";
+ private static final String DESC_ICON_CREATED = "DESC_ICON_CREATED";
private RendererBase cellTemplate = null;
private RendererBase headerCellTemplate = null;
private RendererBase footerCellTemplate = null;
+
+ private RendererBase headerItselfTemplate = null;
private final Log log = LogFactory.getLog(ScrollableGridBaseRenderer.class);
@@ -104,7 +111,8 @@
state.addId(column.getId());
headerCellTemplate = getHeaderCellTemplate();
- ComponentVariables variables = ComponentsVariableResolver.getVariables(headerCellTemplate, column);
+ ComponentVariables variables =
+ ComponentsVariableResolver.getVariables(headerCellTemplate, column);
String widthPx = (String)column.getAttributes().get("width");
int width = Integer.parseInt(widthPx.substring(0, widthPx.indexOf("px")));
@@ -123,14 +131,76 @@
variables.setVariable("sepOffset", new Integer(sepOffset));
headerCellTemplate.encodeBegin(context, column);
- UIComponent component = column.getFacet(HEADER_PART);
- if(component != null){
- renderChild(context, component);
- }
+ headerRenderer.visit(context, column, writer, state);
headerCellTemplate.encodeEnd(context, column);
}
};
+ private final ColumnVisitor headerRenderer = new ColumnVisitor() {
+
+ public int visit(FacesContext context, UIScrollableGridColumn column,
+ ResponseWriter writer, GridRendererState state)
+ throws IOException {
+
+ ComponentVariables variables =
+ ComponentsVariableResolver.getVariables(getHeaderItselfTemplate(), column);
+
+ int cell_index = state.getCellIndex();
+ String client_id = state.getClientId();
+ Boolean sorting = getColumnSorting(state.getGrid(), cell_index);
+
+ if (sorting != null) {
+ if (sorting.booleanValue()) {
+ variables.setVariable("sortAscending", Boolean.TRUE);
+ } else {
+ variables.setVariable("sortDescending", Boolean.TRUE);
+ }
+ }
+ variables.setVariable("client_id", client_id);
+ variables.setVariable("cell_index", new Integer(cell_index));
+
+ getHeaderItselfTemplate().encodeBegin(context, column);
+
+ UIComponent header = column.getFacet(HEADER_PART);
+
+ if(header != null){
+ renderChild(context, header);
+ }
+ getHeaderItselfTemplate().encodeEnd(context, column);
+
+ return 0;
+ }
+
+
+ private Boolean getColumnSorting(UIScrollableGrid grid, int columnIndex) {
+
+ Boolean sorting = null;
+
+ UIScrollableGridColumn column =
+ (UIScrollableGridColumn) grid.getChildren().get(columnIndex);
+ String name = column.getName();
+ SortOrder sortOrder = grid.getSortOrder();
+
+ if (sortOrder != null) {
+ SortField[] sortFields = sortOrder.getFields();
+
+ if (sortFields != null) {
+ for (int i = 0; i < sortFields.length && sorting == null; i++) {
+ SortField sortField = sortFields[i];
+
+ if ((name != null && name.equals(sortField.getName()))
+ || columnIndex == sortField.getIndex()) {
+ sorting = sortField.getAscending();
+ }
+ }
+ }
+ }
+
+ return sorting;
+ }
+
+ };
+
private final ColumnVisitor footerCellRenderer = new ExtendedColumnVisitor(){
public void renderContent(FacesContext context, UIScrollableGridColumn column, ResponseWriter writer, GridRendererState state) throws IOException {
@@ -447,6 +517,7 @@
state.setFrozenPart(isFrozen);
state.setClientId(grid.getClientId(context));
state.setSepOffset(new Integer(0));
+
ColumnWalker.iterateOverColumns(context, grid, headerCellRenderer, writer, state);
}
@@ -493,12 +564,36 @@
public void setUpState(FacesContext context, UIScrollableGrid grid) {
GridRendererState.createState(context, grid);
+ Map attrs = grid.getAttributes();
+
+ if (grid.getAscIcon() == null) {
+ attrs.put(ASC_ICON_CREATED, Boolean.TRUE);
+ }
+
+ if (grid.getDescIcon() == null) {
+ attrs.put(DESC_ICON_CREATED, Boolean.TRUE);
+ }
+
}
- public void tearDownState(FacesContext context){
+ public void tearDownState(FacesContext context, UIScrollableGrid grid){
+
+ Map attrs = grid.getAttributes();
+ if (attrs.containsKey(ASC_ICON_CREATED)) {
+ grid.setAscIcon(null);
+ attrs.remove(ASC_ICON_CREATED);
+ }
+
+ if (attrs.containsKey(DESC_ICON_CREATED)) {
+ grid.setDescIcon(null);
+ attrs.remove(DESC_ICON_CREATED);
+ }
+
+
GridRendererState.restoreState(context);
}
+
public String getRowsAjaxUpdate(FacesContext context, UIScrollableGrid grid){
JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context);
@@ -760,6 +855,18 @@
return footerCellTemplate;
}
+
+
+ private RendererBase getHeaderItselfTemplate() {
+
+ if (headerItselfTemplate == null) {
+ headerItselfTemplate = TemplateLoader.loadTemplate("org.richfaces.renderkit.html.ScrollableGridHeaderItselfRenderer");
+ }
+
+ return headerItselfTemplate;
+ }
+
+
public void renderHiddenScrollInput(FacesContext context, UIScrollableGrid grid) throws IOException{
ResponseWriter writer = context.getResponseWriter();
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/renderkit/html/SelectionRendererContributor.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -16,7 +16,7 @@
import org.ajax4jsf.ajax.repeat.DataVisitor;
import org.ajax4jsf.framework.ajax.AjaxContext;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.framework.renderer.RendererUtils.HTML;
import org.richfaces.component.UIScrollableGrid;
import org.richfaces.model.selection.ClientSelection;
import org.richfaces.model.selection.Selection;
Modified: trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/utils/TemplateLoader.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/utils/TemplateLoader.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/java/org/richfaces/utils/TemplateLoader.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -3,7 +3,7 @@
*/
package org.richfaces.utils;
-import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.framework.renderer.RendererBase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-20 12:07:19 UTC (rev 1732)
@@ -45,7 +45,7 @@
if(target && src) {
Utils.DOM.Event.removeListeners(target);
- //if (ClientUILib.isIE) {
+ if (ClientUILib.isIE) {
var theDoc = document;
//var createEl = theDoc.createElement;
@@ -55,37 +55,13 @@
var tdSrc, tdNode, subNode;
var childs = src.childNodes;
var ccount = childs.length;
-<<<<<<< .working
var tcount = target.childNodes.length;
for(var k=0; k<tcount; k++) {
tdSrc = k<ccount ? childs[k] : null;
tdNode = theDoc.createElement( "TD" );
- //Utils.DOM.copyAttributes(tdNode, tdSrc);
- tdNode.className = "ClientUI_Grid_BC";
-=======
- var tcount = target.childNodes.length;
- for(var k=0; k<tcount; k++) {
- tdSrc = k<ccount ? childs[k] : null;
- tdNode = theDoc.createElement( "TD" );
tdNode.className = target.childNodes[k].className;
->>>>>>> .merge-right.r1635
-<<<<<<< .working
if(tdSrc) {
- if(tdSrc.innerHTML) {
- tdNode.innerHTML = tdSrc.innerHTML;
- }
- else {
- innerHTML = [];
- innerCount = tdSrc.childNodes.length;
- for(j=0; j<innerCount; j++) {
- subNode = tdSrc.childNodes[j];
- innerHTML.push(subNode.xml);
- }
- tdNode.innerHTML = innerHTML.join("");
- }
-=======
- if(tdSrc) {
innerHTML = [];
innerCount = tdSrc.childNodes.length;
for(j=0; j<innerCount; j++) {
@@ -93,7 +69,6 @@
innerHTML.push(subNode.xml);
}
tdNode.innerHTML = innerHTML.join("");
->>>>>>> .merge-right.r1635
}
row.insertBefore(tdNode, null);
}
@@ -101,7 +76,7 @@
target.parentNode.replaceChild(row, target);
return row;
- /*} else {
+ } else {
var theDoc = document;
Utils.DOM._clearAttributes(target);
@@ -132,7 +107,7 @@
target.innerHTML = innerHTML.join("");
return target;
- }*/
+ }
}
else {
if(!target)
Modified: trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2007-07-20 12:07:19 UTC (rev 1732)
@@ -169,8 +169,8 @@
sep.setStyle({cursor: 'auto'});
}
// sort icons
- columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
- columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
+ //columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
+ //columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
j++;
}
@@ -216,8 +216,8 @@
sep.setStyle({cursor: 'auto'});
}
// sort icons
- columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
- columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
+ //columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
+ //columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
}
j++;
}
@@ -242,8 +242,8 @@
var details = new Array(3);
var clientId = this.grid.getElement().id;
details[0] = document.getElementById(clientId + ":hsep_" + column);
- details[1] = document.getElementById(clientId + ":hsortd_" + column);
- details[2] = document.getElementById(clientId + ":hsorta_" + column);
+ //details[1] = document.getElementById(clientId + ":hsortd_" + column);
+ //details[2] = document.getElementById(clientId + ":hsorta_" + column);
return details;
},
agjustSeparators: function() {
@@ -399,6 +399,7 @@
if(el) {
var index = parseInt(el.getAttribute("columnIndex"));
if(index>=0) {
+ /*
var dir = this.getColumns()[index].sorted;
dir = (dir == "asc") ? "desc" : "asc";
this.getColumns()[index].sorted = dir;
@@ -417,10 +418,10 @@
}
}
}
-
+ */
this.grid.eventOnSort.fire({
column: index,
- order: dir,
+ /*order: dir,*/
startRow: this.grid.getBody()._getRowIndex(this.grid.getBody().templFrozen.getElement().rows[0].id),
index: this.grid.getBody().currRange.start
});
Modified: trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/ScrollableGrid.js 2007-07-20 12:07:19 UTC (rev 1732)
@@ -24,6 +24,7 @@
this.options = options;
this.client_id = this.options.client_id;
this.rows_count = $(this.client_id + "_rows_input").value;
+ this.scroll_si = $(this.client_id + ":si");
this.columns_count = this.options.columnsCount;
this.splash_id = this.options.splash_id;
this.dataModel = new ClientUI.controls.grid.FakeArrayDataModel(this.rows_count, this.columns_count, this.client_id);
@@ -33,7 +34,16 @@
{pane: GridLayout_Enum.BODY, ref: this.client_id +"_" + "GridBodyTemplate"},
{pane: GridLayout_Enum.FOOTER, ref: this.client_id +"_" + "GridFooterTemplate"}
];
- this.init2 = this.init.bindAsEventListener(this);
+ var grid = this;
+
+ Event.onReady(function(){
+ grid.init();
+ });
+ Utils.execOnLoad(
+ function(){
+ grid.init();
+ },
+ Utils.Condition.ElementPresent(grid.client_id), 100);
this.endInitTime = (new Date()).getTime();
this.rowCallbacks = [];
@@ -45,32 +55,50 @@
// mark that grid control initialized
if(!this.isInitialized) {
this.isInitialized = true;
-
this.startCreateTime = (new Date()).getTime();
ClientUI.controls.grid.ScrollableGrid.parentClass.constructor().call(this, this.client_id, this.dataModel, this.templates);
-
+
this.endCreateTime = (new Date()).getTime();
-
+
// suspend some processing
setTimeout(function() {
this.startPostProcessTime = (new Date()).getTime();
this.eventOnPostSort = new ClientUI.common.utils.CustomEvent('OnSort');
this.eventOnPostScroll = new ClientUI.common.utils.CustomEvent('OnScroll');
-
- var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
- this.setProgressCtrl(progress);
+
+ //var progress = new ClientUI.common.box.SplashBox(this.splash_id, null, 300, true);
+ //this.setProgressCtrl(progress);
Event.observe(this.eventOnSort, "on sort", this.onSorted.bindAsEventListener(this));
if (this.options.selectionInput) {
this.selectionManager = new ClientUI.controls.grid.SelectionManager(this);
}
this.endPostProcessTime = (new Date()).getTime();
- }.bind(this), 500);
+ }.bind(this), 500);
+
+ if(this.scroll_si.value !=''){
+ var options = this.scroll_si.value.split(',');
+ this.restoreScrollState(options[0],options[1],options[2]);
+ }
+
+ var form = this.getForm($(this.client_id));
+ Event.observe(form, "submit",this.restoreScrollPos.bindAsEventListener(this));
}
},
+ getForm: function(element){
+ var node = element;
+ if(node){
+ while(node.tagName.toUpperCase() != 'FORM'){
+ node = node.parentNode;
+ }
+ }
+
+ return node;
+ },
+
onSortComplete : function(request, event, data){
var options = request.getJSON("options");
Utils.AJAX.updateRows(options,request,
@@ -126,7 +154,7 @@
if(index < flength + nlength - 1) {
var frozen = true;
if(index >= flength) {
- index -= fcount;
+ index -= flength;
frozen = false;
}
this.hideColumn(index, frozen);
@@ -140,16 +168,31 @@
this.updateLayout();
},
- restoreScrollState: function(state, start, end) {
- this.getBody().scrollBox.getElement().scrollTop = state.pos;
- this.getBody().currentPos = state.pos;
- this.getBody().setScrollPos(state.pos);
- this.getBody().currRange.start == start;
- this.getBody().currRange.end = end;
+ restoreScrollState: function(scrollPos, start, end) {
+
+ var body = this.getBody();
+ body.scrollBox.getElement().scrollTop = scrollPos;
+ body.currentPos = scrollPos;
+ body.currRange.start = start;
+ body.currRange.end = end;
+ body._onContentVScroll(scrollPos);
+ var visibleRowPos = body.currRange.start * body.defaultRowHeight;
+ //setTimeout(function(){
+ body.templFrozen.moveToY(visibleRowPos);
+ body.templNormal.moveToY(visibleRowPos);
+ //}, 500);
},
getScrollPos: function() {
return this.getBody().currentPos;
+ },
+
+ restoreScrollPos: function(){
+ var body = this.getBody();
+ var start = body.currRange.start;
+ var end = body.currRange.end;
+ var index = this.getScrollPos();
+ this.scroll_si.value = index + "," + start + "," + end;
}
});
Modified: trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-20 12:07:19 UTC (rev 1732)
@@ -86,23 +86,13 @@
border-right: 1px solid #ebeadb;
}
-.ClientUI_Grid_HC .sort-asc {
-/* background-image: url(sort_asc.gif);*/
+.ClientUI_Grid_HC .sort-asc, .ClientUI_Grid_HC .sort-desc {
background-position: right;
background-repeat: no-repeat;
- display: none;
width: 16px !important;;
position: absolute;
}
-.ClientUI_Grid_HC .sort-desc {
-/* background-image: url(sort_desc.gif);*/
- background-position: right;
- background-repeat: no-repeat;
- display: none;
- width: 16px !important;;
- position: absolute;
-}
/**
* Header cells separator
Modified: trunk/sandbox/ui/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/main/templates/org/richfaces/scrollable-grid-header-cell.jspx 2007-07-20 12:07:19 UTC (rev 1732)
@@ -13,12 +13,9 @@
>
<td class="ClientUI_Grid_HC Idg-header-cell #{component.attributes['headerClass']}" id="#{client_id}:hc_#{cell_index}" columnIndex="#{cell_index}" sortable="#{component.attributes['sortable']}">
- <div id="#{clientId}:hcb_#{cell_index}"
- class="ClientUI_Grid_HCBody">
- <vcp:body/>
- <div align="right" id="#{client_id}:hsortd_#{cell_index}" class="sort-desc" />
- <div align="right" id="#{client_id}:hsorta_#{cell_index}" class="sort-asc" />
- </div>
+
+ <vcp:body/>
+
<jsp:scriptlet>
int offset = ((Integer)variables.getVariable("sepOffset")).intValue() - 3;
Modified: trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/component/html/HtmlScrollableGridComponentTest.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/component/html/HtmlScrollableGridComponentTest.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/component/html/HtmlScrollableGridComponentTest.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -7,6 +7,7 @@
import java.lang.String ;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase ;
+import org.richfaces.model.SortField;
import org.richfaces.model.SortOrder ;
import java.lang.Object ;
import org.richfaces.model.selection.Selection ;
@@ -183,8 +184,7 @@
assertEquals("oncomplete_oncomplete", component.getOncomplete());
component.setValueBinding("sortOrder", new MockValueBinding("sortOrder", org.richfaces.model.SortOrder.class));
SortOrder sortOrder = new SortOrder();
- sortOrder.setSortColumn(2);
- sortOrder.setAscending(true);
+ sortOrder.setFields(new SortField[] {new SortField(null, 2, Boolean.TRUE)});
component.setSortOrder(sortOrder);
assertEquals(sortOrder, component.getSortOrder());
component.setValueBinding("footerClass", new MockValueBinding("footerClass", java.lang.String.class));
Modified: trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java 2007-07-20 06:27:17 UTC (rev 1731)
+++ trunk/sandbox/ui/scrollable-grid/src/test/java/org/richfaces/renderkit/html/ScrollableGridRendererTest.java 2007-07-20 12:07:19 UTC (rev 1732)
@@ -29,9 +29,9 @@
private static Set javaScripts = new HashSet();
static {
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
+ javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript");
javaScripts.add("org/richfaces/renderkit/html/scripts/scrollable-grid.js");
}
@@ -152,54 +152,83 @@
if(elem.getNodeName().equals("div")){
String elemClassAttr = elem.getAttributeValue("class");
- assertTrue(elemClassAttr.contains("ClientUI_InlineBox"));
- boolean templates = elem.getId().equals(grid.getId()+ "_GridBodyTemplate") || elem.getId().equals(grid.getId()+ "_GridFooterTemplate") || elem.getId().equals(grid.getId()+ "_GridHeaderTemplate");
- assertTrue(templates);
- Iterator divIter = elem.getChildElementsIterator();
- HtmlElement inDiv = (HtmlElement) divIter.next();
- assertNotNull(inDiv);
- assertEquals("div", inDiv.getNodeName());
+ res = false;
+ if(elemClassAttr.contains("ClientUI_InlineBox")){
+ res = true;
+ }else if(elemClassAttr.contains("ClientUI_Grid_HSplit")){
+ res = true;
+ }
+ assertTrue(res);
- Iterator spanIter = inDiv.getChildElementsIterator();
+ if(!elemClassAttr.contains("ClientUI_Grid_HSplit")){
+
+ boolean templates = elem.getId().equals(grid.getId()+ "_GridBodyTemplate") || elem.getId().equals(grid.getId()+ "_GridFooterTemplate") || elem.getId().equals(grid.getId()+ "_GridHeaderTemplate");
+ assertTrue(templates);
+
+ Iterator divIter = elem.getChildElementsIterator();
+ HtmlElement inDiv = (HtmlElement) divIter.next();
+ assertNotNull(inDiv);
+ boolean test = false;
+ if(inDiv.getNodeName().equals("div")){
+ test = true;
+ }else if(inDiv.getNodeName().equals("iframe")){
+ test = true;
+ }
+
+ assertTrue(test);
+
+ Iterator spanIter = inDiv.getChildElementsIterator();
- for (;spanIter.hasNext();) {
+ for (;spanIter.hasNext();) {
- HtmlElement span = (HtmlElement) spanIter.next();
- assertNotNull(span);
- assertEquals("span", span.getNodeName());
- elemClassAttr = span.getAttributeValue("class");
- assertNotNull(elemClassAttr);
+ HtmlElement element = (HtmlElement) spanIter.next();
+ assertNotNull(element);
+ res = false;
+ if(element.getNodeName().equals("span")){
+ res = true;
+
+ }else if(element.getNodeName().equals("div")){
+ String divId = element.getAttributeValue("id");
+ assertEquals(id + ":sb", divId);
+ res = true;
+ } else if (element.getNodeName().equals("br")) {
+ res = true;
+ }
+
+ if(!res) {
+ System.out
+ .println("ScrollableGridRendererTest.testRenderingFrozenNormalColumns()");
+ }
+
+ assertTrue(res);
+ elemClassAttr = element.getAttributeValue("class");
+ assertNotNull(elemClassAttr);
- if(span.getId().contains("FrozenBox")){
- assertTrue(elemClassAttr.contains("ClientUI_TmplBox ClientUI_FrozenBox"));
- }else if(span.getId().contains("NormalBox")){
- assertTrue(elemClassAttr.contains("ClientUI_TmplBox ClientUI_NormalBox"));
- }
+ if(element.getId().contains("FrozenBox")){
+ assertTrue(elemClassAttr.contains("ClientUI_TmplBox ClientUI_FrozenBox"));
+ }else if(element.getId().contains("NormalBox")){
+ assertTrue(elemClassAttr.contains("ClientUI_TmplBox ClientUI_NormalBox"));
+ }
- for (int i = 0; i < columns; i++) {
+ for (int i = 0; i < columns; i++) {
- HtmlElement hcell = page.getHtmlElementById(id + ":hc_" + i);
- assertNotNull(hcell);
- elemClassAttr = hcell.getAttributeValue("class");
- assertTrue(elemClassAttr.contains("ClientUI_Grid_HC Idg-header-cell"));
+ HtmlElement hcell = page.getHtmlElementById(id + ":hc_" + i);
+ assertNotNull(hcell);
+ elemClassAttr = hcell.getAttributeValue("class");
+ assertTrue(elemClassAttr.contains("ClientUI_Grid_HC Idg-header-cell"));
- for (int j = 0; j < grid.getRows(); j++) {
- HtmlElement bcell = page.getHtmlElementById(id + ":c_" + j + "_" + i);
- assertNotNull(bcell);
- elemClassAttr = bcell.getAttributeValue("class");
- assertTrue(elemClassAttr.contains("ClientUI_Grid_BC Idg-column-cell"));
+ for (int j = 0; j < grid.getRows(); j++) {
+ HtmlElement bcell = page.getHtmlElementById(id + ":c_" + j + "_" + i);
+ assertNotNull(bcell);
+ elemClassAttr = bcell.getAttributeValue("class");
+ assertTrue(elemClassAttr.contains("ClientUI_Grid_BC Idg-column-cell"));
+ }
}
-
}
-
}
-
}
-
}
-
}
-
}
17 years, 5 months
JBoss Rich Faces SVN: r1731 - in trunk/sandbox: ui and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-20 02:27:17 -0400 (Fri, 20 Jul 2007)
New Revision: 1731
Modified:
trunk/sandbox/samples/pom.xml
trunk/sandbox/ui/pom.xml
Log:
pom's updated as tooltip moved to main
Modified: trunk/sandbox/samples/pom.xml
===================================================================
--- trunk/sandbox/samples/pom.xml 2007-07-20 02:15:10 UTC (rev 1730)
+++ trunk/sandbox/samples/pom.xml 2007-07-20 06:27:17 UTC (rev 1731)
@@ -19,7 +19,6 @@
<module>simpleTogglePanel2-sample</module>
<module>panelmenu-sample</module>
- <module>tooltip-sample</module>
<module>rich-message-demo </module>
</modules>
</project>
\ No newline at end of file
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2007-07-20 02:15:10 UTC (rev 1730)
+++ trunk/sandbox/ui/pom.xml 2007-07-20 06:27:17 UTC (rev 1731)
@@ -15,7 +15,6 @@
<module>calendar</module>
<module>panelmenu</module>
<module>panel2</module>
- <module>tooltip</module>
<!--module>scrollable-grid</module-->
<module>simpleTogglePanel2</module>
<module>message</module>
17 years, 5 months
JBoss Rich Faces SVN: r1730 - trunk/samples/tooltip-sample/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: ishabalov
Date: 2007-07-19 22:15:10 -0400 (Thu, 19 Jul 2007)
New Revision: 1730
Modified:
trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp
Log:
updated sample
Modified: trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2007-07-20 01:38:48 UTC (rev 1729)
+++ trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2007-07-20 02:15:10 UTC (rev 1730)
@@ -14,9 +14,19 @@
<f:verbatim>
<br/><br/>
</f:verbatim>
+ <h:panelGrid columns="1">
+ <h:commandButton value="Tooltip with followMouse mode" id="btn3">
+ <tt:toolTip followMouse="false" direction="top-left" mode="ajax" value="#{bean.toolTipContent}" horizontalOffset="20" verticalOffset="20">
+ <f:facet name="defaultContent">
+ <h:outputText value="Some text will be here soon" />
+ </f:facet>
+ <h:outputText value="Final content" />
+ </tt:toolTip>
+ </h:commandButton>
<h:inputText value="Ajax mode Tooltip with default content" id="inp1" size="50">
<tt:toolTip id="tt" followMouse="false" direction="top-right" mode="ajax" value="#{bean.toolTipContent}" horizontalOffset="20" verticalOffset="20">
- <f:facet name="defaultContent"><f:verbatim>DEFAULT CONTENT</f:verbatim>
+ <f:facet name="defaultContent">
+ <h:outputText value="Some text will be here soon" />
</f:facet>
<h:outputText id="ot" value="#{bean.toolTipContent}"></h:outputText>
<h:commandLink value="Click here to close window..."></h:commandLink>
@@ -27,6 +37,7 @@
<tt:toolTip value="Tooltip text" followMouse="true"></tt:toolTip>
</h:commandButton>
+ </h:panelGrid>
<%--a4j:log popup="false" level="ALL"></a4j:log--%>
</h:form>
17 years, 5 months
JBoss Rich Faces SVN: r1729 - trunk/samples.
by richfaces-svn-commits@lists.jboss.org
Author: ishabalov
Date: 2007-07-19 21:38:48 -0400 (Thu, 19 Jul 2007)
New Revision: 1729
Modified:
trunk/samples/pom.xml
Log:
Settles tooltip on new place
Modified: trunk/samples/pom.xml
===================================================================
--- trunk/samples/pom.xml 2007-07-20 01:38:23 UTC (rev 1728)
+++ trunk/samples/pom.xml 2007-07-20 01:38:48 UTC (rev 1729)
@@ -443,5 +443,6 @@
<module>datascroller-sample</module>
<module>richfaces-demo</module>
<module>dropdownmenu-sample</module>
+ <module>tooltip-sample</module>
</modules>
</project>
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r1728 - in trunk/samples/tooltip-sample: src/main/webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ishabalov
Date: 2007-07-19 21:38:23 -0400 (Thu, 19 Jul 2007)
New Revision: 1728
Modified:
trunk/samples/tooltip-sample/pom.xml
trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp
Log:
Tooltip sample moved
Modified: trunk/samples/tooltip-sample/pom.xml
===================================================================
--- trunk/samples/tooltip-sample/pom.xml 2007-07-20 01:13:09 UTC (rev 1727)
+++ trunk/samples/tooltip-sample/pom.xml 2007-07-20 01:38:23 UTC (rev 1728)
@@ -1,7 +1,7 @@
<?xml version="1.0"?><project>
<parent>
<artifactId>samples</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
+ <groupId>org.richfaces</groupId>
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -11,7 +11,7 @@
<name>tooltip-sample Maven Webapp</name>
<dependencies>
<dependency>
- <groupId>org.richfaces.sandbox.ui</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>tooltip</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
Modified: trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2007-07-20 01:13:09 UTC (rev 1727)
+++ trunk/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2007-07-20 01:38:23 UTC (rev 1728)
@@ -1,7 +1,7 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib uri="http://richfaces.ajax4jsf.org/tooltip" prefix="tt"%>
-<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/tooltip" prefix="tt"%>
+<%@ taglib uri="http://richfaces.org/ajax" prefix="a4j"%>
<html>
<head>
<title></title>
17 years, 5 months
JBoss Rich Faces SVN: r1727 - in trunk/samples/richfaces-demo/src/main: webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-07-19 21:13:09 -0400 (Thu, 19 Jul 2007)
New Revision: 1727
Added:
trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/form.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/region.xhtml
Modified:
trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
Log:
updating the demo
Modified: trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties
===================================================================
--- trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2007-07-20 01:12:08 UTC (rev 1726)
+++ trunk/samples/richfaces-demo/src/main/resources/org/richfaces/demo/common/components.properties 2007-07-20 01:13:09 UTC (rev 1727)
@@ -32,17 +32,17 @@
menuGroup= richMenu, Menu Group, /images/ico_dropDownMenu.gif, /images/cn_DropDownMenu.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/dropDownMenu.jsf
menuItem= richMenu, Menu Item, /images/ico_dropDownMenu.gif, /images/cn_DropDownMenu.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/dropDownMenu.jsf
menuSeparator= richMenu, Menu Separator, /images/ico_dropDownMenu.gif, /images/cn_DropDownMenu.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/dropDownMenu.jsf
-actionparam= ajaxSupport, Action Parameter, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
+actionparam= ajaxSupport, Action Parameter, /images/ico_actionparam.gif, /images/cn_actionparam.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/actionparam.jsf
commandButton= ajaxSupport, Command Button, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
commandLink= ajaxSupport, Command Link, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
-form= ajaxSupport, Ajax Form, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
+form= ajaxSupport, Ajax Form, /images/ico_form.gif, /images/cn_form.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/form.jsf
support= ajaxSupport, Ajax Support, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
jsFunction= ajaxSupport, JavaScript Function, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
poll= ajaxSupport, Poll, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
push= ajaxSupport, Push, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
status= ajaxSupport, Status, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
ajaxListener= ajaxSupport, Ajax Listener, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
-region= ajaxSupport, Ajax Region, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
+region= ajaxSupport, Ajax Region, /images/ico_region.gif, /images/cn_region.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/region.jsf
loadBundle= ajaxResources, Bundle, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
loadScript= ajaxResources, Script, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
loadStyle= ajaxResources, Style, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
@@ -50,7 +50,6 @@
include= ajaxOutput, Include, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
mediaOutput= ajaxOutput, Media Output, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
outputPanel= ajaxOutput, Output Panel, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
-include= ajaxOutput, Include, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
repeat= richDataIterators, Repeat, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
htmlCommandLink= ajaxMisc, Html Command Link, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
log= ajaxMisc, Log, /images/ico_panel.gif, /images/cn_panel.gif, http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., http://labs.jboss.com/file-access/default/members/jbossrichfaces/freezone..., /richfaces/panel.jsf
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2007-07-20 01:12:08 UTC (rev 1726)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2007-07-20 01:13:09 UTC (rev 1727)
@@ -18,6 +18,31 @@
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>userBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.demo.ajaxsupport.UserBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ <managed-property>
+ <property-name>screenWidth</property-name>
+ <property-class>java.lang.Integer</property-class>
+ <null-value/>
+ </managed-property>
+ <managed-property>
+ <property-name>screenHeight</property-name>
+ <property-class>java.lang.Integer</property-class>
+ <null-value/>
+ </managed-property>
+ <managed-property>
+ <property-name>job</property-name>
+ <property-class>java.lang.String</property-class>
+ <null-value/>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>dfsBean</managed-bean-name>
<managed-bean-class>org.richfaces.demo.datafilterslider.DemoSliderBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam.xhtml 2007-07-20 01:13:09 UTC (rev 1727)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Action Parameter</ui:define>
+ <ui:define name="body">
+ <rich:tabPanel switchType="server" styleClass="top_tab" contentClass="content_tab" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+ <rich:tab label="Usage">
+ <ui:include src="/richfaces/actionparam/usage.xhtml"/>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
+</ui:composition>
+</html>
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/richfaces/actionparam.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/form.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/form.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/form.xhtml 2007-07-20 01:13:09 UTC (rev 1727)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Ajax Form</ui:define>
+ <ui:define name="body">
+ <rich:tabPanel switchType="server" styleClass="top_tab" contentClass="content_tab" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+ <rich:tab label="Usage">
+ <ui:include src="/richfaces/form/usage.xhtml"/>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
+</ui:composition>
+</html>
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/richfaces/form.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/samples/richfaces-demo/src/main/webapp/richfaces/region.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/region.xhtml (rev 0)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/region.xhtml 2007-07-20 01:13:09 UTC (rev 1727)
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+<ui:composition template="/templates/main.xhtml">
+ <ui:define name="title">RichFaces - Open Source Rich JSF Components - Ajax Region</ui:define>
+ <ui:define name="body">
+ <rich:tabPanel switchType="server" styleClass="top_tab" contentClass="content_tab" inactiveTabClass="inactive_tab" activeTabClass="active_tab">
+ <rich:tab label="Usage">
+ <ui:include src="/richfaces/region/usage.xhtml"/>
+ </rich:tab>
+ </rich:tabPanel>
+ </ui:define>
+</ui:composition>
+</html>
Property changes on: trunk/samples/richfaces-demo/src/main/webapp/richfaces/region.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years, 5 months
JBoss Rich Faces SVN: r1726 - in trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo: ajaxsupport and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-07-19 21:12:08 -0400 (Thu, 19 Jul 2007)
New Revision: 1726
Added:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java
Log:
Added: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java (rev 0)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java 2007-07-20 01:12:08 UTC (rev 1726)
@@ -0,0 +1,47 @@
+package org.richfaces.demo.ajaxsupport;
+
+public class UserBean {
+ private String name;
+ private java.lang.Integer screenWidth;
+ private java.lang.Integer screenHeight;
+ private String job;
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public java.lang.Integer getScreenWidth() {
+ return screenWidth;
+ }
+
+ public void setScreenWidth(java.lang.Integer screenWidth) {
+ this.screenWidth = screenWidth;
+ }
+
+ public java.lang.Integer getScreenHeight() {
+ return screenHeight;
+ }
+
+ public void setScreenHeight(java.lang.Integer screenHeight) {
+ this.screenHeight = screenHeight;
+ }
+
+ public void nameItJohn() {
+ setName("Jonh");
+ }
+ public void nameItMark() {
+ setName("Mark");
+ }
+
+ public String getJob() {
+ return job;
+ }
+
+ public void setJob(String job) {
+ this.job = job;
+ }
+
+}
Property changes on: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/ajaxsupport/UserBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years, 5 months