Home » Eclipse Projects » GEF » editable figure
editable figure [message #109811] |
Mon, 22 December 2003 02:06  |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Hi Friends,
I want to create a Figures, Connections with some name. the
name should be editable. is it possible?.
thanks
David.
|
|
| | | | |
Re: editable figure [message #109846 is a reply to message #109818] |
Mon, 22 December 2003 10:21   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
"David Danie" <david_danie@hotmail.com> wrote in message
news:bs65eo$qqf$2@eclipse.org...
> David Danie wrote:
> > Hi Friends,
> > I want to create a Figures, Connections with some name. the
> > name should be editable. is it possible?.
> >
> > thanks
> > David.
> >
> Note: i don't want to use Labels with separate Editparts.
So, can you instead use labels, but *without* separated editparts? So,
basically, its just a property of the connection which happens to be
displayed visually by using mulitple figures.
Then, when you get a REQ_DIRECT_EDIT, all you need to do is hit-test the
mouse location and the label(s). Of course a good application provides
keyboard equivalents, which shouldnt' be too hard either.
|
|
|
Re: editable figure [message #109876 is a reply to message #109846] |
Tue, 23 December 2003 04:58   |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Randy Hudson wrote:
> "David Danie" <david_danie@hotmail.com> wrote in message
> news:bs65eo$qqf$2@eclipse.org...
>
>>David Danie wrote:
>>
>>>Hi Friends,
>>> I want to create a Figures, Connections with some name. the
>>>name should be editable. is it possible?.
>>>
>>>thanks
>>>David.
>>>
>>
>>Note: i don't want to use Labels with separate Editparts.
>
>
> So, can you instead use labels, but *without* separated editparts? So,
> basically, its just a property of the connection which happens to be
> displayed visually by using mulitple figures.
>
> Then, when you get a REQ_DIRECT_EDIT, all you need to do is hit-test the
> mouse location and the label(s). Of course a good application provides
> keyboard equivalents, which shouldnt' be too hard either.
>
>
Randy,
I am not clear about your comments.
Thanks
David Danie.
|
|
|
Re: editable figure [message #109883 is a reply to message #109839] |
Tue, 23 December 2003 05:11   |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Brian Fernandes wrote:
> David,
>
> If you follow my recent post: "Labelling EditParts", you will see that I've
> implemented this using a separate model and editpart for the label. This is
> precicely becuase I want to be able to edit the label in place... ie. in the
> editor itself; which is what you want to do.
>
> The figure I used for the label extended Label and implemented
> AncestorListener so that it moved along with the figure it labels. I'm
> unsure of wheter DirectEditing is possible without an EditPart and another
> point to consider is; editing the label leads to changes in the model.
>
> Randy would be able to comment on whether all this is possible within Draw2D
> itself.
>
> All the best,
> Brian.
>
>
Brain,
If i create separate Editpart, Model for Label, is it possible
to add Labels along with connections, figures?.
for example,
public IFigure createFigute(){
Connection con = new PolylineConnection();
con.add(new MyLabel());
}
Because i want to creates some names, when i create figures, connections.
Regards
David Danie.
|
|
|
Re: editable figure [message #109890 is a reply to message #109876] |
Tue, 23 December 2003 06:28   |
Eclipse User |
|
|
|
Originally posted by: brian.fernandes.codito.com
What Randy means is, in EditPart#createFigure of the connection you create
2 figures. One is the the PolylineConnection that you used for the
connection (this is the figure you return from createFigure) and a second
Label figure that you use to label the connection. You can add this figure
as a child of the main figure using Figure#add but I think that would mess
up the layout of the main figure and its genuine children. So better is to
place the label onto your diagram layer yourself. As I mentioned in my
previous post, you can implement AncestorListener in your Label figure so
that it moves along with the main figure. Have a look at some of the Handles
in GEF to see how this works.
Regarding the DirectEditing with this technique; I'm not too sure.
If you choose to use a complete model / EditPart to implement labels, then
DirectEditing is not a big problem - it's exactly the same as direct editing
in Logic. If you wanted to allow the user the flexibility of positioning the
label himself, I think it would not be too hard either. The figure used for
the Label editpart is the same as detailed above. The label model must NOT
be added as a child of the model to be labelled - else the label will mess
up the layout of the figure again.
> If i create separate Editpart, Model for Label, is it possible
>to add Labels along with connections, figures?.
>for example,
> public IFigure createFigute(){
>Connection con = new PolylineConnection();
> con.add(new MyLabel());
> }
If MyLabel is a model class, you cannot add it as a child to the connection
FIGURE. I would suggest that your model class (of the figure to be labelled)
should have a member variable for the labels model.
Depending on the flexibility you need, both approaches (with and without
model / editParts) are workable, (I started off without using a separate
model / editpart, but ultimately found that for my needs, using a model for
the label would be simpler and cleaner).
Have a look at my "Labelling EditParts" post for more details.
All the best,
Brian.
|
|
|
Re: editable figure [message #109911 is a reply to message #109890] |
Tue, 23 December 2003 07:47   |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Brian Fernandes wrote:
> What Randy means is, in EditPart#createFigure of the connection you create
> 2 figures. One is the the PolylineConnection that you used for the
> connection (this is the figure you return from createFigure) and a second
> Label figure that you use to label the connection. You can add this figure
> as a child of the main figure using Figure#add
I allready used this way.
but I think that would mess
> up the layout of the main figure and its genuine children. So better is to
> place the label onto your diagram layer yourself.
what is the digram layer?. do you mean add child in to
BaseDiagram(RootDiagram).
As I mentioned in my
> previous post, you can implement AncestorListener in your Label figure so
> that it moves along with the main figure. Have a look at some of the Handles
> in GEF to see how this works.
>
> Regarding the DirectEditing with this technique; I'm not too sure.
>
> If you choose to use a complete model / EditPart to implement labels, then
> DirectEditing is not a big problem - it's exactly the same as direct editing
> in Logic. If you wanted to allow the user the flexibility of positioning the
> label himself, I think it would not be too hard either. The figure used for
> the Label editpart is the same as detailed above. The label model must NOT
> be added as a child of the model to be labelled - else the label will mess
> up the layout of the figure again.
>
>
>
>> If i create separate Editpart, Model for Label, is it possible
>>to add Labels along with connections, figures?.
>
>
>>for example,
>> public IFigure createFigute(){
>>Connection con = new PolylineConnection();
>> con.add(new MyLabel());
>> }
>
>
> If MyLabel is a model class, you cannot add it as a child to the connection
> FIGURE. I would suggest that your model class (of the figure to be labelled)
> should have a member variable for the labels model.
>
>
> Depending on the flexibility you need, both approaches (with and without
> model / editParts) are workable, (I started off without using a separate
> model / editpart, but ultimately found that for my needs, using a model for
> the label would be simpler and cleaner).
>
> Have a look at my "Labelling EditParts" post for more details.
>
> All the best,
> Brian.
>
>
>
>
|
|
|
Re: editable figure [message #109918 is a reply to message #109890] |
Tue, 23 December 2003 09:37   |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Brain,
Brian Fernandes wrote:
> What Randy means is, in EditPart#createFigure of the connection you create
> 2 figures. One is the the PolylineConnection that you used for the
> connection (this is the figure you return from createFigure) and a second
> Label figure that you use to label the connection. You can add this figure
> as a child of the main figure using Figure#add
I allready used this way. the label displayed always in left corner.
but I think that would mess
> up the layout of the main figure and its genuine children. So better is to
> place the label onto your diagram layer yourself.
what do you mean in diagram layer ?. adding label in to RootDiagram.
As I mentioned in my
> previous post, you can implement AncestorListener in your Label figure so
> that it moves along with the main figure. Have a look at some of the Handles
> in GEF to see how this works.
>
> Regarding the DirectEditing with this technique; I'm not too sure.
>
> If you choose to use a complete model / EditPart to implement labels, then
> DirectEditing is not a big problem - it's exactly the same as direct editing
> in Logic. If you wanted to allow the user the flexibility of positioning the
> label himself, I think it would not be too hard either. The figure used for
> the Label editpart is the same as detailed above. The label model must NOT
> be added as a child of the model to be labelled - else the label will mess
> up the layout of the figure again.
>
>
>
>> If i create separate Editpart, Model for Label, is it possible
>>to add Labels along with connections, figures?.
>
>
>>for example,
>> public IFigure createFigute(){
>>Connection con = new PolylineConnection();
>> con.add(new MyLabel());
>> }
>
>
> If MyLabel is a model class, you cannot add it as a child to the connection
> FIGURE. I would suggest that your model class (of the figure to be labelled)
> should have a member variable for the labels model.
>
>
> Depending on the flexibility you need, both approaches (with and without
> model / editParts) are workable, (I started off without using a separate
> model / editpart, but ultimately found that for my needs, using a model for
> the label would be simpler and cleaner).
>
> Have a look at my "Labelling EditParts" post for more details.
>
> All the best,
> Brian.
>
>
>
>
Now i am planning to add names as a property of Figure, Connections. So
give me some inputs about property pages.
Thanks
David Danie.
|
|
| | | |
Re: editable figure [message #109992 is a reply to message #109964] |
Wed, 24 December 2003 06:20  |
Eclipse User |
|
|
|
Originally posted by: david_danie.hotmail.com
Randy Hudson wrote:
> "Brian Fernandes" <brian.fernandes@codito.com> wrote in message
> news:bs97v4$ho9$1@eclipse.org...
>
>>What Randy means is, in EditPart#createFigure of the connection you
>
> create
>
>>2 figures. One is the the PolylineConnection that you used for the
>>connection (this is the figure you return from createFigure) and a second
>>Label figure that you use to label the connection. You can add this figure
>>as a child of the main figure using Figure#add but I think that would mess
>>up the layout of the main figure and its genuine children. So better is to
>
>
> No, you would add the label directly to the connection as its child:
>
> IFigure createFigure(...) {
> PolylineConnection conn = new PolylineConnection();
> myLabel = new Label();
> conn.add(myLabel);
> }
>
> See the GEF article which shows how to add labels to connections
>
>
Now i got it.
thanks for your comments.
Regards,
David Danie.
|
|
|
Goto Forum:
Current Time: Sun Jun 22 13:50:07 EDT 2025
Powered by FUDForum. Page generated in 0.05861 seconds
|