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/19 17:38:05 UTC
svn commit: r882196 [1/2] - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/config/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache/myface...
Author: lofwyr
Date: Thu Nov 19 16:38:01 2009
New Revision: 882196
URL: http://svn.apache.org/viewvc?rev=882196&view=rev
Log:
TOBAGO-827: Possibility to configure values in the theme dependent from the markup
* adding an interface "Configurable" which holds the relevant information (rendererType and markup).
all LayoutComponent, LayoutContainer and LayoutManager entends it.
* Fixing the look of the box in richmond and charlotteville
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenu.java
- copied, changed from r882081, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/Configurable.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java
- copied, changed from r882081, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
- copied, changed from r882081, myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuBarRenderer.java
Removed:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/ThemeConfig.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SpacingValues.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterWrapper.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java
myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ThemeConfigViewController.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java
myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java
myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/property/tobago-theme-config.properties
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ButtonRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectManyCheckboxRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SelectOneRadioRenderer.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/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
myfaces/tobago/trunk/theme/speyside/src/main/java/org/apache/myfaces/tobago/renderkit/html/speyside/standard/tag/BoxRenderer.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java Thu Nov 19 16:38:01 2009
@@ -42,7 +42,7 @@
import java.util.Arrays;
import java.util.List;
-public abstract class AbstractUIGridLayout extends UILayout implements LayoutManager {
+public abstract class AbstractUIGridLayout extends UILayout implements LayoutManager, SupportsMarkup {
private static final Log LOG = LogFactory.getLog(AbstractUIGridLayout.class);
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenu.java (from r882081, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenu.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenu.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java&r1=882081&r2=882196&rev=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIMenu.java Thu Nov 19 16:38:01 2009
@@ -17,141 +17,7 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
-import org.apache.myfaces.tobago.layout.Measure;
-import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.util.Iterator;
-
-public abstract class AbstractUIPopup extends UIPanelBase
- implements NamingContainer, AjaxComponent, InvokeOnComponent, DeprecatedDimension {
-
- private boolean activated;
-
- public void setActivated(boolean activated) {
- this.activated = activated;
- }
-
- public void processDecodes(FacesContext facesContext) {
- if (isSubmitted()) {
- for (Iterator it = getFacetsAndChildren(); it.hasNext();) {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processDecodes(facesContext);
- }
- try {
- decode(facesContext);
- } catch (RuntimeException e) {
- facesContext.renderResponse();
- throw e;
- }
- }
- }
-
- public boolean isRendered() {
- if (FacesUtils.hasValueBindingOrValueExpression(this, "rendered")) {
- return (Boolean)
- FacesUtils.getValueFromValueBindingOrValueExpression(FacesContext.getCurrentInstance(), this, "rendered");
- } else {
- return isActivated() || isRedisplay();
- }
- }
-
- private boolean isSubmitted() {
- String action = ComponentUtils.findPage(getFacesContext(), this).getActionId();
- return action != null && action.startsWith(getClientId(getFacesContext()) + SEPARATOR_CHAR);
- }
-
- private boolean isRedisplay() {
- if (isSubmitted()) {
- AbstractUIPage page = ComponentUtils.findPage(getFacesContext(), this);
- String action = page.getActionId();
- if (action != null) {
- UIComponent command = page.findComponent(SEPARATOR_CHAR + action);
- if (command != null && command instanceof UICommand) {
- return !(command.getAttributes().get(Attributes.POPUP_CLOSE) != null);
- }
- }
- }
- return false;
- }
-
- private boolean isActivated() {
- return activated;
- }
-
-
- public void processValidators(FacesContext context) {
- if (isSubmitted()) {
- for (Iterator it = getFacetsAndChildren(); it.hasNext();) {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processValidators(context);
- }
- //TODO: check if validation has faild and reset rendered if needed
- if (context.getRenderResponse()) {
- setActivated(true);
- }
- }
- }
-
- public void processUpdates(FacesContext context) {
- if (isSubmitted()) {
- for (Iterator it = getFacetsAndChildren(); it.hasNext();) {
- UIComponent childOrFacet = (UIComponent) it.next();
- childOrFacet.processUpdates(context);
- }
- }
- }
-
- public Object saveState(FacesContext context) {
- Object[] saveState = new Object[2];
- saveState[0] = super.saveState(context);
- saveState[1] = activated;
- return saveState;
- }
-
- public void restoreState(FacesContext context, Object savedState) {
- Object[] values = (Object[]) savedState;
- super.restoreState(context, values[0]);
- activated = (Boolean) values[1];
- }
-
- public void encodeEnd(FacesContext context) throws IOException {
- super.encodeEnd(context);
- activated = false;
- }
-
- public void encodeAjax(FacesContext facesContext) throws IOException {
- super.encodeAjax(facesContext);
- activated = false;
- }
-
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
- }
-
- public abstract Measure getWidth();
-
- public abstract void setWidth(Measure width);
-
- public abstract Measure getHeight();
-
- public abstract void setHeight(Measure height);
-
- public abstract Measure getTop();
-
- public abstract void setTop(Measure top);
-
- public abstract Measure getLeft();
-
- public abstract void setLeft(Measure left);
+public abstract class AbstractUIMenu extends UIPanelBase implements LayoutComponent {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPopup.java Thu Nov 19 16:38:01 2009
@@ -20,6 +20,10 @@
import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.LayoutManager;
+import org.apache.myfaces.tobago.layout.LayoutUtils;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.util.ComponentUtils;
@@ -31,12 +35,25 @@
import javax.faces.context.FacesContext;
import java.io.IOException;
import java.util.Iterator;
+import java.util.List;
public abstract class AbstractUIPopup extends UIPanelBase
- implements NamingContainer, AjaxComponent, InvokeOnComponent, DeprecatedDimension {
+ implements OnComponentPopulated, NamingContainer, AjaxComponent, InvokeOnComponent,
+ DeprecatedDimension, LayoutContainer {
private boolean activated;
+ public void onComponentPopulated(FacesContext facesContext) {
+ if (getLayoutManager() == null) {
+ setLayoutManager(CreateComponentUtils.createAndInitLayout(
+ facesContext, ComponentTypes.GRID_LAYOUT, RendererTypes.GRID_LAYOUT));
+ }
+ }
+
+ public List<LayoutComponent> getComponents() {
+ return LayoutUtils.findLayoutChildren(this);
+ }
+
public void setActivated(boolean activated) {
this.activated = activated;
}
@@ -139,6 +156,14 @@
return FacesUtils.invokeOnComponent(context, this, clientId, callback);
}
+ public LayoutManager getLayoutManager() {
+ return (LayoutManager) getFacet(Facets.LAYOUT);
+ }
+
+ public void setLayoutManager(LayoutManager layoutManager) {
+ getFacets().put(Facets.LAYOUT, (UILayout) layoutManager);
+ }
+
public abstract Measure getWidth();
public abstract void setWidth(Measure width);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/RendererTypes.java Thu Nov 19 16:38:01 2009
@@ -42,6 +42,7 @@
public static final String LABEL = "Label";
public static final String MEDIATOR = "Mediator";
public static final String MESSAGES = "Messages";
+ public static final String MENU = "Menu";
public static final String MENU_BAR = "MenuBar";
public static final String MENU_COMMAND = "MenuCommand";
public static final String OBJECT = "Object";
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/Configurable.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/Configurable.java?rev=882196&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/Configurable.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/Configurable.java Thu Nov 19 16:38:01 2009
@@ -0,0 +1,30 @@
+package org.apache.myfaces.tobago.config;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public interface Configurable {
+
+ /**
+ * The renderer is an id that is used by Tobago to gather information about the components which are
+ * configured in the theme configuration files. E. g. the preferredWidth of a component.
+ * @return The renderer type.
+ */
+ String getRendererType();
+
+ String[] getMarkup();
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/ThemeConfig.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/ThemeConfig.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/ThemeConfig.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/ThemeConfig.java Thu Nov 19 16:38:01 2009
@@ -17,18 +17,19 @@
* limitations under the License.
*/
+import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
import org.apache.myfaces.tobago.layout.Measure;
-import org.apache.myfaces.tobago.layout.PixelMeasure;
import org.apache.myfaces.tobago.util.Deprecation;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
+import java.util.Arrays;
import java.util.Locale;
import java.util.Map;
@@ -44,7 +45,7 @@
@Deprecated
public static int getValue(FacesContext facesContext, UIComponent component, String name) {
Deprecation.LOG.warn("please use ThemeConfig.getMeasure()");
- return getMeasure(facesContext, component.getRendererType(), name).getPixel();
+ return getMeasure(facesContext, component.getRendererType(), ArrayUtils.EMPTY_STRING_ARRAY, name).getPixel();
}
/**
@@ -53,68 +54,71 @@
@Deprecated
public static boolean hasValue(FacesContext facesContext, UIComponent component, String name) {
Deprecation.LOG.warn("please use ThemeConfig.getMeasure()");
- return getMeasure(facesContext, component.getRendererType(), name) != null;
+ return getMeasure(facesContext, component.getRendererType(), ArrayUtils.EMPTY_STRING_ARRAY, name) != null;
}
- public static Measure getMeasure(FacesContext facesContext, String rendererType, String name) {
- CacheKey key = new CacheKey(facesContext.getViewRoot(), rendererType, name);
- Map<CacheKey, Integer> cache
- = (Map<CacheKey, Integer>) facesContext.getExternalContext().getApplicationMap().get(THEME_CONFIG_CACHE);
+ public static Measure getMeasure(FacesContext facesContext, Configurable configurable, String name) {
+ return getMeasure(facesContext, configurable.getRendererType(), configurable.getMarkup(), name);
+ }
+
+ private static Measure getMeasure(FacesContext facesContext, String rendererType, String[] markup, String name) {
+ CacheKey key = new CacheKey(facesContext.getViewRoot(), rendererType, markup, name);
+ Map<CacheKey, Measure> cache
+ = (Map<CacheKey, Measure>) facesContext.getExternalContext().getApplicationMap().get(THEME_CONFIG_CACHE);
- Integer value = cache.get(key);
- if (value == null) {
+ if (!cache.containsKey(key)) {
ResourceManager resourceManager = ResourceManagerFactory.getResourceManager(facesContext);
UIViewRoot viewRoot = facesContext.getViewRoot();
String property = resourceManager.getThemeProperty(viewRoot, "tobago-theme-config", rendererType + "." + name);
if (property != null) {
- value = new Integer(property); // todo: Measure
+ Measure value = Measure.parse(property);
+ for (String m : markup) {
+ String mValue = resourceManager.getThemeProperty(viewRoot, "tobago-theme-config",
+ rendererType + "[" + m + "]" + "." + name);
+ if (mValue != null) {
+ value.add(Measure.parse(mValue));
+ }
+ }
+ cache.put(key, value);
+ return value;
+ } else {
+ cache.put(key, null); // to mark that this value is undefined
+ return null;
}
- cache.put(key, value);
- }
- if (value != null) {
- return new PixelMeasure(value);
+ } else {
+ return cache.get(key);
}
- return null;
}
- private static class CacheKey {
+ private static final class CacheKey {
+
private String clientProperties;
private Locale locale;
private String rendererType;
private String name;
+ private String[] markup;
public CacheKey(UIViewRoot viewRoot, UIComponent component, String name) {
this.clientProperties = ClientProperties.getInstance(viewRoot).getId();
this.locale = viewRoot.getLocale();
- if (component != null) {
- rendererType = component.getRendererType();
- } else {
- rendererType = "DEFAULT";
- }
+ rendererType = component.getRendererType();
this.name = name;
}
- public CacheKey(UIViewRoot viewRoot, String rendererType, String name) {
+ public CacheKey(UIViewRoot viewRoot, String rendererType, String[] markup, String name) {
this.clientProperties = ClientProperties.getInstance(viewRoot).getId();
this.locale = viewRoot.getLocale();
- if (rendererType != null) {
- this.rendererType = rendererType;
- } else {
- this.rendererType = "DEFAULT";
- }
+ this.rendererType = rendererType;
+ this.markup = (String[]) ArrayUtils.clone(markup);
this.name = name;
}
@Override
public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
- final CacheKey cacheKey = (CacheKey) o;
+ CacheKey cacheKey = (CacheKey) o;
if (!clientProperties.equals(cacheKey.clientProperties)) {
return false;
@@ -122,6 +126,9 @@
if (!locale.equals(cacheKey.locale)) {
return false;
}
+ if (!Arrays.equals(markup, cacheKey.markup)) {
+ return false;
+ }
if (!name.equals(cacheKey.name)) {
return false;
}
@@ -134,11 +141,11 @@
@Override
public int hashCode() {
- int result;
- result = clientProperties.hashCode();
- result = 29 * result + locale.hashCode();
- result = 29 * result + rendererType.hashCode();
- result = 29 * result + name.hashCode();
+ int result = clientProperties.hashCode();
+ result = 31 * result + locale.hashCode();
+ result = 31 * result + rendererType.hashCode();
+ result = 31 * result + name.hashCode();
+ result = 31 * result + Arrays.hashCode(markup);
return result;
}
@@ -147,8 +154,8 @@
return "CacheKey(" + clientProperties
+ "," + locale
+ "," + rendererType
+ + "," + Arrays.toString(markup)
+ "," + name + ')';
}
}
-
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java (from r882081, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java&r1=882081&r2=882196&rev=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutObject.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutBase.java Thu Nov 19 16:38:01 2009
@@ -1,7 +1,5 @@
package org.apache.myfaces.tobago.layout;
-import org.apache.myfaces.tobago.component.SupportsMarkup;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,10 +17,12 @@
* limitations under the License.
*/
+import org.apache.myfaces.tobago.config.Configurable;
+
/**
- * A LayoutObject is the technical base for LayoutComponent and LayoutContainer.
+ * A LayoutBase is the technical base for LayoutComponent and LayoutContainer.
*/
-public interface LayoutObject extends SupportsMarkup {
+public interface LayoutBase extends Configurable {
Measure getWidth();
void setWidth(Measure width);
@@ -51,11 +51,6 @@
Measure getLeft();
void setLeft(Measure left);
- /**
- * The renderer is an id that is used by Tobago to gather information about the components which are
- * configured in the theme configuration files. E. g. the preferredWidth of a component.
- * @return The renderer type.
- */
- String getRendererType();
-
+ Measure getTop();
+ void setTop(Measure top);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java Thu Nov 19 16:38:01 2009
@@ -20,7 +20,7 @@
/**
* A LayoutComponent is a piece which can be positioned in a LayoutContainer.
*/
-public interface LayoutComponent extends LayoutObject {
+public interface LayoutComponent extends LayoutBase {
Integer getColumnSpan();
void setColumnSpan(Integer columnSpan);
@@ -28,9 +28,6 @@
Integer getRowSpan();
void setRowSpan(Integer rowSpan);
- Measure getTop();
- void setTop(Measure top);
-
Integer getHorizontalIndex();
void setHorizontalIndex(Integer horizontalIndex);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java Thu Nov 19 16:38:01 2009
@@ -19,12 +19,11 @@
import java.util.List;
-public interface LayoutContainer extends LayoutObject {
+public interface LayoutContainer extends LayoutBase {
List<LayoutComponent> getComponents();
LayoutManager getLayoutManager();
-
void setLayoutManager(LayoutManager layoutManager);
Measure getLeftOffset();
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContext.java Thu Nov 19 16:38:01 2009
@@ -76,11 +76,11 @@
buffer.append(" ");
}
buffer.append(component.getClass().getSimpleName());
- if (component instanceof LayoutObject) {
+ if (component instanceof LayoutBase) {
buffer.append("(");
- buffer.append(((LayoutObject)component).getWidth());
+ buffer.append(((LayoutBase)component).getWidth());
buffer.append(", ");
- buffer.append(((LayoutObject)component).getHeight());
+ buffer.append(((LayoutBase)component).getHeight());
buffer.append(")");
}
if (component instanceof LayoutContainer) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutManager.java Thu Nov 19 16:38:01 2009
@@ -1,5 +1,7 @@
package org.apache.myfaces.tobago.layout;
+import org.apache.myfaces.tobago.config.Configurable;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -17,7 +19,7 @@
* limitations under the License.
*/
-public interface LayoutManager {
+public interface LayoutManager extends Configurable {
void init();
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutUtils.java Thu Nov 19 16:38:01 2009
@@ -131,7 +131,7 @@
return orientation == Orientation.HORIZONTAL ? container.getWidth() : container.getHeight();
}
- public static void setSize(Orientation orientation, LayoutObject component, Measure size) {
+ public static void setSize(Orientation orientation, LayoutBase component, Measure size) {
if (orientation == Orientation.HORIZONTAL) {
if (component.getWidth() != null) { // to not override set sizes
return;
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRendererWrapper.java Thu Nov 19 16:38:01 2009
@@ -1,5 +1,10 @@
package org.apache.myfaces.tobago.renderkit;
+import org.apache.myfaces.tobago.config.Configurable;
+import org.apache.myfaces.tobago.layout.Measure;
+
+import javax.faces.context.FacesContext;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,6 +23,13 @@
*/
public abstract class AbstractLayoutRendererWrapper
- extends AbstractLayoutableRendererBaseWrapper implements LayoutRenderer {
+ extends AbstractLayoutableRendererBaseWrapper implements LayoutRenderer, SpacingValues {
+
+ public Measure getColumnSpacing(FacesContext facesContext, Configurable component) {
+ return ((SpacingValues) getRenderer(facesContext)).getColumnSpacing(facesContext, component);
+ }
+ public Measure getRowSpacing(FacesContext facesContext, Configurable component) {
+ return ((SpacingValues) getRenderer(facesContext)).getRowSpacing(facesContext, component);
+ }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutableRendererBaseWrapper.java Thu Nov 19 16:38:01 2009
@@ -18,59 +18,59 @@
*/
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.layout.Measure;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
public abstract class AbstractLayoutableRendererBaseWrapper extends AbstractRendererBaseWrapper
implements LayoutComponentRenderer {
- public Measure getWidth(FacesContext facesContext, UIComponent component) {
+ public Measure getWidth(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getWidth(facesContext, component);
}
- public Measure getHeight(FacesContext facesContext, UIComponent component) {
+ public Measure getHeight(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getHeight(facesContext, component);
}
- public Measure getMinimumWidth(FacesContext facesContext, UIComponent component) {
+ public Measure getMinimumWidth(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getMinimumWidth(facesContext, component);
}
- public Measure getMinimumHeight(FacesContext facesContext, UIComponent component) {
+ public Measure getMinimumHeight(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getMinimumHeight(facesContext, component);
}
- public Measure getPreferredWidth(FacesContext facesContext, UIComponent component) {
+ public Measure getPreferredWidth(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getPreferredWidth(facesContext, component);
}
- public Measure getPreferredHeight(FacesContext facesContext, UIComponent component) {
+ public Measure getPreferredHeight(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getPreferredHeight(facesContext, component);
}
- public Measure getMaximumWidth(FacesContext facesContext, UIComponent component) {
+ public Measure getMaximumWidth(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getMaximumWidth(facesContext, component);
}
- public Measure getMaximumHeight(FacesContext facesContext, UIComponent component) {
+ public Measure getMaximumHeight(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getMaximumHeight(facesContext, component);
}
- public Measure getLeftOffset(FacesContext facesContext, UIComponent component) {
- return ((LayoutComponentRenderer) getRenderer(facesContext)).getLeftOffset(facesContext, component);
+ public Measure getLeftOffset(FacesContext facesContext, Configurable component) {
+ return ((LayoutComponentRenderer) getRenderer(facesContext)).getLeftOffset(facesContext, component);
}
- public Measure getRightOffset(FacesContext facesContext, UIComponent component) {
+ public Measure getRightOffset(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getRightOffset(facesContext, component);
}
- public Measure getTopOffset(FacesContext facesContext, UIComponent component) {
+ public Measure getTopOffset(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getTopOffset(facesContext, component);
}
- public Measure getBottomOffset(FacesContext facesContext, UIComponent component) {
+ public Measure getBottomOffset(FacesContext facesContext, Configurable component) {
return ((LayoutComponentRenderer) getRenderer(facesContext)).getBottomOffset(facesContext, component);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRenderer.java Thu Nov 19 16:38:01 2009
@@ -17,35 +17,34 @@
* limitations under the License.
*/
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.layout.Measure;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
public interface LayoutComponentRenderer {
- Measure getWidth(FacesContext facesContext, UIComponent component);
+ Measure getWidth(FacesContext facesContext, Configurable component);
- Measure getHeight(FacesContext facesContext, UIComponent component);
+ Measure getHeight(FacesContext facesContext, Configurable component);
- Measure getMinimumWidth(FacesContext facesContext, UIComponent component);
+ Measure getMinimumWidth(FacesContext facesContext, Configurable component);
- Measure getMinimumHeight(FacesContext facesContext, UIComponent component);
+ Measure getMinimumHeight(FacesContext facesContext, Configurable component);
- Measure getPreferredWidth(FacesContext facesContext, UIComponent component);
+ Measure getPreferredWidth(FacesContext facesContext, Configurable component);
- Measure getPreferredHeight(FacesContext facesContext, UIComponent component);
+ Measure getPreferredHeight(FacesContext facesContext, Configurable component);
- Measure getMaximumWidth(FacesContext facesContext, UIComponent component);
+ Measure getMaximumWidth(FacesContext facesContext, Configurable component);
- Measure getMaximumHeight(FacesContext facesContext, UIComponent component);
+ Measure getMaximumHeight(FacesContext facesContext, Configurable component);
- Measure getLeftOffset(FacesContext facesContext, UIComponent component);
+ Measure getLeftOffset(FacesContext facesContext, Configurable component);
- Measure getRightOffset(FacesContext facesContext, UIComponent component);
+ Measure getRightOffset(FacesContext facesContext, Configurable component);
- Measure getTopOffset(FacesContext facesContext, UIComponent component);
-
- Measure getBottomOffset(FacesContext facesContext, UIComponent component);
+ Measure getTopOffset(FacesContext facesContext, Configurable component);
+ Measure getBottomOffset(FacesContext facesContext, Configurable component);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutComponentRendererBase.java Thu Nov 19 16:38:01 2009
@@ -18,59 +18,59 @@
*/
import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.layout.Measure;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
public abstract class LayoutComponentRendererBase extends RendererBase implements LayoutComponentRenderer {
-
- public Measure getWidth(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.WIDTH);
+
+ public Measure getWidth(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.WIDTH);
}
- public Measure getHeight(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.HEIGHT);
+ public Measure getHeight(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.HEIGHT);
}
- public Measure getMinimumWidth(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.MINIMUM_WIDTH);
+ public Measure getMinimumWidth(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.MINIMUM_WIDTH);
}
- public Measure getMinimumHeight(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.MINIMUM_HEIGHT);
+ public Measure getMinimumHeight(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.MINIMUM_HEIGHT);
}
- public Measure getPreferredWidth(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.PREFERRED_WIDTH);
+ public Measure getPreferredWidth(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.PREFERRED_WIDTH);
}
- public Measure getPreferredHeight(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.PREFERRED_HEIGHT);
+ public Measure getPreferredHeight(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.PREFERRED_HEIGHT);
}
- public Measure getMaximumWidth(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.MAXIMUM_WIDTH);
+ public Measure getMaximumWidth(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.MAXIMUM_WIDTH);
}
- public Measure getMaximumHeight(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.MAXIMUM_HEIGHT);
+ public Measure getMaximumHeight(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.MAXIMUM_HEIGHT);
}
- public Measure getLeftOffset(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.LEFT_OFFSET);
+ public Measure getLeftOffset(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.LEFT_OFFSET);
}
- public Measure getRightOffset(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.RIGHT_OFFSET);
+ public Measure getRightOffset(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.RIGHT_OFFSET);
}
- public Measure getTopOffset(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.TOP_OFFSET);
+ public Measure getTopOffset(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.TOP_OFFSET);
}
- public Measure getBottomOffset(FacesContext facesContext, UIComponent component) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), Attributes.BOTTOM_OFFSET);
+ public Measure getBottomOffset(FacesContext facesContext, Configurable component) {
+ return ThemeConfig.getMeasure(facesContext, component, Attributes.BOTTOM_OFFSET);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java Thu Nov 19 16:38:01 2009
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
@@ -80,7 +81,7 @@
*/
@Deprecated
public int getConfiguredValue(FacesContext facesContext, UIComponent component, String key) {
- return ThemeConfig.getMeasure(facesContext, component.getRendererType(), key).getPixel();
+ return ThemeConfig.getMeasure(facesContext, (Configurable) component, key).getPixel();
}
protected Object getCurrentValueAsObject(UIInput input) {
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SpacingValues.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SpacingValues.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SpacingValues.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/SpacingValues.java Thu Nov 19 16:38:01 2009
@@ -17,15 +17,15 @@
* limitations under the License.
*/
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.layout.Measure;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
public interface SpacingValues {
- public Measure getColumnSpacing(FacesContext facesContext, UIComponent component);
+ public Measure getColumnSpacing(FacesContext facesContext, Configurable component);
- public Measure getRowSpacing(FacesContext facesContext, UIComponent component);
+ public Measure getRowSpacing(FacesContext facesContext, Configurable component);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java Thu Nov 19 16:38:01 2009
@@ -61,18 +61,18 @@
width = layout.getWidth();
if (width != null) {
// TODO: Make configurable: this is needed if the box-sizing is border-box, not content-box (see CSS3)
- width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.border-left-width"));
- width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.padding-left"));
- width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.padding-right"));
- width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.border-right-width"));
+ width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.border-left-width"));
+ width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.padding-left"));
+ width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.padding-right"));
+ width = width.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.border-right-width"));
}
height = layout.getHeight();
if (height != null) {
// TODO: Make configurable: this is needed if the box-sizing is border-box, not content-box (see CSS3)
- height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.border-top-width"));
- height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.padding-top"));
- height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.padding-bottom"));
- height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, rendererType, "css.border-bottom-width"));
+ height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.border-top-width"));
+ height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.padding-top"));
+ height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.padding-bottom"));
+ height = height.subtractNotNegative(ThemeConfig.getMeasure(facesContext, layout, "css.border-bottom-width"));
}
this.left = layout.getLeft();
this.top = layout.getTop();
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java Thu Nov 19 16:38:01 2009
@@ -24,8 +24,8 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.LayoutComponent;
-import org.apache.myfaces.tobago.layout.LayoutObject;
import org.apache.myfaces.tobago.layout.Measure;
import javax.faces.component.UIComponent;
@@ -63,9 +63,9 @@
throw new JspException("Component Instance is null");
}
- if (!(component instanceof LayoutObject)) {
+ if (!(component instanceof LayoutBase)) {
// TODO Message resource i18n
- throw new JspException("Component Instance is not a LayoutObject");
+ throw new JspException("Component Instance is not a LayoutBase");
}
if (component instanceof LayoutComponent && isColumnSpanSet()) {
@@ -86,7 +86,8 @@
if (isWidthSet()) {
if (isWidthLiteral()) {
- ((LayoutObject) component).setWidth(Measure.parse(getWidthValue()));
+ ((LayoutBase) component).setWidth(Measure.parse(getWidthValue()));
+// ((LayoutBase) component).setWidth(Measure.parse(getWidthExpression()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.WIDTH, getWidthAsBindingOrExpression());
}
@@ -94,7 +95,8 @@
if (isHeightSet()) {
if (isHeightLiteral()) {
- ((LayoutObject) component).setHeight(Measure.parse(getHeightValue()));
+ ((LayoutBase) component).setHeight(Measure.parse(getHeightValue()));
+// ((LayoutBase) component).setHeight(Measure.parse(getHeightExpression()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.HEIGHT, getHeightAsBindingOrExpression());
}
@@ -102,7 +104,7 @@
if (isMinimumWidthSet()) {
if (isMinimumWidthLiteral()) {
- ((LayoutObject) component).setMinimumWidth(Measure.parse(getMinimumWidthValue()));
+ ((LayoutBase) component).setMinimumWidth(Measure.parse(getMinimumWidthValue()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.MINIMUM_WIDTH, getMinimumWidthAsBindingOrExpression());
}
@@ -110,7 +112,7 @@
if (isMinimumHeightSet()) {
if (isMinimumHeightLiteral()) {
- ((LayoutObject) component).setMinimumHeight(Measure.parse(getMinimumHeightValue()));
+ ((LayoutBase) component).setMinimumHeight(Measure.parse(getMinimumHeightValue()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.MINIMUM_WIDTH, getMinimumHeightAsBindingOrExpression());
}
@@ -118,7 +120,7 @@
if (isPreferredWidthSet()) {
if (isPreferredWidthLiteral()) {
- ((LayoutObject) component).setPreferredWidth(Measure.parse(getPreferredWidthValue()));
+ ((LayoutBase) component).setPreferredWidth(Measure.parse(getPreferredWidthValue()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.PREFERRED_WIDTH,
getPreferredWidthAsBindingOrExpression());
@@ -127,7 +129,7 @@
if (isPreferredHeightSet()) {
if (isPreferredHeightLiteral()) {
- ((LayoutObject) component).setPreferredHeight(Measure.parse(getPreferredHeightValue()));
+ ((LayoutBase) component).setPreferredHeight(Measure.parse(getPreferredHeightValue()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.PREFERRED_WIDTH,
getPreferredHeightAsBindingOrExpression());
@@ -136,7 +138,7 @@
if (isMaximumWidthSet()) {
if (isMaximumWidthLiteral()) {
- ((LayoutObject) component).setMaximumWidth(Measure.parse(getMaximumWidthValue()));
+ ((LayoutBase) component).setMaximumWidth(Measure.parse(getMaximumWidthValue()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.MAXIMUM_WIDTH, getMaximumWidthAsBindingOrExpression());
}
@@ -144,7 +146,7 @@
if (isMaximumHeightSet()) {
if (isMaximumHeightLiteral()) {
- ((LayoutObject) component).setMaximumHeight(Measure.parse(getMaximumHeightValue()));
+ ((LayoutBase) component).setMaximumHeight(Measure.parse(getMaximumHeightValue()));
} else {
FacesUtils.setBindingOrExpression(component, Attributes.MAXIMUM_WIDTH, getMaximumHeightAsBindingOrExpression());
}
@@ -194,8 +196,10 @@
*/
@TagAttribute(name = "width")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract String getWidthValue();
+ public abstract Object getWidthValue();
+// public abstract String getWidthExpression();
+
// height
public abstract boolean isHeightSet();
@@ -208,8 +212,10 @@
*/
@TagAttribute(name = "height")
@UIComponentTagAttribute(type = "org.apache.myfaces.tobago.layout.Measure")
- public abstract String getHeightValue();
+ public abstract Object getHeightValue();
+// public abstract String getHeightExpression();
+
// minimum width
public abstract boolean isMinimumWidthSet();
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutTagDeclaration.java Thu Nov 19 16:38:01 2009
@@ -27,6 +27,7 @@
import org.apache.myfaces.tobago.taglib.decl.HasId;
import org.apache.myfaces.tobago.taglib.decl.HasMargin;
import org.apache.myfaces.tobago.taglib.decl.HasMargins;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import org.apache.myfaces.tobago.taglib.decl.HasRowLayout;
import org.apache.myfaces.tobago.taglib.decl.HasSpacing;
@@ -100,5 +101,5 @@
componentFamily = "org.apache.myfaces.tobago.GridLayout",
allowedChildComponenents = "NONE", isLayout = true)
public interface GridLayoutTagDeclaration extends HasId, HasBorder, HasSpacing, HasMargin,
- HasMargins, HasColumnLayout, HasRowLayout, HasBinding {
+ HasMargins, HasColumnLayout, HasRowLayout, HasBinding, HasMarkup {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuTagDeclaration.java Thu Nov 19 16:38:01 2009
@@ -20,9 +20,11 @@
import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
import org.apache.myfaces.tobago.apt.annotation.Tag;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
import org.apache.myfaces.tobago.taglib.decl.HasImage;
import org.apache.myfaces.tobago.taglib.decl.HasLabelAndAccessKey;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
@@ -38,7 +40,8 @@
"org.apache.myfaces.tobago.internal.taglib.MenuSeparatorTag"})
@UIComponentTag(
uiComponent = "org.apache.myfaces.tobago.component.UIMenu",
- uiComponentBaseClass = "org.apache.myfaces.tobago.component.UIPanelBase",
+ uiComponentBaseClass = "org.apache.myfaces.tobago.component.AbstractUIMenu",
+ rendererType = RendererTypes.MENU,
allowedChildComponenents = {
"org.apache.myfaces.tobago.Menu",
"org.apache.myfaces.tobago.MenuCommand",
@@ -46,5 +49,5 @@
"org.apache.myfaces.tobago.MenuSelectOne",
"org.apache.myfaces.tobago.MenuSeparator"})
public interface MenuTagDeclaration extends HasIdBindingAndRendered, HasLabelAndAccessKey,
- IsDisabled, HasImage, IsGridLayoutComponent {
+ IsDisabled, HasImage, IsGridLayoutComponent, HasMarkup {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java Thu Nov 19 16:38:01 2009
@@ -23,6 +23,7 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasId;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponentWithDeprecatedDimension;
import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutContainer;
import org.apache.myfaces.tobago.taglib.decl.IsRendered;
@@ -37,7 +38,7 @@
interfaces = "org.apache.myfaces.tobago.ajax.api.AjaxComponent",
rendererType = RendererTypes.POPUP)
public interface PopupTagDeclaration
- extends HasId, IsRendered, IsGridLayoutComponentWithDeprecatedDimension, IsGridLayoutContainer {
+ extends HasId, IsRendered, IsGridLayoutComponentWithDeprecatedDimension, IsGridLayoutContainer, HasMarkup {
@TagAttribute
@UIComponentTagAttribute(type = "java.lang.Boolean", defaultValue = "Boolean.TRUE")
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SheetLayoutTagDeclaration.java Thu Nov 19 16:38:01 2009
@@ -22,6 +22,7 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasId;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
/**
* Creates a SheetLayout, which is a internal layout manager of a sheet.
@@ -34,5 +35,5 @@
componentFamily = "org.apache.myfaces.tobago.SheetLayout",
allowedChildComponenents = "NONE",
isLayout = true)
-public interface SheetLayoutTagDeclaration extends HasId {
+public interface SheetLayoutTagDeclaration extends HasId, HasMarkup {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java Thu Nov 19 16:38:01 2009
@@ -22,6 +22,7 @@
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.taglib.decl.HasId;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
/**
* Creates a TabGroupLayout, which is a internal layout manager of a tabGroup.
@@ -34,5 +35,5 @@
componentFamily = "org.apache.myfaces.tobago.TabGroupLayout",
allowedChildComponenents = "NONE",
isLayout = true)
-public interface TabGroupLayoutTagDeclaration extends HasId {
+public interface TabGroupLayoutTagDeclaration extends HasId, HasMarkup {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriter.java Thu Nov 19 16:38:01 2009
@@ -153,12 +153,6 @@
writeAttribute(HtmlAttributes.STYLE, style, false);
}
- /**
- * Write the style attribute. The value will not escaped.
- */
- @Deprecated
- public abstract void writeStyleAttribute() throws IOException;
-
public void writeJavascript(String script) throws IOException {
startJavascript();
write(script);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java Thu Nov 19 16:38:01 2009
@@ -21,11 +21,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.config.ThemeConfig;
-import org.apache.myfaces.tobago.layout.Display;
-import org.apache.myfaces.tobago.layout.LayoutComponent;
-import org.apache.myfaces.tobago.layout.Measure;
-import org.apache.myfaces.tobago.renderkit.css.Position;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
@@ -34,7 +29,6 @@
import org.apache.myfaces.tobago.util.XmlUtils;
import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import java.io.IOException;
import java.io.Writer;
@@ -400,77 +394,6 @@
}
}
- @Deprecated
- public void writeStyleAttribute() throws IOException {
-
- Style styles = (Style) component.getAttributes().get(Attributes.STYLE);
-
- styles = addLayout(styles);
-
- if (styles != null) {
- writeAttribute(HtmlAttributes.STYLE, styles.encode(), false);
- }
- }
-
- @Deprecated
- private Style addLayout(Style styles) {
- if (component instanceof LayoutComponent) {
- LayoutComponent layoutComponent = (LayoutComponent) component;
- FacesContext facesContext = FacesContext.getCurrentInstance();
-
- Measure width = layoutComponent.getWidth();
- if (width != null) {
- // TODO: Make configurable: this is needed if the box-sizing is border-box, not content-box (see CSS3)
- width = width.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.border-left-width"));
- width = width.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.padding-left"));
- width = width.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.padding-right"));
- width = width.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.border-right-width"));
- styles = ensureHtmlStyleMap(component, styles);
- styles.setWidth(width);
- }
- Measure height = layoutComponent.getHeight();
- if (height != null) {
- // TODO: Make configurable: this is needed if the box-sizing is border-box, not content-box (see CSS3)
- height = height.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.border-top-width"));
- height = height.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.padding-top"));
- height = height.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.padding-bottom"));
- height = height.subtractNotNegative(
- ThemeConfig.getMeasure(facesContext, component.getRendererType(), "css.border-bottom-width"));
- styles = ensureHtmlStyleMap(component, styles);
- styles.setHeight(height);
- }
- Measure left = layoutComponent.getLeft();
- if (left != null) {
- styles = ensureHtmlStyleMap(component, styles);
- styles.setLeft(left);
- }
- Measure top = layoutComponent.getTop();
- if (top != null) {
- styles = ensureHtmlStyleMap(component, styles);
- styles.setTop(top);
- }
- // if there are a position coordinates, activate absolute positioning
- // XXX String "Page" is not nice here
- if ((left != null || top != null) && !component.getRendererType().contains("Page")) {
- styles = ensureHtmlStyleMap(component, styles);
- styles.setPosition(Position.ABSOLUTE);
- }
- Display display = layoutComponent.getDisplay();
- if (display != null) {
- styles = ensureHtmlStyleMap(component, styles);
- styles.setDisplay(display);
- }
- }
- return styles;
- }
-
public static Style ensureHtmlStyleMap(UIComponent component, Style styles) {
if (styles == null) {
styles = new Style();
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterWrapper.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterWrapper.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterWrapper.java Thu Nov 19 16:38:01 2009
@@ -81,11 +81,6 @@
responseWriter.writeAttribute(HtmlAttributes.CLASS, null, Attributes.STYLE_CLASS);
}
- @Deprecated
- public void writeStyleAttribute() throws IOException {
- responseWriter.writeAttribute(HtmlAttributes.STYLE, null, Attributes.STYLE);
- }
-
public String getContentType() {
return responseWriter.getContentType();
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java Thu Nov 19 16:38:01 2009
@@ -23,6 +23,8 @@
import org.apache.myfaces.tobago.config.TobagoConfig;
import org.apache.myfaces.tobago.config.TobagoConfigParser;
import org.apache.myfaces.tobago.context.ResourceManagerFactory;
+import org.apache.myfaces.tobago.context.ResourceManagerImpl;
+import org.apache.myfaces.tobago.layout.Measure;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
@@ -62,7 +64,7 @@
tobagoConfig.resolveThemes();
// theme config cache
- servletContext.setAttribute(ThemeConfig.THEME_CONFIG_CACHE, new HashMap());
+ servletContext.setAttribute(ThemeConfig.THEME_CONFIG_CACHE, new HashMap<ResourceManagerImpl.CacheKey, Measure>());
} catch (Throwable e) {
if (LOG.isFatalEnabled()) {
Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ThemeConfigViewController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ThemeConfigViewController.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ThemeConfigViewController.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ThemeConfigViewController.java Thu Nov 19 16:38:01 2009
@@ -29,6 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.config.ThemeConfig;
+import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.Measure;
import javax.faces.component.UIComponent;
@@ -172,7 +173,7 @@
for (int i = 0; i < propertyNames.length; i++) {
String propertyName = propertyNames[i];
try {
- Measure measure = ThemeConfig.getMeasure(facesContext, component.getRendererType(), propertyName);
+ Measure measure = ThemeConfig.getMeasure(facesContext, (LayoutBase)component, propertyName);
found.add(new DefaultKeyValue(propertyName, measure.toString()));
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java Thu Nov 19 16:38:01 2009
@@ -24,8 +24,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.LayoutComponent;
-import org.apache.myfaces.tobago.layout.LayoutObject;
import org.apache.myfaces.tobago.layout.Measure;
import javax.el.ELException;
@@ -69,8 +69,8 @@
public void apply(FaceletContext faceletContext, UIComponent parent)
throws IOException, FacesException, ELException {
- if (parent instanceof LayoutObject) {
- LayoutObject component = (LayoutObject) parent;
+ if (parent instanceof LayoutBase) {
+ LayoutBase component = (LayoutBase) parent;
if (parent instanceof LayoutComponent && columnSpan != null) {
LOG.error(columnSpan.getValue());
Modified: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java (original)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/AbstractUIEquationGridLayout.java Thu Nov 19 16:38:01 2009
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.layout.Display;
import org.apache.myfaces.tobago.layout.EquationLayoutContext;
import org.apache.myfaces.tobago.layout.EquationLayoutManager;
@@ -39,7 +40,8 @@
import java.util.Arrays;
import java.util.List;
-public abstract class AbstractUIEquationGridLayout extends UILayout implements EquationLayoutManager {
+public abstract class AbstractUIEquationGridLayout extends UILayout
+ implements EquationLayoutManager, Configurable {
private static final Log LOG = LogFactory.getLog(AbstractUIEquationGridLayout.class);
Modified: myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java (original)
+++ myfaces/tobago/trunk/extension/math/src/main/java/org/apache/myfaces/tobago/component/UIEquationGridLayout.java Thu Nov 19 16:38:01 2009
@@ -1,37 +1,18 @@
-// ---------- Attention: Generated code, please do not modify! -----------
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package org.apache.myfaces.tobago.component;
+import org.apache.commons.lang.ArrayUtils;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.layout.Measure;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
import javax.faces.context.FacesContext;
+import java.util.ArrayList;
+import java.util.List;
-/**
- * UIComponent class, generated from template {@code component1.2.stg} with class
- * {@link org.apache.myfaces.tobago.taglib.component.GridLayoutTagDeclaration}.
- */
public class UIEquationGridLayout
extends AbstractUIEquationGridLayout {
-
-
public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.GridLayout";
@@ -48,6 +29,7 @@
private String marginTop;
private String columns;
private String rows;
+ private java.lang.String[] markup;
public String getFamily() {
return COMPONENT_FAMILY;
@@ -126,7 +108,7 @@
}
return getCellspacing() != null
? getCellspacing()
- : ThemeConfig.getMeasure(getFacesContext(), getRendererType(), "columnSpacing");
+ : ThemeConfig.getMeasure(getFacesContext(), this, "columnSpacing");
}
public void setColumnSpacing(Measure columnSpacing) {
@@ -157,7 +139,7 @@
}
return getCellspacing() != null
? getCellspacing()
- : ThemeConfig.getMeasure(getFacesContext(), getRendererType(), "rowSpacing");
+ : ThemeConfig.getMeasure(getFacesContext(), this, "rowSpacing");
}
public void setRowSpacing(Measure rowSpacing) {
@@ -315,6 +297,41 @@
this.rows = rows;
}
+ public String[] getMarkup() {
+ if (markup != null) {
+ return markup;
+ }
+ ValueExpression ve = getValueExpression("markup");
+ if (ve != null) {
+ try {
+ Object strArray = ve.getValue(getFacesContext().getELContext());
+ if (strArray instanceof String[]) {
+ return (String[]) strArray;
+ } else if (strArray instanceof String) {
+ String[] strings = ((String) strArray).split("[, ]");
+ List<String> result = new ArrayList<String>(strings.length);
+ for (String string : strings) {
+ if (string.trim().length() != 0) {
+ result.add(string.trim());
+ }
+ }
+ return result.toArray(new String[result.size()]);
+ } else if (strArray == null) {
+ return ArrayUtils.EMPTY_STRING_ARRAY;
+ } else {
+ return new String[]{strArray.toString()};
+ }
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ }
+ return ArrayUtils.EMPTY_STRING_ARRAY;
+ }
+
+ public void setMarkup(String[] markup) {
+ this.markup = markup;
+ }
+
public void restoreState(FacesContext context, Object componentState) {
Object[] values = (Object[]) componentState;
super.restoreState(context, values[0]);
@@ -329,10 +346,11 @@
marginTop = (String) values[9];
columns = (String) values[10];
rows = (String) values[11];
+ markup = (java.lang.String[]) values[12];
}
public Object saveState(FacesContext context) {
- Object[] values = new Object[12];
+ Object[] values = new Object[13];
values[0] = super.saveState(context);
values[1] = border;
values[2] = cellspacing;
@@ -345,8 +363,7 @@
values[9] = marginTop;
values[10] = columns;
values[11] = rows;
+ values[12] = markup;
return values;
}
-
-
-}
\ No newline at end of file
+}
Modified: myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/property/tobago-theme-config.properties?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/charlotteville/src/main/resources/org/apache/myfaces/tobago/renderkit/html/charlotteville/standard/property/tobago-theme-config.properties Thu Nov 19 16:38:01 2009
@@ -21,3 +21,7 @@
Box.css.border-top-width=1
Box.css.border-right-width=1
Box.css.border-bottom-width=1
+Box.leftOffset=6
+Box.topOffset=26
+Box.rightOffset=6
+Box.bottomOffset=6
Modified: myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/property/tobago-theme-config.properties?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/property/tobago-theme-config.properties Thu Nov 19 16:38:01 2009
@@ -21,6 +21,10 @@
Box.css.border-top-width=1
Box.css.border-right-width=1
Box.css.border-bottom-width=1
+Box.leftOffset=6
+Box.topOffset=26
+Box.rightOffset=6
+Box.bottomOffset=6
# padding-top + padding-bottom + border-top + border-bottom
TabGroup.paddingHeight=28
Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java?rev=882196&r1=882195&r2=882196&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/BoxRenderer.java Thu Nov 19 16:38:01 2009
@@ -48,7 +48,7 @@
UIPanel toolbar = (UIPanel) box.getFacet(Facets.TOOL_BAR);
Style style = new Style(facesContext, box);
if (toolbar != null) {
- Measure padding = ThemeConfig.getMeasure(facesContext, box.getRendererType(), "paddingTopWhenToolbar");
+ Measure padding = ThemeConfig.getMeasure(facesContext, box, "paddingTopWhenToolbar");
style.setPaddingTop(padding);
style.setPaddingBottom(PixelMeasure.ZERO);
}
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=882196&r1=882195&r2=882196&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 Thu Nov 19 16:38:01 2009
@@ -26,6 +26,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UIButton;
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.layout.PixelMeasure;
@@ -127,20 +128,20 @@
}
@Override
- public Measure getPreferredWidth(FacesContext facesContext, UIComponent component) {
+ public Measure getPreferredWidth(FacesContext facesContext, Configurable component) {
UIButton button = (UIButton) component;
Measure width = PixelMeasure.ZERO;
boolean image = button.getImage() != null;
if (image) {
- width = ThemeConfig.getMeasure(facesContext, button.getRendererType(), "imageWidth");
+ width = ThemeConfig.getMeasure(facesContext, button, "imageWidth");
}
LabelWithAccessKey label = new LabelWithAccessKey(button);
if (label.getText() != null) {
width = width.add(RenderUtil.calculateStringWidth(facesContext, button, label.getText()));
}
- Measure padding = ThemeConfig.getMeasure(facesContext, button.getRendererType(), "paddingWidth");
+ Measure padding = ThemeConfig.getMeasure(facesContext, button, "paddingWidth");
// left padding, right padding and when an image and an text then a middle padding.
width = width.add(padding.multiply(image && label.getText() != null ? 3 : 2));