Saves the place data
()
| 261 | * Saves the place data |
| 262 | */ |
| 263 | public void save(){ |
| 264 | //if(!textfield_name.getText().isEmpty()){ // name not empty |
| 265 | try { |
| 266 | if(layer == null) layer = world.getNewLayer(); |
| 267 | |
| 268 | // create place if it doesn't exist else just set the name |
| 269 | if(place == null) layer.put(place = new Place(textfieldName.getText(), px, py, layer)); |
| 270 | else place.setName(textfieldName.getText()); |
| 271 | |
| 272 | // set place group |
| 273 | PlaceGroup a = (PlaceGroup) comboboxPlaceGroup.getSelectedItem(); |
| 274 | place.setPlaceGroup(a != placeGroupNull ? a : null); // replace null group with null |
| 275 | place.setInfoRing((InformationColor) comboboxInfoColor.getSelectedItem()); |
| 276 | |
| 277 | // set minimum level |
| 278 | if(checkboxLvlMin.isSelected()){ |
| 279 | place.setRecLevelMin((Integer) spinnerRecLvlMin.getValue()); |
| 280 | } else { |
| 281 | place.setRecLevelMin(-1); |
| 282 | } |
| 283 | |
| 284 | // set maximum level |
| 285 | if(checkboxLvlMax.isSelected()){ |
| 286 | place.setRecLevelMax((Integer) spinnerRecLvlMax.getValue()); |
| 287 | } else { |
| 288 | place.setRecLevelMax(-1); |
| 289 | } |
| 290 | |
| 291 | // set comments |
| 292 | place.setComments(commentArea.getText()); |
| 293 | } catch (Layer.PlaceNotInsertedException ex) { |
| 294 | Logger.getLogger(PlaceDialog.class.getName()).log(Level.SEVERE, null, ex); |
| 295 | } |
| 296 | //} |
| 297 | getParent().repaint(); |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Gets the place (eg. after creation |
no test coverage detected