Package org.opensourcephysics.tools
Class LibraryBrowser
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.opensourcephysics.tools.LibraryBrowser
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
A GUI for browsing OSP digital library collections.
- Author:
- Douglas Brown
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JMenuItem
protected static final String
protected static Border
protected JMenuItem
protected JMenuItem
protected JMenuItem
protected static final String
protected JMenuItem
protected JMenu
protected Action
protected JButton
protected JTextField
protected JLabel
protected static ResizableIcon
protected static final String
protected JMenuItem
protected org.opensourcephysics.tools.LibraryBrowser.TrackerDLFilter
protected Action
protected JButton
protected static ResizableIcon
protected static ResizableIcon
protected JButton
protected JMenuItem
protected boolean
protected static ResizableIcon
protected static JDialog
protected JMenu
protected static FileFilter
static boolean
protected static JFrame
protected static ResizableIcon
protected static ResizableIcon
protected TextFrame
protected JMenuItem
protected JMenu
static final String
static final String
protected JEditorPane
protected JScrollPane
protected boolean
protected boolean
protected Library
protected static final String
protected static final String
protected LibraryManager
protected String
protected ActionListener
protected boolean
protected JMenuItem
protected JMenu
static int
protected static JMenuBar
protected JButton
protected PropertyChangeListener
protected static final String
protected static final String
protected JMenuItem
protected static final String
protected JMenuItem
protected Action
protected static final String
protected static final String
static final String
static final String
protected static final String
protected JMenu
protected JButton
protected static ResizableIcon
protected JMenuItem
protected JMenuItem
protected Action
protected JTextField
protected JMenuItem
protected JLabel
protected LibraryTreePanel
protected JButton
protected ListChooser
protected static ResizableIcon
protected static Timer
static final String
protected JTabbedPane
protected boolean
protected JToolBar
protected static final org.opensourcephysics.tools.LibraryBrowser.TrackerDLFilter
static final String
protected static final String
protected PropertyChangeListener
protected static boolean
protected static final String
protected static final String
protected boolean
protected static final String
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addComPADRECollection
(String path) Adds a ComPADRE collection with a specified path.void
Adds a listener to be notified whenever a LibraryTreePanel.MetadataLoader finishes.void
addOSPLibrary
(String path) Adds an OSP-sponsored library with a specified path.protected static void
addSearchResource
(LibraryResource resource) Adds a searchable collection to the search resource map.protected boolean
addTabAndExecute
(String path, List<String> treePath, PropertyChangeListener listener) Adds a tab displaying a library resource with a given path.protected void
addToCollections
(String path) Adds a collection to this browser's library after prompting the user to assign it a name.protected Map<LibraryResource,
List<String[]>> applyAND
(Map<LibraryResource, List<String[]>> results1, Map<LibraryResource, List<String[]>> results2) Returns the resources that are contained in the keysets of both of two input maps.protected Map<LibraryResource,
List<String[]>> applyOR
(Map<LibraryResource, List<String[]>> results1, Map<LibraryResource, List<String[]>> results2) Returns the resources that are contained in the keysets of either of two input maps.void
static void
boolean
closeTab
(int index) Closes a tab.protected void
Creates the visible components of this panel.protected LibraryTreePanel
Creates a new empty LibraryTreePanel.protected String
Creates a new LibraryCollection file.protected LibraryResource
createResource
(File targetFile, File baseDir, FileFilter filter) Creates a LibraryResource that describes and targets a file.protected void
protected void
void
protected void
doSearch()
static boolean
existsOnWeb
(String URLPath) boolean
exit()
Exits this browser.protected String
Returns html code that describes this browser.static LibraryBrowser
Gets the shared singleton browser.static LibraryBrowser
getBrowser
(JDialog dialog) Gets the shared singleton browser in a JDialog or, if none, in a shared JFrame.protected String
getChooserSavePath
(String chooserTitle) Uses a file chooser to define a path to which a library or resource file (xml) can be saved.Gets the fileFilter used to determine which files are DL resources.protected LibraryManager
Gets the library manager for this browser.getMetadataFromHTML
(String htmlCode) Returns the metadata, if any, defined in HTML codeprotected String[]
getNextSplit
(String phrase) Returns the phrase before the next AND or OR operator, the operator itself, and the remainder of the phrase.protected static String
Gets the path to the local OSP folder.protected String[]
getParenthesisSplit
(String phrase) Returns the phrase enclosed in parentheses along with the remainder of a phrase.Gets the recent collection.protected static String
Returns the redirect URL path, if any, of an HTML page.protected Set<LibraryResource>
Returns the set of searchable resources.Gets the selected LibraryTreePanel, if any.int
Gets the current tab count.protected int
getTabIndexFromPath
(String path) Gets the index of the tab associated with a given path.protected int
getTabIndexFromTitle
(String title) Gets the index of the tab associated with a given title.protected String
getTabTitle
(int index) Gets the title of the tab at a given index.protected String
getTabTitle
(String path) Gets the title of the tab associated with a given path.protected LibraryTreePanel
getTreePanel
(int index) Gets the LibraryTreePanel at a specified tab index.protected String
getUniqueName
(String proposed, String nameToIgnore) Returns a name that is not a duplicate of an existing name.void
importLibrary
(String path) Imports a library with a specified path.protected boolean
isDuplicateName
(String name, String nameToIgnore) Determines if a name duplicates an existing name.static boolean
protected boolean
isWebConnected
(boolean[] isDialogShown) Returns true if connected to the web OR if JavaScript.protected LibraryResource
loadResource
(String path) Loads a library resource from a given path.protected void
loadResourceAsync
(String path, Function<LibraryResource, Void> whenDone) protected void
Loads all searchable paths into the search path map.protected void
Loads a tab from a given path.protected boolean
loadTabAndListen
(String path, List<String> treePath, String mode) protected void
loadTabAsync
(String path, int index, List<String> treePath, PropertyChangeListener listener) static void
Entry point when run as an independent application.protected void
open()
Opens a file using an AsyncFileChooser.void
Opens a file with a specified path.protected void
protected void
processTargetSelection
(LibraryResource record, Object hint) void
Refreshes the Collections menu.protected void
Refreshes the GUI, including locale-dependent resources strings.protected void
refreshGUI
(boolean andRebuild) Refreshes the GUI, including locale-dependent resources strings.void
Refreshes the open recent files menu.protected void
refreshTabTitle
(String path, LibraryResource collection) Refreshes the title of a tab based on the properties of a LibraryCollection and the path associated with that collection.protected String
save()
Saves the selected LibraryTreePanel collection.protected String
saveAs()
Saves the current root resource as a new xml file.protected Map<LibraryResource,
List<String[]>> searchCollectionFor
(String searchPhrase, LibraryCollection collection) Searches a LibraryCollection for matches to a search phrase.protected LibraryTreeNode
searchFor
(String searchPhrase, Set<LibraryResource> searchTargets) Searches a set of LibraryResources for resources matching a search phrase.searchResourceFor
(String searchPhrase, LibraryResource record) Searches a LibraryResource for matches to a search phrase.void
setAlwaysOnTop
(boolean alwaysOnTop) void
setComandButtonEnabled
(boolean enabled) Enables/disables the command button.void
setFontLevel
(int level) Sets the font level.void
setMessage
(String message, Color color) Sets a message in the message label.void
Sets the title of this DL browser.void
setVisible
(boolean vis) Sets the visibility of this browserprotected void
Shows the about dialog.protected void
showHelp()
Shows the help frame and displays a help HTML page.void
warnNotLoaded
(String path) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
TRACKER_LIBRARY
- See Also:
-
SHARED_LIBRARY
- See Also:
-
AND
- See Also:
-
OR
- See Also:
-
OPENING
- See Also:
-
CLOSING
- See Also:
-
MY_LIBRARY_NAME
- See Also:
-
MY_COLLECTION_NAME
- See Also:
-
RECENT_COLLECTION_NAME
- See Also:
-
LIBRARY_HELP_NAME
- See Also:
-
LIBRARY_HELP_BASE
- See Also:
-
WINDOWS_OSP_DIRECTORY
- See Also:
-
OSP_DIRECTORY
- See Also:
-
WEB_SEARCH_BASE_PATH
- See Also:
-
WEB_EJS
- See Also:
-
TRACKER_ONLINE
- See Also:
-
DATATOOL_ONLINE
- See Also:
-
HINT_LOAD_RESOURCE
- See Also:
-
HINT_DOWNLOAD_RESOURCE
- See Also:
-
PROPERTY_LIBRARY_TARGET
- See Also:
-
PROPERTY_LIBRARY_EDITED
- See Also:
-
buttonBorder
-
frame
-
externalDialog
-
expandIcon
-
contractIcon
-
heavyExpandIcon
-
heavyContractIcon
-
refreshIcon
-
downloadIcon
-
downloadDisabledIcon
-
searchTargetIcon
-
TRACKER_FILTER
protected static final org.opensourcephysics.tools.LibraryBrowser.TrackerDLFilter TRACKER_FILTER -
filesAndFoldersFilter
-
searchTimer
-
fireHelpEvent
public static boolean fireHelpEvent -
maxRecentCollectionSize
public static int maxRecentCollectionSize -
useOnlineOnly
protected static boolean useOnlineOnly -
webConnected
protected boolean webConnected -
localLibraryLoaded
protected boolean localLibraryLoaded -
library
-
libraryPath
-
toolbar
-
messageButton
-
commandAction
-
searchAction
-
openRecentAction
-
downloadAction
-
commandLabel
-
searchLabel
-
commandField
-
searchField
-
fileMenu
-
recentMenu
-
collectionsMenu
-
manageMenu
-
helpMenu
-
newItem
-
openItem
-
saveItem
-
saveAsItem
-
closeItem
-
closeAllItem
-
exitItem
-
deleteItem
-
collectionsItem
-
searchItem
-
cacheItem
-
aboutItem
-
logItem
-
helpItem
-
commandButton
-
editButton
-
refreshButton
-
downloadButton
-
searchTargetButton
-
loadCollectionAction
-
exitOnClose
protected boolean exitOnClose -
tabbedPane
-
htmlScroller
-
treePanelListener
-
metadataLoaderListener
-
keyPressed
protected boolean keyPressed -
textChanged
protected boolean textChanged -
helpFrame
-
htmlAboutPane
-
dlFileFilter
protected org.opensourcephysics.tools.LibraryBrowser.TrackerDLFilter dlFileFilter -
isResourcePathXML
protected boolean isResourcePathXML -
libraryManager
-
searchTargetChooser
-
searchResultsTreePanel
-
searchPathMap
-
-
Method Details
-
getBrowser
Gets the shared singleton browser.- Returns:
- the shared LibraryBrowser
-
getBrowser
Gets the shared singleton browser in a JDialog or, if none, in a shared JFrame.- Parameters:
dialog
- a JDialog (if null, browser is returned in a JFrame)- Returns:
- the shared LibraryBrowser
-
isPopulatedCollection
-
setAlwaysOnTop
public void setAlwaysOnTop(boolean alwaysOnTop) -
setFontLevel
public void setFontLevel(int level) Sets the font level.- Parameters:
level
- the desired font level
-
importLibrary
Imports a library with a specified path. (no references to this method?)- Parameters:
path
- the path to the Library xml file
-
addOSPLibrary
Adds an OSP-sponsored library with a specified path.- Parameters:
path
- the path to the Library xml file
-
addComPADRECollection
Adds a ComPADRE collection with a specified path.- Parameters:
path
- the ComPADRE query
-
refreshCollectionsMenu
public void refreshCollectionsMenu()Refreshes the Collections menu. -
setTitle
Sets the title of this DL browser.- Parameters:
title
- the title
-
getDLFileFilter
Gets the fileFilter used to determine which files are DL resources.- Returns:
- the file filter
-
setVisible
public void setVisible(boolean vis) Sets the visibility of this browser- Overrides:
setVisible
in classJComponent
- Parameters:
vis
- true to show, false to hide
-
exit
public boolean exit()Exits this browser.- Returns:
- true if exited, false if cancelled by user
-
cancelLoading
public void cancelLoading() -
doneLoading
public void doneLoading() -
getManager
Gets the library manager for this browser.- Returns:
- the collections manager
-
getSelectedTreePanel
Gets the selected LibraryTreePanel, if any.- Returns:
- the selected treePanel, or null if none
-
getTreePanel
Gets the LibraryTreePanel at a specified tab index.- Parameters:
index
- the tab index- Returns:
- the treePanel
-
getTabTitle
Gets the title of the tab associated with a given path.- Parameters:
path
- the collection path- Returns:
- the tab title
-
getTabTitle
Gets the title of the tab at a given index.- Parameters:
index
- the tab index- Returns:
- the tab title
-
getTabIndexFromPath
Gets the index of the tab associated with a given path.- Parameters:
path
- the collection path- Returns:
- the tab index
-
getTabIndexFromTitle
Gets the index of the tab associated with a given title.- Parameters:
title
- the tab title- Returns:
- the tab index
-
loadTab
Loads a tab from a given path. If the tab is already loaded, this selects it. if not yet loaded, this adds a new tab and selects it. If a treePath is specified, the node it points to will be selected- Parameters:
path
- the pathtreePath
- tree path to select in root-first order (may be null)
-
loadTabAndListen
-
getRecentCollection
Gets the recent collection.- Returns:
- the collection, or null if failed
-
loadResourceAsync
-
loadResource
Loads a library resource from a given path.- Parameters:
path
- the path- Returns:
- the resource, or null if failed
-
createResource
Creates a LibraryResource that describes and targets a file.- Parameters:
targetFile
- the target filebaseDir
- the base directory for relative pathsfilter
- a FileFilter to determine if the file is a DL library resource- Returns:
- a LibraryResource that describes and targets the file
-
addTabAndExecute
protected boolean addTabAndExecute(String path, List<String> treePath, PropertyChangeListener listener) Adds a tab displaying a library resource with a given path. If a treePath is specified, the node it points to will be selected- Parameters:
path
- the path to the resourcetreePath
- tree path to select in root-first order (may be null)listener
-- Returns:
- true if successful
-
refreshTabTitle
Refreshes the title of a tab based on the properties of a LibraryCollection and the path associated with that collection.- Parameters:
path
- the collection pathcollection
- the LibraryCollection itself
-
loadTabAsync
protected void loadTabAsync(String path, int index, List<String> treePath, PropertyChangeListener listener) -
createGUI
protected void createGUI()Creates the visible components of this panel. -
setMessage
Sets a message in the message label.- Parameters:
message
- the message. Will be truncated if too long.color
- the background color
-
processTargetCollection
-
processTargetSelection
-
doSearch
protected void doSearch() -
doDownload
protected void doDownload() -
doCommand
protected void doCommand() -
setComandButtonEnabled
public void setComandButtonEnabled(boolean enabled) Enables/disables the command button.- Parameters:
enabled
- true if enabled
-
refreshGUI
protected void refreshGUI()Refreshes the GUI, including locale-dependent resources strings. -
refreshGUI
protected void refreshGUI(boolean andRebuild) Refreshes the GUI, including locale-dependent resources strings.- Parameters:
andRebuild
- true to refresh strings and rebuild file menu
-
refreshRecentMenu
public void refreshRecentMenu()Refreshes the open recent files menu.- Parameters:
menu
- the menu to refresh
-
open
protected void open()Opens a file using an AsyncFileChooser. -
open
Opens a file with a specified path.- Parameters:
path
- the path to the file
-
closeTab
public boolean closeTab(int index) Closes a tab.- Parameters:
index
- the tab number- Returns:
- true unless cancelled by user
-
getTabCount
public int getTabCount()Gets the current tab count.- Returns:
- tab count
-
save
Saves the selected LibraryTreePanel collection.- Returns:
- the path to the saved file, or null if not saved
-
saveAs
Saves the current root resource as a new xml file.- Returns:
- the path to the saved file, or null if not saved
-
getChooserSavePath
Uses a file chooser to define a path to which a library or resource file (xml) can be saved. This adds the extension ".xml", if none, and checks for duplicates.- Parameters:
chooserTitle
- the title of the file chooser- Returns:
- the path, or null if canceled by the user
-
addSearchResource
Adds a searchable collection to the search resource map. -
existsOnWeb
-
getSearchPathMap
-
loadSearchPathMap
protected void loadSearchPathMap()Loads all searchable paths into the search path map. -
getSearchTargets
Returns the set of searchable resources.- Returns:
- a set of searchable resources
-
searchFor
Searches a set of LibraryResources for resources matching a search phrase.- Parameters:
searchPhrase
- the phrase to matchsearchTargets
- a set of LibraryResources to search- Returns:
- a LibraryTreeNode with the search results, or null if no matches found
-
searchCollectionFor
protected Map<LibraryResource,List<String[]>> searchCollectionFor(String searchPhrase, LibraryCollection collection) Searches a LibraryCollection for matches to a search phrase.- Parameters:
searchPhrase
- the phrasecollection
- the LibraryResource- Returns:
- a List of String[] {where match was found, value in which match was found}, or null if no match found
-
searchResourceFor
Searches a LibraryResource for matches to a search phrase.- Parameters:
searchPhrase
- the phraserecord
- the LibraryResource- Returns:
- a List of String[] {category where match found, value where match found}, or null if no match found
-
getNextSplit
Returns the phrase before the next AND or OR operator, the operator itself, and the remainder of the phrase.- Parameters:
phrase
- a search phrase- Returns:
- String[]
-
getParenthesisSplit
Returns the phrase enclosed in parentheses along with the remainder of a phrase.- Parameters:
phrase
- a phrase that starts immediately AFTER an opening parenthesis- Returns:
- String[] {the enclosed phrase, the remainder}
-
applyAND
protected Map<LibraryResource,List<String[]>> applyAND(Map<LibraryResource, List<String[]>> results1, Map<LibraryResource, List<String[]>> results2) Returns the resources that are contained in the keysets of both of two input maps.- Parameters:
results1
-results2
-- Returns:
- map of resources found in both keysets
-
applyOR
protected Map<LibraryResource,List<String[]>> applyOR(Map<LibraryResource, List<String[]>> results1, Map<LibraryResource, List<String[]>> results2) Returns the resources that are contained in the keysets of either of two input maps.- Parameters:
results1
-results2
-- Returns:
- map of resources found in either keyset
-
addToCollections
Adds a collection to this browser's library after prompting the user to assign it a name.- Parameters:
path
- the path to the collection
-
createNewCollection
Creates a new LibraryCollection file.- Returns:
- the path to the new collection
-
getUniqueName
Returns a name that is not a duplicate of an existing name.- Parameters:
proposed
- a proposed namenameToIgnore
- a name that is ignored when comparing- Returns:
- a unique name that is the proposed name plus a possible suffix
-
isDuplicateName
Determines if a name duplicates an existing name.- Parameters:
name
- the proposed namenameToIgnore
- a name that is ignored when comparing- Returns:
- true if name is a duplicate
-
createLibraryTreePanel
Creates a new empty LibraryTreePanel.- Returns:
- the library tree panel
-
showAboutDialog
protected void showAboutDialog()Shows the about dialog. -
showHelp
protected void showHelp()Shows the help frame and displays a help HTML page. -
getAboutLibraryBrowserText
Returns html code that describes this browser. This is displayed when no LibraryTreePanel is loaded.- Returns:
- the html code
-
main
Entry point when run as an independent application.- Parameters:
args
- String[] ignored
-
warnNotLoaded
-
isWebConnected
protected boolean isWebConnected(boolean[] isDialogShown) Returns true if connected to the web OR if JavaScript.- Returns:
- true if web connected
-
getRedirectFromHTMLCode
Returns the redirect URL path, if any, of an HTML page.- Parameters:
code
- the HTML code- Returns:
- the redirect path
-
getMetadataFromHTML
Returns the metadata, if any, defined in HTML code- Parameters:
htmlCode
- the HTML code- Returns:
- a list of String[] {name, value}
-
addMetadataLoaderListener
Adds a listener to be notified whenever a LibraryTreePanel.MetadataLoader finishes. This is used only for refreshing metadata for Tracker JS.- Parameters:
listener
- the listener
-
getOSPPath
Gets the path to the local OSP folder.- Returns:
- the path
-
clearCache
public static void clearCache()
-