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 LinkedDataStreams.- 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 AttributeListattributesprotected java.util.ArrayList<MguiNumber>dataprotected java.util.HashMap<java.lang.String,java.lang.Boolean>link_name_mappedprotected java.util.HashMap<java.lang.String,LinkedDataStream<?>>linked_dataprotected java.util.TreeSet<VertexDataColumnListener>listenersprotected AttributeXMLHandlerxml_attribute_handlerprotected ColourMapXMLHandlerxml_cmap_handlerprotected java.lang.Stringxml_current_blockprotected java.lang.Stringxml_current_cmapprotected java.lang.Stringxml_dataprotected XMLObject.XMLEncodingxml_data_encodingprotected intxml_data_sizeprotected java.lang.Stringxml_data_typeprotected NameMapXMLHandlerxml_nmap_handlerFields 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 voidaddDataLink(java.lang.String name, LinkedDataStream<?> stream)Adds a data link to this column.voidaddDataLink(java.lang.String name, LinkedDataStream<?> stream, boolean name_mapped)Adds a data link to this column.voidaddListener(VertexDataColumnListener listener)voidattributeUpdated(AttributeEvent e)Called when an Attribute's value has been updated.intcompareTo(VertexDataColumn column)booleancopyAttributes(VertexDataColumn source_column)Copies the attributes ofsource_columnto this column.protected voidfireDataColumnChanged(VertexDataColumnEvent event)protected voidfireDataColumnColourMapChanged(VertexDataColumnEvent event)AttributeListgetAttributes()ColourMapgetColourMap()Returns the colour map associated with this column, ornullif there is no associated colour mapdoublegetColourMax()Returns the data maximum for this columndoublegetColourMin()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 typedoubledoublegetDataMax()Returns the data maximum for this columndoublegetDataMin()Returns the data minimum for this columnintgetDataTransferType()Determines the data transfer type (as defined by DataBuffer) for this data column.doublegetDoubleValueAtVertex(int index)Returns the value in this column for the vertex atindex, as adoublejava.lang.StringgetDTD()Returns the Data Type Declaration (DTD) for this object's XML representationstatic javax.swing.IcongetIcon()LinkedDataStream<?>getLinkedData(java.lang.String name)Returns aLinkedDataStreamspecified bynamejava.util.ArrayList<java.lang.String>getLinkedDataNames()Returns a list of names for all data linked to this columnjava.lang.StringgetLocalName()Returns the local name associated with this XML object.java.lang.StringgetName()Gets the name for this object.NameMapgetNameMap()Returns the associated name map, ornullif none exists.javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.InterfacePopupMenugetPopupMenu()Produces and returns a popup menu for this object.InterfacePopupMenugetPopupMenu(java.util.List<java.lang.Object> selection)Produces and returns a popup menu for this object.java.lang.StringgetShortXML(int tab)Returns a short XML representation of this object.java.lang.StringgetTreeLabel()Returns the label text to appear in a tree node.MguiNumbergetValueAtVertex(int index)Returns the value in this column for the vertex atindex, as an {link MguiDouble}java.lang.StringgetXML()Returns this object's XML representation as a single string.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.java.lang.StringgetXMLSchema()Returns the XML schema for this object's XML representationvoidhandlePopupEvent(java.awt.event.ActionEvent e)Handles an event on this object's popup menu.voidhandleXMLElementEnd(java.lang.String localName)Handles the end of an XML element.voidhandleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Handles the start of an XML element.voidhandleXMLString(java.lang.String s)Handles a string within an XML element.booleanhasNameMap()Returnstrueif this column has an associated name mapbooleanisNameMapped(java.lang.String name)Returnstrueif the data link specified bynamehas an associated name map.protected voidloadAsciiData(java.lang.String string_data)Load vertices from Ascii encoded dataprotected voidloadBinaryData(java.lang.String string_data, int compression)Load vertices from Base64 binary encoded data.voidremoveDataLink(java.lang.String name)Removes the data link specified bynamefrom this columnvoidremoveListener(VertexDataColumnListener listener)protected voidresetDataLimits(boolean update)voidsetColourLimits(double min, double max)Sets the data limits for this column; fires an event ifupdateistrue.voidsetColourLimits(double min, double max, boolean update)Sets the colour limits for this column; fires an event ifupdateistrue.voidsetColourMap(ColourMap map)Sets the colour map associated with this column.voidsetColourMap(ColourMap map, boolean update)Sets the colour map associated with this column.voidsetColourMap(ColourMap map, double colour_min, double colour_max, boolean update)Sets the colour map associated with this column.voidsetColourMax(double max)Sets the data maximum for this column, and fires an event.voidsetColourMax(double max, boolean update)Sets the data maximum for this column; fires an event ifupdateistrue.voidsetColourMin(double min)Sets the data maximum for this column, and fires an event.voidsetColourMin(double min, boolean update)Sets the data maximum for this column; fires an event ifupdateistrue.voidsetDataLimits(double min, double max)Sets the data limits for this column; fires an event ifupdateistrue.voidsetDataLimits(double min, double max, boolean update)Sets the data limits for this column; fires an event ifupdateistrue.voidsetDataMax(double max)Sets the data maximum for this column, and fires an event.voidsetDataMax(double max, boolean update)Sets the data maximum for this column; fires an event ifupdateistrue.voidsetDataMin(double min)Sets the data minimum for this column, and fires an event.voidsetDataMin(double min, boolean update)Sets the data minimum for this column; fires an event ifupdateistrue.voidsetDoubleValueAtVertex(int index, double value)Sets the value in this column for the vertex atindexvoidsetFromVertexDataColumn(VertexDataColumn column)Set this data column to match the values, limits, and colour map ofcolumn.voidsetName(java.lang.String name)Sets the name for this object.voidsetNameMap(NameMap name_map)Associatesmapwith this column.voidsetTreeNode(InterfaceTreeNode treeNode)Sets the children for this node'sInterfaceTreeNode.voidsetValueAtVertex(int index, MguiNumber value)Sets the value in this column for the vertex atindexbooleansetValues(java.util.ArrayList<MguiNumber> values)Sets the values for this data column.booleansetValues(java.util.ArrayList<MguiNumber> values, boolean update)Sets the values for this data column.booleansetValues(java.util.ArrayList<MguiNumber> values, boolean update, boolean check_size)Sets the values for this data column.voidshowPopupMenu(java.awt.event.MouseEvent e)Shows a popup menu at the point of the givenMouseEvent.voidupdateDataLimits()Updates this column's data limits based upon its current datavoidupdateDataLimits(boolean update)Updates this column's data limits based upon its current dataprotected voidwriteAsciiData(java.io.Writer writer, int tab, int line_size, int sig_digits)Writes this vertex column's data as Asciiprotected voidwriteBinaryData(java.io.Writer writer, int tab, int compress)Writes this vertex column's data as Base64 binary.voidwriteXML(int tab, java.io.Writer writer)Writes the XML representation of this object to file.voidwriteXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)Writes the XML representation of this object to file, asXMLType.Normal.voidwriteXML(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, updateTreeNodesMethods 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_columnto 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:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Returns:
-
getIcon
public static javax.swing.Icon getIcon() -
attributeUpdated
Description copied from interface:AttributeListenerCalled when an Attribute's value has been updated.- Specified by:
attributeUpdatedin 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 ifupdateistrue.- Parameters:
max-update-
-
setDataLimits
public void setDataLimits(double min, double max)Sets the data limits for this column; fires an event ifupdateistrue.- Parameters:
max-update-
-
setDataLimits
public void setDataLimits(double min, double max, boolean update)Sets the data limits for this column; fires an event ifupdateistrue.- Parameters:
max-update-
-
setColourLimits
public void setColourLimits(double min, double max)Sets the data limits for this column; fires an event ifupdateistrue.- Parameters:
max-update-
-
setColourLimits
public void setColourLimits(double min, double max, boolean update)Sets the colour limits for this column; fires an event ifupdateistrue.- 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 ifupdateistrue.- 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 ifupdateistrue.- 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 ifupdateistrue.- Parameters:
max-update-
-
addListener
-
removeListener
-
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<VertexDataColumn>
-
getName
public java.lang.String getName()Description copied from interface:NamedObjectGets the name for this object.- Specified by:
getNamein interfaceNamedObject- Overrides:
getNamein classAbstractInterfaceObject- Returns:
-
setName
public void setName(java.lang.String name)Description copied from interface:NamedObjectSets the name for this object.- Specified by:
setNamein interfaceNamedObject- Overrides:
setNamein classAbstractInterfaceObject
-
hasNameMap
public boolean hasNameMap()Returnstrueif this column has an associated name map- Returns:
-
getNameMap
Returns the associated name map, ornullif none exists.- Returns:
-
setNameMap
Associatesmapwith this column.- Parameters:
map-
-
getColourMap
Returns the colour map associated with this column, ornullif 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
nullif 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 bynamefrom 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 aLinkedDataStreamspecified byname- Parameters:
name-- Returns:
-
isNameMapped
public boolean isNameMapped(java.lang.String name)Returnstrueif the data link specified bynamehas an associated name map.- Parameters:
name-- Returns:
-
setTreeNode
Description copied from interface:TreeObjectSets the children for this node'sInterfaceTreeNode.- Specified by:
setTreeNodein interfaceTreeObject- Overrides:
setTreeNodein classAbstractInterfaceObject
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObjectReturns the label text to appear in a tree node.- Specified by:
getTreeLabelin interfaceTreeObject- Overrides:
getTreeLabelin classAbstractInterfaceObject- Returns:
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObjectReturns 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:XMLObjectReturns the XML schema for this object's XML representation- Specified by:
getXMLSchemain interfaceXMLObject- Returns:
-
getXML
public java.lang.String getXML()Description copied from interface:XMLObjectReturns 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:XMLObjectReturns 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:XMLObjectHandles the start of an XML element.- Specified by:
handleXMLElementStartin interfaceXMLObject- Parameters:
localName- Local name of the elementattributes- Set of element attributestype- TheXMLTypeof this element- Throws:
org.xml.sax.SAXException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObjectHandles the end of an XML element.- Specified by:
handleXMLElementEndin 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:XMLObjectHandles a string within an XML element.- Specified by:
handleXMLStringin interfaceXMLObject- Parameters:
s- String to handle- Throws:
org.xml.sax.SAXException
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObjectReturns the local name associated with this XML object.- Specified by:
getLocalNamein interfaceXMLObject- Returns:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites 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.Asciiwill be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites the XML representation of this object to file, asXMLType.Normal. The default format ofXMLFormat.Asciiwill 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:XMLObjectWrites 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.Asciiwill be used. -
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObjectReturns a short XML representation of this object.- Specified by:
getShortXMLin 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:PopupMenuObjectProduces and returns a popup menu for this object.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.- Specified by:
getPopupMenuin interfacePopupMenuObject- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObjectHandles an event on this object's popup menu.- Specified by:
handlePopupEventin interfacePopupMenuObject
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObjectShows a popup menu at the point of the givenMouseEvent.- Specified by:
showPopupMenuin interfacePopupMenuObject
-