일반적으로 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.
최근에 하는 업무가 RCP 로 어플리케이션 개발을 하는 것과 gwt-ext 에서 ui 페이지를 구성하는 작업을 하고 있습니다. 하면서 느끼는 점은 RCP 에서 Action 을 사용하면 이벤트에 대한 재사용이 편한 것과는 달리 gwt-ext 는 정리가 되지 않은 것 같습니다.
최근 viewer 쪽도 gwt-ext 에서 비슷하게 사용할 수 있는 방법을 찾고 일부 적용해보고 있습니다. Action 쪽도 정확하게 컨버팅은 할 수는 없을지라도 비슷하게 만들어 놓으면 RCP 와 gwt-ext 작업을 병행하는데도 편해질 것 같습니다.
그 전에 jface 를 재대로 이해하지 못한다면... 저만의 라이브러리가 되버릴수도....
이 문서는 Rich Client Platform (이하 RCP) 에서 FCKEditor 를 이용하여 HTML 문서를 작성할 수 있는 번들에 대한 소개와 사용법을 설명합니다.
SWT 에서 제공하는 StyledText 위짓의 텍스트를 HTML로 변환하기에는 추가적인 작업이 많이 필요하기 때문에 이클립스의 EPF 프로젝트의 RichText의 소스를 참고하여 FCKEditor 를 간단하게 사용할 수 있도록 구현을 하였습니다. (FCKEditor 의 라이센스는 해당문서를 참조하시기 바랍니다.)