wiki:TEXT_CHAINING_BEHAVIOUR_R1
Last modified 16 years ago Last modified on 09/24/09 14:19:24

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

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

  • Text frames should allow chaining between them. That means that when text overflows from one text frame it goes to another if they are linked. Also there should be overflow indicator.
  • There should be opportunity for the user to have multiple flows from different text frames.
  • The user should be able to point which text frame is linked with current flow and which is not.
  • There should be automatic linking when flow text frame is used. See more at TEXT_AUTO_CHAIN_BEHAVIOUR_R1
  • If there are many linked flow text frames user should have the opportunity to easily reorder/delete/unchain them.

Task requirements

  • Implement chaining prototype
    • Allow linking frames. One frame should allow the other frames to link to it.
    • When the place is insufficient for the text content in a text frame of the chain the rest of the content should be put in the next chained frame.
    • If all of the chained frames cannot display the content, the content gets floating and invisible.
  • Implement GUI for chained frames
    • Linking will be done through a combo box, that lists all available text frames (from all pages but the frames from the current page are first in the list) for chaining and auto chain option.
    • The combo box will be in the HUD that appears when the indicating halo is clicked.
    • Also label indicating which is the previous frame if the frame is not the first one from the chain, should be in the HUD.
    • (optional) Frame connections should be visible by clicking a menu item or a checkbox in the book bottom panel.
  • Implement editing of non-first chained frame
  • Create appropriate halos
    • The halo buttons for chaining and unchaining should be the same, but the unchaining halo should be crossed
    • The unchain halo should present when the frame is part of a chain:
      • If the text frame is a the first one in the chain it has one unchain halo at bottom right.
      • If the text frame is a middle one it has two unchain halos: at bottom right and top left.
      • If the text frame is the last one it has one unchain halo at top left but it also have chain halo at bottom right.
      • In this way selecting a frame a user can know if the frame is first, middle or last one.
  • Implement unchaining of frames
    • User should be able to unchain chained frames by clicking a halo button. This halo buttons should have crossed arrow icon.
    • Unchaining frame separates the frame from the chain but doesn't destruct it.
      • If the unlinked text frame is the first one in the chain, then all the text in the chain is saved in this frame. The links between the other text frames in the chain are saved as if there are not modified pages, having only empty text frames, these pages are deleted without loosing the links in the chain.
      • If the unlinked text frame is a middle one in the chain, then the text frame is divided from the chain as the text frame before it is linked to the text frame after it and the links between the other text frames in the chain and the text are preserved. Notice that every middle text frame of a chain has two unchain halos. There is no matter what halo is used for unchaining.
      • If the text frame is the last one then it is divided from the chain without destroying the chain before it and the text in the chain is saved.
  • Deleting a text frame which is part of linked text frames deletes the frame and:
    • If the frame is the first one in the chain, then the frame and all the text in the chain is deleted but the text is saved in Resources. The links between the others are saved as if there are not modified pages, having only empty text frames, these pages are deleted without loosing the links in the chain. If all the pages are not modified and they have only empty frames the first page is not deleted.
    • If the frame is a middle frame in the chain, then in case of no destructing the links between the frames before and after the deleted frame link them, save the links between the other frames in the new created chain and save the text.
    • If the frame is the last one then the frame is deleted without destroying the chain before it and the text in the chain is saved.
  • Deleting a page that contains linked text frames with other pages' frames should act in the same way as deleting a frame but including all the linked frames in the page.

Task result

The result is source code.

Implementation idea

  • When the text overflows use the arrow at the bottom to chain the text frame to another one and the overflowed text will appear in the new chained text frame. The arrow should appear only when the frame is selected and there are no other frames linked with the first one. If the frame is linked to other frame the unchain halo is available instead of chain halo at bottom right. If other frame is linked to the current one unchain halo is available at top left.
  • Linking and unlinking should be done by halo buttons:


TEXT_CHAINING_BEHAVIOUR_R0
GROUP_CHAINING_AND_HALOS_R0
TEXT_AUTO_CHAIN_BEHAVIOUR_R1

How to demo

  1. Chain four text frames on a page.
  2. Show the halos - first frame should have an unchain halo at bottom right, second and third frames should have two unchain halos at top left and bottom right and the last frame should have unchain halo at top left and chain halo at bottom right.
  3. Unchain the third frame.
  4. Show that the other frames remain chained.
  5. Delete the second frame.
  6. Show that after the frame is deleted the other two frames remain chained.

Design

The new resource design has already taken in mind text chaining by having two kinds of text frames - head and tail. Here's a more detailed description of the idea and the classes that will be created/modified.

  • HeadTextFrameR4 extends FrameR4 implements ResourceFrame
    • It contains the text of the chain as its main resource (in ResourceFrame.KEY_MAIN_RESOURCE) and the mode of the chaining (auto/manual/none) (in KEY_CHAIN_MODE).
  • TailTextFrameR4 extends FrameR4
    • It contains a reference to the head of the frame (KEY_CHAIN_HEAD) and a String key used to determine the chain order (KEY_CHAIN_ORDER).
  • There is a corresponding hierarchy of helpers that have methods for getting these keys.

When a user inserts a text frame, a HeadTextFrame is inserted with a default chaining mode of None. When a user clicks the chain halo button, a HUD appears that allows the user to select a frame to be chained or to turn on auto chaining. A frame that is chained is changed to TailTextFrame and its keys for chain head and order are set. The view is responsible for taking information about chaining from the model and redirecting the areas for text displaying to the text layout.

The existing text chain halo button and HUD will be used as a GUI for the chaining. They will be improved by adding a label for the previous/next frame chained. Options for auto-chaining and no chaining will be added as part of TEXT_AUTO_CHAIN_BEHAVIOUR_R1. They are just part of the overall design for chaining in this task.

TextChainingLogic class will be rewritten to provide the expected behaviour for chaining/unchaining frames. It should also be responsible for taking the appropriate action when a chained frame is deleted (this should be done in an operation with a sort key lower than that of the remove frame operation). The same is true for deleting a page that contains head text frames.

The hierarchy of the views follows the hierarchy of the resources and helpers. Each text view holds a TextViewFlow that is used by the layout to display the text. For the layout to display the text correspondingly it is enough to track the chained frames in the getAreas method.

Some things from that was not clearly described in the analysis is uchaining. Logic for it will be written in the following manner:

Clicking either of the unchain button a frame can have breaks the chain at that place. Text is preserved in the first part of the chain, while the second part remains chained but empty.

Some things from the overview of the analysis are for next revisions: overflow indicator, outlining, and reordering of chained frames.

An initial version of the system test for the chaining can be found here: TextChainingSystemTest.java. It is committed at revision: [6556], merged from trunk at revision: [6620].

Note: Currently trying to chain some frames breaks the application. This will be fixed in the implementation phase.

Implementation

Implemented according to the design, with the following notes:

  • Setting chaining mode keys is not implemented. This will be left for the auto-chaining task.
  • Choosing chaining mode from the HUD is not implemented. This will be left for the auto-chaining task.
  • Labels are not added in the HUD for the previous/next frames in the chain. This will be left for the auto-chaining task.
  • Unchaining a given frame breaks the chain at the specified position. The previous and the next frames are not linked.
  • When a head frame is deleted, it is first unchained. No pages are deleted, even if they remain empty.

Known issues:

  • Linking two existing chains is not possible.
  • Deleting a page that containes a chained text frame crashes the application. You have to delete all chained frames first.

Changesets: [6556], [6605], [6620], [6629], [6630], [6631], [6660], [6666], [6668], [6675]

Merged into the trunk [6700].

Testing

Place the testing results here.

Comments

Write comments for this or later revisions here.

Attachments