コード例 #1
0
 @Override
 public void notifyObjectDeleted(TileGroup group) {
   final MapTile map = WorldViewModel.INSTANCE.getMap();
   final Media config = map.getGroupsConfig();
   final XmlNode node = Stream.loadXml(config);
   final Collection<XmlNode> toRemove = new ArrayList<>();
   for (final XmlNode nodeGroup : node.getChildren(ConfigTileGroup.GROUP)) {
     if (WorldViewRenderer.groupEquals(
         nodeGroup.readString(ConfigTileGroup.NAME), group.getName())) {
       toRemove.add(nodeGroup);
     }
   }
   for (final XmlNode remove : toRemove) {
     node.removeChild(remove);
   }
   toRemove.clear();
   Stream.saveXml(node, config);
   map.loadGroups(config);
 }
コード例 #2
0
 /**
  * Load the existing groups from the object configurer.
  *
  * @param config The config file.
  */
 public void loadGroups(Media config) {
   final Collection<TileGroup> groups = ConfigTileGroup.create(Stream.loadXml(config));
   loadObjects(groups);
 }