java.lang.Object
org.jpo.datamodel.PictureCollection
This object holds the state of the picture collection
-
Constructor Summary
ConstructorDescriptionConstructs a new PictureCollection object with a root object -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCategory
(Integer index, String category) This adds a category to the HashMapaddCategory
(String category) This adds a category to the HashMap if it doesn't already exist and returns the corresponding Integer code for the category.void
addCategoryQueryToTreeModel
(Query query) Adds a query to the Query Category Tree Model.void
addQueryToTreeModel
(Query query) Adds a query to the Query Tree Model.void
This method places the current SDMTN into the mailSelection HashSet.void
This method places the currentSortableDefaultMutableTreeNode
into the selection HashSet.void
addTreeModelListener
(TreeModelListener treeModelListener) Adds a treeModelListener to the collection.void
addYearQuery
(String year) Adds a year queryvoid
This method wipes out the data in the picture collection.void
This method clears the mailSelection HashSet.void
Clear out the nodes in the existing queries Tree Modelvoid
This method clears selection that refers to the selected highlighted thumbnails and fires unselectedEventsint
returns the count of mail-selected nodesint
returns the count of selected nodesvoid
Call this method when you need to create a new TreeModel for the queries.void
Loads the specified file into the root node of the collection.static void
fileLoad
(File fileToLoad, SortableDefaultMutableTreeNode node) Loads the collection indicated by the File at the supplied nodevoid
fileSave()
method that saves the entire index in XML format.findLinkingGroups
(SortableDefaultMutableTreeNode suppliedNode) This method returns a Set of the group nodes that hold a reference to the picture filename of the supplied node.boolean
Returns true if edits are allowed on this collectionNode for the Years treegetCategory
(Integer key) Returns the Value for the keyReturns an iterator through the categories keysReturns a set of category keysReturns the email-selected nodesCall this method when you need the root Node for the queriesCall this method when you need the TreeModel for the queriesThis method returns the root node of the collectionreturns an array of the selected nodes.boolean
Returns true if model updates should be sent to the listenersReturns a Java Stream of sorted categories suitable for presenting the categories in a sorted pick list.The DefaultTreeModel allows notification of tree change events to listening objects.boolean
This method returns true if the collection has unsaved updates, false if it has noneThis method returns the xml file for the collectionNode for the Years treeboolean
Is a thread loading a file?boolean
isInCollection
(File file) This method returns true if the indicated picture file is already a member of the collection.boolean
isInCollection
(String sha256) This method returns true if the indicated checksum is already a member of the collection.boolean
This returns whether the SDMTN is part of the mailSelection HashSet.boolean
This returns whether the SDMTN is part of the selection HashSet.void
removeCategory
(Integer key) Removes the category associated with thevoid
removeCategoryUsage
(Object key, SortableDefaultMutableTreeNode startNode) Removes the category from the nodes using itvoid
This method removes the current SDMTN from the mailSelection HashSet.void
This method removes the current SDMTN from the selectionvoid
removeTreeModelListener
(TreeModelListener treeModelListener) Removes a treeModelListener from the collection.void
renameCategory
(Integer key, String category) Renames a category in the HashMapvoid
sendNodeChanged
(TreeNode changedNode) This method sends a nodeChanged event through to the listeners of the Collection's model.void
sendNodeStructureChanged
(TreeNode changedNode) This method sends a nodeStructureChanged event through to the listeners of the Collection's model.void
sendNodesWereInserted
(TreeNode changedNode, int[] childIndices) This method sends a nodesWereInserted event through to the listeners of the Collection's model.void
sendNodesWereRemoved
(TreeNode node, int[] childIndices, Object[] removedChildren) This method sends a nodesWereRemoved event through to the listeners of the Collection's model.void
setAllowEdits
(boolean newAllowEdits) sets the allow-edit allowedEdits of this collectionvoid
setQueriesTreeModel
(DefaultTreeModel defaultTreeModel) Call this method when you need to set the TreeModel for the queriesvoid
setSendModelUpdates
(boolean status) Sets the flag whether to send model updates or notvoid
This method marks the collection as having unsaved updates.void
setUnsavedUpdates
(boolean unsavedUpdates) This method allows the programmer to set whether the tree has unsaved updates or not.void
setXmlFile
(File file) This method sets the file which represents the current collection.static void
Loads the collection indicated by the Input stream at the "this" node.void
This method inverts the status of the node on the mail selection HashSet
-
Constructor Details
-
PictureCollection
public PictureCollection()Constructs a new PictureCollection object with a root object
-
-
Method Details
-
fileLoad
public static void fileLoad(File fileToLoad, SortableDefaultMutableTreeNode node) throws FileNotFoundException Loads the collection indicated by the File at the supplied node- Parameters:
fileToLoad
- The File object that is to be loaded.node
- the node to load it into- Throws:
FileNotFoundException
- When no good
-
streamLoad
Loads the collection indicated by the Input stream at the "this" node.- Parameters:
is
- The InputStream that is to be loaded.node
- the node to load it into
-
clearCollection
public void clearCollection()This method wipes out the data in the picture collection. As it updates the TreeModel it has been made synchronous on the EDT. -
getTreeModel
The DefaultTreeModel allows notification of tree change events to listening objects.- Returns:
- The tree Model
-
getSendModelUpdates
public boolean getSendModelUpdates()Returns true if model updates should be sent to the listeners- Returns:
- true if model updates are sent around
-
setSendModelUpdates
public void setSendModelUpdates(boolean status) Sets the flag whether to send model updates or not- Parameters:
status
- the new flag value
-
sendNodeStructureChanged
This method sends a nodeStructureChanged event through to the listeners of the Collection's model. It makes sure the event is sent on the EDT- Parameters:
changedNode
- The node that was changed
-
sendNodeChanged
This method sends a nodeChanged event through to the listeners of the Collection's model. It makes sure the event is sent on the EDT- Parameters:
changedNode
- The node that was changed
-
sendNodesWereInserted
This method sends a nodesWereInserted event through to the listeners of the Collection's model.- Parameters:
changedNode
- The node that was insertedchildIndices
- The Child indices
-
sendNodesWereRemoved
This method sends a nodesWereRemoved event through to the listeners of the Collection's model. It makes sure the event is sent on the EDT- Parameters:
node
- parent nodechildIndices
- The Child indicesremovedChildren
- the removed nodes
-
getRootNode
This method returns the root node of the collection- Returns:
- the root node
-
setUnsavedUpdates
public void setUnsavedUpdates()This method marks the collection as having unsaved updates.- See Also:
-
getUnsavedUpdates
public boolean getUnsavedUpdates()This method returns true if the collection has unsaved updates, false if it has none- Returns:
- true if there are unsaved updates, false if there are none
- See Also:
-
setUnsavedUpdates
public void setUnsavedUpdates(boolean unsavedUpdates) This method allows the programmer to set whether the tree has unsaved updates or not.- Parameters:
unsavedUpdates
- Set to true if there are unsaved updates, false if there are none- See Also:
-
getAllowEdits
public boolean getAllowEdits()Returns true if edits are allowed on this collection- Returns:
- true if edits are allowed on this collection
-
setAllowEdits
public void setAllowEdits(boolean newAllowEdits) sets the allow-edit allowedEdits of this collection- Parameters:
newAllowEdits
- pass true to allow edits, false to forbid
-
getQueriesTreeModel
Call this method when you need the TreeModel for the queries- Returns:
- The treemodel of the queries
-
setQueriesTreeModel
Call this method when you need to set the TreeModel for the queries- Parameters:
defaultTreeModel
- the tree model
-
getQueriesRootNode
Call this method when you need the root Node for the queries- Returns:
- the root node
-
createQueriesTreeModel
public void createQueriesTreeModel()Call this method when you need to create a new TreeModel for the queries. -
getYearsTreeNode
Node for the Years tree- Returns:
- the node
-
getCategoriesTreeNode
Node for the Years tree- Returns:
- the node
-
addYearQuery
Adds a year query- Parameters:
year
- the year
-
clearQueriesTreeModel
public void clearQueriesTreeModel()Clear out the nodes in the existing queries Tree Model -
addQueryToTreeModel
Adds a query to the Query Tree Model.- Parameters:
query
- The new Query to add
-
addCategoryQueryToTreeModel
Adds a query to the Query Category Tree Model.- Parameters:
query
- The new Query to add
-
addCategory
This adds a category to the HashMap- Parameters:
index
- The indexcategory
- The category
-
addCategory
This adds a category to the HashMap if it doesn't already exist and returns the corresponding Integer code for the category.- Parameters:
category
- The category to save or look up- Returns:
- the number at which the category was added
-
renameCategory
Renames a category in the HashMap- Parameters:
key
- The Keycategory
- The category
-
getCategoryIterator
Returns an iterator through the categories keys- Returns:
- an iterator over the categories keys
-
getCategoryKeySet
Returns a set of category keys- Returns:
- a set of category keys
-
getSortedCategoryStream
Returns a Java Stream of sorted categories suitable for presenting the categories in a sorted pick list.- Returns:
- A Steam of Category entries
-
getCategory
Returns the Value for the key- Parameters:
key
- the key for the value to be returned-- Returns:
- Returns the Value for the Key
-
removeCategory
Removes the category associated with the- Parameters:
key
- The Key to be removed
-
removeCategoryUsage
Removes the category from the nodes using it- Parameters:
key
- The category to pollstartNode
- The node from which to start
-
addToMailSelection
This method places the current SDMTN into the mailSelection HashSet.- Parameters:
node
- The node going into the selection
-
toggleMailSelected
This method inverts the status of the node on the mail selection HashSet- Parameters:
node
- The node
-
clearMailSelection
public void clearMailSelection()This method clears the mailSelection HashSet. -
removeFromMailSelection
This method removes the current SDMTN from the mailSelection HashSet.- Parameters:
node
- the node to poll from the mail selection
-
isMailSelected
This returns whether the SDMTN is part of the mailSelection HashSet.- Parameters:
node
- The node- Returns:
- true if part of the mailing set, false if not
-
countMailSelectedNodes
public int countMailSelectedNodes()returns the count of mail-selected nodes- Returns:
- the count of selected nodes
-
getMailSelectedNodes
Returns the email-selected nodes- Returns:
- the nodes selected for emailing
-
isInCollection
This method returns true if the indicated picture file is already a member of the collection. Otherwise, it returns false.- Parameters:
file
- The File object of the file to check for- Returns:
- true if found, false if not
-
isInCollection
This method returns true if the indicated checksum is already a member of the collection. Otherwise, it returns false.- Parameters:
sha256
- The checksum of the picture to check for- Returns:
- true if found, false if not
-
isFileLoading
public boolean isFileLoading()Is a thread loading a file?- Returns:
- true if a thread is loading a file
-
getXmlFile
This method returns the xml file for the collection- Returns:
- The xml file of the collection
-
setXmlFile
This method sets the file which represents the current collection. It updates the title of the main application window too.- Parameters:
file
- set the file name
-
fileLoad
Loads the specified file into the root node of the collection. It ought to be called off the EDT. Then the clearCollection runs on the same thread.- Parameters:
file
- The file- Throws:
FileNotFoundException
- bubble-up exception
-
fileSave
public void fileSave()method that saves the entire index in XML format. -
findLinkingGroups
public Set<SortableDefaultMutableTreeNode> findLinkingGroups(SortableDefaultMutableTreeNode suppliedNode) This method returns a Set of the group nodes that hold a reference to the picture filename of the supplied node. This is used in the Navigate-to function of the pop-up menu- Parameters:
suppliedNode
- The node with the picture for which the owning parent nodes need to be found- Returns:
- group nodes that have a child with the same picture
-
addToSelectedNodes
This method places the currentSortableDefaultMutableTreeNode
into the selection HashSet.- Parameters:
node
- The node
-
removeFromSelection
This method removes the current SDMTN from the selection- Parameters:
node
- the node to poll
-
clearSelection
public void clearSelection()This method clears selection that refers to the selected highlighted thumbnails and fires unselectedEvents -
isSelected
This returns whether the SDMTN is part of the selection HashSet.- Parameters:
node
- the node- Returns:
- true if the node is selected
-
getSelection
returns an array of the selected nodes.- Returns:
- an array of the selected nodes
-
countSelectedNodes
public int countSelectedNodes()returns the count of selected nodes- Returns:
- the count of selected nodes
-
addTreeModelListener
Adds a treeModelListener to the collection. Uses the treeModel associated with the PictureCollection to handle the details- Parameters:
treeModelListener
- The listener to add
-
removeTreeModelListener
Removes a treeModelListener from the collection. Uses the treeModel associated with the PictureCollection to handle the details- Parameters:
treeModelListener
- The listener to remove
-