public class NoteLayer extends AbstractModifiableLayer implements java.awt.event.MouseListener, NoteData.NoteDataUpdateListener
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerActionAbstractMapViewPaintable.CompatibilityModeLayerPainterMapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener| Modifier and Type | Field and Description |
|---|---|
private Note |
displayedNote |
private HtmlPanel |
displayedPanel |
private javax.swing.JWindow |
displayedWindow |
private static java.util.regex.Pattern |
HTML_LINK |
private static java.util.regex.Pattern |
HTML_LINK_MARK |
private static java.util.regex.Pattern |
HTTP_LINK |
private NoteData |
noteData |
private static java.util.regex.Pattern |
SENTENCE_MARKS_EASTERN
Pattern to detect end of sentences followed by another one, or a link, in eastern script.
|
private static java.util.regex.Pattern |
SENTENCE_MARKS_WESTERN
Pattern to detect end of sentences followed by another one, or a link, in western script.
|
private static java.util.regex.Pattern |
SLASH |
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP| Constructor and Description |
|---|
NoteLayer()
Convenience constructor that creates a layer with an empty note list
|
NoteLayer(java.util.Collection<Note> notes,
java.lang.String name)
Create a new note layer with a set of notes
|
NoteLayer(NoteData noteData,
java.lang.String name)
Create a new note layer with a notes data
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
createAndOpenSaveFileChooser()
Creates a new "Save" dialog for this layer and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed. |
AbstractIOTask |
createUploadTask(ProgressMonitor monitor)
Creates a new
AbstractIOTask for uploading data. |
void |
destroy()
Called, when the layer is removed from the mapview and is going to be destroyed.
|
private java.awt.Point |
fixPanelSizeAndLocation(MapView mv,
java.lang.String text,
int xl,
int xr,
int yt,
int yb) |
java.lang.String |
getChangesetSourceTag()
Get the source for the layer
|
javax.swing.Icon |
getIcon()
Return a representative small image for this layer.
|
java.lang.Object |
getInfoComponent()
Gets the layer information to display to the user.
|
javax.swing.Action[] |
getMenuEntries()
Returns list of actions.
|
NoteData |
getNoteData()
Returns the note data store being used by this layer
|
static java.lang.String |
getNoteToolTip(Note note)
Returns the HTML-formatted tooltip text for the given note.
|
java.lang.String |
getToolTipText() |
private void |
hideNoteWindow() |
void |
hookUpMapView()
Initialization code, that depends on Main.map.mapView.
|
(package private) 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). |
boolean |
isDownloadable()
Determines if the layer is able to download data and implements the
DownloadFromServer interface. |
boolean |
isMergable(Layer other) |
boolean |
isModified()
Determines if data managed by this layer has been modified.
|
boolean |
isSavable()
Replies the savable state of this layer (i.e if it can be saved through a "File->Save" dialog).
|
boolean |
isUploadable()
Determines if the layer is able to upload data and implements the
UploadToServer interface. |
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
noteDataUpdated(NoteData data)
Called when the note data is updated
|
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds box)
Paint the dataset using the engine set.
|
private void |
paintSelectedNote(java.awt.Graphics2D g,
MapView mv,
int iconHeight,
int iconWidth,
Note selectedNote) |
(package private) static java.lang.String |
replaceLinks(java.lang.String htmlText) |
boolean |
requiresSaveToFile()
Determines if the data managed by this layer needs to be saved to
a file.
|
boolean |
requiresUploadToServer()
Determines if the data managed by this layer needs to be uploaded to
the server because it contains modified data.
|
void |
selectedNoteChanged(NoteData noteData)
The selected node was changed
|
void |
visitBoundingBox(BoundingXYVisitor v)
Visits the content bounds of this layer.
|
getUploadDialog, isLocked, isUploadDiscouraged, isUploadInProgress, lock, onPostSaveToFile, onPostUploadToServer, unlockaddPropertyChangeListener, checkSaveConditions, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getAssociatedFile, getColor, getDefaultLayerPosition, getName, getOpacity, getViewProjectionBounds, hasColor, isBackgroundLayer, isInfoResizable, isProjectionSupported, isRenamed, isVisible, nameSupportedProjections, onPostLoadFromFile, projectionChanged, removePropertyChangeListener, rename, setAssociatedFile, setBackgroundLayer, setColor, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toStringaddInvalidationListener, attachToMapView, createMapViewPainter, invalidate, removeInvalidationListenerprivate static final java.util.regex.Pattern SENTENCE_MARKS_WESTERN
private static final java.util.regex.Pattern SENTENCE_MARKS_EASTERN
private static final java.util.regex.Pattern HTTP_LINK
private static final java.util.regex.Pattern HTML_LINK
private static final java.util.regex.Pattern HTML_LINK_MARK
private static final java.util.regex.Pattern SLASH
private Note displayedNote
private HtmlPanel displayedPanel
private javax.swing.JWindow displayedWindow
public NoteLayer(java.util.Collection<Note> notes, java.lang.String name)
notes - A list of notes to show in this layername - The name of the layer. Typically "Notes"public NoteLayer(NoteData noteData, java.lang.String name)
noteData - Notes dataname - The name of the layer. Typically "Notes"public NoteLayer()
public void hookUpMapView()
LayerAbstractMapViewPaintable.attachToMapView(org.openstreetmap.josm.gui.layer.MapViewPaintable.MapViewEvent)hookUpMapView in class Layerpublic void destroy()
Layerdestroy in interface Destroyabledestroy in class Layerpublic NoteData getNoteData()
public boolean isModified()
AbstractModifiableLayerisModified in class AbstractModifiableLayerpublic boolean isDownloadable()
DownloadFromServerDownloadFromServer interface. A layer that implements the
DownloadFromServer interface must return true.isDownloadable in interface DownloadFromServerisDownloadable in class AbstractModifiableLayertrue if the layer is able to download data; false, otherwisepublic boolean isUploadable()
UploadToServerUploadToServer interface. A layer that implements the
UploadToServer interface must return true.isUploadable in interface UploadToServerisUploadable in class AbstractModifiableLayertrue if the layer is able to upload data; false, otherwisepublic boolean requiresUploadToServer()
UploadToServerrequiresUploadToServer in interface UploadToServerrequiresUploadToServer in class AbstractModifiableLayertrue if the data managed by this layer needs to be
uploaded to the server because it contains modified data;
false, otherwisepublic boolean isSavable()
LayerisSavable in interface SaveToFileisSavable in class Layerpublic boolean requiresSaveToFile()
SaveToFilerequiresSaveToFile in interface SaveToFilerequiresSaveToFile in class AbstractModifiableLayertrue if the data managed by this layer needs to be saved to a file; false, otherwisepublic void paint(java.awt.Graphics2D g, MapView mv, Bounds box)
MapViewPaintablepaint in interface MapViewPaintableg - Graphicsmv - The object that can translate GeoPoints to screen coordinates.box - Bounding boxprivate void hideNoteWindow()
private void paintSelectedNote(java.awt.Graphics2D g, MapView mv, int iconHeight, int iconWidth, Note selectedNote)
private java.awt.Point fixPanelSizeAndLocation(MapView mv, java.lang.String text, int xl, int xr, int yt, int yb)
static java.lang.String insertLineBreaks(java.lang.String longText)
<br> at the end of each sentence mark
(period, interrogation mark, exclamation mark, ideographic full stop).longText - a long text that does not fit on a single line without exceeding half of the map viewpublic static java.lang.String getNoteToolTip(Note note)
note - note to displaystatic java.lang.String replaceLinks(java.lang.String htmlText)
public javax.swing.Icon getIcon()
Layerpublic java.lang.String getToolTipText()
getToolTipText in class Layerpublic void mergeFrom(Layer from)
Layerpublic boolean isMergable(Layer other)
isMergable in class Layerother - The other layer that is tested to be mergable with this.public void visitBoundingBox(BoundingXYVisitor v)
LayervisitBoundingBox in class Layerv - The visitor that gets notified about the contents of this layer.public java.lang.Object getInfoComponent()
LayergetInfoComponent in class LayerComponent describing the layer.public javax.swing.Action[] getMenuEntries()
LayerLayer.SeparatorLayerAction.INSTANCE instead of new JSeparatorgetMenuEntries in class Layerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic java.io.File createAndOpenSaveFileChooser()
LayercreateAndOpenSaveFileChooser in class LayerFileSaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)public AbstractIOTask createUploadTask(ProgressMonitor monitor)
UploadToServerAbstractIOTask for uploading data.createUploadTask in interface UploadToServercreateUploadTask in class AbstractModifiableLayermonitor - The progress monitorAbstractIOTask for uploading data, or null if not applicablepublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void noteDataUpdated(NoteData data)
NoteData.NoteDataUpdateListenernoteDataUpdated in interface NoteData.NoteDataUpdateListenerdata - The data that was changedpublic void selectedNoteChanged(NoteData noteData)
NoteData.NoteDataUpdateListenerselectedNoteChanged in interface NoteData.NoteDataUpdateListenernoteData - The data of which the selected node was changedpublic java.lang.String getChangesetSourceTag()
LayergetChangesetSourceTag in class Layernull