NetCharts Pro

netcharts.pro.common
Class NFFillPattern

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by netcharts.pro.common.NFFillPattern
All Implemented Interfaces:
java.lang.Cloneable, NFCDLGenerator

public class NFFillPattern
extends NFBaseClass
implements NFCDLGenerator

This object represents a single fill pattern configuration. There are three types of fill patterns: Overlay pattern, gradient, and image. The overlay patterns available include forward slashes, gridded patterns and so on. Gradients provide the ability to "fade" from one color to another. The image fill uses the given image in the fill area. An example of the NFFillPattern object's use is shown here:

  ...
  NFLinechart chart = new NFLinechart();

        NFLineSet lineSet = new NFLineSet();

        NFFillPattern fp = new NFFillPattern(NFFillPattern.FSLASH, Color.green, Color.white);
        lineSet.setFillPattern(fp);

        // load dummy data into the line set object
        for (int j=0; j < 20; j++)
                lineSet.addElement(new Double(Math.random()*100));

        chart.addLineSet(lineSet); // add this lineset.
        ...
 


Field Summary
static int BSLASH
          Backward Slash
static int DGRID
          Diagonal Grid
static java.util.Hashtable fillTypeMap
          fillTypeMap hashtable
static int FSLASH
          Forward Slash
static int GRADIENTBDIAG
          Bottom left to top right gradient
static int GRADIENTCENTERHORIZONTAL
          Center out horizontal gradient pattern
static int GRADIENTCENTERVERTICAL
          Center out vertical gradient pattern
static int GRADIENTFDIAG
          Top left to bottom right gradient
static int GRADIENTHORIZONTAL
          Left to right gradient
static int GRADIENTRADIAL
          Radial gradient pattern
static int GRADIENTVERTICAL
          Top to bottom gradient
static int GRID
          Horizontal/Vertical Grid
static int HORIZONTAL
          Horizontal lines
static int IMAGE
          Image fill
static int NONE
          No fill
static int VERTICAL
          Vertical lines
 
Constructor Summary
NFFillPattern()
          Constructs a default fill pattern
NFFillPattern(int type)
          Constructs a fill pattern with the given fill type
NFFillPattern(int type, java.awt.Color foreground, java.awt.Color background)
          Constructs a fill pattern with the given fill type and colors
 
Method Summary
 java.awt.Color getBackground()
          Gets the background color (or secondary color for gradients).
 java.lang.String getCDL()
          Generate CDL parameters representing this pattern fill
 void getCDL(java.lang.StringBuffer sb, boolean includeParens)
          Append CDL parameters representing this pattern fill to the given StringBuffer.
 java.awt.Color getForeground()
          Gets the foreground color (or initial color for gradients).
 java.lang.String getImageURL()
          Gets url string used for the fill image
 int getType()
          Gets the fill type
 void setBackground(java.awt.Color background)
          Sets the background color (or secondary color for gradients).
 void setCDL(java.lang.Object cdlObject)
          Configures this object from a CDL parameter object.
 void setCDL(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 int setCDL(java.lang.String[] elements, int offset)
          Configures this object from a CDL parameter representation.
 void setForeground(java.awt.Color foreground)
          Sets the foreground color (or initial color for gradients).
 void setImageURL(java.lang.String imageURL)
          Sets url string to use for the fill image
 void setType(int type)
          Sets the fill type
 java.lang.String toString()
          Returns a new String object representing this pattern fill.
 
Methods inherited from class netcharts.pro.common.NFBaseClass
clone, getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
No fill


FSLASH

public static final int FSLASH
Forward Slash


BSLASH

public static final int BSLASH
Backward Slash


DGRID

public static final int DGRID
Diagonal Grid


HORIZONTAL

public static final int HORIZONTAL
Horizontal lines


VERTICAL

public static final int VERTICAL
Vertical lines


GRID

public static final int GRID
Horizontal/Vertical Grid


GRADIENTVERTICAL

public static final int GRADIENTVERTICAL
Top to bottom gradient


GRADIENTHORIZONTAL

public static final int GRADIENTHORIZONTAL
Left to right gradient


GRADIENTFDIAG

public static final int GRADIENTFDIAG
Top left to bottom right gradient


GRADIENTBDIAG

public static final int GRADIENTBDIAG
Bottom left to top right gradient


GRADIENTRADIAL

public static final int GRADIENTRADIAL
Radial gradient pattern


GRADIENTCENTERHORIZONTAL

public static final int GRADIENTCENTERHORIZONTAL
Center out horizontal gradient pattern


GRADIENTCENTERVERTICAL

public static final int GRADIENTCENTERVERTICAL
Center out vertical gradient pattern


IMAGE

public static final int IMAGE
Image fill


fillTypeMap

public static java.util.Hashtable fillTypeMap
fillTypeMap hashtable

Constructor Detail

NFFillPattern

public NFFillPattern()
Constructs a default fill pattern


NFFillPattern

public NFFillPattern(int type)
Constructs a fill pattern with the given fill type

Parameters:
type - One of NONE, FSLASH, BSLASH, DGRID, HORIZONTAL, VERTICAL, GRID, GRADIENTVERTICAL, GRADIENTHORIZONTAL, GRADIENTFDIAG, GRADIENTBDIAG, GRADIENTRADIAL, GRADIENTCENTERHORIZONTAL, GRADIENTCENTERVERTICAL, IMAGE.

NFFillPattern

public NFFillPattern(int type,
                     java.awt.Color foreground,
                     java.awt.Color background)
Constructs a fill pattern with the given fill type and colors

Parameters:
type - One of NONE, FSLASH, BSLASH, DGRID, HORIZONTAL, VERTICAL, GRID, GRADIENTVERTICAL, GRADIENTHORIZONTAL, GRADIENTFDIAG, GRADIENTBDIAG, GRADIENTRADIAL, GRADIENTCENTERHORIZONTAL, GRADIENTCENTERVERTICAL, IMAGE.
foreground - Foreground color (or initial color for gradients)
background - Background color (or secondary color for gradients)
Method Detail

setType

public void setType(int type)
Sets the fill type

Parameters:
type - One of NONE, FSLASH, BSLASH, DGRID, HORIZONTAL, VERTICAL, GRID, GRADIENTVERTICAL, GRADIENTHORIZONTAL, GRADIENTFDIAG, GRADIENTBDIAG, GRADIENTRADIAL, GRADIENTCENTERHORIZONTAL, GRADIENTCENTERVERTICAL, IMAGE.

getType

public int getType()
Gets the fill type

Returns:
type or NONE if not set. One of NONE, FSLASH, BSLASH, DGRID, HORIZONTAL, VERTICAL, GRID, GRADIENTVERTICAL, GRADIENTHORIZONTAL, GRADIENTFDIAG, GRADIENTBDIAG, GRADIENTRADIAL, GRADIENTCENTERHORIZONTAL, GRADIENTCENTERVERTICAL, IMAGE.

setForeground

public void setForeground(java.awt.Color foreground)
Sets the foreground color (or initial color for gradients). Ignored if fill type is IMAGE.

Parameters:
foreground - Foreground color.

getForeground

public java.awt.Color getForeground()
Gets the foreground color (or initial color for gradients).

Returns:
foreground or null if not set.

setBackground

public void setBackground(java.awt.Color background)
Sets the background color (or secondary color for gradients). Ignored if fill type is IMAGE.

Parameters:
background - Background color.

getBackground

public java.awt.Color getBackground()
Gets the background color (or secondary color for gradients).

Returns:
background or null if not set.

setImageURL

public void setImageURL(java.lang.String imageURL)
Sets url string to use for the fill image

Parameters:
imageURL - Only used if the type is set to Image.

getImageURL

public java.lang.String getImageURL()
Gets url string used for the fill image

Returns:
imageURL Only used if the type is set to Image.

getCDL

public java.lang.String getCDL()
Generate CDL parameters representing this pattern fill

Specified by:
getCDL in interface NFCDLGenerator
Returns:
CDL in the form: (type, foreground, background, imageURL)

getCDL

public void getCDL(java.lang.StringBuffer sb,
                   boolean includeParens)
Append CDL parameters representing this pattern fill to the given StringBuffer.

Parameters:
sb - Target buffer to append the CDL parameters
includeParens - If true, this will cause the parameters to be delimited with parenthesis.

setCDL

public void setCDL(java.lang.Object cdlObject)
Configures this object from a CDL parameter object.

Parameters:
cdlObject - CDL in a String form or in a user object.

setCDL

public void setCDL(java.lang.String cdl)
Configures this object from a CDL parameter representation.

Specified by:
setCDL in interface NFCDLGenerator
Parameters:
cdl - CDL in the form: (type, foreground, background, imageURL)

setCDL

public int setCDL(java.lang.String[] elements,
                  int offset)
Configures this object from a CDL parameter representation.

Parameters:
elements - Array of parameter elements. This array is expected to contain consecutive elements containing filltype, foreground, background, and imageURL information.
offset - Offset into the elements array.

toString

public java.lang.String toString()
Returns a new String object representing this pattern fill.

Specified by:
toString in interface NFCDLGenerator
Overrides:
toString in class java.lang.Object
Returns:
A new String object in the same form as that given by getCDL().

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011