|
GEF (MVC) 3.9.0.201308190730 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EditPolicy
A pluggable contribution implementing a portion of an EditPart's behavior. EditPolicies contribute to the overall editing behavior of an EditPart. Editing behavior is defined as one or more of the following:
Command
in response to
getCommand(Request)
Request
, an EditPolicy may create a derived Request and forward
it to other EditParts. For example, during the deletion of a composite
EditPart, that composite may consult its children for contributions to the
delete command. Then, if the children have any additional work to do, they
will return additional comands to be executed.
EditPolicies should determine an EditPart's editing capabilities. It is possible to implement an EditPart such that it handles all editing responsibility. However, it is much more flexible and object-oriented to use EditPolicies. Using policies, you can pick and choose the editing behavior for an EditPart without being bound to its class hierarchy. Code reuse is increased, and code management is easier.
IMPORTANT: This interface is not intended to be implemented by
clients. Clients should inherit from
AbstractEditPolicy
. New methods may be
added in the future.
Field Summary | |
---|---|
static java.lang.String |
COMPONENT_ROLE
The key used to install a component EditPolicy. |
static java.lang.String |
CONNECTION_BENDPOINTS_ROLE
The key used to install a bendpoint EditPolicy. |
static java.lang.String |
CONNECTION_ENDPOINTS_ROLE
The key used to install a connection endpoint EditPolicy. |
static java.lang.String |
CONNECTION_ROLE
The key used to install a connection EditPolicy. |
static java.lang.String |
CONTAINER_ROLE
The key used to install a container EditPolicy. |
static java.lang.String |
DIRECT_EDIT_ROLE
The key used to install a direct edit EditPolicy. |
static java.lang.String |
GRAPHICAL_NODE_ROLE
The key used to install a graphical node EditPolicy. |
static java.lang.String |
LAYOUT_ROLE
The key used to install a layout EditPolicy. |
static java.lang.String |
NODE_ROLE
The key used to install a node EditPolicy. |
static java.lang.String |
PRIMARY_DRAG_ROLE
The key used to install a primary drag EditPolicy. |
static java.lang.String |
SELECTION_FEEDBACK_ROLE
The key used to install a selection feedback EditPolicy. |
static java.lang.String |
TREE_CONTAINER_ROLE
The key used to install a tree container EditPolicy. |
Method Summary | |
---|---|
void |
activate()
Activates this EditPolicy. |
void |
deactivate()
Deactivates the EditPolicy, the inverse of activate() . |
void |
eraseSourceFeedback(Request request)
Erases source feedback based on the given Request . |
void |
eraseTargetFeedback(Request request)
Erases target feedback based on the given Request . |
Command |
getCommand(Request request)
Returns the Command contribution for the given
Request , or null . |
EditPart |
getHost()
|
EditPart |
getTargetEditPart(Request request)
Returns null or the appropriate EditPart for
the specified Request . |
void |
setHost(EditPart editpart)
Sets the host in which this EditPolicy is installed. |
void |
showSourceFeedback(Request request)
Shows or updates source feedback for the specified Request . |
void |
showTargetFeedback(Request request)
Shows or updates target feedback for the specified Request . |
boolean |
understandsRequest(Request request)
Returns true if this EditPolicy understand the specified
request. |
Field Detail |
---|
static final java.lang.String COMPONENT_ROLE
static final java.lang.String CONNECTION_ENDPOINTS_ROLE
SelectionHandlesEditPolicy
subclass.
Besides rendering selection by displaying Handle
s at then
ends of the connection, the EditPolicy also understands how to move the
endpoints of the connection. If the endpoints are moveable, the
EditPolicy will show feedback and provide Commands
to
perform the move.
static final java.lang.String CONNECTION_BENDPOINTS_ROLE
endpoints
, bendpoint
EditPolicies are porbably
SelectionHandlesEditPolicy
.
static final java.lang.String CONNECTION_ROLE
ConnectionEditPart
may be implemented in its
component EditPolicy,
static final java.lang.String CONTAINER_ROLE
static final java.lang.String DIRECT_EDIT_ROLE
static final java.lang.String GRAPHICAL_NODE_ROLE
static final java.lang.String LAYOUT_ROLE
static final java.lang.String NODE_ROLE
static final java.lang.String PRIMARY_DRAG_ROLE
static final java.lang.String SELECTION_FEEDBACK_ROLE
static final java.lang.String TREE_CONTAINER_ROLE
Method Detail |
---|
void activate()
deactivate()
. The
EditPolicy might also contribute feedback/visuals immediately, such as
selection handles if the EditPart was selected at the time of
activation.
Activate is called after the host has been set, and that host has been activated.
EditPart.activate()
,
deactivate()
,
EditPart.installEditPolicy(Object, EditPolicy)
void deactivate()
activate()
.
Deactivate is called when the host is deactivated, or when the
EditPolicy is uninstalled from an active host. Deactivate unhooks any
listeners, and removes all feedback.
EditPart.deactivate()
,
activate()
,
EditPart.removeEditPolicy(Object)
void eraseSourceFeedback(Request request)
Request
. Does
nothing if the EditPolicy does not apply to the given Request.
This method is declared on EditPart
, and is redeclared here so that EditPart can delegate its
implementation to each of its EditPolicies.
request
- the Requestvoid eraseTargetFeedback(Request request)
Request
. Does
nothing if the EditPolicy does not apply to the given Request.
This method is declared on EditPart
, and is redeclared here so that EditPart can delegate its
implementation to each of its EditPolicies.
request
- the RequestCommand getCommand(Request request)
Command
contribution for the given
Request
, or null
. null
is treated
as a no-op by the caller, or an empty contribution. The EditPolicy must
return an UnexecutableCommand
if it
wishes to disallow the Request.
This method is declared on EditPart
,
and is redeclared here so that EditPart can delegate its implementation
to each of its EditPolicies. The EditPart will combine each EditPolicy's
contribution into a CompoundCommand
.
request
- the Request
null
or a Command contributionEditPart getHost()
EditPart getTargetEditPart(Request request)
null
or the appropriate EditPart
for
the specified Request
. In general, this EditPolicy will
return its host EditPart if it understands the Request. Otherwise,
it will return null
.
This method is declared on EditPart
, and is redeclared here so that EditPart can delegate its
implementation to each of its EditPolicies. The first non-
null
result returned by an EditPolicy is returned by the
EditPart.
request
- the Request
null
or the appropriate target EditPart
void setHost(EditPart editpart)
editpart
- the host EditPartvoid showSourceFeedback(Request request)
Request
. This method may be called repeatedly for the
purpose of updating feedback based on changes to the Request.
Does nothing if the EditPolicy does not recognize the given Request.
This method is declared on EditPart
, and is redeclared here so that EditPart can delegate its
implementation to each of its EditPolicies.
request
- the Requestvoid showTargetFeedback(Request request)
Request
. This method may be called repeatedly for the
purpose of updating feedback based on changes to the Request.
Does nothing if the EditPolicy does not recognize the given request.
This method is declared on EditPart
, and is redeclared here so that EditPart can delegate its
implementation to each of its EditPolicies.
request
- the Requestboolean understandsRequest(Request request)
true
if this EditPolicy understand the specified
request.
This method is declared on EditPart
, and is redeclared here so that EditPart can delegate its
implementation to each of its EditPolicies. EditPart
returns
true
if any of its EditPolicies returns true
.
In other words, it performs a logical OR.
request
- the Request
true
if the EditPolicy understands the
specified requestEditPart.understandsRequest(Request)
|
GEF (MVC) 3.9.0.201308190730 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |