wiki:HOT_TEXT_REDESIGN_R1
Last modified 16 years ago Last modified on 09/01/09 20:15:26

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

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

The goal of this task is to stabilize the internal design of the new text and make a good ordering and division into packages.

Overview

  • Improve the text internals in the following directions (prioritized in accordance with the goal specified above, stated in the order that should be attacked):
    • Priority 1
      • Migrate the text work to the second_resource_refactoring branch
      • Make a good split into packages, create helpers where needed (e.g. indexing, etc.)
      • Test and fix all existing text operations in the Logic
      • Move(pull up) flow functionality from SimpleSwingTextView to the abstract SwingTextView
      • Correct naming of methods and properties in TextViewFlow (there should be only getters and RwProp-s)
      • Highlights - make as readonly, design for overriding
      • Layout functionality
        • Correct getPosPlace, getHitPos, getLineEnd methods
        • Add tests
      • Correct indexing of HotPoses not to rely on a custom DOC_BREAK
      • Correct the usage of LineBreakMeasurer (as stated in its documentation it should not be used for more than one paragraph)
      • Fix OutOfMemory problems
        • Check for extensive caching
        • Check the ammount of memory consumed by each caching
      • Improve usability of the new text
        • Clarify ImmHotText and HotPos interface
        • Create initial documentation with examples of a proper and common usage of the new text
          • Note: Some initial hints about text are needed in the current revision, because more people are working on text. Also, a few bugs were encountered due to improper usage of text which decreases the productivity.
    • Priority 2
      • Integrate text with new resources
      • Make AutoActions for all Operations in the Logic that change the text
      • Text and Text Layout performance
        • Profile to find problems
    • Priority 3
      • Implement Chaining using the existing old functionality
      • Implement Anchoring (as a separate task)
    • Priority 4
      • HotLayout memoization
      • Implement Layout improve() functionality to make the layout smarter for all kinds of criateria for a good layout (in separate tasks)

Task requirements

  • Implement the Priority 1 tasks.

Task result

  • Source code
  • Initial document for proper usage of the new text

Implementation idea

  • Specified in the Overview section against each task

How to demo

  • See the document that should be provided as part of the implementation section.
  • Use org.sophie2.base.model.text.smart.SwingDemoTest for testing of the new text's status.

Design

  • The following are the design considerations behind the Priority 1 tasks specified in the analysis (only the ones that are not self-explained)
    • Make a good split into packages, create helpers where needed (e.g. indexing, etc.)
      • smart - main text functionality (ImmHotText, HotPos and utility)
      • smart.elements - different elements of the text and helpers for them - characters, attributes
      • smart.highlight - highlight and highlight set
      • smart.layout - all layouts and layout helper classes
      • smart.position - helper classes for HotPos
      • smart.style - styling functionality
      • Note: HotPos and ImmHotText have to be in the same package, because they are strongly related and the internal indexing should not be seen by the client code of ImmHotText.
    • Test and fix all existing text operations in the TextFlowLogic
      • Correct and unify the usage of getSelectionEnds
      • Correct layout bugs
    • Layout functionality
      • Correct and simplify getHitPos
        • HotAreaLayout knows the location of each line layout (vertically) and HotLineLayout knows the location of each segment layout (horizontally)
        • Using the input point and the location of the children layouts, find the child layout that contains the point and delegate to it.
      • Fix the bugs in calculation of HotPos in getPosPlace and getLineEnds methods
      • Add tests
        • NavigationTest and HotLayoutTest added: [5727]
        • LineEndsDemoTest and SwingDemoTest can also be used for testing.
    • Correct indexing of HotPoses not to rely on a custom DOC_BREAK
      • Introduce indexes after the last character of the text
      • Remove DOC_BREAK as it becomes useless
    • Correct the usage of LineBreakMeasurer (as stated in its documentation it should not be used for more than one paragraph)
      • Remove LineBreakMeasurer from HotTextLayout.create()
      • In HotAreaLayout.create() create one LineBreakMeasurer for each modelLineText
        • modelLineText (the text between 2 breaks) has the meaning of a paragraph as implied by the LineBreakMeasurer documentation in the JDK
    • Fix OutOfMemory problems
      • Measure the ammount of memory consumed by each caching
      • It is encountered that HotPos caching consumes a lot of memory so it should be optimized
    • Improve usability of the new text
      • Clarify ImmHotText interface
        • Static factory methods
          • empty
          • createEmpty
          • createStyled
        • Modification methods (creating new ImmHotText)
          • applyStyle
          • replace
          • subText
          • addChar
        • Navigation methods (later may be extracted to a separate Navigator class like the old text)
          • getBegin
          • getEnd
          • advance
          • getAt
          • getPosComparator
        • Getters and conversion methods
          • getLength
          • toString
          • toSequence
          • toAci
      • Create initial documentation with examples of a proper and common usage of the new text
        • For the client code (to be done in a next revision)
          • Iteration over character of the text
          • Applying styles
          • Changing the text
        • For the text internal functionality
          • Indexing - important (a few related bugs encountered)
          • Layout functionality

Implementation

  • Implementation committed to second_resource_refactoring branch
  • Issues
    • Documentation is postponed for a later revision.
    • Known bugs (will be fixed in the next revision)
      • There is a bug in the indexing of HotPoses leading to the following problems
        • Navigation - UP and HOME/END do not work correctly (DOWN is OK)
        • getLineEnds do not work correctly
        • The respective tests fail
      • There is an exception after the first Copy/Paste.

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)