Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.port80.graph.impl
Class ArrowFactory  view ArrowFactory download ArrowFactory.java

java.lang.Object
  extended bycom.port80.graph.impl.ArrowFactory
All Implemented Interfaces:
com.port80.util.attr.IAttrFactory

public class ArrowFactory
extends java.lang.Object
implements com.port80.util.attr.IAttrFactory

Arrow factory. Arrow factory provides a named collection of of stock Arrow object templates. Each template is parameterized by the leadinWidth, which determines the leadin shape. Default templates have leadinWidth=1.0f. The template produced have default colors from the Arrow class. Typically client have to set the appropriate attributes for the Arrow template and render it into an BufferedImage and then applied AffineTransform and composition to merge the rendered image to client area. //FIXME: . Scale square down to 1/sqrt(2) with leadin.


Field Summary
static int ARROW_DOT
           
static int ARROW_INVDOT
           
static int ARROW_INVERT
           
static int ARROW_INVODOT
           
static int ARROW_NONE
           
static int ARROW_NORMAL
           
static int ARROW_ODOT
           
private static float H
           
private static ArrowFactory instance
           
private static float LW
           
private static java.lang.String NAME
           
private static float SQRT2
           
private static java.util.Map table
           
 
Constructor Summary
private ArrowFactory()
           
 
Method Summary
static Arrow create(java.lang.String stringvalue)
          String format: stockname | typename,height | typename,height,linewidth | typename,height,width,linewidth | typename,height,width,linewidth,leadinwidth
 java.lang.Object createObject(java.lang.String str)
          Convert String representation of an attribute value to the appropriate object for storing in AttrTable.
static ArrowFactory getInstance()
           
 boolean isValid(java.lang.Object a)
          Check that given object is valid value for this factory.
 java.lang.Object promptUser(java.lang.String prompt)
          Prompt user and present a user interface to obtain an attribute value from user.
private static Arrow stockDiamond(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          A diamond shape.
private static Arrow stockDot(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          A circle.
private static Arrow stockDoubleLine(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          Double arrow by line only.
private static Arrow stockLine(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          Arrow by line only.
private static Arrow stockNormal(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          Line arrow with same line width for leadin and arrow head.
private static Arrow stockSpear(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          An spear shape stock.
private static Arrow stockSquare(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          A unit square.
private static Arrow stockTriangle(java.lang.String name, float w, float h, float leadinwidth, float linewidth)
          A triangle inside a unit square.
 java.lang.String toString()
          The String representation of attribute type itself.
 java.lang.String toString(java.lang.Object attr)
          The String representation of an attribute value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

instance

private static ArrowFactory instance

ARROW_NONE

public static final int ARROW_NONE
See Also:
Constant Field Values

ARROW_NORMAL

public static final int ARROW_NORMAL
See Also:
Constant Field Values

ARROW_INVERT

public static final int ARROW_INVERT
See Also:
Constant Field Values

ARROW_DOT

public static final int ARROW_DOT
See Also:
Constant Field Values

ARROW_ODOT

public static final int ARROW_ODOT
See Also:
Constant Field Values

ARROW_INVDOT

public static final int ARROW_INVDOT
See Also:
Constant Field Values

ARROW_INVODOT

public static final int ARROW_INVODOT
See Also:
Constant Field Values

table

private static java.util.Map table

SQRT2

private static final float SQRT2

H

private static final float H
See Also:
Constant Field Values

LW

private static final float LW
See Also:
Constant Field Values
Constructor Detail

ArrowFactory

private ArrowFactory()
Method Detail

getInstance

public static ArrowFactory getInstance()

create

public static Arrow create(java.lang.String stringvalue)
String format: stockname | typename,height | typename,height,linewidth | typename,height,width,linewidth | typename,height,width,linewidth,leadinwidth


createObject

public java.lang.Object createObject(java.lang.String str)
Convert String representation of an attribute value to the appropriate object for storing in AttrTable.

Specified by:
createObject in interface com.port80.util.attr.IAttrFactory

isValid

public boolean isValid(java.lang.Object a)
Description copied from interface: com.port80.util.attr.IAttrFactory
Check that given object is valid value for this factory.

Specified by:
isValid in interface com.port80.util.attr.IAttrFactory

toString

public java.lang.String toString(java.lang.Object attr)
The String representation of an attribute value.

Specified by:
toString in interface com.port80.util.attr.IAttrFactory

toString

public java.lang.String toString()
The String representation of attribute type itself.

Specified by:
toString in interface com.port80.util.attr.IAttrFactory

promptUser

public java.lang.Object promptUser(java.lang.String prompt)
Prompt user and present a user interface to obtain an attribute value from user.

Specified by:
promptUser in interface com.port80.util.attr.IAttrFactory

stockNormal

private static Arrow stockNormal(java.lang.String name,
                                 float w,
                                 float h,
                                 float leadinwidth,
                                 float linewidth)
Line arrow with same line width for leadin and arrow head.


stockTriangle

private static Arrow stockTriangle(java.lang.String name,
                                   float w,
                                   float h,
                                   float leadinwidth,
                                   float linewidth)
A triangle inside a unit square.


stockSquare

private static Arrow stockSquare(java.lang.String name,
                                 float w,
                                 float h,
                                 float leadinwidth,
                                 float linewidth)
A unit square.


stockDiamond

private static Arrow stockDiamond(java.lang.String name,
                                  float w,
                                  float h,
                                  float leadinwidth,
                                  float linewidth)
A diamond shape.


stockDot

private static Arrow stockDot(java.lang.String name,
                              float w,
                              float h,
                              float leadinwidth,
                              float linewidth)
A circle.


stockSpear

private static Arrow stockSpear(java.lang.String name,
                                float w,
                                float h,
                                float leadinwidth,
                                float linewidth)
An spear shape stock.


stockLine

private static Arrow stockLine(java.lang.String name,
                               float w,
                               float h,
                               float leadinwidth,
                               float linewidth)
Arrow by line only.


stockDoubleLine

private static Arrow stockDoubleLine(java.lang.String name,
                                     float w,
                                     float h,
                                     float leadinwidth,
                                     float linewidth)
Double arrow by line only.