Module org.jpo
Package org.jpo.gui

Class ThumbnailDescriptionController

java.lang.Object
org.jpo.gui.ThumbnailDescriptionController
All Implemented Interfaces:
GroupInfoChangeListener, PictureInfoChangeListener

public class ThumbnailDescriptionController extends Object implements PictureInfoChangeListener, GroupInfoChangeListener
ThumbnailDescriptionJPanel is a JPanel that displays the metadata of a thumbnail. It knows the node it is representing. It can be told to change the node it is showing. It can be mute. It knows it's x and y position in the grid
  • Field Details

    • referringNode

      protected SortableDefaultMutableTreeNode referringNode
      a link to the SortableDefaultMutableTreeNode in the data model. This allows thumbnails to be selected by sending a nodeSelected event to the data model.
  • Constructor Details

    • ThumbnailDescriptionController

      public ThumbnailDescriptionController()
      Construct a new ThumbnailDescriptionJPanel
  • Method Details

    • correctTextPopupMenu

      public static Optional<JPopupMenu> correctTextPopupMenu(@NonNull String text, @NonNull JTextArea textArea)
      Returns a popup menu if there are some text patterns that JPO knows how to clean up
      Parameters:
      text - The text to clean up
      textArea - The widget upon which to open to popup menu
      Returns:
      an optional pop up menu
    • getPanel

      public JPanel getPanel()
    • handleCollectionLockNotification

      public void handleCollectionLockNotification(CollectionLockNotification event)
    • doUpdate

      public void doUpdate()
      doUpdate writes the changed text back to the data model and submits an nodeChanged notification on the model. It gets called by the Inputverifier on the text area.
    • getDescription

      @TestOnly public String getDescription()
    • getFileLocation

      @TestOnly public String getFileLocation()
    • setDisplayMode

      public void setDisplayMode(ThumbnailDescriptionController.DescriptionSize displayMode)
      This method how the description panel is shown. It can be set to ThumbnailDescriptionJPanel.LARGE_DESCRIPTION, ThumbnailDescriptionJPanel.MINI_INFO,
      Parameters:
      displayMode - display Mode
    • formatDescription

      public void formatDescription()
      This method formats the text information fields for the indicated node.
    • setVisible

      public void setVisible(boolean visibility)
      Overridden method to allow the better tuning of visibility
      Parameters:
      visibility - Send in true or false
    • showSelectionStatus

      public void showSelectionStatus()
      changes the colour so that the user sees whether the thumbnail is part of the selection
    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the preferred size for the ThumbnailDescription as a Dimension using the thumbnailSize as width and height.
      Returns:
      Returns the preferred size for the ThumbnailDescription as a Dimension using the thumbnailSize as width and height.
    • setFactor

      public void setFactor(float thumbnailSizeFactor)
      This method sets the scaling factor for the display of a thumbnail description
      Parameters:
      thumbnailSizeFactor - Factor
    • getNode

      returns the current node
      Returns:
      the current node
    • setNode

      public void setNode(SortableDefaultMutableTreeNode referringNode)
      This method sets the node which the ThumbnailDescriptionJPanel should display. If it should display nothing then set it to null.
      Parameters:
      referringNode - The Node to be displayed
    • pictureInfoChangeEvent

      public void pictureInfoChangeEvent(PictureInfoChangeEvent pictureInfoChangeEvent)
      here we get notified by the PictureInfo object that something has changed.
      Specified by:
      pictureInfoChangeEvent in interface PictureInfoChangeListener
      Parameters:
      pictureInfoChangeEvent - the event object with details about what changed
    • groupInfoChangeEvent

      public void groupInfoChangeEvent(GroupInfoChangeEvent groupInfoChangeEvent)
      Description copied from interface: GroupInfoChangeListener
      inform the listener that the GroupInfo has changed
      Specified by:
      groupInfoChangeEvent in interface GroupInfoChangeListener
      Parameters:
      groupInfoChangeEvent - The Change event
    • showFilename

      public void showFilename(boolean showFilename)
      Makes the filename visible or hidden depending on the supplied parameter.
      Parameters:
      showFilename - send true to make it visible, false to hide it.