001: package com.xoetrope.export;
002:
003: import java.util.Hashtable;
004: import java.util.Vector;
005:
006: /**
007: * Items which are added to an Block object. New Blocks can in
008: * turn be added to the individual Blocks
009: *
010: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
011: * the GNU Public License (GPL), please see license.txt for more details. If
012: * you make commercial use of this software you must purchase a commercial
013: * license from Xoetrope.</p>
014: * <p> $Revision: 1.2 $</p>
015: */
016: public class Block {
017: public static final String ATTRIB_ALIGN = "align";
018: public static final String ATTRIB_SRC = "src";
019:
020: public static final String ALIGN_LEFT = "left";
021: public static final String ALIGN_CENTER = "center";
022: public static final String ALIGN_RIGHT = "right";
023:
024: /**
025: * Items within a block for example tags within a HTML Block
026: */
027: protected Vector blocks;
028:
029: protected String style, value;
030: protected Hashtable attribs;
031:
032: protected StringBuffer content;
033: protected String tagName;
034:
035: public Block() {
036: content = new StringBuffer();
037: blocks = new Vector();
038: attribs = new Hashtable();
039: }
040:
041: public void setTag(String tag) {
042: tagName = tag;
043: }
044:
045: public String getTag() {
046: return tagName;
047: }
048:
049: public void setAttrib(String attribName, Object value) {
050: attribs.put(attribName, value);
051: }
052:
053: public String getAttrib(String attribName) {
054: return (String) attribs.get(attribName);
055: }
056:
057: public Block append(Block item) {
058: blocks.add(item);
059: return item;
060: }
061:
062: public Block append(String tagName) {
063: Block item = new Block();
064: item.setTag(tagName);
065: blocks.add(item);
066: return item;
067: }
068:
069: public Vector getBlocks() {
070: return blocks;
071: }
072:
073: public void setStyle(String styleName) {
074: style = styleName;
075: }
076:
077: public String getStyle() {
078: return style;
079: }
080:
081: public void setValue(String itemValue) {
082: value = itemValue;
083: }
084:
085: public String getValue() {
086: return value;
087: }
088:
089: public String getContent() {
090: return content.toString();
091: }
092:
093: public DataBinding getDataBinding(String path, String attrib) {
094: return new DataBinding(path, attrib);
095: }
096:
097: public String getCallbackValue(String callback) {
098: return null;
099: }
100: }
|