You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/01/15 20:25:51 UTC

svn commit: r496450 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/ core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/taglib/component/ example/demo/src/main/webapp/overview/ ...

Author: weber
Date: Mon Jan 15 11:25:50 2007
New Revision: 496450

URL: http://svn.apache.org/viewvc?view=rev&rev=496450
Log:
TOBAGO-179 (tc:toolbar missing attribute orientation)

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIToolBar.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java
    myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.jsp
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Mon Jan 15 11:25:50 2007
@@ -98,6 +98,7 @@
   public static final String ATTR_NUMBER_STYLE = "numberStyle";
   public static final String ATTR_ONCHANGE = "onchange";
   public static final String ATTR_ONCLICK = "onclick";
+  public static final String ATTR_ORIENTATION = "orientation";
   public static final String ATTR_PAGE_MENU = "pageMenu";
   public static final String ATTR_PASSWORD = "password";
   public static final String ATTR_POPUP_LIST = "popupList";

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIToolBar.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIToolBar.java?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIToolBar.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIToolBar.java Mon Jan 15 11:25:50 2007
@@ -17,6 +17,7 @@
  * limitations under the License.
  */
 
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ORIENTATION;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ICON_SIZE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_POSITION;
 
@@ -39,10 +40,14 @@
   public static final String ICON_BIG = "big";
   public static final String ICON_OFF = "off";
 
+  public static final String ORIENTATION_LEFT = "left";
+  public static final String ORIENTATION_RIGHT = "right";
+
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.ToolBar";
 
   private String labelPosition;
   private String iconSize;
+  private String orientation;
 
   public String getLabelPosition() {
     if (labelPosition != null) {
@@ -76,11 +81,30 @@
     this.iconSize = iconSize;
   }
 
+
+  public String getOrientation() {
+    if (orientation != null) {
+      return orientation;
+    }
+    ValueBinding vb = getValueBinding(ATTR_ORIENTATION);
+    if (vb != null) {
+      return (String) vb.getValue(getFacesContext());
+    } else {
+      return ORIENTATION_LEFT;
+    }
+
+  }
+
+  public void setOrientation(String orientation) {
+    this.orientation = orientation;
+  }
+
   public Object saveState(FacesContext context) {
-    Object[] saveState = new Object[3];
+    Object[] saveState = new Object[4];
     saveState[0] = super.saveState(context);
     saveState[1] = labelPosition;
     saveState[2] = iconSize;
+    saveState[3] = orientation;
     return saveState;
   }
 
@@ -89,5 +113,6 @@
     super.restoreState(context, values[0]);
     labelPosition = (String) values[1];
     iconSize = (String) values[2];
+    orientation = (String) values[3];
   }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTag.java?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTag.java Mon Jan 15 11:25:50 2007
@@ -19,6 +19,7 @@
 
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ICON_SIZE;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL_POSITION;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ORIENTATION;
 import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UIToolBar;
 
@@ -41,6 +42,7 @@
 
   private String labelPosition = LABEL_BOTTOM;
   private String iconSize = ICON_SMALL;
+  private String orientation = UIToolBar.ORIENTATION_LEFT;
 
 
   public String getComponentType() {
@@ -51,6 +53,7 @@
     super.setProperties(component);
     ComponentUtil.setStringProperty(component, ATTR_LABEL_POSITION, labelPosition);
     ComponentUtil.setStringProperty(component, ATTR_ICON_SIZE, iconSize);
+    ComponentUtil.setStringProperty(component, ATTR_ORIENTATION, orientation);
   }
 
   public void release() {
@@ -67,4 +70,7 @@
     this.iconSize = iconSize;
   }
 
+    public void setOrientation(String orientation) {
+        this.orientation = orientation;
+    }
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/ToolBarTagDeclaration.java Mon Jan 15 11:25:50 2007
@@ -79,4 +79,12 @@
   @UIComponentTagAttribute(defaultValue = UIToolBar.ICON_SMALL,
       allowedValues = {UIToolBar.ICON_SMALL, UIToolBar.ICON_BIG, UIToolBar.ICON_OFF})
   void setIconSize(String iconSize);
+
+  /**
+   * Orientation of toolbar
+   */
+  @TagAttribute
+  @UIComponentTagAttribute(defaultValue = UIToolBar.ORIENTATION_LEFT,
+      allowedValues = {UIToolBar.ORIENTATION_LEFT, UIToolBar.ORIENTATION_RIGHT})
+  void setOrientation(String orientation);
 }

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.jsp?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/overview/toolbar.jsp Mon Jan 15 11:25:50 2007
@@ -83,7 +83,8 @@
 
         <tc:cell spanX="3">
         <tc:toolBar iconSize="#{overviewController.toolbarIconSize}"
-            labelPosition="#{overviewController.toolbarTextPosition}" >
+                    labelPosition="#{overviewController.toolbarTextPosition}"
+                    orientation="left" >
           <tc:toolBarCommand id="button2" action="overview/toolbar"
               actionListener="#{overviewController.click}"
               label="#{overviewBundle.toolbar_buttonAction}" />

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ToolBarRenderer.java Mon Jan 15 11:25:50 2007
@@ -45,6 +45,7 @@
 import org.apache.myfaces.tobago.component.UIMenuSelectOne;
 import org.apache.myfaces.tobago.component.UISelectBooleanCommand;
 import org.apache.myfaces.tobago.component.UISelectOneCommand;
+import org.apache.myfaces.tobago.component.UIToolBar;
 import org.apache.myfaces.tobago.context.ResourceManager;
 import org.apache.myfaces.tobago.context.ResourceManagerFactory;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
@@ -93,7 +94,12 @@
       writer.writeComponentClass();
       writer.writeAttribute(HtmlAttributes.STYLE, null, ATTR_STYLE);
       writer.startElement(HtmlConstants.DIV, toolbar);
-      writer.writeClassAttribute("tobago-toolbar-div-inner");
+      boolean right = false;
+      if (toolbar instanceof UIToolBar) {
+        right = UIToolBar.ORIENTATION_RIGHT.equals(((UIToolBar) toolbar).getOrientation());
+      }
+      writer.writeClassAttribute("tobago-toolbar-div-inner" + (right ? " tobago-toolbar-orientation-right" : ""));
+
     }
 
     boolean boxFacet = isBoxFacet(toolbar);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?view=diff&rev=496450&r1=496449&r2=496450
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Mon Jan 15 11:25:50 2007
@@ -299,14 +299,6 @@
   background: transparent;
 }
 
-/* Toolbar ----------------------------------------------------------------- */
-.tobago-toolBar-default  {
-  border: 1px solid #000000;
-  box-sizing: border-box;
-  -moz-box-sizing: border-box;
-}
-
-
 /* file -------------------------------------------------------------------- */
 
 .tobago-file-default {
@@ -806,6 +798,7 @@
 /* Toolbar ----------------------------------------------------------------- */
 .tobago-toolBar-default  {
   border: 2px groove #f6faff;
+  position: relative;
   overflow: hidden;
   box-sizing: border-box;
   -moz-box-sizing: border-box;
@@ -813,6 +806,11 @@
 
 .tobago-toolBar-div-inner {
   padding: 4px;
+}
+
+.tobago-toolbar-orientation-right {
+  right: 0px;
+  position: absolute;
 }
 
 .tobago-toolbar-button {