📄 list.java
字号:
} else if (o instanceof String) { return this.add(new ListItem((String) o)); } return false; } // extra methods /** Makes sure all the items in the list have the same indentation. */ public void normalizeIndentation() { float max = 0; Element o; for (Iterator i = list.iterator(); i.hasNext(); ) { o = (Element)i.next(); if (o instanceof ListItem) { max = Math.max(max, ((ListItem)o).getIndentationLeft()); } } for (Iterator i = list.iterator(); i.hasNext(); ) { o = (Element)i.next(); if (o instanceof ListItem) { ((ListItem)o).setIndentationLeft(max); } } } // setters /** * @param numbered the numbered to set */ public void setNumbered(boolean numbered) { this.numbered = numbered; } /** * @param lettered the lettered to set */ public void setLettered(boolean lettered) { this.lettered = lettered; } /** * @param uppercase the uppercase to set */ public void setLowercase(boolean uppercase) { this.lowercase = uppercase; } /** * @param autoindent the autoindent to set */ public void setAutoindent(boolean autoindent) { this.autoindent = autoindent; } /** * @param alignindent the alignindent to set */ public void setAlignindent(boolean alignindent) { this.alignindent = alignindent; } /** * Sets the number that has to come first in the list. * * @param first a number */ public void setFirst(int first) { this.first = first; } /** * Sets the listsymbol. * * @param symbol a <CODE>Chunk</CODE> */ public void setListSymbol(Chunk symbol) { this.symbol = symbol; } /** * Sets the listsymbol. * <P> * This is a shortcut for <CODE>setListSymbol(Chunk symbol)</CODE>. * * @param symbol a <CODE>String</CODE> */ public void setListSymbol(String symbol) { this.symbol = new Chunk(symbol); } /** * Sets the indentation of this paragraph on the left side. * * @param indentation the new indentation */ public void setIndentationLeft(float indentation) { this.indentationLeft = indentation; } /** * Sets the indentation of this paragraph on the right side. * * @param indentation the new indentation */ public void setIndentationRight(float indentation) { this.indentationRight = indentation; } /** * @param symbolIndent the symbolIndent to set */ public void setSymbolIndent(float symbolIndent) { this.symbolIndent = symbolIndent; } // methods to retrieve information /** * Gets all the items in the list. * * @return an <CODE>ArrayList</CODE> containing <CODE>ListItem</CODE>s. */ public ArrayList getItems() { return list; } /** * Gets the size of the list. * * @return a <CODE>size</CODE> */ public int size() { return list.size(); } /** * Returns <CODE>true</CODE> if the list is empty. * * @return <CODE>true</CODE> if the list is empty */ public boolean isEmpty() { return list.isEmpty(); } /** * Gets the leading of the first listitem. * * @return a <CODE>leading</CODE> */ public float getTotalLeading() { if (list.size() < 1) { return -1; } ListItem item = (ListItem) list.get(0); return item.getTotalLeading(); } // getters /** * Checks if the list is numbered. * @return <CODE>true</CODE> if the list is numbered, <CODE>false</CODE> otherwise. */ public boolean isNumbered() { return numbered; } /** * Checks if the list is lettered. * @return <CODE>true</CODE> if the list is lettered, <CODE>false</CODE> otherwise. */ public boolean isLettered() { return lettered; } /** * Checks if the list lettering is lowercase. * @return <CODE>true</CODE> if it is lowercase, <CODE>false</CODE> otherwise. */ public boolean isLowercase() { return lowercase; } /** * Checks if the indentation of list items is done automatically. * @return the autoindent */ public boolean isAutoindent() { return autoindent; } /** * Checks if all the listitems should be aligned. * @return the alignindent */ public boolean isAlignindent() { return alignindent; } /** * Gets the first number . * @return a number */ public int getFirst() { return first; } /** * Gets the Chunk containing the symbol. * @return a Chunk with a symbol */ public Chunk getSymbol() { return symbol; } /** * Gets the indentation of this paragraph on the left side. * @return the indentation */ public float getIndentationLeft() { return indentationLeft; } /** * Gets the indentation of this paragraph on the right side. * @return the indentation */ public float getIndentationRight() { return indentationRight; } /** * Gets the symbol indentation. * @return the symbol indentation */ public float getSymbolIndent() { return symbolIndent; } /** * @see com.lowagie.text.Element#isContent() * @since iText 2.0.8 */ public boolean isContent() { return true; } /** * @see com.lowagie.text.Element#isNestable() * @since iText 2.0.8 */ public boolean isNestable() { return true; } /** * Returns the String that is after a number or letter in the list symbol. * @return the String that is after a number or letter in the list symbol * @since iText 2.1.1 */ public String getPostSymbol() { return postSymbol; } /** * Sets the String that has to be added after a number or letter in the list symbol. * @since iText 2.1.1 * @param postSymbol the String that has to be added after a number or letter in the list symbol. */ public void setPostSymbol(String postSymbol) { this.postSymbol = postSymbol; } /** * Returns the String that is before a number or letter in the list symbol. * @return the String that is before a number or letter in the list symbol * @since iText 2.1.1 */ public String getPreSymbol() { return preSymbol; } /** * Sets the String that has to be added before a number or letter in the list symbol. * @since iText 2.1.1 * @param preSymbol the String that has to be added before a number or letter in the list symbol. */ public void setPreSymbol(String preSymbol) { this.preSymbol = preSymbol; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -