myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r634028 - in /myfaces/tobago/trunk/core/src: main/java/org/apache/myfaces/tobago/layout/ main/java/org/apache/myfaces/tobago/layout/grid/ test/java/org/apache/myfaces/tobago/layout/ test/java/org/apache/myfaces/tobago/layout/grid/
Date Wed, 05 Mar 2008 20:59:22 GMT
Author: lofwyr
Date: Wed Mar  5 12:59:18 2008
New Revision: 634028

URL: http://svn.apache.org/viewvc?rev=634028&view=rev
Log:
TOBAGO-606: Working layout management

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentConstraints.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ContainerConstraints.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponentImpl.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainerImpl.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/
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Cell.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/ComponentCell.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentCell.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Grid.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridArray.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridArray.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridComponentConstraints.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridContainerConstraints.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManager.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridLayoutManager.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/SpanCell.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/SpanCell.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridArrayUnitTest.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java
      - copied, changed from r627553, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridUnitTest.java
Removed:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Cell.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentCell.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Grid.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridArray.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridLayoutManager.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/SpanCell.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridUnitTest.java
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentConstraints.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentConstraints.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentConstraints.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentConstraints.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,25 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 13.02.2008 20:47:02
+ */
+public interface ComponentConstraints {
+}

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ContainerConstraints.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ContainerConstraints.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ContainerConstraints.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ContainerConstraints.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,26 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 14.02.2008 11:47:07
+ */
+public interface ContainerConstraints {
+
+}

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java?rev=634028&r1=634027&r2=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponent.java
Wed Mar  5 12:59:18 2008
@@ -23,13 +23,8 @@
  */
 public interface LayoutComponent {
 
-  Dimension getMinimumSize();
+  ComponentConstraints getComponentConstraints(String name);
 
-  Dimension getPreferedSize();
+  void setComponentConstraints(String name, ComponentConstraints constraints);
 
-  Dimension getMaximumSize();
-
-  int getColumnSpan();
-
-  int getRowSpan();
 }

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponentImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponentImpl.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponentImpl.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutComponentImpl.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,26 @@
+package org.apache.myfaces.tobago.layout;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * User: lofwyr
+ * Date: 14.02.2008 12:08:52
+ */
+public class LayoutComponentImpl implements LayoutComponent {
+
+  private Map<String, ComponentConstraints> componentConstraints;
+
+  public LayoutComponentImpl() {
+    componentConstraints = new HashMap<String, ComponentConstraints>();
+
+  }
+
+  public ComponentConstraints getComponentConstraints(String name) {
+    return componentConstraints.get(name);
+  }
+
+  public void setComponentConstraints(String name, ComponentConstraints constraints) {
+    componentConstraints.put(name, constraints);
+  }
+}

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java?rev=634028&r1=634027&r2=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainer.java
Wed Mar  5 12:59:18 2008
@@ -25,8 +25,9 @@
  */
 public interface LayoutContainer extends LayoutComponent {
 
-  Dimension getBeginInset();
-  Dimension getEndInset();
+  ContainerConstraints getContainerConstraints(String name);
+
+  void setContainerConstraints(String name, ContainerConstraints component);
 
   List<LayoutComponent> getComponents();
 }

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainerImpl.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainerImpl.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/LayoutContainerImpl.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,34 @@
+package org.apache.myfaces.tobago.layout;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * User: lofwyr
+ * Date: 14.02.2008 12:03:31
+ */
+public class LayoutContainerImpl extends LayoutComponentImpl implements LayoutContainer {
+
+  private Map<String, ContainerConstraints> containerConstraints;
+
+  private List<LayoutComponent> components;
+
+  public LayoutContainerImpl() {
+    containerConstraints = new HashMap<String, ContainerConstraints>();
+    components = new ArrayList<LayoutComponent>();
+  }
+
+  public ContainerConstraints getContainerConstraints(String name) {
+    return containerConstraints.get(name);
+  }
+
+  public void setContainerConstraints(String name, ContainerConstraints containerConstraints)
{
+    this.containerConstraints.put(name, containerConstraints);
+  }
+
+  public List<LayoutComponent> getComponents() {
+    return components;
+  }
+}

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,39 @@
+package org.apache.myfaces.tobago.layout;
+
+/*
+ * 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 23.01.2008 20:21:08
+ */
+public class PixelMeasure implements Measure {
+
+  private int value;
+
+  public PixelMeasure(int value) {
+    this.value = value;
+  }
+
+  public int getValue() {
+    return value;
+  }
+
+  public void setValue(int value) {
+    this.value = value;
+  }
+}

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java
(from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Cell.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Cell.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Cell.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Cell.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,6 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
+
+import org.apache.myfaces.tobago.layout.LayoutComponent;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/ComponentCell.java
(from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentCell.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/ComponentCell.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/ComponentCell.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentCell.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/ComponentCell.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/ComponentCell.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,6 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
+
+import org.apache.myfaces.tobago.layout.LayoutComponent;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java
(from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Grid.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Grid.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/Grid.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/Grid.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridArray.java
(from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridArray.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridArray.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridArray.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridArray.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridArray.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridArray.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -21,6 +21,10 @@
 import java.util.List;
 
 /**
+ * Helper class to manager the rectangular data of the Grid.
+ *
+ * @see Grid
+ *
  * User: lofwyr
  * Date: 25.01.2008
  */

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridComponentConstraints.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridComponentConstraints.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridComponentConstraints.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridComponentConstraints.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,95 @@
+package org.apache.myfaces.tobago.layout.grid;
+
+import org.apache.myfaces.tobago.layout.ComponentConstraints;
+import org.apache.myfaces.tobago.layout.Dimension;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+
+/*
+ * 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 13.02.2008 20:47:28
+ */
+public class GridComponentConstraints implements ComponentConstraints {
+
+  public static final String NAME = "grid";
+
+  private int columnSpan = 1;
+
+  private int rowSpan = 1;
+
+  private Dimension minimumSize;// TODO = new Dimension();
+
+  private Dimension preferedSize;// TODO = new Dimension();
+
+  private Dimension maximumSize;// TODO = new Dimension();
+
+  /**
+   * Convenience method to get the correct layout constraints from the component.
+   * If the constraints object doesn't exists it will be created a default and set to the
component.
+   */
+  public static GridComponentConstraints getConstraints(LayoutComponent component) {
+    GridComponentConstraints constraints
+        = (GridComponentConstraints) component.getComponentConstraints(NAME);
+    if (constraints == null) {
+      constraints = new GridComponentConstraints();
+      component.setComponentConstraints(NAME, constraints);
+    }
+    return constraints;
+  }
+
+  public int getColumnSpan() {
+    return columnSpan;
+  }
+
+  public void setColumnSpan(int columnSpan) {
+    this.columnSpan = columnSpan;
+  }
+
+  public int getRowSpan() {
+    return rowSpan;
+  }
+
+  public void setRowSpan(int rowSpan) {
+    this.rowSpan = rowSpan;
+  }
+
+  public Dimension getMinimumSize() {
+    return minimumSize;
+  }
+
+  public void setMinimumSize(Dimension minimumSize) {
+    this.minimumSize = minimumSize;
+  }
+
+  public Dimension getPreferedSize() {
+    return preferedSize;
+  }
+
+  public void setPreferedSize(Dimension preferedSize) {
+    this.preferedSize = preferedSize;
+  }
+
+  public Dimension getMaximumSize() {
+    return maximumSize;
+  }
+
+  public void setMaximumSize(Dimension maximumSize) {
+    this.maximumSize = maximumSize;
+  }
+}

Added: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridContainerConstraints.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridContainerConstraints.java?rev=634028&view=auto
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridContainerConstraints.java
(added)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridContainerConstraints.java
Wed Mar  5 12:59:18 2008
@@ -0,0 +1,65 @@
+package org.apache.myfaces.tobago.layout.grid;
+
+import org.apache.myfaces.tobago.layout.ContainerConstraints;
+import org.apache.myfaces.tobago.layout.Dimension;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+
+/*
+ * 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.
+ */
+
+/**
+ * User: lofwyr
+ * Date: 14.02.2008
+ */
+public class GridContainerConstraints implements ContainerConstraints {
+
+  public static final String NAME = "grid";
+
+  private Dimension beginInset;// TODO = new Dimension();
+
+  private Dimension endInset;// TODO = new Dimension();
+
+  /**
+   * Convenience method to get the correct layout constraints from the component.
+   * If the constraints object doesn't exists it will be created a default and set to the
component.
+   */
+  public static GridContainerConstraints getConstraints(LayoutContainer container) {
+    GridContainerConstraints constraints
+        = (GridContainerConstraints) container.getContainerConstraints(NAME);
+    if (constraints == null) {
+      constraints = new GridContainerConstraints();
+      container.setContainerConstraints(NAME, constraints);
+    }
+    return constraints;
+  }
+
+  public Dimension getBeginInset() {
+    return beginInset;
+  }
+
+  public void setBeginInset(Dimension beginInset) {
+    this.beginInset = beginInset;
+  }
+
+  public Dimension getEndInset() {
+    return endInset;
+  }
+
+  public void setEndInset(Dimension endInset) {
+    this.endInset = endInset;
+  }
+}
\ No newline at end of file

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManager.java
(from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridLayoutManager.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManager.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManager.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridLayoutManager.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/GridLayoutManager.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManager.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,7 +17,12 @@
  * limitations under the License.
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.tobago.component.LayoutTokens;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.LayoutManager;
 
 import java.util.List;
 
@@ -27,6 +32,8 @@
  */
 public class GridLayoutManager implements LayoutManager {
 
+  private static final Log LOG = LogFactory.getLog(GridLayoutManager.class);
+
   private Grid grid;
 
   private LayoutTokens rowTokens;
@@ -44,10 +51,45 @@
 
     List<LayoutComponent> components = container.getComponents();
 
+    distributeCells(components);
+
+    distributeFixed(components);
+    distributeAuto(components);
+    distributeAsterisk(components);
+
+  }
+
+  private void distributeCells(List<LayoutComponent> components) {
     for (LayoutComponent component : components) {
-      grid.add(new ComponentCell(component), 1, 1);
+
+      GridComponentConstraints constraints = GridComponentConstraints.getConstraints(component);
+      grid.add(new ComponentCell(component), constraints.getColumnSpan(), constraints.getRowSpan());
+
+      LOG.debug("\n" + grid);
     }
+  }
+
+  private void distributeFixed(List<LayoutComponent> components) {
+/*
+    Measure width = ?;
 
-    
+    for (Object token : columnTokens.) {
+
+      if (token.isFix()) {
+        width.substract(token.getSize());
+      }
+
+    }
+*/
+  }
+
+  private void distributeAuto(List<LayoutComponent> components) {
+    //To change body of created methods use File | Settings | File Templates.
   }
+
+  private void distributeAsterisk(List<LayoutComponent> components) {
+    //To change body of created methods use File | Settings | File Templates.
+  }
+
+
 }

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/SpanCell.java
(from r627553, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/SpanCell.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/SpanCell.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/SpanCell.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/SpanCell.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/SpanCell.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/grid/SpanCell.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,6 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
+
+import org.apache.myfaces.tobago.layout.LayoutComponent;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more

Copied: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridArrayUnitTest.java
(from r627553, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridArrayUnitTest.java?p2=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridArrayUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridArrayUnitTest.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more

Copied: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java
(from r627553, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java?p2=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridArrayUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridLayoutManagerUnitTest.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,21 +18,32 @@
  */
 
 import junit.framework.TestCase;
+import org.apache.myfaces.tobago.layout.LayoutComponent;
+import org.apache.myfaces.tobago.layout.LayoutComponentImpl;
+import org.apache.myfaces.tobago.layout.LayoutContainer;
+import org.apache.myfaces.tobago.layout.LayoutContainerImpl;
 
 /**
  * User: lofwyr
- * Date: 25.01.2008 17:05:52
+ * Date: 13.02.2008
  */
-public class GridArrayUnitTest extends TestCase {
+public class GridLayoutManagerUnitTest extends TestCase {
 
   public void test() {
 
-    GridArray gridArray = new GridArray(1, 1);
-    gridArray.get(0,0);
-    assertEquals (1, gridArray.getRowCount());
-    gridArray.get(0,1);
-    assertEquals (1, gridArray.getRowCount());
-    gridArray.set(0,1, null);
-    assertEquals (2, gridArray.getRowCount());
+    LayoutContainer container = new LayoutContainerImpl();
+    LayoutComponent a = new LayoutComponentImpl();
+    LayoutComponent b = new LayoutComponentImpl();
+    GridComponentConstraints bConstraint = GridComponentConstraints.getConstraints(b);
+    bConstraint.setRowSpan(2);
+    LayoutComponent c = new LayoutComponentImpl();
+
+    container.getComponents().add(a);
+    container.getComponents().add(b);
+    container.getComponents().add(c);
+
+    GridLayoutManager manager = new GridLayoutManager("*;*", "*;*");
+    manager.layout(container);
+
   }
 }

Copied: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java
(from r627553, myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridUnitTest.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java?p2=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java&p1=myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridUnitTest.java&r1=627553&r2=634028&rev=634028&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/GridUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/grid/GridUnitTest.java
Wed Mar  5 12:59:18 2008
@@ -1,4 +1,4 @@
-package org.apache.myfaces.tobago.layout;
+package org.apache.myfaces.tobago.layout.grid;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more



Mime
View raw message