Re: [Nanodesigner-developers] Sample GUI Design
Status: Alpha
Brought to you by:
swinnen
|
From: <sw...@us...> - 2004-11-03 16:58:43
|
Elie De Brauwer wrote:
>>>Another design question now, like you might have noticed,=3D20
>>>adding some simple menu options in MainView without actually doing=3D2=
0
>>>something makes your class huge, now already 300 lines. So why not
>>>make a subpackage 'action' to contain all the menuactions, which can
>>>easily access the main application thru the mvcapplication singleton.
>>>=3D20
>>>
>>> =20
>>>
>>I think you should look at the command design pattern. You can put the=
=3D20
>>actions into a separate class actually.
>> =20
>>
>
>That's what I meant, an action subclass with an class extending Abstract=
Action=20
>for each action.
> =20
>
Yes, also important is the ability to add action classes from plug-ins=20
later.
This will be the real tricky thing I think.
>>I think we should first try to figure out how we solve the three-in-one=
=3D20
>>window and the other view, three separate windows. We essentially have=
=3D20
>>six items:
>>1. a menu bar
>>2. a message toolbar
>>3. a 3D pane
>>4. a top tool pane
>>5. a middle tool pane
>>6. a bottom tool pane
>>Each of them can be represeted by a class, each of them should have a=3D=
20
>>separate controller class I think
>>On top of that we have a class (or more than one) that creates one or=3D=
20
>>three frames depending on a preference variable.
>>With the use of three splitpanes we can create the panes mentioned abov=
e.
>>We have to work out the details a bit but I think it should be doable=3D=
20
>>like that.
>>Let me know if it is not clear... or, if you have another idea about it=
...
>>
>> =20
>>
>
>It certainly is doable with three splitpanes, consider the small proof o=
f=20
>concept code:=20
>
><code (Split.java) >
>import javax.swing.JButton;=20
>import javax.swing.JFrame;
>import javax.swing.JSplitPane;
>
>
>public class Split extends JFrame{
> private Split() {}
> public Split(String s) {
> super(s);
> JSplitPane main=3Dnew JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
> JSplitPane upperMiddle =3D new JSplitPane(JSplitPane.VERTICAL_SP=
LIT);
> JSplitPane left =3D new JSplitPane(JSplitPane.VERTICAL_SPLIT);
> upperMiddle.setLeftComponent(new JButton("LEFT"));
> upperMiddle.setRightComponent(new JButton("MIDDLE"));
> left.setLeftComponent(upperMiddle);
> left.setRightComponent(new JButton("LOWER"));
> main.setLeftComponent(left);
> main.setRightComponent(new JButton("RIGHT"));
> setContentPane(main);
> }
> =20
> public static void main (String [] args) {
> JFrame frm =3D new Split("Test");
> frm.setSize(400,400);
> frm.setVisible(true);
> }
>}
>
></code>
> =20
>
I did not doubt it would be possible.
Initially we have to create three frames and add the different panes=20
depending on which view is chosen (one or three windows) depending on a=20
default or user preference. A preference listener keeps track of this=20
preference. If it is changed the appropriate method is called and panes=20
are added and removed from the appropriate frames. I don't think it is=20
more difficult than that.
>Btw, should it be better to create a small cvs testzone or a separate CV=
S tree
>or whtvr. Just for making the sharing of sources easier ?=20
> =20
>
Hmm. Maybe.
Regards,
Val=E8re
|