(Number value)
| 155 | |
| 156 | |
| 157 | public void setValue(Number value) { |
| 158 | if ("int".equals(type)) { |
| 159 | newValue = value.intValue(); |
| 160 | strNewValue = String.format(Locale.US, textFormat, newValue.intValue()); |
| 161 | |
| 162 | } else if ("hex".equals(type)) { |
| 163 | newValue = value.intValue(); |
| 164 | strNewValue = String.format(Locale.US, textFormat, newValue.intValue()); |
| 165 | |
| 166 | } else if ("webcolor".equals(type)) { |
| 167 | newValue = value.intValue(); |
| 168 | // keep only RGB |
| 169 | int val = (newValue.intValue() & 0xffffff); |
| 170 | strNewValue = String.format(Locale.US, textFormat, val); |
| 171 | |
| 172 | } else if ("float".equals(type)) { |
| 173 | BigDecimal bd = new BigDecimal(value.floatValue()); |
| 174 | bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP); |
| 175 | newValue = bd.floatValue(); |
| 176 | strNewValue = String.format(Locale.US, textFormat, newValue.floatValue()); |
| 177 | } |
| 178 | |
| 179 | // send new data to the server in the sketch |
| 180 | sendNewValue(); |
| 181 | } |
| 182 | |
| 183 | |
| 184 | public void updateColorBox() { |
no test coverage detected