You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/10/31 15:54:51 UTC
svn commit: r1537516 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
tobago-theme...
Author: weber
Date: Thu Oct 31 14:54:51 2013
New Revision: 1537516
URL: http://svn.apache.org/r1537516
Log:
TOBAGO-1337 - Sheet: problems forceVerticalScrollbar = true
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java?rev=1537516&r1=1537515&r2=1537516&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheetLayout.java Thu Oct 31 14:54:51 2013
@@ -283,7 +283,7 @@ public abstract class AbstractUISheetLay
}
}
- private boolean needVerticalScrollbar(FacesContext facesContext, AbstractUISheet sheet) {
+ public boolean needVerticalScrollbar(FacesContext facesContext, AbstractUISheet sheet) {
// estimate need of height-scrollbar on client, if yes we have to consider
// this when calculating column width's
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.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/SheetRenderer.java?rev=1537516&r1=1537515&r2=1537516&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Thu Oct 31 14:54:51 2013
@@ -45,6 +45,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.component.AbstractUIMenu;
import org.apache.myfaces.tobago.internal.component.AbstractUIOut;
import org.apache.myfaces.tobago.internal.component.AbstractUISheet;
+import org.apache.myfaces.tobago.internal.component.AbstractUISheetLayout;
import org.apache.myfaces.tobago.internal.context.ResourceManagerFactory;
import org.apache.myfaces.tobago.internal.layout.Cell;
import org.apache.myfaces.tobago.internal.layout.Grid;
@@ -729,6 +730,9 @@ public class SheetRenderer extends Layou
LOG.debug("*****************************************************");
}
+ boolean needVerticalScrollbar = needVerticalScrollbar(facesContext, sheet);
+ int verticalScrollbarWidth = 0;
+
writer.startElement(HtmlElements.DIV, sheet);
writer.writeClassAttribute(Classes.create(sheet, "headerDiv"));
writer.startElement(HtmlElements.TABLE, sheet);
@@ -736,12 +740,22 @@ public class SheetRenderer extends Layou
writer.writeAttribute(HtmlAttributes.CELLPADDING, "0", false);
writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
writer.writeClassAttribute(Classes.create(sheet, "headerTable"));
+ if (needVerticalScrollbar) {
+ verticalScrollbarWidth = getVerticalScrollbarWeight(facesContext, sheet).getPixel();
+ writer.writeAttribute("data-tobago-sheet-verticalscrollbarwidth", String.valueOf(verticalScrollbarWidth), false);
+ }
if (columnWidths != null) {
writer.startElement(HtmlElements.COLGROUP, null);
- for (Integer columnWidth : columnWidths) {
+ for (int i = 0 ; i < columnWidths.size(); i++) {
writer.startElement(HtmlElements.COL, null);
- writer.writeAttribute(HtmlAttributes.WIDTH, columnWidth);
+ if (i == columnWidths.size() - 2 && needVerticalScrollbar) {
+ // if scrollbar is needed the coll for column in header must have own width + scrollbarWidth
+ writer.writeAttribute(
+ HtmlAttributes.WIDTH, columnWidths.get(i) + verticalScrollbarWidth);
+ } else {
+ writer.writeAttribute(HtmlAttributes.WIDTH, columnWidths.get(i));
+ }
writer.endElement(HtmlElements.COL);
}
writer.endElement(HtmlElements.COLGROUP);
@@ -887,6 +901,10 @@ public class SheetRenderer extends Layou
writer.endElement(HtmlElements.DIV);
}
+ private boolean needVerticalScrollbar(FacesContext facesContext, UISheet sheet) {
+ return ((AbstractUISheetLayout) sheet.getLayoutManager()).needVerticalScrollbar(facesContext, sheet);
+ }
+
private void encodeResizing(TobagoResponseWriter writer, AbstractUISheet sheet, int columnIndex) throws IOException {
writer.startElement(HtmlElements.SPAN, null);
writer.writeClassAttribute(Classes.create(sheet, "headerResize"));
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.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-sheet.js?rev=1537516&r1=1537515&r2=1537516&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Thu Oct 31 14:54:51 2013
@@ -288,6 +288,24 @@ Tobago.Sheet.setup2 = function (sheets)
Tobago.Sheet.resetInputFieldSize(jQuery(this));
});
+
+ // adjust body row filler cells if no scrollbar present but was calculated
+ jQuery(sheets).find("[data-tobago-sheet-verticalscrollbarwidth]").each(function() {
+ var table = jQuery(this);
+ var verticalScrollbarWidth = table.data("tobago-sheet-verticalscrollbarwidth");
+ if (verticalScrollbarWidth !== undefined) {
+ var bodyDiv = table.parent().next();
+ var bodyHeight = bodyDiv.css("height").replace("px", "");
+ var scrollHeight = bodyDiv.prop("scrollHeight");
+ if (bodyHeight >= scrollHeight) {
+ table = bodyDiv.find("table");
+ table.find("col").last().attr("width", verticalScrollbarWidth);
+ var tableWidth = table.css("width").replace("px", "") * 1;
+ table.css("width", tableWidth + verticalScrollbarWidth);
+ }
+ }
+ });
+
// resize: mouse events
jQuery(sheets).find(".tobago-sheet-headerResize").each(function () {
jQuery(this).click(function () {