}
protected void doSpin(Cell.Context context, XElement parent, N value, ValueUpdater<N> updater, boolean up) {
if (!isReadOnly()) {
// use the current value in the input element
InputElement input = getInputElement(parent);
String v = input.getValue();
if (!"".equals(v)) {
try {
value = getPropertyEditor().parse(v);
} catch (Exception e) {
e.printStackTrace();
}
}
boolean cancelled = false;
if (context instanceof HandlerManagerContext) {
HandlerManager manager = ((HandlerManagerContext) context).getHandlerManager();
CellBeforeSelectionEvent<N> event = CellBeforeSelectionEvent.fire(manager, context, value);
if (event != null && event.isCanceled()) {
cancelled = true;
}
} else {
CellBeforeSelectionEvent<N> event = CellBeforeSelectionEvent.fire(this, context, value);
if (!fireCancellableEvent(event)) {
cancelled = true;
}
}
if (!cancelled) {
N newVal = null;
if (up) {
newVal = getPropertyEditor().incr(value);
if (newVal.doubleValue() > maxValue.doubleValue() || newVal.doubleValue() < minValue.doubleValue()) {
return;
}
input.setValue(getPropertyEditor().render(newVal));
} else {
newVal = getPropertyEditor().decr(value);
if (newVal.doubleValue() > maxValue.doubleValue() || newVal.doubleValue() < minValue.doubleValue()) {
return;
}
input.setValue(getPropertyEditor().render(newVal));
}
if (context instanceof HandlerManagerContext) {
HandlerManager manager = ((HandlerManagerContext) context).getHandlerManager();
CellSelectionEvent.fire(manager, context, newVal);