|
Eclipse GEF 3.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.rulers.RulerProvider
This class provides an interface to interact with the ruler/guide feature provided in
GEF. A RulerProvider
represents a ruler (and the guides contained within),
and provides the necessary information about them.
Clients wishing to utilize this GEF feature should do the following:
RulerChangeListener
s
of changes in ruler properties.true
on the graphical viewer.
Field Summary | |
protected List |
listeners
A list of RulerChangeListener s that have to be notified of changes in
ruler/guide properties. |
static String |
PROPERTY_HORIZONTAL_RULER
The following property should be set on the graphical viewer. |
static String |
PROPERTY_RULER_VISIBILITY
The following property should be set on the graphical viewer. |
static String |
PROPERTY_VERTICAL_RULER
The following property should be set on the graphical viewer. |
static int |
UNIT_CENTIMETERS
Constant indicating that the ruler should display centimeters. |
static int |
UNIT_INCHES
Constant indicating that the ruler should display inches. |
static int |
UNIT_PIXELS
Constant indicating that the ruler should display pixel count. |
Constructor Summary | |
RulerProvider()
|
Method Summary | |
void |
addRulerChangeListener(RulerChangeListener listener)
The given listener will be notified of changes in ruler properties. |
void |
getAccGuideDescription(AccessibleEvent e,
Object guide)
Return the description of the control or specified child in the result field of the event object. |
void |
getAccGuideName(AccessibleEvent e,
Object guide)
Return the given guide's name/label in the result field of the given
event. |
void |
getAccGuideValue(AccessibleControlEvent e,
Object guide)
Return the guide's position in the result field of the given event. |
List |
getAttachedEditParts(Object guide,
GraphicalViewer viewer)
Returns a List of EditParts that are attached to the given guide. |
List |
getAttachedModelObjects(Object guide)
Returns a List of model objects that are attached to the given guide. |
Command |
getCreateGuideCommand(int position)
Clients should override this method to return a Command to create a new guide at the given position. |
Command |
getDeleteGuideCommand(Object guide)
Clients should override this method to return a Command to delete the given guide. |
Object |
getGuideAt(int position)
In most cases, there should be no need for clients to override this method. |
int |
getGuidePosition(Object guide)
Clients should override this method to return the position (in pixels) of the given guide. |
int[] |
getGuidePositions()
Clients should override this method to return an array of all the positions of all the guides on this ruler. |
List |
getGuides()
Clients should override this method to return a list of all the guides set on this ruler. |
Command |
getMoveGuideCommand(Object guide,
int positionDelta)
Clients should override this method to return a Command to move the given guide by the given amount. |
Object |
getRuler()
Clients should override this method to return a model representation of the ruler. |
int |
getUnit()
Clients should override this method to return the units that the ruler should display: one of UNIT_INCHES, UNIT_CENTIMETERS, UNIT_PIXELS. |
void |
removeRulerChangeListener(RulerChangeListener listener)
The given listener will not be notified of changes in the ruler anymore. |
void |
setUnit(int newUnit)
This method will be invoked when the user requests that the ruler display a different measurement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String PROPERTY_HORIZONTAL_RULER
public static final String PROPERTY_RULER_VISIBILITY
public static final String PROPERTY_VERTICAL_RULER
public static final int UNIT_CENTIMETERS
public static final int UNIT_INCHES
public static final int UNIT_PIXELS
protected List listeners
RulerChangeListener
s that have to be notified of changes in
ruler/guide properties.
Constructor Detail |
public RulerProvider()
Method Detail |
public void addRulerChangeListener(RulerChangeListener listener)
listener
- the listener that is to be notified of changes in ruler propertiespublic void getAccGuideDescription(AccessibleEvent e, Object guide)
result
field of the event object. Returning
an empty string tells the client that the control or child
does not have a description, and returning null tells the
client to use the platform description.
e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleAdapter.getDescription(AccessibleEvent)
public void getAccGuideName(AccessibleEvent e, Object guide)
result
field of the given
event.
e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleAdapter.getName(AccessibleEvent)
public void getAccGuideValue(AccessibleControlEvent e, Object guide)
result
field of the given event.
e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleControlAdapter.getValue(AccessibleControlEvent)
public List getAttachedModelObjects(Object guide)
guide
- the guide to which the model parts are attached.
public List getAttachedEditParts(Object guide, GraphicalViewer viewer)
guide
- the guide to which the EditParts are attached.viewer
- the GraphicalViewer in which these EditParts are shown.
public Command getCreateGuideCommand(int position)
position
- The pixel position where the new guide is to be created
public Command getDeleteGuideCommand(Object guide)
guide
- The guide that is to be deleted
public Object getGuideAt(int position)
position
- The position of the guide that is to be found
null
if no guide exists
at the given positionpublic Command getMoveGuideCommand(Object guide, int positionDelta)
guide
- The guide that is to be movedpositionDelta
- The amount by which the guide is to be moved
public List getGuides()
public int[] getGuidePositions()
public int getGuidePosition(Object guide)
guide
- The guide whose position is to be determined
Integer.MIN_VALUE
public Object getRuler()
null
public int getUnit()
public void removeRulerChangeListener(RulerChangeListener listener)
listener
- the listener that is to be removedpublic void setUnit(int newUnit)
newUnit
- the new unit of measurement; will be one of
UNIT_CENTIMETERS
, UNIT_INCHES
, or
UNIT_PIXELS
|
Eclipse GEF 3.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |