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

Method save

src/main/java/mudmap2/frontend/dialog/PlaceDialog.java:263–298  ·  view source on GitHub ↗

Saves the place data

()

Source from the content-addressed store, hash-verified

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

Callers 1

actionPerformedMethod · 0.95

Calls 12

getNewLayerMethod · 0.80
putMethod · 0.80
setPlaceGroupMethod · 0.80
setInfoRingMethod · 0.80
isSelectedMethod · 0.80
setRecLevelMinMethod · 0.80
setRecLevelMaxMethod · 0.80
setCommentsMethod · 0.80
getParentMethod · 0.65
getTextMethod · 0.45
setNameMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected