Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » creating mutliple edit parts
creating mutliple edit parts [message #146806] Sun, 08 August 2004 18:41 Go to next message
steven melzer is currently offline steven melzerFriend
Messages: 38
Registered: July 2009
Member
all,

i wish to create multiple figures when dragging an item from the palette.
i am not sure the best approach to take for this. an edit part can onlt
create a single figure, so i assume i need to create more than one edit
part.

further, i would like to link these two edit parts (or whatever technique
is best) together. are there existing listeners between edit parts, or
should i make my own inter-editpart communication.

thanks in advance,
steve
Re: creating mutliple edit parts [message #146810 is a reply to message #146806] Sun, 08 August 2004 20:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianv.phreaker.net

Hi Steve,

The approach you take depends on the kind and level of interaction you wish
to achieve between the multiple figures you create.

You could have a single edit part that creates a figure - which in turn has
child figures arranged with some layout. For instance your EditPart figure
could be a layer, to which you "add" RectangleFigures ...

Another way of doing things, is have your main model (which you select from
the palette) create several children models. Each of these models will have
an EditPart and Figure respectively. You can easily set up relationships
between them at the model level.

I'd suggest the latter approach, unless the kind of interaction you want is
pretty trivial and you don't need the flexability that multiple models will
provide.

Hope this helps,
Brian.
Re: creating mutliple edit parts [message #146885 is a reply to message #146806] Mon, 09 August 2004 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

What Brian said, except I think you should describe you application since it
is hard to recommend a certain course of action without knowing the context.

"steven melzer" <smelzer@paymentech.com> wrote in message
news:cf5s3s$l12$1@eclipse.org...
> all,
>
> i wish to create multiple figures when dragging an item from the palette.
> i am not sure the best approach to take for this. an edit part can onlt
> create a single figure, so i assume i need to create more than one edit
> part.
>
> further, i would like to link these two edit parts (or whatever technique
> is best) together. are there existing listeners between edit parts, or
> should i make my own inter-editpart communication.
>
> thanks in advance,
> steve
>
Re: creating mutliple edit parts [message #147159 is a reply to message #146885] Wed, 11 August 2004 02:08 Go to previous messageGo to next message
steven melzer is currently offline steven melzerFriend
Messages: 17
Registered: July 2009
Junior Member
brian and randy,

thank you for the advise.

specifically, i want to seperate out the text from the figure. i want to
be able to "grab" the text from a figure and move it so it can be anywhere
inside or outside of the figure. to do this, i want every shape figure to
have an associated figure that is the text figure (just a rectangle
without border and transparent fill). both would be added to the diagram
model and they would have enough knowledge of each other so
moving/resizing/rotating/etc would effect both.

i really like the model-based control and i believe i will research this
avenue. any other advise would be appreciated.

my goal is to have the main selection tool always "select" the shape
figure regardless whether the associated text figure was selected (this i
know how to do). if you use the text tool, then selecting the shape
figure always selects the text figure.

steve

Randy Hudson wrote:

> What Brian said, except I think you should describe you application since it
> is hard to recommend a certain course of action without knowing the context.

> "steven melzer" <smelzer@paymentech.com> wrote in message
> news:cf5s3s$l12$1@eclipse.org...
> > all,
> >
> > i wish to create multiple figures when dragging an item from the palette.
> > i am not sure the best approach to take for this. an edit part can onlt
> > create a single figure, so i assume i need to create more than one edit
> > part.
> >
> > further, i would like to link these two edit parts (or whatever technique
> > is best) together. are there existing listeners between edit parts, or
> > should i make my own inter-editpart communication.
> >
> > thanks in advance,
> > steve
> >
Re: creating mutliple edit parts [message #147168 is a reply to message #147159] Wed, 11 August 2004 05:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: brianv.phreaker.net

Hi Steven,

Well; with the requirements that you specified - the model based approach
fits to a T. Make sure you set up your associations at the model level and
not in the EditParts or Figures.

I'll assume you have 2 kinds of shapes in your diagram- Rectangles and Text.

We therefore have
Models: RectangleModel and TextModel.
EditParts RectangleEditPart (uses RectangleFigure) and TextEditPart (uses
Label)

When you create a RectangleModel, add a TextModel as it's child directly in
the constructor.

(Note - you could also add the TextModel to the RectangleModels children
when the RectangleModel is being added to it's parent diagram. Whenever you
choose to do it - you will have to make sure that multiple TextModels do not
get added on Undo / Redo - or maybe
while loading the diagram from a saved file. You had better investigate the
best place yourself)

Now - you will be able to select your text (using the text tool) and drag
remove it quite simply from the Rectangle - into the main diagram or into
another Rectangle. This is akin to moving a Gate from a flow container to
another flow container or outside in the main diagram in the Logic plugin.
Pretty simple.


Notes:
See Logic's Sticky Note for an example of text in your diagram.

If you want more than one Text objects in your Rectangle - make sure you set
the layout of your RectangleFigure to something appropriate (Maybe Flow or
Toolbar layout , if you want ordered layouts)

The Label figure will resize with the parent RectangleFigure - unless you
specifically set constraints; so the default behaviour should do nicely for
you.


All the best,
Brian.
Re: creating mutliple edit parts [message #147330 is a reply to message #147159] Wed, 11 August 2004 16:40 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You could also acheive this with a special invible handle which floats on
top of the text. When you drag the text, just the text is moved, even
though it is not a separate, selectable editpart. The text label could be
inside the shape, or floating on top of it on some layer. A graphical
editpart can have two separate figures on two separate layers. You could
just extend the parent's remove/addChildVisuals() to call getFigure2(), and
add it to a separate "contents" pane such as the connection layer, etc..

"steven melzer" <steven.melzer@verizon.net> wrote in message
news:cfbv2j$1dq$1@eclipse.org...
> brian and randy,
>
> thank you for the advise.
>
> specifically, i want to seperate out the text from the figure. i want to
> be able to "grab" the text from a figure and move it so it can be anywhere
> inside or outside of the figure. to do this, i want every shape figure to
> have an associated figure that is the text figure (just a rectangle
> without border and transparent fill). both would be added to the diagram
> model and they would have enough knowledge of each other so
> moving/resizing/rotating/etc would effect both.
>
> i really like the model-based control and i believe i will research this
> avenue. any other advise would be appreciated.
>
> my goal is to have the main selection tool always "select" the shape
> figure regardless whether the associated text figure was selected (this i
> know how to do). if you use the text tool, then selecting the shape
> figure always selects the text figure.
>
> steve
>
> Randy Hudson wrote:
>
> > What Brian said, except I think you should describe you application
since it
> > is hard to recommend a certain course of action without knowing the
context.
>
> > "steven melzer" <smelzer@paymentech.com> wrote in message
> > news:cf5s3s$l12$1@eclipse.org...
> > > all,
> > >
> > > i wish to create multiple figures when dragging an item from the
palette.
> > > i am not sure the best approach to take for this. an edit part can
onlt
> > > create a single figure, so i assume i need to create more than one
edit
> > > part.
> > >
> > > further, i would like to link these two edit parts (or whatever
technique
> > > is best) together. are there existing listeners between edit parts,
or
> > > should i make my own inter-editpart communication.
> > >
> > > thanks in advance,
> > > steve
> > >
>
>
Previous Topic:Creating custom shapes
Next Topic:Troubles accessing draw2d/gef plugins
Goto Forum:
  


Current Time: Thu May 09 20:00:14 GMT 2024

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

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

Back to the top