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 2011/02/22 16:44:35 UTC
svn commit: r1073367 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/...
Author: lofwyr
Date: Tue Feb 22 15:44:34 2011
New Revision: 1073367
URL: http://svn.apache.org/viewvc?rev=1073367&view=rev
Log:
TOBAGO-859: FlowLayoutManager
- add textAlign
Added:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/TextAlign.java
myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/TextAlignUnitTest.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/FlowLayoutRule.java
- copied, changed from r1073239, myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutRule.java
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFlowLayout.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FlowLayoutTagDeclaration.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FlowLayoutRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component2.0.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.1.stg
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.2.stg
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java Tue Feb 22 15:44:34 2011
@@ -194,6 +194,7 @@ public final class Attributes {
public static final String TAB_INDEX = "tabIndex";
public static final String TARGET = "target";
public static final String TIME_STYLE = "timeStyle";
+ public static final String TEXT_ALIGN = "textAlign";
public static final String TIMEZONE = "timezone";
public static final String TITLE = "title";
public static final String TIP = "tip";
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFlowLayout.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFlowLayout.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFlowLayout.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIFlowLayout.java Tue Feb 22 15:44:34 2011
@@ -33,6 +33,7 @@ public abstract class AbstractUIFlowLayo
}
public void mainProcessing(Orientation orientation) {
+
}
public void postProcessing(Orientation orientation) {
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FlowLayoutTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FlowLayoutTagDeclaration.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FlowLayoutTagDeclaration.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/FlowLayoutTagDeclaration.java Tue Feb 22 15:44:34 2011
@@ -19,7 +19,9 @@ package org.apache.myfaces.tobago.intern
import org.apache.myfaces.tobago.apt.annotation.BodyContent;
import org.apache.myfaces.tobago.apt.annotation.Tag;
+import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
+import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasCurrentMarkup;
@@ -27,6 +29,7 @@ import org.apache.myfaces.tobago.interna
import org.apache.myfaces.tobago.internal.taglib.declaration.HasMargin;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasMargins;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasMarkup;
+import org.apache.myfaces.tobago.layout.TextAlign;
/**
* XXX Warning: Still in progress! Please do not use it until other announcement.
@@ -44,4 +47,19 @@ public interface FlowLayoutTagDeclaratio
/*HasSpacing, TODO*/
HasMargin, HasMargins, /*todo: do we need the margin here? Or should be use the margin from the container? */
HasBinding, HasMarkup, HasCurrentMarkup {
+
+ /**
+ * The alignment of the elements inside of the container, possible values are:
+ * {@value TextAlign#STRING_LEFT},
+ * {@value TextAlign#STRING_RIGHT},
+ * {@value TextAlign#STRING_CENTER} und
+ * {@value TextAlign#STRING_JUSTIFY}.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(
+ type = {"org.apache.myfaces.tobago.layout.TextAlign"},
+ defaultValue = "TextAlign.LEFT",
+ allowedValues = {
+ TextAlign.STRING_LEFT, TextAlign.STRING_RIGHT, TextAlign.STRING_CENTER, TextAlign.STRING_JUSTIFY})
+ void setTextAlign(String textAlign);
}
Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/TextAlign.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/TextAlign.java?rev=1073367&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/TextAlign.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/TextAlign.java Tue Feb 22 15:44:34 2011
@@ -0,0 +1,67 @@
+package org.apache.myfaces.tobago.layout;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * 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 enum TextAlign {
+
+ LEFT("left"),
+ RIGHT("right"),
+ CENTER("center"),
+ JUSTIFY("justify");
+
+ public static final String STRING_LEFT = "left";
+ public static final String STRING_RIGHT = "right";
+ public static final String STRING_CENTER = "center";
+ public static final String STRING_JUSTIFY = "justify";
+
+ private String value;
+
+ TextAlign(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ private static final Map<String, TextAlign> MAPPING;
+
+ static {
+ MAPPING = new HashMap<String, TextAlign>();
+
+ for (TextAlign textAlign : TextAlign.values()) {
+ MAPPING.put(textAlign.getValue(), textAlign);
+ }
+ }
+
+ public static TextAlign parse(String string) {
+ if (string == null) {
+ return null;
+ }
+ TextAlign value = MAPPING.get(string);
+ if (value != null) {
+ return value;
+ } else {
+ throw new IllegalArgumentException("Unknown value for TextAlign: '" + string + "'");
+ }
+ }
+
+}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/css/Style.java Tue Feb 22 15:44:34 2011
@@ -22,6 +22,7 @@ import org.apache.myfaces.tobago.layout.
import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.LayoutComponent;
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.TextAlign;
import javax.faces.context.FacesContext;
import java.io.Serializable;
@@ -49,7 +50,7 @@ public class Style implements Serializab
private Measure padding;
private String backgroundImage;
private Integer zIndex;
- private String textAlign;
+ private TextAlign textAlign;
public Style() {
}
@@ -377,11 +378,11 @@ public class Style implements Serializab
this.zIndex = zIndex;
}
- public String getTextAlign() {
+ public TextAlign getTextAlign() {
return textAlign;
}
- public void setTextAlign(String textAlign) {
+ public void setTextAlign(TextAlign textAlign) {
this.textAlign = textAlign;
}
}
Added: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/TextAlignUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/TextAlignUnitTest.java?rev=1073367&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/TextAlignUnitTest.java (added)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/layout/TextAlignUnitTest.java Tue Feb 22 15:44:34 2011
@@ -0,0 +1,32 @@
+package org.apache.myfaces.tobago.layout;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/*
+ * 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 class TextAlignUnitTest {
+
+ @Test
+ public void testConstants() {
+ Assert.assertEquals(TextAlign.LEFT.getValue(), TextAlign.STRING_LEFT);
+ Assert.assertEquals(TextAlign.RIGHT.getValue(), TextAlign.STRING_RIGHT);
+ Assert.assertEquals(TextAlign.CENTER.getValue(), TextAlign.STRING_CENTER);
+ Assert.assertEquals(TextAlign.JUSTIFY.getValue(), TextAlign.STRING_JUSTIFY);
+ }
+}
Copied: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/FlowLayoutRule.java (from r1073239, myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutRule.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/FlowLayoutRule.java?p2=myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/FlowLayoutRule.java&p1=myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutRule.java&r1=1073239&r2=1073367&rev=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutRule.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/FlowLayoutRule.java Tue Feb 22 15:44:34 2011
@@ -23,24 +23,19 @@ import com.sun.facelets.tag.Metadata;
import com.sun.facelets.tag.MetadataTarget;
import com.sun.facelets.tag.TagAttribute;
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.UIGridLayout;
+import org.apache.myfaces.tobago.component.UIFlowLayout;
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.TextAlign;
-public class GridLayoutRule extends MetaRule {
+public class FlowLayoutRule extends MetaRule {
- public static final GridLayoutRule INSTANCE = new GridLayoutRule();
+ public static final FlowLayoutRule INSTANCE = new FlowLayoutRule();
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget metadataTarget) {
- if (metadataTarget.isTargetInstanceOf(UIGridLayout.class)) {
+ if (metadataTarget.isTargetInstanceOf(UIFlowLayout.class)) {
if (attribute.isLiteral()) {
- if (Attributes.COLUMN_SPACING.equals(name)) {
- return new ColumnSpacingMapper(attribute);
- }
- if (Attributes.ROW_SPACING.equals(name)) {
- return new RowSpacingMapper(attribute);
- }
- if (Attributes.CELLSPACING.equals(name)) {
- return new CellspacingMapper(attribute);
+ if (Attributes.TEXT_ALIGN.equals(name)) {
+ return new TextAlignMapper(attribute);
}
if (Attributes.MARGIN_LEFT.equals(name)) {
return new MarginLeftMapper(attribute);
@@ -62,42 +57,16 @@ public class GridLayoutRule extends Meta
return null;
}
- static final class ColumnSpacingMapper extends Metadata {
- private final TagAttribute attribute;
-
- ColumnSpacingMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
- gridLayout.setColumnSpacing(Measure.parse(attribute.getValue()));
- }
- }
-
- static final class RowSpacingMapper extends Metadata {
- private final TagAttribute attribute;
-
- RowSpacingMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
- gridLayout.setRowSpacing(Measure.parse(attribute.getValue()));
- }
- }
-
- static final class CellspacingMapper extends Metadata {
+ static final class TextAlignMapper extends Metadata {
private final TagAttribute attribute;
- CellspacingMapper(TagAttribute attribute) {
+ TextAlignMapper(TagAttribute attribute) {
this.attribute = attribute;
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
- gridLayout.setCellspacing(Measure.parse(attribute.getValue()));
+ UIFlowLayout gridLayout = (UIFlowLayout) instance;
+ gridLayout.setTextAlign(TextAlign.parse(attribute.getValue()));
}
}
@@ -109,7 +78,7 @@ public class GridLayoutRule extends Meta
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
+ UIFlowLayout gridLayout = (UIFlowLayout) instance;
gridLayout.setMarginLeft(Measure.valueOf(attribute.getValue()));
}
}
@@ -122,7 +91,7 @@ public class GridLayoutRule extends Meta
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
+ UIFlowLayout gridLayout = (UIFlowLayout) instance;
gridLayout.setMarginTop(Measure.valueOf(attribute.getValue()));
}
}
@@ -135,7 +104,7 @@ public class GridLayoutRule extends Meta
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
+ UIFlowLayout gridLayout = (UIFlowLayout) instance;
gridLayout.setMarginRight(Measure.valueOf(attribute.getValue()));
}
}
@@ -148,7 +117,7 @@ public class GridLayoutRule extends Meta
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
+ UIFlowLayout gridLayout = (UIFlowLayout) instance;
gridLayout.setMarginBottom(Measure.valueOf(attribute.getValue()));
}
}
@@ -161,7 +130,7 @@ public class GridLayoutRule extends Meta
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- UIGridLayout gridLayout = (UIGridLayout) instance;
+ UIFlowLayout gridLayout = (UIFlowLayout) instance;
gridLayout.setMargin(Measure.valueOf(attribute.getValue()));
}
}
Modified: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java Tue Feb 22 15:44:34 2011
@@ -30,6 +30,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.event.SheetStateChangeSource;
import org.apache.myfaces.tobago.event.SortActionSource;
import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.internal.component.AbstractUIFlowLayout;
import org.apache.myfaces.tobago.internal.component.AbstractUIGridLayout;
import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
@@ -55,6 +56,9 @@ public class TobagoComponentHandler exte
if (AbstractUIGridLayout.class.isAssignableFrom(aClass)) {
metaRuleset.addRule(GridLayoutRule.INSTANCE);
}
+ if (AbstractUIFlowLayout.class.isAssignableFrom(aClass)) {
+ metaRuleset.addRule(FlowLayoutRule.INSTANCE);
+ }
if (TabChangeSource.class.isAssignableFrom(aClass)) {
metaRuleset.addRule(TabChangeSourceRule.INSTANCE);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FlowLayoutRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FlowLayoutRenderer.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FlowLayoutRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/FlowLayoutRenderer.java Tue Feb 22 15:44:34 2011
@@ -49,6 +49,7 @@ public class FlowLayoutRenderer extends
style.setMarginRight(getMarginRight(facesContext, layout));
style.setMarginTop(getMarginTop(facesContext, layout));
style.setMarginBottom(getMarginBottom(facesContext, layout));
+ style.setTextAlign(layout.getTextAlign());
writer.writeStyleAttribute(style);
}
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/SheetRenderer.java Tue Feb 22 15:44:34 2011
@@ -18,8 +18,6 @@ package org.apache.myfaces.tobago.render
*/
import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.config.Configurable;
-import org.apache.myfaces.tobago.util.CreateComponentUtils;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.SupportsMarkup;
@@ -30,6 +28,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.component.UIMenuCommand;
import org.apache.myfaces.tobago.component.UIReload;
import org.apache.myfaces.tobago.component.UISheet;
+import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.context.ClientProperties;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.context.ResourceManager;
@@ -40,6 +39,7 @@ import org.apache.myfaces.tobago.event.P
import org.apache.myfaces.tobago.internal.util.StringUtils;
import org.apache.myfaces.tobago.layout.LayoutBase;
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.TextAlign;
import org.apache.myfaces.tobago.model.SheetState;
import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -51,6 +51,7 @@ import org.apache.myfaces.tobago.renderk
import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
import org.apache.myfaces.tobago.util.ComponentUtils;
+import org.apache.myfaces.tobago.util.CreateComponentUtils;
import org.apache.myfaces.tobago.util.FacetUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
@@ -322,7 +323,7 @@ public class SheetRenderer extends Layou
markup = markup.add(Markup.CLICKABLE);
}
writer.writeClassAttribute(Classes.create(sheet, "cell", markup));
- final String align = (String) column.getAttributes().get(Attributes.ALIGN);
+ final TextAlign align = TextAlign.parse((String) column.getAttributes().get(Attributes.ALIGN));
if (align != null) {
Style alignStyle = new Style();
alignStyle.setTextAlign(align);
@@ -739,10 +740,8 @@ public class SheetRenderer extends Layou
Style divStyle = new Style();
divWidth = divWidth - 6; // leftBorder + leftPadding + rightPadding + rightBorder = 6, todo: use Style Constructor
divStyle.setWidth(Measure.valueOf(divWidth));
- String align = (String) column.getAttributes().get(Attributes.ALIGN);
- if (align != null) {
- divStyle.setTextAlign(align);
- }
+ TextAlign align = TextAlign.parse((String) column.getAttributes().get(Attributes.ALIGN));
+ divStyle.setTextAlign(align);
writer.startElement(HtmlElements.SPAN, null);
writer.writeIdAttribute(sheetId + ComponentUtils.SUB_SEPARATOR + "header_box_" + columnIndex);
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java Tue Feb 22 15:44:34 2011
@@ -21,6 +21,7 @@ import org.apache.myfaces.tobago.compone
import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.context.ResourceManager;
import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.layout.TextAlign;
import org.apache.myfaces.tobago.renderkit.css.Classes;
import org.apache.myfaces.tobago.renderkit.css.Style;
import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -47,7 +48,7 @@ public class ToolBarRenderer extends Too
Style style = new Style(facesContext, toolBar);
boolean right = toolBar instanceof UIToolBar && UIToolBar.ORIENTATION_RIGHT.equals(toolBar.getOrientation());
if (right) {
- style.setTextAlign("right");
+ style.setTextAlign(TextAlign.RIGHT);
}
writer.writeStyleAttribute(style);
super.encodeEnd(facesContext, toolBar);
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.1.stg Tue Feb 22 15:44:34 2011
@@ -414,6 +414,10 @@ SeverityProperty(property) ::= <<
<NormalProperty(property)>
>>
+TextAlignProperty(property) ::= <<
+<NormalProperty(property)>
+>>
+
DisplayProperty(property) ::= <<
<NormalProperty(property)>
>>
@@ -502,6 +506,32 @@ public void set<property.upperCamelCaseN
}
>>
+TextAlignProperty(property) ::= <<
+
+<createDescription(property)>
+<checkDeprecated(property)>
+public <property.type> get<property.upperCamelCaseName>() {
+ if (<property.propertyName> != null) {
+ return <property.propertyName>;
+ }
+ <getValueExpression(property)>
+ if (ve != null) {
+ String string = (String) <getValue(property)>
+ return TextAlign.parse(string);
+ }
+ <if(property.defaultCode)>
+ return <property.defaultCode>;
+ <else>
+ return null;
+ <endif>
+}
+
+<checkDeprecated(property)>
+public void set<property.upperCamelCaseName>(<property.type> <property.propertyName>) {
+ this.<property.propertyName> = <property.propertyName>;
+}
+>>
+
MarkupProperty(property) ::= <<
<checkDeprecated(property)>
@@ -567,6 +597,10 @@ MeasureSaveStateProperty() ::= <<
values[<it.indexPlusOne>] = <it.propertyName>;
>>
+TextAlignSaveStateProperty() ::= <<
+values[<it.indexPlusOne>] = <it.propertyName>;
+>>
+
MarkupSaveStateProperty() ::= <<
values[<it.indexPlusOne>] = <it.propertyName>;
>>
@@ -624,6 +658,10 @@ MeasureRestoreStateProperty() ::= <<
<it.propertyName> = (<it.type>) values[<it.indexPlusOne>];
>>
+TextAlignRestoreStateProperty() ::= <<
+<it.propertyName> = (<it.type>) values[<it.indexPlusOne>];
+>>
+
MarkupRestoreStateProperty() ::= <<
<it.propertyName> = (<it.type>) values[<it.indexPlusOne>];
>>
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component1.2.stg Tue Feb 22 15:44:34 2011
@@ -149,7 +149,7 @@ checkDeprecated(property) ::= <<
logDeprecated(property) ::= <<
<if(property.deprecated)>
Deprecation.LOG.error("The attribute '<property.propertyName>' of '<componentInfo.className>' is deprecated. "
- + "Please refer the documentation for further information.");
+ + "Please refer the documentation for further information.");
<endif>
>>
@@ -328,6 +328,10 @@ SeverityProperty(property) ::= <<
<NormalProperty(property)>
>>
+TextAlignProperty(property) ::= <<
+<NormalProperty(property)>
+>>
+
DisplayProperty(property) ::= <<
<NormalProperty(property)>
>>
@@ -457,6 +461,36 @@ public void set<property.upperCamelCaseN
}
>>
+TextAlignProperty(property) ::= <<
+
+<createDescription(property)>
+<checkDeprecated(property)>
+public <property.type> get<property.upperCamelCaseName>() {
+ if (<property.propertyName> != null) {
+ return <property.propertyName>;
+ }
+ <getValueExpression(property)>
+ if (ve != null) {
+ try {
+ String string = (String) <getValue(property)>
+ return TextAlign.parse(string);
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ }
+ <if(property.defaultCode)>
+ return <property.defaultCode>;
+ <else>
+ return null;
+ <endif>
+}
+
+<checkDeprecated(property)>
+public void set<property.upperCamelCaseName>(<property.type> <property.propertyName>) {
+ this.<property.propertyName> = <property.propertyName>;
+}
+>>
+
MarkupProperty(property) ::= <<
<checkDeprecated(property)>
@@ -537,6 +571,10 @@ MeasureSaveStateProperty() ::= <<
values[<it.indexPlusOne>] = <it.propertyName>;
>>
+TextAlignSaveStateProperty() ::= <<
+values[<it.indexPlusOne>] = <it.propertyName>;
+>>
+
MarkupSaveStateProperty() ::= <<
values[<it.indexPlusOne>] = <it.propertyName>;
>>
@@ -601,6 +639,10 @@ MeasureRestoreStateProperty() ::= <<
<it.propertyName> = (<it.type>) values[<it.indexPlusOne>];
>>
+TextAlignRestoreStateProperty() ::= <<
+<it.propertyName> = (<it.type>) values[<it.indexPlusOne>];
+>>
+
MarkupRestoreStateProperty() ::= <<
<it.propertyName> = (<it.type>) values[<it.indexPlusOne>];
>>
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component2.0.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component2.0.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component2.0.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/component2.0.stg Tue Feb 22 15:44:34 2011
@@ -269,6 +269,10 @@ SeverityProperty(property) ::= <<
<NormalProperty(property)>
>>
+TextAlignProperty(property) ::= <<
+<NormalProperty(property)>
+>>
+
DisplayProperty(property) ::= <<
<NormalProperty(property)>
>>
@@ -378,6 +382,26 @@ public void set<property.upperCamelCaseN
}
>>
+TextAlignProperty(property) ::= <<
+
+<createDescription(property)>
+<checkDeprecated(property)>
+public <property.type> get<property.upperCamelCaseName>() {
+ String string = (String) getStateHelper().eval(PropertyKeys.<property.propertyName>);
+ return TextAlign.parse(string);
+ <if(property.defaultCode)>
+ return <property.defaultCode>;
+ <else>
+ return null;
+ <endif>
+}
+
+<checkDeprecated(property)>
+public void set<property.upperCamelCaseName>(<property.type> <property.propertyName>) {
+ getStateHelper().put(PropertyKeys.<property.propertyName>, <property.propertyName>);
+}
+>>
+
MarkupProperty(property) ::= <<
<checkDeprecated(property)>
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.1.stg Tue Feb 22 15:44:34 2011
@@ -202,6 +202,16 @@ if (<it.propertyName> != null) {
}
>>
+TextAlign() ::= <<
+if (<it.propertyName> != null) {
+ if (isValueReference<it.propertyName>)) {
+ <createValueBinding(it)>
+ } else {
+ component.set<it.upperCamelCaseName>(org.apache.myfaces.tobago.layout.TextAlign.parse(<it.propertyName>));
+ }
+}
+>>
+
Markup() ::= <<
if (<it.propertyName> != null) {
if (isValueReference(<it.propertyName>)) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tag1.2.stg Tue Feb 22 15:44:34 2011
@@ -235,6 +235,16 @@ if (<it.propertyName> != null) {
}
>>
+TextAlign() ::= <<
+if (<it.propertyName> != null) {
+ if (!<it.propertyName>.isLiteralText()) {
+ <createValueBinding(it)>
+ } else {
+ component.set<it.upperCamelCaseName>(org.apache.myfaces.tobago.layout.TextAlign.parse(<it.propertyName>.getExpressionString()));
+ }
+}
+>>
+
Markup() ::= <<
if (<it.propertyName> != null) {
if (!<it.propertyName>.isLiteralText()) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.1.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.1.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.1.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.1.stg Tue Feb 22 15:44:34 2011
@@ -172,6 +172,16 @@ if (<it.propertyName> != null) {
}
>>
+TextAlign() ::= <<
+if (<it.propertyName> != null) {
+ if (isValueReference(<it.propertyName>)) {
+ <createValueBinding(it)>
+ } else {
+ component.set<it.upperCamelCaseName>(org.apache.myfaces.tobago.layout.TextAlign.parse(<it.propertyName>));
+ }
+}
+>>
+
Markup() ::= <<
if (<it.propertyName> != null) {
if (isValueReference(<it.propertyName>)) {
Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.2.stg
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.2.stg?rev=1073367&r1=1073366&r2=1073367&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.2.stg (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/resources/org/apache/myfaces/tobago/apt/tagAbstract1.2.stg Tue Feb 22 15:44:34 2011
@@ -209,6 +209,16 @@ if (<it.propertyName> != null) {
}
>>
+TextAlign() ::= <<
+if (<it.propertyName> != null) {
+ if (!<it.propertyName>.isLiteralText()) {
+ <createValueBinding(it)>
+ } else {
+ component.set<it.upperCamelCaseName>(org.apache.myfaces.tobago.layout.TextAlign.parse(<it.propertyName>));
+ }
+}
+>>
+
Markup() ::= <<
if (<it.propertyName> != null) {
if (!<it.propertyName>.isLiteralText()) {