JBoss Rich Faces SVN: r19135 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-08 09:40:08 -0400 (Wed, 08 Sep 2010)
New Revision: 19135
Removed:
branches/RFPL-754/
Log:
branch is now closed
14 years, 3 months
JBoss Rich Faces SVN: r19133 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-08 09:38:31 -0400 (Wed, 08 Sep 2010)
New Revision: 19133
Added:
branches/RF-7817/
Log:
Created branch for RF-7817
Copied: branches/RF-7817 (from rev 19132, trunk)
14 years, 3 months
JBoss Rich Faces SVN: r19132 - branches.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-08 09:19:22 -0400 (Wed, 08 Sep 2010)
New Revision: 19132
Removed:
branches/RF-7560/
Log:
branch is now closed
14 years, 3 months
JBoss Rich Faces SVN: r19131 - trunk.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-08 09:17:39 -0400 (Wed, 08 Sep 2010)
New Revision: 19131
Modified:
trunk/
Log:
Removed merge tracking for "svnmerge" for
https://svn.jboss.org/repos/richfaces/branches/RF-7560
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
- /branches/RF-7560:1-19125 /branches/RFPL-754:1-18909
+ /branches/RFPL-754:1-18909
14 years, 3 months
JBoss Rich Faces SVN: r19130 - trunk/ui/dist/richfaces-components-ui.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-08 09:11:16 -0400 (Wed, 08 Sep 2010)
New Revision: 19130
Modified:
trunk/ui/dist/richfaces-components-ui/pom.xml
Log:
RF-7560 - added richfaces-core-impl into ui distribution pom
Modified: trunk/ui/dist/richfaces-components-ui/pom.xml
===================================================================
--- trunk/ui/dist/richfaces-components-ui/pom.xml 2010-09-08 00:39:24 UTC (rev 19129)
+++ trunk/ui/dist/richfaces-components-ui/pom.xml 2010-09-08 13:11:16 UTC (rev 19130)
@@ -66,7 +66,6 @@
<artifactId>richfaces-ui-input-ui</artifactId>
</dependency>
- <!-- for javadoc generation -->
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-api</artifactId>
@@ -76,6 +75,10 @@
<artifactId>richfaces-core-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</dependency>
14 years, 3 months
JBoss Rich Faces SVN: r19128 - in branches/RF-8992/ui/input/ui/src/main: java/org/richfaces/renderkit and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-07 11:04:17 -0400 (Tue, 07 Sep 2010)
New Revision: 19128
Modified:
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
branches/RF-8992/ui/input/ui/src/main/templates/inplaceInput.template.xml
branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
Log:
add script encoding for th inplaeInput, fix InplaceIput script building
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-09-07 15:04:17 UTC (rev 19128)
@@ -26,10 +26,21 @@
public static final String COMPONENT_FAMILY = "org.richfaces.InplaceSelect";
+ @Attribute(defaultValue="250px")
+ public abstract String getListWidth();
+
+ @Attribute(defaultValue="100px")
+ public abstract String getListHeight();
+
@Attribute(defaultValue="InplaceState.ready")
public abstract InplaceState getState();
@Attribute
public abstract String getDefaultLabel();
-
+
+ @Attribute(defaultValue="false")
+ public abstract boolean isShowControls();
+
+ @Attribute(defaultValue="click")
+ public abstract String getEditEvent();
}
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-09-07 15:04:17 UTC (rev 19128)
@@ -36,7 +36,6 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractInplaceInput;
import org.richfaces.component.InplaceComponent;
import org.richfaces.component.InplaceState;
import org.richfaces.component.util.HtmlUtil;
@@ -161,32 +160,49 @@
}
public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
- AbstractInplaceInput inplaceInput = (AbstractInplaceInput)component;
- JSFunction function = new JSFunction("new RichFaces.ui.InplaceInput");
-
- String clientId = inplaceInput.getClientId(facesContext);
+ if(!(component instanceof InplaceComponent)) {
+ return;
+ }
+
+ String scriptName = getScriptName();
+ JSFunction function = new JSFunction(scriptName);
+ String clientId = component.getClientId(facesContext);
+ Map<String, Object> options = createInplaceComponentOptions(clientId, (InplaceComponent)component);
+ addToOptions(component, options);
+ function.addParameter(clientId);
+ function.addParameter(options);
+ writer.write(function.toString());
+ }
+
+ protected String getScriptName() {
+ return "new RichFaces.ui.InplaceInput";
+ }
+
+ private Map<String, Object> createInplaceComponentOptions(String clientId, InplaceComponent inplaceComponent) {
Map<String, Object> options = new HashMap<String, Object>();
- options.put(OPTIONS_EDIT_EVENT, inplaceInput.getEditEvent());
+ options.put(OPTIONS_EDIT_EVENT, inplaceComponent.getEditEvent());
options.put(OPTIONS_NONE_CSS, getNoneCss());
options.put(OPTIONS_CHANGED_CSS, getChangedStateCss());
options.put(OPTIONS_EDIT_CONTAINER, clientId + ":edit");
options.put(OPTIONS_INPUT, clientId + ":input");
options.put(OPTIONS_LABEL, clientId + ":label");
options.put(OPTIONS_FOCUS, clientId + ":focus");
- options.put(OPTIONS_DEFAULT_LABEL, inplaceInput.getDefaultLabel());
+ options.put(OPTIONS_DEFAULT_LABEL, inplaceComponent.getDefaultLabel());
+
+ boolean showControls = inplaceComponent.isShowControls();
- boolean showControls = inplaceInput.isShowControls();
options.put(OPTIONS_SHOWCONTROLS, showControls);
if(showControls) {
options.put(OPTIONS_BUTTON_OK, clientId + ":okbtn");
options.put(OPTIONS_BUTTON_CANCEL, clientId + ":cancelbtn");
- }
-
- function.addParameter(clientId);
- function.addParameter(options);
- writer.write(function.toString());
+ }
+ return options;
}
+ public void addToOptions(UIComponent component, Map<String, Object> parameters) {
+ //override this method if you need additional options
+ }
+
public String getReadyStateCss() {
return "rf-ii-d-s";
}
Modified: branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-09-07 15:04:17 UTC (rev 19128)
@@ -1,16 +1,21 @@
package org.richfaces.renderkit;
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import javax.faces.model.SelectItem;
-import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.ScriptString;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.util.InputUtils;
+import org.ajax4jsf.util.SelectUtils;
import org.richfaces.component.AbstractInplaceSelect;
@@ -23,23 +28,77 @@
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
@ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library="org.richfaces", name = "inplaceInput.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceSelect.js"),
@ResourceDependency(library="org.richfaces", name = "inplaceSelect.ecss") })
public class InplaceSelectBaseRenderer extends InplaceInputBaseRenderer {
+
+ protected static final class ClientSelectItem implements ScriptString {
+ private String label;
+ private String convertedValue;
+ public ClientSelectItem(String convertedValue, String label) {
+ super();
+ this.convertedValue = convertedValue;
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getConvertedValue() {
+ return convertedValue;
+ }
+
+ public void appendScript(StringBuffer functionString) {
+ functionString.append(this.toScript());
+ }
+
+ public String toScript() {
+ return "[" + ScriptUtils.toScript(label) + ", " + ScriptUtils.toScript(convertedValue) + "]";
+ }
+ }
+
@Override
- public void buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
+ protected String getScriptName() {
+ return "new RichFaces.ui.InplaceSelect";
+ }
+
+ public List<ClientSelectItem> getConvertedSelectItems(FacesContext facesContext, UIComponent component) {
AbstractInplaceSelect inplaceSelect = (AbstractInplaceSelect)component;
- JSFunction function = new JSFunction("new RichFaces.ui.InplaceSelect");
-
- String clientId = inplaceSelect.getClientId(facesContext);
- Map<String, Object> options = new HashMap<String, Object>();
-
- function.addParameter(clientId);
- function.addParameter(options);
- writer.write(function.toString());
+ List<SelectItem> selectItems = SelectUtils.getSelectItems(facesContext, inplaceSelect);
+ List<ClientSelectItem> clientSelectItems = new ArrayList<InplaceSelectBaseRenderer.ClientSelectItem>();
+ for (SelectItem selectItem: selectItems) {
+ String convertedStringValue = InputUtils.getConvertedStringValue(facesContext, inplaceSelect, selectItem.getValue());
+ String label = selectItem.getLabel();
+ clientSelectItems.add(new ClientSelectItem(convertedStringValue, label));
+ }
+ return clientSelectItems;
}
+ public void encodeOptions(FacesContext facesContext, UIComponent component, List<ClientSelectItem> clientSelectItems) throws IOException {
+ AbstractInplaceSelect inplaceSelect = (AbstractInplaceSelect)component;
+ if(clientSelectItems != null && !clientSelectItems.isEmpty()) {
+ ResponseWriter writer = facesContext.getResponseWriter();
+ for(ClientSelectItem clientSelectItem: clientSelectItems) {
+ writer.startElement(HTML.SPAN_ELEM, inplaceSelect);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, getOptionCss() , null);
+
+ String label = clientSelectItem.getLabel();
+
+ if(label != null && label.trim().length() > 0) {
+ writer.writeText(label, null);
+ } else {
+ writer.write("\u00a0");
+ }
+ writer.endElement(HTML.SPAN_ELEM);
+ writer.startElement("br", inplaceSelect);
+ writer.endElement("br");
+ }
+ }
+ }
+
public String getListStyles(FacesContext facesContext, UIComponent component) {
return "";
}
@@ -59,4 +118,9 @@
public String getNoneCss() {
return "rf-is-none";
}
+
+ public String getOptionCss() {
+ return "insel_option insel_font";
+ }
+
}
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-09-07 15:04:17 UTC (rev 19128)
@@ -28,7 +28,7 @@
$super.constructor.call(this, id);
this.attachToDom(id);
- this.namespace = this.namespace || "." + rf.Event.createNamespace(this.name, this.id);
+ this.namespace = this.getNamespace() || "." + rf.Event.createNamespace(this.getName(), this.id);
this.currentState = options.state;
this.editEvent = options.editEvent;
@@ -63,7 +63,7 @@
};
// Extend component class and add protected methods from parent class to our container
- rf.BaseComponent.extend( rf.ui.InplaceInput);
+ rf.BaseComponent.extend(rf.ui.InplaceInput);
// define super class link
var $super = rf.ui.InplaceInput.$super;
@@ -78,6 +78,10 @@
/****************** public methods *****************************************/
+ getName: function() {
+ return this.name;
+ },
+
getNamespace: function () {
return this.namespace;
},
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-09-07 15:04:17 UTC (rev 19128)
@@ -22,7 +22,7 @@
display : inline-block;
position : relative;
white-space : nowrap;
- background-color : '#{richSkin.editBackgroundColor}';
+ background-color : '#{richSkin.editorBackgroundColor}';
border-bottom-width : 1px;
border-bottom-style : dashed;
border-bottom-color : '#{richSkin.generalTextColor}';
@@ -41,7 +41,6 @@
top : 0px;
left : 0px;
width : 100px;
- display : inline-block;
}
.insel_field {
@@ -111,7 +110,6 @@
.insel_list_scroll {
overflow : auto;
overflow-x : hidden;
- height : 100px;
display: inline-block;
width: 100%;
}
@@ -134,10 +132,6 @@
border-color : '#{richSkin.generalTextColor}';
}
-.insel_width_list {
- width : 250px;
-}
-
.insel_select {
padding : 1px;
width : 100%;
Modified: branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-09-07 15:04:17 UTC (rev 19128)
@@ -2,8 +2,19 @@
rf.ui = rf.ui || {};
- rf.ui.InplaceSelect = function(id, options) {
-
- }
+ rf.ui.InplaceSelect = function(id, options) {
+ $super.constructor.call(this, id, options);
+ }
+
+ rf.ui.InplaceInput.extend(rf.ui.InplaceSelect);
+ var $super = rf.ui.InplaceSelect.$super;
+
+ $.extend(rf.ui.InplaceSelect.prototype, function () {
+
+ return{
+ name : "inplaceSelect"
+ }
+ })
+
})(jQuery, window.RichFaces);
Modified: branches/RF-8992/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-09-07 15:04:17 UTC (rev 19128)
@@ -49,8 +49,7 @@
<input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-ii-none"/>
<span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
<input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
- type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-f" style="width: #{component.attributes['inputWidth']};"
- cdk:passThrough="tabIndex">
+ type="text" value="#{getInputValue(facesContext, component)}" class="rf-ii-f" style="width: #{component.attributes['inputWidth']};" cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);"/>
</input>
<c:if test="#{component.attributes['showControls']}">
Modified: branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-07 15:02:31 UTC (rev 19127)
+++ branches/RF-8992/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-09-07 15:04:17 UTC (rev 19128)
@@ -34,6 +34,9 @@
<cdk:object type="java.lang.String" name="inplaceValue"
value="#{getValue(facesContext, component)}" />
+ <cdk:object type="java.util.List" type-arguments="InplaceSelectBaseRenderer.ClientSelectItem" name="clientSelectItems"
+ value="#{getConvertedSelectItems(facesContext, component)}" />
+
<span id="#{clientId}" class="#{getReadyStyleClass(component, inplaceState)}"
cdk:passThroughWithExclusions="id class">
@@ -43,19 +46,17 @@
<input id="#{clientId}:focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
- <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}"
- style="display: inline-block;">
+ <span id="#{clientId}:edit" class="#{getEditStyleClass(component, inplaceState)}">
<input id="#{clientId}:input" autocomplete="off" name="#{clientId}"
type="text" value="#{getInputValue(facesContext, component)}"
- class="insel_field" style="width: #{component.attributes['inputWidth']};"
- cdk:passThrough="tabIndex" readonly="readonly">
+ class="insel_field" style="width: #{component.attributes['inputWidth']};" readonly="readonly"
+ cdk:passThrough="tabIndex">
<cdk:call expression="renderInputHandlers(facesContext, component);" />
</input>
<c:if test="#{component.attributes['showControls']}">
<span class="insel_btn_preposition">
<span class="insel_btn_position">
<span id="#{clientId}:btnshadow" class="insel_shadow">
-
<span class="insel_shadow_t"></span>
<span class="insel_shadow_l"></span>
<span class="insel_shadow_r"></span>
@@ -72,29 +73,21 @@
onmouseout="this.className='insel_btn_press'" onmouseup="this.className='insel_btn'" />
<br />
</span>
-
</span>
</span>
</span>
</c:if>
<br/>
<span class="insel_list_cord">
- <span class="insel_list_position insel_width_list">
+ <span class="insel_list_position" style="width: #{component.attributes['listWidth']}">
<span class="insel_shadow">
<span class="insel_shadow_t"></span>
<span class="insel_shadow_l"></span>
<span class="insel_shadow_r"></span>
<span class="insel_shadow_b"></span>
<span class="insel_list_decoration">
- <span class="insel_list_scroll">
- <span class="insel_option insel_font">Option 1</span>
- <br/>
- <span class="insel_option insel_font">Option 2</span>
- <br/>
- <span class="insel_option insel_font">Option 3</span>
- <br/>
- <span class="insel_option insel_font">Option 4</span>
- <br/>
+ <span class="insel_list_scroll" style="height: #{component.attributes['listHeight']}">
+ <cdk:call expression="encodeOptions(facesContext, component, clientSelectItems);"/>
</span>
</span>
</span>
14 years, 3 months
JBoss Rich Faces SVN: r19127 - branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-09-07 11:02:31 -0400 (Tue, 07 Sep 2010)
New Revision: 19127
Modified:
branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
Log:
add common inplace component methods
Modified: branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
===================================================================
--- branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-09-07 10:01:04 UTC (rev 19126)
+++ branches/RF-8992/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-09-07 15:02:31 UTC (rev 19127)
@@ -1,8 +1,14 @@
package org.richfaces.component;
+
public interface InplaceComponent {
public String getDefaultLabel();
+ public String getEditEvent();
+
+ public boolean isShowControls();
+
public InplaceState getState();
+
}
14 years, 3 months
JBoss Rich Faces SVN: r19126 - trunk.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-07 06:01:04 -0400 (Tue, 07 Sep 2010)
New Revision: 19126
Modified:
trunk/
Log:
Initialized merge tracking via "svnmerge" with revisions "1-19038" from
https://svn.jboss.org/repos/richfaces/branches/RF-7560
Property changes on: trunk
___________________________________________________________________
Name: svnmerge-integrated
- /branches/RFPL-754:1-18909
+ /branches/RF-7560:1-19038 /branches/RFPL-754:1-18909
14 years, 3 months
JBoss Rich Faces SVN: r19125 - in branches/RF-7560: core/impl/src/main/java/org/richfaces/resource and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-09-06 21:08:23 -0400 (Mon, 06 Sep 2010)
New Revision: 19125
Modified:
branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java
branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
Log:
RF-7560
Modified: branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java
===================================================================
--- branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java 2010-09-07 00:16:57 UTC (rev 19124)
+++ branches/RF-7560/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java 2010-09-07 01:08:23 UTC (rev 19125)
@@ -22,7 +22,6 @@
package org.richfaces.cdk.resource.handler.impl;
import static org.richfaces.cdk.strings.Constants.DASH_JOINER;
-import static org.richfaces.cdk.strings.Constants.DOT_JOINER;
import static org.richfaces.cdk.strings.Constants.SLASH_JOINER;
import java.io.IOException;
@@ -92,38 +91,6 @@
throw new UnsupportedOperationException();
}
- private String getMangledLibraryName() {
- String resourceName = getResourceName();
- if (Strings.isNullOrEmpty(getLibraryName()) && !resourceName.endsWith(ECSS_EXTENSION)) {
- int idx = resourceName.lastIndexOf('.');
- if (idx < 0) {
- return null;
- } else {
- return resourceName.substring(0, idx);
- }
- }
-
- return getLibraryName();
- }
-
- private String getMangledResourceName() {
- String resourceName = getResourceName();
- if (resourceName.endsWith(ECSS_EXTENSION)) {
- return resourceName.substring(0, resourceName.length() - ECSS_EXTENSION.length());
- }
-
- if (Strings.isNullOrEmpty(getLibraryName())) {
- int idx = resourceName.lastIndexOf('.');
- if (idx < 0) {
- return resourceName;
- } else {
- return resourceName.substring(idx + 1);
- }
- } else {
- return resourceName;
- }
- }
-
private FileNameMapper getFileNameMapper() {
return ServiceTracker.getService(FileNameMapper.class);
}
@@ -138,12 +105,30 @@
@Override
public String getRequestPath() {
- String mangledLibraryName = getMangledLibraryName();
- String mangledResourceName = getMangledResourceName();
String resourceExtension = getResourceExtension();
+
+ String resourceName = getResourceName();
+ if (resourceName.endsWith(ECSS_EXTENSION)) {
+ resourceName = resourceName.substring(0, resourceName.length() - ECSS_EXTENSION.length());
+ } else {
+ if (resourceExtension != null && resourceName.endsWith(resourceExtension)) {
+ resourceName = resourceName.substring(0, resourceName.length() - resourceExtension.length());
+ }
+ }
- String resourceName = DOT_JOINER.join(DASH_JOINER.join(mangledResourceName, getVersion()), resourceExtension);
- String resourcePath = SLASH_JOINER.join(mangledLibraryName, resourceName);
+ String libraryName = getLibraryName();
+
+ if (Strings.isNullOrEmpty(libraryName)) {
+ int idx = resourceName.lastIndexOf('.');
+
+ if (idx >= 0) {
+ libraryName = resourceName.substring(0, idx);
+ resourceName = resourceName.substring(idx + 1);
+ }
+ }
+
+ String versionedName = DASH_JOINER.join(resourceName, getVersion()) + Strings.nullToEmpty(resourceExtension);
+ String resourcePath = SLASH_JOINER.join(libraryName, versionedName);
return ResourceFactory.SKINNED_RESOURCE_PREFIX + getFileNameMapper().createName(resourcePath);
}
@@ -167,7 +152,7 @@
if (contentType.startsWith("text/") || contentType.startsWith("image/")) {
String[] split = contentType.split("/");
if (split.length == 2) {
- return split[1];
+ return '.' + split[1];
}
}
Modified: branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java
===================================================================
--- branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-09-07 00:16:57 UTC (rev 19124)
+++ branches/RF-7560/core/impl/src/main/java/org/richfaces/resource/ResourceFactoryImpl.java 2010-09-07 01:08:23 UTC (rev 19125)
@@ -309,7 +309,7 @@
}
String libraryName = resourceData.getLibraryName();
- Resource resource = createDynamicResource(new ResourceKey(resourceName, libraryName));
+ Resource resource = createDynamicResource(new ResourceKey(resourceName, libraryName), false);
if (resource == null) {
logMissingResource(context, resourceData.getResourceKey());
@@ -355,28 +355,32 @@
return externalStaticResourceFactory.createResource();
}
- return createDynamicResource(resourceKey);
+ return createDynamicResource(resourceKey, true);
}
- protected Resource createDynamicResource(ResourceKey resourceKey) {
+ protected Resource createDynamicResource(ResourceKey resourceKey, boolean useDependencyInjection) {
Resource result = null;
- Map<String, String> params;
+ Map<String, String> params = null;
MappedResourceData mappedResourceData = mappedResourceDataMap.get(resourceKey);
ResourceKey actualKey;
if (mappedResourceData != null) {
actualKey = mappedResourceData.getResourceKey();
- params = mappedResourceData.getParams();
+ if (useDependencyInjection) {
+ params = mappedResourceData.getParams();
+ }
} else {
actualKey = resourceKey;
- params = Collections.<String, String>emptyMap();
+ if (useDependencyInjection) {
+ params = Collections.<String, String>emptyMap();
+ }
}
-
+
if (Strings.isNullOrEmpty(resourceKey.getResourceName())) {
return null;
}
-
+
if (actualKey.getResourceName().endsWith(".ecss")) {
// TODO nick - params?
result = createCompiledCSSResource(actualKey);
14 years, 3 months