Author Topic: How to model GUI classes  (Read 2550 times)

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
How to model GUI classes
« on: May 04, 2004, 11:48:57 am »
G'day g'day,

How would one model a form window class that has an instance of a class of push button?

How would we show that instances of that form window class includes that push button?
Cheers and best regards.

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #1 on: May 04, 2004, 12:07:34 pm »
Hi Jason,

Make the push button an attribute of the Window class. It's type would then be the class "Push Button" (or whatever the name it has).
Or are you trying to model the GUI itself? On the Custom diagram, you can use Screen and UI Control objects to model the GUI - and you can set the classifier for each of those, so you can make the screen's classifier to be your own class.

Does this help?

Bruno
http://wiki.eausergroup.org - WIKI for all things EA

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #2 on: May 04, 2004, 12:23:39 pm »
Hello Bruno,

Not interested in modeling the GUI, but rather interested in modeling the classes.

I've tried two things so far to model a push button instance for a form window class:

1) setup an attribute of the window class that is of type "pushbutton"

2) link to the form window class an object (classified as "pushbutton") with an aggregation link;

The first idea is better for visualizing the fact that any generalization of the form window has that pushbutton.

The second is better for visualizing calls to pushbutton functions.

Me thinks that to comprehensively document our "framework" of GUI classes, I'll have to use both ideas in parallel.

What do you think?
Cheers and best regards.

thomaskilian

  • Guest
Re: How to model GUI classes
« Reply #3 on: May 05, 2004, 03:52:55 am »
Hi Jason,
I'd look at the pushbutton rather as method than as attribute since pressing it makes something happen.

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #4 on: May 05, 2004, 12:45:23 pm »
Hi Thomas,

that would still make pushbutton an attribute of a class that contains a method that is triggered by pushing it... and another method triggered by doubleclicking etc.

Bruno
http://wiki.eausergroup.org - WIKI for all things EA

thomaskilian

  • Guest
Re: How to model GUI classes
« Reply #5 on: May 06, 2004, 09:16:18 am »
Right Bruno,
I probably got confused by the way VB is generating simply "Click-Functions".

Jason, isn't it the normal way to have a (button) attribute in the (frame) class and then name the association after that attribute?

(ugly ascii )

.--------------.
. frame        .
.--------------.
. +mButton .
.--------------.
       I
       I
       V +mButton
.-------------.
. button     .
.-------------.
. -pos         .
. -shape     .
.-------------.
. +clicked   .
. +clacked  .
.-------------.

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #6 on: May 06, 2004, 10:13:47 am »
G'day folks,

Thanks all.

I'm just going to add to my form window class an attribute of type push button.  That will handle, quite nicely, our simple and immediate needs.

Thomas, I haven't had any UML training; I base my slowly increasing knowledge on a few books.  If you wouldn't mind, where do you get the "normal way" from?  (Course?  Book?)  Much appreciated.
Cheers and best regards.

thomaskilian

  • Guest
Re: How to model GUI classes
« Reply #7 on: May 06, 2004, 12:13:51 pm »
Hi Jason,
;D shake hands. I started learning UML with a project some 3 years ago where I was forced  8) to use Rose. We were developing a web based tool for bank risk management using VB. I rather stumbled around since I did not have much of a clue execept I was used to work with classes (which was and still is an exception with programmers still   ;)). Right after that project I had the chance to go on with developing a PHP based printer management tool using the automation interface of Rose. So I gathered quite a year or two of autodidactical training. Since beginning of this year I switched to EA :) and focused on Use Case Modelling. I found this wonderfull discussion forum which encouraged me to learn more and more about UML. Still I'm a beginner though.

There are some guys here in that forum that seem to be real UML gurus. I wonder where they learned to use UML?

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #8 on: May 06, 2004, 11:01:10 pm »
Hi Thomas and Jason,

I would actually model it like this:


Bruno

P.S. You could use an association (or a <<trace>> relationship) to visually indicate the link in addition to this.

Quote
Right Bruno,
I probably got confused by the way VB is generating simply "Click-Functions".

Jason, isn't it the normal way to have a (button) attribute in the (frame) class and then name the association after that attribute?

(ugly ascii )

.--------------.
. frame        .
.--------------.
. +mButton .
.--------------.
        I
        I
        V +mButton
.-------------.
. button     .
.-------------.
. -pos         .
. -shape     .
.-------------.
. +clicked   .
. +clacked  .
.-------------.

« Last Edit: May 06, 2004, 11:01:53 pm by Bruno.Cossi »
http://wiki.eausergroup.org - WIKI for all things EA

CJ

  • EA User
  • **
  • Posts: 288
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #9 on: May 07, 2004, 04:52:47 am »
Thanks Bruno, that's what I did ... keeps things nice and tidy with a minimal amount of work.

The only thing I did different:  I added the stereotype <<control>> to the Push Button attribute in the Window class.
« Last Edit: May 07, 2004, 04:55:36 am by jasonv »
Cheers and best regards.

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: How to model GUI classes
« Reply #10 on: May 11, 2004, 10:19:28 pm »
Hi Jason,

that sounds like a good idea to me - visually separating instance variables from visual controls.

Bruno
http://wiki.eausergroup.org - WIKI for all things EA