Skip to main content



      Home
Home » Eclipse Projects » GEF » Design Question??
Design Question?? [message #100768] Mon, 20 October 2003 03:06 Go to next message
Eclipse UserFriend
Hi,

I have been going through the Logic example and am trying to adapt it to my
need.
For each graphical element there is a controller and a model associated with
it.
For example say LED, there is LEDFigure(GUI),LEDEditPart(Controller) and
LED(Model in the model package).
I guess this LED is more like view model.I want to create by business model
objects.Where do i do them???

If i create it in constructor of LED(),it wont be right. I see that
everytime the user drags an element
in to the editor, this view model object gets created.[Not when actually
drops it but when dragged!!,So if i simply drag
an object to the editor,and then change my mind, and move it back, a
businees object would be created and my in-memory model
would be corrupted.].

So I create my Businees Objects in the controller's createFigure().
That is inside createFigure() of LEDEditPart i say something like

//I know that LED (the view model) is created by this time, so i can safely
invoke it.
if(LED.getBusinessModel() == null) {
//Business Model is not created yet,so create it now
//This check is also imprtant in the sense that createFigure() may be
called several times,but BusinessModel() for that particular figure
//should only be created once!!!
IModel model = createModel(RootParent)
LED.setBusinessModel(model).
}

So design is something like
Controller(LEDEditPart)--------creates--------ViewModel(LED) ----------
|
|<<View Model stores BusinessModelObject>>
|--------createFigure()
creates--------BusinessModel Object

Am i doing the right way???
Is createFigure() the right method to instantiate my business objects..

Thanks in advance,
Mark
Re: Design Question?? [message #100837 is a reply to message #100768] Mon, 20 October 2003 07:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jpl.remotejava.com

anotherneatguy wrote:

> So I create my Businees Objects in the controller's createFigure().
> That is inside createFigure() of LEDEditPart i say something like
...
> Am i doing the right way???
> Is createFigure() the right method to instantiate my business objects..

Not according to the name and contract of this method.

I believe that creating business objects in Command.execute
(and associating the presentation models with them there) would
be a better idea.

-JPL
Re: Design Question?? [message #100891 is a reply to message #100768] Mon, 20 October 2003 08:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

If your business objects already exist, and you are just creating a view of
them in your diagram, then you don't need to create any BO, right? If you
are creating both simultaneously, everything should be done in the command.

The GEF tutorial briefly mentions your type of application model. See the
GEF homepage for a link to this article.

"anotherneatguy" <anotherneatguy@yahoo.com> wrote in message
news:bn01ed$dfj$1@eclipse.org...
> Hi,
>
> I have been going through the Logic example and am trying to adapt it to
my
> need.
> For each graphical element there is a controller and a model associated
with
> it.
> For example say LED, there is LEDFigure(GUI),LEDEditPart(Controller) and
> LED(Model in the model package).
> I guess this LED is more like view model.I want to create by business
model
> objects.Where do i do them???
>
> If i create it in constructor of LED(),it wont be right. I see that
> everytime the user drags an element
> in to the editor, this view model object gets created.[Not when actually
> drops it but when dragged!!,So if i simply drag
> an object to the editor,and then change my mind, and move it back, a
> businees object would be created and my in-memory model
> would be corrupted.].
>
> So I create my Businees Objects in the controller's createFigure().
> That is inside createFigure() of LEDEditPart i say something like
>
> //I know that LED (the view model) is created by this time, so i can
safely
> invoke it.
> if(LED.getBusinessModel() == null) {
> //Business Model is not created yet,so create it now
> //This check is also imprtant in the sense that createFigure() may be
> called several times,but BusinessModel() for that particular figure
> //should only be created once!!!
> IModel model = createModel(RootParent)
> LED.setBusinessModel(model).
> }
>
> So design is something like
> Controller(LEDEditPart)--------creates--------ViewModel(LED) ----------
> |
> |<<View Model stores BusinessModelObject>>
> |--------createFigure()
> creates--------BusinessModel Object
>
> Am i doing the right way???
> Is createFigure() the right method to instantiate my business objects..
>
> Thanks in advance,
> Mark
>
>
>
>
Re: Design Question?? [message #100931 is a reply to message #100891] Mon, 20 October 2003 09:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi Guys,

Thanks for the inputs!!!

Thanks JPL for pointing out the "contracts" thing. Even though creating the
object in createFigure()
solves my problem, i guess its a bad use of GEF design. The name itself
should have been reminder.
I was trying to solve the problem from a coding rather than a design
perspective..:)

Randy ,Just to clear up,
As u suggested there are two scenarios:

1)Existing BO's. Suppose my data is stored in XML format.When user clicks on
this file, i read the xml data,
create my in-memory model consisting of BOs,iterate through this model and
then try to show this model via GUI elements.
Where do i link my BO's to my GUI elements??

2)Now my in-memory model is ready.I have shown the GUI elements. User drags
a "new" item from the palette
and drops it in to the editor.This results in Creation of new Business
objects.When the user drags an item from palette and drops in the
editor, i create a BO and attach it to the GUI element.This should be done
via command.

What about my 1st case???[I mean the createCommand comes in to picture only
when u create a new GUI element by dragging from the palette
Its not generated when i "statically" create the GUI Model from the
in-memory model at file opening,ie no events are generated,no requests are
made,
(thats my understanding...)]

I have been able to achieve all of the above, but just want to validate the
right way of doing it...

Rgds,
Mark

"Randy Hudson" <none@us.ibm.com> wrote in message
news:bn0lo2$vh2$1@eclipse.org...
> If your business objects already exist, and you are just creating a view
of
> them in your diagram, then you don't need to create any BO, right? If you
> are creating both simultaneously, everything should be done in the
command.
>
> The GEF tutorial briefly mentions your type of application model. See the
> GEF homepage for a link to this article.
>
> "anotherneatguy" <anotherneatguy@yahoo.com> wrote in message
> news:bn01ed$dfj$1@eclipse.org...
> > Hi,
> >
> > I have been going through the Logic example and am trying to adapt it to
> my
> > need.
> > For each graphical element there is a controller and a model associated
> with
> > it.
> > For example say LED, there is LEDFigure(GUI),LEDEditPart(Controller) and
> > LED(Model in the model package).
> > I guess this LED is more like view model.I want to create by business
> model
> > objects.Where do i do them???
> >
> > If i create it in constructor of LED(),it wont be right. I see that
> > everytime the user drags an element
> > in to the editor, this view model object gets created.[Not when actually
> > drops it but when dragged!!,So if i simply drag
> > an object to the editor,and then change my mind, and move it back, a
> > businees object would be created and my in-memory model
> > would be corrupted.].
> >
> > So I create my Businees Objects in the controller's createFigure().
> > That is inside createFigure() of LEDEditPart i say something like
> >
> > //I know that LED (the view model) is created by this time, so i can
> safely
> > invoke it.
> > if(LED.getBusinessModel() == null) {
> > //Business Model is not created yet,so create it now
> > //This check is also imprtant in the sense that createFigure() may
be
> > called several times,but BusinessModel() for that particular figure
> > //should only be created once!!!
> > IModel model = createModel(RootParent)
> > LED.setBusinessModel(model).
> > }
> >
> > So design is something like
> > Controller(LEDEditPart)--------creates--------ViewModel(LED) ----------
> > |
> > |<<View Model stores BusinessModelObject>>
> > |--------createFigure()
> > creates--------BusinessModel Object
> >
> > Am i doing the right way???
> > Is createFigure() the right method to instantiate my business objects..
> >
> > Thanks in advance,
> > Mark
> >
> >
> >
> >
>
>
Re: Design Question?? [message #100945 is a reply to message #100768] Mon, 20 October 2003 10:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ThisisFake.Fakeness.xyz

The EditPart replaces your business object. And if your trying to keep
your business objects seperate for whatever reason, the EditPart should be
the adapter into your business object. I am taking some assumptions here
because I assume that your "business" must be graphical in nature else you
wouldn't be using such an interface as GEF. Remember, the Model object is
the ONLY thing that is saved, business object is just a processor for
data, and data is input and output through your EditPart.

Again, your business object should be associated with and or included in
the EditPart. Your business object should be expendable as the EditPart
can be recreated at any time. Anything that needs saving needs to be
associated with the model. What is a business model object? Their is
only 1 model, and that is of your design. GEF does not care what your
model contains, only that your EditPart knows how to read it...



CL



On Mon, 20 Oct 2003 12:36:44 +0530, anotherneatguy wrote:

> Hi,
>
> I have been going through the Logic example and am trying to adapt it to
> my need.
> For each graphical element there is a controller and a model associated
> with it.
> For example say LED, there is LEDFigure(GUI),LEDEditPart(Controller) and
> LED(Model in the model package).
> I guess this LED is more like view model.I want to create by business
> model objects.Where do i do them???
>
> If i create it in constructor of LED(),it wont be right. I see that
> everytime the user drags an element
> in to the editor, this view model object gets created.[Not when actually
> drops it but when dragged!!,So if i simply drag an object to the
> editor,and then change my mind, and move it back, a businees object would
> be created and my in-memory model would be corrupted.].
>
> So I create my Businees Objects in the controller's createFigure(). That
> is inside createFigure() of LEDEditPart i say something like
>
> //I know that LED (the view model) is created by this time, so i can
> safely invoke it.
> if(LED.getBusinessModel() == null) {
> //Business Model is not created yet,so create it now //This check is
> also imprtant in the sense that createFigure() may be
> called several times,but BusinessModel() for that particular figure
> //should only be created once!!!
> IModel model = createModel(RootParent)
> LED.setBusinessModel(model).
> }
> }
> So design is something like
> Controller(LEDEditPart)--------creates--------ViewModel(LED) ----------
> |
> |<<View Model stores BusinessModelObject>>
> |--------createFigure()
> creates--------BusinessModel Object
>
> Am i doing the right way???
> Is createFigure() the right method to instantiate my business objects..
>
> Thanks in advance,
> Mark
Re: Design Question?? [message #100967 is a reply to message #100945] Mon, 20 October 2003 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jpl.remotejava.com

CL [dnoyeB] Gilbert wrote:

> What is a business model object? Their is only 1 model, and that is
> of your design. GEF does not care what your model contains, only that
> your EditPart knows how to read it...

By my definition, a business model object would be an object containing
and concerned with information that is completely neutral from the
presentation style - unlike a "presentation model object", which might
contain stuff like (x,y) coordinates of a diagram node. Both business
model information and presentation model information needs to be saved,
though these kinds of information could imaginably be persisted separate
from each other (for example, presentation model in a file-per-diagram,
business model in a central database).

Mark's question was about where (or when) to associate presentation model
objects with existing business model objects when initializing an editor.
To that, my answer is: GraphicalEditor.initializeGraphicalViewer - there
you can parse the IEditorInput, reconstruct all presentation model objects
and link them to (existing) business model objects in some manner.

-JPL
Re: Design Question?? [message #100997 is a reply to message #100967] Mon, 20 October 2003 11:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ThisisFake.Fakeness.xyz

On Mon, 20 Oct 2003 14:38:53 +0000, Jan Ploski wrote:

> CL [dnoyeB] Gilbert wrote:
>
>> What is a business model object? Their is only 1 model, and that is of
>> your design. GEF does not care what your model contains, only that
>> your EditPart knows how to read it...
>
> By my definition, a business model object would be an object containing
> and concerned with information that is completely neutral from the
> presentation style - unlike a "presentation model object", which might
> contain stuff like (x,y) coordinates of a diagram node. Both business
> model information and presentation model information needs to be saved,
> though these kinds of information could imaginably be persisted separate
> from each other (for example, presentation model in a file-per-diagram,
> business model in a central database).
>
>
Interesting. I am using such an architecture where my visual data is
stored in a simple GEF file, but associated data is stored in a database.


> Mark's question was about where (or when) to associate presentation
> model objects with existing business model objects when initializing an
> editor. To that, my answer is: GraphicalEditor.initializeGraphicalViewer
> - there you can parse the IEditorInput, reconstruct all presentation
> model objects and link them to (existing) business model objects in some
> manner.
>
> -JPL

I intend to use my "model" to manage ALL data that is stored. I think
that is the correct approach. Even if you have 5-10 other models behind
it, GEF only needs to recognize your 1 model, and that model can load and
save (other sub-models) as it needs too.

My answer would be to associate both with a basic model that GEF will load
as needed. that model should provide any data the EditPart needs.
Remember that all data must be exposed through the EditPart at some point,
or its useless.

Carl
Re: Design Question?? [message #101010 is a reply to message #100997] Mon, 20 October 2003 11:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You are correct. GEF anticipates models that are split apart, such as your
database schema (guessing). Also, these models may be "exposed" in varying
degrees, ranging from just the editpart knowing about them, to other things
like selection synchronizing, etc. knowing that they exist.

"CL [dnoyeB] Gilbert" <ThisisFake@Fakeness.xyz> wrote in message
news:pan.2003.10.20.15.17.46.788129@Fakeness.xyz...
> On Mon, 20 Oct 2003 14:38:53 +0000, Jan Ploski wrote:
>
> > CL [dnoyeB] Gilbert wrote:
> >
> >> What is a business model object? Their is only 1 model, and that is of
> >> your design. GEF does not care what your model contains, only that
> >> your EditPart knows how to read it...
> >
> > By my definition, a business model object would be an object containing
> > and concerned with information that is completely neutral from the
> > presentation style - unlike a "presentation model object", which might
> > contain stuff like (x,y) coordinates of a diagram node. Both business
> > model information and presentation model information needs to be saved,
> > though these kinds of information could imaginably be persisted separate
> > from each other (for example, presentation model in a file-per-diagram,
> > business model in a central database).
> >
> >
> Interesting. I am using such an architecture where my visual data is
> stored in a simple GEF file, but associated data is stored in a database.
>
>
> > Mark's question was about where (or when) to associate presentation
> > model objects with existing business model objects when initializing an
> > editor. To that, my answer is: GraphicalEditor.initializeGraphicalViewer
> > - there you can parse the IEditorInput, reconstruct all presentation
> > model objects and link them to (existing) business model objects in some
> > manner.
> >
> > -JPL
>
> I intend to use my "model" to manage ALL data that is stored. I think
> that is the correct approach. Even if you have 5-10 other models behind
> it, GEF only needs to recognize your 1 model, and that model can load and
> save (other sub-models) as it needs too.
>
> My answer would be to associate both with a basic model that GEF will load
> as needed. that model should provide any data the EditPart needs.
> Remember that all data must be exposed through the EditPart at some point,
> or its useless.
>
> Carl
Re: Design Question?? [message #101023 is a reply to message #100931] Mon, 20 October 2003 11:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

1) So, let say you are creating a diagram file for an existing namespace.
You might decide to pre-populate the diagram with views of the existing
types. This requires generating some kind of automatic layout, which
provides constraints for the views. I'm interpreting your "GUI elements" to
actualyl mean the "view model", and not the figures or editparts used in
GEF. One possibility is that you generate the view model immediately from
the New Wizard which created the diagram resource. That way, your editor
doesn't need to worry about the difference between a new diagram, and one
created by the user.

2) Yes, if by "GUI element", you are referring to the other "half" of your
model, the view model.

"anotherneatguy" <anotherneatguy@yahoo.com> wrote in message
news:bn0opb$2up$1@eclipse.org...
> Hi Guys,
>
> Thanks for the inputs!!!
>
> Thanks JPL for pointing out the "contracts" thing. Even though creating
the
> object in createFigure()
> solves my problem, i guess its a bad use of GEF design. The name itself
> should have been reminder.
> I was trying to solve the problem from a coding rather than a design
> perspective..:)
>
> Randy ,Just to clear up,
> As u suggested there are two scenarios:
>
> 1)Existing BO's. Suppose my data is stored in XML format.When user clicks
on
> this file, i read the xml data,
> create my in-memory model consisting of BOs,iterate through this model and
> then try to show this model via GUI elements.
> Where do i link my BO's to my GUI elements??
>
> 2)Now my in-memory model is ready.I have shown the GUI elements. User
drags
> a "new" item from the palette
> and drops it in to the editor.This results in Creation of new Business
> objects.When the user drags an item from palette and drops in the
> editor, i create a BO and attach it to the GUI element.This should be done
> via command.
>
> What about my 1st case???[I mean the createCommand comes in to picture
only
> when u create a new GUI element by dragging from the palette
> Its not generated when i "statically" create the GUI Model from the
> in-memory model at file opening,ie no events are generated,no requests are
> made,
> (thats my understanding...)]
>
> I have been able to achieve all of the above, but just want to validate
the
> right way of doing it...
>
> Rgds,
> Mark
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:bn0lo2$vh2$1@eclipse.org...
> > If your business objects already exist, and you are just creating a view
> of
> > them in your diagram, then you don't need to create any BO, right? If
you
> > are creating both simultaneously, everything should be done in the
> command.
> >
> > The GEF tutorial briefly mentions your type of application model. See
the
> > GEF homepage for a link to this article.
> >
> > "anotherneatguy" <anotherneatguy@yahoo.com> wrote in message
> > news:bn01ed$dfj$1@eclipse.org...
> > > Hi,
> > >
> > > I have been going through the Logic example and am trying to adapt it
to
> > my
> > > need.
> > > For each graphical element there is a controller and a model
associated
> > with
> > > it.
> > > For example say LED, there is LEDFigure(GUI),LEDEditPart(Controller)
and
> > > LED(Model in the model package).
> > > I guess this LED is more like view model.I want to create by business
> > model
> > > objects.Where do i do them???
> > >
> > > If i create it in constructor of LED(),it wont be right. I see that
> > > everytime the user drags an element
> > > in to the editor, this view model object gets created.[Not when
actually
> > > drops it but when dragged!!,So if i simply drag
> > > an object to the editor,and then change my mind, and move it back, a
> > > businees object would be created and my in-memory model
> > > would be corrupted.].
> > >
> > > So I create my Businees Objects in the controller's createFigure().
> > > That is inside createFigure() of LEDEditPart i say something like
> > >
> > > //I know that LED (the view model) is created by this time, so i can
> > safely
> > > invoke it.
> > > if(LED.getBusinessModel() == null) {
> > > //Business Model is not created yet,so create it now
> > > //This check is also imprtant in the sense that createFigure() may
> be
> > > called several times,but BusinessModel() for that particular figure
> > > //should only be created once!!!
> > > IModel model = createModel(RootParent)
> > > LED.setBusinessModel(model).
> > > }
> > >
> > > So design is something like
> > > Controller(LEDEditPart)--------creates--------ViewModel(LED) ----------
> > > |
> > > |<<View Model stores BusinessModelObject>>
> > > |--------createFigure()
> > > creates--------BusinessModel Object
> > >
> > > Am i doing the right way???
> > > Is createFigure() the right method to instantiate my business
objects..
> > >
> > > Thanks in advance,
> > > Mark
> > >
> > >
> > >
> > >
> >
> >
>
>
Re: Design Question?? [message #101039 is a reply to message #100997] Mon, 20 October 2003 11:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jpl.remotejava.com

CL [dnoyeB] Gilbert wrote:

> I intend to use my "model" to manage ALL data that is stored. I think
> that is the correct approach. Even if you have 5-10 other models behind
> it, GEF only needs to recognize your 1 model, and that model can load and
> save (other sub-models) as it needs too.
>
> My answer would be to associate both with a basic model that GEF will load
> as needed. that model should provide any data the EditPart needs.

I believe that the whole point of separating presentation and business
models is to ensure reusability of the latter outside of GEF and make
its independent understanding possible. To achieve this, the business
model must not know anything about the presentation model - you should
be able to throw away all GEF code and still have a useful set of
"business" classes that you can use to manipulate data.

What you discuss is whether EditParts should be aware of the existence
of that "business model" behind the scenes. I would argue that there
is less value in protecting that information. However, you can indeed
achieve this goal using your delegation approach. (One benefit would
be that you can understand and maintain most of the GEF pieces of your
application without concerns about the "business part".)

> Remember that all data must be exposed through the EditPart at some point,
> or its useless.

This is not true - some data available from the business model might be
useless to GEF (i.e. not ever presented or manipulated by EditParts),
yet still relevant in other contexts.

-JPL
Re: Design Question?? [message #101046 is a reply to message #101039] Mon, 20 October 2003 12:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> I believe that the whole point of separating presentation and business
> models is to ensure reusability of the latter outside of GEF and make
> its independent understanding possible. To achieve this, the business
> model must not know anything about the presentation model - you should
> be able to throw away all GEF code and still have a useful set of
> "business" classes that you can use to manipulate data.
>
> What you discuss is whether EditParts should be aware of the existence
> of that "business model" behind the scenes. I would argue that there

I think he meant that GEF itself (our code) doesn't know about the business
model. But, your own EditParts, Command, and Policies (*your code*)
definitely have legitimate reasons to manipulate and access the business
model. So you all are in violent agreement ;-)
Re: Design Question?? [message #101135 is a reply to message #101023] Mon, 20 October 2003 15:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ThisisFake.Fakeness.xyz

On Mon, 20 Oct 2003 11:45:00 -0400, Randy Hudson wrote:

> 1) So, let say you are creating a diagram file for an existing namespace.
> You might decide to pre-populate the diagram with views of the existing
> types. This requires generating some kind of automatic layout, which
> provides constraints for the views. I'm interpreting your "GUI elements"
> to actualyl mean the "view model", and not the figures or editparts used
> in GEF. One possibility is that you generate the view model immediately
> from the New Wizard which created the diagram resource. That way, your
> editor doesn't need to worry about the difference between a new diagram,
> and one created by the user.
>

This is what I am doing. I create a project with my first dialog page.
Next page creates a connection to a database, and that information is
stored with my project. So when I create my "view model" with a file
creation dialog, or some such, it can retrieve the database connection
from the project. that way I have both a file, and a database connection
for each EditPart that requires them, because they are in my models.

CL
Re: Design Question?? [message #101148 is a reply to message #101039] Mon, 20 October 2003 15:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

On Mon, 20 Oct 2003 15:51:48 +0000, Jan Ploski wrote:

> I believe that the whole point of separating presentation and business
> models is to ensure reusability of the latter outside of GEF and make
> its independent understanding possible. To achieve this, the business
> model must not know anything about the presentation model - you should
> be able to throw away all GEF code and still have a useful set of
> "business" classes that you can use to manipulate data.
>
>
>
>
I always thought business logic stood between presentation and storage
(model). The term business model is new to me.

What I am gathering is that their is data related to what is
displayed(business model) and their is data related to how it is
displayed(presentation model). These can remain seperate. The answer to
your question though is that your EditPart is the interpreter of all your
model(s). When a file is loaded from disk/wherever, first the model data
is created. Then a factory will create the proper EditPart to fit that
model's class. So you WILL need a main model. This can be simply an
adapter to two other models if you wish. When an EditPart is created by a
Tool/Command using the GUI, first the EditPart is created, then an
appropriate model is created for that EditPart's type.

The EditPart is where the communication between model and presentation is.
It must understand your Model(s). It must be GEF centric.



> What you discuss is whether EditParts should be aware of the existence
> of that "business model" behind the scenes. I would argue that there is
> less value in protecting that information. However, you can indeed
> achieve this goal using your delegation approach. (One benefit would be
> that you can understand and maintain most of the GEF pieces of your
> application without concerns about the "business part".)
>
>
I think the main point here is that the EditPart is the interface or
"contract" to all of your model data, be that business data or
presentation data.



>> Remember that all data must be exposed through the EditPart at some
>> point, or its useless.
>
> This is not true - some data available from the business model might be
> useless to GEF (i.e. not ever presented or manipulated by EditParts),
> yet still relevant in other contexts.
>
>
>
If this data will not be used by GEF, I would recommend the contract not
expose it to GEF.

In my last iteration of my project, I had a database model and a
presentation model. My "adapter" class actually turned out to be a little
more than an adapter. It also cached my DB objects so that I could ensure
only 1 java object existed per db object. But it still did not store
anything, preferring to delegate that to the sub-models.

Carl
Re: Design Question?? [message #101315 is a reply to message #100768] Tue, 21 October 2003 13:39 Go to previous message
Eclipse UserFriend
Hi Guys Thanks for all the inputs!!!!!!!!!!!!!!!
Will come up with more doubts later!!!!!!!!!!!!!!!!!!
As soon as i implement ur suggestions!!!!!!!

Mark
"anotherneatguy" <anotherneatguy@yahoo.com> wrote in message
news:bn01ed$dfj$1@eclipse.org...
> Hi,
>
> I have been going through the Logic example and am trying to adapt it to
my
> need.
> For each graphical element there is a controller and a model associated
with
> it.
> For example say LED, there is LEDFigure(GUI),LEDEditPart(Controller) and
> LED(Model in the model package).
> I guess this LED is more like view model.I want to create by business
model
> objects.Where do i do them???
>
> If i create it in constructor of LED(),it wont be right. I see that
> everytime the user drags an element
> in to the editor, this view model object gets created.[Not when actually
> drops it but when dragged!!,So if i simply drag
> an object to the editor,and then change my mind, and move it back, a
> businees object would be created and my in-memory model
> would be corrupted.].
>
> So I create my Businees Objects in the controller's createFigure().
> That is inside createFigure() of LEDEditPart i say something like
>
> //I know that LED (the view model) is created by this time, so i can
safely
> invoke it.
> if(LED.getBusinessModel() == null) {
> //Business Model is not created yet,so create it now
> //This check is also imprtant in the sense that createFigure() may be
> called several times,but BusinessModel() for that particular figure
> //should only be created once!!!
> IModel model = createModel(RootParent)
> LED.setBusinessModel(model).
> }
>
> So design is something like
> Controller(LEDEditPart)--------creates--------ViewModel(LED) ----------
> |
> |<<View Model stores BusinessModelObject>>
> |--------createFigure()
> creates--------BusinessModel Object
>
> Am i doing the right way???
> Is createFigure() the right method to instantiate my business objects..
>
> Thanks in advance,
> Mark
>
>
>
>
Previous Topic:How to get the IProtySheetPage.class into use in editor's getAdapter() ?
Next Topic:What role does LogicMessage.java play in logic example?
Goto Forum:
  


Current Time: Sun Jun 08 17:09:13 EDT 2025

Powered by FUDForum. Page generated in 0.04325 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top