You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/10/09 16:01:52 UTC
svn commit: r1707730 [1/2] - in /myfaces/tobago/branches/tobago-3.0.x:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/
tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/
tobago-core/src/main/java/org/apache/myfaces...
Author: lofwyr
Date: Fri Oct 9 14:01:50 2015
New Revision: 1707730
URL: http://svn.apache.org/viewvc?rev=1707730&view=rev
Log:
TOBAGO-1489: Refactoring: using enums (also for attributes in taglib)
Added:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/MarkupLanguageAttributes.java
Modified:
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterWrapper.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/XmlResponseWriter.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LinkRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeCommandRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIconRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeMenuNodeRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeNodeRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/DebugResponseWriterWrapper.java Fri Oct 9 14:01:50 2015
@@ -20,6 +20,7 @@
package org.apache.myfaces.tobago.internal.webapp;
import org.apache.myfaces.tobago.internal.util.StringUtils;
+import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,14 +73,22 @@ public class DebugResponseWriterWrapper
responseWriter.writeText(text, property);
}
+ @Override
public void flush() throws IOException {
responseWriter.flush();
}
- public void writeAttribute(final String name, final String value, final boolean escape) throws IOException {
+ @Override
+ public void writeAttribute(final MarkupLanguageAttributes name, final String value, final boolean escape)
+ throws IOException {
responseWriter.writeAttribute(name, value, escape);
}
+ @Override
+ public void writeURIAttribute(MarkupLanguageAttributes name, String string) throws IOException {
+ responseWriter.writeURIAttribute(name, string);
+ }
+
public String getContentType() {
return responseWriter.getContentType();
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/JsonResponseWriter.java Fri Oct 9 14:01:50 2015
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.internal.util.FastStringWriter;
import org.apache.myfaces.tobago.internal.util.JavascriptWriterUtils;
import org.apache.myfaces.tobago.internal.util.StringUtils;
+import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
import org.apache.myfaces.tobago.util.FacesVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -134,7 +135,7 @@ public class JsonResponseWriter extends
@Override
protected void writeAttributeInternal(
- final Writer writer, final String name, final String value, final boolean escape)
+ final Writer writer, final MarkupLanguageAttributes name, final String value, final boolean escape)
throws IOException {
if (!isStartStillOpen()) {
final String trace = getCallingClassStackTraceElementString();
@@ -148,7 +149,7 @@ public class JsonResponseWriter extends
if (value != null) {
writer.write(' ');
- writer.write(name);
+ writer.write(name.getValue());
writer.write("='");
if (escape) {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java Fri Oct 9 14:01:50 2015
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.internal.util.Deprecation;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -231,13 +232,17 @@ public abstract class TobagoResponseWrit
write("-->");
}
-
-
+ @Deprecated
public void writeAttribute(final String name, final Object value, final String property)
throws IOException {
final String attribute = findValue(value, property);
- writeAttribute(name, attribute, true);
+ writeAttribute(new MarkupLanguageAttributes() {
+ @Override
+ public String getValue() {
+ return name;
+ }
+ }, attribute, true);
}
protected final String getCallingClassStackTraceElementString() {
@@ -259,11 +264,19 @@ public abstract class TobagoResponseWrit
// interface TobagoResponseWriter //////////////////////////////////////////////////////////////////////////////////
- public void writeAttribute(final String name, final String value, final boolean escape)
+ public void writeAttribute(final MarkupLanguageAttributes name, final String value, final boolean escape)
throws IOException {
writeAttributeInternal(writer, name, value, escape);
}
+ public void writeURIAttribute(final MarkupLanguageAttributes name, final String value)
+ throws IOException {
+ if (value != null) {
+ final URI uri = URI.create(value);
+ writeAttribute(name, uri.toASCIIString(), true);
+ }
+ }
+
/**
* @deprecated since Tobago 1.5.0
*/
@@ -290,7 +303,7 @@ public abstract class TobagoResponseWrit
protected abstract void closeEmptyTag() throws IOException;
protected void writeAttributeInternal(
- final Writer writer, final String name, final String value, final boolean escape)
+ final Writer writer, final MarkupLanguageAttributes name, final String value, final boolean escape)
throws IOException {
if (!startStillOpen) {
final String trace = getCallingClassStackTraceElementString();
@@ -304,7 +317,7 @@ public abstract class TobagoResponseWrit
if (value != null) {
writer.write(' ');
- writer.write(name);
+ writer.write(name.getValue());
writer.write("='");
writerAttributeValue(value, escape);
writer.write('\'');
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterWrapper.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterWrapper.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterWrapper.java Fri Oct 9 14:01:50 2015
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.internal.webapp;
+import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -69,8 +70,9 @@ public class TobagoResponseWriterWrapper
responseWriter.flush();
}
- public void writeAttribute(final String name, final String value, final boolean escape) throws IOException {
- responseWriter.writeAttribute(name, value, null);
+ public void writeAttribute(final MarkupLanguageAttributes name, final String value, final boolean escape)
+ throws IOException {
+ responseWriter.writeAttribute(name.getValue(), value, null);
}
public String getContentType() {
@@ -93,6 +95,11 @@ public class TobagoResponseWriterWrapper
responseWriter.writeURIAttribute(name, value, property);
}
+ @Override
+ public void writeURIAttribute(MarkupLanguageAttributes name, String string) throws IOException {
+ responseWriter.writeURIAttribute(name.getValue(), string, null);
+ }
+
public void writeText(final char[] text, final int off, final int len) throws IOException {
responseWriter.writeText(text, off, len);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/XmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/XmlResponseWriter.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/XmlResponseWriter.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/XmlResponseWriter.java Fri Oct 9 14:01:50 2015
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.internal.webapp;
+import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.util.XmlUtils;
@@ -81,7 +82,7 @@ public final class XmlResponseWriter ext
getWriter().write(XHTML_DOCTYPE);
getWriter().write('\n');
startElement(HtmlElements.HTML, null);
- writeAttribute("xmlns", "http://www.w3.org/1999/xhtml", false);
+ writeAttribute(HtmlAttributes.XMLNS, "http://www.w3.org/1999/xhtml", false);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/Aria.java Fri Oct 9 14:01:50 2015
@@ -19,7 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html;
-public enum Aria {
+public enum Aria implements MarkupLanguageAttributes {
ACTIVEDESCENDANT("aria-activedescendant"),
ATOMIC("aria-atomic"),
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java Fri Oct 9 14:01:50 2015
@@ -24,7 +24,7 @@ package org.apache.myfaces.tobago.render
* These attributes may transport data to DOM which are not standardized.
* The format is "data-tobago-*" which is conform to HTML 5, but also works in older browsers.
*/
-public enum DataAttributes {
+public enum DataAttributes implements MarkupLanguageAttributes {
/**
* The index of the column of a sheet. This index means the position of the rendered column. It can differ, if there
@@ -85,6 +85,11 @@ public enum DataAttributes {
/**
* Defines a maximum value.
*/
+ LAYOUT("data-tobago-layout"),
+
+ /**
+ * Defines a maximum value.
+ */
MAX("data-tobago-max"),
/**
@@ -150,6 +155,10 @@ public enum DataAttributes {
*/
STYLE("data-tobago-style"),
+ SCROLL_PANEL("data-tobago-scroll-panel"),
+
+ SCROLL_POSITION("data-tobago-scroll-position"),
+
SUGGEST_DATA("data-tobago-suggest-data"),
SUGGEST_DELAY("data-tobago-suggest-delay"),
@@ -199,4 +208,14 @@ public enum DataAttributes {
public String getValue() {
return value;
}
+
+ public static MarkupLanguageAttributes dynamic(final String withoutPrefix) {
+ return new MarkupLanguageAttributes() {
+ @Override
+ public String getValue() {
+ return "data-" + withoutPrefix;
+ }
+ };
+ }
+
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Fri Oct 9 14:01:50 2015
@@ -19,107 +19,120 @@
package org.apache.myfaces.tobago.renderkit.html;
-public final class HtmlAttributes {
+public enum HtmlAttributes implements MarkupLanguageAttributes {
- public static final String ACCEPT_CHARSET = "accept-charset";
- public static final String ACCEPT = "accept";
- public static final String ACCESSKEY = "accesskey";
- public static final String ACTION = "action";
- public static final String ALIGN = "align";
- public static final String ALT = "alt";
- public static final String AUTOCOMPLETE = "autocomplete";
- public static final String AUTOFOCUS = "autofocus";
- public static final String BORDER = "border";
- public static final String CELLPADDING = "cellpadding";
- public static final String CELLSPACING = "cellspacing";
- public static final String CHECKED = "checked";
- public static final String CLASS = "class";
- public static final String COLSPAN = "colspan";
- public static final String CONTENT = "content";
- public static final String DEFER = "defer";
- public static final String DISABLED = "disabled";
- public static final String ENCTYPE = "enctype";
- public static final String FOR = "for";
- public static final String FRAMEBORDER = "frameborder";
- public static final String HEIGHT = "height";
- public static final String HREF = "href";
- public static final String HTTP_EQUIV = "http-equiv";
- public static final String ID = "id";
- public static final String LABEL = "label";
- public static final String MAXLENGTH = "maxlength";
- public static final String MEDIA = "media";
- public static final String METHOD = "method";
- public static final String MULTIPLE = "multiple";
- public static final String NAME = "name";
+ ACCEPT_CHARSET("accept-charset"),
+ ACCEPT("accept"),
+ ACCESSKEY("accesskey"),
+ ACTION("action"),
+ ALIGN("align"),
+ ALT("alt"),
+ AUTOCOMPLETE("autocomplete"),
+ AUTOFOCUS("autofocus"),
+ BORDER("border"),
+ CELLPADDING("cellpadding"),
+ CELLSPACING("cellspacing"),
+ CHECKED("checked"),
+ CLASS("class"),
+ COLSPAN("colspan"),
+ CONTENT("content"),
+ DEFER("defer"),
+ DISABLED("disabled"),
+ ENCTYPE("enctype"),
+ FOR("for"),
+ FRAMEBORDER("frameborder"),
+ HEIGHT("height"),
+ HREF("href"),
+ HTTP_EQUIV("http-equiv"),
+ ID("id"),
+ LABEL("label"),
+ MAXLENGTH("maxlength"),
+ MEDIA("media"),
+ METHOD("method"),
+ MULTIPLE("multiple"),
+ NAME("name"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONBLUR = "onblur";
+ ONBLUR("onblur"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONCHANGE = "onchange";
+ ONCHANGE("onchange"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONCLICK = "onclick";
+ ONCLICK("onclick"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONDBLCLICK = "ondblclick";
+ ONDBLCLICK("ondblclick"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONFOCUS = "onfocus";
+ ONFOCUS("onfocus"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONFOCUSIN = "onfocusin";
+ ONFOCUSIN("onfocusin"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONKEYDOWN = "onkeydown";
+ ONKEYDOWN("onkeydown"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONKEYPRESS = "onkeypress";
+ ONKEYPRESS("onkeypress"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONKEYUP = "onkeyup";
+ ONKEYUP("onkeyup"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONLOAD = "onload";
+ ONLOAD("onload"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONMOUSEOVER = "onmouseover";
+ ONMOUSEOVER("onmouseover"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String ONMOUSEOUT = "onmouseout";
- public static final String PATTERN = "pattern";
- public static final String PLACEHOLDER = "placeholder";
- public static final String READONLY = "readonly";
- public static final String REL = "rel";
- public static final String REQUIRED = "required";
- public static final String ROLE = "role";
- public static final String ROWS = "rows";
- public static final String ROWSPAN = "rowspan";
- public static final String SCROLL = "scroll";
- public static final String SELECTED = "selected";
- public static final String SIZE = "size";
- public static final String SRC = "src";
+ ONMOUSEOUT("onmouseout"),
+ PATTERN("pattern"),
+ PLACEHOLDER("placeholder"),
+ READONLY("readonly"),
+ REL("rel"),
+ REQUIRED("required"),
+ ROLE("role"),
+ ROWS("rows"),
+ ROWSPAN("rowspan"),
+ SCROLL("scroll"),
+ SELECTED("selected"),
+ SIZE("size"),
+ SRC("src"),
/** @deprecated Since 2.0.0. This attribute work not with SCP */
@Deprecated
- public static final String STYLE = "style";
- public static final String SUMMARY = "summary";
- public static final String TABINDEX = "tabindex";
- public static final String TARGET = "target";
- public static final String TITLE = "title";
- public static final String TYPE = "type";
- public static final String VALIGN = "valign";
- public static final String VALUE = "value";
- public static final String WIDTH = "width";
+ STYLE("style"),
+ SUMMARY("summary"),
+ TABINDEX("tabindex"),
+ TARGET("target"),
+ TITLE("title"),
+ TYPE("type"),
+ VALIGN("valign"),
+ VALUE("value"),
+ WIDTH("width"),
+ XMLNS("xmlns"),
// Non standard attributes ///////////////////////////////////////////////////////////
/**
* The index of the tab inside the tab group.
*/
- public static final String TABGROUPINDEX = "tabgroupindex";
+ TABGROUPINDEX("tabgroupindex"),
/**
* The mode of the tab switch: client, reloadTab, reloadPage.
*/
- public static final String SWITCHTYPE = "switchtype";
+ SWITCHTYPE("switchtype");
+
+
+ private final String value;
+
+ HtmlAttributes(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
}
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/MarkupLanguageAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/MarkupLanguageAttributes.java?rev=1707730&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/MarkupLanguageAttributes.java (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/MarkupLanguageAttributes.java Fri Oct 9 14:01:50 2015
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.renderkit.html;
+
+public interface MarkupLanguageAttributes {
+
+ String getValue();
+}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Fri Oct 9 14:01:50 2015
@@ -23,8 +23,8 @@ import org.apache.commons.collections.Co
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.component.Visual;
import org.apache.myfaces.tobago.component.UISheet;
+import org.apache.myfaces.tobago.component.Visual;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.context.TransientStateHolder;
import org.apache.myfaces.tobago.event.AbstractPopupActionListener;
@@ -36,6 +36,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.util.ObjectUtils;
import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.renderkit.RendererBase;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1027,9 +1028,10 @@ public final class ComponentUtils {
* Adding a data attribute to the component.
* The name must start with "data-", e. g. "data-tobago-foo" or "data-bar"
*/
- public static void putDataAttributeWithPrefix(final UIComponent component, final String name, final Object value) {
- if (name.startsWith("data-")) {
- putDataAttribute(component, name.substring(5), value);
+ public static void putDataAttributeWithPrefix(
+ final UIComponent component, final DataAttributes name, final Object value) {
+ if (name.getValue().startsWith("data-")) {
+ putDataAttribute(component, name.getValue().substring(5), value);
} else {
LOG.error("The name must start with 'data-' but it doesn't: '" + name + "'");
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java Fri Oct 9 14:01:50 2015
@@ -27,6 +27,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
+import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -67,6 +68,12 @@ public abstract class TobagoResponseWrit
* @deprecated Should not directly called via this interface. There is be a special method which might be better.
*/
@Deprecated
+ public abstract void writeURIAttribute(String name, Object value, final String property) throws IOException;
+
+ /**
+ * @deprecated Should not directly called via this interface. There is be a special method which might be better.
+ */
+ @Deprecated
public abstract void writeText(Object text, String property) throws IOException;
@Override
@@ -78,32 +85,30 @@ public abstract class TobagoResponseWrit
* Writes a string attribute. The renderer may set escape=false to switch of escaping of the string,
* if it is not necessary.
*/
- public abstract void writeAttribute(String name, String string, boolean escape) throws IOException;
+ public abstract void writeAttribute(MarkupLanguageAttributes name, String string, boolean escape) throws IOException;
+
+ /**
+ * Writes a string attribute URL encoded.
+ */
+ public abstract void writeURIAttribute(MarkupLanguageAttributes name, String string) throws IOException;
/**
* Writes a boolean attribute. The value will not escaped.
*/
- public void writeAttribute(final String name, final boolean on) throws IOException {
+ public void writeAttribute(final MarkupLanguageAttributes name, final boolean on) throws IOException {
if (on) {
- writeAttribute(name, name, false);
+ writeAttribute(name, name.getValue(), false);
}
}
/**
* Writes a integer attribute. The value will not escaped.
*/
- public void writeAttribute(final String name, final int number) throws IOException {
+ public void writeAttribute(final MarkupLanguageAttributes name, final int number) throws IOException {
writeAttribute(name, Integer.toString(number), false);
}
/**
- * Writes a propery as attribute. The value will be escaped.
- */
- public void writeAttributeFromComponent(final String name, final String property) throws IOException {
- writeAttribute(name, null, property);
- }
-
- /**
* Write the id attribute. The value will not escaped.
*/
public void writeIdAttribute(final String id) throws IOException {
@@ -174,7 +179,7 @@ public abstract class TobagoResponseWrit
if (json.length() > 2) { // empty "{}" needs not to be written
final FacesContext facesContext = FacesContext.getCurrentInstance();
writeAttribute(
- DataAttributes.STYLE.getValue(), json, style.needsToBeEscaped() || AjaxUtils.isAjaxRequest(facesContext));
+ DataAttributes.STYLE, json, style.needsToBeEscaped() || AjaxUtils.isAjaxRequest(facesContext));
// in case of AJAX we need to escape the " as long we use
// org.apache.myfaces.tobago.internal.webapp.JsonResponseWriter
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-extension/tobago-sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SplitLayoutRenderer.java Fri Oct 9 14:01:50 2015
@@ -22,9 +22,11 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.internal.component.AbstractUISplitLayout;
import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
import org.apache.myfaces.tobago.renderkit.css.Style;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
+import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
import org.apache.myfaces.tobago.renderkit.html.standard.standard.tag.GridLayoutRenderer;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
@@ -44,6 +46,13 @@ public class SplitLayoutRenderer extends
private static final Logger LOG = LoggerFactory.getLogger(SplitLayoutRenderer.class);
private static final String POSITION_ID_POSTFIX = "_spLP";
+ // todo: put as enum to DataAttributes, when moved from sandbox to core
+ private static MarkupLanguageAttributes SPLIT_LAYOUT = DataAttributes.dynamic("tobago-split-layout");
+
+ // todo: put as enum to DataAttributes, when moved from sandbox to core
+ private static MarkupLanguageAttributes SPLIT_LAYOUT_CONTAINMENT
+ = DataAttributes.dynamic("data-tobago-split-layout-containment");
+
@Override
public void decode(final FacesContext facesContext, final UIComponent component) {
final String clientId = component.getClientId();
@@ -78,8 +87,8 @@ public class SplitLayoutRenderer extends
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
writer.startElement(HtmlElements.SPAN, layout);
writer.writeIdAttribute(id);
- writer.writeAttribute("data-tobago-split-layout", layout.getOrientation().name(), false);
- writer.writeAttribute("data-tobago-split-layout-containment", createDraggableContainment(layout), true);
+ writer.writeAttribute(SPLIT_LAYOUT, layout.getOrientation().name(), false);
+ writer.writeAttribute(SPLIT_LAYOUT_CONTAINMENT, createDraggableContainment(layout), true);
/* XXX todo not implemented currently
final Style style = calculateHandleStyle(layout);
writer.writeStyleAttribute(style);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ButtonRenderer.java Fri Oct 9 14:01:50 2015
@@ -73,7 +73,7 @@ public class ButtonRenderer extends Comm
if (!disabled) {
final CommandMap map = new CommandMap(new Command(facesContext, button));
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
writer.writeAttribute(HtmlAttributes.HREF, "#", false);
@@ -105,7 +105,7 @@ public class ButtonRenderer extends Comm
if (button instanceof UIButton && ((UIButton) component).isDefaultCommand()) {
final AbstractUIForm form = ComponentUtils.findAncestor(component, AbstractUIForm.class);
- writer.writeAttribute(DataAttributes.DEFAULT.getValue(), form.getClientId(facesContext), false);
+ writer.writeAttribute(DataAttributes.DEFAULT, form.getClientId(facesContext), false);
}
writer.flush(); // force closing the start tag
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/CommandRenderer.java Fri Oct 9 14:01:50 2015
@@ -72,7 +72,7 @@ public class CommandRenderer extends Com
writer.startElement(HtmlElements.A, link);
final CommandMap map = new CommandMap(new Command(facesContext, link));
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
writer.writeAttribute(HtmlAttributes.HREF, "#", false);
@@ -90,7 +90,7 @@ public class CommandRenderer extends Com
writer.writeStyleAttribute(link.getStyle());
if (link.isParentOfCommands()) {
writer.writeClassAttribute(BootstrapClass.DROPDOWN_TOGGLE); // todo: CSS classes
- writer.writeAttribute(DataAttributes.TOGGLE.getValue(), "dropdown", false);
+ writer.writeAttribute(DataAttributes.TOGGLE, "dropdown", false);
} else {
writer.writeClassAttribute(Classes.create(link), link.getCustomClass());
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java Fri Oct 9 14:01:50 2015
@@ -46,9 +46,9 @@ public class DateRenderer extends InRend
final AbstractUIDate date = (AbstractUIDate) input;
super.writeAdditionalAttributes(facesContext, writer, date);
- writer.writeAttribute(DataAttributes.PATTERN.getValue(), date.getPattern(), true);
+ writer.writeAttribute(DataAttributes.PATTERN, date.getPattern(), true);
final DateTimeI18n dateTimeI18n = DateTimeI18n.valueOf(facesContext.getViewRoot().getLocale());
- writer.writeAttribute(DataAttributes.DATE_TIME_I18N.getValue(), JsonUtils.encode(dateTimeI18n), true);
+ writer.writeAttribute(DataAttributes.DATE_TIME_I18N, JsonUtils.encode(dateTimeI18n), true);
}
@Override
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/FlexLayoutRenderer.java Fri Oct 9 14:01:50 2015
@@ -23,12 +23,10 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -36,8 +34,6 @@ import java.io.IOException;
public class FlexLayoutRenderer extends RendererBase {
- private static final Logger LOG = LoggerFactory.getLogger(FlexLayoutRenderer.class);
-
@Override
public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
final UIFlexLayout flexLayout = (UIFlexLayout) component;
@@ -85,33 +81,7 @@ public class FlexLayoutRenderer extends
writer.writeClassAttribute(
Classes.create(flexLayout, vertically ? Markup.VERTICALLY : Markup.NULL));
// todo: const, utils, etc.
- writer.writeAttribute("data-tobago-layout", b.toString(), true);
-// writer.writeAttribute("data-tobago-layout", "{\"columns\":[\"auto\",1]}", true);
- }
-
- @Override
- public void encodeChildren(final FacesContext facesContext, final UIComponent component) throws IOException {
- final UIComponent container = component.getParent();
- if (!container.isRendered()) {
- return;
- }
- RenderUtils.encodeChildren(facesContext, container);
-/*
- final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
- final AbstractUIBootstrapLayout bootstrapLayout = (AbstractUIBootstrapLayout) component;
- final UIComponent container = bootstrapLayout.getParent();
- if (!container.isRendered()) {
- return;
- }
-
- final List<UIComponent> children = container.getChildren();
- for (UIComponent child : children) {
- writer.startElement(HtmlElements.DIV, null);
- writer.writeClassAttribute("col-md-4");
- RenderUtils.encode(facesContext, child);
- writer.endElement(HtmlElements.DIV);
- }
-*/
+ writer.writeAttribute(DataAttributes.LAYOUT, b.toString(), true);
}
@Override
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/GridLayoutRenderer.java Fri Oct 9 14:01:50 2015
@@ -32,6 +32,7 @@ import org.apache.myfaces.tobago.layout.
import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.HtmlRoleValues;
@@ -57,7 +58,6 @@ public class GridLayoutRenderer extends
final AbstractUIGridLayout gridLayout = (AbstractUIGridLayout) component;
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-// writer.startElement(HtmlElements.DIV, gridLayout);
writer.startElement(HtmlElements.TABLE, gridLayout);
writer.writeAttribute(HtmlAttributes.ROLE, HtmlRoleValues.PRESENTATION.toString(), false);
writer.writeClassAttribute(Classes.create(gridLayout));
@@ -72,8 +72,7 @@ public class GridLayoutRenderer extends
jsonLayout(gridLayout.getGrid().getRows(), builder);
builder.append("}");
- writer.writeAttribute("data-tobago-layout", builder.toString(), true);
-
+ writer.writeAttribute(DataAttributes.LAYOUT, builder.toString(), true);
writer.startElement(HtmlElements.COLGROUP, gridLayout);
final LayoutTokens columns = gridLayout.getGrid().getColumns();
@@ -182,6 +181,5 @@ public class GridLayoutRenderer extends
writer.endElement(HtmlElements.TBODY);
writer.endElement(HtmlElements.TABLE);
-// writer.endElement(HtmlElements.DIV);
}
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LabelLayoutRendererBase.java Fri Oct 9 14:01:50 2015
@@ -28,6 +28,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.CssItem;
import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
+import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
@@ -129,12 +130,10 @@ public abstract class LabelLayoutRendere
switch (labelLayout) {
case flexLeft:
- // todo: const, utils, etc.
- writer.writeAttribute("data-tobago-layout", "{\"columns\":[\"auto\",1]}", true);
+ writer.writeAttribute(DataAttributes.LAYOUT, "{\"columns\":[\"auto\",1]}", true);
break;
case flexRight:
- // todo: const, utils, etc.
- writer.writeAttribute("data-tobago-layout", "{\"columns\":[1,\"auto\"]}", true);
+ writer.writeAttribute(DataAttributes.LAYOUT, "{\"columns\":[1,\"auto\"]}", true);
break;
default:
// nothing to do
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LinkRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LinkRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LinkRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/LinkRenderer.java Fri Oct 9 14:01:50 2015
@@ -59,7 +59,7 @@ public class LinkRenderer extends Comman
writer.startElement(HtmlElements.A, link);
final CommandMap map = new CommandMap(new Command(facesContext, link));
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
writer.writeAttribute(HtmlAttributes.HREF, "#", false);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java Fri Oct 9 14:01:50 2015
@@ -157,9 +157,9 @@ public class MenuCommandRenderer extends
}
writer.writeClassAttribute(css);
if (!disabled) {
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
}
- writer.writeAttribute(DataAttributes.VALUE.getValue(), value, true);
+ writer.writeAttribute(DataAttributes.VALUE, value, true);
if (command != null) {
HtmlRendererUtils.writeDataAttributes(facesContext, writer, command);
@@ -180,8 +180,8 @@ public class MenuCommandRenderer extends
final String imageHover = ResourceManagerUtils
.getImageOrDisabledImage(facesContext, image + "Hover", disabled, true);
if (imageHover != null) {
- writer.writeAttribute(DataAttributes.SRC_DEFAULT.getValue(), imageWithPath, false);
- writer.writeAttribute(DataAttributes.SRC_HOVER.getValue(), imageHover, false);
+ writer.writeAttribute(DataAttributes.SRC_DEFAULT, imageWithPath, false);
+ writer.writeAttribute(DataAttributes.SRC_HOVER, imageHover, false);
}
writer.writeAttribute(HtmlAttributes.ALT, "", true);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MessagesRenderer.java Fri Oct 9 14:01:50 2015
@@ -118,10 +118,10 @@ public class MessagesRenderer extends Re
writer.startElement(HtmlElements.BUTTON, null);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON, false);
writer.writeClassAttribute(BootstrapClass.CLOSE);
- writer.writeAttribute(DataAttributes.DISMISS.getValue(), "alert", false);
- writer.writeAttribute(Aria.ACTIVEDESCENDANT.getValue(), "Close", false); // todo: i18n
+ writer.writeAttribute(DataAttributes.DISMISS, "alert", false);
+ writer.writeAttribute(Aria.ACTIVEDESCENDANT, "Close", false); // todo: i18n
writer.startElement(HtmlElements.SPAN, null);
- writer.writeAttribute(Aria.HIDDEN.getValue(), Boolean.TRUE.toString(), false);
+ writer.writeAttribute(Aria.HIDDEN, Boolean.TRUE.toString(), false);
writer.writeText("Ã"); // times
writer.endElement(HtmlElements.SPAN);
writer.endElement(HtmlElements.BUTTON);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/NavRenderer.java Fri Oct 9 14:01:50 2015
@@ -25,6 +25,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.component.AbstractUIForm;
import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
+import org.apache.myfaces.tobago.renderkit.html.Aria;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlButtonTypes;
@@ -113,10 +114,10 @@ public class NavRenderer extends Rendere
writer.startElement(HtmlElements.BUTTON, null);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON, false);
writer.writeClassAttribute(BootstrapClass.NAVBAR_TOGGLE, BootstrapClass.COLLAPSED);
- writer.writeAttribute(DataAttributes.TOGGLE.getValue(), "collapse", false);
- writer.writeAttribute(DataAttributes.TARGET.getValue(), JQueryUtils.escapeIdForHtml(navbarId), true);
- writer.writeAttribute("aria-expanded", Boolean.FALSE.toString(), false);
- writer.writeAttribute("aria-controls", navbarId, false);
+ writer.writeAttribute(DataAttributes.TOGGLE, "collapse", false);
+ writer.writeAttribute(DataAttributes.TARGET, JQueryUtils.escapeIdForHtml(navbarId), true);
+ writer.writeAttribute(Aria.EXPANDED, Boolean.FALSE.toString(), false);
+ writer.writeAttribute(Aria.CONTROLS, navbarId, false);
writer.startElement(HtmlElements.SPAN, null);
writer.writeClassAttribute(BootstrapClass.SR_ONLY);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Fri Oct 9 14:01:50 2015
@@ -236,7 +236,7 @@ public class PageRenderer extends Render
}
writer.writeAttribute(HtmlAttributes.ACTION, formAction, true);
if (partialAction != null) {
- writer.writeAttribute(DataAttributes.PARTIAL_ACTION.getValue(), partialAction, true);
+ writer.writeAttribute(DataAttributes.PARTIAL_ACTION, partialAction, true);
}
if (LOG.isDebugEnabled()) {
LOG.debug("partial action = " + partialAction);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PanelRenderer.java Fri Oct 9 14:01:50 2015
@@ -74,7 +74,7 @@ public class PanelRenderer extends Rende
final UIComponent facetReload = panel.getFacet(Facets.RELOAD);
if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
final UIReload update = (UIReload) facetReload;
- writer.writeAttribute(DataAttributes.RELOAD.getValue(), Integer.toString(update.getFrequency()), false);
+ writer.writeAttribute(DataAttributes.RELOAD, Integer.toString(update.getFrequency()), false);
}
}
HtmlRendererUtils.renderCommandFacet(panel, facesContext, writer);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java Fri Oct 9 14:01:50 2015
@@ -66,7 +66,7 @@ public class SelectManyListboxRenderer e
}
writer.writeStyleAttribute(select.getStyle());
writer.writeClassAttribute(Classes.create(select), BootstrapClass.FORM_CONTROL, select.getCustomClass());
- writer.writeAttribute(HtmlAttributes.MULTIPLE, HtmlAttributes.MULTIPLE, false);
+ writer.writeAttribute(HtmlAttributes.MULTIPLE, true);
if (title != null) {
writer.writeAttribute(HtmlAttributes.TITLE, title, true);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java Fri Oct 9 14:01:50 2015
@@ -76,7 +76,7 @@ public class SelectManyShuttleRenderer e
writer.writeClassAttribute(Classes.create(select, "unselected"));
- writer.writeAttribute(HtmlAttributes.MULTIPLE, HtmlAttributes.MULTIPLE, false);
+ writer.writeAttribute(HtmlAttributes.MULTIPLE, true);
final Object[] values = select.getSelectedValues();
final String[] submittedValues = getSubmittedValues(select);
@@ -108,7 +108,7 @@ public class SelectManyShuttleRenderer e
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
}
writer.writeClassAttribute(Classes.create(select, "selected"));
- writer.writeAttribute(HtmlAttributes.MULTIPLE, HtmlAttributes.MULTIPLE, false);
+ writer.writeAttribute(HtmlAttributes.MULTIPLE, true);
items = SelectItemUtils.getItemIterator(facesContext, select);
HtmlRendererUtils.renderSelectItems(select, items, values, submittedValues, true, writer, facesContext);
@@ -118,7 +118,7 @@ public class SelectManyShuttleRenderer e
final String hiddenClientId = clientId + ComponentUtils.SUB_SEPARATOR + "hidden";
writer.writeIdAttribute(hiddenClientId);
writer.writeNameAttribute(clientId);
- writer.writeAttribute(HtmlAttributes.MULTIPLE, HtmlAttributes.MULTIPLE, false);
+ writer.writeAttribute(HtmlAttributes.MULTIPLE, true);
writer.writeAttribute(HtmlAttributes.REQUIRED, select.isRequired());
HtmlRendererUtils.renderCommandFacet(select, facesContext, writer);
items = SelectItemUtils.getItemIterator(facesContext, select);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java Fri Oct 9 14:01:50 2015
@@ -151,14 +151,14 @@ public class SheetRenderer extends Rende
final UIComponent facetReload = sheet.getFacet(Facets.RELOAD);
if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
final UIReload update = (UIReload) facetReload;
- writer.writeAttribute(DataAttributes.RELOAD.getValue(), update.getFrequency());
+ writer.writeAttribute(DataAttributes.RELOAD, update.getFrequency());
}
final String[] clientIds = ComponentUtils.evaluateClientIds(facesContext, sheet, sheet.getRenderedPartially());
if (clientIds.length > 0) {
- writer.writeAttribute(DataAttributes.PARTIAL_IDS.getValue(), JsonUtils.encode(clientIds), true);
+ writer.writeAttribute(DataAttributes.PARTIAL_IDS, JsonUtils.encode(clientIds), true);
}
- writer.writeAttribute(DataAttributes.SELECTION_MODE.getValue(), sheet.getSelectable().name(), false);
- writer.writeAttribute(DataAttributes.FIRST.getValue(), Integer.toString(sheet.getFirst()), false);
+ writer.writeAttribute(DataAttributes.SELECTION_MODE, sheet.getSelectable().name(), false);
+ writer.writeAttribute(DataAttributes.FIRST, Integer.toString(sheet.getFirst()), false);
final boolean rowAction = HtmlRendererUtils.renderSheetCommands(sheet, facesContext, writer);
@@ -280,7 +280,7 @@ public class SheetRenderer extends Rende
writer.startElement(HtmlElements.TR, null);
if (rowRendered instanceof Boolean) {
// if rowRendered attribute is set we need the rowIndex on the client
- writer.writeAttribute(DataAttributes.ROW_INDEX.getValue(), rowIndex);
+ writer.writeAttribute(DataAttributes.ROW_INDEX, rowIndex);
}
final boolean selected = selectedRows.contains(rowIndex);
final String[] rowMarkups = (String[]) sheet.getAttributes().get("rowMarkup");
@@ -299,7 +299,7 @@ public class SheetRenderer extends Rende
}
final String parentId = sheet.getRowParentClientId();
if (parentId != null) {
- writer.writeAttribute(DataAttributes.TREE_PARENT.getValue(), parentId, false);
+ writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);
}
int columnIndex = -1;
@@ -745,7 +745,7 @@ public class SheetRenderer extends Rende
writer.writeAttribute(HtmlAttributes.SRC, image, false);
writer.writeAttribute(HtmlAttributes.TITLE, tip, true);
writer.writeAttribute(HtmlAttributes.ALT, "", false);
- writer.writeAttribute(DataAttributes.DISABLED.getValue(), disabled);
+ writer.writeAttribute(DataAttributes.DISABLED, disabled);
writer.endElement(HtmlElements.IMG);
}
@@ -836,7 +836,7 @@ public class SheetRenderer extends Rende
final Command click = new Command(
sortCommand.getClientId(facesContext), null, null, null, clientIds, null, null, null, null, null);
map.setClick(click);
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
if (tip == null) {
tip = "";
@@ -998,7 +998,7 @@ public class SheetRenderer extends Rende
menuItem.setLabel(ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", label));
menuItem.setMarkup(markup);
menuItem.setOmit(true);
- ComponentUtils.putDataAttributeWithPrefix(menuItem, DataAttributes.SHEET_ID.getValue(), sheetId);
+ ComponentUtils.putDataAttributeWithPrefix(menuItem, DataAttributes.SHEET_ID, sheetId);
menu.getChildren().add(menuItem);
}
@@ -1129,7 +1129,7 @@ public class SheetRenderer extends Rende
writer.startElement(innerElement, null);
writer.writeClassAttribute(Classes.create(sheet, "pagingLink"));
if (pagingLinkType == PagingLinkType.NORMAL) {
- writer.writeAttribute(DataAttributes.TO_PAGE.getValue(), toPage);
+ writer.writeAttribute(DataAttributes.TO_PAGE, toPage);
writer.writeAttribute(HtmlAttributes.HREF, "#", false);
}
writer.flush();
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SuggestRenderer.java Fri Oct 9 14:01:50 2015
@@ -52,34 +52,25 @@ public class SuggestRenderer extends Ren
totalCount = list.size();
}
- ComponentUtils.putDataAttribute(in, cut(DataAttributes.SUGGEST_MIN_CHARS.getValue()), suggest.getMinimumCharacters());
- ComponentUtils.putDataAttribute(in, cut(DataAttributes.SUGGEST_DELAY.getValue()), suggest.getDelay());
- ComponentUtils.putDataAttribute(in, cut(DataAttributes.SUGGEST_MAX_ITEMS.getValue()), suggest.getMaximumItems());
- ComponentUtils.putDataAttribute(in, cut(DataAttributes.SUGGEST_UPDATE.getValue()), suggest.isUpdate());
- ComponentUtils.putDataAttribute(in, cut(DataAttributes.SUGGEST_TOTAL_COUNT.getValue()), totalCount);
+ ComponentUtils.putDataAttributeWithPrefix(in, DataAttributes.SUGGEST_MIN_CHARS, suggest.getMinimumCharacters());
+ ComponentUtils.putDataAttributeWithPrefix(in, DataAttributes.SUGGEST_DELAY, suggest.getDelay());
+ ComponentUtils.putDataAttributeWithPrefix(in, DataAttributes.SUGGEST_MAX_ITEMS, suggest.getMaximumItems());
+ ComponentUtils.putDataAttributeWithPrefix(in, DataAttributes.SUGGEST_UPDATE, suggest.isUpdate());
+ ComponentUtils.putDataAttributeWithPrefix(in, DataAttributes.SUGGEST_TOTAL_COUNT, totalCount);
// tbd final String title
// tbd = ResourceManagerUtils.getPropertyNotNull(facesContext, "tobago", "tobago.in.inputSuggest.moreElements");
- String array[] = new String[list.size()];
+ String[] array = new String[list.size()];
for (int i = 0; i < totalCount; i++) {
array[i] = list.get(i).getLabel();
}
- ComponentUtils.putDataAttribute(in, cut(DataAttributes.SUGGEST_DATA.getValue()), JsonUtils.encode(array));
+ ComponentUtils.putDataAttribute(in, DataAttributes.SUGGEST_DATA, JsonUtils.encode(array));
super.prepareRender(facesContext, component);
}
- /// todo: make DataAttribute to a enum and add this util to the enum class
- private String cut(String name) {
- if (name.startsWith("data-")) {
- return name.substring(5);
- } else {
- return name;
- }
- }
-
private AutoSuggestItems createAutoSuggestItems(final Object object) {
if (object instanceof AutoSuggestItems) {
return (AutoSuggestItems) object;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TabGroupRenderer.java Fri Oct 9 14:01:50 2015
@@ -111,7 +111,7 @@ public class TabGroupRenderer extends Re
final String[] clientIds
= ComponentUtils.evaluateClientIds(facesContext, tabGroup, tabGroup.getRenderedPartially());
if (clientIds.length > 0) {
- writer.writeAttribute(DataAttributes.PARTIAL_IDS.getValue(), JsonUtils.encode(clientIds), true);
+ writer.writeAttribute(DataAttributes.PARTIAL_IDS, JsonUtils.encode(clientIds), true);
}
writer.startElement(HtmlElements.INPUT, null);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRenderer.java Fri Oct 9 14:01:50 2015
@@ -60,8 +60,8 @@ public class ToolBarRenderer extends Ren
writer.startElement(HtmlElements.BUTTON, null);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlButtonTypes.BUTTON, false);
writer.writeClassAttribute(BootstrapClass.NAVBAR_TOGGLE);
- writer.writeAttribute(DataAttributes.TOGGLE.getValue(), "collapse", false);
- writer.writeAttribute("data-target", JQueryUtils.escapeIdForHtml(toolBar.getClientId(facesContext)), true);
+ writer.writeAttribute(DataAttributes.TOGGLE, "collapse", false);
+ writer.writeAttribute(DataAttributes.TARGET, JQueryUtils.escapeIdForHtml(toolBar.getClientId(facesContext)), true);
writer.startElement(HtmlElements.SPAN, null);
writer.writeClassAttribute(BootstrapClass.SR_ONLY);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java Fri Oct 9 14:01:50 2015
@@ -284,11 +284,11 @@ public abstract class ToolBarRendererBas
writer.writeIdAttribute(command.getClientId(facesContext));
}
if (map != null) {
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
}
HtmlRendererUtils.writeDataAttributes(facesContext, writer, command);
if (value != null) {
- writer.writeAttribute(DataAttributes.VALUE.getValue(), value, true);
+ writer.writeAttribute(DataAttributes.VALUE, value, true);
}
// render icon
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeCommandRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeCommandRenderer.java Fri Oct 9 14:01:50 2015
@@ -83,7 +83,7 @@ public class TreeCommandRenderer extends
} else {
writer.startElement(HtmlElements.A, command);
final CommandMap map = new CommandMap(new Command(facesContext, command));
- writer.writeAttribute(DataAttributes.COMMANDS.getValue(), JsonUtils.encode(map), true);
+ writer.writeAttribute(DataAttributes.COMMANDS, JsonUtils.encode(map), true);
writer.writeNameAttribute(clientId);
}
writer.writeStyleAttribute(style);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIconRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIconRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIconRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeIconRenderer.java Fri Oct 9 14:01:50 2015
@@ -111,8 +111,8 @@ public class TreeIconRenderer extends Re
HtmlRendererUtils.writeDataAttributes(facesContext, writer, image);
writer.writeAttribute(HtmlAttributes.SRC, source, true);
if (folder) {
- writer.writeAttribute(DataAttributes.SRC_OPEN.getValue(), openSource, true);
- writer.writeAttribute(DataAttributes.SRC_CLOSE.getValue(), closedSource, true);
+ writer.writeAttribute(DataAttributes.SRC_OPEN, openSource, true);
+ writer.writeAttribute(DataAttributes.SRC_CLOSE, closedSource, true);
}
writer.writeAttribute(HtmlAttributes.ALT, "", false);
writer.endElement(HtmlElements.IMG);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java Fri Oct 9 14:01:50 2015
@@ -103,7 +103,7 @@ public class TreeListboxRenderer extends
writer.writeNameAttribute(clientId + AbstractUITree.SELECT_STATE);
writer.writeIdAttribute(clientId + AbstractUITree.SELECT_STATE);
writer.writeAttribute(HtmlAttributes.VALUE, ";", false);
- writer.writeAttribute(DataAttributes.SELECTION_MODE.getValue(), tree.getSelectable().name(), false);
+ writer.writeAttribute(DataAttributes.SELECTION_MODE, tree.getSelectable().name(), false);
writer.endElement(HtmlElements.INPUT);
}
@@ -165,7 +165,7 @@ public class TreeListboxRenderer extends
writer.startElement(HtmlElements.SELECT, tree);
writer.writeClassAttribute(Classes.create(tree, "select"));
if (parentId != null) {
- writer.writeAttribute(DataAttributes.TREE_PARENT.getValue(), parentId, false);
+ writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);
}
writer.writeAttribute(HtmlAttributes.SIZE, 9); // must be > 1, but the real size comes from the layout
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeMenuNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeMenuNodeRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeMenuNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeMenuNodeRenderer.java Fri Oct 9 14:01:50 2015
@@ -61,7 +61,7 @@ public class TreeMenuNodeRenderer extend
writer.writeClassAttribute(Classes.create(node));
HtmlRendererUtils.writeDataAttributes(facesContext, writer, node);
if (parentId != null) {
- writer.writeAttribute(DataAttributes.TREE_PARENT.getValue(), parentId, false);
+ writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);
}
// In the case of a sheet, we need not hiding the node, because the whole TR will be hidden.
@@ -110,8 +110,8 @@ public class TreeMenuNodeRenderer extend
writer.startElement(HtmlElements.IMG, null);
writer.writeClassAttribute(Classes.create(node, "toggle"));
writer.writeAttribute(HtmlAttributes.SRC, src, false);
- writer.writeAttribute(DataAttributes.SRC_OPEN.getValue(), srcOpen, false);
- writer.writeAttribute(DataAttributes.SRC_CLOSE.getValue(), srcClose, false);
+ writer.writeAttribute(DataAttributes.SRC_OPEN, srcOpen, false);
+ writer.writeAttribute(DataAttributes.SRC_CLOSE, srcClose, false);
writer.writeAttribute(HtmlAttributes.ALT, "", false);
writer.endElement(HtmlElements.IMG);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeNodeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeNodeRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeNodeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeNodeRenderer.java Fri Oct 9 14:01:50 2015
@@ -56,7 +56,7 @@ public class TreeNodeRenderer extends Tr
writer.writeClassAttribute(Classes.create(node));
HtmlRendererUtils.writeDataAttributes(facesContext, writer, node);
if (parentId != null) {
- writer.writeAttribute(DataAttributes.TREE_PARENT.getValue(), parentId, false);
+ writer.writeAttribute(DataAttributes.TREE_PARENT, parentId, false);
}
Style style = node.getStyle();
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeRenderer.java?rev=1707730&r1=1707729&r2=1707730&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeRenderer.java Fri Oct 9 14:01:50 2015
@@ -85,11 +85,11 @@ public class TreeRenderer extends Render
writer.writeStyleAttribute(tree.getStyle());
writer.writeIdAttribute(clientId);
HtmlRendererUtils.writeDataAttributes(facesContext, writer, tree);
- writer.writeAttribute("data-tobago-scroll-panel", "true", true);
+ writer.writeAttribute(DataAttributes.SCROLL_PANEL, Boolean.TRUE.toString(), false);
final Selectable selectable = tree.getSelectable();
if (selectable.isSupportedByTree()) {
- writer.writeAttribute(DataAttributes.SELECTABLE.getValue(), selectable.name(), false);
+ writer.writeAttribute(DataAttributes.SELECTABLE, selectable.name(), false);
}
final SelectedState selectedState = tree.getSelectedState();