Last modified 10 years ago Last modified on 10/12/09 15:55:25

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

Error: Macro TicketQuery(summary=GROUP_TEMPLATES_R4, 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



Improve templating

Task requirements

  • Modify the templates so the actual template is not modifiable in the book
    • When you create a template from frame1 and create frame2 from this template, modifying frame 1 should not change frame2
    • Ensure overwriting a template is possible
    • Add a dialog that asks "Do you want to overwrite existing template?" that allows overwriting the template that is origin of the frame. The dialog should pop up when the user modifies a frame and clicks add to template button.
  • Optional - Add frame list under the page options when adding to template
    • Only list of frames is enough, all of the frame options should be saved and applied when applying the template
  • Add location for frames (checkbox)
  • Optional - Add timeline options for frames (checkbox)
  • Add content templating - ability to change the content of a frame - and checkbox for content
  • Add drag and drop support for template list items in the tab
    • Dragging a frame template to a page creates a frame from this template
      • Cursor should show that drop is possible (see image drag and drop)
    • Dragging a book template to a page creates an empty embedded book from this template
      • Cursor should show that drop is possible (see image drag and drop)
    • Dragging a book template to the desktop creates a new book from the template
    • Optional - dragging page template over page thumbnail (page preview palette) applies template to the page
      • The page should be highlighted before the drop
    • Optional - dragging page template next to a page thumbnail (page preview palette) adds new page from the template
      • The space should be highlighted before the drop

Task result


Implementation idea

  • When creating a frame template (for example), instead of linking it to the source by setting it as a template, just copy the source - that will become the frame template.
  • Look the AllResourcesPalette to see how to use the Drag and drop module.


How to demo

Create a template, frame from it, then overwrite it.


Creating a template

  • Instead of making a new resource and set the source as its template, just copy the source. That will be the new template. This will insure that modifying the source does not change the template.
  • Since the templates are being represented by their titles and we need overwriting of templates, upon template creating we need to search the existing templates for the given title by the user.
    • If the title exists, copy the source to the ref of the found template, and thus overwriting it. A confirmation dialog should popup.
    • Otherwise, create a random ref for the template.
  • Introduce a Map<ResourceRefR4, String>, maybe in the AddTemplateHaloButton. It will contain the last template created from each resource. When the user clicks the add template button:
    • if there is a record in the map for the resource, that will be the default title of the template
    • if there is no record, some pre-defined default title should be displayed, like "Frame A template", corresponding to the resource kind.

Frame content templating

  • Since ResourceFrame.KEY_MAIN_RESOURCE is a ResourceRef, it may well point to a non-existing location, when a frame template is applied.
  • Create a TemplatedResourceRefKey which extends TemplatedKey. The logic of the get() method should convert the resulting ref, relative to the containing resource. For example"
    	ResourceAccess template =, null);
    	ResourceRefR4 absoluteRef =, null).getRef();
    	return ResourceRefR4.getRelativeRef(access.getRef(), absoluteRef);
  • Change ResourceFrame.KEY_MAIN_RESOURCE from TemplatedKey to TemplatedResourceRefKey.


  • The method ResourceDataProvider#getResourceKind() should be changed to getResourceClass() which returns a class extending ResourceH. Matching by kind is no good, because we need to match all frames, which may well have different kinds.
  • Add FrameResourceDataProvider, PageResourceDataProvider, BookResourceDataProvider extensions.
  • Register the Frame, Page and BookTemplatesPallete for drag operations like this:
    SophieDragDropHandler.registerComponent(list().get(), FrameTemplatesPalette.this, null, null, true, true);
  • The new events in LibraryTabLogic should added for DND_IMPORT and DND_EXPORT



Merged to the trunk at [7507].


(Place the testing results here.)


(Write comments for this or later revisions here.)