1 17 18 package com.finalist.jag.template; 19 20 21 import com.finalist.jag.util.*; 22 23 24 31 public class TemplateTreeItem extends TreeItem { 32 33 34 public TemplateTag tag = null; 35 36 37 public TemplateTextBlock textBlock = null; 38 39 40 45 public TemplateTreeItem() { 46 textBlock = new TemplateTextBlock(""); 47 } 48 49 50 57 public TemplateTreeItem(TemplateTreeItem root) { 58 59 textBlock = new TemplateTextBlock(root.textBlock); 61 62 if (root.tag != null) { 64 tag = new TemplateTag(root.tag); 65 66 tag.setTextBuffer(textBlock); 67 tag.setClosingTextBuffer(null); 68 } 69 70 TreeItem childItem = root.getFirstChild(); 71 72 while (childItem != null) { 73 addChild(new TemplateTreeItem((TemplateTreeItem) childItem)); 74 75 childItem = childItem.getNextSibling(); 76 } 77 78 if ((tag != null) && (getLastChild() != null)) { 79 TemplateTreeItem closingBlock = 80 (TemplateTreeItem) getLastChild(); 81 TemplateTextBlock closingText = closingBlock.getTextBlock(); 82 83 tag.setClosingTextBuffer(closingText); 84 } 85 } 86 87 88 95 public void setTag(TemplateTag tag) { 96 this.tag = tag; 97 } 98 99 100 107 public void setTextBlock(TemplateTextBlock textBlock) { 108 this.textBlock = textBlock; 109 } 110 111 112 119 public TemplateTag getTag() { 120 return (this.tag); 121 } 122 123 124 131 public TemplateTextBlock getTextBlock() { 132 return (this.textBlock); 133 } 134 } 135 136 ; | Popular Tags |