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 2013/11/10 17:54:59 UTC
svn commit: r1540495 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/context/
tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
tobago-theme/tobago-the...
Author: lofwyr
Date: Sun Nov 10 16:54:58 2013
New Revision: 1540495
URL: http://svn.apache.org/r1540495
Log:
TOBAGO-1328: Page dimension
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java?rev=1540495&r1=1540494&r2=1540495&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java Sun Nov 10 16:54:58 2013
@@ -72,6 +72,7 @@ public final class Markup implements Ser
public static final Markup MODAL = valueOf("modal");
public static final Markup NUMBER = valueOf("number");
public static final Markup ODD = valueOf("odd");
+ public static final Markup PORTLET = valueOf("portlet");
public static final Markup PURE = valueOf("pure");
public static final Markup READONLY = valueOf("readonly");
public static final Markup REQUIRED = valueOf("required");
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=1540495&r1=1540494&r2=1540495&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Sun Nov 10 16:54:58 2013
@@ -155,17 +155,17 @@ public class PageRenderer extends PageRe
}
}
- final Object response = facesContext.getExternalContext().getResponse();
+ final ExternalContext externalContext = facesContext.getExternalContext();
+ final Object response = externalContext.getResponse();
final Application application = facesContext.getApplication();
final ViewHandler viewHandler = application.getViewHandler();
final String viewId = facesContext.getViewRoot().getViewId();
- final String formAction
- = facesContext.getExternalContext().encodeActionURL(viewHandler.getActionURL(facesContext, viewId));
+ final String formAction = externalContext.encodeActionURL(viewHandler.getActionURL(facesContext, viewId));
final String partialAction;
if (PortletUtils.isPortletApiAvailable() && response instanceof MimeResponse) {
final MimeResponse mimeResponse = (MimeResponse) response;
final ResourceURL resourceURL = mimeResponse.createResourceURL();
- partialAction = facesContext.getExternalContext().encodeResourceURL(resourceURL.toString());
+ partialAction = externalContext.encodeResourceURL(resourceURL.toString());
} else {
partialAction = null;
}
@@ -180,7 +180,7 @@ public class PageRenderer extends PageRe
final boolean productionMode = !debugMode && projectStage == ProjectStage.Production;
int clientLogSeverity = 2;
if (debugMode) {
- String severity = (String) facesContext.getExternalContext().getRequestMap().get(CLIENT_DEBUG_SEVERITY);
+ String severity = (String) externalContext.getRequestMap().get(CLIENT_DEBUG_SEVERITY);
if (LOG.isDebugEnabled()) {
LOG.debug("get " + CLIENT_DEBUG_SEVERITY + " = " + severity);
}
@@ -303,9 +303,14 @@ public class PageRenderer extends PageRe
writer.endElement(HtmlElements.HEAD);
}
- writer.startElement(HtmlElements.BODY, page);
+ if (PortletUtils.isPortletApiAvailable() && response instanceof MimeResponse) {
+ writer.startElement(HtmlElements.DIV, page);
+ writer.writeClassAttribute(Classes.create(page, Markup.PORTLET));
+ } else {
+ writer.startElement(HtmlElements.BODY, page);
+ writer.writeClassAttribute(Classes.create(page));
+ }
writer.writeIdAttribute(clientId);
- writer.writeClassAttribute(Classes.create(page));
HtmlRendererUtils.writeDataAttributes(facesContext, writer, page);
HtmlRendererUtils.renderCommandFacet(page, facesContext, writer);
@@ -338,7 +343,7 @@ public class PageRenderer extends PageRe
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "context-path");
writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "context-path");
- writer.writeAttribute(HtmlAttributes.VALUE, facesContext.getExternalContext().getRequestContextPath(), true);
+ writer.writeAttribute(HtmlAttributes.VALUE, externalContext.getRequestContextPath(), true);
writer.endElement(HtmlElements.INPUT);
writer.startElement(HtmlElements.INPUT, null);
@@ -422,7 +427,7 @@ public class PageRenderer extends PageRe
// page.encodeLayoutBegin(facesContext);
writer.startElement(HtmlElements.DIV, page);
- writer.writeClassAttribute(Classes.create(page, "content"));
+ writer.writeClassAttribute(Classes.create(page, "content", Markup.PORTLET));
writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "content");
Style style = new Style(facesContext, page);
// XXX position the div, so that the scrollable area is correct.
@@ -558,23 +563,19 @@ public class PageRenderer extends PageRe
// debugging...
if (debugMode) {
- List<String> logMessages = new ArrayList<String>();
- for (Iterator ids = facesContext.getClientIdsWithMessages();
- ids.hasNext();) {
- String id = (String) ids.next();
- for (Iterator messages = facesContext.getMessages(id);
- messages.hasNext();) {
- FacesMessage message = (FacesMessage) messages.next();
+ final List<String> logMessages = new ArrayList<String>();
+ for (Iterator ids = facesContext.getClientIdsWithMessages(); ids.hasNext();) {
+ final String id = (String) ids.next();
+ for (Iterator messages = facesContext.getMessages(id); messages.hasNext();) {
+ final FacesMessage message = (FacesMessage) messages.next();
logMessages.add(errorMessageForDebugging(id, message));
}
-
}
if (!logMessages.isEmpty()) {
logMessages.add(0, "LOG.show();");
}
- HtmlRendererUtils.writeScriptLoader(facesContext, null,
- logMessages.toArray(new String[logMessages.size()]));
+ HtmlRendererUtils.writeScriptLoader(facesContext, null, logMessages.toArray(new String[logMessages.size()]));
}
writer.startElement(HtmlElements.NOSCRIPT, null);
@@ -584,13 +585,16 @@ public class PageRenderer extends PageRe
writer.endElement(HtmlElements.DIV);
writer.endElement(HtmlElements.NOSCRIPT);
- writer.endElement(HtmlElements.BODY);
+ final Object response = facesContext.getExternalContext().getResponse();
+ if (PortletUtils.isPortletApiAvailable() && response instanceof MimeResponse) {
+ writer.endElement(HtmlElements.DIV);
+ } else {
+ writer.endElement(HtmlElements.BODY);
+ }
if (LOG.isDebugEnabled()) {
- LOG.debug("unused AccessKeys : "
- + AccessKeyMap.getUnusedKeys(facesContext));
- LOG.debug("duplicated AccessKeys: "
- + AccessKeyMap.getDublicatedKeys(facesContext));
+ LOG.debug("unused AccessKeys : " + AccessKeyMap.getUnusedKeys(facesContext));
+ LOG.debug("duplicated AccessKeys: " + AccessKeyMap.getDublicatedKeys(facesContext));
}
if (facesContext.getExternalContext().getRequestParameterMap().get("X") != null) {
@@ -598,8 +602,9 @@ public class PageRenderer extends PageRe
}
}
- private void writeEventFunction(TobagoResponseWriter writer, Collection<String> eventFunctions,
- String event, boolean returnBoolean) throws IOException {
+ private void writeEventFunction(
+ TobagoResponseWriter writer, Collection<String> eventFunctions, String event, boolean returnBoolean)
+ throws IOException {
if (!eventFunctions.isEmpty()) {
writer.write("Tobago.applicationOn");
writer.write(event);
@@ -649,8 +654,7 @@ public class PageRenderer extends PageRe
}
}
- private void errorMessageForDebugging(String id, FacesMessage message,
- ResponseWriter writer) throws IOException {
+ private void errorMessageForDebugging(String id, FacesMessage message, ResponseWriter writer) throws IOException {
writer.startElement(HtmlElements.DIV, null);
writer.writeAttribute(HtmlAttributes.STYLE, "color: red", null);
writer.flush(); // is needed in some cases, e. g. TOBAGO-1094
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1540495&r1=1540494&r2=1540495&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Sun Nov 10 16:54:58 2013
@@ -635,6 +635,10 @@ li.tobago-menu-markup-selected {
overflow: hidden;
}
+.tobago-page-content-markup-portlet {
+ position: relative;
+}
+
.tobago-page-scrollbarWeight {
width: 100px;
height: 100px;
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml?rev=1540495&r1=1540494&r2=1540495&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml Sun Nov 10 16:54:58 2013
@@ -160,6 +160,12 @@
</supported-markup>
</renderer>
<renderer>
+ <name>Page</name>
+ <supported-markup>
+ <markup>portlet</markup>
+ </supported-markup>
+ </renderer>
+ <renderer>
<name>Popup</name>
<supported-markup>
<markup>modal</markup>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1540495&r1=1540494&r2=1540495&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Sun Nov 10 16:54:58 2013
@@ -289,7 +289,7 @@ var Tobago = {
// new LOG.LogArea({hide: false});
// LOG.show();
TbgTimer.startOnload = new Date(); // @DEV_ONLY
- var body = jQuery("body");
+ var body = jQuery(".tobago-page");
this.page = body.get(0);
this.form = body.find("form").get(0); // find() seems to be faster than children()
this.addBindEventListener(this.form, 'submit', this, 'onSubmit');