/** * Adds a child to this item's child node list. It first asks the new item whether it's allowed to * belong to this item, for example <cfelse> tags must only be a child of an <cfif> * tag. * * @param newItem The new document item to add. * @return true - child added, false - error with child. */ public boolean addChild(DocItem newItem) { boolean addOkay = true; if (!newItem.validChildAddition(this)) { parseMessages.addMessage( new ParseError( newItem.getLineNumber(), newItem.getStartPosition(), newItem.getEndPosition(), newItem.getItemData(), "Invalid child " + newItem.getClass().getName() + ":\'" + newItem.getName() + "\' for parent \'" + getName() + "\'")); addOkay = false; } // // Set the item's parent & sibling newItem.setParent(this); if (docNodes.size() == 0) newItem.setPrevSibling(null); else newItem.setPrevSibling((DocItem) docNodes.get(docNodes.size() - 1)); docNodes.add(newItem); return addOkay; }
protected void addParseMessage(ParseMessage newMsg) { // System.out.println("DocItem::addParseMessage() - Adding message " + newMsg.getMessage()); parseMessages.addMessage(newMsg); }