if (Strings.isEmpty(selectedTileId)) {
newEditor = new NewTileFragment(editor.getId(), "new-tile-form-fragment", this, getModel()) {
@Override
protected void onAddTile(String tileId, String tileTypeName) {
BrixNode containerNode = getTileContainerNode();
containerNode.checkout();
BrixNode node = getTileContainerNode().tiles().createTile(tileId, tileTypeName);
getEditor().save(node);
containerNode.save();
containerNode.checkin();
selectedTileId = tileId;
setupTileEditor();
}
};
} else {
newEditor = new TileEditorFragment(editor.getId(), "editor-form-fragment", this, getModel(),
selectedTileId, filterFeedback()) {
@Override
protected void onDelete(String tileId) {
BrixNode tile = getTileContainerNode().tiles().getTile(selectedTileId);
if (tile != null) {
getTileContainerNode().checkout();
tile.remove();
getTileContainerNode().save();
getTileContainerNode().checkin();
}
selectedTileId = null;
setupTileEditor();