Class NoteLayer

    • Field Detail

      • SENTENCE_MARKS_WESTERN

        private static final java.util.regex.Pattern SENTENCE_MARKS_WESTERN
        Pattern to detect end of sentences followed by another one, or a link, in western script. Group 1 (capturing): period, interrogation mark, exclamation mark Group non capturing: at least one horizontal or vertical whitespace Group 2 (capturing): a letter (any script), or any punctuation
      • SENTENCE_MARKS_EASTERN

        private static final java.util.regex.Pattern SENTENCE_MARKS_EASTERN
        Pattern to detect end of sentences followed by another one, or a link, in eastern script. Group 1 (capturing): ideographic full stop Group 2 (capturing): a letter (any script), or any punctuation
      • HTTP_LINK

        private static final java.util.regex.Pattern HTTP_LINK
      • HTML_LINK

        private static final java.util.regex.Pattern HTML_LINK
      • HTML_LINK_MARK

        private static final java.util.regex.Pattern HTML_LINK_MARK
      • SLASH

        private static final java.util.regex.Pattern SLASH
    • Constructor Detail

      • NoteLayer

        public NoteLayer​(java.util.Collection<Note> notes,
                         java.lang.String name)
        Create a new note layer with a set of notes
        Parameters:
        notes - A list of notes to show in this layer
        name - The name of the layer. Typically "Notes"
      • NoteLayer

        public NoteLayer​(NoteData noteData,
                         java.lang.String name)
        Create a new note layer with a notes data
        Parameters:
        noteData - Notes data
        name - The name of the layer. Typically "Notes"
        Since:
        14101
      • NoteLayer

        public NoteLayer()
        Convenience constructor that creates a layer with an empty note list
    • Method Detail

      • destroy

        public void destroy()
        Description copied from class: Layer
        Called, when the layer is removed from the mapview and is going to be destroyed.

        This is because the Layer constructor cannot add itself safely as a listener to the layerlist dialog, because there may be no such dialog yet (loaded via command line parameter).

        Specified by:
        destroy in interface Destroyable
        Overrides:
        destroy in class Layer
      • getNoteData

        public NoteData getNoteData()
        Returns the note data store being used by this layer
        Returns:
        noteData containing layer notes
      • isUploadable

        public boolean isUploadable()
        Description copied from interface: UploadToServer
        Determines if the layer is able to upload data and implements the UploadToServer interface. A layer that implements the UploadToServer interface must return true.
        Specified by:
        isUploadable in interface UploadToServer
        Overrides:
        isUploadable in class AbstractModifiableLayer
        Returns:
        true if the layer is able to upload data; false, otherwise
      • isSavable

        public boolean isSavable()
        Description copied from class: Layer
        Replies the savable state of this layer (i.e., if it can be saved through a "File → Save" dialog).
        Specified by:
        isSavable in interface SaveToFile
        Overrides:
        isSavable in class Layer
        Returns:
        true if this layer can be saved to a file
      • requiresSaveToFile

        public boolean requiresSaveToFile()
        Description copied from interface: SaveToFile
        Determines if the data managed by this layer needs to be saved to a file. Only replies true if a file is assigned to this layer and if the data managed by this layer has been modified since the last save operation to the file.
        Specified by:
        requiresSaveToFile in interface SaveToFile
        Overrides:
        requiresSaveToFile in class AbstractModifiableLayer
        Returns:
        true if the data managed by this layer needs to be saved to a file; false, otherwise
      • paint

        public void paint​(java.awt.Graphics2D g,
                          MapView mv,
                          Bounds box)
        Description copied from interface: MapViewPaintable
        Paint the dataset using the engine set.
        Specified by:
        paint in interface MapViewPaintable
        Parameters:
        g - Graphics
        mv - The object that can translate GeoPoints to screen coordinates.
        box - Bounding box
      • paintSelectedNote

        private void paintSelectedNote​(java.awt.Graphics2D g,
                                       MapView mv,
                                       int iconHeight,
                                       int iconWidth,
                                       Note selectedNote)
      • fixPanelSizeAndLocation

        private java.awt.Point fixPanelSizeAndLocation​(MapView mv,
                                                       java.lang.String text,
                                                       int xl,
                                                       int xr,
                                                       int yt,
                                                       int yb)
      • insertLineBreaks

        static java.lang.String insertLineBreaks​(java.lang.String longText)
        Inserts HTML line breaks (<br> at the end of each sentence mark (period, interrogation mark, exclamation mark, ideographic full stop).
        Parameters:
        longText - a long text that does not fit on a single line without exceeding half of the map view
        Returns:
        text with line breaks
      • getNoteToolTip

        public static java.lang.String getNoteToolTip​(Note note)
        Returns the HTML-formatted tooltip text for the given note.
        Parameters:
        note - note to display
        Returns:
        the HTML-formatted tooltip text for the given note
        Since:
        13111
      • replaceLinks

        static java.lang.String replaceLinks​(java.lang.String htmlText)
      • getIcon

        public javax.swing.Icon getIcon()
        Description copied from class: Layer
        Return a representative small image for this layer. The image must not be larger than 64 pixel in any dimension.
        Specified by:
        getIcon in class Layer
        Returns:
        layer icon
      • getToolTipText

        public java.lang.String getToolTipText()
        Description copied from class: Layer
        Returns a small tooltip hint about some statistics for this layer.
        Specified by:
        getToolTipText in class Layer
        Returns:
        A small tooltip hint about some statistics for this layer.
      • mergeFrom

        public void mergeFrom​(Layer from)
        Description copied from class: Layer
        Merges the given layer into this layer. Throws if the layer types are incompatible.
        Specified by:
        mergeFrom in class Layer
        Parameters:
        from - The layer that get merged into this one. After the merge, the other layer is not usable anymore and passing to one others mergeFrom should be one of the last things to do with a layer.
      • isMergable

        public boolean isMergable​(Layer other)
        Description copied from class: Layer
        Determines if the other layer can be merged into this layer.
        Specified by:
        isMergable in class Layer
        Parameters:
        other - The other layer that is tested to be mergable with this.
        Returns:
        Whether the other layer can be merged into this layer.
      • visitBoundingBox

        public void visitBoundingBox​(BoundingXYVisitor v)
        Description copied from class: Layer
        Visits the content bounds of this layer. The behavior of this method depends on the layer, but each implementation should attempt to cover the relevant content of the layer in this method.
        Specified by:
        visitBoundingBox in class Layer
        Parameters:
        v - The visitor that gets notified about the contents of this layer.
      • getInfoComponent

        public java.lang.Object getInfoComponent()
        Description copied from class: Layer
        Gets the layer information to display to the user. This is used if the user requests information about this layer. It should display a description of the layer content.
        Specified by:
        getInfoComponent in class Layer
        Returns:
        Either a String or a Component describing the layer.
      • getMenuEntries

        public javax.swing.Action[] getMenuEntries()
        Description copied from class: Layer
        Returns list of actions. Action can implement LayerAction interface when it needs to be represented by other menu component than JMenuItem or when it supports multiple layers. Actions that support multiple layers should also have correct equals implementation.

        Use Layer.SeparatorLayerAction.INSTANCE instead of new JSeparator

        Specified by:
        getMenuEntries in class Layer
        Returns:
        menu actions for this layer
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • autosave

        public boolean autosave​(java.io.File file)
                         throws java.io.IOException
        Description copied from class: AbstractModifiableLayer
        Perform the autosave action for the layer
        Overrides:
        autosave in class AbstractModifiableLayer
        Parameters:
        file - The file to save to
        Returns:
        true if the layer was successfully saved
        Throws:
        java.io.IOException - If there was an IO exception from saving