@Override public Object getNextValue() { if (part.getArmor(side) < part.getArmorMax(side)) { return Integer.valueOf(part.getArmor(side) + 1); } return Integer.valueOf(part.getArmor(side) + 1); }
@Override public void setValue(Object arg0) { if (getValue().equals(arg0)) return; try { final boolean setSymmetric = symmetric.isSelected() && part.getInternalComponent().getLocation().oppositeSide() != null; final int armor = ((Integer) arg0).intValue(); if (setSymmetric) { opStack.pushAndApply(new OpSetArmorSymmetric(xBar, loadout, part, side, armor, true)); } else { opStack.pushAndApply(new OpSetArmor(xBar, loadout, part, side, armor, true)); } } catch (IllegalArgumentException exception) { // TODO: Handle failed case better! Toolkit.getDefaultToolkit().beep(); } finally { fireStateChanged(); } }
@Override public Object getValue() { return Integer.valueOf(part.getArmor(side)); }
@Override public Object getPreviousValue() { if (part.getArmor(side) < 1) return null; return Integer.valueOf(part.getArmor(side) - 1); }