/** * Set the hidden flag for this node. * * @param hidden : The new flag */ public void setHidden(boolean hidden) { getJsonObject().put("hidden", hidden); }
/** * Set the ID for this node. * * @param id : The new ID */ public void setId(String id) { getJsonObject().put("id", id); }
/** * Set the title for this node. * * @param title : The new title */ public void setTitle(String title) { getJsonObject().put("title", title); } }
/** * Add a new child node to the top level. * * @param id : The ID value to put in this node. * @param title : The title value to put in this node. * @return boolean : True if successful, otherwise False */ public boolean addTopNode(String id, String title) { if (id == null || title == null) { return false; } String key = "node-" + id; ManifestNode node = new ManifestNode(); node.setId(id); node.setTitle(title); node.setKey(key); node.setParentKey(null); JsonObject object = writeObject("manifest"); object.put(key, node.getJsonObject()); return true; }
/** * Add a new child node to this node. * * @param id : The ID value to put in this node. * @param title : The title value to put in this node. * @return boolean : True if successful, otherwise False */ public boolean addChild(String id, String title) { if (id == null || title == null) { return false; } String key = "node-" + id; ManifestNode node = new ManifestNode(); node.setId(id); node.setTitle(title); node.setKey(key); node.setParentKey(thisKey); JsonObject object = writeObject("children"); object.put(key, node.getJsonObject()); return true; }