(String string, int width)
| 184 | } |
| 185 | |
| 186 | @Override |
| 187 | public String shortenToWidth(String string, int width) { |
| 188 | if (StringUtils.isEmpty(string)) |
| 189 | return string; |
| 190 | Validate.isTrue(width > 0); |
| 191 | |
| 192 | boolean changed = false; |
| 193 | if (getStringWidth(string) > width) { |
| 194 | while (getStringWidth(string + "...") > width && !string.isEmpty()) { |
| 195 | string = string.substring(0, string.length() - 1); |
| 196 | changed = true; |
| 197 | } |
| 198 | } |
| 199 | if (changed) |
| 200 | string += "..."; |
| 201 | return string; |
| 202 | } |
| 203 | |
| 204 | @Override |
| 205 | public IButton createButton(int id, int x, int y, String label) { |
nothing calls this directly
no test coverage detected