(String string, int width)
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public String shortenToWidth(String string, int width) { |
| 176 | if (StringUtils.isEmpty(string)) |
| 177 | return string; |
| 178 | Validate.isTrue(width > 0); |
| 179 | |
| 180 | boolean changed = false; |
| 181 | if (getStringWidth(string) > width) { |
| 182 | while (getStringWidth(string + "...") > width && !string.isEmpty()) { |
| 183 | string = string.substring(0, string.length() - 1); |
| 184 | changed = true; |
| 185 | } |
| 186 | } |
| 187 | if (changed) |
| 188 | string += "..."; |
| 189 | return string; |
| 190 | } |
| 191 | |
| 192 | @Override |
| 193 | public IButton createButton(int id, int x, int y, String label) { |
nothing calls this directly
no test coverage detected