Changes between Version 14 and Version 15 of TEXT_VIEW_MODEL


Ignore:
Timestamp:
04/15/10 16:32:27 (15 years ago)
Author:
diana
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TabularUnified TEXT_VIEW_MODEL

    v14 v15  
    6868   
    6969 * replace TextViewFlow with TextViewModel 
     70 -----------------------TEXT_VIEW_MODEL part--------------------------------------- 
     71 * In org.sophie2.base.model.text package add new abstract class TextChange that represents  
     72 the base model of a text change (applying styles ot text, replacing existing text in some interval). 
     73 This class has the following abstract functions: 
     74   * public abstract ImmText applyTo(ImmText sourceText) - This method applies the current text change to a given text and 
     75 returns new text with applied change. 
     76   * public abstract HotTextInterval getSourceDamage(ImmText sourceText) - Returns the damaged region (interval)  
     77 from the source text. 
     78   * public abstract HotTextInterval getTargetDamage(ImmText sourceText) - Returns the damaged region  
     79 (interval) from the target (text after the change is made to the source text) text. 
     80   * public abstract int updateIndex(int index, ImmText sourceText) - Updates the given index. 
     81 Ex: text: ASD the change is deleting the A update(2) will return 1. 
     82 * In org.sophie2.base.model.text add new class TextReplaceChange that extends TextChange. This class 
     83 gives basic implementation of the TextChange's functions for a change representing replacing in the ImmText. 
     84 This class has two private fields: final HotTextInterval interval and final ImmText substitution - the first 
     85 one is holds the interval that will be replaced and the second one holds the text for the substitution. 
     86 The applyTo method simply calls ImmText#replace function. 
     87 * In org.sophie2.base.model.text package add class TextStyleChange that extends TextChange class. 
     88 This class is basic implementation of the functions in TextChange class for changes in text  
     89 that represent applying styles on ImmText. It has two private fields - final HotTextInterval interval and 
     90 final HotStyleDef style. The first one holds the interval that the styles will be applied to and the second one  
     91 holds the styles. The applyTo method calls ImmText#applyStyle function. 
     92 * In CommonAttr class add public static ImmList<HotAttr<?>> getAllAttr() function and remove the same from HotStyleDef 
     93 class. This function gets all the attributes that are defined in the class. 
     94 * In org.sophie2.base.model.text.elements package add new final class : LayoutAttr that holds all the attributes 
     95 that only the processors can apply to the text. 
     96   * In LayoutAttr class add HotAttr<Integer> CARET_ATTR - this attribute represents the caret in the view. 
     97 * In CommonChar class add static final char EMPTY_CHAR - A dummy char inserted at the end of a text to help 
     98 the text navigation.Used only in the layout.  
     99 * In HotTextInterval class add new function: public HotTextInterval unite(HotTextInterval interval) -  
     100 Unites two intervals - gets the largest possible interval from the given one and the current. 
     101 * In ImmTextUtils add new function: public static ImmText concat(ImmText text1, ImmText text2) -  
     102 Concatenates the two given texts. Keeps the styles as the origin texts. 
     103 * Rename TextViewFlow to TextModel and add new functions as follows:  
     104   * public abstract ImmText getRawText() -  The text in the model. This is text without any attributes added for highlights, selection, etc. 
     105   * public abstract ImmText getProcessedText() - The text that the layout use. This text differs from  
     106  the raw text only by some text attributes (added for highlights, selection etc.) 
     107    * remove the caret() and mark() properties and replace them with getCaret, setCaret, getMark and setMark. 
     108 * In org.sophie2.base.model.text.mvc package add new class abstract class BaseTextModel extends TextModel - 
     109Basic implementation of the methods from the TextModel abstract class. This class has function public void  
     110update(TextChange change) that applies the given change to the raw text and to the processed text and   
     111updates the indexes of the caret an the mark of the model. 
     112 * In org.sophie2.base.model.text.mvc package add new class public static class SelectionOptions<T> implements  
     113 TextProcessor.Options - a class representing the options of the selection processor. This class has private final  HotAttr<T> attribute,  
     114 private final T value, private final HotTextInterval selectionInterval. The first one holds the attribute of  
     115 the selection (CommonAttr.BACKGROUND_COLOR), the second one holds it's value (Ex: ImmColor.Blue) and 
     116 the third one holds the selection interval. 
     117 * In org.sophie2.base.model.text.mvc package add new class SelectionProcessor implements TextProcessor<SelectionOptions, 
     118 DefaultTextEffect> - Processes text selection and caret.Its work consists of modifying some of the the color attributes for 
     119 the selected chars, as well as to put a LayoutAttr#CARET_ATTR somewhere.  
     120 * In org.sophie2.base.model.text.mvc.swing package add new class: SwingTextModel extends BaseTextModel -  
     121The swing realization of the {@link TextModel} class. It is used only for testing. 
     122 * In org.sophie2.main.func.text.view package add new class : abstract class TextResourceModel extends  
     123 BaseTextModel - Base implementation of the TextModel that connects the view with the text resource. It has 
     124 one function: public void changeModel(final TextChange change, ResourceAccess access, 
     125 final ImmText text, boolean significant, String description) -  Method for updating the text model with a given TextChange. 
     126 Changes the text resource, related to the view that holds the current TextResourceModel and updates the caret and mark poses  
     127 to stay consistent. 
     128 * Make the class HeadTextModel extend TextResourceModel. 
     129 * In HotTextLogic class rename ON_SET_TEXT to ON_CHANGE_TEXT and call the changeModel when the text needs to  
     130 be changed in the model(replace the AutoAction part). 
     131  * In TextView class : EventIds rename the SET_TEXT to SET_CHANGE and set its event params to: 
     132  TextChange.class, String.class, Boolean.class - the change to be made, the description of the action and 
     133  the significance (if it can be undo/redo). 
    70134  
    71135