wiki:BASE_DND_R1

Version 11 (modified by peko, 16 years ago) (diff)

--

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=BASE_DND_R1, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

This revision of the task will introduce CUT/COPY and PASTE operations for resources in Sophie2.0. It should also provide the implementation for clipboard operations with images(from, to and in Sophie2.0). If there is time left a prototype drag and drop functionality is considered to be implemented.

Task requirements

  • Provide support for CUT/COPY/PASTE of resources.
    • From resource palette to the page work area.
    • From the page work area to the resource palette.
  • Provide support for CUT/COPY/PASTE of images.
    • From an image frame to an image editor outside sophie.
    • From an image editor to sophie:
      • to the resource palette.
      • to the image frame - should change the image.
      • to the page work area - should create a new image frame.

Task result

  • source code.
  • Optional:wiki content with diagrams.

Implementation idea

  • Create implementations of DndData for resources.
    • Either one DndData or multiple for the different types of resources. Depends on the design.
  • Create implementation of SophieTransferable for resources.
    • Again may need only one transferable for resources or several.
  • Note: If implementing clipboard operations for resources turns out to be a difficult thing, consider implementing only Frame clipboard operations.
  • Put the ImageData into the created transferables to support transferring images if needed.
  • Optional: (If not done, SHOULD be put for the next revision!)
    • Supply base classes for drag and drop management.
      • Create a global drag and drop manager that will handle part of the drag and drop operations. The rest should be handled in the corresponding logic.
      • Create DndData implementations for resources.
      • After creating the drag and drop base classes, implement D'n'D for:
        • images
        • plain text
        • resources.
        • Note: This should be rather easy having in mind that we have already implemented the necessary DndDatas and SophieTransferables...
      • Provide a diagram of the D'n'd manager.
      • Create a wiki page named BASE_DND, to serve as a reference for all drag and drop and cut/copy/paste functionality. It should have all the design of the base library, as well as the already implemented functionality. For example explaining the use cases that are implemented.
    • Create a DndManager class. It should be able to provide the interaction between VisualElements.
    • Create the diagram using netbeans and put it in the newly created page. Put also the wiki content of the previous revision of this task.

How to demo

  • Use case 1:
    • Start sophie.
    • Drag and drop or cut/copy and paste an image frame from sophie2 to an image redactor. (for example gimp).
      • The image from the image frame should appear in the redactor.
    • Drag and drop or cut/copy and paste another image from the image redactor to sophie.
      • This should create a frame with an image content if dropped on the page.
      • This should change the current image of the image content if dropped on an image frame.
  • Use case 2:
    • Start sophie.
      • Create some frames.
      • Drag and drop or cut/copy and paste a frame resource from the resource palette to the page work area.
        • The corresponding frame should appear as a copy of the selected one.

Design

  • Drag and Drop will not be implemented on this revision because it is time consuming.
  • CUT/COPY and PASTE of resources to the OS cannot be implemented. It appears that clipboard operations are limited for Java. For drag and drop operations however it will be possible and SHOULD be implemented.
  • The data flavors for resources will be with DataFlavor.javaSerializedObjectMimeType mime type. An image resource data will have a flavor:
    new DataFlavor(DataFlavor.javaSerializedObjectMimeType + "; class=" + ImageResource.class.getName()); 
    
  • The DndData implementations for resources are going to be as follows:
    • ResourceData - a base dnd data for resources.
    • HotTextResourceData - an implementation of the ResourceData for HotTextBookResources.
    • ImageResourceData - an implementation of the ResourceData for ImageResources.
    • ResourcesListData - an implementation of the ResourceData for list of resources.
    • Note: for current revision this would be enough for transferring resource between the resources palette and the work area.
    • For every dnd data described above a SophieTransferable implementation will be created. It will manage the resource and some other dnd data as well. For example the ImageTransferable will transfer ImageResourceData, ImageData and StringData (see BASE_DND_R0). This will export the image resouce, the image itself and the location of the resource as a string.
      • ImageTransferable - transfers image resources, images and the location of the resource.
      • HotTextTransferable - transfers hot text resources, hot text itself and plain text (using StringData) that represents the plain text representation of the hot text.

Implementation

Testing

(Place the testing results here.)

Comments

  • On paste it is significant what is currently selected - for example, if you paste frame A in a book, but frame B is currently selected, frame A replaces frame B (in page work area, replacement is not a good idea for the resources palette since it is hard to select nothing there. This should be applied to all elements and behavior should be stated.
  • During this revision copy/paste will be done by keyboard shortcuts, add this in the task overview
  • "Duplicate" may be convinient and should be discussed, however, there's no need to add it to this task