JBoss Rich Faces SVN: r1937 - in trunk/framework: api/src/main/java/org/ajax4jsf/javascript and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 19:06:05 -0400 (Mon, 30 Jul 2007)
New Revision: 1937
Modified:
trunk/framework/api/
trunk/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
trunk/framework/test/
Log:
- Slight ScriptUtils optimization
- .clover svn:ignored
Property changes on: trunk/framework/api
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
.settings
target
+ .classpath
.project
.settings
target
.clover
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2007-07-30 18:39:00 UTC (rev 1936)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/javascript/ScriptUtils.java 2007-07-30 23:06:05 UTC (rev 1937)
@@ -87,14 +87,15 @@
StringBuffer ret = new StringBuffer("{");
boolean first = true;
- for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
- Object key = (Object) iter.next();
+ for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
if (!first) {
ret.append(',');
}
- addEncodedString(ret, key);
+
+ addEncodedString(ret, entry.getKey());
ret.append(":");
- ret.append(toScript(map.get(key)));
+ ret.append(toScript(entry.getValue()));
first = false;
}
return ret.append("} ").toString();
Property changes on: trunk/framework/test
___________________________________________________________________
Name: svn:ignore
- target
.settings
.classpath
.project
+ target
.settings
.classpath
.project
.clover
17 years, 4 months
JBoss Rich Faces SVN: r1936 - trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-07-30 14:39:00 -0400 (Mon, 30 Jul 2007)
New Revision: 1936
Modified:
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js
Log:
fixed incompatibilities with IE7 (a damn crutch)
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-30 16:34:01 UTC (rev 1935)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/common/utils/Utils.js 2007-07-30 18:39:00 UTC (rev 1936)
@@ -1,5 +1,7 @@
var Utils = {
+ xmlns: new RegExp("xmlns=\"http://www.w3.org/1999/xhtml\"", 'g'),
+
DOM: {
copyAttributes : function(target, source, opts) {
@@ -41,11 +43,24 @@
replaceNode : function(id, request) {
var target = document.getElementById(id);
var src = request.getElementById(id);
-
+
if(target && src) {
Utils.DOM.Event.removeListeners(target);
if (ClientUILib.isIE) {
+
+ var s = String();
+ var newOuterXml = "<table><tbody>" + src.xml.replace(Utils.xmlns, '') + "</tbody></table>";
+ var newNode = document.createElement("DIV");
+ newNode.innerHTML = newOuterXml;
+ var imported = newNode.firstChild.firstChild.firstChild;
+
+ //alert(imported);
+
+ target.parentNode.replaceChild(imported, target);;
+ return imported;
+
+ } /*else if (ClientUILib.isIE) {
var theDoc = document;
//var createEl = theDoc.createElement;
@@ -76,7 +91,8 @@
target.parentNode.replaceChild(row, target);
return row;
- } else {
+ } */
+ else {
var theDoc = document;
Utils.DOM._clearAttributes(target);
@@ -232,6 +248,7 @@
var countForUpdate = 0;
var rowsForUpdate = [];
+
for(i=0; i<count; i++) {
rowindex = startRow + i;
if(rowindex >= rowCount){
@@ -251,6 +268,18 @@
}
);
}
+ if (ClientUILib.isIE7) {
+ setTimeout(function() {
+ var body = grid.getBody();
+ ["fTable", "nTable"].unbreakableEach(
+ function(prop) {
+ body[prop].hide();
+ body[prop].show();
+ }
+ );
+ }
+ ,50);
+ }
if (callbacks && countForUpdate>0) {
// process suspended processing
17 years, 4 months
JBoss Rich Faces SVN: r1935 - trunk/sandbox/samples/scrollable-grid-demo.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-07-30 12:34:01 -0400 (Mon, 30 Jul 2007)
New Revision: 1935
Modified:
trunk/sandbox/samples/scrollable-grid-demo/pom.xml
Log:
added ui core to deps
Modified: trunk/sandbox/samples/scrollable-grid-demo/pom.xml
===================================================================
--- trunk/sandbox/samples/scrollable-grid-demo/pom.xml 2007-07-30 16:27:27 UTC (rev 1934)
+++ trunk/sandbox/samples/scrollable-grid-demo/pom.xml 2007-07-30 16:34:01 UTC (rev 1935)
@@ -20,6 +20,11 @@
<artifactId>skins</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
17 years, 4 months
JBoss Rich Faces SVN: r1934 - in trunk/sandbox/ui/calendar/src: main/java/org/richfaces/component and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-07-30 12:27:27 -0400 (Mon, 30 Jul 2007)
New Revision: 1934
Modified:
trunk/sandbox/ui/calendar/src/main/config/component/calendar.xml
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java
Log:
added tooltipMode
Modified: trunk/sandbox/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/sandbox/ui/calendar/src/main/config/component/calendar.xml 2007-07-30 16:26:36 UTC (rev 1933)
+++ trunk/sandbox/ui/calendar/src/main/config/component/calendar.xml 2007-07-30 16:27:27 UTC (rev 1934)
@@ -137,5 +137,11 @@
<description></description>
<defaultvalue>"popupButton"</defaultvalue>
</property>
+ <property>
+ <name>toolTipMode</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+ <defaultvalue>"batch"</defaultvalue>
+ </property>
</component>
</components>
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-30 16:26:36 UTC (rev 1933)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-30 16:27:27 UTC (rev 1934)
@@ -118,16 +118,19 @@
public abstract String getDirection();
public abstract void setDirection(String direction);
-
+
public abstract boolean isPopup();
public abstract void setPopup(boolean popup);
-
+
public abstract String getButtonLabel();
public abstract void setButtonLabel(String buttonLabel);
-
+ public abstract String getToolTipMode();
+
+ public abstract void setToolTipMode(String toolTipMode);
+
// currentDate processing -------------------------------------------------
public String getValueAsString(FacesContext context, UIComponent component)
@@ -193,16 +196,16 @@
return calendar.getTime();
}
}
-
- public Object getTooltip(Date date){
-
+
+ public Object getTooltip(Date date) {
+
CalendarDataModel calendarDM = (CalendarDataModel) getData();
- if (calendarDM != null) {
- return calendarDM.getToolTip(date);
- }else{
- return null;
- }
-
+ if (calendarDM != null) {
+ return calendarDM.getToolTip(date);
+ } else {
+ return null;
+ }
+
}
protected Date getDefaultPreloadBegin(Date date) {
@@ -216,7 +219,6 @@
return calendar.getTime();
}
-
protected Date getDefaultPreloadEnd(Date date) {
Calendar calendar = Calendar.getInstance(getTimeZone(), getLocale());
calendar.setTime(date);
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-30 16:26:36 UTC (rev 1933)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-30 16:27:27 UTC (rev 1934)
@@ -39,6 +39,7 @@
import javax.faces.convert.DateTimeConverter;
import javax.faces.event.PhaseId;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
@@ -68,7 +69,7 @@
public static final String DATE_SCROLL = "DateScroll";
protected static final String MARKUP_SUFFIX = "Markup";
-
+
/*
* (non-Javadoc)
*
@@ -85,6 +86,17 @@
return HtmlUtil.qualifySize(size.toString());
}
+ public void addPopupToAjaxRendered(FacesContext context,
+ UICalendar component) {
+
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if (ajaxContext.isAjaxRequest()) {
+ ajaxContext.getAjaxRenderedAreas().add(
+ component.getClientId(context) + "Popup");
+ }
+
+ }
+
public Object getConvertedValue(FacesContext context,
UIComponent component, Object submittedValue)
throws ConverterException {
@@ -97,9 +109,10 @@
converter.setPattern(calendar.getDatePattern());
converter.setLocale(calendar.getLocale());
converter.setTimeZone(calendar.getTimeZone());
- return converter.getAsObject(context, component, (String) submittedValue);
+ return converter.getAsObject(context, component,
+ (String) submittedValue);
}
-
+
public Date convertCurrentDate(String currentDateString) {
Calendar calendar = Calendar.getInstance();
@@ -120,7 +133,7 @@
super.doDecode(context, component);
String clientId = component.getClientId(context);
-
+
Map requestParameterMap = context.getExternalContext()
.getRequestParameterMap();
@@ -128,26 +141,26 @@
+ DATE_SCROLL);
if (currentDateString != null) {
-// ((UICalendar) component)
-// .setCurrentDate(convertCurrentDate(currentDateString));
- CurrentDateChangeEvent ev = new CurrentDateChangeEvent(component, currentDateString) ;
+ // ((UICalendar) component)
+ // .setCurrentDate(convertCurrentDate(currentDateString));
+ CurrentDateChangeEvent ev = new CurrentDateChangeEvent(component,
+ currentDateString);
ev.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
ev.queue();
-
+
new AjaxEvent(component).queue();
}
-
- String selectedDateString = (String) requestParameterMap.get(clientId + "InputSelectedDate");
+
+ String selectedDateString = (String) requestParameterMap.get(clientId
+ + "InputSelectedDate");
if (selectedDateString != null) {
((UICalendar) component).setSubmittedValue(selectedDateString);
}
}
-
+ public void encodeChildren(FacesContext context, UIComponent calendar)
+ throws IOException {
- public void encodeChildren(FacesContext context, UIComponent calendar)
- throws IOException {
-
}
public void writeMarkupScriptBody(FacesContext context,
@@ -166,7 +179,6 @@
}
}
-
public void writePreloadBody(FacesContext context, UICalendar calendar)
throws IOException {
Object preload = calendar.getPreload();
@@ -189,8 +201,8 @@
options.put("calendar", JSReference.THIS);
options.put("single", JSReference.TRUE);
// ajax single
- //options.put("control", new JSReference(JSReference.THIS.toScript(),
- // "id"));
+ // options.put("control", new JSReference(JSReference.THIS.toScript(),
+ // "id"));
String oncomplete = AjaxRendererUtils.getAjaxOncomplete(calendar);
JSFunctionDefinition oncompleteDefinition = new JSFunctionDefinition();
@@ -214,35 +226,36 @@
writer.write(definition.toScript());
}
- public String getInputValue(FacesContext context, UIComponent component){
- // UIInput input = (UIInput) component;
+ public String getInputValue(FacesContext context, UIComponent component) {
UICalendar input = (UICalendar) component;
String value = (String) input.getSubmittedValue();
- if(value == null){
+ if (value == null) {
Object curVal = input.getValue();
DateTimeConverter converter = new DateTimeConverter();
converter.setPattern(input.getDatePattern());
converter.setLocale(input.getLocale());
- converter.setTimeZone(input.getTimeZone());
- // Converter converter = SelectUtils.getConverterForProperty(context, input, "value");
-
- if(converter != null){
+ // converter.setTimeZone(input.getTimeZone());
+ // Converter converter =
+ // SelectUtils.getConverterForProperty(context, input, "value");
+
+ if (converter != null) {
value = converter.getAsString(context, input, curVal);
} else {
- if(curVal == null){
+ if (curVal == null) {
value = "";
} else {
value = curVal.toString();
}
}
}
- if(value == null){
+ if (value == null) {
value = "";
}
return value;
}
- public void writeSymbols(FacesContext facesContext, UICalendar calendar) throws IOException {
+ public void writeSymbols(FacesContext facesContext, UICalendar calendar)
+ throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
Map symbolsMap = getSymbolsMap(facesContext, calendar);
Iterator entryIterator = symbolsMap.entrySet().iterator();
@@ -252,24 +265,26 @@
writer.writeText(entry.getKey(), null);
writer.writeText(": ", null);
writer.writeText(ScriptUtils.toScript(entry.getValue()), null);
-
+
if (entryIterator.hasNext()) {
writer.writeText(", ", null);
}
}
}
-
- private static String[] shiftDates(int firstDayOfWeek, int minimum, int maximum, String[] labels) {
+
+ private static String[] shiftDates(int firstDayOfWeek, int minimum,
+ int maximum, String[] labels) {
if (minimum == 0) {
return labels;
}
String[] shiftedLabels = new String[maximum - minimum + 1];
- System.arraycopy(labels, minimum, shiftedLabels, 0, maximum - minimum + 1);
-
+ System.arraycopy(labels, minimum, shiftedLabels, 0, maximum - minimum
+ + 1);
+
return shiftedLabels;
}
-
+
protected Map getSymbolsMap(FacesContext facesContext, UICalendar calendar) {
Map map = new HashMap();
@@ -278,61 +293,74 @@
int maximum = cal.getActualMaximum(Calendar.DAY_OF_WEEK);
int minimum = cal.getActualMinimum(Calendar.DAY_OF_WEEK);
int firstDayOfWeek = cal.getFirstDayOfWeek();
-
- //.getInstance(locale) changet to new DateFormatSymbols(locale) by Alexej Kushunin ;
+
+ // .getInstance(locale) changet to new DateFormatSymbols(locale) by
+ // Alexej Kushunin ;
DateFormatSymbols symbols = new DateFormatSymbols(locale);
- String[] weekDayLabels = ComponentUtil.asArray(calendar.getWeekDayLabels());
+ String[] weekDayLabels = ComponentUtil.asArray(calendar
+ .getWeekDayLabels());
if (weekDayLabels == null) {
weekDayLabels = symbols.getWeekdays();
- weekDayLabels = shiftDates(firstDayOfWeek, minimum, maximum, weekDayLabels);
+ weekDayLabels = shiftDates(firstDayOfWeek, minimum, maximum,
+ weekDayLabels);
}
-
- String[] weekDayLabelsShort = ComponentUtil.asArray(calendar.getWeekDayLabelsShort());
+
+ String[] weekDayLabelsShort = ComponentUtil.asArray(calendar
+ .getWeekDayLabelsShort());
if (weekDayLabelsShort == null) {
weekDayLabelsShort = symbols.getShortWeekdays();
- weekDayLabelsShort = shiftDates(firstDayOfWeek, minimum, maximum, weekDayLabelsShort);
+ weekDayLabelsShort = shiftDates(firstDayOfWeek, minimum, maximum,
+ weekDayLabelsShort);
}
String[] monthLabels = ComponentUtil.asArray(calendar.getMonthLabels());
if (monthLabels == null) {
monthLabels = symbols.getMonths();
}
-
- String[] monthLabelsShort = ComponentUtil.asArray(calendar.getMonthLabelsShort());
+
+ String[] monthLabelsShort = ComponentUtil.asArray(calendar
+ .getMonthLabelsShort());
if (monthLabelsShort == null) {
monthLabelsShort = symbols.getShortMonths();
}
-
+
map.put(WEEK_DAY_LABELS, weekDayLabels);
map.put(WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);
map.put(MONTH_LABELS, monthLabels);
map.put(MONTH_LABELS_SHORT, monthLabelsShort);
-
+
return map;
}
-
- public String getFirstWeekDay(FacesContext context, UICalendar calendar) throws IOException {
+
+ public String getFirstWeekDay(FacesContext context, UICalendar calendar)
+ throws IOException {
Calendar cal = calendar.getCalendar();
- return String.valueOf(cal.getFirstDayOfWeek() - cal.getActualMinimum(Calendar.DAY_OF_WEEK));
+ return String.valueOf(cal.getFirstDayOfWeek()
+ - cal.getActualMinimum(Calendar.DAY_OF_WEEK));
}
-
- public String getMinDaysInFirstWeek(FacesContext context, UICalendar calendar) throws IOException {
+
+ public String getMinDaysInFirstWeek(FacesContext context,
+ UICalendar calendar) throws IOException {
Calendar cal = calendar.getCalendar();
return String.valueOf(cal.getMinimalDaysInFirstWeek());
}
- public String getCurrentDate(FacesContext context, UICalendar calendar) throws IOException {
+ public String getCurrentDate(FacesContext context, UICalendar calendar)
+ throws IOException {
Date date = calendar.getCurrentDateOrDefault();
return ScriptUtils.toScript(formatDate(date));
}
- public String getSelectedDate(FacesContext context, UICalendar calendar) throws IOException {
+ public String getSelectedDate(FacesContext context, UICalendar calendar)
+ throws IOException {
Object submittedValue = calendar.getSubmittedValue();
Date date;
-
+
if (submittedValue instanceof String) {
- Converter converter = SelectUtils.getConverterForProperty(context, calendar, "value");
- date = (Date) converter.getAsObject(context, calendar, (String) submittedValue);
+ Converter converter = SelectUtils.getConverterForProperty(context,
+ calendar, "value");
+ date = (Date) converter.getAsObject(context, calendar,
+ (String) submittedValue);
} else if (submittedValue != null) {
date = (Date) submittedValue;
} else {
Modified: trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java
===================================================================
--- trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java 2007-07-30 16:26:36 UTC (rev 1933)
+++ trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java 2007-07-30 16:27:27 UTC (rev 1934)
@@ -18,6 +18,7 @@
import org.apache.commons.lang.StringUtils;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlScript;
@@ -57,6 +58,7 @@
calendar = (UICalendar) application
.createComponent(UICalendar.COMPONENT_TYPE);
calendar.setLocale(Locale.CHINESE);
+ calendar.setDatePattern("d/MM/yyyy");
Calendar calendarObject = Calendar.getInstance();
calendarObject.set(2001, Calendar.SEPTEMBER, 11);
calendar.setId("calendar");
@@ -140,17 +142,19 @@
HtmlPage page = renderView();
assertNotNull(page);
- //System.out.println(page.asXml());
+ // System.out.println(page.asXml());
HtmlElement htmlCalendar = page.getHtmlElementById(calendar.getClientId(facesContext));
assertNotNull(htmlCalendar);
+ System.out.println(htmlCalendar.getAttributeValue("datePattern"));
//System.out.println(htmlCalendar.getAttributeValue("class"));
htmlCalendar.getAttributeValue("class");
- HtmlElement htmlCalendarInput = page.getHtmlElementById(calendar.getClientId(facesContext)+"Input");
+ HtmlInput htmlCalendarInput = (HtmlInput) page.getHtmlElementById(calendar.getClientId(facesContext)+"PopupInput");
HtmlElement htmlCalendarButton = page.getHtmlElementById(calendar.getClientId(facesContext)+"PopupButton");
assertNotNull(htmlCalendarInput);
assertNotNull(htmlCalendarButton);
- assertTrue(htmlCalendarInput.getAttributeValue("class").contains("org.richfaces.component.html.HtmlCalendar"));
+ htmlCalendarInput.setValueAttribute("11/09/2001");
+ // assertTrue(htmlCalendarInput.getAttributeValue("class").contains("org.richfaces.component.html.HtmlCalendar"));
// assertTrue(htmlCalendarButton.getAttributeValue("class").contains("org.richfaces.component.html.HtmlCalendar"));
}
17 years, 4 months
JBoss Rich Faces SVN: r1933 - trunk/sandbox/ui/calendar/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-07-30 12:26:36 -0400 (Mon, 30 Jul 2007)
New Revision: 1933
Modified:
trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
added toolTipMode
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-30 16:04:53 UTC (rev 1932)
+++ trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-30 16:26:36 UTC (rev 1933)
@@ -30,6 +30,7 @@
datePattern: '#{component.datePattern}',
jointPoint: '#{component.jointPoint}',
direction: '#{component.direction}',
+ toolTipMode:'#{component.toolTipMode}',
popup: #{component.popup},
<f:call name="writeSymbols" />,
firstWeekDay: #{this:getFirstWeekDay(context, component)},
@@ -58,8 +59,10 @@
<jsp:scriptlet>
<![CDATA[
boolean popup = getUtils().isBooleanAttribute(component, "popup");
- if (popup) {]]>
+ if (popup) {
+ addPopupToAjaxRendered(context, component);]]>
</jsp:scriptlet>
+
<span
id="#{clientId}Popup"
> <input
17 years, 4 months
JBoss Rich Faces SVN: r1932 - in trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html: scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-07-30 12:04:53 -0400 (Mon, 30 Jul 2007)
New Revision: 1932
Modified:
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
popup fixes
css fixes
Modified: trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-07-30 15:57:22 UTC (rev 1931)
+++ trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-07-30 16:04:53 UTC (rev 1932)
@@ -80,10 +80,10 @@
width : 25px;
}
-.calendar_holly{
+/*.calendar_holly{
background-color : #ffebda; /*unknown parameter - need to add*/
color : #ff7800; /*unknown parameter - need to add*/
-}
+}*/
/*.calendar_current{
background-color : #ff7800; /*unknown parameter - need to add*/
@@ -175,6 +175,10 @@
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
+ <u:selector name=".Weekendclass">
+ <u:style name="color" value="red"/>
+ </u:selector>
+
/* background-color : #f5f5f5; unknown parameter - need to add*/
<u:selector name=".calendar_week">
<u:style name="border-bottom" skin="panelBorderColor"/>
@@ -183,13 +187,13 @@
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
+
+ <u:selector name=".calendar_holly">
+ <u:style name="background-color" value="#ffebda"/> /*unknown parameter - need to add*/
+ <u:style name="color" value="#ff7800"/> /*unknown parameter - need to add*/
+ </u:selector>
+
/*
-.calendar_holly{
- background-color : #ffebda; /*unknown parameter - need to add
- color : #ff7800; /*unknown parameter - need to add
-}
-*/
-/*
.calendar_current{
background-color : #ff7800; /*unknown parameter - need to add
color : #ffebda; /*unknown parameter - need to add
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-30 15:57:22 UTC (rev 1931)
+++ trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-07-30 16:04:53 UTC (rev 1932)
@@ -89,7 +89,7 @@
element.style.left = ox + 'px';
element.style.top = oy + 'px';
-}
+};
Richfaces.Calendar.getOffsetDimensions = function(element) {
// from prototype 1.5.0 // Pavel Yascenko
@@ -113,7 +113,7 @@
els.position = originalPosition;
els.visibility = originalVisibility;
return {width: originalWidth, height: originalHeight};
-}
+};
Richfaces.Calendar.checkCollision = function(elementRect, windowRect, windowOffset)
{
@@ -128,7 +128,7 @@
right: (elementRect.right<windowRect.right ? elementRect.right : windowRect.right),
bottom: (elementRect.bottom<windowRect.bottom ? elementRect.bottom : windowRect.bottom)};
return (rect.right-rect.left)* (rect.bottom-rect.top);
-}
+};
Richfaces.Calendar.getWindowDimensions = function() {
@@ -141,7 +141,7 @@
|| document.body.clientHeight
|| 0;
return {width:w, height: h};
-}
+};
Richfaces.Calendar.getWindowScrollOffset = function() {
var dx = window.pageXOffset
@@ -153,13 +153,13 @@
|| document.body.scrollTop
|| 0;
return {left:dx, top: dy};
-}
+};
Richfaces.Calendar.getWindowViewport = function() {
var windowDim = Richfaces.Calendar.getWindowDimensions();
var windowOffset = Richfaces.Calendar.getWindowScrollOffset();
return {left:windowOffset.left, top:windowOffset.top, right: windowDim.width+windowOffset.left, bottom: windowDim.height+windowOffset.top};
-}
+};
Richfaces.Calendar.joinArray = function(array, begin, end, separator)
{
@@ -168,28 +168,14 @@
while (array.length)
value = begin+array.pop()+end+separator+value;
return value;
-}
+};
-/*Richfaces.Calendar.getPageDimensions = function() {
- var x,y;
- var test1 = document.body.scrollHeight;
- var test2 = document.body.offsetHeight;
- if (test1 > test2) {
- // all but Explorer Mac
- x = document.body.scrollWidth;
- y = document.body.scrollHeight;
- }
- else {
- // Explorer Mac;
- // would also work in Explorer 6 Strict, Mozilla and Safari
+Richfaces.Calendar.getMonthByLabel = function (monthLabel, monthNames)
+{
+ var i=0;
+ while (i<monthNames.length) if (monthNames[i]==monthLabel) return i; else i++;
+};
- x = document.body.offsetWidth;
- y = document.body.offsetHeight;
- }
-
- return {width:x, height:y};
-}*/
-
Object.extend(Event, {
findElementByAttr : function(event, tagName, attribute, value, flag) {
var element = Event.findElement(event, tagName);
@@ -228,34 +214,8 @@
return (shortNames
? ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
: ['January','February','March','April','May','June','July','August','September','October','November','December']);
- }
-});
-Object.extend(Date.prototype, {
+ },
- format : function(pattern, monthNames, monthNamesShort) {
- if (!monthNames) monthNames = Date.getDefaultMonthNames();
- if (!monthNamesShort) monthNamesShort = Date.getDefaultMonthNames(true);
- var d = this; var mm; var dd;
- return pattern.replace(/(yy^y|y+|M^M|MM^M|MMM^M|M+|d^d|d+)/g,
- function($1) {
- switch ($1) {
- case 'yy': return d.getYear().toString().substr(-2);
- case 'M': return d.getMonth()+1;
- case 'MM': return (mm = d.getMonth()+1)<10 ? '0'+mm : mm;
- case 'MMM': return monthNamesShort[d.getMonth()];
- case 'd': return d.getDate();
- }
- // y+,M+,d+
- var ch = $1.charAt(0);
- if (ch=='y') return d.getFullYear();
- if (ch=='M') return monthNames[d.getMonth()];
- if (ch=='d') return (dd = d.getDate())<10 ? '0'+dd : dd;
- }
- );
- }
-});
-
-Object.extend(Date, {
parseDate: function(dateString, pattern, monthNames, monthNamesShort)
{
if (!monthNames) monthNames = Date.getDefaultMonthNames();
@@ -263,6 +223,7 @@
var counter=1;
var y,m,d;
+ var shortLabel=false;
pattern = pattern.replace(/([.*+?^<>=!:${}()|[\]\/\\])/g, '\\$1');
pattern = pattern.replace(/(yy^y|y+|M^M|MM^M|MMM^M|M+|d^d|d+)/g,
@@ -272,7 +233,7 @@
case 'MM' : m=counter; counter++; return '(\\d{2})';
case 'M' : m=counter; counter++; return '(\\d{1,2})';
case 'd' : d=counter; counter++; return '(\\d{1,2})';
- case 'MMM': m=counter; counter++; return '('+monthNamesShort.join('|')+')';
+ case 'MMM': m=counter; counter++; shortLabel=true; return '('+monthNamesShort.join('|')+')';
}
// y+,M+,d+
var ch = $1.charAt(0);
@@ -286,16 +247,38 @@
var match = dateString.match(re);
if (match!=null)
{
- var month;
- var yy = parseInt(match[y]); if (isNaN(yy)) return null; else if (yy<70) yy+=2000; else if (yy<100) yy+=1900;
- var mm = parseInt(match[m]); if (isNaN(mm)) mm = match[m]; else if (mm<1 || mm>12) return null;
- var days = 32 - new Date(mm+'/32/'+yy).getDate();
- var dd = parseInt(match[d]); if (isNaN(dd) || dd<1 || dd>days) return null;
- return new Date(mm+'/'+dd+'/'+yy);
+ var yy = parseInt(match[y],10); if (isNaN(yy)) return null; else if (yy<70) yy+=2000; else if (yy<100) yy+=1900;
+ var mm = parseInt(match[m],10); if (isNaN(mm)) mm = Richfaces.Calendar.getMonthByLabel(match[m], shortLabel ? monthNamesShort : monthNames); else if (--mm<1 || mm>12) return null;
+ var dd = parseInt(match[d],10); if (isNaN(dd) || dd<1 || dd>daysInMonth(yy, mm)) return null;
+ return new Date(yy, mm, dd);
}
return null;
}
});
+Object.extend(Date.prototype, {
+
+ format : function(pattern, monthNames, monthNamesShort) {
+ if (!monthNames) monthNames = Date.getDefaultMonthNames();
+ if (!monthNamesShort) monthNamesShort = Date.getDefaultMonthNames(true);
+ var d = this; var mm; var dd;
+ return pattern.replace(/(yy^y|y+|M^M|MM^M|MMM^M|M+|d^d|d+)/g,
+ function($1) {
+ switch ($1) {
+ case 'yy': return d.getYear().toString().substr(-2);
+ case 'M': return d.getMonth()+1;
+ case 'MM': return (mm = d.getMonth()+1)<10 ? '0'+mm : mm;
+ case 'MMM': return monthNamesShort[d.getMonth()];
+ case 'd': return d.getDate();
+ }
+ // y+,M+,d+
+ var ch = $1.charAt(0);
+ if (ch=='y') return d.getFullYear();
+ if (ch=='M') return monthNames[d.getMonth()];
+ if (ch=='d') return (dd = d.getDate())<10 ? '0'+dd : dd;
+ }
+ );
+ }
+});
function isLeapYear(year) {
return new Date(year, 1, 29).getDate()==29;
@@ -457,15 +440,17 @@
if (this.params.showWeekDaysBar)
{
var htmlTextWeekDayBar = '<tr id="'+this.params.weekDayBarId+'">';
- if (this.params.showWeeksBar) htmlTextWeekDayBar+='<td style="calendar_days"><br/></td>';
+ if (this.params.showWeeksBar) htmlTextWeekDayBar+='<td class="calendar_days"><br/></td>';
var weekDayCounter = this.params.firstWeekDay;
for (var i=0;i<7;i++)
{
var weekDayHtml = this.evaluateMarkup(this.params.weekDayMarkup, {weekDayLabel: this.params.weekDayLabelsShort[weekDayCounter], weekDayNumber:weekDayCounter, componentId:this.getWeekDayComponentId(i)} );
if (weekDayCounter==6) weekDayCounter=0; else weekDayCounter++;
- styleClass = (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber ? "Weekendclass" : "calendar_days");
- if (i==6) styleClass +=" right_cell";
+ styleClass = "calendar_days";
+ if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass += " Weekendclass";
+
+ if (i==6) styleClass += " right_cell";
htmlTextWeekDayBar+='<td class="'+styleClass+'">'+weekDayHtml+'</td>';
}
htmlTextWeekDayBar+='</tr>\n';
@@ -631,7 +616,7 @@
var obj = Event.findElementByAttr(e, "TD", "id", this.DATE_ELEMENT_ID, true);
if (obj)
{
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length))];
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
if (daydata._month==0)
{
this.selectedDate=new Date(this.currentDate);
@@ -661,7 +646,7 @@
var obj = Event.findElementByAttr(e, "TD", "id", this.DATE_ELEMENT_ID, true);
if (obj)
{
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length))];
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
if (daydata._month==0 && Element.hasClassName(obj,daydata._className)) Element.replaceClassName(obj,daydata._className, daydata._hoverClassName);
}
},
@@ -670,7 +655,7 @@
var obj = Event.findElementByAttr(e, "TD", "id", this.DATE_ELEMENT_ID, true);
if (obj)
{
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length))];
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
if (daydata._month==0 && Element.hasClassName(obj,daydata._hoverClassName)) Element.replaceClassName(obj,daydata._hoverClassName, daydata._className);
}
},
17 years, 4 months
JBoss Rich Faces SVN: r1931 - trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-30 11:57:22 -0400 (Mon, 30 Jul 2007)
New Revision: 1931
Modified:
trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
Log:
Modified: trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-07-30 15:50:57 UTC (rev 1930)
+++ trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-07-30 15:57:22 UTC (rev 1931)
@@ -15,9 +15,6 @@
<table>
<tbody>
<tr>
- <td> <h:outputText value="Rich Message Demo"/> </td>
- </tr>
- <tr>
<td>
<h:selectOneMenu id="select1" value="">
<f:selectItem itemValue="error" itemLabel="error"/>
@@ -67,7 +64,11 @@
</h:selectOneMenu>
</td>
</tr>
-
+
+ <tr>
+ <td> <h:outputText value="Rich Message Demo"/> </td>
+ </tr>
+
<tr>
<td>
<r:message for="select1"
17 years, 4 months
JBoss Rich Faces SVN: r1930 - trunk/sandbox/samples/rich-message-demo.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-30 11:50:57 -0400 (Mon, 30 Jul 2007)
New Revision: 1930
Modified:
trunk/sandbox/samples/rich-message-demo/pom.xml
Log:
add dependency to richfaces-ui 3.10-SNAPSHOT
Modified: trunk/sandbox/samples/rich-message-demo/pom.xml
===================================================================
--- trunk/sandbox/samples/rich-message-demo/pom.xml 2007-07-30 15:50:26 UTC (rev 1929)
+++ trunk/sandbox/samples/rich-message-demo/pom.xml 2007-07-30 15:50:57 UTC (rev 1930)
@@ -20,6 +20,11 @@
<artifactId>skins</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
17 years, 4 months
JBoss Rich Faces SVN: r1929 - in trunk: sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 11:50:26 -0400 (Mon, 30 Jul 2007)
New Revision: 1929
Added:
trunk/framework/api/src/main/java/org/richfaces/model/MapDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java
Removed:
trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
Log:
- TreeModel API & Impl optimized
- MapDataModel.java added
- Sample case for MapDataModel.java added
Deleted: trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -1,118 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-import java.io.IOException;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 26.07.2007
- *
- */
-public class LastAwareArrayDataModel extends ExtendedDataModel implements LastAwareDataModel {
-
- private Object[] wrappedData;
- private Integer rowKey;
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
- */
- public Object getRowKey() {
- return rowKey;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
- */
- public void setRowKey(Object key) {
- this.rowKey = (Integer) key;
- }
-
- /* (non-Javadoc)
- * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
- */
- public void walk(FacesContext context, DataVisitor visitor, Range range,
- Object argument) throws IOException {
- if (wrappedData != null) {
- for (int i = 0; i < wrappedData.length; i++) {
- Integer key = new Integer(i);
-
- visitor.process(context, key, argument);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowCount()
- */
- public int getRowCount() {
- return wrappedData != null ? wrappedData.length : 0;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowData()
- */
- public Object getRowData() {
- if (wrappedData == null) {
- return null;
- }
-
- return wrappedData[rowKey.intValue()];
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getRowIndex()
- */
- public int getRowIndex() {
- return 0;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#getWrappedData()
- */
- public Object getWrappedData() {
- return wrappedData;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#isRowAvailable()
- */
- public boolean isRowAvailable() {
- return wrappedData != null && wrappedData.length < rowKey.intValue();
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#setRowIndex(int)
- */
- public void setRowIndex(int rowIndex) {
-
- }
-
- /* (non-Javadoc)
- * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
- */
- public void setWrappedData(Object data) {
- this.wrappedData = (Object[]) data;
- }
-
- public boolean isLast() {
- return wrappedData != null && wrappedData.length == rowKey.intValue() + 1;
- }
-
- public LastAwareArrayDataModel(Object[] wrappedData) {
- super();
- setWrappedData(wrappedData);
- }
-
- public boolean isEmpty() {
- return wrappedData == null || wrappedData.length == 0;
- }
-}
Deleted: trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -1,16 +0,0 @@
-/**
- *
- */
-package org.richfaces.model;
-
-/**
- * @author Nick Belaevski
- * mailto:nbelaevski@exadel.com
- * created 26.07.2007
- *
- */
-public interface LastAwareDataModel {
- public boolean isLast();
-
- public boolean isEmpty();
-}
Added: trunk/framework/api/src/main/java/org/richfaces/model/MapDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/MapDataModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/MapDataModel.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -0,0 +1,128 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+
+/**
+ * @author Nick Belaevski mailto:nbelaevski@exadel.com created 30.07.2007
+ *
+ */
+public class MapDataModel extends ExtendedDataModel {
+
+ private Map map;
+ private Object rowKey;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+
+ public void setRowKey(Object key) {
+ this.rowKey = key;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext,
+ * org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range,
+ * java.lang.Object)
+ */
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+ if (map != null) {
+ for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
+ Object key = (Object) iterator.next();
+
+ visitor.process(context, key, argument);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+
+ public int getRowCount() {
+ return map != null ? map.size() : 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+
+ public Object getRowData() {
+ return map != null ? map.get(rowKey) : null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+
+ public int getRowIndex() {
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ public Object getWrappedData() {
+ return map;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+ return map != null && map.containsKey(rowKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ public void setRowIndex(int rowIndex) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ public void setWrappedData(Object data) {
+ this.map = (Map) data;
+ }
+
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/SequenceDataModel.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -0,0 +1,115 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public class SequenceDataModel extends ExtendedDataModel {
+
+ private Object wrappedData;
+ private List list;
+ private Integer key;
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ public Object getRowKey() {
+ return key;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ public void setRowKey(Object key) {
+ this.key = (Integer) key;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+
+ if (list != null) {
+ int i = 0;
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ iterator.next();
+
+ visitor.process(context, new Integer(i), argument);
+
+ i++;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ public int getRowCount() {
+ return list != null ? list.size() : 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ public Object getRowData() {
+ return list != null ? list.get(key.intValue()) : null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ public int getRowIndex() {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ public Object getWrappedData() {
+ return wrappedData;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+ return list != null && list.size() > key.intValue();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ public void setRowIndex(int rowIndex) {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ public void setWrappedData(Object data) {
+ this.wrappedData = data;
+ if (data instanceof List) {
+ this.list = (List) data;
+ } else if (data != null) {
+ this.list = Arrays.asList((Object[]) data);
+ } else {
+ this.list = null;
+ }
+ }
+}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -24,10 +24,12 @@
public class StackingTreeModel extends AbstractTreeDataModel implements TreeComponentModel {
private String id;
-
+ private String var;
+
private String modelId;
private Object modelKey;
+ private StackingTreeModelDataProvider dataProvider;
protected StackingTreeModel stackingTreeModel;
// private ExtendedDataModel dataModel;
@@ -35,27 +37,60 @@
private Map models = new LinkedHashMap();
private List treeComponentModelListeners = new ArrayList();
+ private Object varObject;
public ExtendedDataModel getDataModel() {
- return null;
+ Object data = dataProvider.getData();
+ ExtendedDataModel dataModel;
+ if (data instanceof Map) {
+ dataModel = new MapDataModel();
+ } else {
+ dataModel = new SequenceDataModel();
+ }
+
+ dataModel.setWrappedData(data);
+ return dataModel;
}
- public StackingTreeModel(String id) {
+ public StackingTreeModel(String id, String var, StackingTreeModelDataProvider dataProvider) {
super();
this.id = id;
+ this.var = var;
+ this.dataProvider = dataProvider;
}
- public void leaveModel() {
+ public StackingTreeModel() {
+ this(null, null, null);
+ }
+
+ public void leaveModel(FacesContext facesContext) {
if (stackingTreeModel != null && stackingTreeModel != this) {
stackingTreeModel.leaveModel();
}
stackingTreeModel = null;
modelId = null;
modelKey = null;
+
+ if (var != null) {
+ Map map = facesContext.getExternalContext().getRequestMap();
+ map.put(var, varObject);
+ }
}
+
+ public void leaveModel() {
+ leaveModel(FacesContext.getCurrentInstance());
+ }
+ public void setupModel(Object object, FacesContext facesContext) {
+ if (var != null) {
+ Map map = facesContext.getExternalContext().getRequestMap();
+ varObject = map.get(var);
+ map.put(var, object);
+ }
+ }
+
public void setupModel(Object object) {
-
+ setupModel(object, FacesContext.getCurrentInstance());
}
public void setParent(StackingTreeModel parent) {
@@ -95,7 +130,7 @@
dataModel = getDataModel();
}
dataModel.setRowKey(localRowKey);
- setupModel(dataModel.getRowData());
+ setupModel(dataModel.getRowData(), context);
System.out.println(dataModel.getRowData() + (last ? " * " : "") + " - " + argumentKey);
processElement(context, dataVisitor, argument, argumentKey, last);
Added: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelDataProvider.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -0,0 +1,14 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 30.07.2007
+ *
+ */
+public interface StackingTreeModelDataProvider {
+ public Object getData();
+}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -4,7 +4,6 @@
package org.richfaces.model;
import java.util.Iterator;
-import java.util.List;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
@@ -19,15 +18,8 @@
public abstract Object getNodes();
public abstract void setNodes(Object nodes);
- public Object[] getData() {
- Object[] data;
- List nodes = (List) getNodes();
- if (nodes != null) {
- data = nodes.toArray();
- } else {
- data = new Object[0];
- }
- return data;
+ public Object getData() {
+ return getNodes();
}
protected abstract StackingTreeModel createStackingTreeModel();
Modified: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -3,8 +3,8 @@
*/
package org.richfaces.model;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.LinkedHashMap;
+import java.util.Map;
/**
* @author Nick Belaevski
@@ -13,18 +13,18 @@
*
*/
public class Package extends Entry {
- private List classes = new ArrayList();
+ private Map classes = new LinkedHashMap();
- public List getClasses() {
+ public Map getClasses() {
return classes;
}
- public void setClasses(List classes) {
+ public void setClasses(Map classes) {
this.classes = classes;
}
public void addClass(Class clazz) {
- this.classes.add(clazz);
+ this.classes.put(clazz.getName(), clazz);
clazz.setParent(this);
}
}
Modified: trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -4,26 +4,17 @@
package org.richfaces.component;
-import java.io.IOException;
-import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-import org.richfaces.model.LastAwareArrayDataModel;
import org.richfaces.model.StackingTreeModel;
-import org.richfaces.model.StackingTreeModelProvider;
+import org.richfaces.model.StackingTreeModelDataProvider;
/**
* JSF component class
*
*/
-public abstract class UIRecursiveTreeNodes extends StackingTreeModelProvider {
+public abstract class UIRecursiveTreeNodes extends UITreeNodes {
private static final String COMPONENT_TYPE = "org.richfaces.RecursiveTreeNodes";
@@ -32,113 +23,36 @@
public abstract Object getRoot();
public abstract void setRoot(Object root);
- public Object[] getRoots() {
- List nodes = (List) getRoot();
- Object[] roots;
- if (nodes != null) {
- roots = nodes.toArray();
- } else {
- roots = new Object[0];
- }
- return roots;
+ public Object getData() {
+ return getRoot();
}
+
+ public abstract String getVar();
+ public abstract void setVar(String var);
+
+ public StackingTreeModel getStackingModel() {
+ StackingTreeModel stackingModel = super.getStackingModel();
+
+ StackingTreeModel recursiveModel = new StackingTreeModel(getId(), getVar(), new StackingTreeModelDataProvider() {
- protected StackingTreeModel createStackingTreeModel() {
- StackingTreeModel treeModel = new StackingTreeModel(getId()) {
-
- private Object varObject;
-
- public void walk(FacesContext context, DataVisitor dataVisitor,
- Range range, Object rowKey, Object argument, boolean last)
- throws IOException {
-
- Object var = getAttributes().get("var");
- Map map = context.getExternalContext().getRequestMap();
- Object varObject = map.get(var);
-
- super.walk(context, dataVisitor, range, rowKey, argument, last);
-
- map.put(var, varObject);
+ public Object getData() {
+ return UIRecursiveTreeNodes.this.getNodes();
}
+
+ }) {
public void setupModel(Object object) {
super.setupModel(object);
- Object var = getAttributes().get("var");
-
- Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
- varObject = map.get(var);
- map.put(var, object);
componentSelected(UIRecursiveTreeNodes.this);
}
- public void leaveModel() {
- super.leaveModel();
- Object var = getAttributes().get("var");
-
- Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
- map.put(var, varObject);
- }
-
- public ExtendedDataModel getDataModel() {
- return new LastAwareArrayDataModel(getRoots());
- }
-
public Map getModels() {
- LinkedHashMap models = new LinkedHashMap();
- models.putAll(super.getModels());
- StackingTreeModel model = new StackingTreeModel(getId()) {
-
- private Object varObject;
-
- public void walk(FacesContext context, DataVisitor dataVisitor,
- Range range, Object rowKey, Object argument, boolean last)
- throws IOException {
-
- Object var = getAttributes().get("var");
- Map map = context.getExternalContext().getRequestMap();
- Object varObject = map.get(var);
-
- super.walk(context, dataVisitor, range, rowKey, argument, last);
-
- map.put(var, varObject);
- }
-
- public void setupModel(Object object) {
- super.setupModel(object);
- Object var = getAttributes().get("var");
-
- Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
- varObject = map.get(var);
- map.put(var, object);
- componentSelected(UIRecursiveTreeNodes.this);
- }
-
- public void leaveModel() {
- super.leaveModel();
- Object var = getAttributes().get("var");
-
- Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
- map.put(var, varObject);
- }
-
- public ExtendedDataModel getDataModel() {
- return new LastAwareArrayDataModel(getData());
- }
-
- public Map getModels() {
- LinkedHashMap models = new LinkedHashMap();
- models.putAll(this.parent.getModels());
-
- return models;
- }
- };
- model.setParent(this);
- models.put(getId(), model);
-
- return models;
+ return this.parent.getModels();
}
};
-
- return treeModel;
+ stackingModel.addStackingModel(recursiveModel);
+
+ return stackingModel;
}
+
}
Modified: trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -4,13 +4,8 @@
package org.richfaces.component;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.richfaces.model.LastAwareArrayDataModel;
import org.richfaces.model.StackingTreeModel;
+import org.richfaces.model.StackingTreeModelDataProvider;
import org.richfaces.model.StackingTreeModelProvider;
@@ -24,18 +19,21 @@
private static final String COMPONENT_FAMILY = "org.richfaces.TreeNodes";
+ public abstract String getVar();
+ public abstract void setVar(String var);
+
protected StackingTreeModel createStackingTreeModel() {
- StackingTreeModel treeModel = new StackingTreeModel(getId()) {
+ StackingTreeModel treeModel = new StackingTreeModel(getId(), getVar(), new StackingTreeModelDataProvider() {
+
+ public Object getData() {
+ return UITreeNodes.this.getData();
+ }
+
+ }) {
public void setupModel(Object object) {
super.setupModel(object);
- Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
- map.put(getAttributes().get("var"), object);
componentSelected(UITreeNodes.this);
}
-
- public ExtendedDataModel getDataModel() {
- return new LastAwareArrayDataModel(getData());
- }
};
return treeModel;
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-07-30 15:42:39 UTC (rev 1928)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-07-30 15:50:26 UTC (rev 1929)
@@ -508,7 +508,7 @@
return treeDataModel;
} else {
//TODO implement request caching
- StackingTreeModel stackingTreeModel = new StackingTreeModel(null);
+ StackingTreeModel stackingTreeModel = new StackingTreeModel();
if (getChildCount() > 0) {
Iterator children = getChildren().iterator();
while (children.hasNext()) {
17 years, 4 months
JBoss Rich Faces SVN: r1928 - trunk/ui/panelmenu/design/funcspec.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2007-07-30 11:42:39 -0400 (Mon, 30 Jul 2007)
New Revision: 1928
Modified:
trunk/ui/panelmenu/design/funcspec/FuncSpec - RF Panel Menu Component.doc
Log:
Modified: trunk/ui/panelmenu/design/funcspec/FuncSpec - RF Panel Menu Component.doc
===================================================================
(Binary files differ)
17 years, 4 months