[richfaces-svn-commits] JBoss Rich Faces SVN: r18637 - in sandbox/trunk/ui/inputs/inputnumberslider/src/main: java/org/richfaces and 4 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sun Aug 15 14:42:52 EDT 2010


Author: nbelaevski
Date: 2010-08-15 14:42:51 -0400 (Sun, 15 Aug 2010)
New Revision: 18637

Added:
   sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/component/
   sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/component/PositionType.java
   sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
Removed:
   sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/html/PositionType.java
Modified:
   sandbox/trunk/ui/inputs/inputnumberslider/src/main/config/faces-config.xml
   sandbox/trunk/ui/inputs/inputnumberslider/src/main/templates/inputnumberslider.template.xml
Log:
InputNumberSlider refactoring

Modified: sandbox/trunk/ui/inputs/inputnumberslider/src/main/config/faces-config.xml
===================================================================
--- sandbox/trunk/ui/inputs/inputnumberslider/src/main/config/faces-config.xml	2010-08-14 14:35:28 UTC (rev 18636)
+++ sandbox/trunk/ui/inputs/inputnumberslider/src/main/config/faces-config.xml	2010-08-15 18:42:51 UTC (rev 18637)
@@ -112,8 +112,8 @@
 		</property>
 		<property>
 			<property-name>inputPosition</property-name>
-			<property-class>org.richfaces.renderkit.html.PositionType</property-class>
-			<default-value>PositionType.right</default-value>
+			<property-class>org.richfaces.component.PositionType</property-class>
+			<default-value>PositionType.DEFAULT</default-value>
 			<property-extension>
 				<cdk:generate>true</cdk:generate>
 			</property-extension>

Copied: sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/component/PositionType.java (from rev 18636, sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/html/PositionType.java)
===================================================================
--- sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/component/PositionType.java	                        (rev 0)
+++ sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/component/PositionType.java	2010-08-15 18:42:51 UTC (rev 18637)
@@ -0,0 +1,7 @@
+package org.richfaces.component;
+
+public enum PositionType {
+    top, right, bottom, left;
+    
+    public static final PositionType DEFAULT = right;
+}

Added: sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
===================================================================
--- sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java	                        (rev 0)
+++ sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java	2010-08-15 18:42:51 UTC (rev 18637)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.component.PositionType;
+
+/**
+ * @author Nick Belaevski
+ * 
+ */
+public abstract class InputNumberSliderRendererBase extends InputRendererBase {
+
+    protected String getInputPositionName(UIComponent component) {
+        PositionType type = (PositionType) component.getAttributes().get("inputPosition");
+        if (type == null) {
+            type = PositionType.DEFAULT;
+        }
+        
+        return type.name();
+    }
+}

Deleted: sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/html/PositionType.java
===================================================================
--- sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/html/PositionType.java	2010-08-14 14:35:28 UTC (rev 18636)
+++ sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/html/PositionType.java	2010-08-15 18:42:51 UTC (rev 18637)
@@ -1,5 +0,0 @@
-package org.richfaces.renderkit.html;
-
-public enum PositionType {
-    top, right, bottom, left
-}

Modified: sandbox/trunk/ui/inputs/inputnumberslider/src/main/templates/inputnumberslider.template.xml
===================================================================
--- sandbox/trunk/ui/inputs/inputnumberslider/src/main/templates/inputnumberslider.template.xml	2010-08-14 14:35:28 UTC (rev 18636)
+++ sandbox/trunk/ui/inputs/inputnumberslider/src/main/templates/inputnumberslider.template.xml	2010-08-15 18:42:51 UTC (rev 18637)
@@ -28,7 +28,7 @@
 	xmlns:xi="http://www.w3.org/2001/XInclude">
 	<cc:interface>
 		<cdk:class>org.richfaces.renderkit.html.InputNumberSliderRenderer</cdk:class>
-		<cdk:superclass>org.richfaces.renderkit.InputRendererBase</cdk:superclass>
+		<cdk:superclass>org.richfaces.renderkit.InputNumberSliderRendererBase</cdk:superclass>
 		<cdk:component-family>javax.faces.Input</cdk:component-family>
 		<cdk:renderer-type>org.richfaces.InputNumberSliderRenderer</cdk:renderer-type>
 		<cdk:resource-dependency name="inputNumberSlider.ecss" />
@@ -41,10 +41,10 @@
 	</cc:interface>
 	<cc:implementation>
 		<span id="#{clientId}" class="rf-ins #{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id class">
-			<c:if test="#{PositionType.valueOf('left') == component.attributes['inputPosition']
-				|| PositionType.valueOf('top') == component.attributes['inputPosition']}">
+            <c:if test="#{'left' == getInputPositionName(component)
+				|| 'top' == getInputPositionName(component)}">
 				<xi:include xpointer="xpointer(/*)" href="input.template.inc" />
-				<c:if test="#{PositionType.valueOf('top') == component.attributes['inputPosition'] and component.attributes['showInput']}">
+				<c:if test="#{'top' == getInputPositionName(component) and component.attributes['showInput']}">
 					<br />
 				</c:if>
 			</c:if>
@@ -63,9 +63,9 @@
 			<c:if test="#{component.attributes['showArrows']}">
 				<span class="rf-ins-ib#{component.attributes['disabled'] ? '-d' : ''} #{component.attributes['increaseClass']}" />
 			</c:if>
-			<c:if test="#{PositionType.valueOf('right') == component.attributes['inputPosition']
-				|| PositionType.valueOf('bottom') == component.attributes['inputPosition']}">
-				<c:if test="#{PositionType.valueOf('bottom') == component.attributes['inputPosition'] and component.attributes['showInput']}">
+			<c:if test="#{'right' == getInputPositionName(component)
+				|| 'bottom' == getInputPositionName(component)}">
+				<c:if test="#{'bottom' == getInputPositionName(component) and component.attributes['showInput']}">
 					<br />
 				</c:if>
 				<xi:include xpointer="xpointer(/*)" href="input.template.inc" />



More information about the richfaces-svn-commits mailing list