Author: nbelaevski
Date: 2010-08-15 14:48:47 -0400 (Sun, 15 Aug 2010)
New Revision: 18638
Modified:
sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
sandbox/trunk/ui/inputs/inputnumberslider/src/main/templates/inputnumberslider.template.xml
Log:
InputNumberSlider refactoring: more type safety added
Modified:
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 2010-08-15
18:42:51 UTC (rev 18637)
+++
sandbox/trunk/ui/inputs/inputnumberslider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java 2010-08-15
18:48:47 UTC (rev 18638)
@@ -31,12 +31,13 @@
*/
public abstract class InputNumberSliderRendererBase extends InputRendererBase {
- protected String getInputPositionName(UIComponent component) {
+ protected boolean isInputPosition(UIComponent component, String name) {
PositionType type = (PositionType)
component.getAttributes().get("inputPosition");
if (type == null) {
type = PositionType.DEFAULT;
}
- return type.name();
+ return type == PositionType.valueOf(name);
}
+
}
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-15
18:42:51 UTC (rev 18637)
+++
sandbox/trunk/ui/inputs/inputnumberslider/src/main/templates/inputnumberslider.template.xml 2010-08-15
18:48:47 UTC (rev 18638)
@@ -41,10 +41,9 @@
</cc:interface>
<cc:implementation>
<span id="#{clientId}" class="rf-ins
#{component.attributes['styleClass']}" cdk:passThroughWithExclusions="id
class">
- <c:if test="#{'left' == getInputPositionName(component)
- || 'top' == getInputPositionName(component)}">
+ <c:if test="#{isInputPosition(component, 'left') ||
isInputPosition(component, 'top')}">
<xi:include xpointer="xpointer(/*)" href="input.template.inc"
/>
- <c:if test="#{'top' == getInputPositionName(component) and
component.attributes['showInput']}">
+ <c:if test="#{isInputPosition(component, 'top') and
component.attributes['showInput']}">
<br />
</c:if>
</c:if>
@@ -63,9 +62,8 @@
<c:if test="#{component.attributes['showArrows']}">
<span class="rf-ins-ib#{component.attributes['disabled'] ?
'-d' : ''} #{component.attributes['increaseClass']}" />
</c:if>
- <c:if test="#{'right' == getInputPositionName(component)
- || 'bottom' == getInputPositionName(component)}">
- <c:if test="#{'bottom' == getInputPositionName(component) and
component.attributes['showInput']}">
+ <c:if test="#{isInputPosition(component, 'right') ||
isInputPosition(component, 'bottom')}">
+ <c:if test="#{isInputPosition(component, 'bottom') and
component.attributes['showInput']}">
<br />
</c:if>
<xi:include xpointer="xpointer(/*)" href="input.template.inc"
/>