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/06/26 14:13:47 UTC
svn commit: r788668 [5/6] - in /myfaces/tobago/trunk: core/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/context/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache...
Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneListboxExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneListboxExtensionTag.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneListboxExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneListboxExtensionTag.java Fri Jun 26 12:13:41 2009
@@ -22,14 +22,17 @@
import org.apache.myfaces.tobago.internal.taglib.SelectOneListboxTag;
import org.apache.myfaces.tobago.taglib.decl.HasBinding;
import org.apache.myfaces.tobago.taglib.decl.HasConverter;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedHeight;
+import org.apache.myfaces.tobago.taglib.decl.HasConverterMessage;
import org.apache.myfaces.tobago.taglib.decl.HasId;
import org.apache.myfaces.tobago.taglib.decl.HasLabel;
import org.apache.myfaces.tobago.taglib.decl.HasLabelWidth;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import org.apache.myfaces.tobago.taglib.decl.HasOnchange;
+import org.apache.myfaces.tobago.taglib.decl.HasRequiredMessage;
import org.apache.myfaces.tobago.taglib.decl.HasTabIndex;
import org.apache.myfaces.tobago.taglib.decl.HasTip;
import org.apache.myfaces.tobago.taglib.decl.HasValidator;
+import org.apache.myfaces.tobago.taglib.decl.HasValidatorMessage;
import org.apache.myfaces.tobago.taglib.decl.HasValue;
import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
@@ -37,10 +40,6 @@
import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
import org.apache.myfaces.tobago.taglib.decl.IsRendered;
import org.apache.myfaces.tobago.taglib.decl.IsRequired;
-import org.apache.myfaces.tobago.taglib.decl.HasValidatorMessage;
-import org.apache.myfaces.tobago.taglib.decl.HasRequiredMessage;
-import org.apache.myfaces.tobago.taglib.decl.HasConverterMessage;
-import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
@@ -54,19 +53,17 @@
extends BodyTagSupport implements HasId, HasValue, HasValueChangeListener, IsDisabled,
HasLabel, HasLabelWidth, IsReadonly, HasOnchange, IsRendered,
HasValidatorMessage, HasRequiredMessage, HasConverterMessage, HasMarkup,
- HasBinding, HasDeprecatedHeight, IsFocus, HasTip, IsRequired, HasConverter, HasValidator, HasTabIndex {
+ HasBinding, IsFocus, HasTip, IsRequired, HasConverter, HasValidator, HasTabIndex {
private String required;
private String value;
private String valueChangeListener;
private String disabled;
private String readonly;
private String onchange;
- //private String inline;
private String label;
private String rendered;
private String binding;
private String tip;
- private String height;
private String converter;
private String validator;
private String labelWidth;
@@ -136,9 +133,6 @@
if (id != null) {
selectOneListboxTag.setId(id);
}
- if (height != null) {
- selectOneListboxTag.setHeight(height);
- }
if (readonly != null) {
selectOneListboxTag.setReadonly(readonly);
}
@@ -180,10 +174,8 @@
binding = null;
onchange = null;
disabled = null;
- //inline = null;
labelWidth = null;
label = null;
- height = null;
readonly = null;
rendered = null;
converter = null;
@@ -226,18 +218,10 @@
this.onchange = onchange;
}
-/* public void setInline(String inline) {
- this.inline = inline;
- }*/
-
public void setLabel(String label) {
this.label = label;
}
- public void setHeight(String height) {
- this.height = height;
- }
-
public void setValidator(String validator) {
this.validator = validator;
}
Modified: myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/LabelExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/LabelExtensionTag.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/LabelExtensionTag.java (original)
+++ myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/LabelExtensionTag.java Fri Jun 26 12:13:41 2009
@@ -27,7 +27,7 @@
import org.apache.myfaces.tobago.internal.taglib.GridLayoutTag;
import org.apache.myfaces.tobago.internal.taglib.LabelTag;
import org.apache.myfaces.tobago.internal.taglib.PanelTag;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import javax.el.ValueExpression;
import javax.faces.webapp.FacetTag;
@@ -153,7 +153,7 @@
}
void setColumns(javax.el.ValueExpression columns) {
- if (!(!columns.isLiteralText() || LayoutUtil.checkTokens(columns.getExpressionString()))) {
+ if (!(!columns.isLiteralText() || LayoutUtils.checkTokens(columns.getExpressionString()))) {
LOG.warn("Illegal value for columns = \"" + columns.getExpressionString()
+ "\" replacing with default: \"" + DEFAULT_COLUMNS + "\"");
this.columns = createStringValueExpression(DEFAULT_COLUMNS);
Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/fo/standard/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/fo/standard/standard/tag/GridLayoutRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/fo/standard/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/fo/standard/standard/tag/GridLayoutRenderer.java Fri Jun 26 12:13:41 2009
@@ -20,7 +20,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.UIGridLayout;
-import org.apache.myfaces.tobago.renderkit.LayoutManager;
import javax.faces.component.UIComponent;
import javax.faces.component.UIMessages;
@@ -30,13 +29,7 @@
import java.util.Iterator;
import java.util.List;
-/*
- * Created: Dec 1, 2004 7:25:02 PM
- * User: bommel
- * $Id:GridLayoutRenderer.java 472227 2006-11-07 21:05:00 +0100 (Tue, 07 Nov 2006) bommel $
- */
-public class GridLayoutRenderer extends FoRendererBase
- implements LayoutManager {
+public class GridLayoutRenderer extends FoRendererBase {
private static final Log LOG = LogFactory.getLog(GridLayoutRenderer.class);
@@ -50,8 +43,6 @@
LOG.debug("*** begin " + component);
}
try {
-
-
layoutBegin(facesContext, component);
} catch (RuntimeException e) {
LOG.error("caught RuntimeException :", e);
Modified: myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/RichTextEditorTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/RichTextEditorTagDeclaration.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/RichTextEditorTagDeclaration.java (original)
+++ myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/RichTextEditorTagDeclaration.java Fri Jun 26 12:13:41 2009
@@ -19,7 +19,6 @@
/*import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-import org.apache.myfaces.tobago.taglib.decl.HasDeprecatedWidth;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
import org.apache.myfaces.tobago.taglib.decl.HasValue;*/
@@ -35,7 +34,7 @@
// TODO: switched off @Tag(name="richTextEditor")
public interface RichTextEditorTagDeclaration {
//extends TextInputTagDeclaration,
- /*HasIdBindingAndRendered, HasValue, HasLabelAndAccessKey, HasDeprecatedWidth {
+ /*HasIdBindingAndRendered, HasValue, HasLabelAndAccessKey {
@TagAttribute
@UIComponentTagAttribute(type = "java.lang.Boolean")
void setStatePreview(String statePreview);*/
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.java Fri Jun 26 12:13:41 2009
@@ -30,7 +30,7 @@
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -59,7 +59,7 @@
String value1 = Integer.toString(model.getValue());
String value2 = Integer.toString(model.getMaximum() - model.getValue());
- Integer width = LayoutUtil.getLayoutWidth(component);
+ Integer width = LayoutUtils.getLayoutWidth(component);
String width1 = value1;
String width2 = value2;
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java Fri Jun 26 12:13:41 2009
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.component.AbstractUICommand;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UIButtonCommand;
import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
@@ -58,7 +59,7 @@
if (!(component instanceof UICommand)) {
return;
}
- UICommand command = (UICommand) component;
+ AbstractUICommand command = (AbstractUICommand) component;
String clientId = command.getClientId(facesContext);
CommandRendererHelper helper = new CommandRendererHelper(facesContext, command, CommandRendererHelper.Tag.BUTTON);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CellRenderer.java Fri Jun 26 12:13:41 2009
@@ -17,6 +17,10 @@
* limitations under the License.
*/
+/**
+ * @deprecated The Cell is deprecated since Tobago 1.1
+ */
+@Deprecated
public class CellRenderer extends PanelRenderer {
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Fri Jun 26 12:13:41 2009
@@ -26,6 +26,7 @@
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.UIBox;
+import org.apache.myfaces.tobago.component.UIButtonCommand;
import org.apache.myfaces.tobago.component.UIDateInput;
import org.apache.myfaces.tobago.component.UIDatePicker;
import org.apache.myfaces.tobago.component.UIGridLayout;
@@ -37,6 +38,7 @@
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
import org.apache.myfaces.tobago.event.PopupActionListener;
+import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.util.DateFormatUtils;
@@ -52,10 +54,6 @@
import java.util.Map;
import java.util.TimeZone;
-/*
- * Date: 30.05.2006
- * Time: 22:21:17
- */
public class DatePickerRenderer extends LinkRenderer {
private static final Log LOG = LogFactory.getLog(DatePickerRenderer.class);
public static final String CLOSE_POPUP = "closePopup";
@@ -155,19 +153,15 @@
box.getChildren().add(buttonPanel);
- final org.apache.myfaces.tobago.component.UICommand okButton =
- (org.apache.myfaces.tobago.component.UICommand) CreateComponentUtils.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
- RendererTypes.BUTTON);
+ final UIButtonCommand okButton = (UIButtonCommand)
+ CreateComponentUtils.createComponent(facesContext, UIButtonCommand.COMPONENT_TYPE, RendererTypes.BUTTON);
buttonPanel.getChildren().add(okButton);
okButton.setId("ok" + CLOSE_POPUP);
okButton.getAttributes().put(Attributes.LABEL, ResourceManagerUtil.getPropertyNotNull(
facesContext, "tobago", "datePickerOk"));
- final org.apache.myfaces.tobago.component.UICommand cancelButton =
- (org.apache.myfaces.tobago.component.UICommand) CreateComponentUtils.createComponent(facesContext,
- org.apache.myfaces.tobago.component.UIButtonCommand.COMPONENT_TYPE,
- RendererTypes.BUTTON);
+ final UIButtonCommand cancelButton = (UIButtonCommand)
+ CreateComponentUtils.createComponent(facesContext, UIButtonCommand.COMPONENT_TYPE, RendererTypes.BUTTON);
buttonPanel.getChildren().add(cancelButton);
cancelButton.getAttributes().put(Attributes.LABEL, ResourceManagerUtil.getPropertyNotNull(
@@ -175,8 +169,8 @@
cancelButton.setId(CLOSE_POPUP);
// create image
- UIGraphic image = (UIGraphic) CreateComponentUtils.createComponent(
- facesContext, UIGraphic.COMPONENT_TYPE, RendererTypes.IMAGE);
+ UIGraphic image = (UIGraphic)
+ CreateComponentUtils.createComponent(facesContext, UIGraphic.COMPONENT_TYPE, RendererTypes.IMAGE);
image.setRendered(true);
if (linkId != null) {
image.setId(linkId + "image");
@@ -195,18 +189,15 @@
if (facesContext instanceof TobagoFacesContext) {
UIPopup popup = (UIPopup) component.getFacets().get(Facets.PICKER_POPUP);
if (popup != null) {
- popup.getAttributes().put(
- Attributes.WIDTH, ThemeConfig.getValue(facesContext, component, "CalendarPopupWidth"));
- popup.getAttributes().put(
- Attributes.HEIGHT, ThemeConfig.getValue(facesContext, component, "CalendarPopupHeight"));
+ popup.setWidth(new PixelMeasure(ThemeConfig.getValue(facesContext, component, "CalendarPopupWidth")));
+ popup.setHeight(new PixelMeasure(ThemeConfig.getValue(facesContext, component, "CalendarPopupHeight")));
((TobagoFacesContext) facesContext).getPopups().add(popup);
}
}
super.prepareRender(facesContext, component);
}
- public void encodeBegin(FacesContext facesContext,
- UIComponent component) throws IOException {
+ public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
UIDatePicker link = (UIDatePicker) component;
// DatePickerController datePickerController = new DatePickerController();
UIDateInput dateInput = (UIDateInput) link.getForComponent();
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FileRenderer.java Fri Jun 26 12:13:41 2009
@@ -35,7 +35,7 @@
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import org.apache.myfaces.tobago.webapp.TobagoMultipartFormdataRequest;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -65,7 +65,7 @@
int space = 0;
if (component.getFacet(Facets.LABEL) != null) {
- int labelWidht = LayoutUtil.getLabelWidth(component);
+ int labelWidht = LayoutUtils.getLabelWidth(component);
space += labelWidht != 0
? labelWidht : getLabelWidth(facesContext, component);
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java Fri Jun 26 12:13:41 2009
@@ -30,7 +30,6 @@
import org.apache.myfaces.tobago.component.UICell;
import org.apache.myfaces.tobago.component.UIGridLayout;
import org.apache.myfaces.tobago.component.UILayout;
-import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.layout.FixedLayoutToken;
import org.apache.myfaces.tobago.layout.HideLayoutToken;
import org.apache.myfaces.tobago.layout.LayoutToken;
@@ -47,7 +46,7 @@
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.util.LayoutInfo;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -346,7 +345,7 @@
int cellHeight = -1;
try {
- Integer layoutHeight = LayoutUtil.getLayoutHeight(cell);
+ Integer layoutHeight = LayoutUtils.getLayoutHeight(cell);
if (layoutHeight != null) {
cellHeight = layoutHeight.intValue();
}
@@ -400,13 +399,33 @@
writer.endElement(HtmlConstants.TABLE);
}
+ @Override
+ public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
+ TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
+ UIGridLayout gridLayout = (UIGridLayout) component;
+ writer.startElement(HtmlConstants.DIV, gridLayout);
+ writer.writeClassAttribute();
+// writer.writeStyleAttribute();
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ UIComponent container = component.getParent();
+ RenderUtil.encodeChildrenWithoutLayout(facesContext, container);
+ }
+
+ @Override
public void encodeEnd(FacesContext facesContext,
UIComponent component) throws IOException {
- if (component.getParent() instanceof UIPage) {
- LOG.error("XXXXXXXXXXXXXXXXXXXXXXX never XXXXXXXXXXXXXXXXXXXXXX", new Exception());
- } else {
- encodeChildrenOfComponent(facesContext, component.getParent());
- }
+ TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
+// UIGridLayout gridLayout = (UIGridLayout)component;
+ writer.endElement(HtmlConstants.DIV);
+
+// if (component.getParent() instanceof UIPage) {
+// LOG.error("XXXXXXXXXXXXXXXXXXXXXXX never XXXXXXXXXXXXXXXXXXXXXX", new Exception());
+// } else {
+// encodeChildrenOfComponent(facesContext, component.getParent());
+// }
}
private String getOverflow(UIComponent cell) {
@@ -709,7 +728,7 @@
UIComponent component = (UIComponent) cell;
int height = -1;
if (minimum) {
- height = (int) LayoutUtil.getMinimumHeight(facesContext, component);
+ height = (int) LayoutUtils.getMinimumHeight(facesContext, component);
} else {
LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
if (renderer != null) {
@@ -743,7 +762,7 @@
}
int max = -1;
if (minimum) {
- max = (int) LayoutUtil.getMinimumWidth(facesContext, component);
+ max = (int) LayoutUtils.getMinimumWidth(facesContext, component);
} else {
LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
if (renderer != null) {
@@ -782,7 +801,7 @@
cellWidth += ((spanX - 1) * 2);
}
cellWidth += (spanX - 1) * getCellSpacing(facesContext, layout);
- LayoutUtil.maybeSetLayoutAttribute(cell,
+ LayoutUtils.maybeSetLayoutAttribute(cell,
Attributes.LAYOUT_WIDTH, Integer.valueOf(cellWidth));
}
}
@@ -816,7 +835,7 @@
cell.getAttributes().put(Attributes.LAYOUT_HEIGHT, Integer.valueOf(cellHeight));
cell.getAttributes().remove(Attributes.INNER_HEIGHT);
if (cell instanceof UICell || cell instanceof AbstractUIForm) {
- List children = LayoutUtil.addChildren(new ArrayList<UIComponent>(), cell);
+ List children = LayoutUtils.addChildren(new ArrayList<UIComponent>(), cell);
for (Iterator childs = children.iterator(); childs.hasNext();) {
UIComponent component = (UIComponent) childs.next();
if (LOG.isDebugEnabled()) {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java Fri Jun 26 12:13:41 2009
@@ -25,6 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
+import org.apache.myfaces.tobago.component.AbstractUICommand;
import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.CreateComponentUtils;
@@ -342,8 +343,8 @@
throws IOException {
for (Object o : component.getChildren()) {
UIComponent entry = (UIComponent) o;
- if (entry instanceof UICommand) {
- addMenuEntry(sb, var, facesContext, (UICommand) entry);
+ if (entry instanceof AbstractUICommand) {
+ addMenuEntry(sb, var, facesContext, (AbstractUICommand) entry);
} else if (entry instanceof UIMenuSeparator) {
addMenuSeparator(sb, var);
} else if (entry instanceof UIMenu) {
@@ -358,7 +359,7 @@
return index;
}
- private void addMenuEntry(StringBuilder sb, String var, FacesContext facesContext, UICommand command)
+ private void addMenuEntry(StringBuilder sb, String var, FacesContext facesContext, AbstractUICommand command)
throws IOException {
CommandRendererHelper helper = new CommandRendererHelper(facesContext, command);
String onclick = helper.getOnclick();
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java Fri Jun 26 12:13:41 2009
@@ -39,6 +39,7 @@
import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.context.TobagoFacesContext;
+import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.renderkit.MessageRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -138,10 +139,10 @@
AbstractUIPage page = ComponentUtil.findPage(facesContext, messages);
- popup.setWidth(page.getWidth() - 200);
- popup.setHeight(page.getHeight() - 200);
- popup.setLeft(100);
- popup.setTop(100);
+ popup.setWidth(new PixelMeasure(page.getWidth().getPixel() - 200));
+ popup.setHeight(new PixelMeasure(page.getHeight().getPixel() - 200));
+ popup.setLeft(new PixelMeasure(100));
+ popup.setTop(new PixelMeasure(100));
popup.setRendered(true);
popup.setActivated(true);
((TobagoFacesContext) facesContext).getPopups().add(popup);
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java Fri Jun 26 12:13:41 2009
@@ -17,17 +17,11 @@
* limitations under the License.
*/
-/*
- * Created 07.02.2003 16:00:00.
- * $Id$
- */
-
-import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.UIOut;
import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
-import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -37,26 +31,28 @@
public class OutRenderer extends LayoutableRendererBase {
- public void encodeEnd(FacesContext facesContext,
- UIComponent component) throws IOException {
- String text = RenderUtil.currentValue(component);
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+
+ UIOut out = (UIOut) component;
+
+ String text = RenderUtil.currentValue(out);
if (text == null) {
text = "";
}
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- boolean escape = ComponentUtil.getBooleanAttribute(component, Attributes.ESCAPE);
- boolean createSpan = ComponentUtil.getBooleanAttribute(component, Attributes.CREATE_SPAN);
+ boolean escape = out.isEscape();
+ boolean createSpan = out.isCreateSpan();
if (createSpan) {
- String id = component.getClientId(facesContext);
- writer.startElement(HtmlConstants.SPAN, component);
+ String id = out.getClientId(facesContext);
+ writer.startElement(HtmlConstants.DIV, out);
writer.writeIdAttribute(id);
writer.writeStyleAttribute();
- HtmlRendererUtil.renderDojoDndItem(component, writer, true);
+ HtmlRendererUtil.renderDojoDndItem(out, writer, true);
writer.writeClassAttribute();
- HtmlRendererUtil.renderTip(component, writer);
+ HtmlRendererUtil.renderTip(out, writer);
}
if (escape) {
StringTokenizer tokenizer = new StringTokenizer(text, "\n\r");
@@ -73,7 +69,7 @@
writer.write(text);
}
if (createSpan) {
- writer.endElement(HtmlConstants.SPAN);
+ writer.endElement(HtmlConstants.DIV);
}
}
}
Modified: myfaces/tobago/trunk/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/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java Fri Jun 26 12:13:41 2009
@@ -28,7 +28,6 @@
import org.apache.myfaces.tobago.component.AbstractUIPage;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.UILayout;
import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.context.ClientProperties;
@@ -55,6 +54,7 @@
import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -89,6 +89,7 @@
private static final String CLIENT_DEBUG_SEVERITY = "clientDebugSeverity";
+ @Override
public void decode(FacesContext facesContext, UIComponent component) {
super.decode(facesContext, component);
String name = component.getClientId(facesContext) + SUBCOMPONENT_SEP + "clientSeverity";
@@ -99,11 +100,14 @@
}
}
- public void encodeEnd(FacesContext facesContextOrg, UIComponent component) throws IOException {
+ @Override
+ public void encodeBegin(FacesContext facesContextOrg, UIComponent component) throws IOException {
+
+// public void encodeEnd(FacesContext facesContextOrg, UIComponent component) throws IOException {
UIPage page = (UIPage) component;
// invoke prepareRender
- TobagoFacesContext facesContext = null;
+ TobagoFacesContext facesContext;
if (facesContextOrg instanceof TobagoFacesContext) {
facesContext = (TobagoFacesContext) facesContextOrg;
} else {
@@ -112,12 +116,12 @@
// LAYOUT Begin
- try {
+// try {
LayoutContext layoutContext = new LayoutContext(page);
layoutContext.layout();
- } catch (Throwable e) {
- LOG.info("testing... " + e);
- }
+// } catch (Throwable e) {
+// LOG.info("testing... ", e);
+// }
// LAYOUT End
@@ -243,9 +247,8 @@
scriptFiles.remove("script/theme-config.js");
int clientLogSeverity = 2;
- boolean hideClientLogging = true;
- // true; hideClientLogging = false;
if (debugMode) {
+ boolean hideClientLogging = true;
String severity = (String) facesContext.getExternalContext().getRequestMap().get(CLIENT_DEBUG_SEVERITY);
LOG.info("get " + CLIENT_DEBUG_SEVERITY + " = " + severity);
if (severity != null) {
@@ -259,6 +262,7 @@
hideClientLogging = !severity.contains("show");
}
scriptFiles.add("script/logging.js");
+ facesContext.getOnloadScripts().add(0, "new LOG.LogArea({hide: " + hideClientLogging + "});");
}
// render remaining script tags
@@ -331,6 +335,7 @@
//this ist for ie to prevent scrollbars where none are needed
writer.writeAttribute(HtmlAttributes.SCROLL, "auto", false);
writer.writeClassAttribute();
+ writer.writeStyleAttribute();
writer.writeIdAttribute(clientId);
writer.startJavascript();
@@ -344,7 +349,7 @@
writer.write(ResourceManagerUtil.getImageWithPath(facesContext, "image/tobago-overlay-wait.gif"));
writer.write("';\n");
writer.endJavascript();
-
+/*
if (debugMode) {
final String[] jsFiles = new String[]{
"script/logging.js"
@@ -353,10 +358,13 @@
HtmlRendererUtil.writeScriptLoader(facesContext, jsFiles, jsCommand);
writer.writeJavascript("TbgTimer.startBody = new Date();");
}
+*/
+ if (debugMode) {
+ writer.writeJavascript("TbgTimer.startBody = new Date();");
+ }
writer.startElement(HtmlConstants.FORM, page);
- writer.writeNameAttribute(
- clientId + SUBCOMPONENT_SEP + "form");
+ writer.writeNameAttribute(clientId + SUBCOMPONENT_SEP + "form");
writer.writeAttribute(HtmlAttributes.ACTION, formAction, true);
writer.writeIdAttribute(page.getFormId(facesContext));
writer.writeAttribute(HtmlAttributes.METHOD, getMethod(page), false);
@@ -423,17 +431,46 @@
RenderUtil.encode(facesContext, menubar);
}
// write the proviously rendered page content
- UILayout.getLayout(component).encodeChildrenOfComponent(facesContext, component);
+// UILayout.getLayout(component).encodeChildrenOfComponent(facesContext, component);
+
+// page.encodeLayoutBegin(facesContext);
+ }
+
+// @Override
+// public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+// UIPage page = (UIPage) component;
+// page.encodeLayoutChildren(facesContext);
+// }
+
+ @Override
+ public void encodeEnd(FacesContext facesContextOrg, UIComponent component) throws IOException {
+
+ UIPage page = (UIPage) component;
+
+ TobagoFacesContext facesContext;
+ if (facesContextOrg instanceof TobagoFacesContext) {
+ facesContext = (TobagoFacesContext) facesContextOrg;
+ } else {
+ facesContext = new TobagoFacesContext(facesContextOrg);
+ }
+
+// page.encodeLayoutEnd(facesContext);
// write popup components
// beware of ConcurrentModificationException in cascating popups!
// no foreach
UIPopup[] popupArray = facesContext.getPopups().toArray(new UIPopup[facesContext.getPopups().size()]);
- for (int i = 0; i < popupArray.length; i++) {
- UIComponent popup = popupArray[i];
+ for (UIPopup popup : popupArray) {
RenderUtil.encode(facesContext, popup);
}
+ TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
+
+ String clientId = page.getClientId(facesContext);
+ final boolean debugMode = ClientProperties.getInstance(facesContext.getViewRoot()).isDebugMode();
+
+ Application application = facesContext.getApplication();
+ ViewHandler viewHandler = application.getViewHandler();
writer.startElement(HtmlConstants.SPAN, null);
writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + "jsf-state-container");
@@ -468,7 +505,7 @@
if (debugMode) {
writer.writeJavascript("TbgTimer.endBody = new Date();");
}
-
+
writer.writeJavascript("setTimeout(\"Tobago.init('" + clientId + "')\", 1000)");
writer.endElement(HtmlConstants.BODY);
@@ -480,9 +517,13 @@
LOG.debug("dublicated AccessKeys: "
+ AccessKeyMap.getDublicatedKeys(facesContext));
}
+
+ if (facesContext.getExternalContext().getRequestParameterMap().get("X") != null) {
+ throw new RuntimeException("Debugging activated via X parameter");
+ }
}
- private void writeEventFunction(TobagoResponseWriter writer, Set<String> eventFunctions,
+ private void writeEventFunction(TobagoResponseWriter writer, Collection<String> eventFunctions,
String event, boolean returnBoolean) throws IOException {
if (!eventFunctions.isEmpty()) {
writer.write("Tobago.applicationOn");
@@ -534,10 +575,11 @@
}
}
- public void encodeChildren(FacesContext facesContext, UIComponent component)
- throws IOException {
- // children are encoded in encodeEndTobago(...)
- }
+// public void encodeEnd(FacesContext facesContext, UIComponent component)
+// public void encodeChildren(FacesContext facesContext, UIComponent component)
+// throws IOException {
+//todo: remove this comment // children are encoded in encodeEndTobago(...)
+// }
private void errorMessageForDebugging(String id, FacesMessage message,
ResponseWriter writer) throws IOException {
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java Fri Jun 26 12:13:41 2009
@@ -85,12 +85,12 @@
final StringBuilder contentStyle = new StringBuilder(32);
if (component.getWidth() != null) {
contentStyle.append("width: ");
- contentStyle.append(component.getWidth());
+ contentStyle.append(component.getWidth().getPixel());
contentStyle.append("; ");
}
if (component.getHeight() != null) {
contentStyle.append("height: ");
- contentStyle.append(component.getHeight());
+ contentStyle.append(component.getHeight().getPixel());
contentStyle.append("; ");
}
contentStyle.append("z-index: ");
@@ -126,10 +126,10 @@
final StringBuilder frameSize = new StringBuilder(32);
// full client area
frameSize.append("width: ");
- frameSize.append(page.getWidth());
+ frameSize.append(page.getWidth().getPixel());
frameSize.append("; ");
frameSize.append("height: ");
- frameSize.append(page.getHeight());
+ frameSize.append(page.getHeight().getPixel());
frameSize.append("; ");
writer.writeAttribute(HtmlAttributes.STYLE, frameSize.toString(), false);
} else {
@@ -165,9 +165,9 @@
writer.write("Tobago.setupPopup('");
writer.write(clientId);
writer.write("', '");
- writer.write(String.valueOf(component.getLeft()));
+ writer.write(component.getLeft().getPixel());
writer.write("', '");
- writer.write(String.valueOf(component.getTop()));
+ writer.write(component.getTop().getPixel());
writer.write("', ");
writer.write(String.valueOf(component.isModal()));
writer.write(");");
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.java Fri Jun 26 12:13:41 2009
@@ -33,7 +33,7 @@
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
@@ -69,7 +69,7 @@
/ (model.getMaximum() - model.getMinimum())) + " %";
}
- Integer width = LayoutUtil.getLayoutWidth(component);
+ Integer width = LayoutUtils.getLayoutWidth(component);
String width1 = value1;
String width2 = value2;
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=788668&r1=788667&r2=788668&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 Jun 26 12:13:41 2009
@@ -61,7 +61,7 @@
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
import org.apache.myfaces.tobago.util.ComponentUtil;
import org.apache.myfaces.tobago.util.LayoutInfo;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import org.apache.myfaces.tobago.util.StringUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -187,7 +187,7 @@
Map attributes = data.getAttributes();
HtmlStyleMap sheetStyle = (HtmlStyleMap) attributes.get(Attributes.STYLE);
//HtmlStyleMap headerStyle = (HtmlStyleMap) attributes.get(STYLE_HEADER);
-// String sheetWidthString = LayoutUtil.getStyleAttributeValue(sheetStyle,
+// String sheetWidthString = LayoutUtils.getStyleAttributeValue(sheetStyle,
// "width");
Integer sheetHeight = HtmlRendererUtil.getStyleAttributeIntValue(sheetStyle, "height");
if (sheetHeight == null) {
@@ -1207,7 +1207,7 @@
}
- int space = LayoutUtil.getInnerSpace(facesContext, data, true);
+ int space = LayoutUtils.getInnerSpace(facesContext, data, true);
space -= getContentBorder(facesContext, data);
if (needVerticalScrollbar(facesContext, data)) {
space -= getScrollbarWidth(facesContext, data);
Copied: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupLayoutRenderer.java (from r786116, myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupLayoutRenderer.java?p2=myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupLayoutRenderer.java&p1=myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java&r1=786116&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupLayoutRenderer.java Fri Jun 26 12:13:41 2009
@@ -17,912 +17,111 @@
* 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.component.AbstractUIForm;
-import org.apache.myfaces.tobago.component.AbstractUIGridLayout;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.UICell;
-import org.apache.myfaces.tobago.component.UIGridLayout;
-import org.apache.myfaces.tobago.component.UILayout;
-import org.apache.myfaces.tobago.component.UIPage;
-import org.apache.myfaces.tobago.layout.FixedLayoutToken;
-import org.apache.myfaces.tobago.layout.HideLayoutToken;
-import org.apache.myfaces.tobago.layout.LayoutToken;
-import org.apache.myfaces.tobago.layout.LayoutTokens;
-import org.apache.myfaces.tobago.layout.MinimumLayoutToken;
-import org.apache.myfaces.tobago.layout.PixelLayoutToken;
-import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
-import org.apache.myfaces.tobago.renderkit.LayoutInformationProvider;
-import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
-import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
-import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
-import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
-import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutInfo;
-import org.apache.myfaces.tobago.util.LayoutUtil;
-import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class GridLayoutRenderer extends DefaultLayoutRenderer {
-
- private static final Log LOG = LogFactory.getLog(GridLayoutRenderer.class);
-
- public int getFixedHeight(FacesContext facesContext, UIComponent component) {
- int height = calculateLayoutHeight(facesContext, component, false);
-
- LayoutInformationProvider containerRenderer =
- ComponentUtil.getRenderer(facesContext, component);
- height += containerRenderer.getHeaderHeight(facesContext, component);
- height += containerRenderer.getPaddingHeight(facesContext, component);
- return height;
- }
-
- public int getFixedWidth(FacesContext facesContext, UIComponent component) {
- int width = calculateLayoutWidth(facesContext, component, false);
-
- LayoutInformationProvider containerRenderer =
- ComponentUtil.getRenderer(facesContext, component);
- width += containerRenderer.getPaddingWidth(facesContext, component);
- return width;
- }
-
- private int calculateLayoutHeight(
- FacesContext facesContext, UIComponent component, boolean minimum) {
- UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
- final List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
-
- LayoutTokens layoutTokens = layout.getRowLayout();
-
- if (layoutTokens == null && !minimum && LOG.isDebugEnabled()) {
- LOG.debug("No rowLayout found using " + (minimum ? "'minimum'" : "'fixed'")
- + " for all " + rows.size() + " rows."
- + " (clientId='" + layout.getClientId(facesContext) + "')");
- }
- if (rows.size() != layoutTokens.getSize()) {
- LOG.warn("Unbalanced layout: rows.size()=" + rows.size()
- + " != layoutTokens.length=" + layoutTokens.getSize()
- + " rowLayout='" + layoutTokens + "'"
- + " (clientId='" + layout.getClientId(facesContext) + "')");
- layoutTokens.ensureSize(rows.size(), new RelativeLayoutToken(1));
- }
- // TODO alternative? rows.size() == 1 ? new RelativeLayoutToken(1) : new FixedLayoutToken()
- //new FixedLayoutToken() );
- //String[] layoutTokens
- // = LayoutInfo.createLayoutTokens(rowLayout, rows.size(),
- // minimum ? "minimum" : "fixed");
-
-
- int size = Math.min(rows.size(), layoutTokens.getSize());
-
- int height = 0;
- height += getMarginAsInt(layout.getMarginTop());
- height += getMarginAsInt(layout.getMarginBottom());
- boolean first = true;
- for (int i = 0; i < size; i++) {
- if (!rowIsRendered(rows.get(i))) {
- continue;
- }
- height += getCellPadding(facesContext, layout, first);
- first = false;
- LayoutToken token = layoutTokens.get(i);
- if (token instanceof PixelLayoutToken) {
- height += ((PixelLayoutToken) token).getPixel();
- } else if (token instanceof FixedLayoutToken) {
- height += getMaxHeight(facesContext, rows.get(i), false);
- } else if (token instanceof MinimumLayoutToken) {
- height += getMaxHeight(facesContext, rows.get(i), true);
- } else {
- if (!minimum && LOG.isWarnEnabled()) {
- if (layout.getRows() != null) {
- // TODO: this is only an error if the token was explicitly set by application
- LOG.warn("Unable to calculate Height for token '" + token
- + "'! using " + (minimum ? "'minimum'" : "'fixed'") + " , component-id="
- + component.getClientId(facesContext) + " is "
- + component.getRendererType());
- }
- }
- height += getMaxHeight(facesContext, rows.get(i), minimum);
- }
- }
-
- return height;
- }
-
-
- public int calculateLayoutWidth(
- FacesContext facesContext, UIComponent component, boolean minimum) {
- UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
- final List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
- AbstractUIGridLayout.Row row = rows.get(0);
-
-
- LayoutTokens layoutTokens = layout.getColumnLayout();
-
- if (layoutTokens == null && !minimum && LOG.isDebugEnabled()) {
- LOG.debug("No rowLayout found using " + (minimum ? "'minimum'" : "'fixed'")
- + " for all " + rows.size() + " rows of "
- + layout.getClientId(facesContext) + " !");
- }
-
- if (row.getColumns() != layoutTokens.getSize()) {
- LOG.warn("Unbalanced layout: rows.size()=" + rows.size()
- + " != layoutTokens.length=" + layoutTokens.getSize()
- + " columnLayout='" + layoutTokens + "'"
- + " (clientId='" + layout.getClientId(facesContext) + "')");
- layoutTokens.ensureSize(row.getColumns(), new FixedLayoutToken());
- }
-
- int size = Math.min(rows.size(), layoutTokens.getSize());
-
- int width = 0;
- width += getMarginAsInt(layout.getMarginLeft());
- width += getMarginAsInt(layout.getMarginRight());
- boolean first = true;
- for (int i = 0; i < size; i++) {
- if (!columnIsRendered(rows, i)) {
- continue;
- }
- width += getCellPadding(facesContext, layout, first);
- first = false;
- LayoutToken token = layoutTokens.get(i);
- if (token instanceof PixelLayoutToken) {
- width += ((PixelLayoutToken) token).getPixel();
- } else if (token instanceof FixedLayoutToken) {
- width += getMaxWidth(facesContext, rows, i, false);
- } else if (token instanceof MinimumLayoutToken) {
- width += getMaxWidth(facesContext, rows, i, true);
- } else {
- if (!minimum && LOG.isWarnEnabled()) {
- LOG.warn("Unable to calculate Width for token '" + token
- + "'! using " + (minimum ? "'minimum'" : "'fixed'") + " , component-id="
- + component.getClientId(facesContext) + " is "
- + component.getRendererType());
- }
- width += getMaxWidth(facesContext, rows, i, minimum);
- }
- }
-
- return width;
- }
-
- private boolean columnIsRendered(List<UIGridLayout.Row> rows, int column) {
- for (AbstractUIGridLayout.Row row : rows) {
- Object object = row.getElements().get(column);
- if (object instanceof UIComponent) {
- if (object instanceof UICell) {
- UICell cell = (UICell) object;
- if (cell.getSpanX() > 1) {
- return false;
- }
- }
- UIComponent component = (UIComponent) object;
- if (component.isRendered()) {
- return true;
- }
- // XXX ????
- } else if (UIGridLayout.USED.equals(object)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean rowIsRendered(UIGridLayout.Row row) {
- for (Object element : row.getElements()) {
- if (element instanceof UIComponent) {
- UIComponent component = (UIComponent) element;
- if (component.isRendered()) {
- return true;
- }
- }
- }
- return false;
- }
-
- public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
- super.prepareRender(facesContext, component);
- layoutEnd(facesContext, component);
- layoutMargins((UIGridLayout) component);
-
- }
-
- void prepareDimension(FacesContext facesContext, UIComponent component) {
-
- }
-
- public void encodeChildrenOfComponent(FacesContext facesContext, UIComponent component)
- throws IOException {
- // encode table with component's children
-
- UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
- //prepareRender(facesContext, layout);
- //HtmlRendererUtil.prepareRender(facesContext, layout);
-
- //layoutEnd(facesContext, layout);
- //layoutMargins(layout);
-
- final Map attributes = layout.getAttributes();
- List columnWidths = (List) attributes.get(Attributes.WIDTH_LIST);
-
-
- TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
- writer.startElement(HtmlConstants.TABLE, layout);
- writer.writeAttributeFromComponent(HtmlAttributes.BORDER, Attributes.BORDER);
- writer.writeClassAttribute();
- writer.writeStyleAttribute();
- writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
- writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
- writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
-
- boolean first = true;
- if (columnWidths != null) {
- writer.startElement(HtmlConstants.COLGROUP, null);
- for (int i = 0; i < columnWidths.size(); i++) {
- int cellWidth = ((Integer) columnWidths.get(i)).intValue();
- if (cellWidth != LayoutInfo.HIDE) {
- cellWidth += getCellPadding(facesContext, layout, first);
- first = false;
- writer.startElement(HtmlConstants.COL, null);
- writer.writeAttribute(HtmlAttributes.WIDTH, cellWidth);
- writer.endElement(HtmlConstants.COL);
- }
- }
- writer.endElement(HtmlConstants.COLGROUP);
- }
-
-
- List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
- boolean firstRenderedRow = true;
- for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) {
- AbstractUIGridLayout.Row row = rows.get(rowIndex);
- if (!row.isHidden()) {
- writer.startElement(HtmlConstants.TR, null);
-
- List cells = row.getElements();
- boolean firstRenderedColum = true;
- for (int columnIndex = 0; columnIndex < cells.size(); columnIndex++) {
- boolean hide = false;
-
- if (columnWidths != null) {
- Integer columWidth = ((Integer) columnWidths.get(columnIndex));
- hide = columWidth.intValue() == LayoutInfo.HIDE;
- }
- if (!hide) {
-
- Object object = cells.get(columnIndex);
- if (object.toString().equals(UIGridLayout.USED)) {
- firstRenderedColum = false;
- continue; // ignore the markers UIGridLayout.Used
- } else if (object.equals(UIGridLayout.FREE)) {
- if (LOG.isWarnEnabled() && !layout.isIgnoreFree()) {
- LOG.warn("There are free blocks in the layout: id='"
- + layout.getClientId(facesContext)
- + "'");
- }
- firstRenderedColum = false;
- continue;
- }
- UIComponent cell = (UIComponent) object;
-
-
- int spanX = UIGridLayout.getSpanX(cell);
- int spanY = UIGridLayout.getSpanY(cell);
- StyleClasses classes = StyleClasses.ensureStyleClassesCopy(layout);
- if (firstRenderedRow) {
- classes.addClass("gridLayout", "first-row"); // XXX not a standard compliant name
- }
- if (firstRenderedColum) {
- classes.addClass("gridLayout", "first-column"); // XXX not a standard compliant name
- }
-
- int cellWidth = -1;
- if (columnWidths != null) {
- cellWidth = 0;
- for (int i = columnIndex;
- i < columnIndex + spanX && i < columnWidths.size(); i++) {
- cellWidth += ((Integer) columnWidths.get(i)).intValue()
- + getCellPadding(facesContext, layout, firstRenderedColum);
- if (firstRenderedColum) {
- firstRenderedColum = false;
- }
- }
- }
-
-
- int cellHeight = -1;
- try {
- Integer layoutHeight = LayoutUtil.getLayoutHeight(cell);
- if (layoutHeight != null) {
- cellHeight = layoutHeight.intValue();
- }
- } catch (Exception e) {
- // ignore
- } // ignore, use 0
-
- int topPadding = getCellPadding(facesContext, layout, firstRenderedRow);
- //("Cellheight " + cellHeight + " topPadding "+ topPadding + " firstRendered "
- // + firstRenderedRow + " RowIndex " + rowIndex + " Column " + columnIndex);
- String cellStyle =
- (cellWidth != -1 ? "width: " + cellWidth + "px;" : "")
- + (cellHeight != -1 ? " height: " + (cellHeight + topPadding) + "px;" : "");
- cellStyle += getOverflow(cell);
-
-
- writer.startElement(HtmlConstants.TD, null);
- writer.writeClassAttribute("tobago-gridLayout-cell-td");
- writer.writeAttribute(HtmlAttributes.STYLE, cellStyle, false);
- if (spanX > 1) {
- writer.writeAttribute(HtmlAttributes.COLSPAN, spanX);
- }
- if (spanY > 1) {
- writer.writeAttribute(HtmlAttributes.ROWSPAN, spanY);
- }
-
- writer.flush();
-
- if (ComponentUtil.getAttribute(layout, Attributes.CELLSPACING) != null) {
- cellStyle += " padding: " + getCellSpacing(facesContext, layout) + "px;";
- }
-
- writer.startElement(HtmlConstants.DIV, null);
- writer.writeClassAttribute(classes);
- writer.writeAttribute(HtmlAttributes.STYLE, cellStyle, false);
- writer.flush();
- RenderUtil.encode(facesContext, cell);
-
- writer.endElement(HtmlConstants.DIV);
- writer.endElement(HtmlConstants.TD);
-
- firstRenderedColum = false;
- HtmlRendererUtil.removeStyleClasses(cell);
- }
- }
-
- writer.endElement(HtmlConstants.TR);
- firstRenderedRow = false;
- }
- }
- writer.endElement(HtmlConstants.TABLE);
- }
-
- public void encodeEnd(FacesContext facesContext,
- UIComponent component) throws IOException {
- if (component.getParent() instanceof UIPage) {
- LOG.error("XXXXXXXXXXXXXXXXXXXXXXX never XXXXXXXXXXXXXXXXXXXXXX", new Exception());
- } else {
- encodeChildrenOfComponent(facesContext, component.getParent());
- }
- }
-
- private String getOverflow(UIComponent cell) {
- String overflow = "";
-
- String scrollbars = (String) cell.getAttributes().get(Attributes.SCROLLBARS);
- if (scrollbars != null) {
- if (scrollbars.equals("false")) {
- overflow = " overflow: hidden;";
- } else if (scrollbars.equals("true")) {
- overflow = " overflow: scroll;";
- } else if (scrollbars.equals("auto")) {
- overflow = " overflow: auto;";
- } else {
- if (LOG.isWarnEnabled()) {
- LOG.warn("Illegal value for attribute 'scrollbars' : " + scrollbars);
- }
- }
- }
-
- return overflow;
- }
-
- private int getCellPadding(
- FacesContext facesContext, UIComponent component, boolean first) {
- return first ? 0 : getCellSpacing(facesContext, component);
- }
-
- private int getBorder(UIComponent component) {
- int border = 0;
- String borderWidth
- = (String) component.getAttributes().get(Attributes.BORDER);
- try {
- if (borderWidth != null) {
- border = Integer.parseInt(borderWidth);
- }
- } catch (NumberFormatException e) {
- if (LOG.isWarnEnabled()) {
- LOG.warn("Can't parse border, using 0!");
- }
- }
- return border;
- }
-
- private int getSpacingSum(UIComponent component, FacesContext facesContext,
- int count) {
- int space = 0;
- int border = getBorder(component);
- int cellSpacing = getCellSpacing(facesContext, component);
- if (border != 0) {
- space = (border * 2) + count * 2;
- }
- space += (count - 1) * cellSpacing;
- if (LOG.isDebugEnabled()) {
- LOG.debug("extra count =" + count + ", space = " + space);
- }
- return space;
- }
-
- private int getWidthSpacingSum(UIGridLayout component,
- FacesContext facesContext, int renderedColumnCount) {
- int spacingSum = getSpacingSum(component, facesContext, renderedColumnCount);
- spacingSum += getComponentExtraWidth(facesContext, component);
- return spacingSum;
- }
-
- private int getCellSpacing(FacesContext facesContext, UIComponent component) {
- String cellspacing = (String) component.getAttributes().get(Attributes.CELLSPACING);
- if (cellspacing != null) {
- try {
- return Integer.parseInt(cellspacing);
- } catch (NumberFormatException e) {
- if (LOG.isWarnEnabled()) {
- LOG.warn("Illegal value for cellspacing : " + cellspacing
- + " using default");
- }
- // ignore and return defaut value
- }
- }
- return getConfiguredValue(facesContext, component, "cellSpacing");
- }
-
- public void layoutEnd(FacesContext facesContext, UIComponent component) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("doLayout end");
- }
- UIGridLayout layout = (UIGridLayout) component;
- final Map attributes = layout.getParent().getAttributes();
-
-
- boolean needVerticalScroolbar = false;
- Integer innerHeight =
- (Integer) attributes.get(Attributes.INNER_HEIGHT);
- if (innerHeight != null && innerHeight.intValue() > 0) {
- int value = innerHeight.intValue();
- int minimum = calculateLayoutHeight(facesContext, layout.getParent(), true);
- if (minimum > value) {
- value = minimum;
- needVerticalScroolbar = true;
- }
- layoutHeight(Integer.valueOf(value), layout, facesContext);
- }
-
-
- Integer innerWidth =
- (Integer) attributes.get(Attributes.INNER_WIDTH);
- if (innerWidth != null && innerWidth.intValue() != -1) {
- int value = innerWidth.intValue();
- if (needVerticalScroolbar) {
- value -= getConfiguredValue(facesContext, component, "scrollbarWidth");
- HtmlRendererUtil.replaceStyleAttribute(layout, "width", value);
- }
- layoutWidth(Integer.valueOf(value), layout, facesContext);
- }
-
- }
-
- private int getHeightSpacingSum(UIGridLayout layout,
- FacesContext facesContext, int renderedRowCount) {
- int spacingSum = getSpacingSum(layout, facesContext, renderedRowCount);
- spacingSum += getComponentExtraHeight(facesContext, layout);
- return spacingSum;
- }
-
- private void layoutWidth(Integer innerWidth, UIGridLayout layout,
- FacesContext facesContext) {
-
- final List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
- //final int columnCount = layout.getColumnCount();
-
- final LayoutTokens layoutTokens = layout.getColumnLayout();
- //layoutTokens.ensureSize(columnCount, new RelativeLayoutToken(1));
-
- //LayoutInfo.createLayoutTokens((String)
- //layout.getAttributes().get(COLUMNS), columnCount);
-
- int renderedColumnCount = 0;
- if (!rows.isEmpty()) {
- AbstractUIGridLayout.Row row = rows.get(0);
- final List cells = row.getElements();
- renderedColumnCount = cells.size();
- for (int i = 0; i < cells.size(); i++) {
- Object cell = cells.get(i);
- boolean hidden = false;
- if (isHidden(cell)) {
- hidden = true;
- for (int j = 1; j < rows.size(); j++) {
- hidden &= isHidden(rows.get(j).getElements().get(i));
- }
- }
- if (hidden) {
- layoutTokens.set(i, new HideLayoutToken());
- renderedColumnCount--;
- }
- }
- }
-
- innerWidth -= getWidthSpacingSum(layout, facesContext, renderedColumnCount);
- LayoutInfo layoutInfo =
- new LayoutInfo(layoutTokens.getSize(), innerWidth.intValue(), layoutTokens, layout.getClientId(facesContext),
- layout.isIgnoreFree());
-
- parseFixedWidth(layoutInfo, layout, facesContext);
- layoutInfo.parseColumnLayout(innerWidth.doubleValue(),
- getCellSpacing(facesContext, layout));
-
- setColumnWidths(layout, layoutInfo, facesContext);
- layout.getAttributes().put(Attributes.WIDTH_LIST,
- layoutInfo.getSpaceList());
- }
-
- private boolean isHidden(Object cell) {
- return (cell instanceof UIComponent && !((UIComponent) cell).isRendered())
- || (cell instanceof UIGridLayout.Marker
- && !((UIGridLayout.Marker) cell).isRendered());
- }
-
- private void layoutHeight(Integer innerHeight, UIGridLayout layout,
- FacesContext facesContext) {
-
- final List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
- LayoutTokens layoutTokens = layout.getRowLayout();
- layoutTokens.ensureSize(rows.size(), rows.size() == 1 ? new RelativeLayoutToken(1) : new FixedLayoutToken());
- /*LayoutInfo.createLayoutTokens(
- (String) layout.getAttributes().get(ROWS),
- rows.size(), rows.size() == 1 ? "1*" : "fixed");*/
-
- int renderedRowCount = rows.size();
- for (int i = 0; i < rows.size(); i++) {
- boolean hidden = true;
- AbstractUIGridLayout.Row row = rows.get(i);
- List cells = row.getElements();
- for (Object cell : cells) {
- hidden &= isHidden(cell);
- }
- row.setHidden(hidden);
- if (hidden) {
- layoutTokens.set(i, new HideLayoutToken());
- renderedRowCount--;
- }
- }
-
- innerHeight -= getHeightSpacingSum(layout, facesContext, renderedRowCount);
-
- LayoutInfo layoutInfo
- = new LayoutInfo(rows.size(), innerHeight.intValue(), layoutTokens, layout.getClientId(facesContext));
-
- if (!layoutTokens.isEmpty()) {
- parseFixedHeight(layoutInfo, layout, facesContext);
- layoutInfo.parseColumnLayout(innerHeight.doubleValue(),
- getCellSpacing(facesContext, layout));
- }
-
- setColumnHeights(layout, layoutInfo, facesContext);
-
- }
-
- private void parseFixedWidth(LayoutInfo layoutInfo, UIGridLayout layout,
- FacesContext facesContext) {
- parseFixedSpace(layoutInfo, layout, true, facesContext);
- }
- private void parseFixedHeight(LayoutInfo layoutInfo, UIGridLayout layout,
- FacesContext facesContext) {
- parseFixedSpace(layoutInfo, layout, false, facesContext);
- }
-
- public void parseFixedSpace(LayoutInfo layoutInfo, UIGridLayout layout,
- LayoutTokens layoutTokens, boolean width, FacesContext facesContext) {
-
- //String[] tokens = layoutInfo.getLayoutTokens();
- for (int i = 0; i < layoutTokens.getSize(); i++) {
- LayoutToken token = layoutTokens.get(i);
- if (token instanceof FixedLayoutToken) {
- int max = 0;
- final List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
- if (!rows.isEmpty()) {
- if (width) {
- max = getMaxWidth(facesContext, rows, i, false);
- } else {
- if (i < rows.size()) { //
- AbstractUIGridLayout.Row row = rows.get(i);
- max = getMaxHeight(facesContext, row, false);
- } else {
- layoutInfo.update(0, i);
- if (LOG.isWarnEnabled()) {
- LOG.warn("More LayoutTokens found than rows! skipping! tokens = "
- + token + " components = "
- + rows.size());
- }
- }
- }
- layoutInfo.update(max, i);
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("set column " + i + " from fixed to with " + max);
- }
- }
- }
- }
- private void parseFixedSpace(LayoutInfo layoutInfo, UIGridLayout layout,
- boolean width, FacesContext facesContext) {
-
- LayoutTokens tokens = layoutInfo.getLayoutTokens();
- for (int i = 0; i < tokens.getSize(); i++) {
- LayoutToken token = tokens.get(i);
- if (token instanceof FixedLayoutToken) {
- int max = 0;
- final List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
- if (!rows.isEmpty()) {
- if (width) {
- max = getMaxWidth(facesContext, rows, i, false);
- } else {
- if (i < rows.size()) { //
- AbstractUIGridLayout.Row row = rows.get(i);
- max = getMaxHeight(facesContext, row, false);
- } else {
- layoutInfo.update(0, i);
- if (LOG.isWarnEnabled()) {
- LOG.warn("More LayoutTokens found than rows! skipping! tokens = "
- + token + " components = "
- + rows.size());
- }
- }
- }
- layoutInfo.update(max, i);
- }
- if (LOG.isDebugEnabled()) {
- LOG.debug("set column " + i + " from fixed to with " + max);
- }
- }
- }
- }
-
- private int getMaxHeight(FacesContext facesContext, UIGridLayout.Row row, boolean minimum) {
- int maxHeight = 0;
- List cells = row.getElements();
- for (Object cell : cells) {
- if (cell instanceof UIComponent) {
- UIComponent component = (UIComponent) cell;
- int height = -1;
- if (minimum) {
- height = (int) LayoutUtil.getMinimumHeight(facesContext, component);
- } else {
- LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
- if (renderer != null) {
- height = renderer.getFixedHeight(facesContext, component);
- }
- }
- maxHeight = Math.max(maxHeight, height);
- } else if (cell instanceof UIGridLayout.Marker) {
- // ignore
- } else {
- // TODO is this needed?
- LOG.error("Object is not instanceof UIComponent " + cell.getClass().getName());
- }
- }
- return maxHeight;
- }
-
- private int getMaxWidth(FacesContext facesContext, List<UIGridLayout.Row> rows, int column, boolean minimum) {
- int maxWidth = 0;
+public class TabGroupLayoutRenderer extends RendererBase {
- for (AbstractUIGridLayout.Row row : rows) {
- if (column < row.getElements().size()) {
- Object object = row.getElements().get(column);
+ private static final Log LOG = LogFactory.getLog(TabGroupLayoutRenderer.class);
- if (object instanceof UIComponent) {
- UIComponent component = (UIComponent) object;
- if (component instanceof UICell) {
- if (((UICell) component).getSpanX() > 1) {
- continue;
- }
- }
- int max = -1;
- if (minimum) {
- max = (int) LayoutUtil.getMinimumWidth(facesContext, component);
- } else {
- LayoutInformationProvider renderer = ComponentUtil.getRenderer(facesContext, component);
- if (renderer != null) {
- max = renderer.getFixedWidth(facesContext, component);
- }
- }
- maxWidth = Math.max(maxWidth, max);
- } else if (object instanceof UIGridLayout.Marker) {
- // ignore
- } else {
- // TODO is this needed?
- LOG.error("Object is not instanceof UIComponent " + object.getClass().getName());
- }
- }
- }
- return maxWidth;
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ UIComponent container = component.getParent();
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ LOG.info("TAB GROUP LAYOUT RENDERER");
+ RenderUtil.encodeChildrenWithoutLayout(facesContext, container);
}
- private void setColumnWidths(UIGridLayout layout, LayoutInfo layoutInfo,
- FacesContext facesContext) {
- List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
-
- for (Iterator iter = rows.iterator(); iter.hasNext();) {
- AbstractUIGridLayout.Row row = (UIGridLayout.Row) iter.next();
- List cells = row.getElements();
- int columnCount = layout.getColumnCount();
- for (int i = 0; i < columnCount; i++) {
- if (cells.get(i) instanceof UIComponent) {
- UIComponent cell = (UIComponent) cells.get(i);
- int spanX = UIGridLayout.getSpanX(cell);
- int cellWidth = 0;
- for (int j = i; j < i + spanX; j++) {
- cellWidth += layoutInfo.getSpaceForColumn(j);
- }
- if (spanX > 1 && getBorder(layout) > 0) {
- cellWidth += ((spanX - 1) * 2);
- }
- cellWidth += (spanX - 1) * getCellSpacing(facesContext, layout);
- LayoutUtil.maybeSetLayoutAttribute(cell,
- Attributes.LAYOUT_WIDTH, Integer.valueOf(cellWidth));
- }
- }
- }
- }
-
- private void setColumnHeights(UIGridLayout layout, LayoutInfo layoutInfo,
- FacesContext facesContext) {
- List<AbstractUIGridLayout.Row> rows = layout.ensureRows();
-
- for (int i = 0; i < rows.size(); i++) {
- AbstractUIGridLayout.Row row = rows.get(i);
- List cells = row.getElements();
- int columnCount = layout.getColumnCount();
- for (int j = 0; j < columnCount; j++) {
- if (cells.get(j) instanceof UIComponent) {
- UIComponent cell = (UIComponent) cells.get(j);
- int spanY = UIGridLayout.getSpanY(cell);
- int cellHeight = 0;
- for (int k = i; k < i + spanY; k++) {
- cellHeight += layoutInfo.getSpaceForColumn(k);
- }
- if (spanY > 1 && getBorder(layout) > 0) {
- cellHeight += ((spanY - 1) * 2);
- }
- cellHeight += (spanY - 1) * getCellSpacing(facesContext, layout);
- if (LOG.isDebugEnabled()) {
- LOG.debug("set height of " + cellHeight + "px to "
- + cell.getRendererType() + " layoutInfo " + layoutInfo.toString());
- }
- cell.getAttributes().put(Attributes.LAYOUT_HEIGHT, Integer.valueOf(cellHeight));
- cell.getAttributes().remove(Attributes.INNER_HEIGHT);
- if (cell instanceof UICell || cell instanceof AbstractUIForm) {
- List children = LayoutUtil.addChildren(new ArrayList<UIComponent>(), cell);
- for (Iterator childs = children.iterator(); childs.hasNext();) {
- UIComponent component = (UIComponent) childs.next();
- if (LOG.isDebugEnabled()) {
- LOG.debug("set height of " + cellHeight + "px to "
- + component.getRendererType());
- }
- component.getAttributes().put(Attributes.LAYOUT_HEIGHT, Integer.valueOf(cellHeight));
- component.getAttributes().remove(Attributes.INNER_HEIGHT);
-
- }
- }
- }
- }
- }
- }
-
-
- public void layoutBegin(FacesContext facesContext, UIComponent component) {
- if (LOG.isInfoEnabled()) {
- LOG.info("############################## layoutBegin +++++++++++++++++++++++++++++++++++++++++");
- }
- HtmlRendererUtil.layoutSpace(facesContext, component, true);
- HtmlRendererUtil.layoutSpace(facesContext, component, false);
-
- if (component instanceof UIGridLayout) {
- layoutMargins((UIGridLayout) component);
- }
- }
-
- private void layoutMargins(UIGridLayout layout) {
-
- HtmlStyleMap style = (HtmlStyleMap) layout.getAttributes().get(Attributes.STYLE);
-
- if (style != null) {
- int marginTop = getMarginAsInt(layout.getMarginTop());
- int marginRight = getMarginAsInt(layout.getMarginRight());
- int marginBottom = getMarginAsInt(layout.getMarginBottom());
- int marginLeft = getMarginAsInt(layout.getMarginLeft());
- if(marginTop > 0) {
- style.put("margin-top", marginTop);
- }
- if(marginRight > 0) {
- style.put("margin-right", marginRight);
- Integer width = style.getInt("width");
- if (width != null) {
- width -= marginRight;
- style.put("width", width);
- }
- }
- if(marginBottom > 0) {
- style.put("margin-bottom", marginBottom);
- }
- if(marginLeft > 0) {
- style.put("margin-left", marginLeft);
- Integer width = style.getInt("width");
- if (width != null) {
- width -= marginLeft;
- style.put("width", width);
- }
- }
-
- //layout.getAttributes().put(ATTR_LAYOUT_TABLE_STYLE, style);
- }
- }
-
- public int getComponentExtraWidth(FacesContext facesContext,
- UIComponent component) {
- int extra = 0;
- UIGridLayout layout = (UIGridLayout) component;
-
- extra += getMarginAsInt(layout.getMarginRight());
- extra += getMarginAsInt(layout.getMarginLeft());
-
- return extra;
- }
-
- public int getComponentExtraHeight(FacesContext facesContext,
- UIComponent component) {
- int extra = 0;
- UIGridLayout layout = (UIGridLayout) component;
-
- extra += getMarginAsInt(layout.getMarginTop());
- extra += getMarginAsInt(layout.getMarginBottom());
- return extra;
- }
-
- private int getMarginAsInt(String margin) {
- if (margin != null) {
- margin = removePx(margin);
- try {
- return Integer.parseInt(margin);
- } catch (NumberFormatException e) {
- if (LOG.isWarnEnabled()) {
- LOG.warn("Illegal Margin : " + margin
- + " exception : " + e.getMessage(), e);
- }
- }
- }
- return 0;
- }
-
- private String removePx(String margin) {
- if (margin!=null&&margin.endsWith("px")) {
- margin = margin.substring(0, margin.length() - 2);
- }
- return margin;
- }
}
-
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TextAreaRenderer.java Fri Jun 26 12:13:41 2009
@@ -24,15 +24,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.AbstractUIGridConstraints;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UITextarea;
-import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.HtmlUtils;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
-import org.apache.myfaces.tobago.renderkit.html.HtmlStyleMap;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtil;
import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
@@ -41,8 +38,8 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
import javax.faces.validator.LengthValidator;
+import javax.faces.validator.Validator;
import java.io.IOException;
public class TextAreaRenderer extends InputRendererBase {
@@ -80,18 +77,6 @@
}
HtmlRendererUtil.renderDojoDndItem(component, writer, true);
-// LAYOUT Begin
- HtmlStyleMap style = (HtmlStyleMap) input.getAttributes().get(Attributes.STYLE);
- Measure width = ((AbstractUIGridConstraints) input.getConstraints()).getWidth();
- if (width != null) {
- style.put("width", width.toString());
- }
- Measure height = ((AbstractUIGridConstraints) input.getConstraints()).getHeight();
- if (height !=null) {
- style.put("height", height.toString());
- }
-// LAYOUT End
-
writer.writeStyleAttribute();
writer.writeClassAttribute();
if (onchange != null) {