discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editor and the responder chain


From: Stefan Urbanek
Subject: Re: Editor and the responder chain
Date: Mon, 21 Mar 2005 16:47:12 +0100
User-agent: Internet Messaging Program (IMP) 3.2.2

Citát Fred Kiefer <address@hidden>:

> Stefan Urbanek wrote:
> > I have a NSDocument document. The document is composed of card collections
> which
> > can be of different types. There is a document window (NSWindowController
> +
> > NSWindow) and in that window are two parts: one list for adding and
> removing
> > collections, and a view for editing the collection:
> > 
> >  +-------+-------------+
> >  |       |             |
> >  | list  |    view     |
> >  |       |             |
> >  |[+][-] |             |
> >  +-------+-------------+
> > 
> > When there was only one type of collection, there was no problem, as the
> view
> > was the collection view and the window controller served as editor
> (delegate),
> > which handled all action methods too.
> > 
> > Now I have more collection types and I would like to have different view
> for
> > each type. Say, that I have following types: ordered stack collection and
> > diagram. The view for ordered stack would be something similar to the view
> in a
> > presentation application (PowerPoint or OO.org) where one sees all slides
> and
> > can reorder them by D&D. The diagram view will look like, well, a diagram
> :o) -
> > objects with connections.
> > 
> > Now I would like to change the view, depending on the selected collection.
> And I
> > would like to have separate object to handle all editing actions - move
> editing
> > out of the window controller, as there should be many kinds of editors in
> the
> > future.
> > 
> > One solution is to have an Editor class which will provide a view. Then
> window
> > controller will reference: currentEditor, editorView. When one selects a
> > collection, the window controller will do:
> > - notify old editor that it will end editing
> > - remove old editor
> > - create new editor according to the collection
> > - assign selected collection to the new editor
> > - change old editor view to new editor view
> > 
> > Now, the problem is: how can I include the new editor object into the
> responder
> > chain?
> > 
> 
> I did not understand at what layer you use the document class. Is one 
> diagram a separate document or constitute all diagrams together the 
> document? From what you descirbe I would expect the later and this also 
> fits better with the NSDocument paradigma.
>

More diagrams/collections per document.

> I see different things you could do. One being to have a specific NSView 
> subclass used as the editor which will be in the view hierarchy and by 
> that also in the responder chain. This is a solution I don't like much.
>

Me neither.

> A better way would be to make the editor the delegate of the window, 
> whenever you change the diagram. This puts it into the responder chain, 
> and every class still may have its natural super class.
>

Thanks, this information helps - I was not aware of this functionality.

Stefan Urbanek
--
http://stefan.agentfarms.net

First they ignore you, then they laugh at you, then they fight you, then
you win.
- Mahatma Gandhi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]