 
   class IntEditorView extends CellEditorView
 
+    el: '<input type="text" class="bk-cell-editor bk-cell-editor-int" />'
+
+    render: () ->
+      @$el.spinner(step: @model.get("step"))
+      @disable_horizontal_navigation()
+      @disable_vertical_navigation()
+      @$el.focus().select()
+
+    remove: () ->
+      @$el.spinner("destroy")
+      super()
+
+    serializeValue: () ->
+      return parseInt(@getValue(), 10) || 0
+
+    loadValue: (item) ->
+      super(item)
+      @$el[0].defaultValue = @defaultValue
+      @$el.select()
+
+    validateValue: (value) ->
+      if isNaN(value)
+        return { valid: false, msg: "Please enter a valid integer"}
+      else
+        return super(value)
+
   class IntEditor extends CellEditor
     type: 'IntEditor'
     default_view: IntEditorView

  "common/has_properties"
  "common/collection"
  "common/continuum_view"
], (_, $, HasProperties, Collection, ContinuumView) ->

  class CellEditor extends HasProperties
  class CellEditorCollection extends Collection

      @defaultValue = if value? then value else @emptyValue
      @setValue(@defaultValue)

    validateValue: (value) ->
      if @args.column.validator
        result = @args.column.validator(value)
        if !result.valid
          return result

      return { valid: true, msg: null }

    validate: () -> return @validateValue(@getValue())

    disable_horizontal_navigation: () ->
      @$el.bind "keydown", (event) =>
        if event.keyCode == $.ui.keyCode.LEFT or event.keyCode == $.ui.keyCode.RIGHT
          event.stopImmediatePropagation()

    disable_vertical_navigation: () ->
      @$el.bind "keydown", (event) =>
        if event.keyCode == $.ui.keyCode.UP   or event.keyCode == $.ui.keyCode.PAGE_UP   or
           event.keyCode == $.ui.keyCode.DOWN or event.keyCode == $.ui.keyCode.PAGE_DOWN
          event.stopImmediatePropagation()

  class StringEditorView extends CellEditorView

    emptyValue: ""

    el: '<input type="text" class="bk-cell-editor bk-cell-editor-string" />'

    render: () ->
      @disable_horizontal_navigation()
      @$el.focus().select()

    loadValue: (item) ->
      super(item)
