Re: Design Question: Bindings & Custom Views

2008-08-29 Thread Erik Buck
Sorry. When I posted about "the problem Oleg Krupnov describes", I wasn't caught up on my reading of the list. The VC MYShapeDraw application I describe is a drawing application and not related to image thumbnail caching. Of course, the pattern is general and applicable to image thumbnai

Re: Design Question: Bindings & Custom Views

2008-08-29 Thread Erik Buck
"Cocoa Design Patterns" Chapter 29, "Controllers," contains an MVC solution to exactly the problem Oleg Krupnov describes. The chapter presents a relatively simple MVC MYShapeDraw application. The chapter leads the reader through the step by step process of re-inventing NSArrayControlle

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Oleg Krupnov
Thanks, that mostly answers my question, finally. And the short answer is "No" :). There is no standard Cocoa way of doing this and it's up to me how to implement it. I just wanted to make sure I was not reinventing the wheel. You are correct in suspecting me in a kind of MVC purism (typical for a

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread graham . lee
Grahaam Cox wrote on 2008-08-28 13:11:47: > > Regarding the above though, if this is similar to your situation - > what's really wrong with model objects caching a thumbnail? Being a > slave to MVC is going to lead to suboptimal solutions just as ignoring > MVC altogether is going to be. The c

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Cathy Shive
On Aug 28, 2008, at 12:26 PM, Oleg Krupnov wrote: I think there are times when it's appropriate to have wrapper objects - that are view related - for your model objects. In an image browser, it's likely that there is a "thumbnail" object that draws "image" objects. Yeah, maybe "view-rela

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Graham Cox
On 28 Aug 2008, at 8:26 pm, Oleg Krupnov wrote: In your image browser example, this problem sounds as follows: where to store the cached thumbnail images, to avoid re-creating them anew in each drawRect call? Also, if a thumbnail is in process of dragging inside the custom view, where to save t

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Graham Cox
On 28 Aug 2008, at 6:15 pm, Oleg Krupnov wrote: I have only one problem with this approach: As I mentioned before, I need to add custom-view specific instance variables (states) to the model object's category. The Objective-C categories do not allow adding instance variables, only methods I am

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Oleg Krupnov
> I think there are times when it's appropriate to have wrapper objects - that > are view related - for your model objects. In an image browser, it's likely > that there is a "thumbnail" object that draws "image" objects. Yeah, maybe "view-related wrapper objects for model objects" is the right t

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Cathy Shive
On Aug 28, 2008, at 11:06 AM, Oleg Krupnov wrote: In other words, I need a way to associate additional custom-view-specific properties with model object, without adding them as transitive properties to the model. What is the best way to do this? Or maybe your point is that this is a bad idea at

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Negm-Awad Amin
Okay, I – hopefully – understand you now: You have a view with some (model) objects displayed. There is another view (potentially or really?) that can display these objects, too The additional attributes are specific for each displayed object and each view? Correct? (There is a german phrase

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Oleg Krupnov
Yes, you are correct. I am looking not to break MVC and also get the correct implementation of binding in a custom view > Just an example: I had a graphic application that drawed some inserted > shapes. The shape itself is a part of the model, the color of the shape, > too. But when the user selec

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Negm-Awad Amin
Am Do,28.08.2008 um 10:15 schrieb Oleg Krupnov: Parts of your first question remind me of a situation that I had. Erik Buck gave me some great advice and part of it was the following: If you are worried about adding drawing code to a "Model" object, add the drawing code in a category of *

Re: Design Question: Bindings & Custom Views

2008-08-28 Thread Oleg Krupnov
> Parts of your first question remind me of a situation that I had. Erik Buck > gave me some great advice and part of it was the following: > If you are worried about adding drawing code to a "Model" object, add the > drawing code in a category of * and maintain the category > implementation in

Re: Design Question: Bindings & Custom Views

2008-08-27 Thread Paul Bruneau
On Aug 27, 2008, at 8:10 AM, Oleg Krupnov wrote: I am building a custom view that can display and edit some polymorphic objects. Furthermore, the objects can be composite, i.e. contain child objects hierarchically. Now I want to bind this custom view to the model through a controller (NSTreeCon