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 2009/11/20 18:17:07 UTC
svn commit: r882645 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/util/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag...
Author: lofwyr
Date: Fri Nov 20 17:16:58 2009
New Revision: 882645
URL: http://svn.apache.org/viewvc?rev=882645&view=rev
Log:
TOBAGO-828 Sheet with new Layout
- height of content is not so ugly.
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java?rev=882645&r1=882644&r2=882645&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUISheetLayout.java Fri Nov 20 17:16:58 2009
@@ -29,6 +29,9 @@
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.Orientation;
+/**
+ * XXX: Not really implemented yet.
+ */
public abstract class AbstractUISheetLayout extends UILayout implements LayoutManager {
private static final Log LOG = LogFactory.getLog(AbstractUIGridLayout.class);
@@ -80,7 +83,7 @@
Measure size = intervals.computeAuto();
size = size.add(LayoutUtils.getBeginOffset(orientation, getLayoutContainer()));
size = size.add(LayoutUtils.getEndOffset(orientation, getLayoutContainer()));
- LayoutUtils.setSize(orientation, getLayoutContainer(), size);
+// todo LayoutUtils.setSize(orientation, getLayoutContainer(), size);
}
}
@@ -99,7 +102,7 @@
for (LayoutComponent component : getLayoutContainer().getComponents()) {
component.setDisplay(Display.BLOCK); // TODO: use CSS via classes and style.css
- LayoutUtils.setSize(orientation, component, available);
+// todo LayoutUtils.setSize(orientation, component, available);
// call sub layout manager
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java?rev=882645&r1=882644&r2=882645&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutInfo.java Fri Nov 20 17:16:58 2009
@@ -20,17 +20,17 @@
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.layout.HideLayoutToken;
import org.apache.myfaces.tobago.layout.LayoutToken;
-import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import org.apache.myfaces.tobago.layout.LayoutTokens;
import org.apache.myfaces.tobago.layout.PercentLayoutToken;
import org.apache.myfaces.tobago.layout.PixelLayoutToken;
-import org.apache.myfaces.tobago.layout.HideLayoutToken;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
import java.util.ArrayList;
import java.util.List;
-import java.util.StringTokenizer;
+@Deprecated
public class LayoutInfo {
private static final Log LOG = LogFactory.getLog(LayoutInfo.class);
@@ -154,32 +154,6 @@
}
- public static String[] createLayoutTokens(String columnLayout, int count, String defaultToken) {
- String[] tokens;
- if (columnLayout != null) {
- List<String> list = new ArrayList<String>();
- StringTokenizer tokenizer = new StringTokenizer(columnLayout, ";");
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken().trim();
- if ("*".equals(token)) {
- token = "1*";
- }
- list.add(token);
- }
- tokens = list.toArray(new String[list.size()]);
- } else {
- defaultToken = "*".equals(defaultToken) ? "1*" : defaultToken;
- tokens = new String[count];
- for (int i = 0; i < tokens.length; i++) {
- tokens[i] = defaultToken;
- }
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("created Tokens : " + tokensToString(tokens));
- }
- return tokens;
- }
-
public static String listToTokenString(List list) {
String[] tokens = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
@@ -213,14 +187,6 @@
return spaces[column] == FREE;
}
- public int getSpaceForColumn(int column) {
- if (column >= spaces.length) {
- LOG.error("spaces length " + spaces.length + " column " + column);
- return 0;
- }
- return spaces[column];
- }
-
public int getSpaceLeft() {
return spaceLeft;
}
Modified: myfaces/tobago/trunk/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/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=882645&r1=882644&r2=882645&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Fri Nov 20 17:16:58 2009
@@ -17,11 +17,6 @@
* limitations under the License.
*/
-/*
- * Created 07.02.2003 16:00:00.
- * $Id$
- */
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
@@ -44,6 +39,7 @@
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.event.PageAction;
import org.apache.myfaces.tobago.layout.AutoLayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.LayoutToken;
import org.apache.myfaces.tobago.layout.LayoutTokens;
import org.apache.myfaces.tobago.layout.Measure;
@@ -102,19 +98,18 @@
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
- UISheet data = (UISheet) uiComponent;
- storeFooterHeight(facesContext, data);
+ UISheet sheet = (UISheet) uiComponent;
- Style style = new Style(facesContext, data);
+ Style style = new Style(facesContext, sheet);
- ensureColumnWidthList(facesContext, data, style);
+ ensureColumnWidthList(facesContext, sheet, style);
- final String sheetId = data.getClientId(facesContext);
+ final String sheetId = sheet.getClientId(facesContext);
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
// Outer sheet div
- writer.startElement(HtmlConstants.DIV, data);
+ writer.startElement(HtmlConstants.DIV, sheet);
writer.writeIdAttribute(sheetId + "_outer_div");
writer.writeClassAttribute("tobago-sheet-outer-div");
writer.writeStyleAttribute(style);
@@ -122,7 +117,7 @@
UICommand dblClickAction = null;
int columnSelectorIndex = -1;
int i = 0;
- for (UIComponent child : (List<UIComponent>) data.getChildren()) {
+ for (UIComponent child : (List<UIComponent>) sheet.getChildren()) {
if (child instanceof UIColumnEvent) {
UIColumnEvent columnEvent = (UIColumnEvent) child;
if (columnEvent.isRendered()) {
@@ -143,7 +138,7 @@
i++;
}
- renderSheet(facesContext, data, (clickAction != null || dblClickAction != null), style);
+ renderSheet(facesContext, sheet, (clickAction != null || dblClickAction != null), style);
writer.endElement(HtmlConstants.DIV);
@@ -156,14 +151,14 @@
boolean ajaxEnabled = TobagoConfig.getInstance(facesContext).isAjaxEnabled();
Integer frequency = null;
- UIComponent facetReload = data.getFacet(Facets.RELOAD);
+ UIComponent facetReload = sheet.getFacet(Facets.RELOAD);
if (facetReload != null && facetReload instanceof UIReload && facetReload.isRendered()) {
UIReload update = (UIReload) facetReload;
frequency = update.getFrequency();
}
final String[] cmds = {
"new Tobago.Sheet(\"" + sheetId + "\", " + ajaxEnabled
- + ", \"" + checked + "\", \"" + unchecked + "\", \"" + data.getSelectable()
+ + ", \"" + checked + "\", \"" + unchecked + "\", \"" + sheet.getSelectable()
+ "\", " + columnSelectorIndex + ", " + frequency
+ ", " + (clickAction != null ? HtmlRendererUtils.getJavascriptString(clickAction.getId()) : null)
+ ", " + HtmlRendererUtils.getRenderedPartiallyJavascriptArray(facesContext, clickAction)
@@ -175,13 +170,13 @@
HtmlRendererUtils.writeScriptLoader(facesContext, SCRIPTS, cmds);
}
- private void renderSheet(FacesContext facesContext, UISheet data, boolean hasClickAction, Style style)
+ private void renderSheet(FacesContext facesContext, UISheet sheet, boolean hasClickAction, Style style)
throws IOException {
TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
UIViewRoot viewRoot = facesContext.getViewRoot();
String contextPath = facesContext.getExternalContext().getRequestContextPath();
- String sheetId = data.getClientId(facesContext);
+ String sheetId = sheet.getClientId(facesContext);
String image1x1 = contextPath + resourceManager.getImage(viewRoot, "image/1x1.gif");
String selectorDisabled = contextPath + resourceManager.getImage(viewRoot, "image/sheetUncheckedDisabled.gif");
@@ -198,16 +193,15 @@
} else {
sheetHeight = style.getHeight();
}
- Measure footerHeight = (Measure) data.getAttributes().get(Attributes.FOOTER_HEIGHT);
-
- String selectable = data.getSelectable();
+ Measure footerHeight = getFooterHeight(facesContext, sheet);
+ String selectable = sheet.getSelectable();
Application application = facesContext.getApplication();
- SheetState state = data.getSheetState(facesContext);
- List<Integer> columnWidths = data.getWidthList();
+ SheetState state = sheet.getSheetState(facesContext);
+ List<Integer> columnWidths = sheet.getWidthList();
- String selectedRows = StringUtils.joinWithSurroundingSeparator(getSelectedRows(data, state));
- List<UIColumn> renderedColumnList = data.getRenderedColumns();
+ String selectedRows = StringUtils.joinWithSurroundingSeparator(getSelectedRows(sheet, state));
+ List<UIColumn> renderedColumnList = sheet.getRenderedColumns();
writer.startElement(HtmlConstants.INPUT, null);
@@ -221,7 +215,7 @@
writer.writeIdAttribute(sheetId + SCROLL_POSTFIX);
writer.writeNameAttribute(sheetId + SCROLL_POSTFIX);
writer.writeAttribute(HtmlAttributes.TYPE, "hidden", false);
- Integer[] scrollPosition = data.getScrollPosition();
+ Integer[] scrollPosition = sheet.getScrollPosition();
if (scrollPosition != null) {
String scroll = scrollPosition[0] + ";" + scrollPosition[1];
writer.writeAttribute(HtmlAttributes.VALUE, scroll, false);
@@ -240,7 +234,7 @@
}
- final boolean showHeader = data.getShowHeader();
+ final boolean showHeader = sheet.getShowHeader();
if (showHeader) {
// begin rendering header
writer.startElement(HtmlConstants.DIV, null);
@@ -250,7 +244,7 @@
writer.writeStyleAttribute(new Style());
int columnCount = 0;
- Measure sortMarkerWidth = getAscendingMarkerWidth(facesContext, data);
+ Measure sortMarkerWidth = getAscendingMarkerWidth(facesContext, sheet);
String imageAscending = contextPath + resourceManager.getImage(viewRoot, "image/ascending.gif");
String imageDescending = contextPath + resourceManager.getImage(viewRoot, "image/descending.gif");
String img = resourceManager.getImage(viewRoot, "image/unsorted.gif", true);
@@ -259,7 +253,7 @@
imageUnsorted = contextPath + img;
}
for (UIColumn column : renderedColumnList) {
- renderColumnHeader(facesContext, writer, data, columnCount, column,
+ renderColumnHeader(facesContext, writer, sheet, columnCount, column,
imageAscending, imageDescending, imageUnsorted, image1x1, sortMarkerWidth);
columnCount++;
}
@@ -282,7 +276,7 @@
// BEGIN RENDER BODY CONTENT
Style bodyStyle = new Style();
bodyStyle.setPosition(Position.RELATIVE);
- bodyStyle.setWidth(data.getWidth());
+ bodyStyle.setWidth(sheet.getWidth());
bodyStyle.setHeight(sheetHeight.subtract(footerHeight));
writer.startElement(HtmlConstants.DIV, null);
@@ -296,9 +290,9 @@
if (bodyStyle.getWidth() != null) {
// intSpace -= columnWidths.get(columnWidths.size() - 1);
Measure space = bodyStyle.getWidth();
- space.subtractNotNegative(getContentBorder(facesContext, data));
- if (needVerticalScrollbar(facesContext, data, style)) {
- space.subtractNotNegative(getScrollbarWidth(facesContext, data));
+ space.subtractNotNegative(getContentBorder(facesContext, sheet));
+ if (needVerticalScrollbar(facesContext, sheet, style)) {
+ space.subtractNotNegative(getScrollbarWidth(facesContext, sheet));
}
sheetBodyStyle.setWidth(space);
}
@@ -325,18 +319,18 @@
// Print the Content
if (LOG.isDebugEnabled()) {
- LOG.debug("first = " + data.getFirst() + " rows = " + data.getRows());
+ LOG.debug("first = " + sheet.getFirst() + " rows = " + sheet.getRows());
}
- final String var = data.getVar();
+ final String var = sheet.getVar();
boolean odd = false;
int visibleIndex = -1;
- final int last = data.getFirst() + data.getRows();
- for (int rowIndex = data.getFirst(); rowIndex < last; rowIndex++) {
+ final int last = sheet.getFirst() + sheet.getRows();
+ for (int rowIndex = sheet.getFirst(); rowIndex < last; rowIndex++) {
visibleIndex++;
- data.setRowIndex(rowIndex);
- if (!data.isRowAvailable()) {
+ sheet.setRowIndex(rowIndex);
+ if (!sheet.isRowAvailable()) {
break;
}
odd = !odd;
@@ -344,7 +338,7 @@
if (LOG.isDebugEnabled()) {
LOG.debug("var " + var);
- LOG.debug("list " + data.getValue());
+ LOG.debug("list " + sheet.getValue());
}
writer.startElement(HtmlConstants.TR, null);
@@ -399,10 +393,20 @@
writer.writeClassAttribute("tobago-sheet-column-selector");
writer.endElement(HtmlConstants.IMG);
} else {
- List<UIComponent> childs = data.getRenderedChildrenOf(column);
+ List<UIComponent> childs = sheet.getRenderedChildrenOf(column);
for (UIComponent grandkid : childs) {
// set height to 0 to prevent use of layoutheight from parent
grandkid.getAttributes().put(Attributes.LAYOUT_HEIGHT, HEIGHT_0);
+ // XXX hotfix
+ if (grandkid instanceof LayoutBase) {
+ LayoutBase base = (LayoutBase) grandkid;
+ if (base.getLeft() != null) {
+ base.setLeft(null);
+ }
+ if (base.getTop() != null) {
+ base.setTop(null);
+ }
+ }
RenderUtil.prepareRendererAll(facesContext, grandkid);
RenderUtil.encode(facesContext, grandkid);
}
@@ -436,7 +440,7 @@
writer.endElement(HtmlConstants.TR);
}
- data.setRowIndex(-1);
+ sheet.setRowIndex(-1);
writer.endElement(HtmlConstants.TABLE);
@@ -445,32 +449,33 @@
// END RENDER BODY CONTENT
final String showRowRange
- = getPagingAttribute(data, Attributes.SHOW_ROW_RANGE);
+ = getPagingAttribute(sheet, Attributes.SHOW_ROW_RANGE);
final String showPageRange
- = getPagingAttribute(data, Attributes.SHOW_PAGE_RANGE);
+ = getPagingAttribute(sheet, Attributes.SHOW_PAGE_RANGE);
final String showDirectLinks
- = getPagingAttribute(data, Attributes.SHOW_DIRECT_LINKS);
+ = getPagingAttribute(sheet, Attributes.SHOW_DIRECT_LINKS);
if (isValidPagingValue(showRowRange)
|| isValidPagingValue(showPageRange)
|| isValidPagingValue(showDirectLinks)) {
Style footerStyle = new Style(bodyStyle);
+ footerStyle.setPosition(null); // todo: may be removed later; later the body has not position set.
footerStyle.setHeight(footerHeight);
footerStyle.setTop(sheetHeight.subtract(footerHeight));
// "height", MessageFormat.format("{0}px", footerHeight));
// + " top: " + (sheetHeight - footerHeight) + "px;";
- writer.startElement(HtmlConstants.DIV, data);
+ writer.startElement(HtmlConstants.DIV, sheet);
writer.writeClassAttribute("tobago-sheet-footer");
writer.writeStyleAttribute(footerStyle);
if (isValidPagingValue(showRowRange)) {
- UICommand pagerCommand = (UICommand) data.getFacet(Facets.PAGER_ROW);
+ UICommand pagerCommand = (UICommand) sheet.getFacet(Facets.PAGER_ROW);
if (pagerCommand == null) {
pagerCommand = createPagingCommand(application, PageAction.TO_ROW, false);
- data.getFacets().put(Facets.PAGER_ROW, pagerCommand);
+ sheet.getFacets().put(Facets.PAGER_ROW, pagerCommand);
}
String pagingOnClick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
final String pagerCommandId = pagerCommand.getClientId(facesContext);
@@ -485,7 +490,7 @@
writer.writeAttribute(HtmlAttributes.TITLE, ResourceManagerUtil.getPropertyNotNull(
facesContext, "tobago", "sheetPagingInfoRowPagingTip"), true);
writer.writeText("");
- writer.write(createSheetPagingInfo(data, facesContext,
+ writer.write(createSheetPagingInfo(sheet, facesContext,
pagerCommandId, true));
writer.endElement(HtmlConstants.SPAN);
}
@@ -498,17 +503,17 @@
writer.startElement(HtmlConstants.SPAN, null);
writer.writeClassAttribute(className);
writer.writeIdAttribute(sheetId + SUBCOMPONENT_SEP + "pagingLinks");
- writeDirectPagingLinks(writer, facesContext, application, data);
+ writeDirectPagingLinks(writer, facesContext, application, sheet);
writer.endElement(HtmlConstants.SPAN);
}
if (isValidPagingValue(showPageRange)) {
UICommand pagerCommand
- = (UICommand) data.getFacet(Facets.PAGER_PAGE);
+ = (UICommand) sheet.getFacet(Facets.PAGER_PAGE);
if (pagerCommand == null) {
pagerCommand = createPagingCommand(
application, PageAction.TO_PAGE, false);
- data.getFacets().put(Facets.PAGER_PAGE, pagerCommand);
+ sheet.getFacets().put(Facets.PAGER_PAGE, pagerCommand);
}
String pagingOnClick = new CommandRendererHelper(facesContext, pagerCommand).getOnclickDoubleQuoted();
final String pagerCommandId = pagerCommand.getClientId(facesContext);
@@ -522,9 +527,9 @@
writer.writeIdAttribute(sheetId + SUBCOMPONENT_SEP + "pagingPages");
writer.writeText("");
- boolean atBeginning = data.isAtBeginning();
- link(facesContext, application, atBeginning, PageAction.FIRST, data);
- link(facesContext, application, atBeginning, PageAction.PREV, data);
+ boolean atBeginning = sheet.isAtBeginning();
+ link(facesContext, application, atBeginning, PageAction.FIRST, sheet);
+ link(facesContext, application, atBeginning, PageAction.PREV, sheet);
writer.startElement(HtmlConstants.SPAN, null);
writer.writeClassAttribute("tobago-sheet-paging-pages-text");
writer.writeAttribute(HtmlAttributes.ONCLICK, "tobagoSheetEditPagingRow(this, '"
@@ -533,11 +538,11 @@
facesContext, "tobago", "sheetPagingInfoPagePagingTip"), true);
writer.writeText("");
writer.write(createSheetPagingInfo(
- data, facesContext, pagerCommandId, false));
+ sheet, facesContext, pagerCommandId, false));
writer.endElement(HtmlConstants.SPAN);
- boolean atEnd = data.isAtEnd();
- link(facesContext, application, atEnd, PageAction.NEXT, data);
- link(facesContext, application, atEnd || !data.hasRowCount(), PageAction.LAST, data);
+ boolean atEnd = sheet.isAtEnd();
+ link(facesContext, application, atEnd, PageAction.NEXT, sheet);
+ link(facesContext, application, atEnd || !sheet.hasRowCount(), PageAction.LAST, sheet);
writer.endElement(HtmlConstants.SPAN);
}
@@ -545,19 +550,18 @@
}
}
- private String createSheetPagingInfo(UISheet data,
- FacesContext facesContext, String pagerCommandId, boolean row) {
+ private String createSheetPagingInfo(UISheet sheet, FacesContext facesContext, String pagerCommandId, boolean row) {
String sheetPagingInfo;
- if (data.getRowCount() > 0) {
+ if (sheet.getRowCount() > 0) {
Locale locale = facesContext.getViewRoot().getLocale();
int first;
int last;
if (row) {
- first = data.getFirst() + 1;
- last = data.getLast();
+ first = sheet.getFirst() + 1;
+ last = sheet.getLast();
} else { // page
- first = data.getPage();
- last = data.getPages();
+ first = sheet.getPage();
+ last = sheet.getPages();
}
String key;
if (first != last) {
@@ -571,7 +575,7 @@
Object[] args = {
first,
last,
- data.getRowCount(),
+ sheet.getRowCount(),
pagerCommandId + SUBCOMPONENT_SEP + "text"
};
sheetPagingInfo = detail.format(args);
@@ -625,12 +629,12 @@
}
- private boolean needVerticalScrollbar(FacesContext facesContext, UISheet data, Style style) {
+ private boolean needVerticalScrollbar(FacesContext facesContext, UISheet sheet, Style style) {
// estimate need of height-scrollbar on client, if yes we have to consider
// this when calculating column width's
final Object forceScroolbar
- = data.getAttributes().get(Attributes.FORCE_VERTICAL_SCROLLBAR);
+ = sheet.getAttributes().get(Attributes.FORCE_VERTICAL_SCROLLBAR);
if (forceScroolbar != null) {
if ("true".equals(forceScroolbar)) {
return true;
@@ -643,11 +647,11 @@
}
if (style.getHeight() != null) {
- int first = data.getFirst();
- int rows = Math.min(data.getRowCount(), first + data.getRows()) - first;
+ int first = sheet.getFirst();
+ int rows = Math.min(sheet.getRowCount(), first + sheet.getRows()) - first;
LOG.error("20; // FIXME: make dynamic (was removed by changing the layouting");
- Measure heightNeeded = getFooterHeight(facesContext, data)
- .add(getRowPadding(facesContext, data).add(20/*fixme*/).multiply(rows))
+ Measure heightNeeded = getFooterHeight(facesContext, sheet)
+ .add(getRowPadding(facesContext, sheet).add(20/*fixme*/).multiply(rows))
.add(20); // FIXME: make dynamic (was removed by changing the layouting
return heightNeeded.greaterThan(style.getHeight());
} else {
@@ -667,18 +671,16 @@
data.getAttributes().put(Attributes.FOOTER_HEIGHT, getFooterHeight(facesContext, data));
}
- private Measure getFooterHeight(FacesContext facesContext, UISheet data) {
- // todo: use Measure instead of int
- Measure footerHeight;
- if (isValidPagingAttribute(data, Attributes.SHOW_ROW_RANGE)
- || isValidPagingAttribute(data, Attributes.SHOW_PAGE_RANGE)
- || isValidPagingAttribute(data, Attributes.SHOW_DIRECT_LINKS)) {
- footerHeight =
- ThemeConfig.getMeasure(facesContext, data, "footerHeight");
- } else {
- footerHeight = PixelMeasure.ZERO;
- }
- return footerHeight;
+ private Measure getFooterHeight(FacesContext facesContext, UISheet sheet) {
+ return isFooterVisible(sheet)
+ ? ThemeConfig.getMeasure(facesContext, sheet, "footerHeight")
+ : PixelMeasure.ZERO;
+ }
+
+ private boolean isFooterVisible(UISheet sheet) {
+ return isValidPagingAttribute(sheet, Attributes.SHOW_ROW_RANGE)
+ || isValidPagingAttribute(sheet, Attributes.SHOW_PAGE_RANGE)
+ || isValidPagingAttribute(sheet, Attributes.SHOW_DIRECT_LINKS);
}
private boolean isValidPagingAttribute(UISheet component, String name) {
@@ -699,6 +701,7 @@
}
private boolean isValidPagingValue(String value) {
+ // todo: use enum type instead of string
return "left".equals(value) || "center".equals(value)
|| "right".equals(value);
}
@@ -753,10 +756,10 @@
writer.endElement(HtmlConstants.IMG);
}
- private void renderColumnHeader(FacesContext facesContext,
- TobagoResponseWriter writer, UISheet component,
- int columnIndex, UIColumn column, String imageAscending, String imageDescending, String imageUnsorted,
- String image1x1, Measure sortMarkerWidth) throws IOException {
+ private void renderColumnHeader(
+ FacesContext facesContext, TobagoResponseWriter writer, UISheet component,
+ int columnIndex, UIColumn column, String imageAscending, String imageDescending, String imageUnsorted,
+ String image1x1, Measure sortMarkerWidth) throws IOException {
String sheetId = component.getClientId(facesContext);
Application application = facesContext.getApplication();
@@ -1077,7 +1080,7 @@
}
private Measure getContentBorder(FacesContext facesContext, UISheet data) {
- return ThemeConfig.getMeasure(facesContext, data, "contentBorder");
+ return getLeftOffset(facesContext, data).add(getRightOffset(facesContext, data));
}
public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
@@ -1161,9 +1164,9 @@
}
Measure space = data.getWidth();
- space.subtractNotNegative(getContentBorder(facesContext, data));
+ space = space.subtractNotNegative(getContentBorder(facesContext, data));
if (needVerticalScrollbar(facesContext, data, style)) {
- space.subtractNotNegative(getScrollbarWidth(facesContext, data));
+ space = space.subtractNotNegative(getScrollbarWidth(facesContext, data));
}
LayoutInfo layoutInfo =
new LayoutInfo(newTokens.getSize(), space.getPixel(), newTokens, data.getClientId(facesContext), false);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=882645&r1=882644&r2=882645&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Fri Nov 20 17:16:58 2009
@@ -24,7 +24,6 @@
Tobago.fixedHeight=25
Tobago.pickerSpace=5
Tobago.scrollbarWidth=19
-Tobago.contentBorder=0
Tobago.clientBorder=12
Tobago.headerHeight=0
Tobago.labelSpace=0
@@ -137,6 +136,10 @@
Sheet.rowPadding=5
Sheet.selectorMenuWidth=20
Sheet.cellPaddingWidth=4
+Sheet.leftOffset=0
+Sheet.topOffset=0
+Sheet.rightOffset=0
+Sheet.bottomOffset=0
Tab.paddingWidth=0
Tab.paddingHeight=0
Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?rev=882645&r1=882644&r2=882645&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties Fri Nov 20 17:16:58 2009
@@ -84,9 +84,10 @@
Sheet.headerHeight=20
Sheet.footerHeight=15
Sheet.rowPadding=3
-Sheet.contentBorder=2
Sheet.selectorMenuWidth=16
Sheet.cellPaddingWidth=4
+Sheet.leftOffset=1
+Sheet.rightOffset=1
Tab.paddingWidth=0
Tab.paddingHeight=0