🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18139

Re: Does a Dialog need a Frame?

#18139
From: Paul Furbacher
Date: Wed, 12 Aug 1998 00:00
48 lines
2710 bytes
Thomas Wynne wrote:
 
> Does anybody know why a Dialog has to have a Frame to be created?  
> For example, I have three classes, class A, B, and C.

[My brain starts to scramble when I read such non-descriptive
naming.  Nevertheless, ...]
 
> Class A is my main class, it does my initializing and database stuff.  It
> also has a frame with a menu item that calls the dialog in Class B.
> 
> Class B dialog is called with 'this' as the frame parameter.  The this, is
> referring to the frame in class A.
> 
> In my Class B dialog, I make another call to Class C which brings up yet
> another dialog.  But to create Dialog C, I had create a bogus frame in class
> B to pass as a parameter.
> 
> So to generalize the question, does anybody know why a dialog must have a
> frame, and, is the way that I am doing it consistent with everybody else's
> methods, or have I just found a way to do it which is going to get me into
> some trouble in the future.  

It would appear that part of your problem is that you 
are mixing models ("database stuff") into views (frames).
It's best to strive to isolate the two and have an
"application model", or controller which coordinates the
showing/hiding of views from one central module.  Views, 
especially, should contain no database code beyond 
something like 

  myUIWidget.setDataSet(controller.getDataSetForThisWidget());


Done properly, the app controller creates the required 
database modules, the requisite views (frames), and brokers
requests for data from the views.  In addition, it controls
the visibility of the views and their subviews (dialogs, alerts,
etc.).  When a view (frame) needs to show an alert, it asks
the controller to do so.  Thus, since the controller has a 
reference to all frames, it easily knows which frame to assign 
as dialog parent.  The benefits of having a central application 
controller go far beyond this.  Re-usability increases, 
maintenance of each category of functionality (database, 
view, event, etc.) becomes easier, and so on.


Paul Furbacher
Technical Details
Message-ID: <35D1B94D.5B4BA182@bilbo.bio.purdue.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6qr2vs$3ft3@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,14994826d8c972ac
X-Google-Attributes: gidf74b3,public
From: Paul Furbacher <pf@bilbo.bio.purdue.edu>
Subject: Re: Does a Dialog need a Frame?
Date: 1998/08/12
Message-ID: <35D1B94D.5B4BA182@bilbo.bio.purdue.edu>
X-Deja-AN: 380429528
Content-Transfer-Encoding: 7bit
References: <6qr2vs$3ft3@forums.borland.com>
To: Thomas Wynne <twynne@entropy.uark.edu>
Content-Type: text/plain; charset=us-ascii
Organization: Biological Sciences, Purdue Univ.
Mime-Version: 1.0
Reply-To: pf@bilbo.bio.purdue.edu
Newsgroups: borland.public.jbuilder.java.language