Changes between Version 2 and Version 3 of TEXT_MODEL_REDESIGN


Ignore:
Timestamp:
03/22/10 17:38:37 (15 years ago)
Author:
diana
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TEXT_MODEL_REDESIGN

    v2 v3  
    2424 
    2525= Design = 
    26 ^(Describe your design here.)^ 
     26--------TEXT MODEL PART----- 
     27The idea of the new text design is to remove the existing stable poses with unstable indexes. 
     28In order to achieve this functionality the following changes have been made: 
     29 * Rename HotIndexInterval in org.sophie2.base.model.text.smart.position package with HotTextInterval. 
     30 *  From org.sophie2.base.model.text.smart.position remove HotInterval and replace all of its usage 
     31 in Sophie with HotTextInterval. 
     32 * Remove HotPos class. 
     33 * Remove HotPos persister class.  
     34 * In HotTextInterval add a comparator for intervals. 
     35 * In org.sophie2.base.model.text.smart package add new class named TextUnit - this class represents a 
     36 single text unit in sophie text. This class is needed mostly to hold the styled value of every single text 
     37 unit in the whole text. 
     38   * Every text unit holds a char value and HotStyleDef value(only reference to a text style). 
     39   * Add getUnitStyle function in the class to get the unit style. 
     40   * Add getUnitChar function to get the char. 
     41 * In org.sophie2.base.model.text.smart add ImmText interface - the interface of the new sophie text. 
     42  * Hash getStyledHash() - Returns the styled hash of the text. 
     43  * HotTextInterval getLastChangedInterval() - Returns interval from the last change of the text(applying styles or replacing 
     44        text).   
     45  * CharSequence toSequence() - Gets the chars of the text as CharSequence. 
     46  * char getCharAt(int index) - Method for getting the char at a specific text's index. 
     47  * TextUnit getAt(int index) - Method for getting a text unit at a specific index. 
     48  * ImmText replace(HotTextInterval interval, ImmText text) - Method for replacing interval  
     49  of the given text with another text. Replaces form the begin index inclusive to the end index exclusive. 
     50  Applies the styles from the first replaced text to the replacing text. 
     51  * T getStyleValue(HotAttr<T> attr, HotTextInterval interval) - Gets the style value for a given attribute and given interval. 
     52  If not all interval has the same value for the given attribute - the default value is returned. 
     53  * ImmText applyStyle(HotStyleDef style, HotTextInterval interval) - Applies style to the text for a given interval. 
     54  * int getBegin() - Gets the begin of the text.  
     55  * int getEnd() - Gets the end of the text.   
     56 * In ImmHotText class remove all the existing fields and add ImmList<TextUnit> textUnits  and  
     57 HotTextInterval lastChangedInterval(the first one holds the units of the sophie2 text and the second one holds  
     58 the interval that has been most recently changed by some of the functions of the text(applyStyle or replace)). 
     59 * Make the ImmHotText class implement the ImmText interface and implement the functions of the interface. 
     60 * Make HotStyleDef class implement Hashable and intern the HotStyleDef's values(add field with the used styles 
     61 till now and when creating a new HotStyleDef object if the map contains the object take the containing object 
     62 else add the object in the map). 
     63 * In HotStyleDef class add replaceDerive function that concatenates only the non default values from this  
     64 style and the given one and constructs a new HotStyleDef with this values. 
     65 * In HotStyleDef class add getAllAttr function that returns list of all the CommonAttr's values. 
     66 * In CommonAttr add two new values: HotAttr<String> LINK_ATTRIBUTE - represents the link id's for the text and 
     67 HotAttr<ImmList<String>> ATTACHMENT_ATTRIBUTE - represents the text attachments 
     68(without text links(anchors and so on)). 
     69 * In LinkAttachment class add String linkId attribute - this is a random final value that is unique for every 
     70 link in the text and is genetared in the constructor of the class. Add a getter method for the value. 
     71 * In HotTextResourceR4 class add Key<ImmMap<String, LinkAttachment>> KEY_TEXT_LINK_MAP key that 
     72 holds all the the text link attachments' ids to the link attachment itself(this is used in the ligics for adding 
     73 and removing text links). 
     74 * The new logic for adding/removing link is as follows:first applying style to the text with the map consisting 
     75 of LINK_ATTRIBUTE with value equal to the added link id's(the default LINK_ATTRIBUTE's value if removed), 
     76 second we change the map of the current hottextresource to a new one(with one added or removed value). 
     77 * In TextViewFlow add abstract Prop<ImmMap<HotTextInterval, Attachment>> attachmentMap() - Property, holding map 
     78 of intervals to link attachments. it holds all the links that are not none-refs(it is called attachmentMap 
     79 not linkAttachmentMap because it will hold all the link attachments and the other attachments  in the future). 
     80 * In org.sophie2.base.model.text.smart add new utility class ImmTextUtils that has: 
     81  * ImmText empty() - Creates an empty text. 
     82  * int advance(ImmText text, int index, int offset) - navigates in text(if negative offset - navigate backwards 
     83   else advande forwards). 
     84  *  HotTextInterval getNextAttrInterval - Returns interval from the given position to the last position in the given text   
     85before which the value of the given attribute in this position is the same as the value of the attribute in the given position. 
     86  * boolean checkBounds - Checks if the given index is in the bounds of the given text. 
     87  * ImmText subText(HotTextInterval interval, ImmText text) - Creates a new sub text of the given text. 
     88  * ImmText addLinkAttachment - Adds LINK_ATTRIBUTE to the given text with given link id. 
     89  * ImmText removeLinkAttachment - Removes LINK_ATTRIBUTE from the given text.This method only applies style to the given  
     90  interval that has link attribute set to it's default value. Does not check if the interval has consistent link attribute. 
     91  * getStyleValue - Retrieves a specific text attribute's value at a specific position of the given text. 
     92  * TextViewState?????????????????????????????? 
     93--------TEXT LAYOUT PART----- 
     94 
    2795 
    2896= Implementation =