Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Why do I have two labels in a custom figure?
Why do I have two labels in a custom figure? [message #148398] Wed, 29 August 2007 12:27 Go to next message
Eclipse UserFriend
Originally posted by: slorenc.infogix.com

I have a custom figure which is an icon with text label painted in the
middle. I converted my gmgraf definition from non custom figure because I
wanted to use an icon as a figure.

Here is how it is now defined in gmfgraph. the dashes indicate tree depth
level and the properties are in parenthesis.

Canvas diagram
- Figure Gallery Default
--Figure Descriptor CustomAFigure (Name=CustomAFigure)
---Custom Figure CustomAFigure (Descriptor=Figure Descriptor CustomAFigure,
Name=CustomAFigure,QualifiedClassName=com.xyz.figures.Custom AFigure)
----Label ANameFigure (Descriptor=Figure Descriptor CustomAFigure,
Name=ANameFigure,Text=sometext)
---Child Access getFigureANameFigure (Accessor=getFigureANameFigure,
Figure=Label ANameFigure)
--Node A (CustomAFigure) properties are (Affixed Parent Side=NONE, Content
Pane=, Figure=Figure Descriptor CustomAFigure, Name=A, Resize
Constraint=NSEW)
--Diagram Label AName (Accessor=Child Access getFigureANameFigure, Affixed
Parent Side=NONE, Container=, Content Pane=, Element Icon=false,
External=false, Figure=,Name=AName, ResizeConstraint=NSEW)

My custom figure implementation com.xyz.figures.CustomAFigure extends
org.eclipse.draw2d.ImageFigure. In the constructor I load the image and set
it in figure and specify alignment to NORTH.

With the above definition this figure appears in a diagram as follows after
I type in the name 'myNewA'.

+------------------------+
| myNewA |
| sometext |
+------------------------+

The 'myNewA' is the value of the 'name' attribute of object A. The
'sometext' is the value of the 'Text' property of the 'Label ANameFigure'
definition .

I want to see the 'myNewA' label but I don't want to see 'sometext'. I
thought that the 'Text' property can be used to provide an initial value for
the newly created object, but since then I implemented provision of initial
values via 'Feature Seq Initializer' and 'Feature Value Spec' which are set
in the mapping definition.

So I changed the value of Text property to be empty. The text disappeared
but now I have another problem. I used to be able to double click inside
the figure and have it open another editor. Now the area occupied by the
'myNewA' label is enlarged to occupy almost all of the figure (which is the
size of the icon) and the area where I can double click is only a narrow
strip below the label. User would have to aim pretty precisely to open the
editor.

I guess my problem is with the definition of the custom figure. Should I
remove the Label ANameFigure from the Custom Figure CustomAFigure
definition?

Thanks,

Swavek
Re: Why do I have two labels in a custom figure? [message #148415 is a reply to message #148398] Wed, 29 August 2007 12:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: slorenc.infogix.com

I removed the 'Label ANameFigure' and regenerated the code. Now the
unwanted label doesn't appear.
But I still have a problem with double clicking behavior.

The behavior I want is like this. When I double click on the text of the
label I want the in-place editor to open and let me change the label. If I
double click outside of the label text but still within the icon I want the
other editor to open.

Current behavior is like this.
In order to edit the label I need to double click anywhere in the icon and
then click on the text. So three clicks in total.
I can't open another editor by double clicking.

Swavek



"Swavek Lorenc" <slorenc@infogix.com> wrote in message
news:fb46p7$653$1@build.eclipse.org...
>I have a custom figure which is an icon with text label painted in the
>middle. I converted my gmgraf definition from non custom figure because I
>wanted to use an icon as a figure.
>
> Here is how it is now defined in gmfgraph. the dashes indicate tree depth
> level and the properties are in parenthesis.
>
> Canvas diagram
> - Figure Gallery Default
> --Figure Descriptor CustomAFigure (Name=CustomAFigure)
> ---Custom Figure CustomAFigure (Descriptor=Figure Descriptor
> CustomAFigure,
> Name=CustomAFigure,QualifiedClassName=com.xyz.figures.Custom AFigure)
> ----Label ANameFigure (Descriptor=Figure Descriptor CustomAFigure,
> Name=ANameFigure,Text=sometext)
> ---Child Access getFigureANameFigure (Accessor=getFigureANameFigure,
> Figure=Label ANameFigure)
> --Node A (CustomAFigure) properties are (Affixed Parent Side=NONE, Content
> Pane=, Figure=Figure Descriptor CustomAFigure, Name=A, Resize
> Constraint=NSEW)
> --Diagram Label AName (Accessor=Child Access getFigureANameFigure, Affixed
> Parent Side=NONE, Container=, Content Pane=, Element Icon=false,
> External=false, Figure=,Name=AName, ResizeConstraint=NSEW)
>
> My custom figure implementation com.xyz.figures.CustomAFigure extends
> org.eclipse.draw2d.ImageFigure. In the constructor I load the image and
> set it in figure and specify alignment to NORTH.
>
> With the above definition this figure appears in a diagram as follows
> after I type in the name 'myNewA'.
>
> +------------------------+
> | myNewA |
> | sometext |
> +------------------------+
>
> The 'myNewA' is the value of the 'name' attribute of object A. The
> 'sometext' is the value of the 'Text' property of the 'Label ANameFigure'
> definition .
>
> I want to see the 'myNewA' label but I don't want to see 'sometext'. I
> thought that the 'Text' property can be used to provide an initial value
> for the newly created object, but since then I implemented provision of
> initial values via 'Feature Seq Initializer' and 'Feature Value Spec'
> which are set in the mapping definition.
>
> So I changed the value of Text property to be empty. The text disappeared
> but now I have another problem. I used to be able to double click inside
> the figure and have it open another editor. Now the area occupied by the
> 'myNewA' label is enlarged to occupy almost all of the figure (which is
> the size of the icon) and the area where I can double click is only a
> narrow strip below the label. User would have to aim pretty precisely to
> open the editor.
>
> I guess my problem is with the definition of the custom figure. Should I
> remove the Label ANameFigure from the Custom Figure CustomAFigure
> definition?
>
> Thanks,
>
> Swavek
>
Re: Why do I have two labels in a custom figure? [message #148422 is a reply to message #148415] Wed, 29 August 2007 15:43 Go to previous message
Eclipse UserFriend
Originally posted by: vinsarwate.rediffmail.com

Hi Swavek,

In my case, I was able to achieve what you want,atleast to some extent
i.e. opening cell editor on double click.

My name edit part is something like this -

SomeShapeNameEditPart extends CompartmentEditPart implements
ITextAwareEditPart


In this SomShapeNameEditPart, I have overridden performRequest like this -

public void performRequest(Request request) {
if(RequestConstants.REQ_OPEN==request.getType())
performDirectEdit(((SelectionRequest)request).getLocation()) ;
else
super.performRequest(request);
}

Though it works but when you click on icon adjacent to lable text, icon
disappears, I don't know why.

Thanks,
Vinay
Previous Topic:Problem Markers and HibernateResource
Next Topic:sketch and tooling
Goto Forum:
  


Current Time: Thu Jun 05 00:57:56 EDT 2025

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

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

Back to the top