public class LibraryManager extends java.lang.Object implements javax.swing.event.TreeExpansionListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LIID_LABEL
The LIID_LABEL is used as the name of the String Attribute that is
attached to Tree Items to keep track of their Library Index ID.
|
Constructor and Description |
---|
LibraryManager()
constructor called from getInstance()
|
Modifier and Type | Method and Description |
---|---|
void |
addKAR(java.io.File karFile)
Given the LSID of a KAR that has been successfully cached this method
will add all of the contents of that KAR into the Library by first
updating the LibIndex and then updating the tree model.
|
void |
addLibraryJTree(javax.swing.JTree ptree)
Add a reference to a JTree that is using the Library Tree Model so that
it can be updated when the tree model changes.
|
void |
addXML(java.io.File xmlFile)
Update the LibIndex and tree model for a XML file.
|
void |
buildEmptyLibrary()
Create an empty library.
|
void |
buildLibrary()
This method will synchronize the cache with local repositories.
|
ComponentEntity |
createAndAddTreeItem(CompositeEntity parent,
LibItem li)
Create and add the appropriate type of placeholder object to the parent
CompositeEntity that is in the tree model.
|
void |
deleteKAR(java.io.File aKarFile)
Remove a KAR file from the Component Library and from the user's Disk.
|
ComponentEntity |
findTreeItem(CompositeEntity parent,
int liid)
Look only at the children of the given parent to match the given LIID.
|
ComponentEntity |
findTreeItem(int liid)
Look in the entire tree and return the ComponentEntity that matches the
given LIID.
|
ComponentEntity |
findTreeItemDeep(CompositeEntity parent,
int liid)
Recurse all children under parent to match the given LIID.
|
CompositeEntity |
getActorLibrary()
Get the CompositeEntity version of the library.
|
LibIndex |
getIndex() |
static LibraryManager |
getInstance()
Method for getting an instance of this singleton class.
|
static int |
getLiidFor(ComponentEntity obj)
Return the Library Index ID for the given NamedObj or -1 if an ID cannot
be found.
|
java.util.Vector<java.lang.Integer> |
getLiidsFor(java.util.Vector<KeplerLSID> lsids)
Return the LIIDs for the given set of LSIDs.
|
LibItem |
getPopulatedLibItem(int liid)
Populate this LibItem Object from the database using the given Library
Index ID.
|
LibItem |
getTreeItemIndexInformation(int liid)
Return a populated LibItem for the given liid.
|
EntityTreeModel |
getTreeModel() |
EntityTreeModel |
getTreeModel(java.io.File filterFile) |
void |
refreshJTrees()
Refresh and redraw any JTrees that the LibraryManager is keeping track
of.
|
void |
removeAllFrameTabs(TableauFrame parent) |
void |
setActorLibraryWorkspace(Workspace ws)
Set the workspace for the actor library and regenerate
|
void |
treeCollapsed(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree is collapsed.
|
void |
treeExpanded(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree is expanded.
|
public static final java.lang.String LIID_LABEL
public LibraryManager()
public static LibraryManager getInstance()
public static int getLiidFor(ComponentEntity obj)
obj
- a NamedObj from the Library tree.public void addKAR(java.io.File karFile) throws java.sql.SQLException
f
- java.sql.SQLException
public void addXML(java.io.File xmlFile) throws java.sql.SQLException
f
- java.sql.SQLException
public void addLibraryJTree(javax.swing.JTree ptree)
ptree
- The feature to be added to the LibraryComponent attributepublic void buildEmptyLibrary()
public void buildLibrary()
public void removeAllFrameTabs(TableauFrame parent)
public ComponentEntity createAndAddTreeItem(CompositeEntity parent, LibItem li) throws IllegalActionException, NameDuplicationException, java.lang.IllegalArgumentException, java.io.IOException
li
- NameDuplicationException
IllegalActionException
java.io.IOException
java.lang.IllegalArgumentException
public void deleteKAR(java.io.File aKarFile)
File
- aKarFilepublic ComponentEntity findTreeItem(CompositeEntity parent, int liid)
parent
- liid
- public ComponentEntity findTreeItem(int liid)
liid
- public ComponentEntity findTreeItemDeep(CompositeEntity parent, int liid)
parent
- liid
- public CompositeEntity getActorLibrary()
public java.util.Vector<java.lang.Integer> getLiidsFor(java.util.Vector<KeplerLSID> lsids)
lsids
- public LibItem getTreeItemIndexInformation(int liid)
liid
- public EntityTreeModel getTreeModel()
public EntityTreeModel getTreeModel(java.io.File filterFile)
public void refreshJTrees() throws IllegalActionException
IllegalActionException
- Description of the Exceptionpublic void setActorLibraryWorkspace(Workspace ws)
ws
- public LibItem getPopulatedLibItem(int liid) throws java.sql.SQLException
liid
- java.sql.SQLException
public void treeExpanded(javax.swing.event.TreeExpansionEvent event)
treeExpanded
in interface javax.swing.event.TreeExpansionListener
public void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
treeCollapsed
in interface javax.swing.event.TreeExpansionListener