Author: alexsmirnov
Date: 2011-01-25 19:52:53 -0500 (Tue, 25 Jan 2011)
New Revision: 21226
Added:
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/ok.png
Modified:
trunk/core/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/NULL.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/classic.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/ruby.skin.properties
trunk/core/impl/src/main/resources/META-INF/skins/wine.skin.properties
trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss
trunk/ui/validator/ui/src/main/templates/message.template.xml
Log:
CODING IN PROGRESS - issue RF-10064: Finish rich:message HTML design
https://issues.jboss.org/browse/RF-10064
Modified: trunk/core/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/DEFAULT.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -78,6 +78,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/NULL.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/NULL.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/NULL.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -72,6 +72,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -70,6 +70,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/classic.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/classic.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/classic.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -70,6 +70,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
===================================================================
---
trunk/core/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++
trunk/core/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -74,6 +74,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
===================================================================
---
trunk/core/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++
trunk/core/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -71,6 +71,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
===================================================================
---
trunk/core/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++
trunk/core/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -72,6 +72,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/plain.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -69,5 +69,7 @@
warningColor=#{null}
warningBackgroundColor=#{null}
+errorColor=#{null}
+
editorBackgroundColor=#{null}
editBackgroundColor=#{null}
\ No newline at end of file
Modified: trunk/core/impl/src/main/resources/META-INF/skins/ruby.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -69,6 +69,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified: trunk/core/impl/src/main/resources/META-INF/skins/wine.skin.properties
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/skins/wine.skin.properties 2011-01-25
19:14:02 UTC (rev 21225)
+++ trunk/core/impl/src/main/resources/META-INF/skins/wine.skin.properties 2011-01-26
00:52:53 UTC (rev 21226)
@@ -71,6 +71,8 @@
warningColor=#FFE6E6
warningBackgroundColor=#FF0000
+errorColor=#FF0000
+
editorBackgroundColor=#F1F1F1
editBackgroundColor=#FEFFDA
Modified:
trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java
===================================================================
---
trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2011-01-25
19:14:02 UTC (rev 21225)
+++
trunk/ui/validator/ui/src/main/java/org/richfaces/renderkit/MessageRendererBase.java 2011-01-26
00:52:53 UTC (rev 21226)
@@ -29,6 +29,7 @@
import javax.faces.application.FacesMessage;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.component.UIComponent;
+import javax.faces.component.UIMessage;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;
@@ -55,15 +56,10 @@
*/
public class MessageRendererBase extends Renderer {
- private static final ImmutableMap<Severity, SeverityAttributes> SEVERITY_MAP =
ImmutableMap
- .of(FacesMessage.SEVERITY_INFO,
- attrs("info", "inf", null),
- FacesMessage.SEVERITY_WARN,
- attrs("warn","wrn", null),
- FacesMessage.SEVERITY_ERROR,
- attrs("error","err", null),
- FacesMessage.SEVERITY_FATAL,
- attrs("fatal","ftl",null));
+ private static final ImmutableMap<Severity, SeverityAttributes> SEVERITY_MAP =
ImmutableMap.of(
+ FacesMessage.SEVERITY_INFO, attrs("info", "inf", null),
FacesMessage.SEVERITY_WARN, attrs("warn", "wrn", null),
+ FacesMessage.SEVERITY_ERROR, attrs("error", "err", null),
FacesMessage.SEVERITY_FATAL,
+ attrs("fatal", "ftl", null));
protected Iterator<FacesMessage> getMessages(FacesContext context, String
forClientId, UIComponent component) {
@@ -92,7 +88,10 @@
}
/**
- * <p class="changed_added_4_0">TODO - make Generator aware of
Iterator.</p>
+ * <p class="changed_added_4_0">
+ * TODO - make Generator aware of Iterator.
+ * </p>
+ *
* @param context
* @param component
* @return
@@ -126,54 +125,81 @@
protected void encodeMessage(FacesContext facesContext, UIComponent component, Object
msg) throws IOException {
// TODO fix generator to properly detect iteration variable type
FacesMessage message = (FacesMessage) msg;
+ UIMessage uiMessage = (UIMessage) component;
ResponseWriter responseWriter = facesContext.getResponseWriter();
- responseWriter.writeText(message.getSummary(),"value");
+ // tooltip
+ boolean wroteTooltip =
Boolean.TRUE.equals(uiMessage.getAttributes().get("tooltip"));
+ String summary = message.getSummary();
+ if(wroteTooltip && !Strings.isNullOrEmpty(summary)){
+ responseWriter.writeAttribute("title", summary,null);
+ }
+ if (!wroteTooltip && uiMessage.isShowSummary()) {
+ writeMessageLabel(responseWriter, summary, "rf-msg-sum");
+ }
+ if (uiMessage.isShowDetail()) {
+ writeMessageLabel(responseWriter, message.getDetail(),
"rf-msg-des");
+ }
}
+ private void writeMessageLabel(ResponseWriter responseWriter, String label, String
styleClass) throws IOException {
+ if (!Strings.isNullOrEmpty(label)) {
+ responseWriter.startElement("span", null);
+ responseWriter.writeAttribute("class", styleClass, null);
+ responseWriter.writeText(label, null);
+ responseWriter.endElement("span");
+ }
+ }
+
protected void encodeScript(FacesContext facesContext, UIComponent component) throws
IOException {
JavaScriptService javaScriptService =
ServiceTracker.getService(JavaScriptService.class);
JSFunction messageObject = new JSObject("RichFaces.ui.Message",
component.getClientId(facesContext));
String forId = (String) component.getAttributes().get("for");
- if(!Strings.isNullOrEmpty(forId)){
+ if (!Strings.isNullOrEmpty(forId)) {
UIComponent target = RendererUtils.getInstance().findComponentFor(component,
forId);
- if(null != target){
- messageObject.addParameter(ImmutableMap.<String,
String>of("forComponentId",target.getClientId(facesContext)));
+ if (null != target) {
+ messageObject.addParameter(ImmutableMap.<String, String>
of("forComponentId",
+ target.getClientId(facesContext)));
}
}
-// RendererUtils.getInstance().writeScript(facesContext, component,
messageObject);
+ // RendererUtils.getInstance().writeScript(facesContext, component,
messageObject);
javaScriptService.addPageReadyScript(facesContext, messageObject);
}
-
- protected String getMsgClass(FacesContext facesContext, UIComponent component, Object
msg) throws IOException{
+
+ protected String getMsgClass(FacesContext facesContext, UIComponent component, Object
msg) throws IOException {
FacesMessage message = (FacesMessage) msg;
SeverityAttributes severityAttributes = SEVERITY_MAP.get(message.getSeverity());
- String styleClass = buildSeverityAttribute(component,
severityAttributes.skinClass, severityAttributes.classAttribute, ' ');
+ String styleClass =
+ buildSeverityAttribute(component, severityAttributes.skinClass,
severityAttributes.classAttribute, ' ');
return styleClass;
}
-
- protected String getMsgStyle(FacesContext facesContext, UIComponent component, Object
msg) throws IOException{
+
+ protected String getMsgStyle(FacesContext facesContext, UIComponent component, Object
msg) throws IOException {
FacesMessage message = (FacesMessage) msg;
SeverityAttributes severityAttributes = SEVERITY_MAP.get(message.getSeverity());
- String style = buildSeverityAttribute(component, severityAttributes.skinStyle,
severityAttributes.styleAttribute, ';');
+ String style =
+ buildSeverityAttribute(component, severityAttributes.skinStyle,
severityAttributes.styleAttribute, ';');
return style;
}
private String buildSeverityAttribute(UIComponent component, String skinValue, String
attrName, char delimiter) {
StringBuilder style = new StringBuilder();
- if(null != skinValue){
- style.append(skinValue).append(delimiter);
+ if (!Strings.isNullOrEmpty(skinValue)) {
+ style.append(skinValue);
}
Object componentStyle = component.getAttributes().get(attrName);
- if(null != componentStyle){
+ if (null != componentStyle &&
!Strings.isNullOrEmpty(componentStyle.toString())) {
+ if (!Strings.isNullOrEmpty(skinValue)) {
+ style.append(delimiter);
+ }
style.append(componentStyle);
}
return style.toString();
}
- static SeverityAttributes attrs(String attPrefix, String skinSuffix,String skinStyle)
{
+ static SeverityAttributes attrs(String attPrefix, String skinSuffix, String
skinStyle) {
SeverityAttributes attrs =
- new SeverityAttributes(attPrefix+"Style",
attPrefix+"Class", "rf-msg-"+skinSuffix, skinStyle,
- null, null);
+ new SeverityAttributes(attPrefix + "Style", attPrefix +
"Class", "rf-msg-" + skinSuffix, skinStyle, null,
+ null);
return attrs;
}
Modified:
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss
===================================================================
---
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss 2011-01-25
19:14:02 UTC (rev 21225)
+++
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/msg.ecss 2011-01-26
00:52:53 UTC (rev 21226)
@@ -1,14 +1,46 @@
+ /*--- RF Message styles ---*/
.rf-msg {
+
font-family:'#{richSkin.generalFamilyFont}';/*generalFamilyFont*/
+ font-size:'#{richSkin.generalSizeFont}';/*generalSizeFont*/
+ height:18ex;
+ }
+ /* all messages */
+.rf-msg-err, rf-msg-ftl, rf-msg-inf, rf-msg-wrn {
+ display:inline-block;
+ padding-right:2px;
+ padding-left:20px;
+ vertical-align:middle;
+ background-repeat:no-repeat;
+ background-position:left center ;
}
+
.rf-msg-err {
- list-style-image: url(#{resource['org.richfaces:error.png']});
+ background-image: url(#{resource['org.richfaces:error.png']});
+ color:'#{richSkin.errorColor}';
}
.rf-msg-ftl {
- list-style-image: url(#{resource['org.richfaces:error.png']});
+ background-image: url(#{resource['org.richfaces:fatal.png']});
+ color:'#{richSkin.errorColor}';
}
.rf-msg-inf {
- list-style-image: url(#{resource['org.richfaces:error.png']});
+ background-image: url(#{resource['org.richfaces:info.png']});
+ color:'#{richSkin.generalTextColor}';
}
-.rf-msg-ftl {
- list-style-image: url(#{resource['org.richfaces:error.png']});
-}
\ No newline at end of file
+.rf-msg-wrn {
+ background-image: url(#{resource['org.richfaces:warning.png']});
+ color:'#{richSkin.warningColor}';
+}
+.rf-msg-ok {
+ background-image: url(#{resource['org.richfaces:ok.png']});
+ color:'#{richSkin.generalTextColor}';
+ width:20px;
+ display:inline-block;
+ vertical-align:middle;
+ background-repeat:no-repeat;
+ background-position:left center ;
+}
+
+.rf-msg-sum{ /*Summary*/
+}
+.rf-msg-des{ /*Description*/
+}
Added: trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/ok.png
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/ok.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/ui/validator/ui/src/main/templates/message.template.xml
===================================================================
--- trunk/ui/validator/ui/src/main/templates/message.template.xml 2011-01-25 19:14:02 UTC
(rev 21225)
+++ trunk/ui/validator/ui/src/main/templates/message.template.xml 2011-01-26 00:52:53 UTC
(rev 21226)
@@ -20,19 +20,21 @@
<cdk:superclass>org.richfaces.renderkit.MessageRendererBase</cdk:superclass>
<cdk:component-family>javax.faces.Message</cdk:component-family>
<cdk:renderer-type>org.richfaces.MessageRenderer</cdk:renderer-type>
+ <cdk:resource-dependency library="org.richfaces"
+ name="msg.ecss" />
<cdk:resource-dependency library="org.richfaces"
name="message.reslib" />
</cc:interface>
<cc:implementation>
- <ul id="#{clientId}" class="rf-msg
#{component.attributes['styleClass']}"
+ <span id="#{clientId}" class="rf-msg
#{component.attributes['styleClass']}"
cdk:passThroughWithExclusions="id class">
<c:forEach var="msg"
items="#{getVisibleMessages(facesContext,component)}">
- <li class="#{getMsgClass(facesContext,component,msg)}"
style="#{getMsgStyle(facesContext,component,msg)}">
+ <span class="#{getMsgClass(facesContext,component,msg)}"
style="#{getMsgStyle(facesContext,component,msg)}">
<cdk:call>encodeMessage(facesContext,component,msg)</cdk:call>
- </li>
+ </span>
</c:forEach>
<cdk:call>encodeScript(facesContext,component)</cdk:call>
- </ul>
+ </span>
</cc:implementation>
</cdk:root>