Package mgui.interfaces.graphics
Class Graphic2DGrid
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.graphics.Graphic2DGrid
- All Implemented Interfaces:
AttributeListener
,AttributeObject
,InterfaceObject
,NamedObject
,TreeObject
,CleanableObject
public class Graphic2DGrid extends AbstractInterfaceObject implements AttributeObject, AttributeListener
Defines a 2D grid, for display in an
InterfaceGraphic2D
window.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Field Summary
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description Graphic2DGrid()
-
Method Summary
Modifier and Type Method Description void
addDisplayListener(DisplayListener listener)
void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.void
draw2D(java.awt.Graphics2D g, DrawingEngine de)
protected void
fireListeners()
Attribute<?>
getAttribute(java.lang.String attrName)
Returns a specific attribute for this object.AttributeList
getAttributes()
Returns the list of current attributes for this object.java.lang.Object
getAttributeValue(java.lang.String name)
Gets the value of attributename
, ornull
if it does not exist.java.awt.Color
getColour()
boolean
getIsMajor()
boolean
getIsVisible()
java.awt.Color
getLabelColour()
java.awt.Font
getLabelFont()
int
getLabelSize()
double
getMax()
double
getMin()
java.lang.String
getName()
Gets the name for this object.boolean
getShowLabels()
double
getSpacing()
java.awt.Stroke
getStyle()
protected void
init()
void
removeDisplayListener(DisplayListener listener)
void
setAttribute(java.lang.String attrName, java.lang.Object newValue)
Sets a value for a specific attribute.void
setAttributes(AttributeList thisList)
Sets the list of attributes for this object.void
setColour(java.awt.Color c)
void
setIsMajor(boolean b)
void
setIsVisible(boolean b)
void
setLabelColour(java.awt.Color c)
void
setLabelSize(int b)
void
setMax(double max)
void
setMin(double min)
void
setName(java.lang.String name)
Sets the name for this object.void
setShowLabels(boolean b)
void
setSpacing(double s)
void
setStyle(java.awt.Stroke s)
void
setTreeNode(InterfaceTreeNode treeNode)
Sets the children for this node'sInterfaceTreeNode
.java.lang.String
toString()
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, issueTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Graphic2DGrid
public Graphic2DGrid()
-
-
Method Details
-
init
protected void init() -
draw2D
-
setIsVisible
public void setIsVisible(boolean b) -
setIsMajor
public void setIsMajor(boolean b) -
getShowLabels
public boolean getShowLabels() -
setShowLabels
public void setShowLabels(boolean b) -
getLabelSize
public int getLabelSize() -
setLabelSize
public void setLabelSize(int b) -
getLabelFont
public java.awt.Font getLabelFont() -
getLabelColour
public java.awt.Color getLabelColour() -
setLabelColour
public void setLabelColour(java.awt.Color c) -
setMin
public void setMin(double min) -
setMax
public void setMax(double max) -
setSpacing
public void setSpacing(double s) -
setColour
public void setColour(java.awt.Color c) -
setStyle
public void setStyle(java.awt.Stroke s) -
setName
public void setName(java.lang.String name)Description copied from interface:NamedObject
Sets the name for this object.- Specified by:
setName
in interfaceNamedObject
- Overrides:
setName
in classAbstractInterfaceObject
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Overrides:
getName
in classAbstractInterfaceObject
- Returns:
-
getIsVisible
public boolean getIsVisible() -
getIsMajor
public boolean getIsMajor() -
getMin
public double getMin() -
getMax
public double getMax() -
getSpacing
public double getSpacing() -
getColour
public java.awt.Color getColour() -
getStyle
public java.awt.Stroke getStyle() -
getAttribute
Description copied from interface:AttributeObject
Returns a specific attribute for this object.- Specified by:
getAttribute
in interfaceAttributeObject
- Returns:
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObject
Gets the value of attributename
, ornull
if it does not exist.- Specified by:
getAttributeValue
in interfaceAttributeObject
- Parameters:
name
- Name of the attribute- Returns:
- the value of attribute
name
, ornull
if it does not exist
-
getAttributes
Description copied from interface:AttributeObject
Returns the list of current attributes for this object.- Specified by:
getAttributes
in interfaceAttributeObject
- Returns:
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObject
Sets a value for a specific attribute.- Specified by:
setAttribute
in interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObject
Sets the list of attributes for this object.- Specified by:
setAttributes
in interfaceAttributeObject
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in classAbstractInterfaceObject
-
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated.- Specified by:
attributeUpdated
in interfaceAttributeListener
-
addDisplayListener
-
removeDisplayListener
-
fireListeners
protected void fireListeners() -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-