public abstract class AbstractAssistant extends java.lang.Object implements LayoutAssistant
LayoutAssistant
Modifier and Type | Field and Description |
---|---|
protected static IdeAction |
MOVE_TO_FIRST_ACTION |
static javax.swing.JMenuItem |
MOVE_TO_FIRST_ITEM |
protected static IdeAction |
MOVE_TO_LAST_ACTION |
static javax.swing.JMenuItem |
MOVE_TO_LAST_ITEM |
static javax.swing.JMenu |
ZORDER_MENU |
TOOLBAR_ITEM, TOOLBAR_ITEM_COUNT
Constructor and Description |
---|
AbstractAssistant() |
Modifier and Type | Method and Description |
---|---|
protected int |
calcBestZ(CmtModelNode node,
CmtModelNode toNode,
java.awt.Point location,
java.awt.Dimension size,
java.awt.Rectangle zBounds)
Determine the best position in the stacking order of toNode for node given
a proposed location and size.
|
protected boolean |
changeZ(CmtModelNode node,
CmtModelNode toNode,
int z)
Move a node within its parent to a specific position in the stacking order.
|
void |
cleanupRemovedComponent(CmtModelNode parent)
A child of a container has been removed.
|
void |
constrainAdd(CmtModelNode toNode,
java.awt.Point mouseOrigin,
java.awt.Point mousePos,
java.awt.Point newPos,
java.awt.Dimension newSize)
Optionally modify size and position of an object being added to conform to
the constraints imposed by the LayoutManager being represented.
|
java.lang.String |
constrainMove(CmtModelNode node,
CmtModelNode toNode,
java.awt.Point mousePos,
java.awt.Point mouseOffset,
java.awt.Point newPos,
java.awt.Dimension newSize)
Optionally modify size and position of an object being moved to conform to
the constraints imposed by the LayoutManager being represented.
|
void |
drawGrid(java.awt.Container host,
java.awt.Graphics g)
Gives some special effects to the container based on the LayoutManager.
|
javax.swing.JComponent[] |
getContextMenuItems(Context context)
Get an array of JComponent for population onto a ContextMenu.
|
javax.swing.JComponent |
getEffects(UICanvas canvas,
java.awt.Container host)
Get a JComponent whose rendering provides any special effects applicable
during object creation, object resize or object move for the LayoutManager
being represented.
|
java.lang.String |
getInitializer()
Get initialization string for use in declaration allocation, else null.
|
protected java.lang.Object |
getKey(java.awt.Component comp)
Get the sorting key associated with the given Component.
|
protected static java.util.ArrayList |
getSelectedSiblings(Context context)
Convenience method for determining whether the selection of the given
Context contains all siblings.
|
boolean |
handleEvent(IdeAction action,
Context context)
Respond to the given user action within the given context.
|
boolean |
hasInitializer()
Determine whether or not this assistant generates an initialization string
for use in the declaration allocation.
|
void |
layoutChanged(CmtModelNode container)
Layout has been switched.
|
protected boolean |
lessThan(java.lang.Object o1,
java.lang.Object o2)
Determine whether one object is less than another for sorting purposes.
|
void |
prepareAddComponent(CmtModelNode node,
CmtModelNode toNode,
java.awt.Point location,
java.awt.Point offset,
java.awt.Dimension size)
Perform any preparation on a child component that will be added into to a
container.
|
java.lang.String |
prepareAddStatus(CmtModelNode node,
CmtModelNode toNode,
java.awt.Point location,
java.awt.Dimension size)
Return a string for display during the add process.
|
void |
prepareChangeLayout(CmtModelNode parent)
Perform changes on children of a container to best handle a layout type
change.
|
java.lang.String |
prepareMouseMoveStatus(CmtModelNode node,
CmtModelNode toNode,
java.awt.Point location)
Return a string for display while the user is moving the mouse over a
component.
|
void |
prepareMoveComponent(CmtModelNode node,
CmtModelNode toNode,
java.awt.Point location,
java.awt.Point offset)
Child is being moved.
|
void |
prepareResizeComponent(CmtModelNode node,
SelectionEffects effects,
SelectNib nib)
Perform a requested resize on a child.
|
java.lang.String |
prepareResizeStatus(CmtModelNode node,
java.awt.Point location,
java.awt.Dimension size)
Return a string for display during the resize process.
|
void |
prepareSelectComponent(CmtModelNode node,
SelectionEffects effects)
An immedate child node has been selected.
|
void |
prepareSelectDescendant(CmtModelNode parent,
CmtModelNode child,
SelectionEffects effects)
A descendant node has been selected.
|
protected void |
raiseChildToView(CmtModelNode parent,
CmtModelNode child)
Raise the child within the parent as necessary such that it will be
visible for selection.
|
protected static void |
removeBoundsSetting(CmtModelNode node)
Convenience method for resetting the bounds probery of the given node.
|
java.lang.String |
resizeAction(java.awt.Point location,
SelectionEffects effects,
SelectNib nib)
Return a status message string that will be displayed while the user is
dragging the nib.
|
protected void |
sort(java.util.ArrayList array,
java.util.ArrayList key)
Sort the objects contained in array using the descriptions contained in
key.
|
protected java.util.ArrayList |
sortedNodes(CmtModelNode parent)
Get a sorted list of a given parent's children.
|
boolean |
update(IdeAction action,
Context context)
Update the enabled state of the given action within the given context.
|
boolean |
usesReverseZOrder()
Determine whether or not z-order is reversed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConstraintsEditor, getConstraintsType, getPropertyEditor, getToolbarPrefix
public static javax.swing.JMenu ZORDER_MENU
public static javax.swing.JMenuItem MOVE_TO_FIRST_ITEM
public static javax.swing.JMenuItem MOVE_TO_LAST_ITEM
protected static IdeAction MOVE_TO_FIRST_ACTION
protected static IdeAction MOVE_TO_LAST_ACTION
public boolean hasInitializer()
LayoutAssistant
hasInitializer
in interface LayoutAssistant
public java.lang.String getInitializer()
LayoutAssistant
getInitializer
in interface LayoutAssistant
public void prepareAddComponent(CmtModelNode node, CmtModelNode toNode, java.awt.Point location, java.awt.Point offset, java.awt.Dimension size)
prepareAddComponent
in interface LayoutAssistant
node
- the node being added.toNode
- CmtModelNode receiving the node.location
- the location in the parent.offset
- the mouse down position relative to the node.size
- the size of the component.public void prepareMoveComponent(CmtModelNode node, CmtModelNode toNode, java.awt.Point location, java.awt.Point offset)
prepareMoveComponent
in interface LayoutAssistant
node
- the CmtModelNode that has moved.toNode
- CmtModelNode receiving the node.location
- the new location.offset
- the mouse down position relative to the node.public void layoutChanged(CmtModelNode container)
layoutChanged
in interface LayoutAssistant
container
- teh CmtModelNode for the container that has changed.public void prepareChangeLayout(CmtModelNode parent)
prepareChangeLayout
in interface LayoutAssistant
parent
- the CmtModelNode for the container that has changed.public void prepareResizeComponent(CmtModelNode node, SelectionEffects effects, SelectNib nib)
prepareResizeComponent
in interface LayoutAssistant
node
- the CmtModelNode that is being resized.effects
- the SelectionEffects associated with the UIEditor upon which
the SelectNib appearsnib
- the SelectNib that is being manipulated.public java.lang.String prepareResizeStatus(CmtModelNode node, java.awt.Point location, java.awt.Dimension size)
prepareResizeStatus
in interface LayoutAssistant
node
- the node being resized.location
- new Point relative to parent's upper left corner.size
- the size of the new node.public java.lang.String resizeAction(java.awt.Point location, SelectionEffects effects, SelectNib nib)
resizeAction
in interface LayoutAssistant
location
- new position of the SelectNib being manipulated.effects
- the SelectionEffects associated with the UICanvas upon which
the SelectNib appears.nib
- the SelectNib being manipulated.public void prepareSelectComponent(CmtModelNode node, SelectionEffects effects)
prepareSelectComponent
in interface LayoutAssistant
node
- the selected node.effects
- the SelectionEffects associated with the UICanvas
upon which the selection has taken place.prepareSelectDescendant(oracle.jdeveloper.cmt.CmtModelNode, oracle.jdeveloper.cmt.CmtModelNode, oracle.jdeveloper.uieditor.uicanvas.SelectionEffects)
public void prepareSelectDescendant(CmtModelNode parent, CmtModelNode child, SelectionEffects effects)
prepareSelectDescendant
in interface LayoutAssistant
parent
- the root of the selection pathchild
- the branch of the selection path stemming from parenteffects
- the SelectionEffects associated with the UICanvas
upon which the selection has taken place.protected void raiseChildToView(CmtModelNode parent, CmtModelNode child)
parent
- the parent containing the child.child
- the child to raise.public java.lang.String prepareAddStatus(CmtModelNode node, CmtModelNode toNode, java.awt.Point location, java.awt.Dimension size)
prepareAddStatus
in interface LayoutAssistant
node
- the node about to be added.toNode
- the parent that the node will be added to.location
- new Point relative to parent's upper left corner.size
- the size of the new node.public java.lang.String prepareMouseMoveStatus(CmtModelNode node, CmtModelNode toNode, java.awt.Point location)
prepareMouseMoveStatus
in interface LayoutAssistant
node
- the node that the mouse is over.toNode
- the parent of the node that the mouse is over.location
- Point relative to parent's upper left corner.public java.lang.String constrainMove(CmtModelNode node, CmtModelNode toNode, java.awt.Point mousePos, java.awt.Point mouseOffset, java.awt.Point newPos, java.awt.Dimension newSize)
constrainMove
in interface LayoutAssistant
node
- node being manipulated.toNode
- parent of node being manipulated.mousePos
- current mouse position relative to toNode.mouseOffset
- mouse position relative to node at beginning of move.newPos
- output parameter for receiving constrained drop location.newSize
- output parameter for receiving constrained drop size.public void constrainAdd(CmtModelNode toNode, java.awt.Point mouseOrigin, java.awt.Point mousePos, java.awt.Point newPos, java.awt.Dimension newSize)
constrainAdd
in interface LayoutAssistant
toNode
- parent of node being added.mouseOrigin
- mouse position at start of move operation.mousePos
- current mouse position.newPos
- output parameter for receiving constrained add position.newSize
- output parameter for receiving constrained add size.public void cleanupRemovedComponent(CmtModelNode parent)
cleanupRemovedComponent
in interface LayoutAssistant
parent
- The node that had a child removed.public javax.swing.JComponent getEffects(UICanvas canvas, java.awt.Container host)
getEffects
in interface LayoutAssistant
canvas
- UICanvas displaying the GUIhost
- Container upon which an object is being added, resized or
moved.public boolean usesReverseZOrder()
usesReverseZOrder
in interface LayoutAssistant
public void drawGrid(java.awt.Container host, java.awt.Graphics g)
drawGrid
in interface LayoutAssistant
host
- Container upon which the grid is being drawn.g
- Graphics object to draw the gird.public javax.swing.JComponent[] getContextMenuItems(Context context)
getContextMenuItems
in interface LayoutAssistant
context
- the current context.oracle.ide.ContextMenu
public boolean update(IdeAction action, Context context)
update
in interface LayoutAssistant
action
- action whose availability is to be updated.context
- the current context.public boolean handleEvent(IdeAction action, Context context)
handleEvent
in interface LayoutAssistant
action
- user action to be responded to.context
- context in which action was initiated.protected static final java.util.ArrayList getSelectedSiblings(Context context)
context
- selection to consider.protected static final void removeBoundsSetting(CmtModelNode node)
node
- the CmtModelNode representing the Compnent whose bounds are to
be reset.protected int calcBestZ(CmtModelNode node, CmtModelNode toNode, java.awt.Point location, java.awt.Dimension size, java.awt.Rectangle zBounds)
node
- the node whose stacking position is desired.toNode
- the container in which node is to reside.location
- the location of node.size
- the size of node.zBounds
- protected boolean changeZ(CmtModelNode node, CmtModelNode toNode, int z)
node
- the node to move.toNode
- the container in which node resides.z
- the new position in the stacking order.protected java.lang.Object getKey(java.awt.Component comp)
comp
- the Component for which a sorting key is desired.sortedNodes(oracle.jdeveloper.cmt.CmtModelNode)
protected boolean lessThan(java.lang.Object o1, java.lang.Object o2)
o1
- first object to compare.o2
- second object to compare.sort(java.util.ArrayList, java.util.ArrayList)
protected void sort(java.util.ArrayList array, java.util.ArrayList key)
array
- the collection of objects to sort.key
- the sorting criteria of each object in array.sortedNodes(oracle.jdeveloper.cmt.CmtModelNode)
,
lessThan(java.lang.Object, java.lang.Object)
protected java.util.ArrayList sortedNodes(CmtModelNode parent)
parent
- the parent whose children are to be sorted.getKey(java.awt.Component)
,
sort(java.util.ArrayList, java.util.ArrayList)