Updates the infobar
()
| 294 | * Updates the infobar |
| 295 | */ |
| 296 | private void updateInfobar(){ |
| 297 | if(labelInfobar != null){ |
| 298 | if(worldPanel.isCursorEnabled()){ |
| 299 | Layer layer = getWorld().getLayer(worldPanel.getPosition().getLayer()); |
| 300 | if(layer != null && layer.exist(worldPanel.getCursorX(), worldPanel.getCursorY())){ |
| 301 | Place pl; |
| 302 | pl = layer.get(worldPanel.getCursorX(), worldPanel.getCursorY()); |
| 303 | |
| 304 | boolean has_place_group = pl.getPlaceGroup() != null; |
| 305 | boolean has_comments = !pl.getComments().isEmpty(); |
| 306 | |
| 307 | StringBuilder infoText = new StringBuilder(pl.getName()); |
| 308 | |
| 309 | if(has_place_group || has_comments){ |
| 310 | infoText.append(" ("); |
| 311 | } |
| 312 | if(has_place_group){ |
| 313 | infoText.append(pl.getPlaceGroup().getName()); |
| 314 | } |
| 315 | if(has_comments){ |
| 316 | if(has_place_group){ |
| 317 | infoText.append(", "); |
| 318 | } |
| 319 | infoText.append(pl.getComments().replace('\n', ' ').replace("\r", "")); |
| 320 | } |
| 321 | if(has_place_group || has_comments){ |
| 322 | infoText.append(")"); |
| 323 | } |
| 324 | |
| 325 | labelInfobar.setText(infoText.toString()); |
| 326 | } else { |
| 327 | labelInfobar.setText(""); |
| 328 | } |
| 329 | } else labelInfobar.setText(""); |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | // ========================= selection listener ============================ |
| 334 | @Override |
no test coverage detected