JIDE 3.5.15

com.jidesoft.marker
Class DefaultMarkerModel

java.lang.Object
  extended by com.jidesoft.marker.DefaultMarkerModel
All Implemented Interfaces:
MarkerModel, PropertyChangeListener, EventListener
Direct Known Subclasses:
DefaultMarkerModel

public class DefaultMarkerModel
extends Object
implements MarkerModel, PropertyChangeListener


Field Summary
protected  boolean _isAdjusting
           
protected  EventListenerList _listenerList
           
protected  List<Marker> _markers
           
 
Constructor Summary
DefaultMarkerModel()
           
 
Method Summary
 Marker addMarker(int start, int end, int type, String tooltip)
          Adds a marker.
 void addMarkerListener(MarkerListener l)
          Add a listener to the list that's notified each time a change to the line marker occurs.
 void clearMarkers()
          Removes all markers.
protected  Marker createMarker(int start, int end, int type, String tooltip)
          Creates the Marker.
protected  void fireMarkerChanged(Marker marker, int type, boolean isAdjusting)
          Fires the MarkerEvent.
 MarkerListener[] getMarkerListeners()
          Returns an array of all the MarkerListeners added to this MarkerModel with addMarkerListener().
 List<Marker> getMarkers()
          Gets the list of markers.
 List<Marker> getMarkersAt(int start, int end)
          Gets the list of markers in the specified range.
 boolean isAdjusting()
          Checks if the marker model is adjusting.
 void propertyChange(PropertyChangeEvent evt)
           
 boolean removeMarker(Marker marker)
          Removes a previous added marker.
 void removeMarkerListener(MarkerListener l)
          Remove a listener from the list that's notified each time a change to the line marker occurs.
 void setAdjusting(boolean adjusting)
          Sets the marker model to adjusting mode.
 void updateMarker(Marker marker)
          Tells the marker model that this marker has been updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_markers

protected List<Marker> _markers

_isAdjusting

protected boolean _isAdjusting

_listenerList

protected EventListenerList _listenerList
Constructor Detail

DefaultMarkerModel

public DefaultMarkerModel()
Method Detail

getMarkers

public List<Marker> getMarkers()
Gets the list of markers. The list returned from this method should be unmodifiable.

Specified by:
getMarkers in interface MarkerModel
Returns:
the list of markers.

getMarkersAt

public List<Marker> getMarkersAt(int start,
                                 int end)
Gets the list of markers in the specified range.

Specified by:
getMarkersAt in interface MarkerModel
Parameters:
start - the start offset
end - the end offset
Returns:
Gets the markers in the specified range.

isAdjusting

public boolean isAdjusting()
Checks if the marker model is adjusting.

Specified by:
isAdjusting in interface MarkerModel
Returns:
true if it is adjusting.

setAdjusting

public void setAdjusting(boolean adjusting)
Sets the marker model to adjusting mode. If it's in adjusting mode, all marker events fired will have isAdjusting to be true.

Specified by:
setAdjusting in interface MarkerModel
Parameters:
adjusting - true or false.

addMarker

public Marker addMarker(int start,
                        int end,
                        int type,
                        String tooltip)
Adds a marker.

To make the marker display the customized style, please let the type greater than Marker.TYPE_CUSTOM_STYLE.

Specified by:
addMarker in interface MarkerModel
Parameters:
start - the start offset
end - the end offset
type - the type of the marker
tooltip - the tooltip of the marker
Returns:
the marker just added.

createMarker

protected Marker createMarker(int start,
                              int end,
                              int type,
                              String tooltip)
Creates the Marker. Subclass can override to create a subclass of Marker if needed.

Parameters:
start - the start offset
end - the end offset
type - the type
tooltip - the tooltip of the marker
Returns:
a Marker

clearMarkers

public void clearMarkers()
Removes all markers.

Specified by:
clearMarkers in interface MarkerModel

removeMarker

public boolean removeMarker(Marker marker)
Removes a previous added marker.

Specified by:
removeMarker in interface MarkerModel
Parameters:
marker - the marker
Returns:
true if the marker is removed. Otherwise the marker doesn't exist.

updateMarker

public void updateMarker(Marker marker)
Tells the marker model that this marker has been updated.

Specified by:
updateMarker in interface MarkerModel
Parameters:
marker - the marker

fireMarkerChanged

protected void fireMarkerChanged(Marker marker,
                                 int type,
                                 boolean isAdjusting)
Fires the MarkerEvent.

Parameters:
marker - the marker
type - the event type
isAdjusting - adjusting or not

addMarkerListener

public void addMarkerListener(MarkerListener l)
Add a listener to the list that's notified each time a change to the line marker occurs.

Specified by:
addMarkerListener in interface MarkerModel
Parameters:
l - the LineMarkerListener

removeMarkerListener

public void removeMarkerListener(MarkerListener l)
Remove a listener from the list that's notified each time a change to the line marker occurs.

Specified by:
removeMarkerListener in interface MarkerModel
Parameters:
l - the LineMarkerListener
See Also:
addMarkerListener(com.jidesoft.marker.MarkerListener)

getMarkerListeners

public MarkerListener[] getMarkerListeners()
Returns an array of all the MarkerListeners added to this MarkerModel with addMarkerListener().

Specified by:
getMarkerListeners in interface MarkerModel
Returns:
all of the MarkerListeners added or an empty array if no listeners have been added

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

JIDE 3.5.15