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