You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2009/06/26 14:13:47 UTC
svn commit: r788668 [1/6] - in /myfaces/tobago/trunk: core/
core/src/main/java/org/apache/myfaces/tobago/component/
core/src/main/java/org/apache/myfaces/tobago/context/
core/src/main/java/org/apache/myfaces/tobago/layout/
core/src/main/java/org/apache...
Author: lofwyr
Date: Fri Jun 26 12:13:41 2009
New Revision: 788668
URL: http://svn.apache.org/viewvc?rev=788668&view=rev
Log:
TOBAGO-606: Layout-Manager
- integrating the new layout management into the most important components.
- adding test pages to see and test the layout
Added:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIButton.java
- copied, changed from r788441, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICell.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIColumn.java
- copied, changed from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIOut.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java
- copied, changed from r786116, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java
- copied, changed from r786116, 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/ComponentTypes.java
- copied, changed from r766599, 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/component/Tags.java
- copied, changed from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Display.java
- copied, changed from r788313, myfaces/tobago/branches/tobago-1.1.x-progress-layout/core/src/main/java/org/apache/myfaces/tobago/layout/Measure.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ReferenceToVariable.java
- copied, changed from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Node.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SubsetOfReferencesToVariables.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
- copied, changed from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/css/CssProperties.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridLayoutConstraintTag.java
- copied, changed from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupReferenceTag.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupLayoutTagDeclaration.java
- copied, changed from r786116, 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/decl/IsGridLayoutComponent.java
- copied, changed from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasTip.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/IsGridLayoutComponentWithDeprecatedDimension.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtils.java (contents, props changed)
- copied, changed from r788441, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java (contents, props changed)
- copied, changed from r766599, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java
myfaces/tobago/trunk/example/test/src/main/webapp/navi-sheet.xhtml
- copied, changed from r785994, myfaces/tobago/trunk/example/test/src/main/webapp/navi.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/box/
myfaces/tobago/trunk/example/test/src/main/webapp/tc/box/box.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/cell/
myfaces/tobago/trunk/example/test/src/main/webapp/tc/cell/3x3-center.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/cell/position-4x4-span-steps.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/horizontal-600px-asterisk-default.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/horizontal-600px-default-300px.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/horizontal-600px-default-default.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/horizontal-default-default-600px.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/nested.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-10x10-span.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2-out.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2-span-bottom.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2-span-left.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2-span-right.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2-span-top.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-2x2.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/gridLayout/position-4x4-span-steps.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/in/
myfaces/tobago/trunk/example/test/src/main/webapp/tc/in/in.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tc/tabGroup/
- copied from r766599, myfaces/tobago/trunk/example/test/src/main/webapp/tabGroup/
myfaces/tobago/trunk/example/test/src/main/webapp/tc/tabGroup/simple.xhtml
myfaces/tobago/trunk/example/test/src/main/webapp/tx/
myfaces/tobago/trunk/example/test/src/main/webapp/tx/in/
myfaces/tobago/trunk/example/test/src/main/webapp/tx/in/in.xhtml
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/GridLayoutConstraintHandler.java
- copied, changed from r766599, myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PopupReferenceHandler.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupLayoutRenderer.java
- copied, changed from r786116, myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/GridLayoutRenderer.java
Removed:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridConstraints.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/LayoutProvider.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/MockUIGridConstraints.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManager.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Node.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutManager.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/GridConstraintsTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasDeprecatedDimension.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasDeprecatedHeight.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasDeprecatedWidth.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasDimension.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasHeight.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/HasWidth.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/LayoutUtil.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/StringUtilsUnitTest.java
myfaces/tobago/trunk/example/test/src/main/webapp/tabGroup/
Modified:
myfaces/tobago/trunk/core/pom.xml
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java
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/AbstractUILabel.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.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/AbstractUITabGroup.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITree.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/CreateComponentUtils.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/component/UIInputBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UILayout.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/TobagoFacesContext.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Component.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Constraints.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Container.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/Measure.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/PseudoCell.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/RealCell.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/AbstractLayoutRenderer.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/BoxRendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/LayoutableRendererBase.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlStyleMap.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/BoxTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ButtonTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CellTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ColumnTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ImageTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/InTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LabelTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/LinkTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/MenuBarTagDeclaration.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/OutTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PageTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PanelTagDeclaration.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/SelectManyListboxTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/SelectOneListboxTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TabGroupTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TextAreaTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/TreeTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/decl/InputTagDeclaration.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterImpl.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockComponent.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MockContainer.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/AssertUtils.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
myfaces/tobago/trunk/example/addressbook/war/src/main/webapp/auth/login.xhtml
myfaces/tobago/trunk/example/demo/src/main/webapp/WEB-INF/web.xml
myfaces/tobago/trunk/example/demo/src/main/webapp/overview/locale.xhtml
myfaces/tobago/trunk/example/demo/src/main/webapp/overview/theme.xhtml
myfaces/tobago/trunk/example/demo/src/main/webapp/reference/layout-test.jsp
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AbstractTobagoTagLibrary.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/PageRule.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/TobagoLabelExtensionHandler.java
myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/FileExtensionTag.java
myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/LabelExtensionTag.java
myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectManyCheckboxExtensionTag.java
myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectManyListboxExtensionTag.java
myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension/SelectOneListboxExtensionTag.java
myfaces/tobago/trunk/extension/tobago-taglib-extension/src/main/java/org/apache/myfaces/tobago/taglib/extension12/LabelExtensionTag.java
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/renderkit/fo/standard/standard/tag/GridLayoutRenderer.java
myfaces/tobago/trunk/sandbox/src/main/java/org/apache/myfaces/tobago/taglib/sandbox/RichTextEditorTagDeclaration.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/mozilla_4_7/tag/ProgressRenderer.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/CellRenderer.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/FileRenderer.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/MenuBarRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MessagesRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/OutRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PageRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ProgressRenderer.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/TextAreaRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRendererBase.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeNodeRenderer.java
myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
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/html/util/HtmlRendererUtil.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtil.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/CreateComponentAnnotationVisitor.java
myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/generate/PropertyInfo.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
Modified: myfaces/tobago/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/pom.xml?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/pom.xml (original)
+++ myfaces/tobago/trunk/core/pom.xml Fri Jun 26 12:13:41 2009
@@ -137,7 +137,6 @@
<!-- <compilerArgument>-Xlint:all,-serial,-fallthrough</compilerArgument>-->
<excludes>
<exclude>org/apache/myfaces/tobago/tablib/extension/*</exclude>
- <exclude>org/apache/myfaces/tobago/component/CreateComponentUtils*</exclude>
<exclude>org/apache/myfaces/tobago/component/UIDatePicker*</exclude>
</excludes>
</configuration>
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIButton.java (from r788441, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIButton.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIButton.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java&r1=788441&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIButton.java Fri Jun 26 12:13:41 2009
@@ -17,76 +17,8 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
+import org.apache.myfaces.tobago.layout.Component;
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
-import java.io.IOException;
-import java.util.Iterator;
+public abstract class AbstractUIButton extends AbstractUICommand implements Component {
-/*
- * Date: Apr 4, 2005
- * Time: 5:02:10 PM
- * $Id$
- */
-public abstract class AbstractUICommand extends javax.faces.component.UICommand
- implements InvokeOnComponent, SupportsRenderedPartially {
-
- public static final String COMMAND_TYPE_SUBMIT = "submit";
- public static final String COMMAND_TYPE_RESET = "reset";
- public static final String COMMAND_TYPE_NAVIGATE = "navigate";
- public static final String COMMAND_TYPE_SCRIPT = "script";
-
- public void processDecodes(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- // Skip processing if our rendered flag is false
- if (!isRendered()) {
- return;
- }
-
- // Process this component itself
- try {
- decode(context);
- } catch (RuntimeException e) {
- context.renderResponse();
- throw e;
- }
-
- Iterator kids = getFacetsAndChildren();
- while (kids.hasNext()) {
- UIComponent kid = (UIComponent) kids.next();
- kid.processDecodes(context);
- }
- }
-
- public void encodeChildren(FacesContext facesContext) throws IOException {
- if (isRendered()) {
- UILayout.getLayout(this).encodeChildrenOfComponent(facesContext, this);
- }
- }
-
- public void queueEvent(FacesEvent facesEvent) {
- // fix for TOBAGO-262
- super.queueEvent(facesEvent);
- if (this == facesEvent.getSource()) {
- if (isImmediate()) {
- facesEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
- facesEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- }
- }
- }
-
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
- }
}
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICell.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICell.java?rev=788668&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICell.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICell.java Fri Jun 26 12:13:41 2009
@@ -0,0 +1,49 @@
+package org.apache.myfaces.tobago.component;
+
+/*
+ * 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.
+ */
+
+/**
+ * @deprecated The Cell is deprecated since Tobago 1.1
+ */
+@Deprecated
+public abstract class AbstractUICell extends AbstractUIPanel {
+
+ public abstract Integer getSpanX();
+
+ public abstract void setSpanX(Integer spanX);
+
+ public abstract Integer getSpanY();
+
+ public abstract void setSpanY(Integer spanY);
+
+ public Integer getRowSpan() {
+ return getSpanY();
+ }
+
+ public void setRowSpan(Integer rowSpan) {
+ setSpanY(rowSpan);
+ }
+
+ public Integer getColumnSpan() {
+ return getSpanX();
+ }
+
+ public void setColumnSpan(Integer columnSpan) {
+ setSpanX(columnSpan);
+ }
+}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIColumn.java (from r766599, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIColumn.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIColumn.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java&r1=766599&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIData.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIColumn.java Fri Jun 26 12:13:41 2009
@@ -17,526 +17,8 @@
* limitations under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
-import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
-import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.event.PageActionEvent;
-import org.apache.myfaces.tobago.event.SheetStateChangeEvent;
-import org.apache.myfaces.tobago.event.SheetStateChangeListener;
-import org.apache.myfaces.tobago.event.SheetStateChangeSource;
-import org.apache.myfaces.tobago.event.SortActionEvent;
-import org.apache.myfaces.tobago.event.SortActionSource;
-import org.apache.myfaces.tobago.layout.LayoutTokens;
-import org.apache.myfaces.tobago.model.SheetState;
-import org.apache.myfaces.tobago.renderkit.LayoutableRenderer;
-import org.apache.myfaces.tobago.util.ComponentUtil;
-
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
import javax.faces.component.UIColumn;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.MethodBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
-import javax.faces.render.Renderer;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public abstract class AbstractUIData extends javax.faces.component.UIData
- implements SheetStateChangeSource, SortActionSource, AjaxComponent, InvokeOnComponent {
-
- private static final Log LOG = LogFactory.getLog(AbstractUIData.class);
-
- public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Data";
-
- /**
- * @see Facets
- * @deprecated Please use Facets instead. Will be removed after Tobago 1.1 */
- @Deprecated
- public static final String FACET_SORTER = "sorter";
- public static final String SORTER_ID = "sorter";
- /**
- * @see Attributes
- * @deprecated Please use Attributes instead. Will be removed after Tobago 1.1 */
- @Deprecated
- public static final String ATTR_SCROLL_POSITION = "attrScrollPosition";
-
- public static final String NONE = "none";
- public static final String SINGLE = "single";
- public static final String MULTI = "multi";
- public static final int DEFAULT_DIRECT_LINK_COUNT = 9;
- public static final int DEFAULT_ROW_COUNT = 100;
- public static final String ROW_IDX_REGEX = "^\\d+" + SEPARATOR_CHAR + ".*";
-
- private SheetState sheetState;
- private List<Integer> widthList;
- private transient LayoutTokens columnLayout;
-
- public void encodeBegin(FacesContext facesContext) throws IOException {
- Renderer renderer = getRenderer(facesContext);
- if (renderer != null && renderer instanceof LayoutableRenderer) {
- ((LayoutableRenderer) renderer).layoutBegin(facesContext, this);
- }
-
- SheetState state = getSheetState(facesContext);
- if (state.getFirst() > -1 && state.getFirst() < getRowCount()) {
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.FIRST)) {
- FacesUtils.setValueOfBindingOrExpression(facesContext, state.getFirst(), this, Attributes.FIRST);
- } else {
- setFirst(state.getFirst());
- }
- }
- super.encodeBegin(facesContext);
- }
-
- public void encodeEnd(FacesContext facesContext) throws IOException {
- Renderer renderer = getRenderer(facesContext);
- if (renderer != null && renderer instanceof LayoutableRenderer) {
- ((LayoutableRenderer) renderer).layoutEnd(facesContext, this);
- }
- super.encodeEnd(facesContext);
- }
-
-
- public void setState(SheetState state) {
- this.sheetState = state;
- }
-
- public SheetState getState() {
- return getSheetState(FacesContext.getCurrentInstance());
- }
-
- public SheetState getSheetState(FacesContext facesContext) {
- if (sheetState != null) {
- return sheetState;
- } else {
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.STATE)) {
- SheetState state = (SheetState)
- FacesUtils.getValueFromValueBindingOrValueExpression(facesContext, this, Attributes.STATE);
- if (state == null) {
- state = new SheetState();
- FacesUtils.setValueOfBindingOrExpression(facesContext, state, this, Attributes.STATE);
- }
- return state;
- } else {
- sheetState = new SheetState();
- return sheetState;
- }
- }
- }
-
- public abstract String getColumns();
-
- public LayoutTokens getColumnLayout() {
- if (columnLayout == null) {
- String columns = getColumns();
- if (columns != null) {
- columnLayout = LayoutTokens.parse(columns);
- }
- }
- return columnLayout;
- }
-
- public int getLast() {
- int last = getFirst() + getRows();
- return last < getRowCount() ? last : getRowCount();
- }
-
- public int getPage() {
- int first = getFirst() + 1;
- int rows = getRows();
- if (rows == 0) {
- // avoid division by zero
- return 0;
- }
- if ((first % rows) > 0) {
- return (first / rows) + 1;
- } else {
- return (first / rows);
- }
- }
-
- public int getPages() {
- int rows = getRows();
- if (rows == 0) {
- return 0;
- }
- return getRowCount() / rows + (getRowCount() % rows == 0 ? 0 : 1);
- }
-
- public List<UIComponent> getRenderedChildrenOf(UIColumn column) {
- List<UIComponent> children = new ArrayList<UIComponent>();
- for (Object o : column.getChildren()) {
- UIComponent kid = (UIComponent) o;
- if (kid.isRendered()) {
- children.add(kid);
- }
- }
- return children;
- }
-
- public boolean isAtBeginning() {
- return getFirst() == 0;
- }
-
- public boolean hasRowCount() {
- return getRowCount() != -1;
- }
-
- public boolean isAtEnd() {
- if (!hasRowCount()) {
- setRowIndex(getFirst() + getRows() + 1);
- return !isRowAvailable();
- } else {
- return getFirst() >= getLastPageIndex();
- }
- }
-
- public int getLastPageIndex() {
- int rows = getRows();
- if (rows == 0) {
- // avoid division by zero
- return 0;
- }
- int rowCount = getRowCount();
- int tail = rowCount % rows;
- return rowCount - (tail != 0 ? tail : rows);
- }
-
- public void processUpdates(FacesContext context) {
- super.processUpdates(context);
- updateSheetState(context);
- }
-
- private void updateSheetState(FacesContext facesContext) {
- SheetState state = getSheetState(facesContext);
- if (state != null) {
- // ensure sortActionListener
-// getSortActionListener();
-// state.setSortedColumn(sortActionListener != null ? sortActionListener.getColumn() : -1);
-// state.setAscending(sortActionListener != null && sortActionListener.isAscending());
- Map attributes = getAttributes();
- //noinspection unchecked
- state.setSelectedRows((List<Integer>) attributes.get(Attributes.SELECTED_LIST_STRING));
- state.setColumnWidths((String) attributes.get(Attributes.WIDTH_LIST_STRING));
- state.setScrollPosition((Integer[]) attributes.get(Attributes.SCROLL_POSITION));
- attributes.remove(Attributes.SELECTED_LIST_STRING);
- attributes.remove(Attributes.SCROLL_POSITION);
- }
- }
-
-
- public Object saveState(FacesContext context) {
- Object[] saveState = new Object[2];
- saveState[0] = super.saveState(context);
- saveState[1] = sheetState;
- return saveState;
- }
-
- public void restoreState(FacesContext context, Object savedState) {
- Object[] values = (Object[]) savedState;
- super.restoreState(context, values[0]);
- sheetState = (SheetState) values[1];
- }
-
- public List<UIColumn> getAllColumns() {
- List<UIColumn> columns = new ArrayList<UIColumn>();
- for (UIComponent kid : (List<UIComponent>) getChildren()) {
- if (kid instanceof UIColumn && !(kid instanceof ColumnEvent)) {
- columns.add((UIColumn) kid);
- }
- }
- return columns;
- }
-
- public List<UIColumn> getRenderedColumns() {
- List<UIColumn> columns = new ArrayList<UIColumn>();
- for (UIComponent kid : (List<UIComponent>) getChildren()) {
- if (kid instanceof UIColumn && kid.isRendered() && !(kid instanceof ColumnEvent)) {
- columns.add((UIColumn) kid);
- }
- }
- return columns;
- }
-
-/* public MethodBinding getSortActionListener() {
- if (sortActionListener != null) {
- return sortActionListener;
- } else {
- return new Sorter();
- }
- }*/
-
- public void queueEvent(FacesEvent facesEvent) {
- UIComponent parent = getParent();
- if (parent == null) {
- throw new IllegalStateException(
- "component is not a descendant of a UIViewRoot");
- }
-
- if (facesEvent.getComponent() == this
- && (facesEvent instanceof SheetStateChangeEvent
- || facesEvent instanceof PageActionEvent)) {
- facesEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- if (LOG.isInfoEnabled()) {
- LOG.info("queueEvent = \"" + facesEvent + "\"");
- }
- parent.queueEvent(facesEvent);
- } else {
- UIComponent source = facesEvent.getComponent();
- UIComponent sourceParent = source.getParent();
- if (sourceParent.getParent() == this
- && source.getId() != null && source.getId().endsWith(SORTER_ID)) {
- facesEvent.setPhaseId(PhaseId.INVOKE_APPLICATION);
- parent.queueEvent(new SortActionEvent(this, (UIColumn) sourceParent));
- } else {
- super.queueEvent(facesEvent);
- }
- }
- }
-
- public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
- super.broadcast(facesEvent);
- if (facesEvent instanceof SheetStateChangeEvent) {
- invokeMethodBinding(getStateChangeListener(), facesEvent);
- } else if (facesEvent instanceof PageActionEvent) {
- if (facesEvent.getComponent() == this) {
- performPaging((PageActionEvent) facesEvent);
- invokeMethodBinding(getStateChangeListener(), new SheetStateChangeEvent(this));
- }
- } else if (facesEvent instanceof SortActionEvent) {
- getSheetState(getFacesContext()).updateSortState((SortActionEvent) facesEvent);
- MethodBinding methodBinding = getSortActionListener();
- if (methodBinding!= null) {
- invokeMethodBinding(methodBinding, facesEvent);
- } else {
- new Sorter().perform((SortActionEvent) facesEvent);
- }
- }
- }
-
- private void invokeMethodBinding(MethodBinding methodBinding, FacesEvent event) {
- if (methodBinding != null && event != null) {
- try {
- Object[] objects = new Object[]{event};
- methodBinding.invoke(getFacesContext(), objects);
- } catch (EvaluationException e) {
- Throwable cause = e.getCause();
- if (cause instanceof AbortProcessingException) {
- throw (AbortProcessingException) cause;
- } else {
- throw e;
- }
- }
- }
- }
-
- public void addStateChangeListener(SheetStateChangeListener listener) {
- addFacesListener(listener);
- }
-
- public SheetStateChangeListener[] getStateChangeListeners() {
- return (SheetStateChangeListener[]) getFacesListeners(SheetStateChangeListener.class);
- }
-
- public void removeStateChangeListener(SheetStateChangeListener listener) {
- removeFacesListener(listener);
- }
-
- public List<Integer> getWidthList() {
- return widthList;
- }
-
- public void setWidthList(List<Integer> widthList) {
- this.widthList = widthList;
- }
-
- public void processDecodes(FacesContext context) {
- if (context instanceof TobagoFacesContext && ((TobagoFacesContext) context).isAjax()) {
- final String ajaxId = ((TobagoFacesContext) context).getAjaxComponentId();
- UIComponent reload = getFacet(Facets.RELOAD);
- if (ajaxId != null && ajaxId.equals(getClientId(context)) && reload != null && reload.isRendered()
- && ajaxId.equals(ComponentUtil.findPage(context, this).getActionId())) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- if (context.getExternalContext().getResponse() instanceof HttpServletResponse) {
- ((HttpServletResponse) context.getExternalContext().getResponse())
- .setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- }
- context.responseComplete();
- return;
- }
- }
- }
- }
- super.processDecodes(context);
- }
-
- public void encodeAjax(FacesContext facesContext) throws IOException {
- Renderer renderer = getRenderer(facesContext);
- if (renderer != null && renderer instanceof LayoutableRenderer) {
- ((LayoutableRenderer) renderer).layoutEnd(facesContext, this);
- }
-
- // TODO neets more testing!!!
- //if (!facesContext.getRenderResponse() && !ComponentUtil.hasErrorMessages(facesContext)) {
- // in encodeBegin of superclass is some logic which clears the DataModel
- // this must here also done.
- // in RI and myfaces this could done via setValue(null)
-
- if (FacesUtils.hasValueBindingOrValueExpression(this, "value")) {
- setValue(null);
- } else {
- setValue(getValue());
- }
- //}
- UIComponent reload = getFacet(Facets.RELOAD);
- if (reload != null && reload.isRendered()) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && !immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- return;
- }
- }
- }
- AjaxUtils.encodeAjaxComponent(facesContext, this);
- }
-
- public Integer[] getScrollPosition() {
- Integer[] scrollPosition = (Integer[]) getAttributes().get(Attributes.SCROLL_POSITION);
- if (scrollPosition == null) {
- scrollPosition = getSheetState(FacesContext.getCurrentInstance()).getScrollPosition();
- }
- return scrollPosition;
- }
-
-
- public UIComponent findComponent(String searchId) {
- if (searchId.matches(ROW_IDX_REGEX)) {
- searchId = searchId.substring(searchId.indexOf(SEPARATOR_CHAR) + 1);
- }
- return super.findComponent(searchId);
- }
-
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- // we may need setRowIndex on UIData
- int oldRowIndex = getRowIndex();
- try {
- String sheetId = getClientId(context);
- String idRemainder = clientId.substring(sheetId.length());
- if (LOG.isInfoEnabled()) {
- LOG.info("idRemainder = \"" + idRemainder + "\"");
- }
- if (idRemainder.matches("^:\\d+:.*")) {
- idRemainder = idRemainder.substring(1);
- int idx = idRemainder.indexOf(":");
- try {
- int rowIndex = Integer.parseInt(idRemainder.substring(0, idx));
- if (LOG.isInfoEnabled()) {
- LOG.info("set rowIndex = \"" + rowIndex + "\"");
- }
- setRowIndex(rowIndex);
-
- } catch (NumberFormatException e) {
- if (LOG.isInfoEnabled()) {
- LOG.error("idRemainder = \"" + idRemainder + "\"", e);
- }
- }
- } else {
- if (LOG.isInfoEnabled()) {
- LOG.info("no match for \"^:\\d+:.*\"");
- }
- }
-
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
-
- } finally {
- // we should reset rowIndex on UIData
- setRowIndex(oldRowIndex);
- }
- }
-
- public void performPaging(PageActionEvent pageEvent) {
-
- int first = -1;
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("action = '" + pageEvent.getAction().name() + "'");
- }
-
- int start;
- switch (pageEvent.getAction()) {
- case FIRST:
- first = 0;
- break;
- case PREV:
- start = getFirst() - getRows();
- first = start < 0 ? 0 : start;
- break;
- case NEXT:
- if (hasRowCount()) {
- start = getFirst() + getRows();
- first = start > getRowCount() ? getLastPageIndex() : start;
- } else {
- if (isAtEnd()) {
- first = getFirst();
- } else {
- first = getFirst() + getRows();
- }
- }
- break;
- case LAST:
- first = getLastPageIndex();
- break;
- case TO_ROW:
- start = pageEvent.getValue() - 1;
- if (start > getLastPageIndex()) {
- start = getLastPageIndex();
- } else if (start < 0) {
- start = 0;
- }
- first = start;
- break;
- case TO_PAGE:
- start = pageEvent.getValue() - 1;
- if (LOG.isDebugEnabled()) {
- LOG.debug("start = " + start + " sheet.getRows() = "
- + getRows() + " => start = " + (start * getRows()));
- }
- start = start * getRows();
- if (start > getLastPageIndex()) {
- start = getLastPageIndex();
- } else if (start < 0) {
- start = 0;
- }
- first = start;
- break;
- default:
- // can't happen
- }
-
- if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.FIRST)) {
- FacesUtils.setValueOfBindingOrExpression(FacesContext.getCurrentInstance(), first, this, Attributes.FIRST);
- } else {
- setFirst(first);
- }
- getState().setFirst(first);
-// sheet.queueEvent(new SheetStateChangeEvent(sheet));
- }
+public abstract class AbstractUIColumn extends UIColumn {
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUICommand.java Fri Jun 26 12:13:41 2009
@@ -89,4 +89,10 @@
throws FacesException {
return FacesUtils.invokeOnComponent(context, this, clientId, callback);
}
+
+ public abstract Boolean isJsfResource();
+
+ public abstract String getResource();
+
+ public abstract String getLink();
}
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=788668&r1=788667&r2=788668&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 Fri Jun 26 12:13:41 2009
@@ -20,11 +20,23 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.OnComponentCreated;
+import org.apache.myfaces.tobago.layout.Component;
+import org.apache.myfaces.tobago.layout.Container;
+import org.apache.myfaces.tobago.layout.Display;
+import org.apache.myfaces.tobago.layout.FixedLayoutToken;
+import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.LayoutManager;
+import org.apache.myfaces.tobago.layout.LayoutToken;
import org.apache.myfaces.tobago.layout.LayoutTokens;
-import org.apache.myfaces.tobago.layout.grid.GridLayoutManager;
+import org.apache.myfaces.tobago.layout.PixelLayoutToken;
+import org.apache.myfaces.tobago.layout.PixelMeasure;
+import org.apache.myfaces.tobago.layout.RelativeLayoutToken;
+import org.apache.myfaces.tobago.layout.grid.Cell;
+import org.apache.myfaces.tobago.layout.grid.Grid;
+import org.apache.myfaces.tobago.layout.grid.RealCell;
+import org.apache.myfaces.tobago.layout.math.EquationManager;
import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
+import org.apache.myfaces.tobago.util.LayoutUtils;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -33,13 +45,224 @@
import java.util.ArrayList;
import java.util.List;
-//public abstract class AbstractUIGridLayout extends UILayout {
-// LAYOUT Begin
-public abstract class AbstractUIGridLayout extends UILayout implements OnComponentCreated {
-// LAYOUT End
+public abstract class AbstractUIGridLayout extends UILayout implements OnComponentCreated, LayoutManager {
private static final Log LOG = LogFactory.getLog(AbstractUIGridLayout.class);
+
+// LAYOUT Begin
+ // XXX new layout manager begin
+
+ private Grid grid;
+
+ // XXX columns and columnTokens are double/redundant
+ private LayoutTokens columnTokens;
+
+ // XXX rows and rowTokens are double/redundant
+ private LayoutTokens rowTokens;
+
+ public void onComponentCreated(FacesContext context, UIComponent component) {
+
+ columnTokens = LayoutTokens.parse(getColumns());
+ rowTokens = LayoutTokens.parse(getRows());
+
+ grid = new Grid(columnTokens.getSize(), rowTokens.getSize());
+ }
+
+ public void collect(LayoutContext layoutContext, Container container, int horizontalIndex, int verticalIndex) {
+
+ // horizontal
+ EquationManager horizontal = layoutContext.getHorizontal();
+ int[] horizontalIndices = horizontal.divide(horizontalIndex, columnTokens.getSize());
+
+ // vertical
+ EquationManager vertical = layoutContext.getVertical();
+ int[] verticalIndices = vertical.divide(verticalIndex, rowTokens.getSize());
+
+ List<Component> components = container.getComponents();
+ for (Component component1 : components) {
+ grid.add(new RealCell(component1), component1.getColumnSpan(), component1.getRowSpan());
+ LOG.debug("\n" + grid);
+ }
+
+ addFixedConstraints(layoutContext, horizontalIndex + 1, verticalIndex + 1);
+ addRelativeConstraints(layoutContext, horizontalIndex + 1, verticalIndex + 1);
+
+ for (int j = 0; j < grid.getRowCount(); j++) {
+ for (int i = 0; i < grid.getColumnCount(); i++) {
+ org.apache.myfaces.tobago.layout.grid.Cell temp = grid.get(i, j);
+ if (temp instanceof RealCell) {
+ RealCell cell = (RealCell) temp;
+ Component component = temp.getComponent();
+
+ // horizontal
+ int hIndex = horizontal.addComponent(horizontalIndices[i], cell.getColumnSpan());
+ cell.getComponent().setHorizontalIndex(hIndex);
+
+ // vertical
+ int vIndex = vertical.addComponent(verticalIndices[j], cell.getRowSpan());
+ cell.getComponent().setVerticalIndex(vIndex);
+
+ if (component instanceof Container) {
+ Container subContainer = (Container) component;
+ LayoutManager layoutManager = subContainer.getLayoutManager();
+ layoutManager.collect(layoutContext, subContainer, hIndex, vIndex);
+ }
+ }
+ }
+ }
+ }
+
+ public void distribute(LayoutContext layoutContext, Container container) {
+
+ distributeSizes(layoutContext);
+ distributePositions();
+ }
+
+ private void distributeSizes(LayoutContext layoutContext) {
+
+ for (int j = 0; j < grid.getRowCount(); j++) {
+ for (int i = 0; i < grid.getColumnCount(); i++) {
+ Cell temp = grid.get(i, j);
+ if (temp instanceof RealCell) {
+ RealCell cell = (RealCell) temp;
+ Component component = temp.getComponent();
+
+ component.setDisplay(Display.BLOCK);
+
+ EquationManager horizontal = layoutContext.getHorizontal();
+ EquationManager vertical = layoutContext.getVertical();
+
+ int horizontalIndex = cell.getComponent().getHorizontalIndex();
+ int verticalIndex = cell.getComponent().getVerticalIndex();
+
+ PixelMeasure width = new PixelMeasure(horizontal.getResult()[horizontalIndex]);
+ PixelMeasure height = new PixelMeasure(vertical.getResult()[verticalIndex]);
+
+ component.setWidth(width);
+ component.setHeight(height);
+
+ if (component instanceof Container) {
+
+ Container subContainer = (Container) component;
+ LayoutManager layoutManager = subContainer.getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.distribute(layoutContext, subContainer);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void distributePositions() {
+
+ // find the "left" positions
+ for (int j = 0; j < grid.getRowCount(); j++) {
+ PixelMeasure left = new PixelMeasure(0);
+ for (int i = 0; i < grid.getColumnCount(); i++) {
+ Cell cell = grid.get(i, j);
+ if (cell == null) {
+ continue; // XXX why this can happen?
+ }
+ Component component = cell.getComponent();
+ if (cell instanceof RealCell) {
+ component.setLeft(left);
+ }
+ if (cell.isInFirstColumn()) {
+ left = (PixelMeasure) left.add(component.getWidth());
+ }
+ }
+ }
+
+ // find the "top" positions
+ for (int i = 0; i < grid.getColumnCount(); i++) {
+ PixelMeasure top = new PixelMeasure(0);
+ for (int j = 0; j < grid.getRowCount(); j++) {
+ Cell cell = grid.get(i, j);
+ if (cell == null) {
+ continue; // XXX why this can happen?
+ }
+ Component component = cell.getComponent();
+ if (cell instanceof RealCell) {
+ component.setTop(top);
+ }
+ if (cell.isInFirstRow()) {
+ top = (PixelMeasure) top.add(component.getHeight());
+ }
+ }
+ }
+ }
+
+ private void addFixedConstraints(LayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
+ // horizontal
+ for (int i = 0; i < columnTokens.getSize(); i++) {
+ LayoutToken layoutToken = columnTokens.get(i);
+ if (layoutToken instanceof PixelLayoutToken) {
+ int pixel = ((PixelLayoutToken) layoutToken).getPixel();
+ layoutContext.getHorizontal().setFixedLength(i + horizontalIndexOffset, pixel);
+ }
+ if (layoutToken instanceof FixedLayoutToken) {
+ int pixel = 100;
+ LOG.warn("auto/fixed is not implemented yet and was set to 100px");
+ layoutContext.getHorizontal().setFixedLength(i + horizontalIndexOffset, pixel);
+ }
+ }
+ // vertical
+ for (int i = 0; i < rowTokens.getSize(); i++) {
+ LayoutToken layoutToken = rowTokens.get(i);
+ if (layoutToken instanceof PixelLayoutToken) {
+ int pixel = ((PixelLayoutToken) layoutToken).getPixel();
+ layoutContext.getVertical().setFixedLength(i + verticalIndexOffset, pixel);
+ }
+ if (layoutToken instanceof FixedLayoutToken) {
+ int pixel = 25;
+ LOG.warn("auto/fixed is not implemented yet and was set to 25px");
+ layoutContext.getVertical().setFixedLength(i + verticalIndexOffset, pixel);
+ }
+ }
+ }
+
+ private void addRelativeConstraints(LayoutContext layoutContext, int horizontalIndexOffset, int verticalIndexOffset) {
+ // horizontal
+ Integer first = null;
+ Integer firstIndex = null;
+ for (int i = 0; i < columnTokens.getTokens().size(); i++) {
+ LayoutToken token = columnTokens.getTokens().get(i);
+ if (token instanceof RelativeLayoutToken) {
+ int factor = ((RelativeLayoutToken) token).getFactor();
+ if (first == null) {
+ first = factor;
+ firstIndex = i + horizontalIndexOffset;
+ } else {
+ layoutContext.getHorizontal().setProportion(firstIndex, i + horizontalIndexOffset, first, factor);
+ }
+ }
+ }
+ // vertical
+ first = null;
+ firstIndex = null;
+ for (int i = 0; i < rowTokens.getTokens().size(); i++) {
+ LayoutToken token = rowTokens.getTokens().get(i);
+ if (token instanceof RelativeLayoutToken) {
+ int factor = ((RelativeLayoutToken) token).getFactor();
+ if (first == null) {
+ first = factor;
+ firstIndex = i + verticalIndexOffset;
+ } else {
+ layoutContext.getVertical().setProportion(firstIndex, i + verticalIndexOffset, first, factor);
+ }
+ }
+ }
+ }
+
+ protected Grid getGrid() {
+ return grid;
+ }
+
+ // XXX new layout manager end
+// LAYOUT End
+
public static final Marker FREE = new Marker("free");
public static final String USED = "used";
@@ -50,16 +273,13 @@
private List<Row> layoutRows;
// LAYOUT Begin
- private GridLayoutManager manager;
- public void onComponentCreated(FacesContext context, UIComponent component) {
- manager = new GridLayoutManager(getColumns(), getRows());
+ public AbstractUIGridLayout() {
+ LOG.info("**************************************************************************************"
+ + " Constructor AbstractUIGridLayout");
}
- public LayoutManager getLayoutManager() {
- return manager;
- }
-// LAYOUT End
+ // LAYOUT End
public LayoutTokens getRowLayout() {
if (rowLayout == null) {
@@ -92,11 +312,11 @@
return false;
}
- @Override
- public void encodeChildren(FacesContext context)
- throws IOException {
+// @Override
+// public void encodeChildren(FacesContext context)
+// throws IOException {
// do nothing here
- }
+// }
@Override
public void encodeChildrenOfComponent(
@@ -113,6 +333,7 @@
return getColumnLayout().getSize();
}
+ @Deprecated
public List<Row> ensureRows() {
if (layoutRows == null) {
layoutRows = createRows();
@@ -120,11 +341,14 @@
return layoutRows;
}
+ @Deprecated
private List<Row> createRows() {
+ // XXX
+ LOG.warn("This code is deprecated and should be removed!");
List<Row> rows = new ArrayList<Row>();
int columnCount = getColumnCount();
List<UIComponent> children
- = LayoutUtil.addChildren(new ArrayList<UIComponent>(), getParent());
+ = LayoutUtils.addChildren(new ArrayList<UIComponent>(), getParent());
for (UIComponent component : children) {
int spanX = getSpanX(component);
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUILabel.java Fri Jun 26 12:13:41 2009
@@ -19,12 +19,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.layout.Component;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import java.io.IOException;
-public class AbstractUILabel extends javax.faces.component.UIOutput {
+public abstract class AbstractUILabel extends javax.faces.component.UIOutput implements Component {
private static final Log LOG = LogFactory.getLog(AbstractUILabel.class);
Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIOut.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIOut.java?rev=788668&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIOut.java (added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIOut.java Fri Jun 26 12:13:41 2009
@@ -0,0 +1,25 @@
+package org.apache.myfaces.tobago.component;
+
+/*
+ * 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.
+ */
+
+import org.apache.myfaces.tobago.layout.Component;
+
+import javax.faces.component.UIOutput;
+
+public abstract class AbstractUIOut extends UIOutput implements Component {
+}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPage.java Fri Jun 26 12:13:41 2009
@@ -20,14 +20,15 @@
import org.apache.commons.collections.KeyValue;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.OnComponentCreated;
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.compat.InvokeOnComponent;
import org.apache.myfaces.tobago.layout.Box;
import org.apache.myfaces.tobago.layout.Component;
-import org.apache.myfaces.tobago.layout.Constraints;
import org.apache.myfaces.tobago.layout.Container;
import org.apache.myfaces.tobago.layout.LayoutManager;
+import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.model.PageState;
import org.apache.myfaces.tobago.model.PageStateImpl;
import org.apache.myfaces.tobago.util.ComponentUtil;
@@ -70,18 +71,59 @@
private List<KeyValue> postfields;
@Override
- public void encodeChildren(FacesContext context) throws IOException {
+ public boolean getRendersChildren() {
+ return true;
}
public String getFormId(FacesContext facesContext) {
if (formId == null) {
- formId = getClientId(facesContext)
- + SUBCOMPONENT_SEP + "form";
+ formId = getClientId(facesContext) + SUBCOMPONENT_SEP + "form";
}
return formId;
}
@Override
+ public void encodeBegin(FacesContext facesContext) throws IOException {
+
+ super.encodeBegin(facesContext);
+
+ UILayout layoutManager = (UILayout) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.encodeBegin(facesContext);
+ } else {
+ // todo: later: LOG.debug or remove
+ LOG.warn("no layout manager found");
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext) throws IOException {
+
+ UILayout layoutManager = (UILayout) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.encodeChildren(facesContext);
+ } else {
+ // todo: later: LOG.debug or remove
+ LOG.warn("no layout manager found");
+ super.encodeChildren(facesContext);
+ }
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext) throws IOException {
+
+ UILayout layoutManager = (UILayout) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.encodeEnd(facesContext);
+ } else {
+ // todo: later: LOG.debug or remove
+ LOG.warn("no layout manager found");
+ }
+
+ super.encodeEnd(facesContext);
+ }
+
+ @Override
public void processDecodes(FacesContext facesContext) {
checkTobagoRequest(facesContext);
@@ -301,16 +343,21 @@
}
public LayoutManager getLayoutManager() {
- AbstractUIGridLayout uiGridLayout = (AbstractUIGridLayout) getFacet(Facets.LAYOUT);
- return uiGridLayout != null ? uiGridLayout.getLayoutManager() : null;
+ LayoutManager layoutManager = (LayoutManager) getFacet(Facets.LAYOUT);
+ // todo: What is using as default, if nothing is defined?
+ if (layoutManager == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ layoutManager = (LayoutManager) CreateComponentUtils.createComponent(
+ facesContext, "org.apache.myfaces.tobago.GridLayout", RendererTypes.GRID_LAYOUT);
+ ((OnComponentCreated) layoutManager).onComponentCreated(facesContext, (UILayout) layoutManager);
+ getFacets().put(Facets.LAYOUT, (UILayout) layoutManager);
+ }
+ return layoutManager;
}
- public Constraints getConstraints() {
- return (AbstractUIGridConstraints) getFacet(Facets.CONSTRAINTS);
- }
// LAYOUT End
- public abstract Integer getWidth();
+ public abstract Measure getWidth();
- public abstract Integer getHeight();
+ public abstract Measure getHeight();
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java (from r786116, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java&r1=786116&r2=788668&rev=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPanelBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIPanel.java Fri Jun 26 12:13:41 2009
@@ -17,74 +17,85 @@
* limitations under the License.
*/
-import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
-import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
-import org.apache.myfaces.tobago.compat.FacesUtils;
-import org.apache.myfaces.tobago.compat.InvokeOnComponent;
-import org.apache.myfaces.tobago.context.TobagoFacesContext;
-import org.apache.myfaces.tobago.util.ComponentUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.OnComponentCreated;
+import org.apache.myfaces.tobago.layout.Component;
+import org.apache.myfaces.tobago.layout.Container;
+import org.apache.myfaces.tobago.layout.LayoutManager;
-import javax.faces.FacesException;
-import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
-/*
- * User: weber
- * Date: Feb 28, 2005
- * Time: 3:05:19 PM
- */
-public class UIPanelBase extends javax.faces.component.UIPanel
- implements AjaxComponent, InvokeOnComponent {
+public abstract class AbstractUIPanel extends UIPanelBase implements Container {
+
+ private static final Log LOG = LogFactory.getLog(AbstractUIPanel.class);
+
+ @Override
+ public void encodeBegin(FacesContext facesContext) throws IOException {
+
+ super.encodeBegin(facesContext);
+
+ UILayout layoutManager = (UILayout) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.encodeBegin(facesContext);
+ } else {
+ // todo: later: LOG.debug or remove
+ LOG.warn("no layout manager found");
+ }
+ }
+ @Override
public void encodeChildren(FacesContext facesContext) throws IOException {
- if (isRendered()) {
- UILayout.getLayout(this).encodeChildrenOfComponent(facesContext, this);
+
+ UILayout layoutManager = (UILayout) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.encodeChildren(facesContext);
+ } else {
+ // todo: later: LOG.debug or remove
+ LOG.warn("no layout manager found");
+ super.encodeChildren(facesContext);
}
}
- public void processDecodes(FacesContext context) {
- if (context instanceof TobagoFacesContext && ((TobagoFacesContext) context).isAjax()) {
+ @Override
+ public void encodeEnd(FacesContext facesContext) throws IOException {
- final String ajaxId = ((TobagoFacesContext) context).getAjaxComponentId();
- UIComponent reload = getFacet(Facets.RELOAD);
- if (ajaxId != null && ajaxId.equals(getClientId(context)) && reload != null && reload.isRendered()
- && ajaxId.equals(ComponentUtil.findPage(context, this).getActionId())) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- if (context.getExternalContext().getResponse() instanceof HttpServletResponse) {
- ((HttpServletResponse) context.getExternalContext().getResponse())
- .setStatus(HttpServletResponse.SC_NOT_MODIFIED);
- }
- context.responseComplete();
- return;
- }
- }
- }
+ UILayout layoutManager = (UILayout) getLayoutManager();
+ if (layoutManager != null) {
+ layoutManager.encodeEnd(facesContext);
+ } else {
+ // todo: later: LOG.debug or remove
+ LOG.warn("no layout manager found");
}
- super.processDecodes(context);
+
+ super.encodeEnd(facesContext);
}
- public void encodeAjax(FacesContext facesContext) throws IOException {
- UIComponent reload = getFacet(Facets.RELOAD);
- if (reload != null && reload.isRendered()) {
- Boolean immediate = (Boolean) reload.getAttributes().get(Attributes.IMMEDIATE);
- if (immediate != null && !immediate) {
- Boolean update = (Boolean) reload.getAttributes().get(Attributes.UPDATE);
- if (update != null && !update) {
- return;
- }
+ public List<Component> getComponents() {
+ List<Component> result = new ArrayList<Component>();
+ for (UIComponent uiComponent : (List<UIComponent>) getChildren()) {
+ if (uiComponent instanceof Component) {
+ result.add((Component) uiComponent);
}
}
- AjaxUtils.encodeAjaxComponent(facesContext, this);
+ return result;
}
- public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
- throws FacesException {
- return FacesUtils.invokeOnComponent(context, this, clientId, callback);
+ public LayoutManager getLayoutManager() {
+ LayoutManager layoutManager = (LayoutManager) getFacet(Facets.LAYOUT);
+ // todo: What is using as default, if nothing is defined?
+ if (layoutManager == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ layoutManager = (LayoutManager) CreateComponentUtils.createComponent(
+ facesContext, "org.apache.myfaces.tobago.GridLayout", RendererTypes.GRID_LAYOUT);
+ ((OnComponentCreated) layoutManager).onComponentCreated(facesContext, (UILayout) layoutManager);
+ getFacets().put(Facets.LAYOUT, (UILayout) layoutManager);
+ }
+ return layoutManager;
}
+
}
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=788668&r1=788667&r2=788668&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 Fri Jun 26 12:13:41 2009
@@ -20,6 +20,7 @@
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.ComponentUtil;
import javax.faces.FacesException;
@@ -137,19 +138,19 @@
return FacesUtils.invokeOnComponent(context, this, clientId, callback);
}
- public abstract Integer getWidth();
+ public abstract Measure getWidth();
- public abstract void setWidth(Integer width);
+ public abstract void setWidth(Measure width);
- public abstract Integer getHeight();
+ public abstract Measure getHeight();
- public abstract void setHeight(Integer height);
+ public abstract void setHeight(Measure height);
- public abstract Integer getTop();
+ public abstract Measure getTop();
- public abstract void setTop(Integer top);
+ public abstract void setTop(Measure top);
- public abstract Integer getLeft();
+ public abstract Measure getLeft();
- public abstract void setLeft(Integer left);
+ public abstract void setLeft(Measure left);
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroup.java Fri Jun 26 12:13:41 2009
@@ -19,12 +19,16 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.OnComponentCreated;
import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
import org.apache.myfaces.tobago.compat.FacesUtils;
import org.apache.myfaces.tobago.event.TabChangeEvent;
import org.apache.myfaces.tobago.event.TabChangeListener;
import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.layout.Component;
+import org.apache.myfaces.tobago.layout.Container;
+import org.apache.myfaces.tobago.layout.LayoutManager;
import javax.faces.component.ActionSource;
import javax.faces.component.UIComponent;
@@ -41,7 +45,8 @@
import java.util.Collection;
import java.util.List;
-public abstract class AbstractUITabGroup extends UIPanelBase implements TabChangeSource, ActionSource, AjaxComponent {
+public abstract class AbstractUITabGroup extends UIPanelBase
+ implements TabChangeSource, ActionSource, AjaxComponent, Container, OnComponentCreated {
private static final Log LOG = LogFactory.getLog(AbstractUITabGroup.class);
@@ -52,16 +57,35 @@
public static final String SWITCH_TYPE_RELOAD_TAB = "reloadTab";
@Override
- public boolean getRendersChildren() {
- return true;
+ public void encodeBegin(FacesContext facesContext) throws IOException {
+
+ super.encodeBegin(facesContext);
+
+ ((UILayout) getLayoutManager()).encodeBegin(facesContext);
}
@Override
- public void encodeBegin(FacesContext facesContext) throws IOException {
- super.encodeBegin(facesContext);
+ public void encodeChildren(FacesContext facesContext) throws IOException {
+
+ ((UILayout) getLayoutManager()).encodeChildren(facesContext);
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext) throws IOException {
+
+ ((UILayout) getLayoutManager()).encodeEnd(facesContext);
+
+ resetTabLayout();
+ super.encodeEnd(facesContext);
+ setRenderedIndex(getSelectedIndex());
}
+ @Override
+ public boolean getRendersChildren() {
+ return true;
+ }
+
public void queueEvent(FacesEvent event) {
if (this == event.getSource()) {
if (isImmediate()) {
@@ -73,18 +97,6 @@
super.queueEvent(event);
}
- @Override
- public void encodeChildren(FacesContext context)
- throws IOException {
- }
-
- @Override
- public void encodeEnd(FacesContext facesContext) throws IOException {
- resetTabLayout();
- super.encodeEnd(facesContext);
- setRenderedIndex(getSelectedIndex());
- }
-
private void resetTabLayout() {
for (UIComponent component : (List<UIComponent>) getChildren()) {
component.getAttributes().remove(Attributes.LAYOUT_WIDTH);
@@ -299,4 +311,32 @@
public void removeActionListener(ActionListener listener) {
removeFacesListener(listener);
}
+
+ // LAYOUT Begin
+ public List<Component> getComponents() {
+ List<Component> result = new ArrayList<Component>();
+ for (UIComponent uiComponent : (List<UIComponent>) getChildren()) {
+ if (uiComponent instanceof Component) {
+ result.add((Component) uiComponent);
+ }
+ }
+ return result;
+ }
+
+ public LayoutManager getLayoutManager() {
+ return (LayoutManager) getFacet(Facets.LAYOUT);
+ }
+
+ public void onComponentCreated(FacesContext context, UIComponent component) {
+ // if there is no layout manager set, create one
+ if (getLayoutManager() == null) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ LayoutManager layoutManager = (LayoutManager) CreateComponentUtils.createComponent(
+ facesContext, "org.apache.myfaces.tobago.TabGroupLayout", RendererTypes.TAB_GROUP_LAYOUT);
+ ((OnComponentCreated) layoutManager).onComponentCreated(facesContext, (UILayout) layoutManager);
+ getFacets().put(Facets.LAYOUT, (UILayout) layoutManager);
+ }
+ }
+
+// LAYOUT End
}
Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java (from r786116, 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/AbstractUITabGroupLayout.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITabGroupLayout.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUIGridLayout.java&r1=786116&r2=788668&rev=788668&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/AbstractUITabGroupLayout.java Fri Jun 26 12:13:41 2009
@@ -17,265 +17,29 @@
* limitations under the License.
*/
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.myfaces.tobago.OnComponentCreated;
+import org.apache.myfaces.tobago.layout.Container;
+import org.apache.myfaces.tobago.layout.LayoutContext;
import org.apache.myfaces.tobago.layout.LayoutManager;
-import org.apache.myfaces.tobago.layout.LayoutTokens;
-import org.apache.myfaces.tobago.layout.grid.GridLayoutManager;
-import org.apache.myfaces.tobago.util.ComponentUtil;
-import org.apache.myfaces.tobago.util.LayoutUtil;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-//public abstract class AbstractUIGridLayout extends UILayout {
-// LAYOUT Begin
-public abstract class AbstractUIGridLayout extends UILayout implements OnComponentCreated {
-// LAYOUT End
-
- private static final Log LOG = LogFactory.getLog(AbstractUIGridLayout.class);
-
- public static final Marker FREE = new Marker("free");
- public static final String USED = "used";
-
- private boolean ignoreFree;
- private transient LayoutTokens columnLayout;
- private transient LayoutTokens rowLayout;
-
- private List<Row> layoutRows;
-
-// LAYOUT Begin
- private GridLayoutManager manager;
+// XXX is this a good way?
+public abstract class AbstractUITabGroupLayout extends UILayout implements OnComponentCreated, LayoutManager {
public void onComponentCreated(FacesContext context, UIComponent component) {
- manager = new GridLayoutManager(getColumns(), getRows());
- }
-
- public LayoutManager getLayoutManager() {
- return manager;
- }
-// LAYOUT End
-
- public LayoutTokens getRowLayout() {
- if (rowLayout == null) {
- rowLayout = LayoutTokens.parse(getRows());
- }
- return rowLayout;
}
- public LayoutTokens getColumnLayout() {
- if (columnLayout == null) {
- columnLayout = LayoutTokens.parse(getColumns());
- }
- return columnLayout;
+ public void collect(LayoutContext layoutContext, Container container, int horizontalIndex, int verticalIndex) {
}
-
- public abstract String getRows();
-
- public abstract String getColumns();
-
-
- public Object saveState(FacesContext context) {
- clearRows();
- return super.saveState(context);
+ public void distribute(LayoutContext layoutContext, Container container) {
}
-
@Override
public boolean getRendersChildren() {
return false;
}
- @Override
- public void encodeChildren(FacesContext context)
- throws IOException {
- // do nothing here
- }
-
- @Override
- public void encodeChildrenOfComponent(
- FacesContext facesContext, UIComponent component) throws IOException {
- super.encodeChildrenOfComponent(facesContext, component);
- clearRows();
- }
-
- private void clearRows() {
- layoutRows = null;
- }
-
- public int getColumnCount() {
- return getColumnLayout().getSize();
- }
-
- public List<Row> ensureRows() {
- if (layoutRows == null) {
- layoutRows = createRows();
- }
- return layoutRows;
- }
-
- private List<Row> createRows() {
- List<Row> rows = new ArrayList<Row>();
- int columnCount = getColumnCount();
- List<UIComponent> children
- = LayoutUtil.addChildren(new ArrayList<UIComponent>(), getParent());
-
- for (UIComponent component : children) {
- int spanX = getSpanX(component);
- int spanY = getSpanY(component);
-
- int r = nextFreeRow(rows);
- if (r == rows.size()) {
- rows.add(new Row(columnCount));
- }
- int c = rows.get(r).nextFreeColumn();
- rows.get(r).addControl(component, spanX);
- rows.get(r).fill(c + 1, c + spanX, component.isRendered());
-
- for (int i = r + 1; i < r + spanY; i++) {
-
- if (i == rows.size()) {
- rows.add(new Row(columnCount));
- }
- rows.get(i).fill(c, c + spanX, component.isRendered());
- }
- }
- return rows;
- }
-
- private int nextFreeRow(List rows) {
- int i = 0;
- for (; i < rows.size(); i++) {
- if (((Row) rows.get(i)).nextFreeColumn() != -1) {
- return i;
- }
- }
- return i;
- }
-
- public static int getSpanX(UIComponent component) {
- return ComponentUtil.getIntAttribute(
- component, Attributes.SPAN_X, 1);
- }
-
- public static int getSpanY(UIComponent component) {
- return ComponentUtil.getIntAttribute(
- component, Attributes.SPAN_Y, 1);
- }
-
- public boolean isIgnoreFree() {
- return ignoreFree;
- }
-
- public void setIgnoreFree(boolean ignoreFree) {
- this.ignoreFree = ignoreFree;
- }
-
- public static class Row implements Serializable {
- private static final long serialVersionUID = 1511693677519052045L;
- private int columns;
- private List cells;
- private boolean hidden;
-
- public Row(int columns) {
- setColumns(columns);
- }
-
- private void addControl(UIComponent component, int spanX) {
-
- int i = nextFreeColumn();
-
- cells.set(i, component);
- fill(i + 1, i + spanX, component.isRendered());
- }
-
- private void fill(int start, int end, boolean rendered) {
-
- if (end > columns) {
- LOG.error("Error in Jsp (end > columns). "
- + "Try to insert more spanX as possible.");
- LOG.error("start: " + start);
- LOG.error("end: " + end);
- LOG.error("columns: " + columns);
- LOG.error("Actual cells:");
- for (Object component : cells) {
- if (component instanceof UIComponent) {
- LOG.error("Cell-ID: " + ((UIComponent) component).getId()
- + " " + ((UIComponent) component).getRendererType());
- } else {
- LOG.error("Cell: " + component); // e.g. marker
- }
- }
-
- end = columns; // fix the "end" parameter to continue the processing.
- }
-
- for (int i = start; i < end; i++) {
- cells.set(i, new Marker(USED, rendered));
- }
- }
-
- private int nextFreeColumn() {
- for (int i = 0; i < columns; i++) {
- if (FREE.equals(cells.get(i))) {
- return i;
- }
- }
- return -1;
- }
-
- public List getElements() {
- return cells;
- }
-
- public int getColumns() {
- return columns;
- }
-
- private void setColumns(int columns) {
- this.columns = columns;
- cells = new ArrayList(columns);
- for (int i = 0; i < columns; i++) {
- cells.add(FREE);
- }
- }
-
- public boolean isHidden() {
- return hidden;
- }
-
- public void setHidden(boolean hidden) {
- this.hidden = hidden;
- }
- }
-
- public static class Marker implements Serializable {
- private static final long serialVersionUID = 2505999420762504893L;
- private final String name;
- private boolean rendered;
-
- private Marker(String name) {
- this.name = name;
- }
-
- public Marker(String name, boolean rendered) {
- this.name = name;
- this.rendered = rendered;
- }
-
- @Override
- public String toString() {
- return name;
- }
-
- public boolean isRendered() {
- return rendered;
- }
- }
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITree.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITree.java?rev=788668&r1=788667&r2=788668&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITree.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/AbstractUITree.java Fri Jun 26 12:13:41 2009
@@ -17,6 +17,7 @@
* limitations under the License.
*/
+import org.apache.myfaces.tobago.layout.Component;
import org.apache.myfaces.tobago.model.MixedTreeModel;
import org.apache.myfaces.tobago.util.ComponentUtil;
@@ -31,7 +32,7 @@
import java.util.Iterator;
import java.util.List;
-public abstract class AbstractUITree extends UIInput implements NamingContainer {
+public abstract class AbstractUITree extends UIInput implements NamingContainer, Component {
public static final String MESSAGE_NOT_LEAF = "tobago.tree.MESSAGE_NOT_LEAF";