JBoss Rich Faces SVN: r5264 - in trunk/framework: impl/src/main/java/org/richfaces/model/impl/expressive and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-01-10 09:11:05 -0500 (Thu, 10 Jan 2008)
New Revision: 5264
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java
trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java
Log:
http://jira.jboss.com/jira/browse/RF-1636
http://jira.jboss.com/jira/browse/RF-1715
Modified: trunk/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java 2008-01-10 14:11:03 UTC (rev 5263)
+++ trunk/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java 2008-01-10 14:11:05 UTC (rev 5264)
@@ -34,7 +34,7 @@
* @author Maksim Kaszynski
*
*/
- public static class SimpleRowKey implements Serializable{
+ public static class SimpleRowKey extends Number implements Serializable{
private static final long serialVersionUID = 1L;
private int i;
@@ -71,8 +71,19 @@
return false;
return true;
}
+ @Override
+ public double doubleValue() {
+ return i;
+ }
+ @Override
+ public float floatValue() {
+ return i;
+ }
+ @Override
+ public long longValue() {
+ return i;
+ }
-
}
Modified: trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java 2008-01-10 14:11:03 UTC (rev 5263)
+++ trunk/framework/impl/src/main/java/org/richfaces/model/impl/expressive/WrappedBeanComparator.java 2008-01-10 14:11:05 UTC (rev 5264)
@@ -41,12 +41,12 @@
Object p1 = w1.getProperty(prop);
Object p2 = w2.getProperty(prop);
- if (p1 != null) {
- if (p1 instanceof Comparable && p2 != null) {
- result = ((Comparable<Object>) p1).compareTo(p2);
- } else {
- result = 1;
- }
+ if (p1 instanceof Comparable && p2 instanceof Comparable) {
+ result = ((Comparable<Object>) p1).compareTo(p2);
+ } else if (p1 == null && p2 != null) {
+ result = 1;
+ } else if (p2 == null && p1 != null) {
+ result = -1;
}
if (asc != null && !asc.booleanValue()) {
17 years
JBoss Rich Faces SVN: r5263 - in branches/3.1.x: ui/scrollableDataTable/src/main/java/org/richfaces/model/internal and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-01-10 09:11:03 -0500 (Thu, 10 Jan 2008)
New Revision: 5263
Modified:
branches/3.1.x/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/WrappedBeanComparator.java
Log:
http://jira.jboss.com/jira/browse/RF-1636
http://jira.jboss.com/jira/browse/RF-1715
Modified: branches/3.1.x/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java
===================================================================
--- branches/3.1.x/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java 2008-01-10 13:50:22 UTC (rev 5262)
+++ branches/3.1.x/framework/api/src/main/java/org/richfaces/model/ScrollableTableDataModel.java 2008-01-10 14:11:03 UTC (rev 5263)
@@ -34,7 +34,7 @@
* @author Maksim Kaszynski
*
*/
- public static class SimpleRowKey implements Serializable{
+ public static class SimpleRowKey extends Number implements Serializable{
private static final long serialVersionUID = 1L;
private int i;
@@ -72,6 +72,15 @@
return true;
}
+ public double doubleValue() {
+ return i;
+ }
+ public float floatValue() {
+ return i;
+ }
+ public long longValue() {
+ return i;
+ }
}
Modified: branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/WrappedBeanComparator.java
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/WrappedBeanComparator.java 2008-01-10 13:50:22 UTC (rev 5262)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/model/internal/WrappedBeanComparator.java 2008-01-10 14:11:03 UTC (rev 5263)
@@ -38,8 +38,12 @@
Object p1 = w1.getProperty(prop);
Object p2 = w2.getProperty(prop);
- if (p1 instanceof Comparable) {
+ if (p1 instanceof Comparable && p2 instanceof Comparable) {
result = ((Comparable) p1).compareTo(p2);
+ } else if (p1 == null && p2 != null) {
+ result = 1;
+ } else if (p2 == null && p1 != null) {
+ result = -1;
}
if (asc != null && !asc.booleanValue()) {
17 years
JBoss Rich Faces SVN: r5262 - trunk/framework/api/src/main/java/org/richfaces/model/selection.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-10 08:50:22 -0500 (Thu, 10 Jan 2008)
New Revision: 5262
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
Log:
http://jira.jboss.com/jira/browse/RF-1756
Modified: trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2008-01-10 13:39:43 UTC (rev 5261)
+++ trunk/framework/api/src/main/java/org/richfaces/model/selection/SimpleSelection.java 2008-01-10 13:50:22 UTC (rev 5262)
@@ -5,6 +5,7 @@
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.Set;
/**
@@ -15,7 +16,7 @@
private static final long serialVersionUID = 1L;
- private Set keys = new HashSet();
+ private Set keys = new LinkedHashSet();
public boolean addKey(Object rowKey) {
return keys.add(rowKey);
17 years
JBoss Rich Faces SVN: r5261 - trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-01-10 08:39:43 -0500 (Thu, 10 Jan 2008)
New Revision: 5261
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
RF-1852
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-01-10 13:28:10 UTC (rev 5260)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-01-10 13:39:43 UTC (rev 5261)
@@ -906,8 +906,8 @@
var year = this.dateEditorStartYear = this.dateEditorYear-4;
var htmlContent = this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)
+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)
- +this.createDECell('','<', 0, -1)
- +this.createDECell('','>', 0, 1);
+ +this.createDECell('','<', 0, -1)
+ +this.createDECell('','>', 0, 1);
month++;
for (var i=0;i<5;i++)
@@ -924,9 +924,9 @@
this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
htmlContent+='</tr><tr><td colspan="2" class="rich-calendar-time-layout-ok">'+
- '<div class="rich-calendar-time-btn" style="float:right;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+'\').component.hideDateEditor(true);">OK</div>'+
+ '<div class="rich-calendar-time-btn" style="float:right;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+'\').component.hideDateEditor(true);">'+this.params.labels.ok+'</div>'+
'</td><td colspan="2" class="rich-calendar-time-layout-cancel">'+
- '<div class="rich-calendar-time-btn" style="float:left;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+'\').component.hideDateEditor(false);">Cancel</div>'+
+ '<div class="rich-calendar-time-btn" style="float:left;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+'\').component.hideDateEditor(false);">'+this.params.labels.cancel+'</div>'+
'</td>';
17 years
JBoss Rich Faces SVN: r5260 - branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-01-10 08:28:10 -0500 (Thu, 10 Jan 2008)
New Revision: 5260
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
Log:
RF-1799
Modified: branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-01-10 12:33:37 UTC (rev 5259)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-01-10 13:28:10 UTC (rev 5260)
@@ -370,21 +370,20 @@
}
if(switchType === 0) {
- startRowIndx = this._getRowIndex(this.templFrozen.getElement().rows[0].id);
+ startRowIndx = this._getRowIndex(this.templNormal.getElement().rows[0].id);
startIndex = range.start;
countToLoad = range.end - range.start;
}
else {
var i, row, rownew, cloned;
countToLoad = 0;
- var frozenTbl = this.templFrozen.getElement();
var normalTbl = this.templNormal.getElement();
if(range.start > this.currRange.start
&& range.start < this.currRange.end) {
switchType = 1;
countToLoad = range.start - this.currRange.start;
if(countToLoad > 0) {
- startRowIndx = this._getRowIndex(frozenTbl.rows[0].id);
+ startRowIndx = this._getRowIndex(normalTbl.rows[0].id);
startIndex = this.currRange.end;
}
}
@@ -394,7 +393,7 @@
if(countToLoad > 0) {
startIndex = this.currRange.end;
var restCount = this.rowsCount - countToLoad;
- startRowIndx = this._getRowIndex(frozenTbl.rows[restCount].id);
+ startRowIndx = this._getRowIndex(normalTbl.rows[restCount].id);
}
}
else {
@@ -403,7 +402,7 @@
if(countToLoad > 0) {
startIndex = range.start;
var restCount = this.rowsCount - countToLoad;
- startRowIndx = this._getRowIndex(frozenTbl.rows[restCount].id);
+ startRowIndx = this._getRowIndex(normalTbl.rows[restCount].id);
}
}
}
Modified: branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-01-10 12:33:37 UTC (rev 5259)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-01-10 13:28:10 UTC (rev 5260)
@@ -261,24 +261,24 @@
},
updateSize: function() {
var defaultWidth = 0, defaultHeight = 0;
- var i = 0, h, j=0;
+ var i = 0, h;
var columns = this._columns;
var cols = $A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
- var cells = $A(this.headerFrozenRow.getElement().rows[0].cells);
- cells.each(function(cell) {
+ var count = this.frozenCells.length;
+ for(j=0; j<count; j++) {
+ cell = this.frozenCells[j];
if(i<columns.length) {
columns[i].width = parseInt(cols[j].width);
h = cell.offsetHeight;
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[i].width;
}
- i++;j++;
- });
-
- j=0;
+ i++;
+ }
cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
- cells = $A(this.headerRow.getElement().rows[0].cells);
- cells.each(function(cell) {
+ count = this.cells.length;
+ for(j=0; j<count; j++) {
+ cell = this.cells[j];
if(i<columns.length) {
columns[i].width = parseInt(cols[j].width);
@@ -286,8 +286,8 @@
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[i].width;
}
- i++;j++;
- });
+ i++;
+ }
this.defaultHeight = defaultHeight;
this.defaultWidth = defaultWidth;
17 years
JBoss Rich Faces SVN: r5259 - in trunk: ui/drag-drop/src/main/java/org/richfaces/renderkit/html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-10 07:33:37 -0500 (Thu, 10 Jan 2008)
New Revision: 5259
Modified:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DragSupportRenderer.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DropSupportRenderer.java
Log:
http://jira.jboss.com/jira/browse/RF-1678
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java 2008-01-10 12:26:23 UTC (rev 5258)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/CompositeRenderer.java 2008-01-10 12:33:37 UTC (rev 5259)
@@ -27,10 +27,13 @@
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.org.w3c.tidy.EntityTable;
import org.ajax4jsf.renderkit.AjaxChildrenRenderer;
import org.ajax4jsf.resource.InternetResource;
@@ -236,4 +239,21 @@
encoder.doEncode(context, component);
}
}
+
+ protected String escapeHtmlEntities(CharSequence orig) {
+ StringBuffer buff = new StringBuffer(orig);
+ EntityTable defaultEntityTable = EntityTable.getDefaultEntityTable();
+ Matcher matcher = Pattern.compile("\\&\\w+\\;").matcher(orig);
+ int delta = 0;
+ while (matcher.find()) {
+ String name = matcher.group().substring(0, matcher.group().length() - 1);
+ int code = defaultEntityTable.entityCode(name);
+ if (0 != code) {
+ String replacement = "&#" + code + ";";
+ buff.replace(matcher.start() - delta, matcher.end() - delta, replacement);
+ delta = delta + matcher.group().length() - replacement.length();
+ }
+ }
+ return buff.toString();
+ }
}
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DragSupportRenderer.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DragSupportRenderer.java 2008-01-10 12:26:23 UTC (rev 5258)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DragSupportRenderer.java 2008-01-10 12:33:37 UTC (rev 5259)
@@ -106,7 +106,7 @@
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute("id", component.getClientId(context), "id");
- writer.write(buffer.toString());
+ writer.write(escapeHtmlEntities(buffer));
writer.endElement(HTML.SCRIPT_ELEM);
}
}
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DropSupportRenderer.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DropSupportRenderer.java 2008-01-10 12:26:23 UTC (rev 5258)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/html/DropSupportRenderer.java 2008-01-10 12:33:37 UTC (rev 5259)
@@ -107,7 +107,7 @@
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute("id", component.getClientId(context), "id");
- writer.write(buffer.toString());
+ writer.write(escapeHtmlEntities(buffer));
writer.endElement(HTML.SCRIPT_ELEM);
}
}
17 years
JBoss Rich Faces SVN: r5258 - in trunk/sandbox/ui/progressBAR/src: main/java/org/richfaces/renderkit and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-01-10 07:26:23 -0500 (Thu, 10 Jan 2008)
New Revision: 5258
Modified:
trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java
Log:
attributes refactoring
Modified: trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-10 12:14:17 UTC (rev 5257)
+++ trunk/sandbox/ui/progressBAR/src/main/config/component/progressBar.xml 2008-01-10 12:26:23 UTC (rev 5258)
@@ -32,8 +32,9 @@
<name>mode</name>
<classname>java.lang.String</classname>
<description>Attributes defines AJAX or CLIENT modes for component</description>
+ <defaultvalue><![CDATA["ajax"]]></defaultvalue>
</property>
- <property>
+ <property>
<name>styleClass</name>
<classname>java.lang.String</classname>
<description>CSS class that defines style for progress bar</description>
@@ -50,13 +51,15 @@
</property>
<property>
<name>determined</name>
- <classname>java.lang.String</classname>
+ <classname>boolean</classname>
<description>Attribute defines if component should render percent value</description>
+ <defaultvalue>true</defaultvalue>
</property>
<property>
<name>permanent</name>
- <classname>java.lang.String</classname>
+ <classname>boolean</classname>
<description>Attribute defines background should be permanent</description>
+ <defaultvalue>false</defaultvalue>
</property>
<property>
<name>reRenderAfterComplete</name>
Modified: trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-10 12:14:17 UTC (rev 5257)
+++ trunk/sandbox/ui/progressBAR/src/main/java/org/richfaces/renderkit/AbstractProgressBarRenderer.java 2008-01-10 12:26:23 UTC (rev 5258)
@@ -104,9 +104,9 @@
// TODO provide client script with percent value
public String encodePersent(FacesContext context, UIComponent component)
throws IOException {
- String determinedAttr = (String) component.getAttributes().get(
+ Boolean determinedAttr = (Boolean) component.getAttributes().get(
"determined");
- if (determinedAttr != null && "true".equals(determinedAttr)) {
+ if (determinedAttr != null && determinedAttr.booleanValue()) {
String percent = getPercent(component);
if (percent != null) {
return percent + "%";
@@ -155,9 +155,9 @@
String width = String.valueOf(value.intValue());
String percent = encodePersent(context, component);
String style = (String) component.getAttributes().get("style");
- String permanent = (String) component.getAttributes().get("permanent");
+ Boolean permanent = (Boolean) component.getAttributes().get("permanent");
- if (!(permanent != null && "true".equals(permanent))) {
+ if (!(permanent != null && permanent.booleanValue())) {
String completeClass = (component.getAttributes().get(
"completeClass") != null) ? (String) component
Modified: trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-10 12:14:17 UTC (rev 5257)
+++ trunk/sandbox/ui/progressBAR/src/main/resources/org/richfaces/renderkit/html/js/progressBar.js 2008-01-10 12:26:23 UTC (rev 5258)
@@ -23,6 +23,8 @@
if (val.indexOf("%") < 0)
val = val + "%";
}
+ if (p > 100) { this.switchMode("completed"); return; }
+
if ($(this.id + ":progressState") != null)
{
if (this.mode == "progress")
Modified: trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx
===================================================================
--- trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-10 12:14:17 UTC (rev 5257)
+++ trunk/sandbox/ui/progressBAR/src/main/templates/org/richfaces/progressBar.jspx 2008-01-10 12:26:23 UTC (rev 5258)
@@ -18,7 +18,10 @@
<jsp:scriptlet>
<![CDATA[
String mode = (String) component.getAttributes().get("mode");
- boolean isAjax = !(mode != null && "client".equalsIgnoreCase(mode));
+ if (!mode.equalsIgnoreCase("client") && !mode.equalsIgnoreCase("ajax")) {
+ throw new IOException("Mode attribute should have 'client' or 'ajax' value");
+ }
+ boolean isAjax = ("ajax".equalsIgnoreCase(mode));
Boolean enabled = (Boolean) component.getAttributes().get("enabled");
Number value = (Number)component.getAttributes().get("value");
Integer percent = value.intValue();
Modified: trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java
===================================================================
--- trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java 2008-01-10 12:14:17 UTC (rev 5257)
+++ trunk/sandbox/ui/progressBAR/src/test/java/org/richfaces/sandbox/ProgressBarComponentTest.java 2008-01-10 12:26:23 UTC (rev 5258)
@@ -49,8 +49,7 @@
progressBar.setId("prgs");
progressBar.setValue(50);
progressBar.setInterval(1000);
- progressBar.getAttributes().put("determined", "true");
-
+
form.getChildren().add(progressBar);
}
17 years
JBoss Rich Faces SVN: r5257 - in trunk/sandbox/ui/combobox/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-10 07:14:17 -0500 (Thu, 10 Jan 2008)
New Revision: 5257
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
component is corrected
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-10 09:22:33 UTC (rev 5256)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-10 12:14:17 UTC (rev 5257)
@@ -81,6 +81,7 @@
.rich-combobox-item {
padding : 2px; white-space : nowrap;
+ width: 100%;
}
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-10 09:22:33 UTC (rev 5256)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-10 12:14:17 UTC (rev 5257)
@@ -74,6 +74,7 @@
<script type="text/javascript">
+
var combobox = new Richfaces.ComboBox( "#{clientId}",
"list#{clientId}",
"listParent#{clientId}",
17 years
JBoss Rich Faces SVN: r5256 - management/design/calendar/markup.
by richfaces-svn-commits@lists.jboss.org
Author: admitriev
Date: 2008-01-10 04:22:33 -0500 (Thu, 10 Jan 2008)
New Revision: 5256
Modified:
management/design/calendar/markup/calendar_div_year_chooser.html
Log:
Modified: management/design/calendar/markup/calendar_div_year_chooser.html
===================================================================
--- management/design/calendar/markup/calendar_div_year_chooser.html 2008-01-10 03:05:33 UTC (rev 5255)
+++ management/design/calendar/markup/calendar_div_year_chooser.html 2008-01-10 09:22:33 UTC (rev 5256)
@@ -314,6 +314,28 @@
.calendar_yc_split{
border-right : 1px solid #c0c0c0; /*panelBorderColor*/
}
+.calendar_yc_date{
+ width : 40px;
+ padding: 2px;
+ text-align : center;
+ border : 0px;
+}
+
+.calendar_yc_date_over{
+ width : 40px;
+ padding: 1px;
+ text-align : center;
+ border : 1px solid #C0C0C0; /*panelBorderColor*/
+ cursor : pointer;
+}
+.calendar_yc_date_press{
+ width : 40px;
+ padding: 1px;
+ text-align : center;
+ border : 1px solid #ff7800; /*calendarCurrentBackgroundColor*/
+ cursor : pointer;
+}
+
</style>
</head>
@@ -574,10 +596,10 @@
<table border="0" cellpadding="0" cellspacing="0" class="calendar_yc_layout">
<tr>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Jan</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Jan</div>
</td>
<td class="calendar_yc_cell calendar_yc_split">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Jul</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Jul</div>
</td>
<td class="calendar_yc_cell">
<div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">«</div>
@@ -588,72 +610,72 @@
</tr>
<tr>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Feb</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Feb</div>
</td>
<td class="calendar_yc_cell calendar_yc_split">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Aug</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Aug</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2001</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2001</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2006</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2006</div>
</td>
</tr>
<tr>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Mar</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Mar</div>
</td>
<td class="calendar_yc_cell calendar_yc_split">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Sep</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Sep</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2002</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2002</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn calendar_current" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn calendar_current'" onmousedown="this.className='calendar_yc_btn_press'">2007</div>
+ <div class="calendar_yc_date calendar_current">2007</div>
</td>
</tr>
<tr>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Apr</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Apr</div>
</td>
<td class="calendar_yc_cell calendar_yc_split">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Oct</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Oct</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2003</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2003</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2008</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2008</div>
</td>
</tr>
<tr>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">May</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">May</div>
</td>
<td class="calendar_yc_cell calendar_yc_split">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Nov</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Nov</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2004</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2004</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2009</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2009</div>
</td>
</tr>
<tr>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">Jun</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">Jun</div>
</td>
<td class="calendar_yc_cell calendar_yc_split">
- <div class="calendar_yc_btn calendar_current" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn calendar_current'" onmousedown="this.className='calendar_yc_btn_press'">Dec</div>
+ <div class="calendar_yc_date calendar_current">Dec</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2005</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2005</div>
</td>
<td class="calendar_yc_cell">
- <div class="calendar_yc_btn" onmouseover="this.className='calendar_yc_btn_over'" onmouseout="this.className='calendar_yc_btn'" onmousedown="this.className='calendar_yc_btn_press'">2010</div>
+ <div class="calendar_yc_date" onmouseover="this.className='calendar_yc_date_over calendar_spec'" onmouseout="this.className='calendar_yc_date'" onmousedown="this.className='calendar_yc_date_press calendar_current'">2010</div>
</td>
</tr>
<tr>
17 years
JBoss Rich Faces SVN: r5255 - in trunk/framework/impl/src/main: java/org/ajax4jsf/io/parser and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-01-09 22:05:33 -0500 (Wed, 09 Jan 2008)
New Revision: 5255
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
http://jira.jboss.com/jira/browse/RF-1627
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -27,8 +27,8 @@
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedHashSet;
-import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -444,6 +444,7 @@
}
requestMap.put(SCRIPTS_PARAMETER, scripts);
}
+
Set styles = viewResources.getStyles();
if (styles.size() > 0) {
if (log.isDebugEnabled()) {
@@ -457,6 +458,20 @@
}
requestMap.put(STYLES_PARAMETER, styles);
}
+
+ Set usersStyles = viewResources.getUserStyles();
+ if (usersStyles.size() > 0) {
+ if (log.isDebugEnabled()) {
+ StringBuffer buff = new StringBuffer(
+ "User styles for insert into head : \n");
+ for (Iterator iter = usersStyles.iterator(); iter.hasNext();) {
+ String style = (String) iter.next();
+ buff.append(style).append("\n");
+ }
+ log.debug(buff.toString());
+ }
+ requestMap.put(USER_STYLES_PARAMETER, usersStyles);
+ }
// Mark as processed.
requestMap.put(RESOURCES_PROCESSED, Boolean.TRUE);
// Save viewId for a parser selection
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/context/ViewResources.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -39,7 +39,7 @@
renderKit = rkFactory.getRenderKit(context, context
.getViewRoot().getRenderKitId());
processHeadResources(context, root);
- styles.addAll(userStyles);
+ //styles.addAll(userStyles);
scripts.addAll(userScripts);
}
@@ -156,6 +156,13 @@
return styles;
}
+ /**
+ * @return user styles
+ */
+ public Set getUserStyles() {
+ return userStyles;
+ }
+
public void addScript(String scriptUrl) {
scripts.add(scriptUrl);
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -50,6 +50,8 @@
private Set styles;
+ private Set userStyles;
+
private String encoding;
private String doctype;
@@ -62,7 +64,7 @@
boolean haveHtml = false;
boolean haveHead = false;
boolean closingElement = false;
- if (null != scripts || null != styles) {
+ if (null != scripts || null != styles || null != userStyles) {
ParsingStateManager stateManager = ParsingStateManager
.getInstance();
ParserState state = stateManager.getInitialState();
@@ -174,11 +176,21 @@
if (null != styles) {
for (Iterator iter = styles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
- out.write("<link rel='stylesheet' type='text/css' href='");
+ out.write("<link rel='stylesheet' class='" + COMPONENT_RESOURCE_LINK_CLASS + "'" +
+ " type='text/css' href='");
out.write(style);
out.write("' />");
}
}
+ if (null != userStyles) {
+ for (Iterator iter = userStyles.iterator(); iter.hasNext();) {
+ String style = (String) iter.next();
+ out.write("<link rel='stylesheet' class='" + USER_RESOURCE_LINK_CLASS + "'" +
+ " type='text/css' href='");
+ out.write(style);
+ out.write("' />");
+ }
+ }
if (null != scripts) {
for (Iterator iter = scripts.iterator(); iter.hasNext();) {
String script = (String) iter.next();
@@ -223,6 +235,21 @@
this.styles = styles;
}
+ /**
+ * @return Returns the user styles.
+ */
+ public Set getUserStyles() {
+ return userStyles;
+ }
+
+ /**
+ * @param styles
+ * The user styles to set.
+ */
+ public void setUserStyles(Set userStyles) {
+ this.userStyles = userStyles;
+ }
+
public void parseHtml(InputStream input, Writer output) throws IOException {
parse(new InputStreamReader(input, encoding), output);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseXMLFilter.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -293,6 +293,8 @@
.getAttribute(AjaxContext.SCRIPTS_PARAMETER));
parser.setStyles((Set) request
.getAttribute(AjaxContext.STYLES_PARAMETER));
+ parser.setUserStyles((Set) request
+ .getAttribute(AjaxContext.USER_STYLES_PARAMETER));
// Process parsing.
long startTimeMills = System.currentTimeMillis();
servletResponseWrapper.parseContent(output, parser);
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/HtmlParser.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -59,6 +59,11 @@
*/
public abstract void setStyles(Set styles);
+ /**
+ * @param styles The user styles to set
+ */
+ public abstract void setUserStyles(Set styles);
+
public abstract void setDoctype(String doctype);
/**
@@ -68,4 +73,7 @@
public abstract boolean setMime(String mimeType);
+ public static final String COMPONENT_RESOURCE_LINK_CLASS = "component";
+
+ public static final String USER_RESOURCE_LINK_CLASS = "user";
}
\ No newline at end of file
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -94,6 +94,8 @@
private Set _styles;
+ private Set _userStyles;
+
private String _viewState;
private String _encoding;
@@ -163,6 +165,7 @@
public void reset() {
_scripts = null;
_styles = null;
+ _userStyles = null;
_viewState = null;
_parser.reset();
_serializer.reset();
@@ -289,6 +292,10 @@
}
+ public void setUserStyles(Set styles) {
+ _userStyles = styles;
+ }
+
/*
* (non-Javadoc)
*
@@ -421,23 +428,37 @@
super.endElement(element, augs);
}
+ private void insertStyle(String style, String className) {
+ QName element = new QName(null, "link", "link", null);
+ XMLAttributes attrs = new XMLAttributesImpl();
+ attrs.addAttribute(new QName(null, "href", "href", null),
+ "CDATA", style);
+ attrs.addAttribute(new QName(null, "type", "type", null),
+ "CDATA", "text/css");
+ attrs.addAttribute(new QName(null, "rel", "rel", null),
+ "CDATA", "stylesheet");
+ attrs.addAttribute(new QName(null, "class", "class", null),
+ "CDATA", className);
+ Augmentations augs = new HTMLAugmentations();
+ super.emptyElement(element, attrs, augs);
+ }
+
private void insertResources() {
headParsed = true;
if (null != _styles) {
for (Iterator iter = _styles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
- QName element = new QName(null, "link", "link", null);
- XMLAttributes attrs = new XMLAttributesImpl();
- attrs.addAttribute(new QName(null, "href", "href", null),
- "CDATA", style);
- attrs.addAttribute(new QName(null, "type", "type", null),
- "CDATA", "text/css");
- attrs.addAttribute(new QName(null, "rel", "rel", null),
- "CDATA", "stylesheet");
- Augmentations augs = new HTMLAugmentations();
- super.emptyElement(element, attrs, augs);
+ insertStyle(style, COMPONENT_RESOURCE_LINK_CLASS);
}
}
+
+ if (null != _userStyles) {
+ for (Iterator iter = _userStyles.iterator(); iter.hasNext();) {
+ String style = (String) iter.next();
+ insertStyle(style, USER_RESOURCE_LINK_CLASS);
+ }
+ }
+
if (null != _scripts) {
for (Iterator iter = _scripts.iterator(); iter.hasNext();) {
String script = (String) iter.next();
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2008-01-10 03:05:33 UTC (rev 5255)
@@ -59,6 +59,8 @@
private Set _styles;
+ private Set _userStyles;
+
private String _viewState;
private String _encoding;
@@ -138,7 +140,7 @@
}
// Inserts scripts and styles to head.
- if (null != _scripts || null != _styles || null != _viewState) {
+ if (null != _scripts || null != _styles || null != _userStyles || null != _viewState) {
// find head
org.w3c.dom.Node head = documentElement
.getElementsByTagName("head").item(0);
@@ -168,9 +170,21 @@
style.setAttribute("type", "text/css");
style.setAttribute("rel", "stylesheet");
style.setAttribute("href", url);
+ style.setAttribute("class", COMPONENT_RESOURCE_LINK_CLASS);
head.insertBefore(style, child);
}
}
+ if (null != _userStyles) {
+ for (Iterator iter = _userStyles.iterator(); iter.hasNext();) {
+ String url = (String) iter.next();
+ Element style = document.createElement("link");
+ style.setAttribute("type", "text/css");
+ style.setAttribute("rel", "stylesheet");
+ style.setAttribute("href", url);
+ style.setAttribute("class", USER_RESOURCE_LINK_CLASS);
+ head.insertBefore(style, child);
+ }
+ }
// Scripts
if (null != _scripts) {
for (Iterator iter = _scripts.iterator(); iter
@@ -385,6 +399,10 @@
public void setStyles(Set styles) {
this._styles = styles;
}
+
+ public void setUserStyles(Set styles) {
+ this._userStyles = styles;
+ }
/*
* (non-Javadoc)
Modified: trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-10 03:02:51 UTC (rev 5254)
+++ trunk/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2008-01-10 03:05:33 UTC (rev 5255)
@@ -392,24 +392,58 @@
},
appendNewHeadElements : function(){
- // Append scripts and styles to head, if not presented in page before.
- this._appendNewElements("script","src",["type","language","charset"]);
- this._appendNewElements("link","href",["type","rel","rev","media"]);
+ // Append scripts and styles to head, if not presented in page before.
+ this._appendNewElements("script","src",null,null,["type","language","charset"]);
+ this._appendNewElements("link","href","class",["component","user"],["type","rel","rev","media"],{"class": "className"});
},
- _appendNewElements : function(tag,href,attributes){
+ _appendNewElements : function(tag,href,role,roles,attributes,mappings){
+ var head = document.getElementsByTagName("head")[0]||document.documentElement;
var newscripts = this.getElementsByTagName(tag);
var oldscripts = document.getElementsByTagName(tag);
- var head = document.getElementsByTagName("head")[0]||document.documentElement;
+ var mappedRole = (mappings && mappings[role]) || role;
+
+ var roleAnchors = {};
+ if (roles) {
+ var i = 0;
+
+ for(var j = 0; j < oldscripts.length; j++){
+ var oldscript = oldscripts[j];
+ var scriptRole = oldscript[mappedRole];
+
+ for ( ; i < roles.length && roles[i] != scriptRole; i++) {
+ roleAnchors[roles[i]] = oldscript;
+ }
+
+ if (i == roles.length) {
+ break;
+ }
+ }
+ }
+
for(var i=0 ; i<newscripts.length;i++){
var element = newscripts[i];
var src = element.getAttribute(href);
+ var elementRole;
+
+ if (roles) {
+ elementRole = element.getAttribute(role);
+ }
+
if(src){
var exist = false;
LOG.debug("<"+tag+"> in response with src="+src);
for(var j = 0 ; j < oldscripts.length; j++){
if(this._noSessionHref(src) == this._noSessionHref(oldscripts[j].getAttribute(href))){
LOG.debug("Such element exist in document");
+
+ if (role) {
+ var oldRole = oldscripts[j][mappedRole];
+ if ((!elementRole ^ !oldRole) || (elementRole && oldRole && elementRole != oldRole)) {
+ LOG.warn("Roles are different");
+ }
+ }
+
exist = true;
break;
}
@@ -421,8 +455,19 @@
for(var j = 0 ; j < attributes.length; j++){
this._copyAttribute(element,script,attributes[j]);
}
+
+ if (elementRole) {
+ script[mappedRole] = elementRole;
+ }
+
LOG.debug("append element to document");
- head.appendChild(script);
+
+ var anchor = roleAnchors[elementRole];
+ if (anchor && anchor.parentNode) {
+ anchor.parentNode.insertBefore(script, anchor);
+ } else {
+ head.appendChild(script);
+ }
}
}
}
17 years