Package ca.corbett.extensions.ui
Class AvailableExtensionsPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ca.corbett.extensions.ui.AvailableExtensionsPanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
This panel queries a remote UpdateSource for a list of compatible extensions
with this application, then allows them to be downloaded, installed, or updated.
- Since:
- swing-extras 2.5
- Author:
- scorbo2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected classprotected classprotected classprotected classprotected classListens to our DownloadManager for a VersionManifest file to be downloaded, then parses it and displays it in our UI.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final Stringprotected final JPanelprotected PublicKeyprotected UpdateSources.UpdateSourceprotected final JPanelprotected final Map<String, ExtensionDetailsPanel> protected final DownloadManagerprotected ExtensionDetailsPanelprotected final ListPanel<AvailableExtensionsPanel.ExtensionPlaceholder> protected final ExtensionManager<?> protected final JPanelprotected booleanprotected MessageUtilprotected final Windowprotected final ConcurrentHashMap<String, File> protected final Fileprotected final UpdateManagerFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionAvailableExtensionsPanel(Window owner, ExtensionManager<?> extManager, UpdateManager updateManager, String appName, String appVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up the temporary screenshot cache directory.protected FileCreates a temporary directory for caching screenshot images during this panel's lifetime.protected booleanextensionInstallCallback(DownloadedExtension downloadedExtension) Invoked internally from the install and update actions, after the extension is downloaded, to complete the process and then prompt to restart the application.protected StringgetCacheKeyForUrl(URL url) Generates a cache key from a URL to use as filename.protected MessageUtilprotected voidprotected booleanisInstalled(VersionManifest.Extension extension) booleanprotected voidWhen an extension is selected in the left menu, we display its details, and provide controls for installing it (if not already installed), updating it (if already installed but a newer version is available), or uninstalling it (if already installed).protected voidTries to select an UpdateSource intelligently and display it.protected voidprotected voidsetVersionManifest(VersionManifest manifest) voidInvoked from ExtensionManagerDialog when our tab becomes active - if we have no currently-selected UpdateSource, we'll prompt for one.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, setVisible, unregisterKeyboardAction, updateMethods 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, validateTreeMethods 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
-
messageUtil
-
owner
-
extensionManager
-
updateManager
-
downloadManager
-
isRestartRequired
protected boolean isRestartRequired -
contentPanel
-
headerPanel
-
detailsPanel
-
detailsPanelMap
-
extensionListPanel
-
emptyPanel
-
currentUpdateSource
-
currentPublicKey
-
applicationName
-
applicationVersion
-
screenshotCacheDir
-
screenshotCache
-
-
Constructor Details
-
AvailableExtensionsPanel
public AvailableExtensionsPanel(Window owner, ExtensionManager<?> extManager, UpdateManager updateManager, String appName, String appVersion)
-
-
Method Details
-
isRestartRequired
public boolean isRestartRequired() -
tabActivated
public void tabActivated()Invoked from ExtensionManagerDialog when our tab becomes active - if we have no currently-selected UpdateSource, we'll prompt for one. There is also a manual "refresh" button on this tab, but it may not be immediately intuitive for the user when first visiting this tab to click it, so we can make it happen automatically on first visit. -
initComponents
protected void initComponents() -
listSelectionChanged
protected void listSelectionChanged()When an extension is selected in the left menu, we display its details, and provide controls for installing it (if not already installed), updating it (if already installed but a newer version is available), or uninstalling it (if already installed). -
refreshList
protected void refreshList() -
promptForUpdateSource
protected void promptForUpdateSource()Tries to select an UpdateSource intelligently and display it. If there are no update sources, the view is cleared. If there's only one update source, it is selected automatically. If there are more than one, the user is prompted to pick one. If an update source is chosen as a result of the above, its version manifest and public key are downloaded and set as current. -
setVersionManifest
-
isInstalled
-
extensionInstallCallback
Invoked internally from the install and update actions, after the extension is downloaded, to complete the process and then prompt to restart the application. -
createScreenshotCacheDirectory
Creates a temporary directory for caching screenshot images during this panel's lifetime. Returns null if creation fails. -
cleanupScreenshotCache
public void cleanupScreenshotCache()Cleans up the temporary screenshot cache directory. We rely on the caller to invoke this, as we don't know when the panel is no longer needed. This is typically invoked from the ExtensionManagerDialog when it is closed. -
getCacheKeyForUrl
Generates a cache key from a URL to use as filename. -
getMessageUtil
-