Author: abelevich
Date: 2007-09-24 07:54:08 -0400 (Mon, 24 Sep 2007)
New Revision: 3064
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
Log:
RF-976
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java
===================================================================
---
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-09-24
10:34:32 UTC (rev 3063)
+++
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/renderkit/html/ScrollableDataTableBaseRenderer.java 2007-09-24
11:54:08 UTC (rev 3064)
@@ -70,20 +70,18 @@
int prevWidth = 0;
int width = 0;
+
-
String widthPx = (String)column.getAttributes().get("width");
+ widthPx = getFormattedWidth(widthPx);
prevWidth = state.getSumWidth();
+ width = prevWidth + Integer.parseInt(widthPx);
+ state.setSumWidth(width);
- if(widthPx.endsWith("px")){
- width = prevWidth + Integer.parseInt(widthPx.substring(0,
widthPx.indexOf("px")));
- }
-
- state.setSumWidth(width);
return 1;
}
};
-
+
private final ColumnVisitor colsRenderer = new ExtendedColumnVisitor(){
public void renderContent(FacesContext context, UIComponent column, ResponseWriter
writer, ScrollableDataTableRendererState state) throws IOException {
@@ -112,13 +110,9 @@
ComponentsVariableResolver.getVariables(headerCellTemplate, column);
String widthPx = (String)column.getAttributes().get("width");
- // temporary solution RF-957
- if(widthPx.contains("%")){
- throw new FacesException(PERSENTAGE_SUPPORT_ERROR_MSG);
- }
-
- int width = Integer.parseInt(widthPx.substring(0, widthPx.indexOf("px")));
-
+ widthPx = getFormattedWidth(widthPx);
+ int width = Integer.parseInt(widthPx);
+
int sepOffset = 0;
if(state.isFrozenColumn()){
@@ -395,7 +389,20 @@
}
};
+ // temporary solution RF-957
+ public String getFormattedWidth(String receivedWidth ) throws IOException{
+
+ String formattedWidth = receivedWidth;
+
+ if(formattedWidth.endsWith("%")){
+ throw new FacesException(PERSENTAGE_SUPPORT_ERROR_MSG);
+ }else if(formattedWidth.endsWith("px")){
+ formattedWidth = formattedWidth.substring(0,formattedWidth.indexOf("px"));
+ }
+ return formattedWidth;
+ }
+
public ScrollableDataTableBaseRenderer() {
addContributor(new SelectionRendererContributor());
}
Show replies by date