diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/core/model/schematic/ImageHandleAdapter.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/core/model/schematic/ImageHandleAdapter.java index 3e639f84a94..54240b0d379 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/core/model/schematic/ImageHandleAdapter.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/core/model/schematic/ImageHandleAdapter.java @@ -39,7 +39,8 @@ public class ImageHandleAdapter extends ReportItemtHandleAdapter { /** * Constructor * - * @param handle + * @param image image handle + * @param mark model adapter helper */ public ImageHandleAdapter(ImageHandle image, IModelAdapterHelper mark) { super(image, mark); @@ -126,7 +127,7 @@ public Dimension getSize() { /** * Gets size of image item. Always returns a non-null value. * - * @return + * @return Return the size of the image item */ public Dimension getRawSize() { DimensionHandle widthHandle = getImageHandle().getWidth(); diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/DEUtil.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/DEUtil.java index 2a6ca8a9567..cfc2ff1feeb 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/DEUtil.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/DEUtil.java @@ -71,18 +71,19 @@ import org.eclipse.birt.report.model.api.ReportDesignHandle; import org.eclipse.birt.report.model.api.ReportElementHandle; import org.eclipse.birt.report.model.api.ReportItemHandle; +import org.eclipse.birt.report.model.api.ReportItemHandleImpl; import org.eclipse.birt.report.model.api.ReportItemThemeHandle; import org.eclipse.birt.report.model.api.ResultSetColumnHandle; import org.eclipse.birt.report.model.api.RowHandle; import org.eclipse.birt.report.model.api.SlotHandle; import org.eclipse.birt.report.model.api.StyleHandle; import org.eclipse.birt.report.model.api.TableHandle; -import org.eclipse.birt.report.model.api.TextItemHandle; import org.eclipse.birt.report.model.api.ThemeHandle; import org.eclipse.birt.report.model.api.VariableElementHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.core.IAccessControl; import org.eclipse.birt.report.model.api.core.IDesignElement; +import org.eclipse.birt.report.model.api.core.IModuleModel; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.elements.ReportDesignConstants; import org.eclipse.birt.report.model.api.elements.structures.Action; @@ -93,6 +94,7 @@ import org.eclipse.birt.report.model.api.metadata.IClassInfo; import org.eclipse.birt.report.model.api.metadata.IElementDefn; import org.eclipse.birt.report.model.api.metadata.IElementPropertyDefn; +import org.eclipse.birt.report.model.api.metadata.IMemberInfo; import org.eclipse.birt.report.model.api.metadata.IMetaDataDictionary; import org.eclipse.birt.report.model.api.metadata.IMethodInfo; import org.eclipse.birt.report.model.api.metadata.IPropertyDefn; @@ -103,7 +105,16 @@ import org.eclipse.birt.report.model.api.util.DimensionUtil; import org.eclipse.birt.report.model.api.util.StringUtil; import org.eclipse.birt.report.model.api.util.URIUtil; +import org.eclipse.birt.report.model.elements.interfaces.IAbstractThemeModel; +import org.eclipse.birt.report.model.elements.interfaces.ICellModel; +import org.eclipse.birt.report.model.elements.interfaces.IGraphicMaterPageModel; +import org.eclipse.birt.report.model.elements.interfaces.IGridItemModel; +import org.eclipse.birt.report.model.elements.interfaces.IInternalReportDesignModel; +import org.eclipse.birt.report.model.elements.interfaces.ILabelModel; +import org.eclipse.birt.report.model.elements.interfaces.IParameterGroupModel; import org.eclipse.birt.report.model.elements.interfaces.IStyleModel; +import org.eclipse.birt.report.model.elements.interfaces.ITableRowModel; +import org.eclipse.birt.report.model.elements.interfaces.ITextItemModel; import org.eclipse.birt.report.model.metadata.ElementPropertyDefn; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.Path; @@ -147,6 +158,7 @@ public class DEUtil { private static final String XMLDATE_PATTERN_DATE_ONLY = "yyyy-MM-dd"; //$NON-NLS-1$ private static final String XMLDATE_PATTERN_WITH_OUT_SECOND = "yyyy-MM-dd'T'HH:mm"; //$NON-NLS-1$ private static final String XMLDATE_PATTERN_WITH_OUT_MILLISECOND = "yyyy-MM-dd'T'HH:mm:ss"; //$NON-NLS-1$ + /** property: default library */ public static final String DEFAULT_LIBRARY = "/ThemesReportItems31.rptlibrary"; //$NON-NLS-1$ private static List paletteElementList = new ArrayList<>(); @@ -156,8 +168,8 @@ public class DEUtil { public static final IClassInfo TOTAL_CLASS = getMetaDataDictionary().getClass(IMetaDataDictionary.TOTAL_CLASS_NAME); static { - propertiesMap.put(LabelHandle.TEXT_PROP, ELEMENT_LABELCONTENT_PROPERTY); - propertiesMap.put(TextItemHandle.CONTENT_PROP, ELEMENT_LABELCONTENT_PROPERTY); + propertiesMap.put(ILabelModel.TEXT_PROP, ELEMENT_LABELCONTENT_PROPERTY); + propertiesMap.put(ITextItemModel.CONTENT_PROP, ELEMENT_LABELCONTENT_PROPERTY); // do not support following element in release 2 notSupportList.add(getMetaDataDictionary().getElement(ReportDesignConstants.LINE_ITEM)); @@ -237,6 +249,7 @@ public int compare(IElementDefn o1, IElementDefn o2) { * {@link UIUtil#getUIElementSupportList()} * * @param slotHandle + * @return Return the containable element type list of give slot handle. */ public static List getElementSupportList(SlotHandle slotHandle) { return getElementSupportList(slotHandle.getElementHandle(), slotHandle.getSlotID()); @@ -256,7 +269,7 @@ public static List getElementSupportList(SlotHandle slotHandle) { public static List getElementSupportList(DesignElementHandle parent) { int slotID = -1; if (parent instanceof MasterPageHandle) { - slotID = GraphicMasterPageHandle.CONTENT_SLOT; + slotID = IGraphicMaterPageModel.CONTENT_SLOT; } return getElementSupportList(parent, slotID); } @@ -269,7 +282,7 @@ public static List getElementSupportList(DesignElementHandle paren * {@link UIUtil#getUIElementSupportList()} * * @param propertyHandle - * @return + * @return Return the support list of the given property handle. */ public static List getElementSupportList(PropertyHandle propertyHandle) { List list = new ArrayList<>(); @@ -313,9 +326,10 @@ public int compare(IElementDefn o1, IElementDefn o2) { * Find the position of the element. If the element is null, the position is * last * - * @param parent - * @param element - * @return position + * @param parent parent element + * @param element element to be searched + * @param slotID slot id to be started + * @return the position of the element */ public static int findInsertPosition(DesignElementHandle parent, DesignElementHandle element, int slotID) { if (element == null) { @@ -332,20 +346,14 @@ public static int findInsertPosition(DesignElementHandle parent, DesignElementHa * Find the position of the element. If the element is null, the position is * last * - * @param parent - * @param element - * @param content - * @return + * @param parent parent element + * @param element element to be searched + * @param content content where is to search + * @return Return the position of the element */ public static int findInsertPosition(DesignElementHandle parent, DesignElementHandle element, String content) { if (element == null) { return parent.getContentCount(content); - // SlotHandle slotHandle = parent.getSlot( slotID ); - // if ( slotHandle != null ) - // { - // return slotHandle.getCount( ); - // } - // return -1; } return element.getIndex(); } @@ -400,6 +408,7 @@ public static IElementDefn getElementDefn(String elementName) { * Get display label of report element * * @param obj + * @return Return the display label of report element */ public static String getDisplayLabel(Object obj) { return getDisplayLabel(obj, true); @@ -409,6 +418,8 @@ public static String getDisplayLabel(Object obj) { * Get display label of report element * * @param obj + * @param includeElementName + * @return Return the display label of report element */ public static String getDisplayLabel(Object obj, boolean includeElementName) { if (obj instanceof DesignElementHandle) { @@ -441,7 +452,7 @@ public static String getDisplayLabel(Object obj, boolean includeElementName) { public static int getMasterPageAccount() { SlotHandle slotHandle = SessionHandleAdapter.getInstance().getReportDesignHandle().getMasterPages(); - Iterator itor = slotHandle.iterator(); + Iterator itor = slotHandle.iterator(); int account = 0; @@ -456,12 +467,12 @@ public static int getMasterPageAccount() { * Gets the default content property name. * * @param parent - * @return + * @return Return the default content property name. */ // TODO this a temp resolve method. public static String getDefaultContentName(Object parent) { if (parent instanceof DesignElementHandle) { - List propDefns = ((DesignElementHandle) parent).getDefn().getContents(); + List propDefns = ((DesignElementHandle) parent).getDefn().getContents(); if (!propDefns.isEmpty()) { return ((IPropertyDefn) propDefns.get(0)).getName(); } @@ -478,23 +489,23 @@ public static String getDefaultContentName(Object parent) { public static int getDefaultSlotID(Object parent) { int slotID = -1; if (parent instanceof GraphicMasterPageHandle) { - slotID = GraphicMasterPageHandle.CONTENT_SLOT; + slotID = IGraphicMaterPageModel.CONTENT_SLOT; } else if (parent instanceof ParameterGroupHandle) { - slotID = ParameterGroupHandle.PARAMETERS_SLOT; + slotID = IParameterGroupModel.PARAMETERS_SLOT; } else if (parent instanceof ReportDesignHandle) { - slotID = ReportDesignHandle.BODY_SLOT; + slotID = IInternalReportDesignModel.BODY_SLOT; } else if (parent instanceof LibraryHandle) { - slotID = ModuleHandle.COMPONENT_SLOT; + slotID = IModuleModel.COMPONENT_SLOT; } else if (parent instanceof CellHandle) { - slotID = CellHandle.CONTENT_SLOT; + slotID = ICellModel.CONTENT_SLOT; } else if (parent instanceof RowHandle) { - slotID = RowHandle.CONTENT_SLOT; + slotID = ITableRowModel.CONTENT_SLOT; } else if (parent instanceof GridHandle) { - slotID = GridHandle.ROW_SLOT; + slotID = IGridItemModel.ROW_SLOT; } else if (parent instanceof ThemeHandle) { - slotID = ThemeHandle.STYLES_SLOT; + slotID = IAbstractThemeModel.STYLES_SLOT; } else if (parent instanceof ReportItemThemeHandle) { - slotID = ReportItemThemeHandle.STYLES_SLOT; + slotID = IAbstractThemeModel.STYLES_SLOT; } return slotID; } @@ -671,9 +682,9 @@ else if ("".equals(units))//$NON-NLS-1$ /** * Transform other units to target unit. * - * @param handle - * @param targetUnit - * @return + * @param handle dimension handle + * @param targetUnit target unit + * @return Return the converted value to double */ public static double convertToValue(DimensionHandle handle, String targetUnit) { double retValue = 0.0; @@ -705,6 +716,7 @@ public static boolean isValidInteger(String val) { * double. * * @param val + * @return Return the check result of valid number */ public static boolean isValidNumber(String val) { try { @@ -840,17 +852,17 @@ public static int getRGBInt(RGB rgb) { * @param handle the handle of the element * @return Returns the list of data sets which can be used for this element */ - public static List getDataSetList(DesignElementHandle handle) { - List dataSetList = new ArrayList(); + public static List getDataSetList(DesignElementHandle handle) { + List dataSetList = new ArrayList(); if (handle instanceof ReportElementHandle) { if (handle instanceof ReportItemHandle) { - DesignElementHandle dataSet = ((ReportItemHandle) handle).getDataSet(); + DataSetHandle dataSet = ((ReportItemHandle) handle).getDataSet(); if (dataSet != null && !dataSetList.contains(dataSet)) { dataSetList.add(dataSet); } } - for (Iterator itor = getDataSetList(handle.getContainer()).iterator(); itor.hasNext();) { - DesignElementHandle dataSet = (DesignElementHandle) itor.next(); + for (Iterator itor = getDataSetList(handle.getContainer()).iterator(); itor.hasNext();) { + DataSetHandle dataSet = itor.next(); if (!dataSetList.contains(dataSet)) { dataSetList.add(dataSet); } @@ -866,11 +878,11 @@ public static List getDataSetList(DesignElementHandle handle) { * @return Returns the list of data sets which can be used for this element * excluding itself */ - public static List getDataSetListExcludeSelf(DesignElementHandle handle) { - List dataSetList = new ArrayList(); + public static List getDataSetListExcludeSelf(DesignElementHandle handle) { + List dataSetList = new ArrayList(); if (handle instanceof ReportElementHandle) { - for (Iterator itor = getDataSetList(handle.getContainer()).iterator(); itor.hasNext();) { - DesignElementHandle dataSet = (DesignElementHandle) itor.next(); + for (Iterator itor = getDataSetList(handle.getContainer()).iterator(); itor.hasNext();) { + DesignElementHandle dataSet = itor.next(); if (!dataSetList.contains(dataSet)) { dataSetList.add(dataSet); } @@ -884,6 +896,7 @@ public static List getDataSetListExcludeSelf(DesignElementHandle handle) { * * @param elementName * @param propertyName + * @return Return the definition of model property. */ public static IElementPropertyDefn getPropertyDefn(String elementName, String propertyName) { IElementDefn elementDefn = getMetaDataDictionary().getElement(elementName); @@ -936,10 +949,8 @@ public static String getExpression(Object model) { if (model instanceof ComputedColumnHandle) { if (isBindingCube(((ComputedColumnHandle) model).getElementHandle())) { return getDataExpression(((ComputedColumnHandle) model).getName()); - } else { - return getColumnExpression(((ComputedColumnHandle) model).getName()); } - + return getColumnExpression(((ComputedColumnHandle) model).getName()); } if (model instanceof ResultSetColumnHandle) { return getResultSetColumnExpression(((ResultSetColumnHandle) model).getColumnName()); @@ -971,10 +982,10 @@ public static String getExpression(Object model) { } /** - * Returns the integer font size for string value. + * Get the integer font size for string value. * - * @param fontSize - * @return + * @param fontSize font size + * @return Returns the integer font size for string value. */ public static int getFontSize(String fontSize) { if (DesignChoiceConstants.FONT_SIZE_LARGER.equals(fontSize)) { @@ -1145,9 +1156,8 @@ public static int getFontSizeIntValue(DesignElementHandle handle) { if (handle.getPrivateStyle() != null && handle.getPrivateStyle().getFontSize().getAbsoluteValue() != null) { return (int) CSSUtil.convertToPoint(handle.getPrivateStyle().getFontSize().getAbsoluteValue(), getDefaultFontSize()); - } else { - return getDefaultFontSize(); } + return getDefaultFontSize(); } private static int getDefaultFontSize() { @@ -1277,7 +1287,7 @@ public static String[] getSystemFontNames() { * @param comparator Sort comparator. * @return font names. */ - synchronized public static String[] getSystemFontNames(Comparator comparator) { + synchronized public static String[] getSystemFontNames(AlphabeticallyComparator comparator) { if (scalable_system_fonts == null) { FontData[] fontDatas = Display.getCurrent().getFontList(null, true); @@ -1317,7 +1327,7 @@ synchronized public static String[] getSystemFontNames(Comparator comparator) { * @param modelList DE model list. * @return The tool used to process multil-selection. */ - public static GroupElementHandle getMultiSelectionHandle(List modelList) { + public static GroupElementHandle getMultiSelectionHandle(List modelList) { ModuleHandle designHandle = SessionHandleAdapter.getInstance().getReportDesignHandle(); GroupElementHandle handle = GroupElementFactory.newGroupElement(designHandle, modelList); return handle; @@ -1342,6 +1352,9 @@ public static String escape(String str) { /** * Gets decimal string given the number of zeros. + * + * @param decPlaces number of decimal places + * @return Return the decimal string given the number of zeros. */ public static String getDecmalStr(int decPlaces) { @@ -1383,31 +1396,37 @@ public static boolean isParameterGroup(Object transferSource) { /** * Get styles * - * @return Alphabetically sortted styles list. + * @return Alphabetically sorted styles list. */ - public static Iterator getStyles() { + public static Iterator getStyles() { return getStyles(true, new AlphabeticallyComparator()); } - public static Iterator getStyles(boolean showCurrent) { + /** + * Get styles + * + * @param showCurrent show the current style + * @return Alphabetically sorted styles list. + */ + public static Iterator getStyles(boolean showCurrent) { return getStyles(showCurrent, new AlphabeticallyComparator()); } /** * Get styles * - * @param comparator - * @return return styles list sortted with given comparator. + * @param showCurrent show current style + * @param comparator comparator + * @return return styles list sorted with given comparator. */ - - public static Iterator getStyles(boolean showCurrent, Comparator comparator) { - List styles = null; + public static Iterator getStyles(boolean showCurrent, Comparator comparator) { + List styles = null; ModuleHandle module = SessionHandleAdapter.getInstance().getReportDesignHandle(); if (module instanceof ReportDesignHandle) { styles = module.getAllStyles(); } else if (module instanceof LibraryHandle) { - styles = new ArrayList(); + styles = new ArrayList(); if (showCurrent) { ThemeHandle theme = ((LibraryHandle) module).getTheme(); @@ -1416,8 +1435,8 @@ public static Iterator getStyles(boolean showCurrent, Comparator comparator) { } } else { SlotHandle themeSlot = ((LibraryHandle) module).getThemes(); - styles = new ArrayList(); - for (Iterator iter = themeSlot.getContents().iterator(); iter.hasNext();) { + styles = new ArrayList(); + for (Iterator iter = themeSlot.getContents().iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof AbstractThemeHandle) { AbstractThemeHandle theme = (AbstractThemeHandle) obj; @@ -1446,16 +1465,22 @@ public static Iterator getStyles(boolean showCurrent, Comparator comparator) { return Arrays.asList(stylesArray).iterator(); } - public static Iterator getStyles(Comparator comparator) { + /** + * Get styles + * + * @param comparator comparator of the style + * @return Return the styles + */ + public static Iterator getStyles(Comparator comparator) { return getStyles(true, comparator); } /** * Get styles * - * @return Alphabetically sortted styles list. + * @return Alphabetically sorted styles list. */ - public static Iterator getLocalStyles() { + public static Iterator getLocalStyles() { return getLocalStyles(new AlphabeticallyComparator()); } @@ -1463,16 +1488,16 @@ public static Iterator getLocalStyles() { * Get styles * * @param comparator - * @return return styles list sortted with given comparator. + * @return return styles list sorted with given comparator. */ - public static Iterator getLocalStyles(Comparator comparator) { - List styles = null; + public static Iterator getLocalStyles(Comparator comparator) { + List styles = null; ModuleHandle module = SessionHandleAdapter.getInstance().getReportDesignHandle(); if (module instanceof ReportDesignHandle) { styles = module.getStyles().getContents(); } else if (module instanceof LibraryHandle) { - styles = new ArrayList(); + styles = new ArrayList(); ThemeHandle theme = ((LibraryHandle) module).getTheme(); if (theme != null) { @@ -1491,20 +1516,23 @@ public static Iterator getLocalStyles(Comparator comparator) { /** * Get styles * - * @return Alphabetically sortted styles list. + * @param theme theme handle + * + * @return Alphabetically sorted styles list. */ - public static Iterator getStyles(AbstractThemeHandle theme) { + public static Iterator getStyles(AbstractThemeHandle theme) { return getStyles(theme, new AlphabeticallyComparator()); } /** * Get styles * - * @param comparator - * @return return styles list sortted with given comparator. + * @param theme theme handle + * @param comparator comparator if the styles + * @return return styles list sorted with given comparator. */ - public static Iterator getStyles(AbstractThemeHandle theme, Comparator comparator) { - List styles = new ArrayList(); + public static Iterator getStyles(AbstractThemeHandle theme, Comparator comparator) { + List styles = new ArrayList(); if (theme != null) { styles.addAll(theme.getAllStyles()); @@ -1512,7 +1540,7 @@ public static Iterator getStyles(AbstractThemeHandle theme, Comparator comparato ModuleHandle module = SessionHandleAdapter.getInstance().getReportDesignHandle(); if (module instanceof LibraryHandle) { - styles = new ArrayList(); + styles = new ArrayList(); theme = ((LibraryHandle) module).getTheme(); if (theme != null) { @@ -1533,9 +1561,9 @@ public static Iterator getStyles(AbstractThemeHandle theme, Comparator comparato /** * Checks if two strings have same value. * - * @param str1 - * @param str2 - * @return + * @param str1 string 1 of compare + * @param str2 string 2 of compare + * @return Return the result of the string compare */ public static boolean isSameString(String str1, String str2) { if ((str1 == null && str2 == null) || (str1 != null && str1.equals(str2))) { @@ -1557,6 +1585,12 @@ public static String getColumnExpression(String columnName) { return ExpressionUtil.createJSRowExpression(columnName); } + /** + * Get the data expression + * + * @param columnName column name + * @return Return the data expression + */ public static String getDataExpression(String columnName) { if (StringUtil.isBlank(columnName)) { return null; @@ -1654,19 +1688,17 @@ private static Object getModelFontSize(DesignElementHandle handle) { return fontSizeValue; } + /** - * @deprecated + * Get the report themes + * + * @return Return the report themes */ - @Deprecated - public static List getDataSets() { - return SessionHandleAdapter.getInstance().getReportDesignHandle().getVisibleDataSets(); - } - - public static Iterator getThemes() { + public static Iterator getThemes() { return getThemes(new AlphabeticallyComparator()); } - private static Iterator getThemes(AlphabeticallyComparator comparator) { + private static Iterator getThemes(AlphabeticallyComparator comparator) { List themes = SessionHandleAdapter.getInstance().getReportDesignHandle() .getVisibleThemes(IAccessControl.DIRECTLY_INCLUDED_LEVEL); @@ -1682,9 +1714,9 @@ private static Iterator getThemes(AlphabeticallyComparator comparator) { * Generates GroupElementHandle for given model list. * * @param modelList - * @return + * @return Return the group element handle */ - public static GroupElementHandle getGroupElementHandle(List modelList) { + public static GroupElementHandle getGroupElementHandle(List modelList) { ModuleHandle handle = SessionHandleAdapter.getInstance().getReportDesignHandle(); if (handle == null) { @@ -1698,7 +1730,7 @@ public static GroupElementHandle getGroupElementHandle(List modelList) { * Checks if the library is included. * * @param handle - * @return + * @return Return the check of included library */ public static boolean isIncluded(LibraryHandle handle) { return handle.getNamespace() != null; @@ -1709,7 +1741,7 @@ public static boolean isIncluded(LibraryHandle handle) { * * @return List of classes */ - public static List getClasses() { + public static List getClasses() { return getClasses(new AlphabeticallyComparator()); } @@ -1717,11 +1749,11 @@ public static List getClasses() { /** * Get classes with specified comparator * - * @param comp the coparator + * @param comp the comparator * @return List of classes */ - public static List getClasses(Comparator comp) { - List classes = getMetaDataDictionary().getClasses(); + public static List getClasses(AlphabeticallyComparator comp) { + List classes = getMetaDataDictionary().getClasses(); Collections.sort(classes, comp); // Fix bug 187178: Remove Total JS object @@ -1736,39 +1768,43 @@ public static List getClasses(Comparator comp) { * @param classInfo * @return List of methods */ - public static List getMethods(IClassInfo classInfo) { + public static List getMethods(IClassInfo classInfo) { return getMethods(classInfo, false, new AlphabeticallyComparator()); } /** * Get methods with specified comparator, the list doesn't include constructors * - * @param classInfo + * @param classInfo class info * @param comp The comparator * @return List of methods */ - public static List getMethods(IClassInfo classInfo, Comparator comp) { + public static List getMethods(IClassInfo classInfo, AlphabeticallyComparator comp) { return getMethods(classInfo, false, comp); } /** * Get methods with default comparator constructors * - * @param classInfo + * @param classInfo class info + * @param includeConstructor include constructor * @return List of methods */ - public static List getMethods(IClassInfo classInfo, boolean includeConstructor) { + public static List getMethods(IClassInfo classInfo, boolean includeConstructor) { return getMethods(classInfo, includeConstructor, new AlphabeticallyComparator()); } /** * Get methods with default comparator * - * @param classInfo + * @param classInfo class info + * @param includeConstructor include constructor + * @param comp comparator * @return List of methods */ - public static List getMethods(IClassInfo classInfo, boolean includeConstructor, Comparator comp) { - List mds = new ArrayList(); + public static List getMethods(IClassInfo classInfo, boolean includeConstructor, + AlphabeticallyComparator comp) { + List mds = new ArrayList(); if (includeConstructor) { IMethodInfo mi = classInfo.getConstructor(); @@ -1777,7 +1813,7 @@ public static List getMethods(IClassInfo classInfo, boolean includeConstructor, } } - List methods = classInfo.getMethods(); + List methods = classInfo.getMethods(); Collections.sort(methods, comp); mds.addAll(methods); @@ -1787,22 +1823,22 @@ public static List getMethods(IClassInfo classInfo, boolean includeConstructor, /** * Get members with default comparator * - * @param classInfo + * @param classInfo class info * @return List of members */ - public static List getMembers(IClassInfo classInfo) { + public static List getMembers(IClassInfo classInfo) { return getMembers(classInfo, new AlphabeticallyComparator()); } /** * Get members with specified comparator * - * @param classInfo + * @param classInfo class info * @param comp The comparator * @return List of methods */ - public static List getMembers(IClassInfo classInfo, Comparator comp) { - List members = classInfo.getMembers(); + public static List getMembers(IClassInfo classInfo, AlphabeticallyComparator comp) { + List members = classInfo.getMembers(); Collections.sort(members, comp); return members; @@ -1811,12 +1847,13 @@ public static List getMembers(IClassInfo classInfo, Comparator comp) { /** * - * Return DesignElementHandle avaliable method's argument type name. + * Return DesignElementHandle available method's argument type name. * * @param handle DesignElementHandle. - * @param methodName - * @param argIdex starts from 0. - * @return + * @param methodName method name + * @param argIndex starts from 0. + * @return Return the design element handle available method's argument type + * name. */ public static String getMethodArgumentType(DesignElementHandle handle, String methodName, int argIndex) { if (handle instanceof DataSetHandle) { @@ -1826,15 +1863,16 @@ public static String getMethodArgumentType(DesignElementHandle handle, String me return ReportDesignConstants.DATA_SOURCE_ELEMENT; } - List methods = handle.getDefn().getLocalMethods(); - for (Iterator iter = methods.iterator(); iter.hasNext();) { + List methods = handle.getDefn().getLocalMethods(); + for (Iterator iter = methods.iterator(); iter.hasNext();) { IMethodInfo method = ((ElementPropertyDefn) iter.next()).getMethodInfo(); if (method.getName().equals(methodName)) { - Iterator argumentListIterator = method.argumentListIterator(); + Iterator argumentListIterator = method.argumentListIterator(); if (argumentListIterator.hasNext()) { - IArgumentInfoList argumentInfoList = (IArgumentInfoList) argumentListIterator.next(); + IArgumentInfoList argumentInfoList = argumentListIterator.next(); int i = 0; - for (Iterator iterator = argumentInfoList.argumentsIterator(); iterator.hasNext(); i++) { + for (Iterator iterator = argumentInfoList.argumentsIterator(); iterator + .hasNext(); i++) { Object arg = iterator.next(); if (argIndex == i) { return ((IArgumentInfo) arg).getType(); @@ -1855,21 +1893,22 @@ public static String getMethodArgumentType(DesignElementHandle handle, String me * @param methodName * @return Arguments list, each value is an IArgumentInfo object. */ - public static List getDesignElementMethodArgumentsInfo(DesignElementHandle handle, String methodName) { - List methods = handle.getDefn().getMethods(); - List args = new ArrayList(); + public static List getDesignElementMethodArgumentsInfo(DesignElementHandle handle, + String methodName) { + List methods = handle.getDefn().getMethods(); + List args = new ArrayList(); - for (Iterator iter = methods.iterator(); iter.hasNext();) { + for (Iterator iter = methods.iterator(); iter.hasNext();) { IMethodInfo method = ((ElementPropertyDefn) iter.next()).getMethodInfo(); if (method.getName().equals(methodName)) { - Iterator argumentListIterator = method.argumentListIterator(); + Iterator argumentListIterator = method.argumentListIterator(); if (argumentListIterator.hasNext()) { - IArgumentInfoList argumentInfoList = (IArgumentInfoList) argumentListIterator.next(); + IArgumentInfoList argumentInfoList = argumentListIterator.next(); if (argumentInfoList != null) { - int i = 0; - for (Iterator iterator = argumentInfoList.argumentsIterator(); iterator.hasNext(); i++) { - IArgumentInfo arg = (IArgumentInfo) iterator.next(); + for (Iterator iterator = argumentInfoList.argumentsIterator(); iterator + .hasNext();) { + IArgumentInfo arg = iterator.next(); args.add(arg); } } @@ -1880,17 +1919,18 @@ public static List getDesignElementMethodArgumentsInfo(DesignElementHandle handl } /** + * Get the data sources + * + * @return Return the data sources * @deprecated */ @Deprecated - public static List getDataSources() { + public static List getDataSources() { ModuleHandle moduleHandle = SessionHandleAdapter.getInstance().getReportDesignHandle(); if (moduleHandle != null) { return moduleHandle.getVisibleDataSources(); - } else { - return new ArrayList(); } - + return new ArrayList(); } /** @@ -1900,7 +1940,7 @@ public static List getDataSources() { * @return the list of all column bindings available.The list order is from the * top to the given element */ - public static List getAllColumnBindingList(DesignElementHandle handle) { + public static List getAllColumnBindingList(DesignElementHandle handle) { return getAllColumnBindingList(handle, true); } @@ -1977,6 +2017,13 @@ public static ReportItemHandle getBindingHolder(DesignElementHandle handle) { return getBindingHolder(handle, false); } + /** + * Get binding holder + * + * @param handle designe element handle + * @param skipSelf skip elemnt himself + * @return Return the binding holder + */ public static ReportItemHandle getBindingHolder(DesignElementHandle handle, boolean skipSelf) { if (skipSelf || (handle instanceof ContentElementHandle)) { return getBindingHolder(handle.getContainer()); @@ -2005,10 +2052,23 @@ public static ReportItemHandle getBindingHolder(DesignElementHandle handle, bool return null; } + /** + * Get binding root + * + * @param handle + * @return Return the binding root + */ public static ReportItemHandle getBindingRoot(DesignElementHandle handle) { return getBindingRoot(handle, false); } + /** + * Get the binding root + * + * @param handle design element handle + * @param skipSelf skip element himself + * @return Return the binding root + */ public static ReportItemHandle getBindingRoot(DesignElementHandle handle, boolean skipSelf) { if (skipSelf || (handle instanceof ContentElementHandle)) { return getBindingRoot(handle.getContainer()); @@ -2057,10 +2117,23 @@ public static DataSetHandle getFirstDataSet(DesignElementHandle handle) { return dataSetHandle; } + /** + * Get the first data source + * + * @param handle design element handle + * @return Return the first data source + */ public static Object getFirstDataSource(DesignElementHandle handle) { return getFirstDataSource(handle, true); } + /** + * Get the first data source + * + * @param handle design element handle + * @param findContainer find container + * @return Return the first data source + */ public static Object getFirstDataSource(DesignElementHandle handle, boolean findContainer) { if (handle instanceof ReportItemHandle) { ReportItemHandle item = (ReportItemHandle) handle; @@ -2074,16 +2147,15 @@ public static Object getFirstDataSource(DesignElementHandle handle, boolean find } if (handle.getContainer() != null && findContainer) { return getFirstDataSource(handle.getContainer(), findContainer); - } else { - return null; } + return null; } /** * Get a container that is a ListingHandle that can hold dataset. * - * @param container - * @return + * @param container design element for the container + * @return Return the container that is a ListingHandle that can hold dataset. */ public static ListingHandle getListingContainer(DesignElementHandle container) { for (DesignElementHandle elementHandle = container; elementHandle != null; elementHandle = elementHandle @@ -2105,6 +2177,7 @@ public static ListingHandle getListingContainer(DesignElementHandle container) { * to do * * @return the handle of the binding column,or null if failed + * @throws SemanticException */ public static ComputedColumnHandle addColumn(DesignElementHandle handle, ComputedColumn column, boolean inForce) throws SemanticException { @@ -2137,6 +2210,14 @@ public static String getBindingexpression(DesignElementHandle baseElement, Compu return getBindingexpression(baseElement, column, true); } + /** + * Get the binding expression + * + * @param baseElement the base element + * @param column the binding column + * @param checkOutLevel check out level + * @return Return the binding expression + */ public static String getBindingexpression(DesignElementHandle baseElement, ComputedColumnHandle column, boolean checkOutLevel) { String exp = IReportElementConstants.BINDING_COLUMN_PREFIX; @@ -2152,10 +2233,25 @@ public static String getBindingexpression(DesignElementHandle baseElement, Compu return exp; } + /** + * Get the row number expression + * + * @param baseElement the base element + * @param elementHandle element handle + * @return Return the row number expression + */ public static String getRowNumExpression(DesignElementHandle baseElement, DesignElementHandle elementHandle) { return getRowNumExpression(baseElement, elementHandle, true); } + /** + * Get the row number expression + * + * @param baseElement the base element + * @param elementHandle element handle + * @param checkOutLevel check out level + * @return Return the row number expression + */ public static String getRowNumExpression(DesignElementHandle baseElement, DesignElementHandle elementHandle, boolean checkOutLevel) { String exp = IReportElementConstants.BINDING_COLUMN_PREFIX; @@ -2168,6 +2264,12 @@ public static String getRowNumExpression(DesignElementHandle baseElement, Design return exp; } + /** + * Verify if a cube binding exists + * + * @param element + * @return Return the verification result + */ public static boolean isBindingCube(DesignElementHandle element) { if (element == null) { return false; @@ -2180,9 +2282,10 @@ public static boolean isBindingCube(DesignElementHandle element) { } return true; } else if (((ReportItemHandle) element) - .getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) { + .getDataBindingType() == ReportItemHandleImpl.DATABINDING_TYPE_REPORT_ITEM_REF) { return isBindingCube(((ReportItemHandle) element).getDataBindingReference()); - } else if (((ReportItemHandle) element).getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_DATA) { + } else if (((ReportItemHandle) element) + .getDataBindingType() == ReportItemHandleImpl.DATABINDING_TYPE_DATA) { return false; } } @@ -2236,11 +2339,11 @@ public static boolean isLinkedElement(DesignElementHandle handle) { * @deprecated Use {@link UIUtil.getGroups()} */ @Deprecated - public static List getGroups(DesignElementHandle handle) { - List groupList = new ArrayList(); + public static List getGroups(DesignElementHandle handle) { + List groupList = new ArrayList(); if (handle instanceof ListingHandle) { SlotHandle groupSlotHandle = ((ListingHandle) handle).getGroups(); - for (Iterator iter = groupSlotHandle.iterator(); iter.hasNext();) { + for (Iterator iter = groupSlotHandle.iterator(); iter.hasNext();) { GroupHandle group = (GroupHandle) iter.next(); groupList.add(group); } @@ -2299,7 +2402,7 @@ public static String getGroupControlType(DesignElementHandle handle) { * Get the string enclosed with quote. * * @param string - * @return + * @return Return the string enclosed with quote. */ public static String addQuote(String string) { if (string != null && (!(string.startsWith("\"") && string.endsWith("\"")))) //$NON-NLS-1$//$NON-NLS-2$ @@ -2310,10 +2413,10 @@ public static String addQuote(String string) { } /** - * Remove the quote if the string enclosed width quote . + * Remove the quote if the string enclosed width quote. * * @param string - * @return + * @return Return the quote if the string enclosed width quote. */ public static String removeQuote(String string) { if (string != null && string.length() >= 2 && string.startsWith("\"") //$NON-NLS-1$ @@ -2333,6 +2436,12 @@ public static IMetaDataDictionary getMetaDataDictionary() { return designEngine.getMetaData(); } + /** + * Convert date string to xml string + * + * @param date date to be converted + * @return Return the converted string + */ public static String convertToXMLString(Date date) { if (date == null) { return null; @@ -2351,6 +2460,13 @@ public static String convertToXMLString(Date date) { return formater.format(date); } + /** + * Convert the xml date to string + * + * @param xmlString xml date string + * @return Return the converted string + * @throws ParseException + */ public static Date convertToDate(String xmlString) throws ParseException { if (StringUtil.isBlank(xmlString)) { return null; @@ -2371,25 +2487,43 @@ public static Date convertToDate(String xmlString) throws ParseException { return formater.parse(xmlString); } + /** + * Get the input size + * + * @param input design element + * @return Return the input size + */ public static int getInputSize(Object input) { if (input instanceof GroupElementHandle) { return ((GroupElementHandle) input).getElements().size(); } else if (input instanceof List) { - return (getMultiSelectionHandle((List) input)).getElements().size(); + return (getMultiSelectionHandle((List) input)).getElements().size(); } return -1; } + /** + * Get the first element of the input element + * + * @param input design element + * @return Return the first element of the input element + */ public static Object getInputFirstElement(Object input) { if (input instanceof GroupElementHandle) { return ((GroupElementHandle) input).getElements().get(0); } else if (input instanceof List) { - return ((List) input).get(0); - } else { - return input; + return ((List) input).get(0); } + return input; } + /** + * Get the first element of the input element + * + * @param input design element + * @param notSame without the same element + * @return Return the first element of the input element + */ public static Object getInputFirstElement(Object input, boolean notSame) { if (input instanceof GroupElementHandle) { if (notSame && ((GroupElementHandle) input).isSameType()) { @@ -2397,43 +2531,55 @@ public static Object getInputFirstElement(Object input, boolean notSame) { } return ((GroupElementHandle) input).getElements().get(0); } else if (input instanceof List) { - GroupElementHandle group = DEUtil.getGroupElementHandle((List) input); + GroupElementHandle group = DEUtil.getGroupElementHandle((List) input); if (notSame && group != null && group.isSameType()) { return null; } - return ((List) input).get(0); - } else { - return input; + return ((List) input).get(0); } + return input; } + /** + * Get the input element + * + * @param input input elements + * @param index index of element + * @return Return the input element + */ public static Object getInputElement(Object input, int index) { if (input instanceof GroupElementHandle) { return ((GroupElementHandle) input).getElements().get(index); } else if (input instanceof List) { - return ((List) input).get(index); - } else { - return input; + return ((List) input).get(index); } + return input; } - public static List getInputElements(Object input) { + /** + * Get an input element list + * + * @param input input elements + * @return Return an input element list + */ + public static List getInputElements(Object input) { if (input instanceof GroupElementHandle) { return ((GroupElementHandle) input).getElements(); } else if (input instanceof List) { - return (List) input; - } else { - return Collections.EMPTY_LIST; + return (List) input; } + return Collections.EMPTY_LIST; } /** - * @param input - * @param bindingName - * @return + * Get the input binding + * + * @param input report item handle + * @param bindingName binding name + * @return Return the computed column handle */ public static ComputedColumnHandle getInputBinding(ReportItemHandle input, String bindingName) { - List elementsList = DEUtil.getVisiableColumnBindingsList(input); + List elementsList = DEUtil.getVisiableColumnBindingsList(input); if (elementsList != null && elementsList.size() > 0) { for (int i = 0; i < elementsList.size(); i++) { if (((ComputedColumnHandle) elementsList.get(i)).getName().equals(bindingName)) { @@ -2444,6 +2590,12 @@ public static ComputedColumnHandle getInputBinding(ReportItemHandle input, Strin return null; } + /** + * Enable row number + * + * @param parent + * @return row number available + */ public static boolean enableRowNum(Object parent) { if (parent instanceof ReportItemHandle) { if (((ReportItemHandle) parent).getDataBindingReference() != null) { @@ -2458,17 +2610,17 @@ public static boolean enableRowNum(Object parent) { } /** - * Return the aggregate on display string + * Get the aggregate on display string * - * @param element - * @return + * @param element computed column handle + * @return Return the aggregate on display string */ public static String getAggregateOn(ComputedColumnHandle element) { - List aggregateOnList = element.getAggregateOnList(); + List aggregateOnList = element.getAggregateOnList(); // String value = ""; //$NON-NLS-1$ StringBuilder buffer = new StringBuilder(); int i = 0; - for (Iterator iterator = aggregateOnList.iterator(); iterator.hasNext(); i++) { + for (Iterator iterator = aggregateOnList.iterator(); iterator.hasNext(); i++) { if (i > 0) { // value += ","; //$NON-NLS-1$ buffer.append(","); @@ -2479,16 +2631,15 @@ public static String getAggregateOn(ComputedColumnHandle element) { String value = buffer.toString(); if (value.equals("")) { //$NON-NLS-1$ return null; - } else { // $NON-NLS-1$ - return value; } + return value; } /** - * Gets the hirarchy name + * Gets the hierarchy name * * @param object - * @return + * @return Return the hierarchy name */ public static String getFlatHirarchyPathName(Object object) { if (!(object instanceof DesignElementHandle)) { @@ -2530,7 +2681,7 @@ private static String getCombinatedName(DesignElementHandle handle) { * Test if the handle is from library. * * @param handle - * @return + * @return Test result if the handle is from library. * * @deprecated use {@link #isLinkedElement(DesignElementHandle)} */ @@ -2539,6 +2690,13 @@ public static boolean isReferenceElement(DesignElementHandle handle) { return isLinkedElement(handle); } + /** + * Get file path form of url + * + * @param url url + * @return Return the file path form of url + * @throws Exception + */ public static String getFilePathFormURL(URL url) throws Exception { if (url != null) { URL localURL = FileLocator.resolve(url); @@ -2546,19 +2704,16 @@ public static String getFilePathFormURL(URL url) throws Exception { return localURL.getPath(); } else if (localURL != null && "file".equals(localURL.getProtocol())) { return localURL.toURI().getSchemeSpecificPart(); - } else { - return null; } - } else { - return null; } + return null; } /** * If the layout is fix. * * @param model - * @return + * @return Verify result of fixed layout */ public static boolean isFixLayout(Object model) { if (!(model instanceof DesignElementHandle)) { @@ -2578,7 +2733,7 @@ public static boolean isFixLayout(Object model) { * * @param handle * @param retValue - * @return + * @return Return the padding */ public static Insets getPadding(DesignElementHandle handle, Insets retValue) { if (retValue == null) { @@ -2589,19 +2744,19 @@ public static Insets getPadding(DesignElementHandle handle, Insets retValue) { int fontSize = DEUtil.getFontSizeIntValue(handle); - DimensionValue dimensionValue = (DimensionValue) handle.getProperty(StyleHandle.PADDING_TOP_PROP); + DimensionValue dimensionValue = (DimensionValue) handle.getProperty(IStyleModel.PADDING_TOP_PROP); double px = DEUtil.convertToPixel(dimensionValue, fontSize); - dimensionValue = (DimensionValue) handle.getProperty(StyleHandle.PADDING_BOTTOM_PROP); + dimensionValue = (DimensionValue) handle.getProperty(IStyleModel.PADDING_BOTTOM_PROP); double py = DEUtil.convertToPixel(dimensionValue, fontSize); retValue.top = (int) px; retValue.bottom = (int) py; - dimensionValue = (DimensionValue) handle.getProperty(StyleHandle.PADDING_LEFT_PROP); + dimensionValue = (DimensionValue) handle.getProperty(IStyleModel.PADDING_LEFT_PROP); px = DEUtil.convertToPixel(dimensionValue, fontSize); - dimensionValue = (DimensionValue) handle.getProperty(StyleHandle.PADDING_RIGHT_PROP); + dimensionValue = (DimensionValue) handle.getProperty(IStyleModel.PADDING_RIGHT_PROP); py = DEUtil.convertToPixel(dimensionValue, fontSize); retValue.left = (int) px; @@ -2610,6 +2765,11 @@ public static Insets getPadding(DesignElementHandle handle, Insets retValue) { return retValue; } + /** + * Get the default library handle + * + * @return Return the default library handle + */ public static LibraryHandle getDefaultLibraryHandle() { URL url = FileLocator.find(EclipseUtil.getBundle(IResourceLocator.FRAGMENT_RESOURCE_HOST), new Path(DEFAULT_LIBRARY), null); @@ -2642,43 +2802,13 @@ public static LibraryHandle getDefaultLibraryHandle() { * @param elementHandle */ public static void setDefaultTheme(DesignElementHandle elementHandle) { - // We dont' set the report item theme now, it will inherit from report - // level theme. - // if ( elementHandle instanceof ReportItemHandle - // && hasDefaultLibrary( elementHandle.getModuleHandle( ) ) ) - // { - // ReportItemHandle reportItemHandle = (ReportItemHandle) elementHandle; - // PropertyHandle propertyHandle = reportItemHandle.getPropertyHandle( - // ReportItemHandle.THEME_PROP ); - // List list = propertyHandle.getReferenceableElementList( ); - // String preFileName = getDefultLibraryFileName( ); - // for ( int i = 0; i < list.size( ); i++ ) - // { - // ReportItemThemeHandle itemHandle = (ReportItemThemeHandle) list.get( - // i ); - // if ( itemHandle.getQualifiedName( ).startsWith( preFileName ) ) - // { - // try - // { - // if ( propertyHandle.getValue( ) == null ) - // propertyHandle.setValue( itemHandle.getQualifiedName( ) ); - // break; - // } - // catch ( SemanticException e ) - // { - // // do nothing - // } - // } - // } - // } - // for report design we set the report level theme to the first one from // default library if applicable if (elementHandle instanceof ReportDesignHandle && hasDefaultLibrary(elementHandle.getModuleHandle())) { ReportDesignHandle designHandle = (ReportDesignHandle) elementHandle; - PropertyHandle propertyHandle = designHandle.getPropertyHandle(ModuleHandle.THEME_PROP); + PropertyHandle propertyHandle = designHandle.getPropertyHandle(IModuleModel.THEME_PROP); if (propertyHandle.getValue() == null) { - List list = propertyHandle.getReferenceableElementList(); + List list = propertyHandle.getReferenceableElementList(); String preFileName = getDefultLibraryFileName(); for (int i = 0; i < list.size(); i++) { ThemeHandle itemHandle = (ThemeHandle) list.get(i); @@ -2715,7 +2845,7 @@ private static boolean hasDefaultLibrary(ModuleHandle handle) { } String defaultFileName = defaulthandle.getFileName(); - List list = handle.getLibraries(); + List list = handle.getLibraries(); for (int i = 0; i < list.size(); i++) { LibraryHandle temp = (LibraryHandle) list.get(i); String fileName = null; @@ -2737,6 +2867,12 @@ private static boolean hasDefaultLibrary(ModuleHandle handle) { return false; } + /** + * Reset all style properties + * + * @param handle design element handle + * @throws SemanticException + */ public static void resetAllStyleProperties(DesignElementHandle handle) throws SemanticException { if (handle == null) { return; diff --git a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java index 358d7816a5a..1b66539fd75 100644 --- a/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java +++ b/UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/ImageManager.java @@ -56,7 +56,9 @@ public class ImageManager { private static final String EMBEDDED_SUFFIX = ".Embedded."; //$NON-NLS-1$ private static final String URL_IMAGE_TYPE_SVG = "image/svg+xml"; + private static final String URL_PROTOCOL_TYPE_DATA = "data:"; + private static final String URL_PROTOCOL_TYPE_DATA_BASE = ";base64,"; private static final ImageManager instance = new ImageManager(); @@ -71,7 +73,7 @@ private ImageManager() { /** * Gets the instance of the image manager * - * @return Returns the instanceof the image manager + * @return Returns the instance of the image manager */ public static ImageManager getInstance() { return instance; diff --git a/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ReportDataServiceProvider.java b/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ReportDataServiceProvider.java index 8a57bafdc1f..595652e6649 100644 --- a/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ReportDataServiceProvider.java +++ b/chart/org.eclipse.birt.chart.reportitem.ui/src/org/eclipse/birt/chart/reportitem/ui/ReportDataServiceProvider.java @@ -145,7 +145,6 @@ import org.eclipse.birt.report.model.api.StyleHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn; -import org.eclipse.birt.report.model.api.extension.ExtendedElementException; import org.eclipse.birt.report.model.api.metadata.IPredefinedStyle; import org.eclipse.birt.report.model.api.olap.CubeHandle; import org.eclipse.birt.report.model.api.util.CubeUtil; diff --git a/engine/org.eclipse.birt.report.engine.emitter.config.docx/src/org/eclipse/birt/report/engine/emitter/config/docx/DocxEmitterDescriptor.java b/engine/org.eclipse.birt.report.engine.emitter.config.docx/src/org/eclipse/birt/report/engine/emitter/config/docx/DocxEmitterDescriptor.java index cc1d7df04c0..190983d5f3a 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.config.docx/src/org/eclipse/birt/report/engine/emitter/config/docx/DocxEmitterDescriptor.java +++ b/engine/org.eclipse.birt.report.engine.emitter.config.docx/src/org/eclipse/birt/report/engine/emitter/config/docx/DocxEmitterDescriptor.java @@ -1,12 +1,11 @@ /******************************************************************************* * Copyright (c) 2013 Actuate Corporation. - * + * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0/. - * + * * SPDX-License-Identifier: EPL-2.0 - * * * Contributors: * Actuate Corporation - initial API and implementation @@ -44,7 +43,7 @@ protected void initOptions() { chartDpi.setDisplayName(getMessage("OptionDisplayValue.ChartDpi")); //$NON-NLS-1$ chartDpi.setDataType(IConfigurableOption.DataType.INTEGER); chartDpi.setDisplayType(IConfigurableOption.DisplayType.TEXT); - chartDpi.setDefaultValue(new Integer(192)); + chartDpi.setDefaultValue(Integer.valueOf(192)); chartDpi.setToolTip(getMessage("Tooltip.ChartDpi")); chartDpi.setDescription(getMessage("OptionDescription.ChartDpi")); //$NON-NLS-1$ @@ -52,7 +51,7 @@ protected void initOptions() { embedHtml.setDisplayName(getMessage("OptionDisplayValue.EmbedHtml")); //$NON-NLS-1$ embedHtml.setDataType(IConfigurableOption.DataType.BOOLEAN); embedHtml.setDisplayType(IConfigurableOption.DisplayType.CHECKBOX); - embedHtml.setDefaultValue(new Boolean(true)); + embedHtml.setDefaultValue(Boolean.valueOf(true)); embedHtml.setToolTip(getMessage("Tooltip.EmbedHtml")); embedHtml.setDescription(getMessage("OptionDescription.EmbedHtml")); //$NON-NLS-1$ @@ -60,7 +59,7 @@ protected void initOptions() { wordVersion.setDisplayName(getMessage("OptionDisplayValue.WordVersion")); //$NON-NLS-1$ wordVersion.setDataType(IConfigurableOption.DataType.INTEGER); wordVersion.setDisplayType(IConfigurableOption.DisplayType.TEXT); - wordVersion.setDefaultValue(new Integer(2016)); + wordVersion.setDefaultValue(Integer.valueOf(2016)); IOptionValue[] choices = { new OptionValue(2010), new OptionValue(2016) }; wordVersion.setChoices(choices); wordVersion.setToolTip(getMessage("Tooltip.WordVersion")); @@ -111,6 +110,12 @@ public String getID() { return "org.eclipse.birt.report.engine.emitter.docx"; //$NON-NLS-1$ } + /** + * Get render option name + * + * @param name name of the render option + * @return Return the render option name + */ public String getRenderOptionName(String name) { assert name != null; if (CHART_DPI.equals(name)) { diff --git a/engine/org.eclipse.birt.report.engine.emitter.config/src/org/eclipse/birt/report/engine/emitter/config/ConfigurableOption.java b/engine/org.eclipse.birt.report.engine.emitter.config/src/org/eclipse/birt/report/engine/emitter/config/ConfigurableOption.java index 637f3b0a0bf..9211bcaf446 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.config/src/org/eclipse/birt/report/engine/emitter/config/ConfigurableOption.java +++ b/engine/org.eclipse.birt.report.engine.emitter.config/src/org/eclipse/birt/report/engine/emitter/config/ConfigurableOption.java @@ -58,6 +58,14 @@ public ConfigurableOption(String name) { this.name = name; } + /** + * Constructor + * + * @param name name of the configuration + * @param dataType data type + * @param displayType display type + * @param defaultValue default value + */ public ConfigurableOption(String name, DataType dataType, DisplayType displayType, Object defaultValue) { this(name); @@ -242,6 +250,11 @@ public String getName() { return name; } + /** + * Set configuration to enabled + * + * @param enabled true if configuration is enabled (false, disabled) + */ public void setEnabled(boolean enabled) { this.enabled = enabled; } @@ -256,6 +269,11 @@ public String getCategory() { return category; } + /** + * Set category + * + * @param category name of the category + */ public void setCategory(String category) { this.category = category; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/DocxRenderOption.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/DocxRenderOption.java index 2d9fddaf676..796009a221e 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/DocxRenderOption.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/DocxRenderOption.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright (c) 2008 Actuate Corporation. - * + * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0/. - * + * * SPDX-License-Identifier: EPL-2.0 - * + * * * Contributors: * Actuate Corporation - initial API and implementation @@ -14,19 +14,37 @@ package org.eclipse.birt.report.engine.api; +/** + * Render option of docx output + * + * @since 3.3 + * + */ public class DocxRenderOption extends RenderOption { + /** property: option compression mode */ public static final String OPTION_COMPRESSION_MODE = "BEST_COMPRESSION"; //$NON-NLS-1$ + /** property: option embed html */ public static final String OPTION_EMBED_HTML = "EmbedHtml"; + /** property: option word version */ public static final String OPTION_WORD_VERSION = "WordVersion"; - @SuppressWarnings("unchecked") + /** + * Set the compression mode + * + * @param compressionMode compression mode + */ public void setCompressionMode(CompressionMode compressionMode) { options.put(OPTION_COMPRESSION_MODE, compressionMode); } + /** + * Get the compression mode + * + * @return Return the compression mode + */ public CompressionMode getCompressionMode() { Object mode = options.get(OPTION_COMPRESSION_MODE); if (mode instanceof CompressionMode) { diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/Image.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/Image.java index 452efbb1c53..6adeb4a161f 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/Image.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/Image.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.net.MalformedURLException; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; @@ -117,6 +116,11 @@ public Image(byte[] data, String name, String postfix) { mimeType = FileUtil.getTypeFromExt(extension); } + /** + * Constructor + * + * @param content content environment of the image + */ public Image(IImageContent content) { String imgUri = content.getURI(); byte[] imgData = content.getData(); @@ -185,6 +189,11 @@ public int getSource() { return source; } + /** + * Set the image source + * + * @param source image source + */ public void setSource(int source) { this.source = source; } @@ -248,6 +257,11 @@ public String getMimeType() { return mimeType; } + /** + * Set mime type + * + * @param mimeType mime type of the image + */ public void setMimeType(String mimeType) { this.mimeType = mimeType; } @@ -257,6 +271,11 @@ public String getImageMap() { return imageMap; } + /** + * Set the image mape + * + * @param imageMap image map + */ public void setImageMap(String imageMap) { this.imageMap = imageMap; } @@ -267,7 +286,7 @@ public void setImageMap(String imageMap) { * @see org.eclipse.birt.report.engine.api2.IImage#writeImage(java.io.File) */ @Override - public void writeImage(File dest) throws IOException { + public void writeImage(File dest) { if (source == IImage.INVALID_IMAGE) { logger.log(Level.SEVERE, "image source {0} is not valid!", id); //$NON-NLS-1$ return; @@ -278,8 +297,6 @@ public void writeImage(File dest) throws IOException { logger.log(Level.SEVERE, "image source {0} is not found!", id); //$NON-NLS-1$ return; } - // if(!dest.exists()) - // { String parent = new File(dest.getAbsolutePath()).getParent(); File parentDir = new File(parent); @@ -308,8 +325,6 @@ public void writeImage(File dest) throws IOException { } } } - // } - } /** @@ -341,6 +356,11 @@ public String getExtension() { return extension; } + /** + * Set image size + * + * @param size image size + */ public void setImageSize(ImageSize size) { imageSize = size; } diff --git a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/emitter/ImageReader.java b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/emitter/ImageReader.java index 88a444a666f..8532792878d 100644 --- a/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/emitter/ImageReader.java +++ b/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/emitter/ImageReader.java @@ -38,16 +38,36 @@ import org.eclipse.birt.report.model.api.IResourceLocator; import org.eclipse.birt.report.model.api.ReportDesignHandle; +/** + * Image reader of pdf output + * + * @since 3.3 + * + */ public class ImageReader { + /** property: type image object, raster image */ public static final int TYPE_IMAGE_OBJECT = 0; + + /** property: type image object, flash */ public static final int TYPE_FLASH_OBJECT = 1; + + /** property: type image object, svg image */ public static final int TYPE_SVG_OBJECT = 2; + + /** property: type image object, converted svg image */ public static final int TYPE_CONVERTED_SVG_OBJECT = 3; + /** property: image read status, unloaded */ public static final int OBJECT_UNLOADED = -1; + + /** property: image read status, resource unreachable */ public static final int RESOURCE_UNREACHABLE = 0; + + /** property: image read status, unsupported object */ public static final int UNSUPPORTED_OBJECTS = 1; + + /** property: image read status, object loaded successfully */ public static final int OBJECT_LOADED_SUCCESSFULLY = 2; private int objectType = TYPE_IMAGE_OBJECT; @@ -63,6 +83,12 @@ public class ImageReader { private static final String URL_PROTOCOL_TYPE_DATA = "data:"; private static final String URL_PROTOCOL_TYPE_FILE = "file:"; + /** + * Constructor + * + * @param content content environment of the image + * @param supportedImageFormats supported image formats + */ public ImageReader(IImageContent content, String supportedImageFormats) { this.content = content; this.supportedImageFormats = supportedImageFormats; @@ -72,6 +98,11 @@ public ImageReader(IImageContent content, String supportedImageFormats) { } } + /** + * Read the image + * + * @return Return the read status + */ public int read() { buffer = null; checkObjectType(content); @@ -111,10 +142,20 @@ public int read() { return status; } + /** + * Get the byte array of the image + * + * @return Return the byte array of the image + */ public byte[] getByteArray() { return buffer; } + /** + * Get the image type + * + * @return Return the image type + */ public int getType() { return objectType; } @@ -239,7 +280,7 @@ private void readImage(InputStream in) throws IOException { } } - private void readImage(byte[] data) throws IOException { + private void readImage(byte[] data) { if (data == null || data.length == 0) { buffer = null; status = RESOURCE_UNREACHABLE; diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractThemeHandle.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractThemeHandle.java index 0fafa72e320..918d03a5454 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractThemeHandle.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/AbstractThemeHandle.java @@ -76,13 +76,13 @@ public final SlotHandle getStyles() { * @return all styles.each item is StyleHandle */ - public final List getAllStyles() { + public final List getAllStyles() { AbstractTheme theme = (AbstractTheme) getElement(); - List styles = new ArrayList(); - List styleList = theme.getAllStyles(); - Iterator iter = styleList.iterator(); + List styles = new ArrayList(); + List styleList = theme.getAllStyles(); + Iterator iter = styleList.iterator(); while (iter.hasNext()) { - StyleElement style = (StyleElement) iter.next(); + StyleElement style = iter.next(); styles.add(style.getHandle(module)); } return styles; @@ -117,7 +117,7 @@ final String makeUniqueStyleName(String name) { assert this != null; SlotHandle styles = getStyles(); - Set set = new HashSet(); + Set set = new HashSet(); for (int i = 0; i < styles.getCount(); i++) { StyleHandle style = (StyleHandle) styles.get(i); set.add(style.getName()); @@ -127,7 +127,7 @@ final String makeUniqueStyleName(String name) { PropertyHandle propHandle = getPropertyHandle(IAbstractThemeModel.CSSES_PROP); if (propHandle != null) { - Iterator iterator = propHandle.iterator(); + Iterator iterator = propHandle.iterator(); while (iterator.hasNext()) { IncludedCssStyleSheetHandle handle = (IncludedCssStyleSheetHandle) iterator.next(); set.add(handle.getFileName()); @@ -171,7 +171,6 @@ public final String getDisplayLabel(int level) { * * @return the iterator over all included css style sheets. */ - public final Iterator includeCssesIterator() { PropertyHandle propHandle = getPropertyHandle(CSSES_PROP); return propHandle == null ? Collections.emptyList().iterator() : propHandle.iterator(); @@ -182,13 +181,12 @@ public final Iterator includeCssesIterator() { * * @return each item is CssStyleSheetHandle */ - - public List getAllCssStyleSheets() { + public List getAllCssStyleSheets() { AbstractTheme theme = (AbstractTheme) getElement(); - List allStyles = new ArrayList(); - List csses = theme.getCsses(); + List allStyles = new ArrayList(); + List csses = theme.getCsses(); for (int i = 0; csses != null && i < csses.size(); ++i) { - CssStyleSheet sheet = (CssStyleSheet) csses.get(i); + CssStyleSheet sheet = csses.get(i); allStyles.add(sheet.handle(getModule())); } return allStyles; @@ -197,10 +195,12 @@ public List getAllCssStyleSheets() { /** * (non-Javadoc) * + * @param sheetHandle + * @throws SemanticException + * * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#addCss(org.eclipse * .birt.report.model.api.css.CssStyleSheetHandle) */ - public void addCss(CssStyleSheetHandle sheetHandle) throws SemanticException { CssStyleSheetHandleAdapter adapter = new CssStyleSheetHandleAdapter(module, getElement()); adapter.addCss(sheetHandle); @@ -209,10 +209,12 @@ public void addCss(CssStyleSheetHandle sheetHandle) throws SemanticException { /** * (non-Javadoc) * + * @param cssStruct + * @throws SemanticException + * * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#addCss(org.eclipse * .birt.report.model.api.elements.structures.IncludedCssStyleSheet) */ - public void addCss(IncludedCssStyleSheet cssStruct) throws SemanticException { if (cssStruct == null) { return; @@ -223,11 +225,12 @@ public void addCss(IncludedCssStyleSheet cssStruct) throws SemanticException { } /** - * (non-Javadoc) + * Add css based on file + * + * @param fileName file name of the css style sheet + * @throws SemanticException * * @deprecated - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#addCssByFileName(java.lang - * .String) */ @Deprecated public void addCss(String fileName) throws SemanticException { @@ -235,12 +238,13 @@ public void addCss(String fileName) throws SemanticException { adapter.addCss(fileName); } - /* - * (non-Javadoc) + /** + * Add css based on properties * - * @see - * org.eclipse.birt.report.model.api.AbstractThemeHandle#addCssByProerties(java. - * lang .String) + * @param fileName file name of the css file + * @param externalCssURI external css uri + * @param isUseExternalCss use external css + * @throws SemanticException */ public void addCssByProerties(String fileName, String externalCssURI, boolean isUseExternalCss) throws SemanticException { @@ -249,22 +253,21 @@ public void addCssByProerties(String fileName, String externalCssURI, boolean is } /** - * (non-Javadoc) + * Check if the css style sheet can be dropped based on sheet handle * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#dropCss(org.eclipse - * .birt.report.model.api.css.CssStyleSheetHandle) + * @param sheetHandle + * @throws SemanticException */ - public void dropCss(CssStyleSheetHandle sheetHandle) throws SemanticException { CssStyleSheetHandleAdapter adapter = new CssStyleSheetHandleAdapter(module, getElement()); adapter.dropCss(sheetHandle); } /** - * (non-Javadoc) + * Check if the css style sheet can be dropped based on sheet handle * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#canDropCssStyleSheet - * (org.eclipse.birt.report.model.api.css.CssStyleSheetHandle) + * @param sheetHandle sheet handle to be validated + * @return Return the value of drop option of css style sheet */ public boolean canDropCssStyleSheet(CssStyleSheetHandle sheetHandle) { CssStyleSheetHandleAdapter adapter = new CssStyleSheetHandleAdapter(module, getElement()); @@ -272,23 +275,23 @@ public boolean canDropCssStyleSheet(CssStyleSheetHandle sheetHandle) { } /** - * (non-Javadoc) + * Check if the css style sheet can be added based on sheet handle * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#canAddCssStyleSheet - * (org.eclipse.birt.report.model.api.css.CssStyleSheetHandle) + * @param sheetHandle sheet handle to be validated + * @return Return the validation result of the add option */ - public boolean canAddCssStyleSheet(CssStyleSheetHandle sheetHandle) { CssStyleSheetHandleAdapter adapter = new CssStyleSheetHandleAdapter(module, getElement()); return adapter.canAddCssStyleSheet(sheetHandle); } /** - * (non-Javadoc) + * Check if the css style sheet can be added based on file name + * + * @param fileName file name of the css style sheet + * @return Return the validation result of the add option * * @deprecated - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#canAddCssStyleSheet - * (java.lang.String) */ @Deprecated public boolean canAddCssStyleSheet(String fileName) { @@ -297,35 +300,36 @@ public boolean canAddCssStyleSheet(String fileName) { } /** - * (non-Javadoc) + * Check if the css style sheet can be added based on properties * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#canAddCssStyleSheetByProperties - * (java.lang.String) + * @param fileName file name of the css file + * @param externalCssURI external css uri + * @param useExternalCss use external css + * @return Give the value of add option of css sytle sheet */ public boolean canAddCssStyleSheetByProperties(String fileName, String externalCssURI, boolean useExternalCss) { CssStyleSheetHandleAdapter adapter = new CssStyleSheetHandleAdapter(module, getElement()); return adapter.canAddCssStyleSheetByProperties(fileName, externalCssURI, useExternalCss); } - /* - * (non-Javadoc) + /** + * Reload the css style * - * @see - * org.eclipse.birt.report.model.api.AbstractThemeHandle#reloadCss(org.eclipse - * .birt.report.model.api.css.CssStyleSheetHandle) + * @param sheetHandle css style sheet handle to be reloaded + * @throws SemanticException */ - public void reloadCss(CssStyleSheetHandle sheetHandle) throws SemanticException { CssStyleSheetHandleAdapter adapter = new CssStyleSheetHandleAdapter(module, getElement()); adapter.reloadCss(sheetHandle); } /** - * (non-Javadoc) + * Find the css style sheet handle based on file name + * + * @param fileName file name of the css style sheet + * @return Return the css style sheet handle * * @deprecated - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle# - * findCssStyleSheetHandleByName(java.lang.String) */ @Deprecated public CssStyleSheetHandle findCssStyleSheetHandleByName(String fileName) { @@ -335,11 +339,12 @@ public CssStyleSheetHandle findCssStyleSheetHandleByName(String fileName) { } /** - * (non-Javadoc) + * Find the css style sheet handle based on properties * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle# - * findCssStyleSheetHandleByProperties(java.lang.String, java.lang.String, - * java.lang.Boolean) + * @param fileName file name of the css + * @param externalCssURI external css uri + * @param useExternalCss use external css + * @return Return the css style sheet handle */ public CssStyleSheetHandle findCssStyleSheetHandleByProperties(String fileName, String externalCssURI, boolean useExternalCss) { @@ -349,11 +354,12 @@ public CssStyleSheetHandle findCssStyleSheetHandleByProperties(String fileName, } /** - * (non-Javadoc) + * Find the included css style sheet handle based on file name + * + * @param fileName file name of the css + * @return Return the css style sheet handle * * @deprecated - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle# - * findIncludedCssStyleSheetHandleByName(java.lang.String) */ @Deprecated public IncludedCssStyleSheetHandle findIncludedCssStyleSheetHandleByName(String fileName) { @@ -362,11 +368,12 @@ public IncludedCssStyleSheetHandle findIncludedCssStyleSheetHandleByName(String } /** - * (non-Javadoc) + * Find the included css style sheet handle based on properties * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle# - * findIncludedCssStyleSheetHandleByProperties(java.lang.String, - * java.lang.String, java.lang.Boolean) + * @param fileName file name of the css + * @param externalCssURI external css uri + * @param useExternalCss use external css + * @return Return the css style sheet handle */ public IncludedCssStyleSheetHandle findIncludedCssStyleSheetHandleByProperties(String fileName, String externalCssURI, boolean useExternalCss) { @@ -375,11 +382,13 @@ public IncludedCssStyleSheetHandle findIncludedCssStyleSheetHandleByProperties(S } /** - * (non-Javadoc) + * Rename css properties based on file name + * + * @param handle css sytle sheet handle + * @param newFileName new file name + * @throws SemanticException * * @deprecated - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#renameCss(org.eclipse - * .birt.report.model.api.IncludedCssStyleSheetHandle, java.lang.String) */ @Deprecated public void renameCss(IncludedCssStyleSheetHandle handle, String newFileName) throws SemanticException { @@ -389,11 +398,14 @@ public void renameCss(IncludedCssStyleSheetHandle handle, String newFileName) th } /** - * (non-Javadoc) + * Rename css properties based on properties + * + * @param handle css style sheet handle + * @param newFileName new file name + * @param externalCssURI external css uri + * @param useExternalCss use external css + * @throws SemanticException * - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#renameCssByProperties(org.eclipse - * .birt.report.model.api.IncludedCssStyleSheetHandle, java.lang.String, - * java.lang.String, java.lang.Boolean) */ public void renameCssByProperties(IncludedCssStyleSheetHandle handle, String newFileName, String externalCssURI, boolean useExternalCss) throws SemanticException { @@ -403,12 +415,13 @@ public void renameCssByProperties(IncludedCssStyleSheetHandle handle, String new } /** - * (non-Javadoc) + * Verify if the css could be renamed by file name * + * @param handle css style sheet handle + * @param newFileName new file name + * @return Verification result of renaming + * @throws SemanticException * @deprecated - * @see org.eclipse.birt.report.model.api.AbstractThemeHandle#canRenameCss(org - * .eclipse.birt.report.model.api.IncludedCssStyleSheetHandle, - * java.lang.String) */ @Deprecated public boolean canRenameCss(IncludedCssStyleSheetHandle handle, String newFileName) throws SemanticException { @@ -417,12 +430,13 @@ public boolean canRenameCss(IncludedCssStyleSheetHandle handle, String newFileNa } /** + * Verify if the css could be renamed by property * - * @param handle - * @param newFileName - * @param externalCssURI - * @param useExternalCss - * @return + * @param handle css style sheet handle + * @param newFileName new file name + * @param externalCssURI external css uri + * @param useExternalCss use external css + * @return Verification result of renaming * @throws SemanticException */ public boolean canRenameCssByProperties(IncludedCssStyleSheetHandle handle, String newFileName, diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportItemHandleImpl.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportItemHandleImpl.java index b899e7de841..98b5feb99e7 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportItemHandleImpl.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportItemHandleImpl.java @@ -18,6 +18,7 @@ import java.util.List; import org.eclipse.birt.report.model.api.activity.SemanticException; +import org.eclipse.birt.report.model.api.core.IModuleModel; import org.eclipse.birt.report.model.api.elements.IReportItemMethodContext; import org.eclipse.birt.report.model.api.elements.structures.ComputedColumn; import org.eclipse.birt.report.model.api.elements.structures.TOC; @@ -33,7 +34,9 @@ import org.eclipse.birt.report.model.elements.ReportDesign; import org.eclipse.birt.report.model.elements.ReportItem; import org.eclipse.birt.report.model.elements.ReportItemTheme; -import org.eclipse.birt.report.model.elements.interfaces.IReportItemModel; +import org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel; +import org.eclipse.birt.report.model.elements.interfaces.IInternalReportDesignModel; +import org.eclipse.birt.report.model.elements.interfaces.IInternalReportItemModel; import org.eclipse.birt.report.model.elements.interfaces.IStyledElementModel; import org.eclipse.birt.report.model.elements.interfaces.ISupportThemeElement; import org.eclipse.birt.report.model.elements.olap.Cube; @@ -46,8 +49,14 @@ import org.eclipse.birt.report.model.util.UnusedBoundColumnsMgr; import org.eclipse.birt.report.model.util.VersionUtil; +/** + * Abstract implementation class for the report item handle + * + * @since 3.3 + * + */ public abstract class ReportItemHandleImpl extends ReportElementHandle - implements IReportItemModel, IStyledElementModel, IReportItemMethodContext { + implements IInternalReportItemModel, IStyledElementModel, IReportItemMethodContext { /** * Data binding type "none". @@ -64,13 +73,19 @@ public abstract class ReportItemHandleImpl extends ReportElementHandle */ public static final int DATABINDING_TYPE_REPORT_ITEM_REF = 2; + /** + * Constructor + * + * @param module module of the report item + * @param element element of the report item + */ public ReportItemHandleImpl(Module module, DesignElement element) { super(module, element); } /** * Returns the data set of the report item. - * + * * @return the handle to the data set */ public DataSetHandle getDataSet() { @@ -86,9 +101,9 @@ public DataSetHandle getDataSet() { /** * Sets the data set of the report item. - * + * * @param handle the handle of the data set - * + * * @throws SemanticException if the property is locked. */ public void setDataSet(DataSetHandle handle) throws SemanticException { @@ -107,7 +122,7 @@ public void setDataSet(DataSetHandle handle) throws SemanticException { /** * Returns the cube of the report item. - * + * * @return the handle to the cube */ public CubeHandle getCube() { @@ -123,9 +138,9 @@ public CubeHandle getCube() { /** * Sets the cube of the report item. - * + * * @param handle the handle of the cube - * + * * @throws SemanticException if the property is locked. */ public void setCube(CubeHandle handle) throws SemanticException { @@ -144,20 +159,20 @@ public void setCube(CubeHandle handle) throws SemanticException { /** * Gets a handle to deal with the item's x (horizontal) position. - * + * * @return a DimensionHandle for the item's x position. */ public DimensionHandle getX() { - return super.getDimensionProperty(IReportItemModel.X_PROP); + return super.getDimensionProperty(IInternalReportItemModel.X_PROP); } /** * Gets a handle to deal with the item's y (vertical) position. - * + * * @return a DimensionHandle for the item's y position. */ public DimensionHandle getY() { - return super.getDimensionProperty(IReportItemModel.Y_PROP); + return super.getDimensionProperty(IInternalReportItemModel.Y_PROP); } /** @@ -165,24 +180,24 @@ public DimensionHandle getY() { * such as "10" or "10pt". If no suffix is provided, then the units are assumed * to be in the design's default units. Call this method to set a string typed * in by the user. - * + * * @param dimension dimension string with optional unit suffix. * @throws SemanticException if the string is not valid */ public void setX(String dimension) throws SemanticException { - setProperty(IReportItemModel.X_PROP, dimension); + setProperty(IInternalReportItemModel.X_PROP, dimension); } /** * Sets the item's x position to a value in default units. The default unit may * be defined by the property in BIRT or the application unit defined in the * design session. - * + * * @param dimension the new value in application units. * @throws SemanticException if the property is locked. */ public void setX(double dimension) throws SemanticException { - setFloatProperty(IReportItemModel.X_PROP, dimension); + setFloatProperty(IInternalReportItemModel.X_PROP, dimension); } /** @@ -190,24 +205,24 @@ public void setX(double dimension) throws SemanticException { * such as "10" or "10pt". If no suffix is provided, then the units are assumed * to be in the design's default units. Call this method to set a string typed * in by the user. - * + * * @param dimension dimension string with optional unit suffix. * @throws SemanticException if the string is not valid */ public void setY(String dimension) throws SemanticException { - setProperty(IReportItemModel.Y_PROP, dimension); + setProperty(IInternalReportItemModel.Y_PROP, dimension); } /** * Sets the item's y position to a value in default units. The default unit may * be defined by the property in BIRT or the application unit defined in the * design session. - * + * * @param dimension the new value in application units. * @throws SemanticException if the property is locked. */ public void setY(double dimension) throws SemanticException { - setFloatProperty(IReportItemModel.Y_PROP, dimension); + setFloatProperty(IInternalReportItemModel.Y_PROP, dimension); } /** @@ -215,24 +230,24 @@ public void setY(double dimension) throws SemanticException { * such as "10" or "10pt". If no suffix is provided, then the units are assumed * to be in the design's default units. Call this method to set a string typed * in by the user. - * + * * @param dimension dimension string with optional unit suffix. * @throws SemanticException if the string is not valid */ public void setHeight(String dimension) throws SemanticException { - setProperty(IReportItemModel.HEIGHT_PROP, dimension); + setProperty(IInternalReportItemModel.HEIGHT_PROP, dimension); } /** * Sets the item's height to a value in default units. The default unit may be * defined by the property in BIRT or the application unit defined in the design * session. - * + * * @param dimension the new value in application units. * @throws SemanticException if the property is locked. */ public void setHeight(double dimension) throws SemanticException { - setFloatProperty(IReportItemModel.HEIGHT_PROP, dimension); + setFloatProperty(IInternalReportItemModel.HEIGHT_PROP, dimension); } /** @@ -240,74 +255,74 @@ public void setHeight(double dimension) throws SemanticException { * as "10" or "10pt". If no suffix is provided, then the units are assumed to be * in the design's default units. Call this method to set a string typed in by * the user. - * + * * @param dimension dimension string with optional unit suffix. * @throws SemanticException if the string is not valid */ public void setWidth(String dimension) throws SemanticException { - setProperty(IReportItemModel.WIDTH_PROP, dimension); + setProperty(IInternalReportItemModel.WIDTH_PROP, dimension); } /** * Sets the item's width to a value in default units. The default unit may be * defined by the property in BIRT or the application unit defined in the design * session. - * + * * @param dimension the new value in application units. * @throws SemanticException if the property is locked. */ public void setWidth(double dimension) throws SemanticException { - setFloatProperty(IReportItemModel.WIDTH_PROP, dimension); + setFloatProperty(IInternalReportItemModel.WIDTH_PROP, dimension); } /** * Gets a handle to deal with the item's width. - * + * * @return a DimensionHandle for the item's width. */ public DimensionHandle getWidth() { - return super.getDimensionProperty(IReportItemModel.WIDTH_PROP); + return super.getDimensionProperty(IInternalReportItemModel.WIDTH_PROP); } /** * Gets a handle to deal with the item's height. - * + * * @return a DimensionHandle for the item's height. */ public DimensionHandle getHeight() { - return super.getDimensionProperty(IReportItemModel.HEIGHT_PROP); + return super.getDimensionProperty(IInternalReportItemModel.HEIGHT_PROP); } /** * Returns the bookmark of the report item. - * + * * @return the book mark as a string */ public String getBookmark() { - return getStringProperty(IReportItemModel.BOOKMARK_PROP); + return getStringProperty(IInternalReportItemModel.BOOKMARK_PROP); } /** * Sets the bookmark of the report item. - * + * * @param value the property value to be set. * @throws SemanticException if the property is locked. */ public void setBookmark(String value) throws SemanticException { - setStringProperty(IReportItemModel.BOOKMARK_PROP, value); + setStringProperty(IInternalReportItemModel.BOOKMARK_PROP, value); } /** * Returns visibility rules defined on the report item. The element in the * iterator is the corresponding StructureHandle that deal with a * Hide in the list. - * + * * @return the iterator for visibility rules defined on this report item. - * + * * @see org.eclipse.birt.report.model.api.elements.structures.HideRule */ public Iterator visibilityRulesIterator() { - PropertyHandle propHandle = getPropertyHandle(IReportItemModel.VISIBILITY_PROP); + PropertyHandle propHandle = getPropertyHandle(IInternalReportItemModel.VISIBILITY_PROP); if (propHandle == null) { return Collections.EMPTY_LIST.iterator(); } @@ -318,58 +333,58 @@ public Iterator visibilityRulesIterator() { * Returns the script executed when the element is created in the Factory. * Called after the item is created, but before the item is saved to the report * document file. - * + * * @return the script that executes */ public String getOnCreate() { - return getStringProperty(IReportItemModel.ON_CREATE_METHOD); + return getStringProperty(IInternalReportItemModel.ON_CREATE_METHOD); } /** * Sets the script executed when the element is created in the Factory. Called * after the item is created, but before the item is saved to the report * document file. - * + * * @param value the script to set * @throws SemanticException if the property is locked. */ public void setOnCreate(String value) throws SemanticException { - setProperty(IReportItemModel.ON_CREATE_METHOD, value); + setProperty(IInternalReportItemModel.ON_CREATE_METHOD, value); } /** * Returns the script executed when the element is prepared for rendering in the * Presentation engine. - * + * * @return the script that executes */ public String getOnRender() { - return getStringProperty(IReportItemModel.ON_RENDER_METHOD); + return getStringProperty(IInternalReportItemModel.ON_RENDER_METHOD); } /** * Sets the script executed when the element is prepared for rendering in the * Presentation engine. - * + * * @param value the script to set * @throws SemanticException if the property is locked. */ public void setOnRender(String value) throws SemanticException { - setProperty(IReportItemModel.ON_RENDER_METHOD, value); + setProperty(IInternalReportItemModel.ON_RENDER_METHOD, value); } /** * Returns the iterator for parameter binding list defined on this report item. * The element in the iterator is the corresponding StructureHandle * that deal with a ParamBinding in the list. - * + * * @return the iterator for parameter binding handle list defined on this data * set. - * + * * @see org.eclipse.birt.report.model.api.elements.structures.ParamBindingHandle */ public Iterator paramBindingsIterator() { - PropertyHandle propHandle = getPropertyHandle(IReportItemModel.PARAM_BINDINGS_PROP); + PropertyHandle propHandle = getPropertyHandle(IInternalReportItemModel.PARAM_BINDINGS_PROP); if (propHandle == null) { return Collections.EMPTY_LIST.iterator(); @@ -381,17 +396,17 @@ public Iterator paramBindingsIterator() { * Sets a table of contents entry for this item. The TOC property defines an * expression that returns a string that is to appear in the Table of Contents * for this item or its container. - * + * * @param expression the expression that returns a string * @throws SemanticException if the TOC property is locked by the property mask. - * + * * @see #getTocExpression() * @deprecated */ @Deprecated public void setTocExpression(String expression) throws SemanticException { if (StringUtil.isEmpty(expression)) { - setProperty(IReportItemModel.TOC_PROP, null); + setProperty(IInternalReportItemModel.TOC_PROP, null); return; } TOCHandle tocHandle = getTOC(); @@ -409,7 +424,7 @@ public void setTocExpression(String expression) throws SemanticException { /** * Returns the expression evalueated as a table of contents entry for this item. - * + * * @return the expression evaluated as a table of contents entry for this item * @see #setTocExpression(String) * @deprecated @@ -426,33 +441,33 @@ public String getTocExpression() { /** * Gets the on-prepare script of the group. Startup phase. No data binding yet. * The design of an element can be changed here. - * + * * @return the on-prepare script of the group - * + * */ public String getOnPrepare() { - return getStringProperty(IReportItemModel.ON_PREPARE_METHOD); + return getStringProperty(IInternalReportItemModel.ON_PREPARE_METHOD); } /** * Sets the on-prepare script of the group element. - * + * * @param script the script to set * @throws SemanticException if the method is locked. - * + * * @see #getOnPrepare() */ public void setOnPrepare(String script) throws SemanticException { - setProperty(IReportItemModel.ON_PREPARE_METHOD, script); + setProperty(IInternalReportItemModel.ON_PREPARE_METHOD, script); } /** * Gets the on-pageBreak script of the report item. Presentation phase. It is * for a script executed when the element is prepared for page breaking in the * Presentation engine. - * + * * @return the on-pageBreak script of the report item - * + * */ public String getOnPageBreak() { return getStringProperty(ON_PAGE_BREAK_METHOD); @@ -460,10 +475,10 @@ public String getOnPageBreak() { /** * Sets the on-pageBreak script of the report item. - * + * * @param script the script to set * @throws SemanticException if the method is locked. - * + * * @see #getOnPageBreak() */ public void setOnPageBreak(String script) throws SemanticException { @@ -473,7 +488,7 @@ public void setOnPageBreak(String script) throws SemanticException { /** * Returns the bound columns that binds the data set columns. The item in the * iterator is the corresponding ComputedColumnHandle. - * + * * @return a list containing the bound columns. */ public Iterator columnBindingsIterator() { @@ -486,8 +501,8 @@ public Iterator columnBindingsIterator() { /** * Get a handle to deal with the bound column. - * - * @return a handle to deal with the boudn data column. + * + * @return a handle to deal with the bound data column. */ public PropertyHandle getColumnBindings() { return getPropertyHandle(BOUND_DATA_COLUMNS_PROP); @@ -496,7 +511,7 @@ public PropertyHandle getColumnBindings() { /** * Returns all the bindings which are available for this element. If the report * item has no local data set, the bindings come from its container. - * + * * @return each item is a ComputedColumnHandle instance. */ public Iterator getAvailableBindings() { @@ -514,7 +529,7 @@ public Iterator getAvailableBindings() { // item's data set property is not null. This should be the same as // getColumnBindings() API. - if (getProperty(IReportItemModel.DATA_SET_PROP) != null) { + if (getProperty(IInternalReportItemModel.DATA_SET_PROP) != null) { return bindings.iterator(); } @@ -547,12 +562,11 @@ public Iterator getAvailableBindings() { /** * Adds a bound column to the list. - * + * * @param addColumn the bound column to add * @param inForce true the column is added to the list regardless * of duplicate expression. false do not add the * column if the expression already exist - * @param column the bound column * @return the newly created ComputedColumnHandle or the existed * ComputedColumnHandle in the list * @throws SemanticException if expression is not duplicate but the name @@ -565,7 +579,7 @@ public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn, boolean i return null; } - List columns = (List) getProperty(BOUND_DATA_COLUMNS_PROP); + List columns = (List) getProperty(BOUND_DATA_COLUMNS_PROP); if (columns == null) { return (ComputedColumnHandle) getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn); } @@ -581,7 +595,7 @@ public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn, boolean i /** * Finds a column binding with the given name. - * + * * @param name name of the binding to find * @return column binding with the given name if found, otherwise null */ @@ -589,7 +603,7 @@ public ComputedColumnHandle findColumnBinding(String name) { if (name == null) { return null; } - List columns = (List) getProperty(BOUND_DATA_COLUMNS_PROP); + List columns = (List) getProperty(BOUND_DATA_COLUMNS_PROP); if (columns == null) { return null; } @@ -607,7 +621,7 @@ public ComputedColumnHandle findColumnBinding(String name) { * elements will not be removed. For example, if calls this method for a list * thaat contains a text-data, unused bound columns on list are removed. While, * unused columns on text-data still are kept. - * + * * @throws SemanticException if bound column property is locked. */ public void removedUnusedColumnBindings() throws SemanticException { @@ -616,11 +630,11 @@ public void removedUnusedColumnBindings() throws SemanticException { /** * Gets TOC handle. - * + * * @return toc handle */ public TOCHandle getTOC() { - PropertyHandle propHandle = getPropertyHandle(IReportItemModel.TOC_PROP); + PropertyHandle propHandle = getPropertyHandle(IInternalReportItemModel.TOC_PROP); if (propHandle == null) { return null; } @@ -635,7 +649,7 @@ public TOCHandle getTOC() { /** * Adds toc structure. - * + * * @param expression toc expression * @return toc handle * @throws SemanticException @@ -646,60 +660,60 @@ public TOCHandle addTOC(String expression) throws SemanticException { } TOC toc = StructureFactory.createTOC(expression); - setProperty(IReportItemModel.TOC_PROP, toc); + setProperty(IInternalReportItemModel.TOC_PROP, toc); - return (TOCHandle) toc.getHandle(getPropertyHandle(IReportItemModel.TOC_PROP)); + return (TOCHandle) toc.getHandle(getPropertyHandle(IInternalReportItemModel.TOC_PROP)); } /** * Adds toc structure. - * + * * @param toc toc structure * @return toc handle * @throws SemanticException */ public TOCHandle addTOC(TOC toc) throws SemanticException { - setProperty(IReportItemModel.TOC_PROP, toc); + setProperty(IInternalReportItemModel.TOC_PROP, toc); if (toc == null) { return null; } - return (TOCHandle) toc.getHandle(getPropertyHandle(IReportItemModel.TOC_PROP)); + return (TOCHandle) toc.getHandle(getPropertyHandle(IInternalReportItemModel.TOC_PROP)); } /** * Gets the item's z position as an integer. - * + * * @return the z depth. Start from 0 */ public int getZIndex() { - return super.getIntProperty(IReportItemModel.Z_INDEX_PROP); + return super.getIntProperty(IInternalReportItemModel.Z_INDEX_PROP); } /** * Sets the item's z position to an integer. - * + * * @param zIndex the z depth. Start from 0 * @throws SemanticException if the property is locked. */ public void setZIndex(int zIndex) throws SemanticException { - setIntProperty(IReportItemModel.Z_INDEX_PROP, zIndex); + setIntProperty(IInternalReportItemModel.Z_INDEX_PROP, zIndex); } /** * Returns functions that can be called in the given method. - * + * * @param methodName the method name in string - * + * * @return a list containing IMethodInfo for functions */ - public List getMethods(String methodName) { - return Collections.EMPTY_LIST; + public List getMethods(String methodName) { + return Collections.emptyList(); } /** * Sets the report item of which data binding are referred by. - * + * * @param item the report item * @throws SemanticException if the element reference makes a circle */ @@ -709,7 +723,7 @@ public void setDataBindingReference(ReportItemHandle item) throws SemanticExcept /** * Returns the name of the report item of which data binding are referred by. - * + * * @return the report item name */ public String getDataBindingReferenceName() { @@ -718,7 +732,7 @@ public String getDataBindingReferenceName() { /** * Returns the report item of which data binding are referred by. - * + * * @return the report item */ public ReportItemHandle getDataBindingReference() { @@ -734,13 +748,13 @@ public ReportItemHandle getDataBindingReference() { /** * Returns the data binding type of this report item. The return value should be * one of following: - * + * *
    *
  • DATABINDING_TYPE_NONE, no data binding. *
  • DATABINDING_TYPE_DATA, data binding to data set or cube. *
  • DATABINDING_TYPE_REPORT_ITEM_REF, data binding to another report item. *
- * + * * @return the data binding type of this report item */ public int getDataBindingType() { @@ -748,8 +762,8 @@ public int getDataBindingType() { return DATABINDING_TYPE_REPORT_ITEM_REF; } - if (element.getProperty(module, IReportItemModel.DATA_SET_PROP) != null - || element.getProperty(module, IReportItemModel.CUBE_PROP) != null) { + if (element.getProperty(module, IInternalReportItemModel.DATA_SET_PROP) != null + || element.getProperty(module, IInternalReportItemModel.CUBE_PROP) != null) { return DATABINDING_TYPE_DATA; } @@ -768,10 +782,10 @@ public int getDataBindingType() { * * ReportItem in the design are all applicable. Each entry of the return list is * of ReportItemHandle type. - * + * * @return returns report items that has dataset or cube property defined */ - public List getAvailableDataBindingReferenceList() { + public List getAvailableDataBindingReferenceList() { return getAvailableDataBindingReferenceList(null); } @@ -788,10 +802,10 @@ public List getAvailableDataBindingReferenceList() { * * ReportItem in the design are all applicable. Each entry of the return list is * of ReportItemHandle type. - * + * * @return returns report items that has dataset or cube property defined */ - public List getNamedDataBindingReferenceList() { + public List getNamedDataBindingReferenceList() { return getNamedDataBindingReferenceList(null); } @@ -807,11 +821,11 @@ public List getNamedDataBindingReferenceList() { * * ReportItem in the design are all applicable. Each entry of the return list is * of ReportItemHandle type. - * + * * @return returns report items that has dataset property defined */ - public List getAvailableDataSetBindingReferenceList() { - return getAvailableDataBindingReferenceList(IReportItemModel.DATA_SET_PROP); + public List getAvailableDataSetBindingReferenceList() { + return getAvailableDataBindingReferenceList(IInternalReportItemModel.DATA_SET_PROP); } /** @@ -827,11 +841,11 @@ public List getAvailableDataSetBindingReferenceList() { * * ReportItem in the design are all applicable. Each entry of the return list is * of ReportItemHandle type. - * + * * @return returns report items that has dataset property defined */ - public List getNamedDataSetBindingReferenceList() { - return getNamedDataBindingReferenceList(IReportItemModel.DATA_SET_PROP); + public List getNamedDataSetBindingReferenceList() { + return getNamedDataBindingReferenceList(IInternalReportItemModel.DATA_SET_PROP); } /** @@ -846,11 +860,11 @@ public List getNamedDataSetBindingReferenceList() { * * ReportItem in the design are all applicable. Each entry of the return list is * of ReportItemHandle type. - * + * * @return returns report items that has cube property defined */ - public List getAvailableCubeBindingReferenceList() { - return getAvailableDataBindingReferenceList(IReportItemModel.CUBE_PROP); + public List getAvailableCubeBindingReferenceList() { + return getAvailableDataBindingReferenceList(IInternalReportItemModel.CUBE_PROP); } /** @@ -866,35 +880,35 @@ public List getAvailableCubeBindingReferenceList() { * * ReportItem in the design are all applicable. Each entry of the return list is * of ReportItemHandle type. - * + * * @return returns report items that has cube property defined */ - public List getNamedCubeBindingReferenceList() { - return getNamedDataBindingReferenceList(IReportItemModel.CUBE_PROP); + public List getNamedCubeBindingReferenceList() { + return getNamedDataBindingReferenceList(IInternalReportItemModel.CUBE_PROP); } /** * Returns all available data binding referred report items, regardless of * namelessness. - * + * * @param propName the property name. Can be resultSet, cube or * null . * @return a list containing report item */ - protected List getAvailableDataBindingReferenceList(String propName) { - List rtnList = new ArrayList(); + protected List getAvailableDataBindingReferenceList(String propName) { + List rtnList = new ArrayList(); - int slotID = DesignElement.NO_SLOT; + int slotID = IDesignElementModel.NO_SLOT; if (module instanceof ReportDesign) { - slotID = ReportDesign.BODY_SLOT; + slotID = IInternalReportDesignModel.BODY_SLOT; } else if (module instanceof Library) { - slotID = Library.COMPONENT_SLOT; + slotID = IModuleModel.COMPONENT_SLOT; } ContentIterator iter1 = new ContentIterator(module, new ContainerContext(module, slotID)); while (iter1.hasNext()) { - DesignElement e = (DesignElement) iter1.next(); + DesignElement e = iter1.next(); if ((e == getElement()) || !(e instanceof ReportItem) || ModelUtil.checkContainerOrContent(getElement(), e)) { continue; @@ -903,7 +917,7 @@ protected List getAvailableDataBindingReferenceList(String propName) { ReportItemHandle elementHandle = (ReportItemHandle) e.getHandle(module); int bindingType = elementHandle.getDataBindingType(); - // element can get the' dataset' or' cube' and no reportItem + // element can get the 'dataset' or 'cube' and no reportItem // reference if (bindingType == DATABINDING_TYPE_DATA @@ -913,8 +927,8 @@ protected List getAvailableDataBindingReferenceList(String propName) { // if the report item has no data set, but it defines the // column bindings. It is OK to share result set. - Object tmpValue = e.getLocalProperty(module, IReportItemModel.BOUND_DATA_COLUMNS_PROP); - if (tmpValue instanceof List && !((List) tmpValue).isEmpty()) { + Object tmpValue = e.getLocalProperty(module, IInternalReportItemModel.BOUND_DATA_COLUMNS_PROP); + if (tmpValue instanceof List && !((List) tmpValue).isEmpty()) { rtnList.add(elementHandle); } } else if (bindingType == DATABINDING_TYPE_REPORT_ITEM_REF) { @@ -942,7 +956,7 @@ protected List getAvailableDataBindingReferenceList(String propName) { } if (rtnList.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } return Collections.unmodifiableList(rtnList); @@ -951,17 +965,17 @@ protected List getAvailableDataBindingReferenceList(String propName) { /** * Returns all available data binding referred report items that must have * names. - * + * * @param propName the property name. Can be resultSet, cube or * null . * @return a list containing report item */ - private List getNamedDataBindingReferenceList(String propName) { - List tmpList = getAvailableDataBindingReferenceList(propName); - List retList = new ArrayList(); + private List getNamedDataBindingReferenceList(String propName) { + List tmpList = getAvailableDataBindingReferenceList(propName); + List retList = new ArrayList(); for (int i = 0; i < tmpList.size(); i++) { - ReportItemHandle item = (ReportItemHandle) tmpList.get(i); + ReportItemHandle item = tmpList.get(i); if (item.getName() == null) { continue; } @@ -975,24 +989,24 @@ private List getNamedDataBindingReferenceList(String propName) { /** * Removes bound columns from the element. - * + * * @param bindingNameList the binding name list to be removed, each entry should * be instance of java.lang.String. * @throws SemanticException if bound column property is locked. */ - public void removedColumnBindings(List bindingNameList) throws SemanticException { + public void removedColumnBindings(List bindingNameList) throws SemanticException { if (bindingNameList == null || bindingNameList.isEmpty()) { return; } for (int i = 0; i < bindingNameList.size(); i++) { - removedColumnBinding((String) bindingNameList.get(i)); + removedColumnBinding(bindingNameList.get(i)); } } /** * Removes bound column from the element. - * + * * @param bindingName the binding name to be removed * @throws SemanticException if bound column property is locked. */ @@ -1007,7 +1021,7 @@ public void removedColumnBinding(String bindingName) throws SemanticException { /** * Returns the view that is being used. - * + * * @return the view that is being used */ public DesignElementHandle getCurrentView() { @@ -1017,7 +1031,7 @@ public DesignElementHandle getCurrentView() { /** * Adds a new element as the view. - * + * * @param viewElement the element * @throws SemanticException */ @@ -1028,7 +1042,7 @@ public void addView(DesignElementHandle viewElement) throws SemanticException { /** * Deletes the given view. - * + * * @param viewElement the element * @throws SemanticException */ @@ -1040,10 +1054,10 @@ public void dropView(DesignElementHandle viewElement) throws SemanticException { /** * Sets the view to be used. If the given element is not in the multiple view, * it will be added and set as the active view. - * + * * @param viewElement the view element, must not be this. Can be * null. - * + * * @throws SemanticException if the given element resides in the other elements. */ public void setCurrentView(DesignElementHandle viewElement) throws SemanticException { @@ -1053,9 +1067,9 @@ public void setCurrentView(DesignElementHandle viewElement) throws SemanticExcep /** * Returns a list containing view elements. - * + * * @return a list. Each item is DesignElementHandle. - * + * */ public List getViews() { MultiViewsAPIProvider provider = new MultiViewsAPIProvider((ReportItemHandle) this, MULTI_VIEWS_PROP); @@ -1067,8 +1081,10 @@ public List getViews() { /** * Determines whether this report item can add a view with the specified * extension type or not. - * - * @return + * + * @param extensionType extension type + * + * @return Return the verified option to add the view */ public boolean canAddView(String extensionType) { MultiViewsAPIProvider provider = new MultiViewsAPIProvider((ReportItemHandle) this, MULTI_VIEWS_PROP); @@ -1078,60 +1094,61 @@ public boolean canAddView(String extensionType) { /** * Returns the ACL expression associated with the report element instance. - * + * * @return the expression in string - * + * */ public String getACLExpression() { - return getStringProperty(IReportItemModel.ACL_EXPRESSION_PROP); + return getStringProperty(IInternalReportItemModel.ACL_EXPRESSION_PROP); } /** * Sets the ACL expression associated with the report element instance. - * + * * @param expr the expression in string * @throws SemanticException if the property is locked by masks - * + * */ public void setACLExpression(String expr) throws SemanticException { - setStringProperty(IReportItemModel.ACL_EXPRESSION_PROP, expr); + setStringProperty(IInternalReportItemModel.ACL_EXPRESSION_PROP, expr); } /** * Returns true (the default), a report element's ACL is * automatically propagated to all its directly contained child elements and are * added to their ACLs. Otherwise false. - * + * * @return the flag to control whether to cascade ACL - * + * */ public boolean cascadeACL() { - return getBooleanProperty(IReportItemModel.CASCADE_ACL_PROP); + return getBooleanProperty(IInternalReportItemModel.CASCADE_ACL_PROP); } /** * Sets the flag to control whether to cascade ACL - * + * * @param cascadeACL true (the default), a report element's ACL is * automatically propagated to all its directly contained * child elements and are added to their ACLs. Otherwise * false. * @throws SemanticException if the property is locked by masks - * + * */ public void setCascadeACL(boolean cascadeACL) throws SemanticException { - setBooleanProperty(IReportItemModel.CASCADE_ACL_PROP, cascadeACL); + setBooleanProperty(IInternalReportItemModel.CASCADE_ACL_PROP, cascadeACL); } /** * Determines whether this report item can cascade ACL or not. True if and only - * if this item has define IReportItemModel.CASCADE_ACL_PROP - * property and it is a container. - * + * if this item has define + * IInternalReportItemModel.CASCADE_ACL_PROP property and it is a + * container. + * * @return true if this item has define - * IReportItemModel.CASCADE_ACL_PROP property and it is a - * container, otherwise false + * IInternalReportItemModel.CASCADE_ACL_PROP property and + * it is a container, otherwise false */ public boolean canCascadeACL() { return ((ReportItem) getElement()).canCascadeACL(); @@ -1139,7 +1156,7 @@ public boolean canCascadeACL() { /** * Gets the allowExport property of the report item. - * + * * @return a boolean value which indicates if can be exported or not. */ public boolean allowExport() { @@ -1148,7 +1165,7 @@ public boolean allowExport() { /** * Sets the allowExport property of the report item. - * + * * @param allowExport indicates whether can be exported or not. * @throws SemanticException */ @@ -1158,7 +1175,7 @@ public void setAllowExport(boolean allowExport) throws SemanticException { /** * Gets the host element of this view. - * + * * @return the host element of this view */ public ReportItemHandle getViewHost() { @@ -1174,7 +1191,7 @@ public ReportItemHandle getViewHost() { /** * Gets the display name of the bookmark. - * + * * @return the display name of the bookmark. */ public String getBookmarkDisplayName() { @@ -1183,7 +1200,7 @@ public String getBookmarkDisplayName() { /** * Sets the display name of the bookmark. - * + * * @param bookmarkDisplayName the display name of the bookmark to set * @throws SemanticException */ @@ -1194,7 +1211,7 @@ public void setBookmarkDisplayName(String bookmarkDisplayName) throws SemanticEx /** * Indicate if the query will be pushed down to the database. Default value is * false. - * + * * @return if the query will be pushed down to the database, otherwise * return . */ @@ -1207,7 +1224,7 @@ public boolean pushDown() { /** * Sets the pushdown property value of the report item. Property pushDown * indicates if the query will be pushed down to the database. - * + * * @param pushDown true if the query will be pushed down to the database, * otherwise false. * @throws SemanticException @@ -1218,7 +1235,7 @@ public void setPushDown(boolean pushDown) throws SemanticException { @Override public Object getProperty(String propName) { - if (IReportItemModel.PUSH_DOWN_PROP.equals(propName)) { + if (IInternalReportItemModel.PUSH_DOWN_PROP.equals(propName)) { Object pushDown = ReportItemPropSearchStrategy.getInstance().getPropertyFromElement(module, element, element.getPropertyDefn(propName)); if (pushDown != null) { @@ -1232,6 +1249,12 @@ public Object getProperty(String propName) { return super.getProperty(propName); } + /** + * Set the theme name + * + * @param themeName theme name + * @throws SemanticException throw semantic exception + */ public void setThemeName(String themeName) throws SemanticException { if (element instanceof ISupportThemeElement) { ThemeCommand command = new ThemeCommand(getModule(), element); @@ -1241,6 +1264,12 @@ public void setThemeName(String themeName) throws SemanticException { } } + /** + * Set the theme + * + * @param theme theme object + * @throws SemanticException throw semantic exception + */ public void setTheme(ReportItemThemeHandle theme) throws SemanticException { if (element instanceof ISupportThemeElement) { ThemeCommand command = new ThemeCommand(getModule(), getElement()); @@ -1252,7 +1281,7 @@ public void setTheme(ReportItemThemeHandle theme) throws SemanticException { /** * Returns the refresh rate when viewing the report. - * + * * @return the refresh rate */ public final ReportItemThemeHandle getTheme() { @@ -1266,7 +1295,7 @@ public final ReportItemThemeHandle getTheme() { /** * Returns the tag type of this label item. - * + * * @return the tag type value */ @@ -1276,9 +1305,9 @@ public String getTagType() { /** * Sets the tag type of this label item. - * - * @param tag type the tag type - * + * + * @param tagType the tag type + * * @throws SemanticException if the property is locked. */ @@ -1288,7 +1317,7 @@ public void setTagType(String tagType) throws SemanticException { /** * Returns the language of this label item. - * + * * @return the language */ @@ -1298,9 +1327,9 @@ public String getLanguage() { /** * Sets the language of this label item. - * + * * @param language the language - * + * * @throws SemanticException if the property is locked. */ @@ -1310,7 +1339,7 @@ public void setLanguage(String language) throws SemanticException { /** * Returns the alternate text of this label item. - * + * * @return the alternate text expression. */ public ExpressionHandle getAltTextExpression() { @@ -1319,9 +1348,9 @@ public ExpressionHandle getAltTextExpression() { /** * Sets the alternate text of this label item. - * + * * @param altText the alternate text expression. - * + * * @throws SemanticException if the property is locked. */ public void setAltTextExpression(Expression altText) throws SemanticException { @@ -1330,7 +1359,7 @@ public void setAltTextExpression(Expression altText) throws SemanticException { /** * Returns the order of this label item. - * + * * @return the order */ @@ -1340,9 +1369,9 @@ public int getOrder() { /** * Sets the order of this label item. - * - * @param resourceKey the order - * + * + * @param order order number + * * @throws SemanticException if the property is locked. */ @@ -1352,7 +1381,7 @@ public void setOrder(int order) throws SemanticException { /** * Returns the url of this label item. - * + * * @return the url */ @@ -1362,9 +1391,9 @@ public String getURL() { /** * Sets the url of this label item. - * + * * @param url the url - * + * * @throws SemanticException if the property is locked. */ @@ -1374,22 +1403,22 @@ public void setURL(String url) throws SemanticException { /** * Returns the resource key of the alternate text of this image. - * + * * @return the resource key of the alternate text */ public String getAltTextKey() { - return getStringProperty(IReportItemModel.ALTTEXT_KEY_PROP); + return getStringProperty(IInternalReportItemModel.ALTTEXT_KEY_PROP); } /** * Sets the resource key of the alternate text of this image. - * + * * @param altTextKey the alternate text key * @throws SemanticException */ public void setAltTextKey(String altTextKey) throws SemanticException { - setProperty(IReportItemModel.ALTTEXT_KEY_PROP, altTextKey); + setProperty(IInternalReportItemModel.ALTTEXT_KEY_PROP, altTextKey); } } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportItemModel.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportItemModel.java index 69ab1072bbc..4c2ccb12d80 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportItemModel.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportItemModel.java @@ -12,6 +12,12 @@ *******************************************************************************/ package org.eclipse.birt.report.model.elements.interfaces; +/** + * The interface for the internal report item model + * + * @since 3.3 + * + */ public interface IInternalReportItemModel { /**