| java.lang.Object org.netbeans.modules.visualweb.designer.SelectionManager
SelectionManager | public class SelectionManager (Code) | | This class is the central point for handling selections, mouse interactions,
keyboard interactions, etc., with the page editor / the WYSIWYG designer.
It for example listens to mouse events and decides whether this translates
into a change in selected components, or a drag of a component, etc.
This class manages selections in the page designer.
author: Tor Norbye |
Method Summary | |
public void | addSelected(Element componentRootElement, boolean update) Add the given view/component to the selection.
Parameters: update - If true, update property sheets etc. | public void | clearSelection(boolean update) Clear out the selection - after this has run,
no components are selected
Parameters: update - If true, update property sheets etc. | public void | clearSelectionImmediate() XXX Altered copy of clear selection, to immediatelly update the nodes.
FIXME Get rid of the delayed node updates. | public void | enlarge(Rectangle r) Increase the size of the given rectangle to accomodate
the selection handles. | public boolean | focusDefaultProperty(ActionEvent event) Focus the default property. | public int | getNumSelected() Report the number of selected items. | Element | getPositionElement() Returned the first positioned element in the selection. | public Element | getPrimary() Return the primary selection, if any. | public CssBox | getSelectedAncestor(CssBox box) Check to see if any ancestors of the given view (or the view
itself) is in the selection set, and if so, return it. | public Element[] | getSelectedComponentRootElements() | public Element | getSelectedContainer() Return the first container component found in the selection. | public int | getSelectionHandleDir(int x, int y, int maxWidth, int maxHeight) Determine if the given point overlaps a selection handle. | public Element | getSelectionHandleView(int x, int y, int maxWidth, int maxHeight) Similar to getSelectionHandleDir, but returns the selected
object whose selection handles are pointed at, rather than the
selection handle direction. | public boolean | isBelowSelected(CssBox box) Return true iff the given view is in the set of selected views
or is a child of a selected view.
Parameters: box - The box to check. | public boolean | isNodeUpdatePending() | public boolean | isSelected(Element componentRootElement) Return true iff the given view is in the set of selected views.
Parameters: component - The view to check. | public boolean | isSelectionEmpty() | public void | notifyScrolled() | void | paintInlineEditorBox(Graphics2D g2d, Rectangle rect) Draw selection for the given view. | public void | paintSelHierarchy(Graphics2D g2d) | public void | paintSelection(Graphics2D g2d) | public void | pickPrimary() XXX Bad architecture. | public void | removeSelected(Element componentRootElement, boolean update) Remove the given view/component from the selection.
Parameters: update - If true, update property sheets etc. | public void | selectAll() Select all components on the designer surface (except components
that are children of other components, and except components that
are "special", such as Form/Body/Head/Html, etc. | void | selectAncestor(int targetx, int targety) | void | selectBean(Element componentRootElement) | void | selectComponent(Element componentRootElement) | public void | selectComponentRectangle(Rectangle bounds, boolean contained) Select all views that intersect the given bound rectangle.
Parameters: pane - Pane to look for selection in Parameters: bounds - Bounds to scan within Parameters: exclusive - If true, only include components that are fullycontained within the bounds. | public void | selectComponents(Element[] componentRootElements, boolean update) | public void | setPrimary(Element primary) | public void | setSelected(Element componentRootElement, boolean update) Set the selection to the given component. | public void | syncSelection(boolean update) Synchronize the selection with the model. | public void | updateNodes() Set the activated nodes for the top component bound to this selection
manager to match the current component. | public void | updateNodesImmediate() | public void | updateSelectionImmediate() |
PAINT_SELECTION_HIERARCHY | final static boolean PAINT_SELECTION_HIERARCHY(Code) | | |
selectionViewPos | int selectionViewPos(Code) | | |
addSelected | public void addSelected(Element componentRootElement, boolean update)(Code) | | Add the given view/component to the selection.
Parameters: update - If true, update property sheets etc. to reflectthe new selection. |
clearSelection | public void clearSelection(boolean update)(Code) | | Clear out the selection - after this has run,
no components are selected
Parameters: update - If true, update property sheets etc. to reflectthe new selection. |
clearSelectionImmediate | public void clearSelectionImmediate()(Code) | | XXX Altered copy of clear selection, to immediatelly update the nodes.
FIXME Get rid of the delayed node updates.
|
enlarge | public void enlarge(Rectangle r)(Code) | | Increase the size of the given rectangle to accomodate
the selection handles. Typically used when computing dirty/repaint
rectangles
|
focusDefaultProperty | public boolean focusDefaultProperty(ActionEvent event)(Code) | | Focus the default property. Return false if no default property was
found, or if the property is read only, if no component is selected,
etc.
|
getNumSelected | public int getNumSelected()(Code) | | Report the number of selected items.
the number of selected items in the designer |
getPositionElement | Element getPositionElement()(Code) | | Returned the first positioned element in the selection. Gets the component root element (rendered element).
|
getPrimary | public Element getPrimary()(Code) | | Return the primary selection, if any. The primary is the most recently
"touched" DesignBean in the selection. For example, if you swipe select
a set of 10 components and then right click on one of them, all are selected
but the clicked-on component is primary. Similarly, if you shift-click toggle
components in the selection, the most recently clicked component is primary.
This component is highlighted using a different color than the rest.
|
getSelectedAncestor | public CssBox getSelectedAncestor(CssBox box)(Code) | | Check to see if any ancestors of the given view (or the view
itself) is in the selection set, and if so, return it. This will
return the closest (e.g. furthest down the element tree) match.
Parameters: box - The box to check. May not be null. The selected view or ancestor of the box |
getSelectedComponentRootElements | public Element[] getSelectedComponentRootElements()(Code) | | |
getSelectedContainer | public Element getSelectedContainer()(Code) | | Return the first container component found in the selection.
If no direct selected component is a container, return the first
container ancestor for the first selected item.
|
getSelectionHandleDir | public int getSelectionHandleDir(int x, int y, int maxWidth, int maxHeight)(Code) | | Determine if the given point overlaps a selection handle.
Parameters: editor - The editor whose selection we're checking Parameters: x - The x coordinate of the position we want to check Parameters: y - The y coordinate of the position we want to check Cursor.DEFAULT_CURSOR if the given point (x,y) is notover any of the selection handles drawn for the current selection.If it is, return the right edge direction for the overlap.If there are multiple overlapping selection handles, it's arbitrarywhich one is chosen. See Also: overSelection |
getSelectionHandleView | public Element getSelectionHandleView(int x, int y, int maxWidth, int maxHeight)(Code) | | Similar to getSelectionHandleDir, but returns the selected
object whose selection handles are pointed at, rather than the
selection handle direction.
|
isBelowSelected | public boolean isBelowSelected(CssBox box)(Code) | | Return true iff the given view is in the set of selected views
or is a child of a selected view.
Parameters: box - The box to check. May not be null. true iff the box or one of its ancestors is currently selected. |
isNodeUpdatePending | public boolean isNodeUpdatePending()(Code) | | Return true iff there is a pending node update scheduled
|
isSelected | public boolean isSelected(Element componentRootElement)(Code) | | Return true iff the given view is in the set of selected views.
Parameters: component - The view to check. May not be null. true iff the component is currently selected. |
isSelectionEmpty | public boolean isSelectionEmpty()(Code) | | Return true iff no components are selected
|
notifyScrolled | public void notifyScrolled()(Code) | | |
paintInlineEditorBox | void paintInlineEditorBox(Graphics2D g2d, Rectangle rect)(Code) | | Draw selection for the given view.
Parameters: g - The graphics to draw with Parameters: insertMode - If true, draw a thick insert-mode rectanglearound the selection Parameters: rect - The selection rectangle Parameters: constraints - Which sides are resizable |
paintSelection | public void paintSelection(Graphics2D g2d)(Code) | | Draw selection rectangles around the currently selected views
|
pickPrimary | public void pickPrimary()(Code) | | XXX Bad architecture.
TODO Get rid of this, and update the primary as selection changes.
Ask the selection manager to pick a primary selection object, if it has
one or more selection objects but none designated as primary.
If one is already primary, it is kept as the primary.
|
removeSelected | public void removeSelected(Element componentRootElement, boolean update)(Code) | | Remove the given view/component from the selection.
Parameters: update - If true, update property sheets etc. to reflectthe new selection. |
selectAll | public void selectAll()(Code) | | Select all components on the designer surface (except components
that are children of other components, and except components that
are "special", such as Form/Body/Head/Html, etc.
|
selectAncestor | void selectAncestor(int targetx, int targety)(Code) | | |
selectComponent | void selectComponent(Element componentRootElement)(Code) | | |
selectComponentRectangle | public void selectComponentRectangle(Rectangle bounds, boolean contained)(Code) | | Select all views that intersect the given bound rectangle.
Parameters: pane - Pane to look for selection in Parameters: bounds - Bounds to scan within Parameters: exclusive - If true, only include components that are fullycontained within the bounds. If false, include anycomponent that touches the bounds. |
selectComponents | public void selectComponents(Element[] componentRootElements, boolean update)(Code) | | Make a particular element selected
|
setPrimary | public void setPrimary(Element primary)(Code) | | Choose a bean as the primary selection bean
|
setSelected | public void setSelected(Element componentRootElement, boolean update)(Code) | | Set the selection to the given component.
Attempt to preserve the current component as a leaf, provided
the new component to be selected is an ancestor of the current leaf.
|
syncSelection | public void syncSelection(boolean update)(Code) | | Synchronize the selection with the model. This should be called
when DesignBeans may have changed underneath us, for example because
the user modified the backing file, and it's reparsed by insync.
At this point the DesignBeans we're pointing to in our selection set
may be stale, so for each selected bean check if it's still live
and if not, find its new representative if any.
Parameters: update - If true, update property sheets etc. to reflectthe new selection. |
updateNodes | public void updateNodes()(Code) | | Set the activated nodes for the top component bound to this selection
manager to match the current component.
If there is a component (or multiple components) selected,
the nodes will reflect these components, otherwise a document node
is chosen.
|
updateNodesImmediate | public void updateNodesImmediate()(Code) | | Same as
updateNodes but this request is processed immediately/synchronously
|
updateSelectionImmediate | public void updateSelectionImmediate()(Code) | | |
|
|