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 2018/04/04 14:24:13 UTC
[myfaces-tobago] 01/03: TOBAGO-1887: Content sometimes "jumps" on
AJAX update (e.g. tc:tree)
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 0da1046c8caf13fdb1edb21319a5ab9a168cf321
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Apr 4 14:49:20 2018 +0200
TOBAGO-1887: Content sometimes "jumps" on AJAX update (e.g. tc:tree)
---
.../internal/webapp/TobagoResponseWriterBase.java | 47 +++++++++++-----------
.../tobago-bootstrap/_version/js/tobago-jsf.js | 15 ++++---
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
index 2c3d758..f94fd34 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoResponseWriterBase.java
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.internal.webapp;
-import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
import org.apache.myfaces.tobago.renderkit.html.HtmlTypes;
import org.apache.myfaces.tobago.renderkit.html.MarkupLanguageAttributes;
@@ -28,7 +27,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
import java.io.IOException;
import java.io.Writer;
import java.net.URI;
@@ -41,7 +39,7 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
protected static final char[] XML_VERSION_1_0_ENCODING_UTF_8_CHARS = XML_VERSION_1_0_ENCODING_UTF_8.toCharArray();
- private int i = 0;
+ private int level = 0;
private int inlineStack = 0;
@@ -55,13 +53,10 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
private final String characterEncoding;
- private final boolean ajax;
-
protected TobagoResponseWriterBase(final Writer writer, final String contentType, final String characterEncoding) {
this.writer = writer;
this.contentType = contentType;
this.characterEncoding = characterEncoding != null ? characterEncoding : "UTF-8";
- this.ajax = FacesContext.getCurrentInstance().getPartialViewContext().isPartialRequest();
}
protected final Writer getWriter() {
@@ -164,7 +159,7 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
protected void closeOpenTag() throws IOException {
if (startStillOpen) {
- writer.write(">");
+ writer.write('>');
startStillOpen = false;
}
}
@@ -207,21 +202,22 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
}
startElementInternal(writer, name.getValue(), name.isInline());
if (!name.isVoid()) {
- i++;
+ level++;
}
}
protected void startElementInternal(final Writer sink, final String name, final boolean inline)
throws IOException {
-// closeOpenTag();
if (startStillOpen) {
- sink.write(">");
+ sink.write('>');
}
- if (!ajax && inlineStack <= 1) {
- sink.write("\n");
- sink.write(StringUtils.repeat(" ", i));
+ if (inlineStack <= 1) {
+ sink.write('\n');
+ for (int i = 0; i < level; i++) {
+ sink.write(' ');
+ }
}
- sink.write("<");
+ sink.write('<');
sink.write(name);
startStillOpen = true;
}
@@ -248,7 +244,7 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
closeEmptyTag();
} else {
if (!name.isVoid()) {
- i--;
+ level--;
}
endElementInternal(writer, name.getValue(), inline);
}
@@ -263,9 +259,9 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
public void writeComment(final Object obj) throws IOException {
closeOpenTag();
final String comment = obj.toString();
- if (!ajax) {
- writer.write("\n");
- writer.write(StringUtils.repeat(" ", i));
+ writer.write('\n');
+ for (int i = 0; i < level; i++) {
+ writer.write(' ');
}
write("<!--");
write(comment);
@@ -284,7 +280,7 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
writeAttribute(new MarkupLanguageAttributes() {
@Override
public String getValue() {
- return name;
+ return name;
}
}, attribute, true);
}
@@ -331,15 +327,19 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
protected void endElementInternal(final Writer sink, final String name, final boolean inline) throws IOException {
if (startStillOpen) {
- sink.write(">");
+ sink.write('>');
}
- if (inline || ajax) {
+ if (inline) {
sink.write("</");
} else {
- sink.write("\n" + StringUtils.repeat(" ", i) + "</");
+ sink.write('\n');
+ for (int i = 0; i < level; i++) {
+ sink.write(' ');
+ }
+ sink.write("</");
}
sink.write(name);
- sink.write(">");
+ sink.write('>');
}
protected abstract void closeEmptyTag() throws IOException;
@@ -365,6 +365,7 @@ public abstract class TobagoResponseWriterBase extends TobagoResponseWriter {
sink.write('\'');
}
}
+
protected abstract void writerAttributeValue(String value, boolean escape) throws IOException;
diff --git a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-jsf.js b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-jsf.js
index 7f0cbb7..1e6d095 100644
--- a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-jsf.js
+++ b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/resources/tobago/standard/tobago-bootstrap/_version/js/tobago-jsf.js
@@ -15,7 +15,7 @@
*/
/*
- * XXX This is a modified copy of MyFaces 2.2.10 jsf-uncompressed-full.js
+ * XXX This is a modified copy of MyFaces 2.2.13-SNAPSHOT (2018-04-04) jsf-uncompressed-full.js
* XXX Modifications are marked with TOBAGO-JSF-JS
*/
@@ -3450,10 +3450,10 @@ _MF_CLS(_PFX_UTIL+"_ListenerQueue", myfaces._impl._util._Queue,
/**
* generic broadcast with a number of arguments being passed down
- * @param {Object} argument the arguments passed down which are broadcast
+ * @param {Object} args the arguments passed down which are broadcast
*/
- broadcastEvent : function(argument) {
- var _args = myfaces._impl._util._Lang.objToArray(arguments);
+ broadcastEvent : function(args) {
+ var _args = myfaces._impl._util._Lang.objToArray(arguments); // XXX arguments vs. args?
var broadCastFunc = function(element) {
element.apply(null, _args);
@@ -6405,7 +6405,6 @@ _MF_CLS(_PFX_XHR + "engine.IFrame", myfaces._impl.xhrCore.engine.BaseRequest,
*
* @param args
*/
- /* TOBAGO-JSF-JS: rename "arguments" with "args", because the compressor would fail */
constructor_: function (args) {
//we fetch in the standard arguments
@@ -7064,7 +7063,6 @@ _MF_CLS(_PFX_XHR + "_MultipartAjaxRequestLevel2", myfaces._impl.xhrCore._AjaxReq
_sourceForm:null,
- /* TOBAGO-JSF-JS: rename "arguments" with "args", because the compressor would fail */
constructor_:function (args) {
this._callSuper("constructor_", args);
//TODO xhr level2 can deal with real props
@@ -7114,7 +7112,6 @@ _MF_CLS(_PFX_XHR + "_AjaxRequestLevel2", myfaces._impl.xhrCore._AjaxRequest, {
_sourceForm:null,
- /* TOBAGO-JSF-JS: rename "arguments" with "args", because the compressor would fail */
constructor_:function (args) {
this._callSuper("constructor_", args);
//TODO xhr level2 can deal with real props
@@ -7173,7 +7170,6 @@ _MF_CLS(_PFX_XHR+"_IFrameRequest", myfaces._impl.xhrCore._AjaxRequest,
MF_PART_FACES_REQUEST: "javax.faces.request",
- /* TOBAGO-JSF-JS: rename "arguments" with "args", because the compressor would fail */
constructor_: function(args) {
this._callSuper("constructor_", args);
},
@@ -7570,6 +7566,9 @@ _MF_SINGLTN(_PFX_XHR + "_AjaxResponse", _MF_OBJECT, /** @lends myfaces._impl.xhr
break;
case this.CMD_EXTENSION:
break;
+ case undefined:
+ // ignoring white spaces
+ break;
default:
throw this._raiseError(new Error(), "_AjaxResponse.processChanges: Illegal Command Issued", "processChanges");
}
--
To stop receiving notification emails like this one, please contact
lofwyr@apache.org.