Package mgui.interfaces.shapes.selection
Class ShapeSelectionSet
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.shapes.selection.ShapeSelectionSet
- All Implemented Interfaces:
java.awt.datatransfer.Transferable
,AttributeObject
,InterfaceObject
,PopupMenuObject
,NamedObject
,ShapeSet
,ShapeListener
,InterfaceTransferable
,TreeObject
,CleanableObject
,XMLObject
public class ShapeSelectionSet extends AbstractInterfaceObject implements ShapeSet, XMLObject, PopupMenuObject, InterfaceTransferable, AttributeObject
-
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
InterfaceDisplayPanel
displayPanel
ShapeModel3D
model
java.util.ArrayList<ShapeSelectionListener>
selection_listeners
InterfaceShape
shapeAdded
java.util.TreeSet<InterfaceShape>
shapes
java.util.TreeSet<ShapeSet>
subsets
InterfaceTreeNode
treeNode
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
tree_nodes
-
Constructor Summary
Constructors Constructor Description ShapeSelectionSet()
ShapeSelectionSet(java.lang.String name)
ShapeSelectionSet(ShapeSelectionSet set)
-
Method Summary
Modifier and Type Method Description void
addSelectionListener(ShapeSelectionListener s)
void
addSet(ShapeSelectionSet set)
boolean
addShape(InterfaceShape s)
Adds a shape to this setboolean
addShape(InterfaceShape s, boolean update)
void
addShapes(java.util.ArrayList<InterfaceShape> shapes)
void
addShapes(java.util.TreeSet<InterfaceShape> shapes)
void
addShapes(ShapeSelectionSet set)
void
addUnion(ShapeSet set, boolean recursive)
ShapeSet2DInt
asShapeSet2D()
ShapeSet3DInt
asShapeSet3D()
void
destroy()
Destroy this object (prepare it to be removed from memory)void
fireSelectionListeners(ShapeSelectionEvent e)
protected void
fireShapeDestroyed()
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.lang.String
getDTD()
Returns the Data Type Declaration (DTD) for this object's XML representationSectionSet3DInt
getFilteredSectionSet(SectionSet3DInt sectSet)
Returns a section set which is sectSet, filtered by this selection setShapeSet2DInt
getFilteredShapeSet2D(ShapeSet2DInt thisSet)
Return a shape2D set which is thisSet, filtered by this selection set.ShapeSet3DInt
getFilteredShapeSet3D(ShapeSet3DInt thisSet)
Return a shape3D set which is thisSet, filtered by this selection set.java.lang.String
getFullName()
int
getIndexOf(InterfaceShape shape)
Returns the index ofshape
in this set.java.util.Iterator<InterfaceShape>
getIterator()
InterfaceShape
getLastAdded()
Not implemented.int
getLastInsert()
Not implemented.InterfaceShape
getLastInserted()
Not implemented.InterfaceShape
getLastModified()
Not implemented.InterfaceShape
getLastMoved()
Not implemented.InterfaceShape
getLastRemoved()
Not implemented.java.lang.String
getLocalName()
Returns the local name associated with this XML object.java.util.ArrayList<InterfaceShape>
getMembers()
Returns a copy of this set's member list.ShapeModel3D
getModel()
java.lang.String
getName()
Gets the name for this object.javax.swing.Icon
getObjectIcon()
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.ShapeSceneNode
getShapeSceneNode()
java.util.Set<InterfaceShape>
getShapeSet()
java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.int
getSize()
Returns the number of shapes in this setjava.lang.String
getSourceURL()
java.util.Set<ShapeSet>
getSubSets()
java.lang.Object
getTransferData(java.awt.datatransfer.DataFlavor flavor)
java.awt.datatransfer.DataFlavor[]
getTransferDataFlavors()
ShapeSelectionSet
getUnion(ShapeSet set, boolean recursive)
SpatialUnit
getUnit()
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
hasShape(InterfaceShape shape)
Returnstrue
ifshape
is in this selection set.boolean
hasShape(InterfaceShape shape, boolean recurse)
Current returns the same ashasShape(mgui.interfaces.shapes.InterfaceShape)
TODO: implement to search member shape and selection setsboolean
isAncestorSet(ShapeSet set)
Determines whetherset
is an ancestor set of this set; i.e., whether this set is a subset ofset
.boolean
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
boolean
isDestroyed()
Test whether this object has been destroyedboolean
isSelectable()
InterfaceTreeNode
issueTreeNode()
Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode)
.boolean
isVisible()
boolean
moveShapeBefore(InterfaceShape shape, InterfaceShape target)
Moves the order ofshape
to the spot beforetarget
.boolean
needsRedraw(Attribute a)
boolean
performTransfer(javax.swing.TransferHandler.TransferSupport support)
void
removeSelectionListener(ShapeSelectionListener s)
void
removeSet(ShapeSelectionSet set)
void
removeShape(InterfaceShape s)
Removes a shape from this setvoid
resetTreeNode()
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
setFromSelectionSet(ShapeSelectionSet set)
Sets this set's selection to those inset
.void
setFromSelectionSet(ShapeSelectionSet set, boolean update)
Sets this set's selection to those inset
.void
setModel(ShapeModel3D m)
void
setName(java.lang.String name)
Sets the name for this object.void
setOverride(AttributeList attr)
void
setSourceURL(java.lang.String url)
void
setTreeNode()
void
setTreeNode(TreeListener l)
void
setUnit(SpatialUnit unit)
void
shapeUpdated(ShapeEvent e)
A shape that this object is listening to has been updated.boolean
show2D()
boolean
show3D()
void
showPopupMenu(java.awt.event.MouseEvent e)
Shows a popup menu at the point of the givenMouseEvent
.void
sort()
java.lang.String
toString()
void
unsetOverride()
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, getTreeLabel, setTreeNode, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
shapes
-
subsets
-
shapeAdded
-
treeNode
-
selection_listeners
-
displayPanel
-
model
-
attributes
-
-
Constructor Details
-
ShapeSelectionSet
public ShapeSelectionSet() -
ShapeSelectionSet
public ShapeSelectionSet(java.lang.String name) -
ShapeSelectionSet
-
-
Method Details
-
isSelectable
public boolean isSelectable()- Specified by:
isSelectable
in interfaceShapeSet
-
setSourceURL
public void setSourceURL(java.lang.String url) -
getSourceURL
public java.lang.String getSourceURL() -
getObjectIcon
public javax.swing.Icon getObjectIcon() -
setFromSelectionSet
Sets this set's selection to those inset
.- Parameters:
set
-
-
setFromSelectionSet
Sets this set's selection to those inset
.- Parameters:
set
-
-
getIndexOf
Returns the index ofshape
in this set.- Specified by:
getIndexOf
in interfaceShapeSet
- Returns:
- index of shape, or -1 if it is not in this set
-
getMembers
Returns a copy of this set's member list.- Specified by:
getMembers
in interfaceShapeSet
- Returns:
- a list of members
-
getModel
-
isVisible
public boolean isVisible() -
show2D
public boolean show2D() -
show3D
public boolean show3D() -
setModel
-
asShapeSet3D
-
shapeUpdated
Description copied from interface:ShapeListener
A shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.- Specified by:
shapeUpdated
in interfaceShapeListener
-
asShapeSet2D
-
getSize
public int getSize()Description copied from interface:ShapeSet
Returns the number of shapes in this set -
setOverride
-
unsetOverride
public void unsetOverride() -
getShapeSet
- Specified by:
getShapeSet
in interfaceShapeSet
-
addShape
Description copied from interface:ShapeSet
Adds a shape to this set -
getSubSets
- Specified by:
getSubSets
in interfaceShapeSet
-
getUnion
-
addUnion
-
needsRedraw
-
addShape
-
addShapes
-
addShapes
-
addShapes
-
addSet
-
removeSet
-
removeShape
Description copied from interface:ShapeSet
Removes a shape from this set- Specified by:
removeShape
in interfaceShapeSet
-
getFilteredSectionSet
Returns a section set which is sectSet, filtered by this selection set- Parameters:
sectSet
-- Returns:
- SectionSet3DInt filtered by this selection set
-
getFilteredShapeSet3D
Return a shape3D set which is thisSet, filtered by this selection set.- Parameters:
thisSet
-- Returns:
- filtered ShapeSet3DInt
-
getFilteredShapeSet2D
Return a shape2D set which is thisSet, filtered by this selection set.- Parameters:
thisSet
-- Returns:
- filtered ShapeSet2DInt
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
hasShape
Returnstrue
ifshape
is in this selection set. TODO: implement to search member shape and selection sets -
hasShape
Current returns the same ashasShape(mgui.interfaces.shapes.InterfaceShape)
TODO: implement to search member shape and selection sets -
resetTreeNode
public void resetTreeNode() -
setTreeNode
-
setTreeNode
public void setTreeNode() -
issueTreeNode
Description copied from class:AbstractInterfaceObject
Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode)
. The tree node is stored in this object, which facilitates their destruction when necessary (e.g., when this object is destroyed). All issued tree nodes can informed of changes to their user object using the methodAbstractInterfaceObject.updateTreeNodes()
.- Specified by:
issueTreeNode
in interfaceTreeObject
- Overrides:
issueTreeNode
in classAbstractInterfaceObject
- Returns:
- a new
InterfaceTreeNode
-
fireSelectionListeners
-
addSelectionListener
-
removeSelectionListener
-
getIterator
-
sort
public void sort() -
getShapeSceneNode
-
destroy
public void destroy()Description copied from interface:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
- Specified by:
destroy
in interfaceShapeListener
- Overrides:
destroy
in classAbstractInterfaceObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObject
Test whether this object has been destroyed- Specified by:
isDestroyed
in interfaceInterfaceObject
- Specified by:
isDestroyed
in interfaceShapeListener
- Overrides:
isDestroyed
in classAbstractInterfaceObject
- Returns:
-
fireShapeDestroyed
protected void fireShapeDestroyed() -
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.
-
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:
-
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. -
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:
-
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:
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObject
Handles the end of an XML element.- Specified by:
handleXMLElementEnd
in interfaceXMLObject
- Parameters:
localName
- Local name of the element
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Description 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
-
handleXMLString
public void handleXMLString(java.lang.String s)Description copied from interface:XMLObject
Handles a string within an XML element.- Specified by:
handleXMLString
in interfaceXMLObject
- Parameters:
s
- String to handle
-
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. -
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, 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. -
getLastAdded
Not implemented.- Specified by:
getLastAdded
in interfaceShapeSet
-
getLastRemoved
Not implemented.- Specified by:
getLastRemoved
in interfaceShapeSet
-
getLastModified
Not implemented.- Specified by:
getLastModified
in interfaceShapeSet
-
getLastInserted
Not implemented.- Specified by:
getLastInserted
in interfaceShapeSet
-
getLastMoved
Not implemented.- Specified by:
getLastMoved
in interfaceShapeSet
-
getLastInsert
public int getLastInsert()Not implemented.- Specified by:
getLastInsert
in interfaceShapeSet
-
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:
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object.- 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
-
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException- Specified by:
getTransferData
in interfacejava.awt.datatransfer.Transferable
- Throws:
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()- Specified by:
getTransferDataFlavors
in interfacejava.awt.datatransfer.Transferable
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)- Specified by:
isDataFlavorSupported
in interfacejava.awt.datatransfer.Transferable
-
performTransfer
public boolean performTransfer(javax.swing.TransferHandler.TransferSupport support)- Specified by:
performTransfer
in interfaceInterfaceTransferable
-
getUnit
-
isAncestorSet
Description copied from interface:ShapeSet
Determines whetherset
is an ancestor set of this set; i.e., whether this set is a subset ofset
.- Specified by:
isAncestorSet
in interfaceShapeSet
- Returns:
-
moveShapeBefore
Description copied from interface:ShapeSet
Moves the order ofshape
to the spot beforetarget
.- Specified by:
moveShapeBefore
in interfaceShapeSet
- Returns:
-
setUnit
-
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:
-
getFullName
public java.lang.String getFullName()- Specified by:
getFullName
in interfaceShapeSet
-
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
-