org.eclipse.contribution.visualiser.interfaces.simpleImpl
Class SimpleMarkupProvider

java.lang.Object
  extended byorg.eclipse.contribution.visualiser.interfaces.simpleImpl.SimpleMarkupProvider
All Implemented Interfaces:
IMarkupProvider
Direct Known Subclasses:
FileMarkupProvider

public class SimpleMarkupProvider
extends java.lang.Object
implements IMarkupProvider

Example implementation of a markup provider. Loads its information about the markups from a file. Manages the list of markups in a hashtable - the hashtable maps the member ID to a list of 'Stripe instances' (markups).


Field Summary
 java.util.SortedSet markupKinds
           
 java.util.Hashtable markups
           
 
Constructor Summary
SimpleMarkupProvider()
           
 
Method Summary
 void addMarkup(java.lang.String membername, Stripe s)
          Add a Stripe to the member with the given name.
 boolean changeMode()
          Change the markup provider mode.
 java.util.SortedSet getAllMarkupKinds()
          Get all the markup kinds.
 Color getColorFor(java.lang.String id)
          Get the Color assigned to the given kind.
 Color getColorFor(java.lang.String ikey, boolean allocateIfNotFound)
          Get the Color assigned to the given kind, or if the boolean argument is true and a Color is not found, assign a new one, else return null.
 java.util.List getGroupMarkups(IGroup group)
          Get the markups for a group.
 java.util.List getMemberMarkups(IMember member)
          Get a List of Stripes for the given member, which are its markups.
 boolean hasMultipleModes()
          Ask if the markup provider has multiple modes.
 void initialise()
          Initialise the markup provider.
 void processMarkups()
          Process all the Stripes that have been added to deal with the overlapping cases
 boolean processMouseclick(IMember member, Stripe stripe, java.lang.String exactKind, int buttonClicked)
          Process a mouse click on a stripe.
 void setColorFor(java.lang.String string, Color color)
          Set the colour for a given kind.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

markups

public java.util.Hashtable markups

markupKinds

public java.util.SortedSet markupKinds
Constructor Detail

SimpleMarkupProvider

public SimpleMarkupProvider()
Method Detail

initialise

public void initialise()
Initialise the markup provider. This simple implementation does nothing here.

Specified by:
initialise in interface IMarkupProvider

changeMode

public boolean changeMode()
Change the markup provider mode. This implementaion does nothing and returns false as there has not been a mode change.

Specified by:
changeMode in interface IMarkupProvider
Returns:
true iff the provider requires the visualiser to update,

hasMultipleModes

public boolean hasMultipleModes()
Ask if the markup provider has multiple modes. Returns false.

Specified by:
hasMultipleModes in interface IMarkupProvider
Returns:
true if this markup provider has multiple modes

getMemberMarkups

public java.util.List getMemberMarkups(IMember member)
Get a List of Stripes for the given member, which are its markups.

Specified by:
getMemberMarkups in interface IMarkupProvider

addMarkup

public void addMarkup(java.lang.String membername,
                      Stripe s)
Add a Stripe to the member with the given name.

Parameters:
membername -
s -

processMarkups

public void processMarkups()
Process all the Stripes that have been added to deal with the overlapping cases


getGroupMarkups

public java.util.List getGroupMarkups(IGroup group)
Get the markups for a group. Group markups are a stacked set of member markups.

Specified by:
getGroupMarkups in interface IMarkupProvider

getAllMarkupKinds

public java.util.SortedSet getAllMarkupKinds()
Get all the markup kinds.

Specified by:
getAllMarkupKinds in interface IMarkupProvider
Returns:
a Set of Strings

getColorFor

public Color getColorFor(java.lang.String id)
Get the Color assigned to the given kind.

Specified by:
getColorFor in interface IMarkupProvider

getColorFor

public Color getColorFor(java.lang.String ikey,
                         boolean allocateIfNotFound)
Get the Color assigned to the given kind, or if the boolean argument is true and a Color is not found, assign a new one, else return null.

Parameters:
ikey -
allocateIfNotFound -
Returns:

setColorFor

public void setColorFor(java.lang.String string,
                        Color color)
Set the colour for a given kind.

Specified by:
setColorFor in interface IMarkupProvider

processMouseclick

public boolean processMouseclick(IMember member,
                                 Stripe stripe,
                                 java.lang.String exactKind,
                                 int buttonClicked)
Process a mouse click on a stripe. This implementation does nothing and returns true to allow the visualiser to perform the default operations.

Specified by:
processMouseclick in interface IMarkupProvider
See Also:
org.eclipse.contribution.visualiser.interfaces.IMarkupProvider#processMouseclick(java.lang.String, org.eclipse.contribution.visualiser.core.Stripe, int)