public abstract class RulerProvider
extends java.lang.Object
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.Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
RulerProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addRulerChangeListener(RulerChangeListener listener)
The given listener will be notified of changes in ruler properties.
|
void |
getAccGuideDescription(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(AccessibleEvent e,
java.lang.Object guide)
Return the given guide's name/label in the
result field of
the given event. |
void |
getAccGuideValue(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.
|
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.public void addRulerChangeListener(RulerChangeListener listener)
listener
- the listener that is to be notified of changes in ruler
propertiespublic void getAccGuideDescription(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(AccessibleEvent)
public void getAccGuideName(AccessibleEvent e, java.lang.Object guide)
result
field of
the given event.e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleAdapter.getName(AccessibleEvent)
public void getAccGuideValue(AccessibleControlEvent e, java.lang.Object guide)
result
field of the given
event.e
- AccessibleEventguide
- The guide whose accessibility information is requestedAccessibleControlAdapter.getValue(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 createdpublic Command getDeleteGuideCommand(java.lang.Object guide)
guide
- The guide that is to be deletedpublic java.lang.Object getGuideAt(int position)
position
- The position of the guide that is to be foundnull
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 movedpublic java.util.List getGuides()
public int[] getGuidePositions()
public int getGuidePosition(java.lang.Object guide)
guide
- The guide whose position is to be determinedInteger.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
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.