📄 itemfactory.java
字号:
* Creates a new TextElement containing a date filter structure.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the text color of this text element
* @param alignment the horizontal text alignment.
* @param font the font for this element
* @param nullString the text used when the value of this element is null
* @param format the SimpleDateFormat-formatstring used to format the date
* @param function the function name to retrieve values from
*
* @throws NullPointerException if bounds, name, format or function are null
* @throws IllegalArgumentException if the given alignment is invalid
*
* @return a report element for displaying a java.util.Date function value.
*
* @deprecated use createDateElement instead, as all DataAccess has been unified
*/
public static TextElement createDateFunction(final String name,
final Rectangle2D bounds,
final Paint paint,
final int alignment,
final Font font,
final String nullString,
final String format,
final String function)
{
return createDateElement(name, bounds, paint, alignment, font, nullString, format, function);
}
/**
* Creates a new TextElement containing a date filter structure.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the text color of this text element
* @param alignment the horizontal text alignment.
* @param font the font for this element
* @param nullString the text used when the value of this element is null
* @param format the SimpleDateFormat-formatstring used to format the date
* @param function the function name to retrieve values from
*
* @throws NullPointerException if bounds, name, format or function are null
* @throws IllegalArgumentException if the given alignment is invalid
*
* @return a report element for displaying a java.util.Date function value.
*
* @deprecated use createDateElement instead, as all DataAccess has been unified
*/
public static TextElement createDateFunction(final String name,
final Rectangle2D bounds,
final Paint paint,
final int alignment,
final Font font,
final String nullString,
final DateFormat format,
final String function)
{
return createDateElement(name, bounds, paint, alignment, font, nullString, format, function);
}
/**
* Creates a new TextElement containing a general filter structure.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the text color of this text element
* @param alignment the horizontal text alignment.
* @param font the font for this element
* @param nullString the text used when the value of this element is null
* @param function the function to retrieve values from
*
* @return a report element for displaying a general object.
*
* @throws NullPointerException if bounds, name or function are null
* @throws IllegalArgumentException if the given alignment is invalid
* @deprecated don't use the itemfactory for that kind of element or use the
* createStringElement method
*/
public static TextElement createGeneralElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final int alignment,
final Font font,
final String nullString,
final String function)
{
return createStringElement(name, bounds, paint, alignment, font, nullString, function);
}
/**
* Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will
* not change during the report processing.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the color of this element (currently not used)
* @param source the source url from where to load the image
*
* @return a report element for displaying an image.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*/
public static ImageElement createImageElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final URL source)
{
return createImageElement(name, bounds, paint, source, true);
}
/**
* Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will
* not change during the report processing.
*
* @param name the name of the new element.
* @param bounds the bounds of the new element.
* @param paint the color of this element (currently not used).
* @param source the source url from where to load the image.
* @param scale scale the image?
*
* @return a report element for displaying an image.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*/
public static ImageElement createImageElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final URL source,
final boolean scale)
{
return createImageElement(name, bounds, paint, source, scale, false);
}
/**
* Creates a new ImageElement. The source URL is predefined in an StaticDataSource and will
* not change during the report processing.
*
* @param name the name of the new element.
* @param bounds the bounds of the new element.
* @param paint the color of this element (currently not used).
* @param source the source url from where to load the image.
* @param scale scale the image?
* @param keepAspectRatio preserve the aspect ratio?
*
* @return a report element for displaying an image.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*/
public static ImageElement createImageElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final URL source,
final boolean scale,
final boolean keepAspectRatio)
{
final ImageURLElementTemplate template = new ImageURLElementTemplate();
template.setContent(source.toExternalForm());
final ImageElement element = new ImageElement();
if (name != null)
{
element.setName(name);
}
if (paint != null)
{
element.getStyle().setStyleProperty(ElementStyleSheet.PAINT, paint);
}
setElementBounds(element, bounds);
element.setDataSource(template);
element.setScale(scale);
element.setKeepAspectRatio(keepAspectRatio);
return element;
}
/**
* Creates a new ImageElement, which is fed from an URL stored in the datasource.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the color of this element (currently not used)
* @param field the name of the column/function/expression that returns the URL for the image.
*
* @return a report element for displaying an image from a URL.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*
* @deprecated use createImageURLElement instead
*/
public static ImageElement createImageURLField(final String name,
final Rectangle2D bounds,
final Paint paint,
final String field)
{
return createImageURLElement(name, bounds, paint, field);
}
/**
* Creates a new ImageElement, which is fed from an URL stored in the datasource.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the color of this element (currently not used)
* @param field the name of the column/function/expression that returns the URL for the image.
*
* @return a report element for displaying an image based on a URL.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*/
public static ImageElement createImageURLElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final String field)
{
return createImageURLElement(name, bounds, paint, field, true);
}
/**
* Creates a new ImageElement, which is fed from an URL stored in the datasource.
*
* @param name the name of the new element.
* @param bounds the bounds of the new element.
* @param paint the color of this element (currently not used).
* @param field the name of the column/function/expression that returns the URL for the image.
* @param scale scale the image?
*
* @return a report element for displaying an image based on a URL.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*/
public static ImageElement createImageURLElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final String field,
final boolean scale)
{
return createImageURLElement(name, bounds, paint, field, scale, false);
}
/**
* Creates a new ImageElement, which is fed from an URL stored in the datasource.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the color of this element (currently not used)
* @param field the name of the column/function/expression that returns the URL for the image.
* @param scale true if the content should be scaled to fit.
* @param keepAspectRatio preserve the aspect ratio.
*
* @return a report element for displaying an image based on a URL.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*/
public static ImageElement createImageURLElement(final String name,
final Rectangle2D bounds,
final Paint paint,
final String field,
final boolean scale,
final boolean keepAspectRatio)
{
final ImageURLFieldTemplate template = new ImageURLFieldTemplate();
template.setField(field);
final ImageElement element = new ImageElement();
if (name != null)
{
element.setName(name);
}
if (paint != null)
{
element.getStyle().setStyleProperty(ElementStyleSheet.PAINT, paint);
}
setElementBounds(element, bounds);
element.setDataSource(template);
element.setScale(scale);
element.setKeepAspectRatio(keepAspectRatio);
return element;
}
/**
* Creates a new ImageElement, which is fed from an URL stored in the datasource.
*
* @param name the name of the new element
* @param bounds the bounds of the new element
* @param paint the color of this element (currently not used)
* @param function the name of the function that returns the image URL.
*
* @return a report element for displaying an image based on a URL.
*
* @throws NullPointerException if bounds, name or source are null
* @throws IllegalArgumentException if the given alignment is invalid
*
* @deprecated use createImageURLElement instead
*/
public static ImageElement createImageURLFunction(final String name,
final Rectangle2D bounds,
final Paint paint,
final String function)
{
return createImageURLElement(name, bounds, paint, function);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -