com.sencha.gxt.widget.core.client.form
Class NumberPropertyEditor<N extends java.lang.Number>

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.form.PropertyEditor<N>
      extended by com.sencha.gxt.widget.core.client.form.NumberPropertyEditor<N>
Type Parameters:
N - the number type
All Implemented Interfaces:
Parser<N>, Renderer<N>
Direct Known Subclasses:
NumberPropertyEditor.BigDecimalPropertyEditor, NumberPropertyEditor.DoublePropertyEditor, NumberPropertyEditor.FloatPropertyEditor, NumberPropertyEditor.IntegerPropertyEditor, NumberPropertyEditor.LongPropertyEditor, NumberPropertyEditor.ShortPropertyEditor

public abstract class NumberPropertyEditor<N extends java.lang.Number>
extends PropertyEditor<N>

A property editor that converts typed numbers to strings and strings back to numbers. Also handles incrementing and decrementing the typed numbers.


Nested Class Summary
static class NumberPropertyEditor.BigDecimalPropertyEditor
          A number property editor for use with BigDecimal.
static class NumberPropertyEditor.DoublePropertyEditor
          A number property editor for use with Double.
static class NumberPropertyEditor.FloatPropertyEditor
          A number property editor for use with Float.
static class NumberPropertyEditor.IntegerPropertyEditor
          A number property editor for use with Integer.
static class NumberPropertyEditor.LongPropertyEditor
          A number property editor for use with Long.
static class NumberPropertyEditor.ShortPropertyEditor
          A number property editor for use with Short.
 
Field Summary
 
Fields inherited from class com.sencha.gxt.widget.core.client.form.PropertyEditor
DEFAULT
 
Constructor Summary
NumberPropertyEditor(N incrAmount)
          Creates a new number property editor with the default number type (Double).
NumberPropertyEditor(NumberFormat format, N incrAmount)
          Creates a new number property editor.
NumberPropertyEditor(java.lang.String pattern, N incrAmount)
          Creates a new number property editor.
 
Method Summary
 N decr(N value)
          Decrements a value by the current increment amount.
 NumberFormat getFormat()
          Returns the editor's format.
 N getIncrement()
          Gets the current increment amount.
 N incr(N value)
          Increments a value by the current increment amount.
 N parse(java.lang.CharSequence text)
           
 java.lang.String render(java.lang.Number value)
           
 void setFormat(NumberFormat format)
          Sets the editor's format.
 void setIncrement(N value)
          Sets the increment amount (defaults to zero).
 
Methods inherited from class com.sencha.gxt.widget.core.client.form.PropertyEditor
render
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberPropertyEditor

public NumberPropertyEditor(N incrAmount)
Creates a new number property editor with the default number type (Double).


NumberPropertyEditor

public NumberPropertyEditor(NumberFormat format,
                            N incrAmount)
Creates a new number property editor.

Parameters:
format - the number format

NumberPropertyEditor

public NumberPropertyEditor(java.lang.String pattern,
                            N incrAmount)
Creates a new number property editor.

Parameters:
pattern - the number format pattern
Method Detail

decr

public N decr(N value)
Decrements a value by the current increment amount.

Parameters:
value - the value to decrement
Returns:
the decremented value

getFormat

public NumberFormat getFormat()
Returns the editor's format.

Returns:
the number format

getIncrement

public N getIncrement()
Gets the current increment amount.

Returns:
the current increment amount.

incr

public N incr(N value)
Increments a value by the current increment amount.

Parameters:
value - the value to increment
Returns:
the incremented value

parse

public N parse(java.lang.CharSequence text)
                                 throws java.text.ParseException
Throws:
java.text.ParseException

render

public java.lang.String render(java.lang.Number value)

setFormat

public void setFormat(NumberFormat format)
Sets the editor's format.

Parameters:
format - the format

setIncrement

public void setIncrement(N value)
Sets the increment amount (defaults to zero).

Parameters:
value - the new increment amount


Copyright © 2012. All Rights Reserved.