Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4804

Re: MVC - simplified?

From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
Newsgroups comp.lang.java.gui
Subject Re: MVC - simplified?
References <MVC-20111206170519@ram.dialup.fu-berlin.de> <4tsDq.13109$LO2.3676@newsfe13.iad> <painting-20111206185206@ram.dialup.fu-berlin.de>
Message-ID <SUsDq.6415$_H.2063@newsfe16.iad> (permalink)
Date 2011-12-06 10:10 -0800

Show all headers | View raw


On 12/6/11 10:00 AM, Stefan Ram wrote:
> Daniel Pitts<newsgroup.nospam@virtualinfinity.net>  writes:
>> On 12/6/11 8:23 AM, Stefan Ram wrote:
>>> *Do not de-couple the model from the view via the observer
>> You do this only if you want strange artifacts to appear due to
>> incompatibility with your painting code and the Swing/Awt painting
>
>    What about code that only uses menus, buttons, textfields
>    and so, but no custom painting? For example:
>
> /* controller
> called when "convert degree Celsius to kelvin" button is pushed */
> public void actionPerformed( final java.awt.event.ActionEvent event )
> { final java.lang.String tC = input.getText();
>    { /* model *//* convert from degree Celsius to kelvin */
>      final java.lang.String tK =
>      java.lang.String.valueOf( Double.parseDouble( tC ) + 273.15 );
>      { /* view */ output.setText( tK ); }}}
>
>    The model block directly includes a view block that is
>    responsible for displaying the result of the calculation.
>
>    I do not expect strange artifacts nor do I deem the above
>    code to be unclear.
>
Actually, that is all controller code :-)  input.getText() accesses the 
model, and output.setText() access another model.

No problem there.

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar


Thread

Re: MVC - simplified? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-12-06 09:41 -0800
  Re: MVC - simplified? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-12-06 10:10 -0800

csiph-web