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 AttributeListattributesInterfaceDisplayPaneldisplayPanelShapeModel3Dmodeljava.util.ArrayList<ShapeSelectionListener>selection_listenersInterfaceShapeshapeAddedjava.util.TreeSet<InterfaceShape>shapesjava.util.TreeSet<ShapeSet>subsetsInterfaceTreeNodetreeNodeFields 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 voidaddSelectionListener(ShapeSelectionListener s)voidaddSet(ShapeSelectionSet set)booleanaddShape(InterfaceShape s)Adds a shape to this setbooleanaddShape(InterfaceShape s, boolean update)voidaddShapes(java.util.ArrayList<InterfaceShape> shapes)voidaddShapes(java.util.TreeSet<InterfaceShape> shapes)voidaddShapes(ShapeSelectionSet set)voidaddUnion(ShapeSet set, boolean recursive)ShapeSet2DIntasShapeSet2D()ShapeSet3DIntasShapeSet3D()voiddestroy()Destroy this object (prepare it to be removed from memory)voidfireSelectionListeners(ShapeSelectionEvent e)protected voidfireShapeDestroyed()Attribute<?>getAttribute(java.lang.String attrName)Returns a specific attribute for this object.AttributeListgetAttributes()Returns the list of current attributes for this object.java.lang.ObjectgetAttributeValue(java.lang.String name)Gets the value of attributename, ornullif it does not exist.java.lang.StringgetDTD()Returns the Data Type Declaration (DTD) for this object's XML representationSectionSet3DIntgetFilteredSectionSet(SectionSet3DInt sectSet)Returns a section set which is sectSet, filtered by this selection setShapeSet2DIntgetFilteredShapeSet2D(ShapeSet2DInt thisSet)Return a shape2D set which is thisSet, filtered by this selection set.ShapeSet3DIntgetFilteredShapeSet3D(ShapeSet3DInt thisSet)Return a shape3D set which is thisSet, filtered by this selection set.java.lang.StringgetFullName()intgetIndexOf(InterfaceShape shape)Returns the index ofshapein this set.java.util.Iterator<InterfaceShape>getIterator()InterfaceShapegetLastAdded()Not implemented.intgetLastInsert()Not implemented.InterfaceShapegetLastInserted()Not implemented.InterfaceShapegetLastModified()Not implemented.InterfaceShapegetLastMoved()Not implemented.InterfaceShapegetLastRemoved()Not implemented.java.lang.StringgetLocalName()Returns the local name associated with this XML object.java.util.ArrayList<InterfaceShape>getMembers()Returns a copy of this set's member list.ShapeModel3DgetModel()java.lang.StringgetName()Gets the name for this object.javax.swing.IcongetObjectIcon()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.ShapeSceneNodegetShapeSceneNode()java.util.Set<InterfaceShape>getShapeSet()java.lang.StringgetShortXML(int tab)Returns a short XML representation of this object.intgetSize()Returns the number of shapes in this setjava.lang.StringgetSourceURL()java.util.Set<ShapeSet>getSubSets()java.lang.ObjectgetTransferData(java.awt.datatransfer.DataFlavor flavor)java.awt.datatransfer.DataFlavor[]getTransferDataFlavors()ShapeSelectionSetgetUnion(ShapeSet set, boolean recursive)SpatialUnitgetUnit()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.booleanhasShape(InterfaceShape shape)Returnstrueifshapeis in this selection set.booleanhasShape(InterfaceShape shape, boolean recurse)Current returns the same ashasShape(mgui.interfaces.shapes.InterfaceShape)TODO: implement to search member shape and selection setsbooleanisAncestorSet(ShapeSet set)Determines whethersetis an ancestor set of this set; i.e., whether this set is a subset ofset.booleanisDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)booleanisDestroyed()Test whether this object has been destroyedbooleanisSelectable()InterfaceTreeNodeissueTreeNode()Issues a new tree node and sets it usingAbstractInterfaceObject.setTreeNode(mgui.interfaces.trees.InterfaceTreeNode).booleanisVisible()booleanmoveShapeBefore(InterfaceShape shape, InterfaceShape target)Moves the order ofshapeto the spot beforetarget.booleanneedsRedraw(Attribute a)booleanperformTransfer(javax.swing.TransferHandler.TransferSupport support)voidremoveSelectionListener(ShapeSelectionListener s)voidremoveSet(ShapeSelectionSet set)voidremoveShape(InterfaceShape s)Removes a shape from this setvoidresetTreeNode()voidsetAttribute(java.lang.String attrName, java.lang.Object newValue)Sets a value for a specific attribute.voidsetAttributes(AttributeList thisList)Sets the list of attributes for this object.voidsetFromSelectionSet(ShapeSelectionSet set)Sets this set's selection to those inset.voidsetFromSelectionSet(ShapeSelectionSet set, boolean update)Sets this set's selection to those inset.voidsetModel(ShapeModel3D m)voidsetName(java.lang.String name)Sets the name for this object.voidsetOverride(AttributeList attr)voidsetSourceURL(java.lang.String url)voidsetTreeNode()voidsetTreeNode(TreeListener l)voidsetUnit(SpatialUnit unit)voidshapeUpdated(ShapeEvent e)A shape that this object is listening to has been updated.booleanshow2D()booleanshow3D()voidshowPopupMenu(java.awt.event.MouseEvent e)Shows a popup menu at the point of the givenMouseEvent.voidsort()java.lang.StringtoString()voidunsetOverride()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, getTreeLabel, setTreeNode, updateTreeNodesMethods 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:
isSelectablein 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 ofshapein this set.- Specified by:
getIndexOfin 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:
getMembersin 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:ShapeListenerA shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.- Specified by:
shapeUpdatedin interfaceShapeListener
-
asShapeSet2D
-
getSize
public int getSize()Description copied from interface:ShapeSetReturns the number of shapes in this set -
setOverride
-
unsetOverride
public void unsetOverride() -
getShapeSet
- Specified by:
getShapeSetin interfaceShapeSet
-
addShape
Description copied from interface:ShapeSetAdds a shape to this set -
getSubSets
- Specified by:
getSubSetsin interfaceShapeSet
-
getUnion
-
addUnion
-
needsRedraw
-
addShape
-
addShapes
-
addShapes
-
addShapes
-
addSet
-
removeSet
-
removeShape
Description copied from interface:ShapeSetRemoves a shape from this set- Specified by:
removeShapein 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:
toStringin classjava.lang.Object
-
hasShape
Returnstrueifshapeis 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:AbstractInterfaceObjectIssues 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:
issueTreeNodein interfaceTreeObject- Overrides:
issueTreeNodein classAbstractInterfaceObject- Returns:
- a new
InterfaceTreeNode
-
fireSelectionListeners
-
addSelectionListener
-
removeSelectionListener
-
getIterator
-
sort
public void sort() -
getShapeSceneNode
-
destroy
public void destroy()Description copied from interface:InterfaceObjectDestroy this object (prepare it to be removed from memory)- Specified by:
destroyin interfaceInterfaceObject- Specified by:
destroyin interfaceShapeListener- Overrides:
destroyin classAbstractInterfaceObject
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObjectTest whether this object has been destroyed- Specified by:
isDestroyedin interfaceInterfaceObject- Specified by:
isDestroyedin interfaceShapeListener- Overrides:
isDestroyedin classAbstractInterfaceObject- Returns:
-
fireShapeDestroyed
protected void fireShapeDestroyed() -
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.
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObjectReturns the local name associated with this XML object.- Specified by:
getLocalNamein 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. -
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:
-
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:
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObjectHandles the end of an XML element.- Specified by:
handleXMLElementEndin 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: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
-
handleXMLString
public void handleXMLString(java.lang.String s)Description copied from interface:XMLObjectHandles a string within an XML element.- Specified by:
handleXMLStringin interfaceXMLObject- Parameters:
s- String to handle
-
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. -
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, 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. -
getLastAdded
Not implemented.- Specified by:
getLastAddedin interfaceShapeSet
-
getLastRemoved
Not implemented.- Specified by:
getLastRemovedin interfaceShapeSet
-
getLastModified
Not implemented.- Specified by:
getLastModifiedin interfaceShapeSet
-
getLastInserted
Not implemented.- Specified by:
getLastInsertedin interfaceShapeSet
-
getLastMoved
Not implemented.- Specified by:
getLastMovedin interfaceShapeSet
-
getLastInsert
public int getLastInsert()Not implemented.- Specified by:
getLastInsertin interfaceShapeSet
-
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:
-
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object.- 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
-
getTransferData
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException- Specified by:
getTransferDatain interfacejava.awt.datatransfer.Transferable- Throws:
java.awt.datatransfer.UnsupportedFlavorExceptionjava.io.IOException
-
getTransferDataFlavors
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()- Specified by:
getTransferDataFlavorsin interfacejava.awt.datatransfer.Transferable
-
isDataFlavorSupported
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)- Specified by:
isDataFlavorSupportedin interfacejava.awt.datatransfer.Transferable
-
performTransfer
public boolean performTransfer(javax.swing.TransferHandler.TransferSupport support)- Specified by:
performTransferin interfaceInterfaceTransferable
-
getUnit
-
isAncestorSet
Description copied from interface:ShapeSetDetermines whethersetis an ancestor set of this set; i.e., whether this set is a subset ofset.- Specified by:
isAncestorSetin interfaceShapeSet- Returns:
-
moveShapeBefore
Description copied from interface:ShapeSetMoves the order ofshapeto the spot beforetarget.- Specified by:
moveShapeBeforein interfaceShapeSet- Returns:
-
setUnit
-
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
-
getName
public java.lang.String getName()Description copied from interface:NamedObjectGets the name for this object.- Specified by:
getNamein interfaceNamedObject- Overrides:
getNamein classAbstractInterfaceObject- Returns:
-
getFullName
public java.lang.String getFullName()- Specified by:
getFullNamein interfaceShapeSet
-
getAttribute
Description copied from interface:AttributeObjectReturns a specific attribute for this object.- Specified by:
getAttributein interfaceAttributeObject- Returns:
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObjectGets the value of attributename, ornullif it does not exist.- Specified by:
getAttributeValuein interfaceAttributeObject- Parameters:
name- Name of the attribute- Returns:
- the value of attribute
name, ornullif it does not exist
-
getAttributes
Description copied from interface:AttributeObjectReturns the list of current attributes for this object.- Specified by:
getAttributesin interfaceAttributeObject- Returns:
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObjectSets a value for a specific attribute.- Specified by:
setAttributein interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObjectSets the list of attributes for this object.- Specified by:
setAttributesin interfaceAttributeObject
-