Modifier and Type | Class and Description |
---|---|
static class |
GraphObject.Kind
One of GraphObject.GNODE or GEDGE or GRAPH
|
static class |
GraphObject.ObjectIDComparator
This class compares the object ID's of two GraphObject's.
|
Modifier and Type | Field and Description |
---|---|
Color |
backColor
Background or fill color of the object
|
static chargerlib.Rectangle3D |
defaultDim |
static Color |
defaultSelectColor
The color used for a thick rectangle around each selected node
|
static int |
defaultWrapColumns |
static boolean |
defaultWrapLabels |
chargerlib.Rectangle3D |
displayRect3D
Will represent the diplay "rectangle" including a depth for display.
|
Color |
foreColor
Foreground or text color of the object
|
Color |
highlightColor
highlight color
|
chargerlib.history.ObjectHistory |
history |
private boolean |
isNegated
whether this object is negated; for right now, only useful with graphs
|
boolean |
isSelected
True if this object was selected on the canvas, otherwise false
|
Font |
labelFont |
GraphObject.Kind |
myKind |
GraphObjectID |
objectID
global and unique number.
|
static int |
objectMargin
The amount of white space to have around the text label
|
Graph |
ownerGraph
The innermost enclosing graph in which this object logically lies; null
if in the outermost graph
|
static int |
TerritorialLimit |
String |
textLabel
One of: a referent, a link name, an actor name, a context name
|
Point2D.Double |
textLabelLowerLeftPt
The lower left corner of where the text label should be drawn.
|
Constructor and Description |
---|
GraphObject() |
Modifier and Type | Method and Description |
---|---|
(package private) abstract void |
abandonObject()
Abstract method that disconnects object from any other objects.
|
void |
addHistoryRecord(chargerlib.history.HistoryRecord he) |
void |
adjustCustomDisplayRect()
Performs whatever custom adjustments that any sub-classes want.
|
boolean |
commitToKnowledgeBase(KnowledgeBase kb)
Subclasses will implement this method in order to perform whatever
object-specific actions are appropriate for adding to the knowledge base.
|
abstract void |
draw(Graphics2D g,
boolean printing)
Render the object with adjustments as necessary
|
(package private) abstract void |
drawBorder(Graphics2D g,
Color borderColor)
Highlights the border of the object
|
protected void |
finalize() |
static Graph |
findDominantContext(ArrayList nodeList)
Find the dominant context for a given collection of objects, defined as
the one partially-included context.
|
boolean |
forceMove(Point2D.Double delta)
Forces an un-verified move of the object.
|
void |
forgetObject()
Convenience method for telling the object to tell its graph to forget it.
|
FontMetrics |
getBestFontMetrics()
Find the most appropriate font metrics for this object.
|
Point2D.Double |
getCenter() |
Color |
getColor(String foreback)
Get the colors for this object.
|
double |
getDepth()
Get the 3D depth of the object display (1 means 2D)
|
Dimension |
getDim()
Get the dimension of this object.
|
Rectangle2D.Double |
getDisplayRect()
Gets the display rectangle of this object on the canvas, without any scaling
information.
|
chargerlib.Rectangle3D |
getDisplayRect3D() |
chargerlib.history.ObjectHistory |
getHistory() |
Font |
getLabelFont() |
Dimension |
getMinimumContentSize()
Using the size of the textlabel and including reasonable padding, etc.
|
ObjectLocator |
getObjectLocator()
Constructs an object locator for this object.
|
Graph |
getOutermostGraph()
Find the graph that is the outermost graph of the given object.
|
EditFrame |
getOwnerFrame()
Determines the owner edit frame (if any) for a given graph object,
regardless of the level of nesting.
|
Graph |
getOwnerGraph()
Find the most immediate enclosing graph.
|
abstract Shape |
getShape()
Obtain the Shape object that represents the selectable region of this
object.
|
Shape |
getShapeForDrawing()
Finds the center line of the shape, so that drawing the border will
take place entirely within the desired shape.
|
String |
getTextLabel() |
Dimension |
getTextLabelSize() |
Point2D.Double |
getUpperLeft()
Find the upper left point that lies on the extreme edge of
the display rectangle.
|
int |
getWrapColumns()
The number of columns to wrap a label, if wrapping is enabled
|
boolean |
getWrapLabels()
Figure out whether to wrap labels.
|
boolean |
isNegated() |
boolean |
isNegativelyNested()
Determine whether the given graph is negatively nested; i.e., is it
oddly-nested in the existential graph sense (where only cuts/negative
contexts matter).
|
static String |
listToString(ArrayList list)
Converts a list of graph objects into their i/o string form, including
line separators.
|
static String |
listToStringXML(ArrayList list)
Converts an arraylist of graph objects into their XML string form,
including line separators.
|
boolean |
putInCorrectContext(Graph g,
GraphObject go) |
static boolean |
putInCorrectContext(Graph g,
GraphObject go,
Point2D.Double newPos)
Puts an object in its correct logical context, constrained to be nested
in graph g.
|
void |
resizeIfNecessary()
Use the object's current text label and center to determine whether it
needs re-sizing to accommodate the (possibly new) label.
|
void |
resizeIfNecessary(FontMetrics fmetrics,
Point2D.Double p)
Using the given string and center point, determine whether the object
needs resizing to accommodate the (possibly new) string label.
|
void |
selfCleanup()
Any CharGer-specific cleanup that must be done prior to being
disconnect/ignored.
|
void |
setBackground(Color c) |
void |
setCenter(Point2D.Double p)
Set the center point of the current object.
|
void |
setCenterOnly(Point2D.Double p)
Sets the object's center point on the canvas, moving the object if
necessary.
|
void |
setColor()
Sets the colors of this concept from the current defaults, whatever they
are.
|
void |
setColor(String foreback,
Color c)
Sets the colors of this object from the given color.
|
void |
setDepth(double depth)
Set the 3D depth of the object display (1 means 2D)
|
void |
setDim(Dimension d)
Sets the dimensions of the object.
|
void |
setDim(float wid,
float ht)
Sets the width and height of the object.
|
void |
setDisplayRect(double x,
double y,
double width,
double height) |
void |
setDisplayRect(Rectangle2D.Double rect)
Sets the size and location of the object on the unscaled canvas.
|
void |
setDisplayRect3D(chargerlib.Rectangle3D displayRect3D) |
void |
setForeground(Color c) |
void |
setLabelFont(Font labelFont) |
void |
setNegated(boolean isNegated) |
void |
setOwnerGraph(Graph g)
Set the owner of this graph.
|
void |
setTextLabel(String newTextLabel)
Sets the text label of the graph object.
|
void |
setTextLabel(String newTextLabel,
FontMetrics fm)
Sets the text label of the graph object.
|
void |
setTextLabel(String newTextLabel,
FontMetrics fmetrics,
Point2D.Double p)
Sets the text label of the graph object.
|
void |
setUpperLeft(double upperleftx,
double upperlefty)
Sets the upper left corner of the object.
|
void |
setUpperLeft(Point2D.Double upperleft)
Sets the upper left corner of the object.
|
String |
toString()
Constructs a constrained text version of the object, suitable for writing
to a file and then reading back into the system.
|
boolean |
unCommitFromKnowledgeBase(KnowledgeBase kb)
Subclasses will implement this method in order to perform whatever
object-specific actions are appropriate for removing this object from the
knowledge base.
|
public GraphObjectID objectID
Global.applyForID()
public Graph ownerGraph
public GraphObject.Kind myKind
public static final Color defaultSelectColor
public String textLabel
public static chargerlib.Rectangle3D defaultDim
public static int TerritorialLimit
public static boolean defaultWrapLabels
public static int defaultWrapColumns
public static int objectMargin
public Point2D.Double textLabelLowerLeftPt
public chargerlib.Rectangle3D displayRect3D
public boolean isSelected
public Color foreColor
public Color backColor
private boolean isNegated
public Color highlightColor
public Font labelFont
public chargerlib.history.ObjectHistory history
public abstract Shape getShape()
public Shape getShapeForDrawing()
public boolean getWrapLabels()
public int getWrapColumns()
public Color getColor(String foreback)
foreback
- one of "fill"
or "text"
indicating which color to get.public void setColor()
public void setColor(String foreback, Color c)
foreback
- one of "text"
or "fill"
c
- the color to set for that propertypublic boolean isNegated()
public void setNegated(boolean isNegated)
public void forgetObject()
public boolean forceMove(Point2D.Double delta)
delta
- public void setCenter(Point2D.Double p)
p
- new CENTER pointpublic void setCenterOnly(Point2D.Double p)
p
- The new center pointpublic void setUpperLeft(Point2D.Double upperleft)
upperleft
- The point at the upper left of the graph object.public void setUpperLeft(double upperleftx, double upperlefty)
upperleftx
- x-value of the point at the upper left of the graph
object.upperlefty
- y-value of the point at the upper left of the graph
object.public Point2D.Double getUpperLeft()
public Point2D.Double getCenter()
getUpperLeft()
public Dimension getDim()
public void setDim(Dimension d)
d
- new dimensions for the object.public void setDim(float wid, float ht)
wid
- new width for the object.ht
- new height for the object.public chargerlib.Rectangle3D getDisplayRect3D()
public void setDisplayRect3D(chargerlib.Rectangle3D displayRect3D)
public Rectangle2D.Double getDisplayRect()
public void setDisplayRect(Rectangle2D.Double rect)
rect
- the rectangle of the object.public void setDisplayRect(double x, double y, double width, double height)
public void adjustCustomDisplayRect()
public double getDepth()
public void setDepth(double depth)
public void setForeground(Color c)
public void setBackground(Color c)
public String getTextLabel()
public void setTextLabel(String newTextLabel)
newTextLabel
- new text label (erases the old text label)public void setTextLabel(String newTextLabel, FontMetrics fm)
newTextLabel
- new text label (erases the old text label)fm
- the font metrics that govern re-sizing of the text or object if
necessarypublic void setTextLabel(String newTextLabel, FontMetrics fmetrics, Point2D.Double p)
newTextLabel
- new text label (erases the old text label)fmetrics
- the font metrics that govern re-sizing of the text or
object if necessaryp
- the point around which the label is centeredpublic Dimension getTextLabelSize()
public void resizeIfNecessary()
public void resizeIfNecessary(FontMetrics fmetrics, Point2D.Double p)
public Dimension getMinimumContentSize()
public FontMetrics getBestFontMetrics()
public String toString()
toString
in class Object
IOManager
public static String listToString(ArrayList list)
list
- ArrayList of graph objectscharger.xml.CGXParser#parseCGXMLString
public static String listToStringXML(ArrayList list)
list
- ArrayList of graph objectsEditManager
abstract void abandonObject()
public boolean commitToKnowledgeBase(KnowledgeBase kb)
public boolean unCommitFromKnowledgeBase(KnowledgeBase kb)
public void selfCleanup()
public abstract void draw(Graphics2D g, boolean printing)
g
- Graphics context on which the object is to be renderedprinting
- Whether to pretty-print the objectabstract void drawBorder(Graphics2D g, Color borderColor)
g
- Graphics context on which the object is to be renderedborderColor
- the color to drawpublic static Graph findDominantContext(ArrayList nodeList) throws CGContextException
nodeList
- list containing the objectsCGContextException
public static boolean putInCorrectContext(Graph g, GraphObject go, Point2D.Double newPos)
g
- outermost enclosing graph out of which go cannot be
placedgo
- new (or repositioned) object that is to be placednewPos
- the new position, usually considered to be the center point
for the objectGraph.handleContextLinks()
public boolean putInCorrectContext(Graph g, GraphObject go)
public Graph getOutermostGraph()
public boolean isNegativelyNested()
public EditFrame getOwnerFrame()
null
if it is not in a frame.public Graph getOwnerGraph()
null
if we're at the top level.public void setOwnerGraph(Graph g)
g
- the owner of this graphpublic ObjectLocator getObjectLocator()
ObjectLocator
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public void addHistoryRecord(chargerlib.history.HistoryRecord he)
public chargerlib.history.ObjectHistory getHistory()
public Font getLabelFont()
public void setLabelFont(Font labelFont)