MCPcopy Create free account
hub / github.com/Neop/mudmap2 / updateInfobar

Method updateInfobar

src/main/java/mudmap2/frontend/WorldTab.java:296–331  ·  view source on GitHub ↗

Updates the infobar

()

Source from the content-addressed store, hash-verified

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

Callers 3

placeSelectedMethod · 0.95
placeDeselectedMethod · 0.95
statusUpdateMethod · 0.95

Calls 14

getWorldMethod · 0.95
existMethod · 0.95
getMethod · 0.95
getPlaceGroupMethod · 0.95
getCommentsMethod · 0.95
getNameMethod · 0.95
isCursorEnabledMethod · 0.80
getPositionMethod · 0.80
getCursorXMethod · 0.80
getCursorYMethod · 0.80
isEmptyMethod · 0.65
getLayerMethod · 0.45

Tested by

no test coverage detected