diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/ICellContent.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/ICellContent.java index a05c45b727..b4fc157af8 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/ICellContent.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/ICellContent.java @@ -45,65 +45,206 @@ public interface ICellContent extends IContainerContent { IColumn getColumnInstance(); /** + * Get the row * - * @return + * @return Return the row */ int getRow(); + /** + * Set the column + * + * @param column + */ void setColumn(int column); + /** + * Set the row span + * + * @param rowSpan row span + */ void setRowSpan(int rowSpan); + /** + * Set the column span + * + * @param colSpan column span + */ void setColSpan(int colSpan); + /** + * Set display group icon + * + * @param displayGroupIcon display the group icon + */ void setDisplayGroupIcon(boolean displayGroupIcon); + /** + * Get the display group icon + * + * @return Return the display group icon + */ boolean getDisplayGroupIcon(); + /** + * Has diagonal line + * + * @return Return the check of diagonal line + */ boolean hasDiagonalLine(); + /** + * Get diagonal number + * + * @return Return the diagonal number + */ int getDiagonalNumber(); + /** + * Set diagnonal number + * + * @param diagonalNumber diagonal number + */ void setDiagonalNumber(int diagonalNumber); + /** + * Get diagonal style + * + * @return Return the diagonal style + */ String getDiagonalStyle(); + /** + * Set diagonal style + * + * @param diagonalStyle diagonal style + */ void setDiagonalStyle(String diagonalStyle); + /** + * Get the diagonal width + * + * @return Return the diagonal width + */ DimensionType getDiagonalWidth(); + /** + * Set the diagonal width + * + * @param diagonalWidth diagonal width + */ void setDiagonalWidth(DimensionType diagonalWidth); + /** + * Get the diagonal color + * + * @return Return the diagonal color + */ String getDiagonalColor(); + /** + * Set the diagonal color + * + * @param diagonalColor diagonal color + */ void setDiagonalColor(String diagonalColor); + /** + * Get the anti-diagonal number + * + * @return Return the anti-diagonal number + */ int getAntidiagonalNumber(); + /** + * Set the anti-diagonal number + * + * @param antidiagonalNumber anti-diagonal number + */ void setAntidiagonalNumber(int antidiagonalNumber); + /** + * Get the anti-diagonal style + * + * @return Return the anti-diagonal style + */ String getAntidiagonalStyle(); + /** + * Set the anti-diagonal style + * + * @param antidiagonalStyle anti-diagonal style + */ void setAntidiagonalStyle(String antidiagonalStyle); + /** + * Get the anti-diagonal width + * + * @return Return the anti-diagonal width + */ DimensionType getAntidiagonalWidth(); + /** + * Set the anti-diagonal width + * + * @param antidiagonalWidth anti-diagonal width + */ void setAntidiagonalWidth(DimensionType antidiagonalWidth); + /** + * Get the anti-diagonal color + * + * @return Return the anti-diagonal color + */ String getAntidiagonalColor(); + /** + * Set the anti-diagonal color + * + * @param antidiagonalColor anti-diagonal color + */ void setAntidiagonalColor(String antidiagonalColor); + /** + * Get the headers + * + * @return Return the headers + */ String getHeaders(); + /** + * Set the headers + * + * @param headers + */ void setHeaders(String headers); + /** + * Get the scope + * + * @return Return the scope + */ String getScope(); + /** + * Set the scope + * + * @param scope scope + */ void setScope(String scope); + /** + * Check if the content is repeatable + * + * @return Return the check result if content repeatable + */ boolean repeatContent(); + /** + * Set the repeat content + * + * @param repeatContent repeat content + */ void setRepeatContent(boolean repeatContent); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IReportContent.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IReportContent.java index a264d126b1..dd4c0d818b 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IReportContent.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/content/IReportContent.java @@ -61,17 +61,25 @@ public interface IReportContent { /** * Gets the toc tree of this report content. * + * @param format + * @param locale + * * @return the TOC Tree */ ITOCTree getTOCTree(String format, ULocale locale); /** - * return root content + * Get the root content * - * @return + * @return Return the root content */ IContent getRoot(); + /** + * Get the total page + * + * @return Return the total page + */ long getTotalPage(); /** @@ -142,14 +150,39 @@ public interface IReportContent { */ ITableContent createTableContent(); + /** + * Create the table group content + * + * @return Return the table group content + */ ITableGroupContent createTableGroupContent(); + /** + * Create the table band content + * + * @return Return the table band content + */ ITableBandContent createTableBandContent(); + /** + * Create the list content + * + * @return Return the list content + */ IListContent createListContent(); + /** + * Create the list group content + * + * @return Return the list group content + */ IListGroupContent createListGroupContent(); + /** + * Create the list band content + * + * @return Return the list band content + */ IListBandContent createListBandContent(); /** @@ -173,7 +206,7 @@ public interface IReportContent { * @param content the content template. * @return the text content. */ - ITextContent createTextContent(IContent conent); + ITextContent createTextContent(IContent content); /** * create the foreign content. the foreign content can only be used in this @@ -197,7 +230,7 @@ public interface IReportContent { * @param content the content template. * @return the image content. */ - IImageContent createImageContent(IContent conent); + IImageContent createImageContent(IContent content); /** * create the label content. the label can only be used in this report. @@ -220,7 +253,7 @@ public interface IReportContent { * @param content the content template. * @return the label content. */ - ILabelContent createLabelContent(IContent conent); + ILabelContent createLabelContent(IContent content); /** * create the data content. the data can only be used in this report. @@ -236,10 +269,20 @@ public interface IReportContent { * @param content the content template. * @return the data content. */ - IDataContent createDataContent(IContent conent); + IDataContent createDataContent(IContent content); + /** + * Get the ACL + * + * @return Return the ACL + */ String getACL(); + /** + * Set the ACL + * + * @param acl + */ void setACL(String acl); /** @@ -248,16 +291,49 @@ public interface IReportContent { */ IReportContext getReportContext(); + /** + * Get the user properties + * + * @return Return the user properties + */ Map getUserProperties(); + /** + * Get the extensions + * + * @return Return the extensions + */ Map getExtensions(); + /** + * Set the extensions + * + * @param properties properties of extensions + */ void setExtensions(Map properties); + /** + * Write the content + * + * @param out output stream + * @throws IOException + */ void writeContent(DataOutputStream out) throws IOException; + /** + * Read content + * + * @param in input stream + * @param loader class loader + * @throws IOException + */ void readContent(DataInputStream in, ClassLoader loader) throws IOException; + /** + * Get the title + * + * @return Return the title + */ String getTitle(); void setTitle(String title); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java index f7be93b873..af864cc6ff 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/AbstractStyle.java @@ -40,7 +40,7 @@ abstract public class AbstractStyle implements IStyle { protected CSSEngine engine; /** - * Consructor + * Constructor * * @param engine */ diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/ComputedStyle.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/ComputedStyle.java index 162cba3a0e..d809eeff2b 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/ComputedStyle.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/dom/ComputedStyle.java @@ -21,12 +21,23 @@ import org.eclipse.birt.report.engine.css.engine.value.Value; import org.w3c.dom.css.CSSValue; +/** + * Computed style + * + * @since 3.3 + * + */ public class ComputedStyle extends AbstractStyle { Map cachedStyles = new HashMap<>(); boolean[] caculated; CSSStylableElement elt; CSSValue[] values; + /** + * Constructor + * + * @param elt stylable element + */ public ComputedStyle(CSSStylableElement elt) { super(elt.getCSSEngine()); this.elt = elt; @@ -80,11 +91,23 @@ public void setProperty(int index, CSSValue value) { elt.getStyle().setProperty(index, value); } + /** + * Add cached style + * + * @param styleClass style class names + * @param style computed style + */ public void addCachedStyle(String styleClass, ComputedStyle style) { cachedStyles.put(styleClass, style); } + /** + * Get the cached style + * + * @param styleClass style class name + * @return Return the cached style + */ public ComputedStyle getCachedStyle(String styleClass) { - return (ComputedStyle) cachedStyles.get(styleClass); + return cachedStyles.get(styleClass); } } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractColorManager.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractColorManager.java index 4c0b635ef0..1f75915cbb 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractColorManager.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractColorManager.java @@ -14,7 +14,6 @@ package org.eclipse.birt.report.engine.css.engine.value; -import org.apache.batik.css.engine.StyleMap; import org.eclipse.birt.report.engine.css.engine.CSSEngine; import org.eclipse.birt.report.engine.css.engine.CSSStylableElement; import org.eclipse.birt.report.engine.css.engine.ValueManager; @@ -42,6 +41,11 @@ public abstract class AbstractColorManager extends IdentifierManager { addColorIndent(values); } + /** + * Add color indent + * + * @param values string map to add colors + */ public static void addColorIndent(StringMap values) { // color keywords values.put(CSSConstants.CSS_AQUA_VALUE, CSSValueConstants.AQUA_VALUE); @@ -137,12 +141,12 @@ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { /** * Implements - * {@link ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. + * {@link ValueManager#computeValue(CSSStylableElement,CSSEngine,int,Value)}. */ @Override public Value computeValue(CSSStylableElement elt, CSSEngine engine, int idx, Value value) { if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) { - CSSPrimitiveValue pvalue = (CSSPrimitiveValue) value; + CSSPrimitiveValue pvalue = value; int primitiveType = pvalue.getPrimitiveType(); if (primitiveType == CSSPrimitiveValue.CSS_IDENT) { String ident = pvalue.getStringValue(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractLengthManager.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractLengthManager.java index aab5091070..ae10b0b5ee 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractLengthManager.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractLengthManager.java @@ -14,10 +14,9 @@ package org.eclipse.birt.report.engine.css.engine.value; -import org.apache.batik.css.engine.StyleMap; -import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.css.engine.CSSEngine; import org.eclipse.birt.report.engine.css.engine.CSSStylableElement; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.ValueManager; import org.w3c.css.sac.LexicalUnit; import org.w3c.dom.DOMException; @@ -75,7 +74,7 @@ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { /** * Implements - * {@link ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. + * {@link ValueManager#computeValue(CSSStylableElement,CSSEngine,int,Value)}. */ @Override public Value computeValue(CSSStylableElement elt, CSSEngine engine, int idx, Value value) { @@ -92,13 +91,13 @@ public Value computeValue(CSSStylableElement elt, CSSEngine engine, int idx, Val case CSSPrimitiveValue.CSS_EMS: float v = value.getFloatValue(); - Value fontSize = (Value) elt.getComputedStyle().getProperty(IStyle.STYLE_FONT_SIZE); + Value fontSize = (Value) elt.getComputedStyle().getProperty(StyleConstants.STYLE_FONT_SIZE); float fs = fontSize.getFloatValue(); return new FloatValue(fontSize.getPrimitiveType(), v * fs); case CSSPrimitiveValue.CSS_EXS: v = value.getFloatValue(); - fontSize = (Value) elt.getComputedStyle().getProperty(IStyle.STYLE_FONT_SIZE); + fontSize = (Value) elt.getComputedStyle().getProperty(StyleConstants.STYLE_FONT_SIZE); fs = fontSize.getFloatValue(); return new FloatValue(fontSize.getPrimitiveType(), v * fs * 0.5f); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueFactory.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueFactory.java index 6995c30c06..c15352d629 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueFactory.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueFactory.java @@ -23,7 +23,9 @@ public abstract class AbstractValueFactory { /** - * Returns the name of the property handled. + * Get the name of the property handled. + * + * @return Returns the name of the property handled. */ public abstract String getPropertyName(); @@ -58,7 +60,7 @@ protected DOMException createInvalidFloatTypeDOMException(short t) { * Creates a DOM exception, given an invalid float value. */ protected DOMException createInvalidFloatValueDOMException(float f) { - Object[] p = { getPropertyName(), new Float(f) }; + Object[] p = { getPropertyName(), Float.valueOf(f) }; String s = Messages.formatMessage("invalid.float.value", p); return new DOMException(DOMException.INVALID_ACCESS_ERR, s); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueManager.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueManager.java index f8b8ffad97..49abf86722 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueManager.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/AbstractValueManager.java @@ -14,7 +14,6 @@ package org.eclipse.birt.report.engine.css.engine.value; -import org.apache.batik.css.engine.StyleMap; import org.eclipse.birt.report.engine.css.engine.CSSEngine; import org.eclipse.birt.report.engine.css.engine.CSSStylableElement; import org.eclipse.birt.report.engine.css.engine.ValueManager; @@ -26,7 +25,7 @@ public abstract class AbstractValueManager extends AbstractValueFactory implements ValueManager { /** * Implements - * {@link ValueManager#computeValue(CSSStylableElement,String,CSSEngine,int,StyleMap,Value)}. + * {@link ValueManager#computeValue(CSSStylableElement,CSSEngine,int,Value)}. */ @Override public Value computeValue(CSSStylableElement elt, CSSEngine engine, int idx, Value value) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/DataFormatValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/DataFormatValue.java index 71f5078702..662fd5b648 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/DataFormatValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/DataFormatValue.java @@ -22,6 +22,12 @@ import org.eclipse.birt.core.util.IOUtil; import org.w3c.dom.css.CSSValue; +/** + * Date format value + * + * @since 3.3 + * + */ public class DataFormatValue extends Value implements Serializable, Cloneable { final static long serialVersionUID = 0x35ab0c3879c21567L; @@ -38,6 +44,9 @@ public class DataFormatValue extends Value implements Serializable, Cloneable { protected FormatValue[] values; + /** + * Constructor + */ public DataFormatValue() { values = new FormatValue[FORMATS]; } @@ -47,14 +56,30 @@ public short getCssValueType() { return CSSValue.CSS_CUSTOM; } + /** + * Get the string format + * + * @return Returns the string format + */ public FormatValue getStringFormat() { return values[STRING_FORMAT]; } + /** + * Set the string format + * + * @param pattern pattern-string + * @param locale pattern-locale + */ public void setStringFormat(String pattern, String locale) { values[STRING_FORMAT] = new FormatValue(pattern, locale); } + /** + * Get the string pattern + * + * @return Return the string pattern + */ public String getStringPattern() { if (values[STRING_FORMAT] == null) { return null; @@ -62,6 +87,11 @@ public String getStringPattern() { return values[STRING_FORMAT].pattern; } + /** + * Get the string locale + * + * @return Return the string local + */ public String getStringLocale() { if (values[STRING_FORMAT] == null) { return null; @@ -69,14 +99,30 @@ public String getStringLocale() { return values[STRING_FORMAT].locale; } + /** + * Get the number format + * + * @return Return the number format + */ public FormatValue getNumberFormat() { return values[NUMBER_FORMAT]; } + /** + * Set the number format + * + * @param pattern pattern-string + * @param locale pattern-locale + */ public void setNumberFormat(String pattern, String locale) { values[NUMBER_FORMAT] = new FormatValue(pattern, locale); } + /** + * Get the number pattern + * + * @return Return the number pattern + */ public String getNumberPattern() { if (values[NUMBER_FORMAT] == null) { return null; @@ -84,6 +130,11 @@ public String getNumberPattern() { return values[NUMBER_FORMAT].pattern; } + /** + * Get the number locale + * + * @return Return the number locale + */ public String getNumberLocale() { if (values[NUMBER_FORMAT] == null) { return null; @@ -91,14 +142,30 @@ public String getNumberLocale() { return values[NUMBER_FORMAT].locale; } + /** + * Get the date format + * + * @return Return the date format + */ public FormatValue getDateFormat() { return values[DATE_FORMAT]; } + /** + * Set the date format + * + * @param pattern pattern-string + * @param locale pattern-locale + */ public void setDateFormat(String pattern, String locale) { values[DATE_FORMAT] = new FormatValue(pattern, locale); } + /** + * Get the date pattern + * + * @return Return the date pattern + */ public String getDatePattern() { if (values[DATE_FORMAT] == null) { return null; @@ -106,6 +173,11 @@ public String getDatePattern() { return values[DATE_FORMAT].pattern; } + /** + * Get the date locale + * + * @return Return the date locale + */ public String getDateLocale() { if (values[DATE_FORMAT] == null) { return null; @@ -113,14 +185,30 @@ public String getDateLocale() { return values[DATE_FORMAT].locale; } + /** + * Get the time format + * + * @return Return the time format + */ public FormatValue getTimeFormat() { return values[TIME_FORMAT]; } + /** + * Set the time format + * + * @param pattern pattern-string + * @param locale pattern-locale + */ public void setTimeFormat(String pattern, String locale) { values[TIME_FORMAT] = new FormatValue(pattern, locale); } + /** + * Get the time pattern + * + * @return Return the time pattern + */ public String getTimePattern() { if (values[TIME_FORMAT] == null) { return null; @@ -128,6 +216,11 @@ public String getTimePattern() { return values[TIME_FORMAT].pattern; } + /** + * Get the time locale + * + * @return Return the time locale + */ public String getTimeLocale() { if (values[TIME_FORMAT] == null) { return null; @@ -135,14 +228,30 @@ public String getTimeLocale() { return values[TIME_FORMAT].locale; } + /** + * Get the date time format + * + * @return Return the date time format + */ public FormatValue getDateTimeFormat() { return values[DATETIME_FORMAT]; } + /** + * Set the date time format + * + * @param pattern pattern-string + * @param locale pattern-locale + */ public void setDateTimeFormat(String pattern, String locale) { values[DATETIME_FORMAT] = new FormatValue(pattern, locale); } + /** + * Get the date time pattern + * + * @return Return the date time pattern + */ public String getDateTimePattern() { if (values[DATETIME_FORMAT] == null) { return null; @@ -150,6 +259,11 @@ public String getDateTimePattern() { return values[DATETIME_FORMAT].pattern; } + /** + * Get the date time locale + * + * @return Return the date time locale + */ public String getDateTimeLocale() { if (values[DATETIME_FORMAT] == null) { return null; @@ -167,7 +281,13 @@ public DataFormatValue clone() { return null; } - // utility to serialize/deserialize a DataFormatValue + /** + * Utility to serialize/deserialize a DataFormatValue + * + * @param out output stream + * @param value date format value + * @throws IOException + */ public static void write(DataOutputStream out, DataFormatValue value) throws IOException { IOUtil.writeInt(out, VERSION_0); if (value != null) { @@ -183,6 +303,13 @@ public static void write(DataOutputStream out, DataFormatValue value) throws IOE IOUtil.writeInt(out, ENDING_TAG); } + /** + * Read the date format value from intput stream + * + * @param in data input stream + * @return Return the date format value from the input stream + * @throws IOException + */ public static DataFormatValue read(DataInputStream in) throws IOException { int version = IOUtil.readInt(in); if (version == VERSION_0) { @@ -199,6 +326,12 @@ public static DataFormatValue read(DataInputStream in) throws IOException { return null; } + /** + * Create the date format value + * + * @param oldValue original date format value + * @return Return the date format value + */ public static DataFormatValue createDataFormatValue(DataFormatValue oldValue) { if (oldValue == null) { return new DataFormatValue(); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/FloatValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/FloatValue.java index b9969c2acd..155b3c1bc3 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/FloatValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/FloatValue.java @@ -30,7 +30,11 @@ public class FloatValue extends Value implements CSSPrimitiveValue { private final static DecimalFormat FORMATTER = new DecimalFormat("#.###", new DecimalFormatSymbols(Locale.ENGLISH)); /** - * Returns the CSS text associated with the given type/value pair. + * Get the CSS text associated with the given type/value pair. + * + * @param unit + * @param value + * @return Returns the CSS text associated with the given type/value pair. */ public static String getCssText(short unit, float value) { if (unit < 0 || unit >= UNITS.length) { @@ -58,6 +62,9 @@ public static String getCssText(short unit, float value) { /** * Creates a new value. + * + * @param unitType unit type + * @param floatValue float value */ public FloatValue(short unitType, float floatValue) { this.unitType = unitType; @@ -103,6 +110,10 @@ public String toString() { /** * Converts the actual float value to the given unit type. + * + * @param unitType unit type + * @param value float value + * @return Return the float value */ public static float convertFloatValue(short unitType, FloatValue value) { switch (unitType) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/IdentifierManager.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/IdentifierManager.java index a745d4c8da..1f751ce9de 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/IdentifierManager.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/IdentifierManager.java @@ -50,7 +50,7 @@ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { } } - protected Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { + protected Value createStringValue(short type, String value) throws DOMException { if (type != CSSPrimitiveValue.CSS_IDENT) { throw createInvalidStringTypeDOMException(type); } @@ -62,8 +62,11 @@ protected Value createStringValue(short type, String value, CSSEngine engine) th } /** - * Returns the map that contains the name/value mappings for each possible + * Get the map that contains the name/value mappings for each possible * identifiers. + * + * @return Returns the map that contains the name/value mappings for each + * possible identifiers. */ public abstract StringMap getIdentifiers(); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/ListValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/ListValue.java index a5b71a7474..ace0256256 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/ListValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/ListValue.java @@ -48,13 +48,17 @@ public ListValue() { /** * Creates a ListValue with the given separator. + * + * @param s separator */ public ListValue(char s) { separator = s; } /** - * Returns the separator used for this list. + * Get the separator used for this list. + * + * @return Returns the separator used for this list. */ public char getSeparatorChar() { return separator; @@ -132,22 +136,15 @@ protected String encodeString(String value) { } if (needQuote) { return '\"' + value + '\"'; - } else { - return value; } + return value; } - /** - * Implements {@link Value#getLength()}. - */ @Override public int getLength() throws DOMException { return length; } - /** - * Implements {@link Value#item(int)}. - */ @Override public CSSValue item(int index) throws DOMException { return items[index]; @@ -163,6 +160,8 @@ public String toString() { /** * Appends an item to the list. + * + * @param v CSS value */ public void append(CSSValue v) { if (length == items.length) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RGBColorValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RGBColorValue.java index b9ed4c771c..89d6ad7be8 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RGBColorValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RGBColorValue.java @@ -41,6 +41,10 @@ public class RGBColorValue extends Value implements RGBColor { /** * Creates a new RGBColorValue. + * + * @param r red color value + * @param g green color value + * @param b blue color value */ public RGBColorValue(CSSPrimitiveValue r, CSSPrimitiveValue g, CSSPrimitiveValue b) { red = r; @@ -64,25 +68,16 @@ public String getCssText() { return "rgb(" + red.getCssText() + ", " + green.getCssText() + ", " + blue.getCssText() + ")"; } - /** - * Implements {@link Value#getRed()}. - */ @Override public CSSPrimitiveValue getRed() throws DOMException { return red; } - /** - * Implements {@link Value#getGreen()}. - */ @Override public CSSPrimitiveValue getGreen() throws DOMException { return green; } - /** - * Implements {@link Value#getBlue()}. - */ @Override public CSSPrimitiveValue getBlue() throws DOMException { return blue; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RectValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RectValue.java index 792d3df3a5..38dc9ae349 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RectValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/RectValue.java @@ -45,7 +45,12 @@ public class RectValue extends Value implements Rect { protected Value left; /** - * Creates a new Rect value. + * Creates a new rectangle value. + * + * @param t top + * @param r right + * @param b bottom + * @param l left */ public RectValue(Value t, Value r, Value b, Value l) { top = t; @@ -71,33 +76,21 @@ public String getCssText() { + left.getCssText() + ")"; } - /** - * Implements {@link Value#getTop()}. - */ @Override public CSSPrimitiveValue getTop() throws DOMException { return top; } - /** - * Implements {@link Value#getRight()}. - */ @Override public CSSPrimitiveValue getRight() throws DOMException { return right; } - /** - * Implements {@link Value#getBottom()}. - */ @Override public CSSPrimitiveValue getBottom() throws DOMException { return bottom; } - /** - * Implements {@link Value#getLeft()}. - */ @Override public CSSPrimitiveValue getLeft() throws DOMException { return left; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringMap.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringMap.java index a56d9d2a77..736aba3a99 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringMap.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringMap.java @@ -70,6 +70,8 @@ public StringMap(StringMap t) { /** * Gets the value corresponding to the given string. * + * @param key string key + * * @return the value or null */ public Object get(String key) { @@ -87,6 +89,9 @@ public Object get(String key) { /** * Sets a new value for the given variable * + * @param key string key + * @param value + * * @return the old value or null */ public Object put(String key, Object value) { @@ -160,6 +165,11 @@ protected static class Entry { /** * Creates a new entry + * + * @param hash hash value + * @param key string key + * @param value object value + * @param next next entry */ public Entry(int hash, String key, Object value, Entry next) { this.hash = hash; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringValue.java index 3fe3909637..002d9ef8dd 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/StringValue.java @@ -33,6 +33,9 @@ public class StringValue extends Value { /** * Creates a new StringValue. + * + * @param type unit type + * @param s string value */ public StringValue(short type, String s) { unitType = type; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/URIValue.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/URIValue.java index f8ca13dfce..c9b9184e41 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/URIValue.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/URIValue.java @@ -17,12 +17,14 @@ import org.w3c.dom.css.CSSPrimitiveValue; /** - * This class represents uri values. + * This class represents URI values. * */ public class URIValue extends StringValue { /** * Creates a new StringValue. + * + * @param uri URI string */ public URIValue(String uri) { super(CSSPrimitiveValue.CSS_URI, uri); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/Value.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/Value.java index 9ad0466783..a9c869eb01 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/Value.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/Value.java @@ -55,6 +55,12 @@ public float getFloatValue(short unitType) throws DOMException { throw createDOMException(); } + /** + * Get the float value + * + * @return Return the float value + * @throws DOMException + */ public float getFloatValue() throws DOMException { throw createDOMException(); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/URIManager.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/URIManager.java index 98ec99d489..057c7df2e1 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/URIManager.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/css/engine/value/css/URIManager.java @@ -45,6 +45,13 @@ public class URIManager extends IdentifierManager { protected Value defaultValue; protected boolean inherit; + /** + * Constructor + * + * @param propertyName + * @param inherit + * @param defaultValue + */ public URIManager(String propertyName, boolean inherit, Value defaultValue) { this.propertyName = propertyName; this.defaultValue = defaultValue; @@ -79,7 +86,13 @@ public Value getDefaultValue() { } /** - * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. + * Create URI value Implements + * {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. + * + * @param value URI string + * @param engine CSS engine + * @return Return + * @throws DOMException */ public Value createValue(String value, CSSEngine engine) throws DOMException { return new URIValue(value); @@ -93,7 +106,7 @@ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { if (lu.getLexicalUnitType() == LexicalUnit.SAC_URI) { return new URIValue(lu.getStringValue()); } - return createStringValue(lu.getLexicalUnitType(), lu.getStringValue(), engine); + return createStringValue(lu.getLexicalUnitType(), lu.getStringValue()); } /* @@ -104,7 +117,7 @@ public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { * short, java.lang.String, org.eclipse.birt.report.engine.css.engine.CSSEngine) */ @Override - public Value createStringValue(short type, String value, CSSEngine engine) throws DOMException { + public Value createStringValue(short type, String value) throws DOMException { return new StringValue(CSSPrimitiveValue.CSS_STRING, value); } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Cell.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Cell.java index 95cdbcf94c..b35e31a31d 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Cell.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Cell.java @@ -20,10 +20,24 @@ */ public class Cell { + /** + * Content interface + * + * @since 3.3 + * + */ public interface Content { + /** + * Check if the content is empty + * + * @return Return the check result if the content is empty + */ boolean isEmpty(); + /** + * Reset the content + */ void reset(); } @@ -79,15 +93,30 @@ Cell getCell() { return this; } + /** + * Get the status + * + * @return Return the status + */ public int getStatus() { return this.status; } + /** + * Get the cell content + * + * @return Return the cell content + */ public Content getContent() { Cell cell = getCell(); return (Content) cell.content; } + /** + * Get the row id + * + * @return Return the row id + */ public int getRowId() { if (status == CELL_SPANED) { Cell cell = getCell(); @@ -99,6 +128,11 @@ public int getRowId() { return rowId; } + /** + * Get the column id + * + * @return Return the column id + */ public int getColId() { if (status == CELL_SPANED) { Cell cell = getCell(); @@ -110,6 +144,11 @@ public int getColId() { return colId; } + /** + * Get the left row span + * + * @return Return the left row span + */ public int getLeftRowSpan() { if (status == CELL_USED) { return rowSpan; @@ -127,6 +166,11 @@ public int getLeftRowSpan() { return rowSpan; } + /** + * Get the row span + * + * @return Return the row span + */ public int getRowSpan() { if (status == CELL_USED) { return rowSpan; @@ -144,6 +188,11 @@ public int getRowSpan() { return rowSpan; } + /** + * Get the column span + * + * @return Return the column span + */ public int getColSpan() { if (status == CELL_USED) { return colSpan; diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Row.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Row.java index 4b1af58f4d..5b5dafface 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Row.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Row.java @@ -37,14 +37,30 @@ public class Row { this.rowId = rowId; } + /** + * Get the content + * + * @return Return the content + */ public Object getContent() { return content; } + /** + * Get the cell based on cell id + * + * @param cellId cell id + * @return Return a cell + */ public Cell getCell(int cellId) { return cells[cellId]; } + /** + * Get the row id + * + * @return Return the row id + */ public int getRowId() { return rowId; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Table.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Table.java index e88e981b22..dc21423f1b 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Table.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/Table.java @@ -40,6 +40,12 @@ public class Table { int rowBufferSize; int colBufferSize; + /** + * Constructor + * + * @param rowSize row size + * @param colSize column size + */ public Table(int rowSize, int colSize) { nextColId = -1; rowCount = 0; @@ -47,6 +53,9 @@ public Table(int rowSize, int colSize) { ensureSize(rowSize, colSize); } + /** + * Constructor + */ public Table() { nextColId = -1; rowCount = 0; @@ -65,10 +74,20 @@ public void reset() { colCount = 0; } + /** + * Get the row count + * + * @return Return the row count + */ public int getRowCount() { return rowCount; } + /** + * Get the column count + * + * @return Return the column count + */ public int getColCount() { return colCount; } @@ -168,6 +187,9 @@ public void createCell(int cellId, int rowSpan, int colSpan, Cell.Content conten } } + /** + * Resolve dropped cells + */ public void resolveDropCells() { if (rowCount <= 0) { return; @@ -184,6 +206,11 @@ public void resolveDropCells() { } } + /** + * Resolve dropped cells + * + * @param bandId band id + */ public void resolveDropCells(int bandId) { if (rowCount <= 0) { return; @@ -203,6 +230,11 @@ public void resolveDropCells(int bandId) { } } + /** + * Check if the table has dropped cells + * + * @return Return the check result of dropped cells + */ public boolean hasDropCell() { if (rowCount <= 0) { return false; @@ -223,9 +255,9 @@ public boolean hasDropCell() { } /** - * get the next empty cell. + * Get the next empty cell * - * @return + * @return Return the next empty cell */ protected int getNextEmptyCell() { assert rowCount > 0; @@ -298,11 +330,10 @@ protected void ensureSize(int newRowBufferSize, int newColBufferSize) { } /** - * remove the cell from table layout buffer. The grid cell used by this cell + * Remove the cell from table layout buffer. The grid cell used by this cell * fills EMPTY_CELL. * - * @param rowId row index - * @param colId column index + * @param cell cell to be removed */ protected void removeCell(Cell cell) { int rowId = cell.rowId; @@ -372,10 +403,23 @@ protected void resizeCell(Cell cell, int newRowSpan, int newColSpan) { cell.rowSpan = newRowSpan; } + /** + * Get the cell based on row and column id + * + * @param rowId row id + * @param colId column id + * @return Return a cell + */ public Cell getCell(int rowId, int colId) { return rows[rowId].cells[colId]; } + /** + * Get the row based on row id + * + * @param rowId row id + * @return Return a row + */ public Row getRow(int rowId) { return rows[rowId]; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/TableContentLayout.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/TableContentLayout.java index 56fefdfbe1..79dc87d52a 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/TableContentLayout.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/executor/buffermgr/TableContentLayout.java @@ -36,8 +36,15 @@ import org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.CellContent; import org.eclipse.birt.report.engine.presentation.UnresolvedRowHint; +/** + * Table content layout + * + * @since 3.3 + * + */ public class TableContentLayout { + /** property: maximum row span */ public final Integer MAX_ROW_SPAN = 10000; /** * rows in the table layout @@ -55,7 +62,7 @@ public class TableContentLayout { String format; ArrayList hiddenColumnIds = new ArrayList(); - ArrayList visibleColumns = new ArrayList(); + ArrayList visibleColumns = new ArrayList(); protected UnresolvedRowHint rowHint; @@ -79,6 +86,14 @@ public class TableContentLayout { protected boolean needFormalize = false; + /** + * Constructor + * + * @param tableContent table content + * @param format format + * @param context HTML layout context + * @param keyString key string + */ public TableContentLayout(ITableContent tableContent, String format, HTMLLayoutContext context, String keyString) { this.format = format; this.context = context; @@ -87,10 +102,8 @@ public TableContentLayout(ITableContent tableContent, String format, HTMLLayoutC this.colCount = tableContent.getColumnCount(); - int start = 0; - int end = this.colCount; String tableId = tableContent.getInstanceID().toUniqueString(); - List hints = context.getPageHintManager().getTableColumnHint(tableId); + List hints = context.getPageHintManager().getTableColumnHint(tableId); this.adjustedColumnIds = new int[colCount]; for (int i = 0; i < colCount; i++) { @@ -99,7 +112,7 @@ public TableContentLayout(ITableContent tableContent, String format, HTMLLayoutC if (hints.size() > 0) { int current = -1; - Iterator iter = hints.iterator(); + Iterator iter = hints.iterator(); while (iter.hasNext()) { int[] hint = (int[]) iter.next(); for (int i = hint[0]; i < hint[1]; i++) { @@ -149,14 +162,29 @@ public TableContentLayout(ITableContent tableContent, String format, HTMLLayoutC this.realColCount = visibleColumns.size(); } + /** + * Get the key string + * + * @return Return the key string + */ public String getKeyString() { return keyString; } + /** + * Set unresolved row hint + * + * @param rowHint row hint + */ public void setUnresolvedRowHint(UnresolvedRowHint rowHint) { this.rowHint = rowHint; } + /** + * end row + * + * @param rowContent row content + */ public void endRow(IRowContent rowContent) { if (isRowHidden) { return; @@ -226,26 +254,48 @@ public void reset() { isRowHidden = false; } + /** + * Get the row count + * + * @return Return the row count + */ public int getRowCount() { return rowCount; } + /** + * Get the column count + * + * @return Return the column count + */ public int getColCount() { return realColCount; } + /** + * Check if the cache is exceeded + * + * @return Return the check result of exceeded cache + */ public boolean exceedMaxCache() { return this.rowCount >= MAX_ROW_SPAN; } + /** + * Set flag of need formalize + * + * @param formalize formalize is needed + */ public void setNeedFormalize(boolean formalize) { this.needFormalize = formalize; } /** - * create a row in the table model + * Create a row in the table model * - * @param content row content + * @param rowContent row content + * @param isHidden hidden flag + * @return Return the created row */ public Row createRow(Object rowContent, boolean isHidden) { if (!isHidden) { @@ -279,7 +329,7 @@ public Row createRow(Object rowContent, boolean isHidden) { if (rowCount > 0) { // update the status of last row Cell[] lastCells = rows[rowCount - 1].cells; - HashSet updated = new HashSet(); + HashSet updated = new HashSet(); for (int cellId = 0; cellId < realColCount; cellId++) { Cell lastCell = lastCells[cellId]; if (lastCell.status == Cell.CELL_SPANED) { @@ -362,6 +412,12 @@ public void createCell(int cellId, int rowSpan, int colSpan, Cell.Content conten } + /** + * Resolve the dropped cells + * + * @param finished finished flag + * + */ public void resolveDropCells(boolean finished) { if (!finished) { keepUnresolvedCells(); @@ -381,6 +437,12 @@ public void resolveDropCells(boolean finished) { } } + /** + * Resolve the dropped cells + * + * @param bandId band id + * @param finished finished flag + */ public void resolveDropCells(int bandId, boolean finished) { if (rowCount <= 0) { return; @@ -401,10 +463,20 @@ public void resolveDropCells(int bandId, boolean finished) { } } + /** + * Check if unresolved rows exists + * + * @return Return the check result of unresolved rows + */ public boolean hasUnResolvedRow() { return rowHint != null; } + /** + * Check if dropped cells exists + * + * @return Return the check result of dropped cells + */ public boolean hasDropCell() { if (rowCount <= 0) { return false; @@ -524,10 +596,23 @@ protected void resizeCell(Cell cell, int newRowSpan, int newColSpan) { cell.rowSpan = newRowSpan; } + /** + * Get cells based on row and column index + * + * @param rowIndex row index + * @param colIndex column index + * @return Return the cell + */ public Cell getCell(int rowIndex, int colIndex) { return rows[rowIndex].cells[colIndex]; } + /** + * Get the row based on index + * + * @param index row index + * @return Return the row based on index + */ public Row getRow(int index) { assert (index >= 0 && index < rowCount); return rows[index]; @@ -542,6 +627,11 @@ private boolean isColumnHidden(IColumn column) { return LayoutUtil.isHidden(column, format, context.getOutputDisplayNone(), hiddenMask); } + /** + * Get the unresolved row hint + * + * @return Return the unresolved row hint + */ public UnresolvedRowHint getUnresolvedRow() { return rowHint; @@ -585,10 +675,21 @@ protected void keepUnresolvedCells() { } + /** + * Get current row id + * + * @return Return the current row id + */ public int getCurrentRowID() { return rowCount - 1; } + /** + * Is the table content visible + * + * @param cell cell content + * @return Return the check result if the object is visible + */ public boolean isVisible(ICellContent cell) { IElement parent = cell.getParent(); // For fixed layout reports and in run task, we need to emit the @@ -643,14 +744,24 @@ public Cell createCell(int colId, Row row) { } + /** + * Get the wrapped table content + * + * @return Return the wrapped table content + */ public ITableContent getWrappedTableContent() { if (wrappedTable != null) { return wrappedTable; - } else { - return tableContent; } + return tableContent; } + /** + * Get the wrapped cell content + * + * @param cellContent cell content + * @return Return the wrapped cell content + */ public ICellContent getWrappedCellContent(ICellContent cellContent) { if (needWrap(cellContent)) { CellContentWrapper cellContentWrapper = new CellContentWrapper(cellContent); @@ -659,10 +770,8 @@ public ICellContent getWrappedCellContent(ICellContent cellContent) { cellContentWrapper.setColumn(getAdjustedColumnId(columnId)); cellContentWrapper.setColSpan(getAdjustedColumnSpan(columnId, columnSpan)); return cellContentWrapper; - } else { - return cellContent; } - + return cellContent; } private boolean needWrap(ICellContent cellContent) { @@ -674,6 +783,12 @@ private boolean needWrap(ICellContent cellContent) { return false; } + /** + * Get the column id with check of wrapped table + * + * @param columnId column id + * @return Return the column id + */ public int getColumnId(int columnId) { if (this.wrappedTable != null) { return getAdjustedColumnId(columnId); @@ -681,6 +796,13 @@ public int getColumnId(int columnId) { return columnId; } + /** + * Get the column span + * + * @param columnId column id + * @param columnSpan column span + * @return Return the column span + */ public int getColunmSpan(int columnId, int columnSpan) { if (this.wrappedTable != null) { return getAdjustedColumnSpan(columnId, columnSpan); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/ReportItemDesign.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/ReportItemDesign.java index 28bb12cea3..f0ef649753 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/ReportItemDesign.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/ReportItemDesign.java @@ -104,6 +104,9 @@ abstract public class ReportItemDesign extends StyledElementDesign { */ protected String altTextKey; + /** + * Constructor + */ public ReportItemDesign() { } @@ -166,26 +169,42 @@ public void setY(DimensionType y) { /** * accept a visitor. see visit pattern. * - * @param visitor + * @param visitor report item visitor + * @param value + * @return Return the accepted object */ abstract public Object accept(IReportItemVisitor visitor, Object value); + /** + * Get the TOC + * + * @return Return the TOC + */ public Expression getTOC() { return toc; } + /** + * Set the TOC + * + * @param expr expression of TOC + */ public void setTOC(Expression expr) { this.toc = expr; } /** - * @return Returns the boo-kmark. + * Get the bookmarks + * + * @return Returns the bookmark. */ public Expression getBookmark() { return bookmark; } /** + * Set the bookmarks + * * @param bookmark The book-mark to set. */ public void setBookmark(Expression bookmark) { @@ -193,6 +212,8 @@ public void setBookmark(Expression bookmark) { } /** + * Get the queries + * * @return Returns the queries. */ public IDataQueryDefinition[] getQueries() { @@ -200,7 +221,9 @@ public IDataQueryDefinition[] getQueries() { } /** - * @param query The queries to set. + * Set the queries + * + * @param queries The queries to set. */ public void setQueries(IDataQueryDefinition[] queries) { this.queries = queries; @@ -231,21 +254,27 @@ public Expression getOnCreate() { } /** - * @param onCreate The onCreate to set. + * The onCreate script to set + * + * @param expr expression of onCreate */ public void setOnCreate(Expression expr) { onCreate = expr; } /** - * @return Returns the onRender. + * Get the onRender script + * + * @return Returns the onRender script */ public Expression getOnRender() { return onRender; } /** - * @param onPageBreak The onPageBreak to set. + * Set the onPageBreak script + * + * @param expr expression of onPageBreak */ public void setOnPageBreak(Expression expr) { onPageBreak = expr; @@ -259,7 +288,9 @@ public Expression getOnPageBreak() { } /** - * @param onRender The onRender to set. + * Set the onRender script + * + * @param expr expression of onRender */ public void setOnRender(Expression expr) { onRender = expr; @@ -293,14 +324,30 @@ public void setAction(ActionDesign action) { this.action = action; } + /** + * Set the use cache result + * + * @param useCachedResult use cache + */ public void setUseCachedResult(boolean useCachedResult) { this.useCachedResult = useCachedResult; } + /** + * Is use cached result active + * + * @return Return the flag of cache result usage + */ public boolean useCachedResult() { return useCachedResult; } + /** + * Set expression style + * + * @param propertyIndex property index + * @param value expression of the style + */ public void setExpressionStyle(int propertyIndex, Expression value) { if (expressionStyles == null) { expressionStyles = new HashMap<>(); @@ -308,22 +355,47 @@ public void setExpressionStyle(int propertyIndex, Expression value) { expressionStyles.put(propertyIndex, value); } + /** + * Get the expression style + * + * @return Return the expression style + */ public Map getExpressionStyles() { return expressionStyles; } + /** + * Set expression data + * + * @param extensionData expression data + */ public void setExtensionData(Object extensionData) { this.extensionData = extensionData; } + /** + * Get the expression data + * + * @return Return the expression data + */ public Object getExtensionData() { return this.extensionData; } + /** + * Get the alternative text + * + * @return Return the alternative text + */ public Expression getAltText() { return altText; } + /** + * Set the alternative text + * + * @param altText alternative text + */ public void setAltText(Expression altText) { this.altText = altText; } @@ -335,6 +407,11 @@ public String getAltTextKey() { return altTextKey; } + /** + * Set the alternative text key + * + * @param altTextKey alternative text key + */ public void setAltTextKey(String altTextKey) { this.altTextKey = altTextKey; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/TextItemDesign.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/TextItemDesign.java index 61f5e19f88..6859061017 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/TextItemDesign.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/TextItemDesign.java @@ -28,9 +28,19 @@ */ public class TextItemDesign extends ReportItemDesign { + /** + * property: text item type "auto", automatically type recognition of plain or + * HTML + */ public static final String AUTO_TEXT = "auto"; //$NON-NLS-1$ + + /** property: text item type "plain", content is plain text */ public static final String PLAIN_TEXT = "plain"; //$NON-NLS-1$ + + /** property: text item type "plain", content is HTML text */ public static final String HTML_TEXT = "html"; //$NON-NLS-1$ + + /** property: text item type "plain", content is RTF text */ public static final String RTF_TEXT = "rtf"; //$NON-NLS-1$ /** @@ -53,6 +63,11 @@ public class TextItemDesign extends ReportItemDesign { protected HashMap exprs = null; + /** + * Get the list of expressions + * + * @return Return the list of expressions + */ public HashMap getExpressions() { if (!hasExpression() || (text == null)) { return null; @@ -64,6 +79,13 @@ public HashMap getExpressions() { return exprs; } + /** + * Extraction of an expression from given string + * + * @param textContent string which will be checked + * @param textType text type, e.g. plain, html + * @return Return the extracted expression + */ public static HashMap extractExpression(String textContent, String textType) { HashMap expressions = new HashMap<>(); if (HTML_TEXT.equals(textType) || (AUTO_TEXT.equals(textType) && startsWithIgnoreCase(textContent, ""))) { @@ -76,7 +98,7 @@ public static HashMap extractExpression(String textContent, // and stop the whole task. } if (template != null && template.getNodes() != null) { - Iterator itor = template.getNodes().iterator(); + Iterator itor = template.getNodes().iterator(); Object obj; while (itor.hasNext()) { obj = itor.next(); @@ -103,6 +125,14 @@ private static void addExpression(Map expressions, String ex } } + /** + * Check case insensitive whether the string starts by the given pattern + * + * @param original string which will be checked + * @param pattern pattern to be find + * @return Return "true" if the strung starts with the given pattern checked + * case insensitive + */ public static boolean startsWithIgnoreCase(String original, String pattern) { int length = pattern.length(); if (original == null || original.length() < length) { @@ -153,24 +183,46 @@ public String getTextType() { } /** - * @param encoding The encoding to set. + * Set the text type + * + * @param textType text type, e.g. plain, html */ public void setTextType(String textType) { this.textType = textType; } + /** + * Check if expression exists + * + * @return Return "true" if expression exists + */ public boolean hasExpression() { return hasExpression; } + /** + * Set the expression occurring flag + * + * @param hasExpression has expression + */ public void setHasExpression(boolean hasExpression) { this.hasExpression = hasExpression; } + /** + * Check if jTidy parser is used + * + * @return Return the check result of used jTidy parser + */ public boolean isJTidy() { return jTidy; } + /** + * Set the usage of jTidy parser + * + * @param jTidy usage of jTidy parser + */ public void setJTidy(boolean jTidy) { this.jTidy = jTidy; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/VisibilityDesign.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/VisibilityDesign.java index 6b5a519b34..715bf2f8ff 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/VisibilityDesign.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/ir/VisibilityDesign.java @@ -38,6 +38,11 @@ public void addRule(VisibilityRuleDesign rule) { rules.add(rule); } + /** + * Get the rules + * + * @return Return the rules + */ public Collection getRules() { return rules; } @@ -59,6 +64,6 @@ public int count() { */ public VisibilityRuleDesign getRule(int index) { assert index >= 0 && index < rules.size(); - return (VisibilityRuleDesign) rules.get(index); + return rules.get(index); } } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java index 500f5db099..417704d752 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/StyleUtil.java @@ -23,15 +23,33 @@ import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.value.birt.BIRTConstants; import org.eclipse.birt.report.model.api.elements.structures.HighlightRule; -import org.eclipse.birt.report.model.elements.Style; +import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; +/** + * Style utility class + * + * @since 3.3 + * + */ public class StyleUtil { + /** property: style name to index map */ public static Map styleName2Index = null; + + /** property: set of color properties */ public static Set colorProperties; + + /** property: rule style name to index map */ public static Map ruleStyleName2Index = null; + + /** property: custom name to index map */ public static Map customName2Index = null; + /** + * Main method + * + * @param args arguments + */ public static void main(String[] args) { Field[] fields = HighlightRule.class.getFields(); for (Field field : fields) { @@ -43,37 +61,37 @@ public static void main(String[] args) { static { styleName2Index = new HashMap<>(); - styleName2Index.put(Style.BACKGROUND_ATTACHMENT_PROP, StyleConstants.STYLE_BACKGROUND_ATTACHMENT); - styleName2Index.put(Style.BACKGROUND_COLOR_PROP, StyleConstants.STYLE_BACKGROUND_COLOR); - styleName2Index.put(Style.BACKGROUND_IMAGE_PROP, StyleConstants.STYLE_BACKGROUND_IMAGE); - styleName2Index.put(Style.BACKGROUND_IMAGE_TYPE_PROP, StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE); - styleName2Index.put(Style.BACKGROUND_SIZE_HEIGHT, StyleConstants.STYLE_BACKGROUND_HEIGHT); - styleName2Index.put(Style.BACKGROUND_SIZE_WIDTH, StyleConstants.STYLE_BACKGROUND_WIDTH); - styleName2Index.put(Style.BACKGROUND_POSITION_X_PROP, StyleConstants.STYLE_BACKGROUND_POSITION_X); - styleName2Index.put(Style.BACKGROUND_POSITION_Y_PROP, StyleConstants.STYLE_BACKGROUND_POSITION_Y); - styleName2Index.put(Style.BACKGROUND_REPEAT_PROP, StyleConstants.STYLE_BACKGROUND_REPEAT); - styleName2Index.put(Style.BORDER_BOTTOM_COLOR_PROP, StyleConstants.STYLE_BORDER_BOTTOM_COLOR); - styleName2Index.put(Style.BORDER_BOTTOM_STYLE_PROP, StyleConstants.STYLE_BORDER_BOTTOM_STYLE); - styleName2Index.put(Style.BORDER_BOTTOM_WIDTH_PROP, StyleConstants.STYLE_BORDER_BOTTOM_WIDTH); - styleName2Index.put(Style.BORDER_LEFT_COLOR_PROP, StyleConstants.STYLE_BORDER_LEFT_COLOR); - styleName2Index.put(Style.BORDER_LEFT_STYLE_PROP, StyleConstants.STYLE_BORDER_LEFT_STYLE); - styleName2Index.put(Style.BORDER_LEFT_WIDTH_PROP, StyleConstants.STYLE_BORDER_LEFT_WIDTH); - styleName2Index.put(Style.BORDER_RIGHT_COLOR_PROP, StyleConstants.STYLE_BORDER_RIGHT_COLOR); - styleName2Index.put(Style.BORDER_RIGHT_STYLE_PROP, StyleConstants.STYLE_BORDER_RIGHT_STYLE); - styleName2Index.put(Style.BORDER_RIGHT_WIDTH_PROP, StyleConstants.STYLE_BORDER_RIGHT_WIDTH); - styleName2Index.put(Style.BORDER_TOP_COLOR_PROP, StyleConstants.STYLE_BORDER_TOP_COLOR); - styleName2Index.put(Style.BORDER_TOP_STYLE_PROP, StyleConstants.STYLE_BORDER_TOP_STYLE); - styleName2Index.put(Style.BORDER_TOP_WIDTH_PROP, StyleConstants.STYLE_BORDER_TOP_WIDTH); - styleName2Index.put(Style.MARGIN_BOTTOM_PROP, StyleConstants.STYLE_MARGIN_BOTTOM); - styleName2Index.put(Style.MARGIN_LEFT_PROP, StyleConstants.STYLE_MARGIN_LEFT); - styleName2Index.put(Style.MARGIN_RIGHT_PROP, StyleConstants.STYLE_MARGIN_RIGHT); - styleName2Index.put(Style.MARGIN_TOP_PROP, StyleConstants.STYLE_MARGIN_TOP); - styleName2Index.put(Style.PADDING_TOP_PROP, StyleConstants.STYLE_PADDING_TOP); - styleName2Index.put(Style.PADDING_LEFT_PROP, StyleConstants.STYLE_PADDING_LEFT); - styleName2Index.put(Style.PADDING_BOTTOM_PROP, StyleConstants.STYLE_PADDING_BOTTOM); - styleName2Index.put(Style.PADDING_RIGHT_PROP, StyleConstants.STYLE_PADDING_RIGHT); - styleName2Index.put(Style.CAN_SHRINK_PROP, StyleConstants.STYLE_CAN_SHRINK); - styleName2Index.put(Style.COLOR_PROP, StyleConstants.STYLE_COLOR); + styleName2Index.put(IStyleModel.BACKGROUND_ATTACHMENT_PROP, StyleConstants.STYLE_BACKGROUND_ATTACHMENT); + styleName2Index.put(IStyleModel.BACKGROUND_COLOR_PROP, StyleConstants.STYLE_BACKGROUND_COLOR); + styleName2Index.put(IStyleModel.BACKGROUND_IMAGE_PROP, StyleConstants.STYLE_BACKGROUND_IMAGE); + styleName2Index.put(IStyleModel.BACKGROUND_IMAGE_TYPE_PROP, StyleConstants.STYLE_BACKGROUND_IMAGE_TYPE); + styleName2Index.put(IStyleModel.BACKGROUND_SIZE_HEIGHT, StyleConstants.STYLE_BACKGROUND_HEIGHT); + styleName2Index.put(IStyleModel.BACKGROUND_SIZE_WIDTH, StyleConstants.STYLE_BACKGROUND_WIDTH); + styleName2Index.put(IStyleModel.BACKGROUND_POSITION_X_PROP, StyleConstants.STYLE_BACKGROUND_POSITION_X); + styleName2Index.put(IStyleModel.BACKGROUND_POSITION_Y_PROP, StyleConstants.STYLE_BACKGROUND_POSITION_Y); + styleName2Index.put(IStyleModel.BACKGROUND_REPEAT_PROP, StyleConstants.STYLE_BACKGROUND_REPEAT); + styleName2Index.put(IStyleModel.BORDER_BOTTOM_COLOR_PROP, StyleConstants.STYLE_BORDER_BOTTOM_COLOR); + styleName2Index.put(IStyleModel.BORDER_BOTTOM_STYLE_PROP, StyleConstants.STYLE_BORDER_BOTTOM_STYLE); + styleName2Index.put(IStyleModel.BORDER_BOTTOM_WIDTH_PROP, StyleConstants.STYLE_BORDER_BOTTOM_WIDTH); + styleName2Index.put(IStyleModel.BORDER_LEFT_COLOR_PROP, StyleConstants.STYLE_BORDER_LEFT_COLOR); + styleName2Index.put(IStyleModel.BORDER_LEFT_STYLE_PROP, StyleConstants.STYLE_BORDER_LEFT_STYLE); + styleName2Index.put(IStyleModel.BORDER_LEFT_WIDTH_PROP, StyleConstants.STYLE_BORDER_LEFT_WIDTH); + styleName2Index.put(IStyleModel.BORDER_RIGHT_COLOR_PROP, StyleConstants.STYLE_BORDER_RIGHT_COLOR); + styleName2Index.put(IStyleModel.BORDER_RIGHT_STYLE_PROP, StyleConstants.STYLE_BORDER_RIGHT_STYLE); + styleName2Index.put(IStyleModel.BORDER_RIGHT_WIDTH_PROP, StyleConstants.STYLE_BORDER_RIGHT_WIDTH); + styleName2Index.put(IStyleModel.BORDER_TOP_COLOR_PROP, StyleConstants.STYLE_BORDER_TOP_COLOR); + styleName2Index.put(IStyleModel.BORDER_TOP_STYLE_PROP, StyleConstants.STYLE_BORDER_TOP_STYLE); + styleName2Index.put(IStyleModel.BORDER_TOP_WIDTH_PROP, StyleConstants.STYLE_BORDER_TOP_WIDTH); + styleName2Index.put(IStyleModel.MARGIN_BOTTOM_PROP, StyleConstants.STYLE_MARGIN_BOTTOM); + styleName2Index.put(IStyleModel.MARGIN_LEFT_PROP, StyleConstants.STYLE_MARGIN_LEFT); + styleName2Index.put(IStyleModel.MARGIN_RIGHT_PROP, StyleConstants.STYLE_MARGIN_RIGHT); + styleName2Index.put(IStyleModel.MARGIN_TOP_PROP, StyleConstants.STYLE_MARGIN_TOP); + styleName2Index.put(IStyleModel.PADDING_TOP_PROP, StyleConstants.STYLE_PADDING_TOP); + styleName2Index.put(IStyleModel.PADDING_LEFT_PROP, StyleConstants.STYLE_PADDING_LEFT); + styleName2Index.put(IStyleModel.PADDING_BOTTOM_PROP, StyleConstants.STYLE_PADDING_BOTTOM); + styleName2Index.put(IStyleModel.PADDING_RIGHT_PROP, StyleConstants.STYLE_PADDING_RIGHT); + styleName2Index.put(IStyleModel.CAN_SHRINK_PROP, StyleConstants.STYLE_CAN_SHRINK); + styleName2Index.put(IStyleModel.COLOR_PROP, StyleConstants.STYLE_COLOR); /* * styleName2Index.put( Style.DATE_TIME_FORMAT_PROP, * StyleConstants.STYLE_DATE_FORMAT ); styleName2Index.put( @@ -81,51 +99,51 @@ public static void main(String[] args) { * styleName2Index.put( Style.TIME_FORMAT_PROP, * StyleConstants.STYLE_SQL_TIME_FORMAT ); */ - styleName2Index.put(Style.FONT_FAMILY_PROP, StyleConstants.STYLE_FONT_FAMILY); - styleName2Index.put(Style.FONT_SIZE_PROP, StyleConstants.STYLE_FONT_SIZE); - styleName2Index.put(Style.FONT_STYLE_PROP, StyleConstants.STYLE_FONT_STYLE); - styleName2Index.put(Style.FONT_WEIGHT_PROP, StyleConstants.STYLE_FONT_WEIGHT); - styleName2Index.put(Style.FONT_VARIANT_PROP, StyleConstants.STYLE_FONT_VARIANT); - styleName2Index.put(Style.TEXT_UNDERLINE_PROP, StyleConstants.STYLE_TEXT_UNDERLINE); - styleName2Index.put(Style.TEXT_OVERLINE_PROP, StyleConstants.STYLE_TEXT_OVERLINE); - styleName2Index.put(Style.TEXT_LINE_THROUGH_PROP, StyleConstants.STYLE_TEXT_LINETHROUGH); + styleName2Index.put(IStyleModel.FONT_FAMILY_PROP, StyleConstants.STYLE_FONT_FAMILY); + styleName2Index.put(IStyleModel.FONT_SIZE_PROP, StyleConstants.STYLE_FONT_SIZE); + styleName2Index.put(IStyleModel.FONT_STYLE_PROP, StyleConstants.STYLE_FONT_STYLE); + styleName2Index.put(IStyleModel.FONT_WEIGHT_PROP, StyleConstants.STYLE_FONT_WEIGHT); + styleName2Index.put(IStyleModel.FONT_VARIANT_PROP, StyleConstants.STYLE_FONT_VARIANT); + styleName2Index.put(IStyleModel.TEXT_UNDERLINE_PROP, StyleConstants.STYLE_TEXT_UNDERLINE); + styleName2Index.put(IStyleModel.TEXT_OVERLINE_PROP, StyleConstants.STYLE_TEXT_OVERLINE); + styleName2Index.put(IStyleModel.TEXT_LINE_THROUGH_PROP, StyleConstants.STYLE_TEXT_LINETHROUGH); /* * styleName2Index.put( Style.NUMBER_FORMAT_PROP, * StyleConstants.STYLE_NUMBER_FORMAT ); */ - styleName2Index.put(Style.NUMBER_ALIGN_PROP, StyleConstants.STYLE_NUMBER_ALIGN); - styleName2Index.put(Style.DISPLAY_PROP, StyleConstants.STYLE_DISPLAY); - styleName2Index.put(Style.MASTER_PAGE_PROP, StyleConstants.STYLE_MASTER_PAGE); - styleName2Index.put(Style.PAGE_BREAK_BEFORE_PROP, StyleConstants.STYLE_PAGE_BREAK_BEFORE); - styleName2Index.put(Style.PAGE_BREAK_AFTER_PROP, StyleConstants.STYLE_PAGE_BREAK_AFTER); - styleName2Index.put(Style.PAGE_BREAK_INSIDE_PROP, StyleConstants.STYLE_PAGE_BREAK_INSIDE); - styleName2Index.put(Style.SHOW_IF_BLANK_PROP, StyleConstants.STYLE_SHOW_IF_BLANK); + styleName2Index.put(IStyleModel.NUMBER_ALIGN_PROP, StyleConstants.STYLE_NUMBER_ALIGN); + styleName2Index.put(IStyleModel.DISPLAY_PROP, StyleConstants.STYLE_DISPLAY); + styleName2Index.put(IStyleModel.MASTER_PAGE_PROP, StyleConstants.STYLE_MASTER_PAGE); + styleName2Index.put(IStyleModel.PAGE_BREAK_BEFORE_PROP, StyleConstants.STYLE_PAGE_BREAK_BEFORE); + styleName2Index.put(IStyleModel.PAGE_BREAK_AFTER_PROP, StyleConstants.STYLE_PAGE_BREAK_AFTER); + styleName2Index.put(IStyleModel.PAGE_BREAK_INSIDE_PROP, StyleConstants.STYLE_PAGE_BREAK_INSIDE); + styleName2Index.put(IStyleModel.SHOW_IF_BLANK_PROP, StyleConstants.STYLE_SHOW_IF_BLANK); /* * styleName2Index.put( Style.STRING_FORMAT_PROP, * StyleConstants.STYLE_STRING_FORMAT ); */ - styleName2Index.put(Style.TEXT_ALIGN_PROP, StyleConstants.STYLE_TEXT_ALIGN); - styleName2Index.put(Style.TEXT_INDENT_PROP, StyleConstants.STYLE_TEXT_INDENT); - styleName2Index.put(Style.LETTER_SPACING_PROP, StyleConstants.STYLE_LETTER_SPACING); - styleName2Index.put(Style.LINE_HEIGHT_PROP, StyleConstants.STYLE_LINE_HEIGHT); - styleName2Index.put(Style.ORPHANS_PROP, StyleConstants.STYLE_ORPHANS); - styleName2Index.put(Style.TEXT_TRANSFORM_PROP, StyleConstants.STYLE_TEXT_TRANSFORM); - styleName2Index.put(Style.VERTICAL_ALIGN_PROP, StyleConstants.STYLE_VERTICAL_ALIGN); - styleName2Index.put(Style.WHITE_SPACE_PROP, StyleConstants.STYLE_WHITE_SPACE); - styleName2Index.put(Style.WIDOWS_PROP, StyleConstants.STYLE_WIDOWS); - styleName2Index.put(Style.WORD_SPACING_PROP, StyleConstants.STYLE_WORD_SPACING); - styleName2Index.put(Style.TEXT_DIRECTION_PROP, StyleConstants.STYLE_DIRECTION); - styleName2Index.put(Style.OVERFLOW_PROP, StyleConstants.STYLE_OVERFLOW); - styleName2Index.put(Style.HEIGHT_PROP, StyleConstants.STYLE_HEIGHT); - styleName2Index.put(Style.WIDTH_PROP, StyleConstants.STYLE_WIDTH); + styleName2Index.put(IStyleModel.TEXT_ALIGN_PROP, StyleConstants.STYLE_TEXT_ALIGN); + styleName2Index.put(IStyleModel.TEXT_INDENT_PROP, StyleConstants.STYLE_TEXT_INDENT); + styleName2Index.put(IStyleModel.LETTER_SPACING_PROP, StyleConstants.STYLE_LETTER_SPACING); + styleName2Index.put(IStyleModel.LINE_HEIGHT_PROP, StyleConstants.STYLE_LINE_HEIGHT); + styleName2Index.put(IStyleModel.ORPHANS_PROP, StyleConstants.STYLE_ORPHANS); + styleName2Index.put(IStyleModel.TEXT_TRANSFORM_PROP, StyleConstants.STYLE_TEXT_TRANSFORM); + styleName2Index.put(IStyleModel.VERTICAL_ALIGN_PROP, StyleConstants.STYLE_VERTICAL_ALIGN); + styleName2Index.put(IStyleModel.WHITE_SPACE_PROP, StyleConstants.STYLE_WHITE_SPACE); + styleName2Index.put(IStyleModel.WIDOWS_PROP, StyleConstants.STYLE_WIDOWS); + styleName2Index.put(IStyleModel.WORD_SPACING_PROP, StyleConstants.STYLE_WORD_SPACING); + styleName2Index.put(IStyleModel.TEXT_DIRECTION_PROP, StyleConstants.STYLE_DIRECTION); + styleName2Index.put(IStyleModel.OVERFLOW_PROP, StyleConstants.STYLE_OVERFLOW); + styleName2Index.put(IStyleModel.HEIGHT_PROP, StyleConstants.STYLE_HEIGHT); + styleName2Index.put(IStyleModel.WIDTH_PROP, StyleConstants.STYLE_WIDTH); colorProperties = new HashSet<>(); - colorProperties.add(Style.BACKGROUND_COLOR_PROP); - colorProperties.add(Style.BORDER_BOTTOM_COLOR_PROP); - colorProperties.add(Style.BORDER_LEFT_COLOR_PROP); - colorProperties.add(Style.BORDER_RIGHT_COLOR_PROP); - colorProperties.add(Style.BORDER_TOP_COLOR_PROP); - colorProperties.add(Style.COLOR_PROP); + colorProperties.add(IStyleModel.BACKGROUND_COLOR_PROP); + colorProperties.add(IStyleModel.BORDER_BOTTOM_COLOR_PROP); + colorProperties.add(IStyleModel.BORDER_LEFT_COLOR_PROP); + colorProperties.add(IStyleModel.BORDER_RIGHT_COLOR_PROP); + colorProperties.add(IStyleModel.BORDER_TOP_COLOR_PROP); + colorProperties.add(IStyleModel.COLOR_PROP); ruleStyleName2Index = new HashMap<>(); ruleStyleName2Index.put(HighlightRule.BORDER_TOP_STYLE_MEMBER, StyleConstants.STYLE_BORDER_TOP_STYLE); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TableItemDesignLayout.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TableItemDesignLayout.java index 62a07f2dff..ce56abae63 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TableItemDesignLayout.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TableItemDesignLayout.java @@ -33,6 +33,13 @@ public class TableItemDesignLayout { Table layout = new Table(); + /** + * Create new cell id on the grid + * + * @param grid grid item design + * @param newCellId new cell id + * @return Return the cell id of the new cell + */ public long layout(GridItemDesign grid, long newCellId) { layout = new Table(0, grid.getColumnCount()); layout.reset(); @@ -82,6 +89,13 @@ protected long normalize(long newCellId) { } + /** + * Create new cell id on the table + * + * @param table table item design + * @param newCellId new cell id + * @return Return the cell id of the new cell + */ public long layout(TableItemDesign table, long newCellId) { layout = new Table(0, table.getColumnCount()); layoutBand((TableBandDesign) table.getHeader()); diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TextParser.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TextParser.java index ff18f49a2d..f862128c42 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TextParser.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/TextParser.java @@ -42,12 +42,25 @@ */ public class TextParser { + /** + * property: text type "auto" to verify automatically the text content type, + * e.g. "plain", "html" + */ public static String TEXT_TYPE_AUTO = "auto"; //$NON-NLS-1$ + + /** property: text type "plain" for plain text */ public static String TEXT_TYPE_PLAIN = "plain"; //$NON-NLS-1$ + + /** property: text type "html" for HTML text */ public static String TEXT_TYPE_HTML = "html"; //$NON-NLS-1$ + + /** property: text type "rtf" for RTF text */ public static String TEXT_TYPE_RTF = "rtf"; //$NON-NLS-1$ + /** property: HTML document prefix */ public static String HTML_PREFIX = ""; //$NON-NLS-1$ + + /** property: RTF document prefix */ public static String RTF_PREFIX = "\\rtf"; //$NON-NLS-1$ /** diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/presentation/LocalizedContentVisitor.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/presentation/LocalizedContentVisitor.java index 5ad6db2096..d5523161d1 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/presentation/LocalizedContentVisitor.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/presentation/LocalizedContentVisitor.java @@ -33,7 +33,6 @@ import org.eclipse.birt.core.format.NumberFormatter; import org.eclipse.birt.core.format.StringFormatter; import org.eclipse.birt.core.template.TextTemplate; -import org.eclipse.birt.data.engine.api.IBaseQueryDefinition; import org.eclipse.birt.data.engine.api.IDataQueryDefinition; import org.eclipse.birt.report.engine.api.CachedImage; import org.eclipse.birt.report.engine.api.EngineConstants; @@ -59,6 +58,7 @@ import org.eclipse.birt.report.engine.content.IStyle; import org.eclipse.birt.report.engine.content.ITableContent; import org.eclipse.birt.report.engine.content.ITextContent; +import org.eclipse.birt.report.engine.css.engine.StyleConstants; import org.eclipse.birt.report.engine.css.engine.value.DataFormatValue; import org.eclipse.birt.report.engine.css.engine.value.css.CSSValueConstants; import org.eclipse.birt.report.engine.data.dte.SingleCubeResultSet; @@ -94,6 +94,12 @@ import com.ibm.icu.util.TimeZone; import com.ibm.icu.util.ULocale; +/** + * Localized content visitor + * + * @since 3.3 + * + */ public class LocalizedContentVisitor { protected static Logger logger = Logger.getLogger(LocalizedContentVisitor.class.getName()); @@ -102,7 +108,7 @@ public class LocalizedContentVisitor { private Locale locale; private TimeZone timeZone; private String outputFormat; - protected HashMap templates = new HashMap(); + protected HashMap> templates = new HashMap>(); private OnRenderScriptVisitor onRenderVisitor; final static char[] HEX = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; final static byte[] dummyImageData = { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 1, 0, @@ -114,6 +120,11 @@ public class LocalizedContentVisitor { private static final String FILE_PROTOCOL = ":/"; private static final String URL_DATA_PROTOCOL = "data:"; + /** + * Constructor + * + * @param context execution context + */ public LocalizedContentVisitor(ExecutionContext context) { this.context = context; this.locale = context.getLocale(); @@ -155,6 +166,13 @@ protected void processBackgroundImage(IStyle style) { } } + /** + * Localize of content objects + * + * @param content + * @return Returns the content object + * @throws BirtException + */ public IContent localize(IContent content) throws BirtException { IStyle style = content.getInlineStyle(); processBackgroundImage(style); @@ -190,13 +208,20 @@ public IContent localize(IContent content) throws BirtException { } } + /** + * Localize the report content + * + * @param report + * @return Returns the report content + * @throws BirtException + */ public IReportContent localizeReport(IReportContent report) throws BirtException { processReport(report); return report; } protected IContent localizeAllChildren(IContent content) throws BirtException { - ArrayList children = (ArrayList) content.getChildren(); + ArrayList children = (ArrayList) content.getChildren(); if (children != null) { for (int i = 0; i < children.size(); i++) { IContent child = (IContent) children.get(i); @@ -216,17 +241,17 @@ private IPageContent localizePage(IPageContent page) throws BirtException { } protected TextTemplate parseTemplate(String text) throws BirtException { - SoftReference templateRef = (SoftReference) templates.get(text); + SoftReference templateRef = templates.get(text); TextTemplate template = null; if (templateRef != null) { - template = (TextTemplate) templateRef.get(); + template = templateRef.get(); if (template != null) { return template; } } try { template = new org.eclipse.birt.core.template.TemplateParser().parse(text); - templateRef = new SoftReference(template); + templateRef = new SoftReference(template); templates.put(text, templateRef); } catch (Throwable ex) { throw new EngineException(ex.getLocalizedMessage(), ex); @@ -234,7 +259,7 @@ protected TextTemplate parseTemplate(String text) throws BirtException { return template; } - private String executeTemplate(TextTemplate template, HashMap values) { + private String executeTemplate(TextTemplate template, HashMap values) { return new TemplateExecutor(context).execute(template, values); } @@ -302,9 +327,9 @@ protected void processData(IDataContent data) { IStyle style = data.getComputedStyle(); text = format(value, style); if (value instanceof Number) { - CSSValue align = style.getProperty(IStyle.STYLE_NUMBER_ALIGN); + CSSValue align = style.getProperty(StyleConstants.STYLE_NUMBER_ALIGN); if (align != null && align != CSSValueConstants.NONE_VALUE) { - data.getStyle().setProperty(IStyle.STYLE_TEXT_ALIGN, align); + data.getStyle().setProperty(StyleConstants.STYLE_TEXT_ALIGN, align); } } } @@ -649,7 +674,7 @@ protected void processTemplateContent(IForeignContent foreignContent) { TextItemDesign design = (TextItemDesign) foreignContent.getGenerateBy(); String text = null; - HashMap rawValues = null; + HashMap rawValues = null; if (foreignContent.getRawValue() instanceof Object[]) { Object[] rawValue = (Object[]) foreignContent.getRawValue(); assert rawValue.length == 2; @@ -658,7 +683,7 @@ protected void processTemplateContent(IForeignContent foreignContent) { text = (String) rawValue[0]; } if (rawValue[1] instanceof HashMap) { - rawValues = (HashMap) rawValue[1]; + rawValues = (HashMap) rawValue[1]; } } @@ -708,7 +733,7 @@ private int getChartResolution(IContent content) { resolution = ((Number) chartDpi).intValue(); } if (resolution == 0) { - Map appContext = context.getAppContext(); + Map appContext = context.getAppContext(); if (appContext != null) { Object tmp = appContext.get(EngineConstants.APPCONTEXT_CHART_RESOLUTION); if (tmp instanceof Number) { @@ -870,7 +895,7 @@ protected IContent processExtendedContent(IForeignContent content) { if (queries == null) { DesignElementHandle elementHandle = design.getHandle(); if (elementHandle instanceof ReportElementHandle) { - queries = (IBaseQueryDefinition[]) context.getReport() + queries = context.getReport() .getQueryByReportHandle((ReportElementHandle) elementHandle); } } @@ -924,9 +949,7 @@ protected IContent processExtendedContent(IForeignContent content) { /** * handle the content created by the IPresentation * - * @param item extended item design - * @param emitter emitter used to output the contnet - * @param content ext content + * @param content foreign content * @param type output type * @param output output */