Package mgui.interfaces.shapes
Class VertexDataColumn
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.VertexDataColumn
- All Implemented Interfaces:
java.lang.Comparable<VertexDataColumn>
,AttributeListener
,InterfaceObject
,PopupMenuObject
,NamedObject
,TreeObject
,CleanableObject
,XMLObject
,IconObject
- Direct Known Subclasses:
GridVertexDataColumn
public class VertexDataColumn extends AbstractInterfaceObject implements java.lang.Comparable<VertexDataColumn>, AttributeListener, IconObject, XMLObject, PopupMenuObject
Encapsulates a column of vertex-wise numerical data. Allows this data column to be associated with
a
NameMap
, a ColourMap
, and a list of LinkedDataStream
s.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected AttributeList
attributes
protected java.util.ArrayList<MguiNumber>
data
protected java.util.HashMap<java.lang.String,java.lang.Boolean>
link_name_mapped
protected java.util.HashMap<java.lang.String,LinkedDataStream<?>>
linked_data
protected java.util.TreeSet<VertexDataColumnListener>
listeners
protected AttributeXMLHandler
xml_attribute_handler
protected ColourMapXMLHandler
xml_cmap_handler
protected java.lang.String
xml_current_block
protected java.lang.String
xml_current_cmap
protected java.lang.String
xml_data
protected XMLObject.XMLEncoding
xml_data_encoding
protected int
xml_data_size
protected java.lang.String
xml_data_type
protected NameMapXMLHandler
xml_nmap_handler
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description VertexDataColumn(java.lang.String name)
VertexDataColumn(java.lang.String name, java.util.ArrayList<MguiNumber> data)
-
Method Summary
Modifier and Type Method Description void
addDataLink(java.lang.String name, LinkedDataStream<?> stream)
Adds a data link to this column.void
addDataLink(java.lang.String name, LinkedDataStream<?> stream, boolean name_mapped)
Adds a data link to this column.void
addListener(VertexDataColumnListener listener)
void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.int
compareTo(VertexDataColumn column)
boolean
copyAttributes(VertexDataColumn source_column)
Copies the attributes ofsource_column
to this column.protected void
fireDataColumnChanged(VertexDataColumnEvent event)
protected void
fireDataColumnColourMapChanged(VertexDataColumnEvent event)
AttributeList
getAttributes()
ColourMap
getColourMap()
Returns the colour map associated with this column, ornull
if there is no associated colour mapdouble
getColourMax()
Returns the data maximum for this columndouble
getColourMin()
Returns the data maximum for this columnjava.util.ArrayList<MguiNumber>
getData()
Returns the data array underlying this column.double[]
getDataAsDouble()
Returns the vertex-wise data as typedouble
double
getDataMax()
Returns the data maximum for this columndouble
getDataMin()
Returns the data minimum for this columnint
getDataTransferType()
Determines the data transfer type (as defined by DataBuffer) for this data column.double
getDoubleValueAtVertex(int index)
Returns the value in this column for the vertex atindex
, as adouble
java.lang.String
getDTD()
Returns the Data Type Declaration (DTD) for this object's XML representationstatic javax.swing.Icon
getIcon()
LinkedDataStream<?>
getLinkedData(java.lang.String name)
Returns aLinkedDataStream
specified byname
java.util.ArrayList<java.lang.String>
getLinkedDataNames()
Returns a list of names for all data linked to this columnjava.lang.String
getLocalName()
Returns the local name associated with this XML object.java.lang.String
getName()
Gets the name for this object.NameMap
getNameMap()
Returns the associated name map, ornull
if none exists.javax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.InterfacePopupMenu
getPopupMenu()
Produces and returns a popup menu for this object.InterfacePopupMenu
getPopupMenu(java.util.List<java.lang.Object> selection)
Produces and returns a popup menu for this object.java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.java.lang.String
getTreeLabel()
Returns the label text to appear in a tree node.MguiNumber
getValueAtVertex(int index)
Returns the value in this column for the vertex atindex
, as an {link MguiDouble}java.lang.String
getXML()
Returns this object's XML representation as a single string.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.java.lang.String
getXMLSchema()
Returns the XML schema for this object's XML representationvoid
handlePopupEvent(java.awt.event.ActionEvent e)
Handles an event on this object's popup menu.void
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.void
handleXMLString(java.lang.String s)
Handles a string within an XML element.boolean
hasNameMap()
Returnstrue
if this column has an associated name mapboolean
isNameMapped(java.lang.String name)
Returnstrue
if the data link specified byname
has an associated name map.protected void
loadAsciiData(java.lang.String string_data)
Load vertices from Ascii encoded dataprotected void
loadBinaryData(java.lang.String string_data, int compression)
Load vertices from Base64 binary encoded data.void
removeDataLink(java.lang.String name)
Removes the data link specified byname
from this columnvoid
removeListener(VertexDataColumnListener listener)
protected void
resetDataLimits(boolean update)
void
setColourLimits(double min, double max)
Sets the data limits for this column; fires an event ifupdate
istrue
.void
setColourLimits(double min, double max, boolean update)
Sets the colour limits for this column; fires an event ifupdate
istrue
.void
setColourMap(ColourMap map)
Sets the colour map associated with this column.void
setColourMap(ColourMap map, boolean update)
Sets the colour map associated with this column.void
setColourMap(ColourMap map, double colour_min, double colour_max, boolean update)
Sets the colour map associated with this column.void
setColourMax(double max)
Sets the data maximum for this column, and fires an event.void
setColourMax(double max, boolean update)
Sets the data maximum for this column; fires an event ifupdate
istrue
.void
setColourMin(double min)
Sets the data maximum for this column, and fires an event.void
setColourMin(double min, boolean update)
Sets the data maximum for this column; fires an event ifupdate
istrue
.void
setDataLimits(double min, double max)
Sets the data limits for this column; fires an event ifupdate
istrue
.void
setDataLimits(double min, double max, boolean update)
Sets the data limits for this column; fires an event ifupdate
istrue
.void
setDataMax(double max)
Sets the data maximum for this column, and fires an event.void
setDataMax(double max, boolean update)
Sets the data maximum for this column; fires an event ifupdate
istrue
.void
setDataMin(double min)
Sets the data minimum for this column, and fires an event.void
setDataMin(double min, boolean update)
Sets the data minimum for this column; fires an event ifupdate
istrue
.void
setDoubleValueAtVertex(int index, double value)
Sets the value in this column for the vertex atindex
void
setFromVertexDataColumn(VertexDataColumn column)
Set this data column to match the values, limits, and colour map ofcolumn
.void
setName(java.lang.String name)
Sets the name for this object.void
setNameMap(NameMap name_map)
Associatesmap
with this column.void
setTreeNode(InterfaceTreeNode treeNode)
Sets the children for this node'sInterfaceTreeNode
.void
setValueAtVertex(int index, MguiNumber value)
Sets the value in this column for the vertex atindex
boolean
setValues(java.util.ArrayList<MguiNumber> values)
Sets the values for this data column.boolean
setValues(java.util.ArrayList<MguiNumber> values, boolean update)
Sets the values for this data column.boolean
setValues(java.util.ArrayList<MguiNumber> values, boolean update, boolean check_size)
Sets the values for this data column.void
showPopupMenu(java.awt.event.MouseEvent e)
Shows a popup menu at the point of the givenMouseEvent
.void
updateDataLimits()
Updates this column's data limits based upon its current datavoid
updateDataLimits(boolean update)
Updates this column's data limits based upon its current dataprotected void
writeAsciiData(java.io.Writer writer, int tab, int line_size, int sig_digits)
Writes this vertex column's data as Asciiprotected void
writeBinaryData(java.io.Writer writer, int tab, int compress)
Writes this vertex column's data as Base64 binary.void
writeXML(int tab, java.io.Writer writer)
Writes the XML representation of this object to file.void
writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)
Writes the XML representation of this object to file, asXMLType.Normal
.void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, isDestroyed, issueTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
data
-
attributes
-
linked_data
-
link_name_mapped
protected java.util.HashMap<java.lang.String,java.lang.Boolean> link_name_mapped -
listeners
-
xml_data_type
protected java.lang.String xml_data_type -
xml_data_encoding
-
xml_data_size
protected int xml_data_size -
xml_data
protected java.lang.String xml_data -
xml_current_block
protected java.lang.String xml_current_block -
xml_current_cmap
protected java.lang.String xml_current_cmap -
xml_cmap_handler
-
xml_attribute_handler
-
xml_nmap_handler
-
-
Constructor Details
-
VertexDataColumn
public VertexDataColumn(java.lang.String name) -
VertexDataColumn
-
-
Method Details
-
copyAttributes
Copies the attributes ofsource_column
to this column.- Parameters:
source_column
-- Returns:
-
getAttributes
-
updateDataLimits
public void updateDataLimits()Updates this column's data limits based upon its current data- Parameters:
update
-
-
updateDataLimits
public void updateDataLimits(boolean update)Updates this column's data limits based upon its current data- Parameters:
update
- If true, fires an AttributeEvent after limits are updated
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
getIcon
public static javax.swing.Icon getIcon() -
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated.- Specified by:
attributeUpdated
in interfaceAttributeListener
-
setFromVertexDataColumn
Set this data column to match the values, limits, and colour map ofcolumn
.- Parameters:
column
-
-
getDataMin
public double getDataMin()Returns the data minimum for this column- Returns:
-
setDataMin
public void setDataMin(double min)Sets the data minimum for this column, and fires an event.- Parameters:
min
-
-
setDataMin
public void setDataMin(double min, boolean update)Sets the data minimum for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
setDataLimits
public void setDataLimits(double min, double max)Sets the data limits for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
setDataLimits
public void setDataLimits(double min, double max, boolean update)Sets the data limits for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
setColourLimits
public void setColourLimits(double min, double max)Sets the data limits for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
setColourLimits
public void setColourLimits(double min, double max, boolean update)Sets the colour limits for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
getDataMax
public double getDataMax()Returns the data maximum for this column- Returns:
-
setDataMax
public void setDataMax(double max)Sets the data maximum for this column, and fires an event.- Parameters:
max
-
-
setDataMax
public void setDataMax(double max, boolean update)Sets the data maximum for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
getColourMax
public double getColourMax()Returns the data maximum for this column- Returns:
-
setColourMax
public void setColourMax(double max)Sets the data maximum for this column, and fires an event.- Parameters:
max
-
-
setColourMax
public void setColourMax(double max, boolean update)Sets the data maximum for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
getColourMin
public double getColourMin()Returns the data maximum for this column- Returns:
-
setColourMin
public void setColourMin(double min)Sets the data maximum for this column, and fires an event.- Parameters:
max
-
-
setColourMin
public void setColourMin(double min, boolean update)Sets the data maximum for this column; fires an event ifupdate
istrue
.- Parameters:
max
-update
-
-
addListener
-
removeListener
-
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<VertexDataColumn>
-
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:
-
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
-
hasNameMap
public boolean hasNameMap()Returnstrue
if this column has an associated name map- Returns:
-
getNameMap
Returns the associated name map, ornull
if none exists.- Returns:
-
setNameMap
Associatesmap
with this column.- Parameters:
map
-
-
getColourMap
Returns the colour map associated with this column, ornull
if there is no associated colour map- Returns:
-
setColourMap
Sets the colour map associated with this column. Sets data min and data max to the limits of the colour map- Parameters:
map
-
-
setColourMap
Sets the colour map associated with this column. Sets data min and data max to the limits of the colour map- Parameters:
map
-colour_min
- Sets the colour minimumcolour_min
- Sets the colour maximumupdate
- Whether to fire an event to this column's listeners
-
setColourMap
Sets the colour map associated with this column. Sets data min and data max to the limits of the colour map- Parameters:
map
-update
- Whether to fire an event to this column's listeners
-
getDoubleValueAtVertex
public double getDoubleValueAtVertex(int index)Returns the value in this column for the vertex atindex
, as adouble
- Parameters:
index
-- Returns:
-
getValueAtVertex
Returns the value in this column for the vertex atindex
, as an {link MguiDouble}- Parameters:
index
-- Returns:
- The value, or
null
if the index is out of bounds
-
getDataAsDouble
public double[] getDataAsDouble()Returns the vertex-wise data as typedouble
- Returns:
-
setValues
Sets the values for this data column.- Parameters:
values
-- Returns:
-
setValues
Sets the values for this data column.- Parameters:
values
- New values for this columnupdate
- Whether to fire this column's listeners- Returns:
-
setValues
public boolean setValues(java.util.ArrayList<MguiNumber> values, boolean update, boolean check_size)Sets the values for this data column.- Parameters:
values
- New values for this columnupdate
- Whether to fire this column's listenerscheck_size
- Whether to check the data size first; should be true unless the caller wants to perform its own check- Returns:
-
resetDataLimits
protected void resetDataLimits(boolean update) -
setDoubleValueAtVertex
public void setDoubleValueAtVertex(int index, double value)Sets the value in this column for the vertex atindex
- Parameters:
index
-value
-
-
setValueAtVertex
Sets the value in this column for the vertex atindex
- Parameters:
index
-value
-
-
getData
Returns the data array underlying this column. This is not a copy, so changes to this array will affect the column.- Returns:
-
getDataTransferType
public int getDataTransferType()Determines the data transfer type (as defined by DataBuffer) for this data column.- Returns:
-
addDataLink
Adds a data link to this column.- Parameters:
name
-stream
-
-
addDataLink
Adds a data link to this column.- Parameters:
name
-stream
-name_mapped
- Iftrue
, and this column has a name map, name map values will be used as keys instead of the numeric ones.
-
removeDataLink
public void removeDataLink(java.lang.String name)Removes the data link specified byname
from this column- Parameters:
name
-
-
fireDataColumnChanged
-
fireDataColumnColourMapChanged
-
getLinkedDataNames
public java.util.ArrayList<java.lang.String> getLinkedDataNames()Returns a list of names for all data linked to this column- Returns:
-
getLinkedData
Returns aLinkedDataStream
specified byname
- Parameters:
name
-- Returns:
-
isNameMapped
public boolean isNameMapped(java.lang.String name)Returnstrue
if the data link specified byname
has an associated name map.- Parameters:
name
-- Returns:
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in classAbstractInterfaceObject
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObject
Returns the label text to appear in a tree node.- Specified by:
getTreeLabel
in interfaceTreeObject
- Overrides:
getTreeLabel
in classAbstractInterfaceObject
- Returns:
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObject
Returns the Data Type Declaration (DTD) for this object's XML representationSee http://en.wikipedia.org/wiki/Document_Type_Definition for a description.
-
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObject
Returns the XML schema for this object's XML representation- Specified by:
getXMLSchema
in interfaceXMLObject
- Returns:
-
getXML
public java.lang.String getXML()Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the start of an XML element.- Specified by:
handleXMLElementStart
in interfaceXMLObject
- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
of this element- Throws:
org.xml.sax.SAXException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the end of an XML element.- Specified by:
handleXMLElementEnd
in interfaceXMLObject
- Parameters:
localName
- Local name of the element- Throws:
org.xml.sax.SAXException
-
handleXMLString
public void handleXMLString(java.lang.String s) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles a string within an XML element.- Specified by:
handleXMLString
in interfaceXMLObject
- Parameters:
s
- String to handle- Throws:
org.xml.sax.SAXException
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- Returns:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file, asXMLType.Normal
. The default format ofXMLFormat.Ascii
will be used. The basic contract for this method is that it should not write a newline character at its start or end. -
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used. -
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObject
Returns a short XML representation of this object.- Specified by:
getShortXML
in interfaceXMLObject
- Returns:
-
writeBinaryData
protected void writeBinaryData(java.io.Writer writer, int tab, int compress) throws java.io.IOExceptionWrites this vertex column's data as Base64 binary.- Parameters:
tab
-compress
- ; compression: 0 = none, 1 = zipped; 2 = gzipped- Throws:
java.io.IOException
-
writeAsciiData
protected void writeAsciiData(java.io.Writer writer, int tab, int line_size, int sig_digits) throws java.io.IOExceptionWrites this vertex column's data as Ascii- Parameters:
tab
-compress
- ; compression: 0 = none, 1 = zipped; 2 = gzipped- Throws:
java.io.IOException
-
loadBinaryData
protected void loadBinaryData(java.lang.String string_data, int compression)Load vertices from Base64 binary encoded data.- Parameters:
string_data
-compression
- Compression; 0 for none, 1 for zip, 2 for gzip
-
loadAsciiData
protected void loadAsciiData(java.lang.String string_data)Load vertices from Ascii encoded data- Parameters:
string_data
-
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObject
Handles an event on this object's popup menu.- Specified by:
handlePopupEvent
in interfacePopupMenuObject
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObject
Shows a popup menu at the point of the givenMouseEvent
.- Specified by:
showPopupMenu
in interfacePopupMenuObject
-