Ryan Heise wrote:
> If you take the MVC approach, the methods in DesktopWidget would not be
> at all interesting. In fact DesktopWidget could be defined to have no
> methods. Instead, we have the following design:
>
> class DesktopModel
> - showWindow(win)
> - hideWindow(win)
> - selectWindow(win)
> - disposeWindow(win)
> - moveWindow(win, x, y)
> - resizeWindow(win, w, h)
>
> interface DesktopListener
> - windowShown(event)
> - windowHidden(event)
> - windowSelected(event)
> - windowDisposed(event)
> - windowMoved(event)
> - windowResized(event)
>
> Then perhaps:
>
> class SwingDesktopWidget extends JDesktopPane implements Widget
> {
> class SwingDesktopListener implements DesktopListener
> {
> public void windowShown(DesktopEvent e)
> {
> findWindow(e.getWindow()).setVisible(true);
> }
> }
> }
>
> As you can see, there is no need for a DesktopWidget interface that
> defines methods to move windows around. In MVC, you would call
> controller.moveWindow(...) to move the window. As a result, all
> DesktopListeners will be notified through the windowMoved() method,
> which as you can see I have handled with an inner class to prevent
> people from calling these methods directly.
>
> I mentioned in another email that you don't really need a separate
> controller class, SwingDesktopWidget could interact directly with
> DesktopModel to move the window but SwingDesktopWidget itself has no
> public methods to move a window. It is not an interface for moving
> windows, it is just a view that internally is allowed to move windows.
>
> Now, the class design above was just given to demonstrate MVC. It is not
> necessarily the best design. It is possible to divide DesktopModel into
> a finer set of model components.
>
> If you go with MVC, the first step is to define the *Model, *Listener
> and *Event interfaces. As for the Widget interfaces, I think you will
> need only a single Widget interface. The requirements for the view layer
> will become clearer later on.
DesktopWidget would also have to handle adding and removing
ToolbarWidgets and Im sure other things but thats slightly offtopic.
The only point of the widget interface was to act as a parent to the
others. The widget interfaces are supposed to be an abstract way of
defigning the view, the view could be in Swing, AWT, or something else
in all cases it just has to implement the widget type(s).
I think making the desktop a JDesktopPane is the worst way to go, it
requires to many messy hacks to work could cause problems with AWT
components and is somewhat small minded design wise. several times Ive
proposed the use of a Screen.
public abstract class Screen
it handles the different types of screens, graphics and text
(TextScreen, GraphicsScreen) its not hooked to Swing (it does, however,
use many AWT classes; like GraphicsContext getGraphicsContext() and the
like), its better OO a desktop is not a swing container, its a container
but not in that sense.
public class DesktopScreen extends GraphicsScreen implements
DesktopWidget (whatever that entails)
...would be the standard Screen used for any TGUI (especially the JOS
default UI, lets call it GEM, no reason) it would handle the background
(via a pluggable Background class) the Icon Layer (which is optinal and
should be handled by another extension class) it handles window
managment (this while may be done by an inner class doesnt have to be
pluggable, only one way to do it) and at the top it handles "desktop
components" that is ToolbarWidgets (which could include stuff like a
TaskbarWidget/DockWidget/ToolbarWidget implementin' JWindow) it would
also handle the ScreenSaver. it acts as a container/controller for all
these things and it hands down the graphics objects to them.
I think this is the most flexible way to go, I also think this is not
the time to discuss it (Im sorry I brought it up)
we should decide what types of interfaces to design for the views and
what to put in them, we could make a cheap imitation of a Desktop with a
JWindow or even a JDesktopPane to test on, but I doubt will get that far
so soon.
keep the comments/suggestions comin'
Cheers,
DigiGod
_________________________
[EMAIL PROTECTED]
AIM:DigiGod 86
_________________________
Quote of the Moment:
Thus spake the master Ninjei:
"To the intelligent man, one word, to the fleet horse
one whip, to the well-written program, a single
command"
_________________________
Prank of the Moment:
Using the conferencing feature of your office phone, dial
one Induhvidual, then while it's ringing dial another and
conference them together. Put your own phone on mute
and listen to see how long they'll make small talk before
figuring out that neither one placed the call.
O-
_______________________________________________
UI maillist - [EMAIL PROTECTED]
http://jos.org/mailman/listinfo/ui