Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix eclipse warnings of missing comments and usage of raw types (#1386) #1390

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -44,23 +43,23 @@ 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$

ConfigurableOption embedHtml = new ConfigurableOption(EMBED_HTML);
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$

ConfigurableOption wordVersion = new ConfigurableOption(WORD_VERSION);
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"));
Expand Down Expand Up @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
/*******************************************************************************
* 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
*******************************************************************************/

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -308,8 +325,6 @@ public void writeImage(File dest) throws IOException {
}
}
}
// }

}

/**
Expand Down Expand Up @@ -341,6 +356,11 @@ public String getExtension() {
return extension;
}

/**
* Set image size
*
* @param size image size
*/
public void setImageSize(ImageSize size) {
imageSize = size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
Loading
Loading