일반적으로 GEF 에서 EditPart 에 EditPolicy.LAYOUT_ROLE 로 editpolicy 를 install 하게 됩니다.
이렇게 처리할 경우 생성이나 이동, 리사이징에는 별 무리 없이 사용할 수 있을 것이라 생각하였으나 한가지 문제가 있었습니다. 다른 자식 피규어와 겹칠경우 정상적으로 이동이 되지 않는 것이었습니다. LAYOUT_ROLE 로는 다른 자식 피규어 위에서 이동하는 것에 대한 이벤트를 잡지 않는 것으로 파악이 되었습니다. 그래서 조금 찾아보니 될 것만 같은 것이 있어서 한번 수정한 후 실행을 해보았습니다.
그냥 한번 해보았을 뿐인데... 원하는 결과가 나와버렸습니다. 그래서 구글에서 좀 찾아보니 아래와 같은 자료가 있었습니다.
Because of the relationship between handles and layouts, it is recommended that thePRIMARY_DRAG_ROLEeditpolicy be installed by the parent'sLayoutEditPolicy, which defines abstract methods for this purpose. If a container changes layout managers during editing, typically the layout policy gets swapped with one for the new layout manager. The new policy then replaces the stalePRIMARY_DRAG_ROLEpolicies on each child.
무신 말씀을 하시는지는 정확하게 파악을 하지 못하였으나 잘 돌아가주시니 감사할 따름입니다.
The DragEditPartsTracker extends basic selection behavior to allow the selected parts to be dragged within their graphical viewer. Dragging the selected parts can result in three potential interactions: move, reparent, and clone. All three use theChangeBoundsRequest, which extends GroupRequest to include a size delta, move delta, and mouse location.
While dragging the selection, if the tracker targets the part's original parent, the request is typed asREQ_MOVE. If the target changes, the interaction becomes a reparent. For a reparent, a request of typeREQ_ORPHANis sent to the old parent, while the new target is sent a request of typeREQ_ADD. When the CTRL key is pressed (ALT on the Mac), the operation is always aREQ_CLONE, which is only sent to the target part.
All of these requests are related in that they require the target to process a rectangle and a mouse location. The LayoutEditPolicy is responsible for handling each of these request types. For layouts which use constraints, each part's original bounds is taken and modified by the size and move deltas to determine a new bounds, for which a corresponding constraint is found. For index-based layouts, the mouse location is used to establish the new index.
AContainerEditPolicycan optionally be used to contribute additional commands (not related to the layout) during ADD, ORPHAN, and CLONE requests.
Resizing
Resizing falls under the same category as changing bounds. Note that when resizing either the top or left sides, the location of the part is also changed. Resizing only makes sense for layouts with constraints, such as XYLayout. TheResizableEditPolicyadds up to eight resize handles to its host. When the Selection Tool is clicked on one of these resize handles, aResizeTrackerperforms a resize on the selected parts understanding "resize". SHIFT and CTRL key modifiers can be used to constrain the resize operation.
The types of handles available on an editpart depend on the layout manager in which its figure is placed. For example, parts inside a table might have handles for adjusting insets, padding, column span, or other attributes. Some layouts don't need any handles, but four corner handles should be added just to indicate selection. Dragging these handles would be the same as dragging the part itself.
Because of the relationship between handles and layouts, it is recommended that thePRIMARY_DRAG_ROLEeditpolicy be installed by the parent'sLayoutEditPolicy, which defines abstract methods for this purpose. If a container changes layout managers during editing, typically the layout policy gets swapped with one for the new layout manager. The new policy then replaces the stalePRIMARY_DRAG_ROLEpolicies on each child.
TheMatchSizeActionmatches the size of the selected parts to that of the primary selected part's size. This action is implemented in a way similar to manually resizing the individual parts, and it uses the same request and type.
TheAlignmentActionuses anAlignmentRequest, which extends ChangeBoundsRequest. When using a ChangeBoundsRequest, the part's current placement in the Control (in absolute coordinates) is passed to the request, which then returns a modified version. Using this pattern, alignment is able to adjust each part's rectangle by different amounts. In most cases, alignment can be treated no differently than a move. This action aligns all selected parts with one of the edges of the primary selected part.
회사 프로젝트 때문에 지난 8월 처음 접한 GEF 로 열심히(?) 만든 양식마법사 입니다.
슬슬 구성도를 그려야 할 것 같아서 조금 끄적여 보았습니다.
인수인계도 해야하는데 워낙 아름답게 짜놔서 보고서 욕이나 안했으면 좋겠네요 ㅋㅋㅋ
나중에는 각 티어별로 흐름도를 이쁘게 그려 볼랍니다~