Style Intelligence v12.0

inetsoft.report.painter
Class AbstractBarcodePresenter

java.lang.Object
  extended by inetsoft.report.painter.AbstractBarcodePresenter
All Implemented Interfaces:
Presenter, Serializable
Direct Known Subclasses:
Barcode2of7Presenter, Barcode3of9Presenter, BarcodeCodabarPresenter, BarcodeCode128APresenter, BarcodeCode128BPresenter, BarcodeCode128CPresenter, BarcodeCode128Presenter, BarcodeCode39Presenter, BarcodeEAN128Presenter, BarcodeGTINPresenter, BarcodeMonarchPresenter, BarcodeNW7Presenter, BarcodePDF417Presenter, BarcodeSCC14Presenter, BarcodeSINPresenter, BarcodeSSCC18Presenter, BarcodeUCC128Presenter, BarcodeUSD3Presenter, BarcodeUSD4Presenter, BarcodeUSPSPresenter

public abstract class AbstractBarcodePresenter
extends Object
implements Presenter

This is the base class for all barcode presenter. It provides logic for drawing a string using a barcode encoding.

See Also:
Serialized Form

Constructor Summary
protected AbstractBarcodePresenter()
          Create a presenter and set the defaults.
 
Method Summary
protected abstract  net.sourceforge.barbecue.Barcode createBarcode(String str)
          Create a barcode object.
 Color getBackground()
          Get the background.
protected  double getBarcodeSizeRate()
          There is some bugs aroung barbecue barcode generator which will not return correct prefer width for small width setting.
 double getBarHeight()
          Get the bar height.
 double getBarWidth()
          Get the bar width.
 Dimension getPreferredSize(Object v)
          Calculate the preferred size of the object representation.
 int getResolution()
          Get the ouput resolution.
 boolean isFill()
          Check if this presenter should always fill the entire area of a cell.
 boolean isPresenterOf(Class type)
          Check if the presenter can handle this type of objects.
 boolean isPresenterOf(Object obj)
          Check if the presenter can handle this particular object.
 boolean isRawDataRequired()
          Determine if this Presenter requires raw (unformatted) data.
 void paint(Graphics g, Object v, int x, int y, int w, int h)
          Paint the value.
 void setBackground(Color bg)
          Set the background.
 void setBarHeight(double barHeight)
          Sets the desired height for the bars in the barcode (in pixels).
 void setBarWidth(double barWidth)
          Sets the desired bar width for the barcode.
 void setFont(Font font)
          Set the font to use for this presenter.
 void setResolution(int resolution)
          Sets the desired output resolution for the barcode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface inetsoft.report.Presenter
getDisplayName
 

Constructor Detail

AbstractBarcodePresenter

protected AbstractBarcodePresenter()
Create a presenter and set the defaults.

Method Detail

createBarcode

protected abstract net.sourceforge.barbecue.Barcode createBarcode(String str)
Create a barcode object.


setBarWidth

public void setBarWidth(double barWidth)
Sets the desired bar width for the barcode. This is the width (in pixels) of the thinnest bar in the barcode. Other bars will change their size relative to this.

Parameters:
barWidth - The desired width of the thinnest bar in pixels

getBarWidth

public double getBarWidth()
Get the bar width.


setBarHeight

public void setBarHeight(double barHeight)
Sets the desired height for the bars in the barcode (in pixels). Note that some barcode implementations will not allow the height to go below a minimum size. This is not the height of the component as a whole, as it does not specify the height of any text that may be drawn and does not include borders. Note that changing this setting after a barcode has been drawn will invalidate the component and may force a refresh.

Parameters:
barHeight - The desired height of the barcode bars in pixels

getBarHeight

public double getBarHeight()
Get the bar height.


setResolution

public void setResolution(int resolution)
Sets the desired output resolution for the barcode. This method should be used in cases where the barcode is either being outputted to a device other than the screen, or the barcode is being generated on a headless machine (e.g. a rack mounted server) and the screen resolution cannot be determined. The default resolution is 72 dpi.

Parameters:
resolution - The desired output resolution (in dots per inch)

getResolution

public int getResolution()
Get the ouput resolution.


paint

public void paint(Graphics g,
                  Object v,
                  int x,
                  int y,
                  int w,
                  int h)
Paint the value.

Specified by:
paint in interface Presenter
Parameters:
g - graphical context.
v - object value.
x - x coordinate of the left edge of the paint area.
y - y coordinate of the upper edge of the paint area.
w - area width.
h - area height.

getPreferredSize

public Dimension getPreferredSize(Object v)
Calculate the preferred size of the object representation.

Specified by:
getPreferredSize in interface Presenter
Parameters:
v - object value.
Returns:
preferred size.

isPresenterOf

public boolean isPresenterOf(Class type)
Check if the presenter can handle this type of objects.

Specified by:
isPresenterOf in interface Presenter
Parameters:
type - object type.
Returns:
true if the presenter can handle this type.

isPresenterOf

public boolean isPresenterOf(Object obj)
Check if the presenter can handle this particular object. Normally a presenter handles a class of objects, which is checked by the isPresenterOf(Class) method. If this presenter does not care about the value in the object, it can just call the isPresenterOf() with the class of the object, e.g.
   if(type == null) {
      return false;
   }
   return isPresenterOf(obj.getClass());
 

Specified by:
isPresenterOf in interface Presenter
Parameters:
obj - object type.
Returns:
true if the presenter can handle this type.

isFill

public boolean isFill()
Check if this presenter should always fill the entire area of a cell.

Specified by:
isFill in interface Presenter

setFont

public void setFont(Font font)
Set the font to use for this presenter. A table calls this function before the cell is printed when a presenter is used.

Specified by:
setFont in interface Presenter

isRawDataRequired

public boolean isRawDataRequired()
Determine if this Presenter requires raw (unformatted) data.

Specified by:
isRawDataRequired in interface Presenter
Returns:
true.

getBarcodeSizeRate

protected double getBarcodeSizeRate()
There is some bugs aroung barbecue barcode generator which will not return correct prefer width for small width setting. Fixed it using a fixed correct rate.


setBackground

public void setBackground(Color bg)
Set the background.

Specified by:
setBackground in interface Presenter

getBackground

public Color getBackground()
Get the background.


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.