Another command copying fix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Another command copying fix

keith1y
I found this fix in my code which is another intended to preserve the
command-context integrity

Keith

---


PRCommand-context: aContext

 context: aContext

    (self isValidIn: aContext)
        ifFalse: [ self error: self name , ' is not useable in the given
context.' ].
   
    ^ (aContext command: self new) command
       
       
   
   
   

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Command cant edit model

keith1y
I am trying, and failing, to create a command that acts upon a model.

When a command calls asComponent it usually gives itself as a model.

If I do:

asComponent
    ^ (model description asComponentOn: model)
        addValidatedForm: (Array with: #save -> 'Confirm' with: #cancel);
         yourself

Instead then everything works fine until the container component answers
the model, and the answer handler is expecting aCommand not an instance
of some other class

Any ideas would be appreciated.

Keith


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Command cant edit model

keith1y
Ok solved it...

I can implement read:Using: etc. on the command to delegate all accesses
to the model.

Keith

> I am trying, and failing, to create a command that acts upon a model.
>
> When a command calls asComponent it usually gives itself as a model.
>
> If I do:
>
> asComponent
>     ^ (model description asComponentOn: model)
>         addValidatedForm: (Array with: #save -> 'Confirm' with: #cancel);
>          yourself
>
> Instead then everything works fine until the container component answers
> the model, and the answer handler is expecting aCommand not an instance
> of some other class
>
> Any ideas would be appreciated.
>
> Keith
>  


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Another command copying fix

Lukas Renggli-2
In reply to this post by keith1y
Thank you for reporting this problem.

I removed this accessor from the command all-together. It is used  
nowhere in the code and seems to be a legacy thing from earlier  
versions of Pier.

Cheers,
Lukas


On 22 Oct 2007, at 17:37, Keith Hodges wrote:

> I found this fix in my code which is another intended to preserve the
> command-context integrity
>
> Keith
>
> ---
>
>
> PRCommand-context: aContext
>
>  context: aContext
>
>     (self isValidIn: aContext)
>         ifFalse: [ self error: self name , ' is not useable in the  
> given
> context.' ].
>
>     ^ (aContext command: self new) command
>
>
>
>
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki