A GUI for browsing OSP digital library collections. @author Douglas Brown
| 104 | * @author Douglas Brown |
| 105 | */ |
| 106 | @SuppressWarnings("serial") |
| 107 | public class LibraryBrowser extends JPanel { |
| 108 | |
| 109 | // static constants |
| 110 | @SuppressWarnings("javadoc") |
| 111 | public static final String TRACKER_LIBRARY = "https://opensourcephysics.github.io/resources/CAB/tracker_library.xml"; //$NON-NLS-1$ |
| 112 | @SuppressWarnings("javadoc") |
| 113 | public static final String SHARED_LIBRARY = "https://opensourcephysics.github.io/resources/CAB/shared_library.xml"; //$NON-NLS-1$ |
| 114 | protected static final String AND = " AND "; //$NON-NLS-1$ |
| 115 | protected static final String OR = " OR "; //$NON-NLS-1$ |
| 116 | protected static final String OPENING = "("; //$NON-NLS-1$ |
| 117 | protected static final String CLOSING = ")"; //$NON-NLS-1$ |
| 118 | protected static final String MY_LIBRARY_NAME = "my_library.xml"; //$NON-NLS-1$ |
| 119 | protected static final String MY_COLLECTION_NAME = "my_collection.xml"; //$NON-NLS-1$ |
| 120 | protected static final String RECENT_COLLECTION_NAME = "recent_collection.xml"; //$NON-NLS-1$ |
| 121 | protected static final String LIBRARY_HELP_NAME = "library_browser_help.html"; //$NON-NLS-1$ |
| 122 | protected static final String LIBRARY_HELP_ONLINE = "https://opensourcephysics.github.io/tracker-website/help/library_browser.html"; //$NON-NLS-1$ |
| 123 | protected static final String WINDOWS_OSP_DIRECTORY = "/My Documents/OSP/"; //$NON-NLS-1$ |
| 124 | protected static final String OSP_DIRECTORY = "/Documents/OSP/"; //$NON-NLS-1$ |
| 125 | // protected static final String WEB_SEARCH_BASE_PATH = "https://physlets.org/tracker/library/Search/"; |
| 126 | protected static final String WEB_SEARCH_BASE_PATH = "https://opensourcephysics.github.io/resources/Search/"; |
| 127 | protected static final String WEB_EJS = "https://www.um.es/fem/wikis/runwebejs/?url="; |
| 128 | protected static final String TRACKER_ONLINE = "https://opensourcephysics.github.io/tracker-online/?j2sargs="; |
| 129 | protected static final String DATATOOL_ONLINE = "https://opensourcephysics.github.io/tracker-online/DataTool.html?j2sargs="; |
| 130 | public static final String HINT_LOAD_RESOURCE = "LOAD"; |
| 131 | public static final String HINT_DOWNLOAD_RESOURCE = "DOWNLOAD"; |
| 132 | public static final String PROPERTY_LIBRARY_TARGET = "target"; |
| 133 | public static final String PROPERTY_LIBRARY_EDITED = "collection_edit"; |
| 134 | |
| 135 | // static fields |
| 136 | private static String ospPath; |
| 137 | private static LibraryBrowser browser; |
| 138 | protected static Border buttonBorder; |
| 139 | private static boolean checkedWebConnection = OSPRuntime.isJS; |
| 140 | protected static JFrame frame; |
| 141 | protected static JDialog externalDialog; |
| 142 | protected static JMenuBar menubar; |
| 143 | protected static ResizableIcon expandIcon, contractIcon, heavyExpandIcon, heavyContractIcon; |
| 144 | protected static ResizableIcon refreshIcon, downloadIcon, downloadDisabledIcon; |
| 145 | protected static ResizableIcon searchTargetIcon; |
| 146 | protected static final TrackerDLFilter TRACKER_FILTER = new TrackerDLFilter(); |
| 147 | protected static javax.swing.filechooser.FileFilter filesAndFoldersFilter = new FilesAndFoldersFilter(); |
| 148 | protected static Timer searchTimer; |
| 149 | public static boolean fireHelpEvent = false; |
| 150 | public static int maxRecentCollectionSize = 18; |
| 151 | private static int wide = 900, high = 560; |
| 152 | protected static boolean useOnlineOnly = true; |
| 153 | |
| 154 | static { |
| 155 | buttonBorder = BorderFactory.createEtchedBorder(); |
| 156 | Border space = BorderFactory.createEmptyBorder(1, 2, 2, 2); |
| 157 | buttonBorder = BorderFactory.createCompoundBorder(buttonBorder, space); |
| 158 | space = BorderFactory.createEmptyBorder(0, 1, 0, 1); |
| 159 | buttonBorder = BorderFactory.createCompoundBorder(space, buttonBorder); |
| 160 | menubar = new JMenuBar(); |
| 161 | String imageFile = "/org/opensourcephysics/resources/tools/images/expand.png"; //$NON-NLS-1$ |
| 162 | expandIcon = ResourceLoader.getResizableIcon(imageFile); |
| 163 | imageFile = "/org/opensourcephysics/resources/tools/images/contract.png"; //$NON-NLS-1$ |
nothing calls this directly
no test coverage detected