Hi

2013/5/21 [email protected] <[email protected]>

> Why not TxBaseEditDecorator ?
>

For me null (or non) prefix better fit general idea about edit decorators.
Edit decorators executes specific actions on text to perform basic edit
operations. TxNullEditDecorator is doing nothing except basic edit
operations.
Also before I introduce edit decorator object TxEditor performs edit
operations by itself. So TxNullEditDecorator works as null pattern here.


>
>
> On Tue, May 21, 2013 at 9:23 AM, stephane ducasse <
> [email protected]> wrote:
>
>>
>> I named it "none" edit decorator because It actually not performs any
>> decoration around basic editing operations. TxNoneEditDecorator just
>> performs it.
>>
>>
>> Yes this is what TxNullEditDecorator would convey. I do not see why
>> TxNoneEditDecorator would mean that and not the TxNullEditDecorator.
>>
>>  Concrete edit decorator can execute specific action on text to perform
>> requested edit operation. There are three edit operations:
>> #insertCharacters:at:, #removeNextCharacterAt:,
>> #removePreviousCharacterAt:. They take aTextSelection as "at" argument.
>> For example TxInsertModeEditDecorator extends text selection before
>> characters insertion:
>>
>> TxInsertModeEditDecorato>>insertCharacters: aString at: aTextSelection
>>     aTextSelection isEmpty ifTrue: [aTextSelection end moveRight: aString
>> size]
>>     aTextSelection replaceWith: aString
>>
>>
>> Yes my point is still valid.
>> the NullDecorator does not decorate.
>>
>>
>>
>>> > TxMaskedEditDecorator- input masked values like phone numbers
>>> > TxInsertModeEditDecorator - input with "insert mode" where any new
>>> character
>>> > replace next one.
>>> insert mode is actually opposite - inserts when you type.
>>> replace mode is replaces when you type.
>>>
>>
>> I choose this name because on Windows you have "insert key" to activate
>> such mode in many text editors.
>>
>>
>> I think that igor suggestion is better. because replace is replace :) and
>> insert is insert.
>>
>>
>>
>>
>>
>>
>>>
>>> > TxSmartCharsEditDecorator- input smart characters like ()[]{}
>>> > TxSingleLineEditDecorator - general way to decorate editing with simple
>>> > decoration format. TxSmartNumbersDecorationFormat is example. It
>>> transform
>>> > text with number format like: '10 000 000' or '10'000'000'.
>>> >
>>> btw, can you wrap decorators on top of each other i.e.
>>>
>>> Masked-SimgleLine
>>> so i could have a single-line editor for entering only a phone number?
>>>
>>
>> Now with mask decorator you have single line text field. Multilined mask
>> is not supported (I dont try it actually). When you insert miltiline text
>> to masked field only first line will be used. I make such restriction to
>> simplify implementation. Actually I never see multilined masked field.
>>
>> Decorators can not be wrapped in general way. Maybe some of it. But there
>> is no cases in current decorators.
>> Main reason: most of decorators change cursor position with very specific
>> way. And wrapping decorators will lead to unpredictable and useless results.
>>
>> Your example Masked-SingleLine (if mask can be multilined) is not about
>> wrapping decorators. It is about input "filtering" . It is my next task. I
>> want put at text morph specification of correct input. So you can forbid
>> "cr" characters, can allow only numbers and etc.
>> And at same time decorators can restrict input by its implementation
>> requirements which happens with masked decorator. But edit decorators and
>> "filters" are different concepts (I not choose name for "filters" yet).
>>
>> TxSingleLineEditDecorator implements general way to edit single line text
>> with simple decoration format. Maybe it should be renamed.
>> TxSingleLineEditDecorator transforms full text by decoration format after
>> any edit operation. And it saves logical cursor position after
>> transformation. Look at methods of TxSmartNumbersDecorationFormat as
>> example.
>>
>> I will be happy if you introduce more clever names. Good names is
>> difficult task for single brain. Especially if you are not native english
>> speaker.
>> But many of you already suggest different names. How we can agree on any
>> one?
>>
>> Best regards,
>> Denis
>>
>>
>>> also, going ahead.. how easy/hard would be to implement a password input
>>> field,
>>> when model contains what user types, but display all *** chars?
>>>
>>> > According methods were added to TxTextMorph:
>>> >
>>> > #editDecorator: - set specific edit decorator (TxNoneEditDecorator by
>>> > default)
>>> > #inputContents - returns "native" value (undecorated).
>>> > #displayedContents - returns raw text model asString
>>> >
>>> > See new examples on TxTextMorph class side.
>>> >
>>> > Best regards,
>>> > Denis
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko.
>>>
>>>
>>
>>
>

Reply via email to