|
||||||||||
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 java.util.List |
listeners
A list of RulerChangeListener s that have to be notified of changes in
ruler/guide properties. |
static java.lang.String |
PROPERTY_HORIZONTAL_RULER
The following property should be set on the graphical viewer. |
static java.lang.String |
PROPERTY_RULER_VISIBILITY
The following property should be set on the graphical viewer. |
static java.lang.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(org.eclipse.swt.accessibility.AccessibleEvent e,
java.lang.Object guide)
Return the description of the control or specified child in the result field of the event object. |
void |
getAccGuideName(org.eclipse.swt.accessibility.AccessibleEvent e,
java.lang.Object guide)
Return the given guide's name/label in the result field of the given
event. |
void |
getAccGuideValue(org.eclipse.swt.accessibility.AccessibleControlEvent e,
java.lang.Object guide)
Return the guide's position in the result field of the given event. |
java.util.List |
getAttachedEditParts(java.lang.Object guide,
GraphicalViewer viewer)
Returns a List of EditParts that are attached to the given guide. |
java.util.List |
getAttachedModelObjects(java.lang.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(java.lang.Object guide)
Clients should override this method to return a Command to delete the given guide. |
java.lang.Object |
getGuideAt(int position)
In most cases, there should be no need for clients to override this method. |
int |
getGuidePosition(java.lang.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. |
java.util.List |
getGuides()
Clients should override this method to return a list of all the guides set on this ruler. |
Command |
getMoveGuideCommand(java.lang.Object guide,
int positionDelta)
Clients should override this method to return a Command to move the given guide by the given amount. |
java.lang.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 java.lang.String PROPERTY_HORIZONTAL_RULER
public static final java.lang.String PROPERTY_RULER_VISIBILITY
public static final java.lang.String PROPERTY_VERTICAL_RULER
public static final int UNIT_CENTIMETERS
public static final int UNIT_INCHES
public static final int UNIT_PIXELS
protected java.util.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(org.eclipse.swt.accessibility.AccessibleEvent e, java.lang.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(org.eclipse.swt.accessibility.AccessibleEvent)
public void getAccGuideName(org.eclipse.swt.accessibility.AccessibleEvent e, java.lang.Object guide)
result
field of the given
event.
e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleAdapter.getName(org.eclipse.swt.accessibility.AccessibleEvent)
public void getAccGuideValue(org.eclipse.swt.accessibility.AccessibleControlEvent e, java.lang.Object guide)
result
field of the given event.
e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleControlAdapter.getValue(org.eclipse.swt.accessibility.AccessibleControlEvent)
public java.util.List getAttachedModelObjects(java.lang.Object guide)
guide
- the guide to which the model parts are attached.
public java.util.List getAttachedEditParts(java.lang.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(java.lang.Object guide)
guide
- The guide that is to be deleted
public java.lang.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(java.lang.Object guide, int positionDelta)
guide
- The guide that is to be movedpositionDelta
- The amount by which the guide is to be moved
public java.util.List getGuides()
public int[] getGuidePositions()
public int getGuidePosition(java.lang.Object guide)
guide
- The guide whose position is to be determined
Integer.MIN_VALUE
public java.lang.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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |