Last modified 15 years ago
Last modified on 11/12/09 17:56:48
Analysis
Overview
Implementing a working Drag'n'Drop action for all the actions described in the requirement section:
- Dragging a resource to an empty space of the page work area
- Image Resource
- Text Resource
- Audio Resource
- Video Resource
- Pdf Resource
- Book Resource
- Other
- Frames
- From one book to another
- Pages
- Page Resource from Resource Palette
- Page Template
- Styled Text
Task requirements
- Dragging a page resource from the resources palette to the page should do nothing
- Dragging image resource to an empty space of the page work area should create a frame and link the resource in it
- If an image resource is dropped over the padding space of an existing frame, it should replace it's background
- If other resource is dropped over the padding space of an existing frame, nothing should happen
- Dragging text resource to an empty space of the page work area should create a frame and link the resource in it
- Dragging a book resource to an empty space of the page work area should create a frame and link the book in it
- Dragging an audio resource to an empty space of the page work area should create a frame and link the audio in it
- Dragging a video resource to an empty space of the page work area should create a frame and link the video in it
- Draggging a pdf resource to an empty space of the page work area should create a frame and link the PDF in it
- Dragging any resource to an empty space of the page work area or resources palette of another book should copy the resource to the target book. The resource should have the same name as it was in the previous boook.
- Drag'n'drop of styled text
To be discussed with analysysts and implementators:
- Dragging a frame (using titlebar) to another book should copy the frame (including contents) to the other book
Optional functionalities that can be achieved for this or left for the next revision are:
- Pressing CTRL before the drop forces copy instead of link
- Pressing Alt before the drop forces link instead of copy
- Reordering pages in page preview palette
- User should be able to embed a book by dragging book from open books palette to the current book.
- The embedded book should be linked
- When an inappropriate action is executed (e.g. trying to embed a book in itself) an adequate warning message for the forbidden action must be evoked.
- If one of the resources (text, audio, video, pdf, book) is dropped over the content of an existing frame, it should replace it's content
- Dragging a page (pages) from the page preview palette to the page preview palette should put the selected page(s) to the desired position
- If the selection is not by neighbour pages, they should become neighbour and should be put where dropped
- A highlight between pages should appear before dropping of the dragged page(s)
- Dragging a page template from the library tab over an existing page in the page preview palette should apply the template to the page it was dropped on
- The target page should be highlighted before the drop
- Dragging a page from the resources palette to the page preview palette between pages puts the page in the page sequence (links it)
- A highlight between pages should appear before the drop
- Dragging a page from the resources palette to the page preview palette over an existing page replaces the targed page with the dropped one (linked)
- A highlight between pages should appear before the drop
- Dragging a page template from the library tab before/after an existing page in the page preview palette should create a new page from the selected template and put it where it was dropped
- A highlight between pages should appear before the drop
Task result
- Task result should be code
Implementation idea
- See the related links
- Create Logic that handles import of different resources and remove all similar logics (ImageLogic, PdfLogic) that handle imports of resources.
- Improve drag'n'drop of ResourceReviosionData for drag'n'drop of resources between different books to be done.
Related
- http://sophie2.org/trac/wiki/InteractionAndGraphicsDesign/DragNDrop
- http://sophie2.org/trac/wiki/GlobalSpecification/DragNDrop
- BASE_DND_R2
- BASE_DND_R1
- BASE_DND_R0
How to demo
- Run Sophie2
- Create a new book and add frames with different resources in it
- Execute all the actions from the overview and see if they achieve the expected results
Design
- Create constant ON_DROP_RESOURCE in ResourceImportLogic. It will handle events with ID SophieDragDropHandler.TransferEventIds.DND_IMPORT and will fire new event with ID SophieDragDropHandler.TransferEventIds.DND_IMPORT. ON_DROP_RESOURCE the import role of the resource will be defined depending on the resource kind of the resource transferred.
- ResourceRefData is used when we want to link a resource. When we want to copy the resource in another book and create a frame with it, ResourceRevisionData should be used.
- Create class MediaResourceDataProvider with ResourceRefData, ResourceRevisionData.
- In HotTextDataProvider, PdfResourceDataProvider, ImageResourceDataProvider add another DndData - ResourceRevisionData.
- Override exportToBinData method from ResourceRevisionData - use the MasterPersister to persist ResourceRevision to OutputStream. Schema used - OutputStreamPackagePersister.OUTPUT_STREAM_PERSISTER_SCHEMA.
- In createDndData in ResourceRevisionDndProvider override getResourceRevision using the MasterPersister with OutputStreamPackagePersister.OUTPUT_STREAM_PERSISTER_SCHEMA.
- Dragging a page resource from the resources palette to the page should do nothing - Now there is no page resources in resources palette, so this is not possible to drag out such a resource.
- Dragging image resource to an empty space of the page work area should create a frame and link the resource in it - using ResourceRefData.
- If an image resource is dropped over the padding space of an existing frame, it should replace it's background - using ResourceRefData, ResourceRevisionData or ImagaData. A logic is created to handle this - FrameViewLogic with 1 constant for now.
- If other resource is dropped over the padding space of an existing frame, nothing should happen. - every time the transferable should transfer at least ImageData.
- Dragging text resource to an empty space of the page work area should create a frame and link the resource in it - using ResiourceRefData.
- Dragging a book resource to an empty space of the page work area should create a frame and link the book in it - it will be done next revision.
- Dragging an audio resource to an empty space of the page work area should create a frame and link the audio in it - using ResourceRefData.
- Dragging a video resource to an empty space of the page work area should create a frame and link the video in it - using ResourceRefData.
- Draggging a pdf resource to an empty space of the page work area should create a frame and link the PDF in it - using ResourceRefData.
- Dragging any resource to an empty space of the page work area or resources palette of another book should copy the resource to the target book. The resource should have the same name as it was in the previous boook. - using ResourceRevisionData.
- Drag'n'drop of styled text - this requirement is fulfilled only when text resource is transferred with styled text.
Implementation
Merged to the trunk at [8046].
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)