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