@Override public Object getPreviousValue() { final Object ret = this.getValue(); final long num = ((Number) ret).longValue(); final Unit unit = SizeFormatter.getBestUnit(num); long add = getStep(num, unit); long nv; if (this.nm.getMinimum() != null) { nv = (long) Math.max(((Number) this.nm.getMinimum()).longValue(), num - add); } else { nv = (long) (num - add); } final Unit nunit = SizeFormatter.getBestUnit(nv); if (nunit == unit) { if (nv == num) { this.beep(); } return nv; } nv = nunit.getBytes1024() * 1000; if (nv == num) { this.beep(); } return nv; }
@Override public Object getNextValue() { Object ret = getValue(); long num = ((Number) ret).longValue(); Unit unit = SizeFormatter.getBestUnit(num); long add = getStep(num, unit); long newV; if (nm.getMaximum() != null) { newV = (long) Math.min(((Number) nm.getMaximum()).longValue(), num + add); } else { newV = (long) (num + add); } Unit newUnit = SizeFormatter.getBestUnit((long) newV); if (newUnit == unit) { if (newV == num) { beep(); } return newV; } newV = newUnit.getBytes1024() * 1; if (newV == num) { beep(); } return newV; }