⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cell.java

📁 iText可以制作中文PDF文件的JAVA源程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				table.insertTable((Table)element);				table.addCell(tmp);				table.addCell(DUMMY_CELL);				clear();				arrayList.add(table);				return;				default:					arrayList.add(element);		}	}/** * Add an <CODE>Object</CODE> to this cell. * * @param o the object to add * @return always <CODE>true</CODE> */	public boolean add(Object o) {		try {			this.addElement((Element) o);			return true;		}		catch(ClassCastException cce) {			throw new ClassCastException("You can only add objects that implement the Element interface.");		}		catch(BadElementException bee) {			throw new ClassCastException(bee.getMessage());		}	}/** * Sets the leading. * * @param	value	the new value */	public void setLeading(float value) {		leading = value;	}/** * Sets the horizontal alignment. * * @param	value	the new value */	public void setHorizontalAlignment(int value) {		horizontalAlignment = value;	}/** * Sets the alignment of this cell. * * @param	alignment		the new alignment as a <CODE>String</CODE> */	public void setHorizontalAlignment(String alignment) {		if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {			this.horizontalAlignment = Element.ALIGN_CENTER;			return;		}		if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {			this.horizontalAlignment = Element.ALIGN_RIGHT;			return;		}		if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {			this.horizontalAlignment = Element.ALIGN_JUSTIFIED;			return;		}		this.horizontalAlignment = Element.ALIGN_LEFT;	}/** * Sets the vertical alignment. * * @param	value	the new value */	public void setVerticalAlignment(int value) {		verticalAlignment = value;	}/** * Sets the alignment of this paragraph. * * @param	alignment		the new alignment as a <CODE>String</CODE> */	public void setVerticalAlignment(String alignment) {		if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(alignment)) {			this.verticalAlignment = Element.ALIGN_MIDDLE;			return;		}		if (ElementTags.ALIGN_BOTTOM.equalsIgnoreCase(alignment)) {			this.verticalAlignment = Element.ALIGN_BOTTOM;			return;		}		if (ElementTags.ALIGN_BASELINE.equalsIgnoreCase(alignment)) {			this.verticalAlignment = Element.ALIGN_BASELINE;			return;		}		this.verticalAlignment = Element.ALIGN_TOP;	}/** * Sets the width. * * @param	value	the new value */	public void setWidth(String value) {		width = value;	}/** * Sets the colspan. * * @param	value	the new value */	public void setColspan(int value) {		colspan = value;	}/** * Sets the rowspan. * * @param	value	the new value */	public void setRowspan(int value) {		rowspan = value;	}/** * Sets header. * * @param	value	the new value */	public void setHeader(boolean value) {		header = value;	}/** * Set nowrap. * * @param	value	the new value */	public void setNoWrap(boolean value) {		noWrap = value;	}	// methods to retrieve information/** * Gets the number of <CODE>Element</CODE>s in the Cell. * * @return	a <CODE>size</CODE>. */	public int size() {		return arrayList.size();	}/** * Checks if the <CODE>Cell</CODE> is empty. * * @return	<CODE>false</CODE> if there are non-empty <CODE>Element</CODE>s in the <CODE>Cell</CODE>. */	public boolean isEmpty() {		switch(size()) {			case 0:				return true;			case 1:				Element element = (Element) arrayList.get(0);				switch (element.type()) {					case Element.CHUNK:						return ((Chunk) element).isEmpty();					case Element.ANCHOR:					case Element.PHRASE:					case Element.PARAGRAPH:						return ((Phrase) element).isEmpty();					case Element.LIST:						return ((List) element).size() == 0;				}				return false;				default:					return false;		}	}/** * Makes sure there is at least 1 object in the Cell. * * Otherwise it might not be shown in the table. */	void fill() {		if (size() == 0) arrayList.add(new Paragraph(0));	}/** * Checks if the <CODE>Cell</CODE> is empty. * * @return	<CODE>false</CODE> if there are non-empty <CODE>Element</CODE>s in the <CODE>Cell</CODE>. */	public boolean isTable() {		return (size() == 1) && (((Element)arrayList.get(0)).type() == Element.TABLE);	}/** * Gets an iterator of <CODE>Element</CODE>s. * * @return	an <CODE>Iterator</CODE>. */	public Iterator getElements() {		return arrayList.iterator();	}/** * Gets the horizontal alignment. * * @return	a value */	public int horizontalAlignment() {		return horizontalAlignment;	}/** * Gets the vertical alignment. * * @return	a value */	public int verticalAlignment() {		return verticalAlignment;	}/** * Gets the width. * * @return	a value */	public String cellWidth() {		return width;	}/** * Gets the colspan. * * @return	a value */	public int colspan() {		return colspan;	}/** * Gets the rowspan. * * @return	a value */	public int rowspan() {		return rowspan;	}/** * Gets the leading. * * @return	a value */	public float leading() {		if (Float.isNaN(leading)) {			return 16;		}		return leading;	}/** * Is this <CODE>Cell</CODE> a header? * * @return	a value */	public boolean header() {		return header;	}/** * Get nowrap. * * @return	a value */	public boolean noWrap() {		return noWrap;	}/** * Clears all the <CODE>Element</CODE>s of this <CODE>Cell</CODE>. */	public void clear() {		arrayList.clear();	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float top() {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float bottom() {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float left() {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float right() {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float top(int margin) {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float bottom(int margin) {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float left(int margin) {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public float right(int margin) {		throw new UnsupportedOperationException("Dimensions of a Cell can't be calculated. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public void setTop(int value) {		throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public void setBottom(int value) {		throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public void setLeft(int value) {		throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");	}/** * This method throws an <CODE>UnsupportedOperationException</CODE>. */	public void setRight(int value) {		throw new UnsupportedOperationException("Dimensions of a Cell are attributed automagically. See the FAQ.");	}/** * Checks if a given tag corresponds with this object. * * @param   tag     the given tag * @return  true if the tag corresponds */	public static boolean isTag(String tag) {		return ElementTags.CELL.equals(tag);	}/** Does this <CODE>Cell</CODE> force a group change? */	protected boolean groupChange = true;/** * Does this <CODE>Cell</CODE> force a group change? * * @return	a value */	public boolean getGroupChange() {		return groupChange;	}/** * Sets group change. * * @param	value	the new value */	public void setGroupChange(boolean value) {		groupChange = value;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -