Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to use the side-affixed property?
How to use the side-affixed property? [message #88768] Tue, 02 January 2007 16:28 Go to next message
Eclipse UserFriend
Originally posted by: kalin.nakov.gmail.com

Hi,

I need to display small squares attached to the border of a parent
symbol, the same as the ports in UML. I've heard that setting the
side-affixed property of the Node element in the gmfgraph file could do
the job. I have spent a lot of time on this with no success. What should
I do to make it working?

Thanks in advance,
Kalin
Re: How to use the side-affixed property? [message #88892 is a reply to message #88768] Tue, 02 January 2007 18:59 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Kalin,

AFAIK, you have to specify corresponding constraint for the Node in .gmfgraph
model and then corresponding child node will be shown on the border of the
parent node. The only one thread about it I found on the eclipse site is:
http://wiki.eclipse.org/index.php/GMF_Newsgroup_Q%26A#Is_Aff ixed_Parent_Side_only_respected_on_creation.3F

M.b. "side-affixed" child element should not contain children as well.

-----------------
Alex Shatalin
Re: How to use the side-affixed property? [message #89026 is a reply to message #88892] Wed, 03 January 2007 10:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kalin.nakov.gmail.com

Hello,

I have a big rectangle with a compartment and a small rectangle which
has to stick on the borders of the big parent rectangle. As soon as I
set the small rectangle's side-affixed parent to NSEW the big
rectangle's compartment disappears and I can hardly select and move the
big rectangle. In addition to that I can no longer add new small
rectangles - the mouse cursor is a "no" sign. I have the expected
behavior, but only for the previously added small rectangles. What could
be wrong?

Thanks,
Kalin


Alex Shatalin wrote:
> Hello Kalin,
>
> AFAIK, you have to specify corresponding constraint for the Node in
> .gmfgraph model and then corresponding child node will be shown on the
> border of the parent node. The only one thread about it I found on the
> eclipse site is:
> http://wiki.eclipse.org/index.php/GMF_Newsgroup_Q%26A#Is_Aff ixed_Parent_Side_only_respected_on_creation.3F
>
>
> M.b. "side-affixed" child element should not contain children as well.
>
> -----------------
> Alex Shatalin
>
>
Re: How to use the side-affixed property? [message #89124 is a reply to message #89026] Wed, 03 January 2007 12:23 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Kalin,

Looks like you have the following problem: “big rectangle” fully filled with
compartment and there is no point on big rectangle where you have to click
with the mouse to create small one (if you are clicking into compartment
you are trying to create small rectangle inside a compartment and this is
incorrect). As a workaround I suggest you to:
1. remove compartment and try to work without it.
2. add border to the “big rectangle” figure. In this case you’ll be able
to click to the border to create “small rectangle”.

-----------------
Alex Shatalin
Re: How to use the side-affixed property? [message #89334 is a reply to message #89124] Thu, 04 January 2007 11:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kalin.nakov.gmail.com

Hello again,

Adding a border didn't help. The reason was that the compartment figure
was not a child of the big rectangle in the .gmfgraph file and for some
reason was stretched too much. Now the compartment rectangle is a child
of the big rectangle and visually it is ok. Unfortunately now when I
insert the big rectangle in the canvas it is stuck in the upper left
corner of the canvas and cannot be moved, resized or even selected :-(

Alex Shatalin wrote:
> Hello Kalin,
>
> Looks like you have the following problem: “big rectangle” fully filled
> with compartment and there is no point on big rectangle where you have
> to click with the mouse to create small one (if you are clicking into
> compartment you are trying to create small rectangle inside a
> compartment and this is incorrect). As a workaround I suggest you to:
> 1. remove compartment and try to work without it. 2. add border to the
> “big rectangle” figure. In this case you’ll be able to click to the
> border to create “small rectangle”.
>
> -----------------
> Alex Shatalin
>
>
Re: How to use the side-affixed property? [message #89394 is a reply to message #89334] Thu, 04 January 2007 13:16 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Kalin,

> is a child of the big rectangle and visually it is ok. Unfortunately
> now when I insert the big rectangle in the canvas it is stuck in the
> upper left corner of the canvas and cannot be moved, resized or even
> selected :-(

I can suggest you to investigate this problem a bit more.. You can create
simple mapping (without compartment and figure on the border) and generate
code + create diagram. The if everything works ok you can add border figure..
And then compartment. as a result we'll be able to determine steps forcing
you to this problem. BTW, I suggest you to remove diagram and create new
one each time you modify .gmfmap -> .gmfgen models and regenerate the code
since you are changing diagram structure and existing elements can start
being incorrect..

-----------------
Alex Shatalin
Re: How to use the side-affixed property? [message #89778 is a reply to message #89394] Fri, 05 January 2007 19:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kalin.nakov.gmail.com

This is a multi-part message in MIME format.
--------------010602040200000906040102
Content-Type: text/plain; charset=UTF-7
Content-Transfer-Encoding: 7bit

Hi,

I have created a separate example editor. Here is the situation:

* Without setting side-affixed property everything works fine
* If I set the side affixed property without a compartment everything
works fine
* If I add a compartment with a figure which is a child element of the
master rectangle, the appearance of the symbol is correct, but it is
attached at the upper left corner of the canvas and cannot be moved,
selected, also the whole canvas becomes unusable - no more elements can
be added, modified, etc..
* If I add a compartment with a figure which is not a child element of
the master rectangle, the canvas is editable, but I cannot add small
squares on the border of the master rectangle, because the compartment
figure is stretched and seems to overlap the border. In addition to that
the compartment is no longer collapsible, nevertheless the arrow shows
the opposite.

I cannot live without those compartments, so I desperately need to make
that working. Is there somewhere, anywhere any example on how to use
side-affixed borders of a symbol which has compartments? Attached is a
simple picture of what I want.

Thank you very much in advance!

Alex Shatalin wrote:
> Hello Kalin,
>
>> is a child of the big rectangle and visually it is ok. Unfortunately
>> now when I insert the big rectangle in the canvas it is stuck in the
>> upper left corner of the canvas and cannot be moved, resized or even
>> selected :-(
>
> I can suggest you to investigate this problem a bit more.. You can
> create simple mapping (without compartment and figure on the border) and
> generate code + create diagram. The if everything works ok you can add
> border figure.. And then compartment. as a result we'll be able to
> determine steps forcing you to this problem. BTW, I suggest you to
> remove diagram and create new one each time you modify .gmfmap ->
> .gmfgen models and regenerate the code since you are changing diagram
> structure and existing elements can start being incorrect..
>
> -----------------
> Alex Shatalin
>
>


--------------010602040200000906040102
Content-Type: image/gif;
name="what-i-want.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="what-i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HEfRffbXKd6dMeAauz143WD7jTfhACt+ON9cz/034oE77nHegl/OeMkMd87u 3tcVizbIoy9X
OmRwaw3u5qcXlvpVr1vdW+uOxU736pQLzPrutXvu++/AB8+asMQXb/zxyCev /PLMN+/889BH
L/301Fdv/fXYZ6/99tx37/334Icv/vjkl2/++einr/767Lfv/vvwxy///PTX b//9+Oev//78
9+///wAMoAAHSMACGvCACEygAhfIwAY68IEQjKAEJ0jBClrwghjMoAY3yMEO erAlAQEAOw==
--------------010602040200000906040102--
Re: How to use the side-affixed property? [message #89807 is a reply to message #89778] Fri, 05 January 2007 20:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

Your side affixed element - called BorderItem by the run time - should be
attached to the top level node. That node should extends from
AbstractBorderedShapeEditPart. To get rid of some of the symptoms you
describe, I had to override the following methods:

protected NodeFigure createMainFigure() {
NodeFigure figure = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40),
getMapMode().DPtoLP(40));
figure.setLayoutManager(new StackLayout());
contentPane = new BlockFigure();
figure.add(contentPane);
ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
contentPane.setLayoutManager(layout);
return figure;
}

public IFigure getContentPane() {
if (contentPane != null) {
return contentPane;
}
return super.getContentPane();
}

/*
* our superclass messes this up, not returning the correct content pane
* (non-Javadoc)
*
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBordere dShapeEditPart#getContentPaneFor(org.eclipse.gmf.runtime.dia gram.ui.editparts.IGraphicalEditPart)
*/
protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
if (editPart instanceof IBorderItemEditPart) {
return getBorderedFigure().getBorderItemContainer();
} else {
return getContentPane();
}
}


I've got code that does that, but it hasn't been generated automatically
and it uses GMF 1, maybe Alex can say whether there have been API changes
in the runtime.

If you're interested I can send you some code you could compare to the
generated one to see where the problem is.

cheers,
vlad


On Fri, 05 Jan 2007 21:11:11 +0200, Kalin Nakov wrote:

> Hi,
>
> I have created a separate example editor. Here is the situation:
>
> * Without setting side-affixed property everything works fine
> * If I set the side affixed property without a compartment everything
> works fine
> * If I add a compartment with a figure which is a child element of the
> master rectangle, the appearance of the symbol is correct, but it is
> attached at the upper left corner of the canvas and cannot be moved,
> selected, also the whole canvas becomes unusable - no more elements can
> be added, modified, etc..
> * If I add a compartment with a figure which is not a child element of
> the master rectangle, the canvas is editable, but I cannot add small
> squares on the border of the master rectangle, because the compartment
> figure is stretched and seems to overlap the border. In addition to that
> the compartment is no longer collapsible, nevertheless the arrow shows
> the opposite.
>
> I cannot live without those compartments, so I desperately need to make
> that working. Is there somewhere, anywhere any example on how to use
> side-affixed borders of a symbol which has compartments? Attached is a
> simple picture of what I want.
>
> Thank you very much in advance!
>
> Alex Shatalin wrote:
>> Hello Kalin,
>>
>>> is a child of the big rectangle and visually it is ok. Unfortunately
>>> now when I insert the big rectangle in the canvas it is stuck in the
>>> upper left corner of the canvas and cannot be moved, resized or even
>>> selected :-(
>>
>> I can suggest you to investigate this problem a bit more.. You can
>> create simple mapping (without compartment and figure on the border) and
>> generate code create diagram. The if everything works ok you can add
>> border figure.. And then compartment. as a result we'll be able to
>> determine steps forcing you to this problem. BTW, I suggest you to
>> remove diagram and create new one each time you modify .gmfmap ->
>> .gmfgen models and regenerate the code since you are changing diagram
>> structure and existing elements can start being incorrect..
>>
>> -----------------
>> Alex Shatalin
>>
>>
Re: How to use the side-affixed property? [message #90040 is a reply to message #89778] Sat, 06 January 2007 17:08 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Kalin,

> * If I add a compartment with a figure which is a child element of the
> master rectangle, the appearance of the symbol is correct, but it is
> attached at the upper left corner of the canvas and cannot be moved,
> selected, also the whole canvas becomes unusable - no more elements
> can be added, modified, etc..
Any exceptions in .log file or console? Can you add empty compartment first?
So, there will be "master rectangle" with child reference to "small rectangle"
(affixed) and empty compartment.

> * If I add a compartment with a figure which is not a child element of
> the master rectangle, the canvas is editable, but I cannot add small
Looks like an incorrect configuration. Compartments are just a way to “visually
group” child elements of the node. This means, you can have master rectangle
with several child node references. In addition several compartments can
present in this “master rectangle”. Child nodes could be grouped and visualized
inside corresponding compartments by attaching them to the compartment element
in .gmfmap model. In other words, compartment can reference only child nodes
of it’s parent node.

Side-affixed node is a node located on the border of “master rectangle”.
This not should not be included into any compartments of the “master rectangle”.
AFAIK there should be an audit warning you about this constraint.

> I cannot live without those compartments, so I desperately need to
> make that working. Is there somewhere, anywhere any example on how to
> use side-affixed borders of a symbol which has compartments? Attached
There should be a way to make it working. ;-) First you can try Vlad’s suggestions.
As a sample of elements located on border I can suggest you to have a look
on “org.eclipse.mdt.uml2.diagram.*” plugins. These plugins are created using
GMF and AFAIK side-affixed children are used there together with compartments
(with additional border in main figure).

-----------------
Alex Shatalin
Re: How to use the side-affixed property? [message #90294 is a reply to message #89807] Mon, 08 January 2007 09:07 Go to previous message
Eclipse UserFriend
Originally posted by: kalin.nakov.gmail.com

That solution works pretty well. Thank you very much!

Regards,
Kalin

Vlad Ciubotariu wrote:
> Your side affixed element - called BorderItem by the run time - should be
> attached to the top level node. That node should extends from
> AbstractBorderedShapeEditPart. To get rid of some of the symptoms you
> describe, I had to override the following methods:
>
> protected NodeFigure createMainFigure() {
> NodeFigure figure = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40),
> getMapMode().DPtoLP(40));
> figure.setLayoutManager(new StackLayout());
> contentPane = new BlockFigure();
> figure.add(contentPane);
> ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
> contentPane.setLayoutManager(layout);
> return figure;
> }
>
> public IFigure getContentPane() {
> if (contentPane != null) {
> return contentPane;
> }
> return super.getContentPane();
> }
>
> /*
> * our superclass messes this up, not returning the correct content pane
> * (non-Javadoc)
> *
> * @see org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBordere dShapeEditPart#getContentPaneFor(org.eclipse.gmf.runtime.dia gram.ui.editparts.IGraphicalEditPart)
> */
> protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
> if (editPart instanceof IBorderItemEditPart) {
> return getBorderedFigure().getBorderItemContainer();
> } else {
> return getContentPane();
> }
> }
>
>
> I've got code that does that, but it hasn't been generated automatically
> and it uses GMF 1, maybe Alex can say whether there have been API changes
> in the runtime.
>
> If you're interested I can send you some code you could compare to the
> generated one to see where the problem is.
>
> cheers,
> vlad
>
>
> On Fri, 05 Jan 2007 21:11:11 +0200, Kalin Nakov wrote:
>
>> Hi,
>>
>> I have created a separate example editor. Here is the situation:
>>
>> * Without setting side-affixed property everything works fine
>> * If I set the side affixed property without a compartment everything
>> works fine
>> * If I add a compartment with a figure which is a child element of the
>> master rectangle, the appearance of the symbol is correct, but it is
>> attached at the upper left corner of the canvas and cannot be moved,
>> selected, also the whole canvas becomes unusable - no more elements can
>> be added, modified, etc..
>> * If I add a compartment with a figure which is not a child element of
>> the master rectangle, the canvas is editable, but I cannot add small
>> squares on the border of the master rectangle, because the compartment
>> figure is stretched and seems to overlap the border. In addition to that
>> the compartment is no longer collapsible, nevertheless the arrow shows
>> the opposite.
>>
>> I cannot live without those compartments, so I desperately need to make
>> that working. Is there somewhere, anywhere any example on how to use
>> side-affixed borders of a symbol which has compartments? Attached is a
>> simple picture of what I want.
>>
>> Thank you very much in advance!
>>
>> Alex Shatalin wrote:
>>> Hello Kalin,
>>>
>>>> is a child of the big rectangle and visually it is ok. Unfortunately
>>>> now when I insert the big rectangle in the canvas it is stuck in the
>>>> upper left corner of the canvas and cannot be moved, resized or even
>>>> selected :-(
>>> I can suggest you to investigate this problem a bit more.. You can
>>> create simple mapping (without compartment and figure on the border) and
>>> generate code create diagram. The if everything works ok you can add
>>> border figure.. And then compartment. as a result we'll be able to
>>> determine steps forcing you to this problem. BTW, I suggest you to
>>> remove diagram and create new one each time you modify .gmfmap ->
>>> .gmfgen models and regenerate the code since you are changing diagram
>>> structure and existing elements can start being incorrect..
>>>
>>> -----------------
>>> Alex Shatalin
>>>
>>>
>
Previous Topic:how to install newest GMF milestones
Next Topic:Not Getting the attached Connection Label
Goto Forum:
  


Current Time: Fri Sep 27 04:18:23 GMT 2024

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

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

Back to the top