Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » NEWBIE: can't see anything
NEWBIE: can't see anything [message #183751] Tue, 07 June 2005 14:25 Go to next message
Eclipse UserFriend
Originally posted by: ilballa.email.it

Hi all,

I tried to create a minimal example of an editor using GEF, but without
much success (is it too minimal ?); the editor is open and I can
correctly draw selection rectangles, but the label does not appear.

Does anyone have a clue of what is wrong ?

Thanks in advance,

Andrea
________________________________________________________

I have a very simple EditPart

public class CompositeEditPart extends AbstractGraphicalEditPart {

protected IFigure createFigure() {
Figure f = new Label("XXX");
f.setOpaque(true);
return f;
}

protected void createEditPolicies() {
// TODO Auto-generated method stub
}

protected void refreshVisuals() {
((Label)getFigure()).setVisible(true);
}
}

Tracing the flow of execution I checked that methods createFigure and
refreshVisuals get executed.

The Editor is also very simple.

public final class CompositeEditor
extends GraphicalEditorWithFlyoutPalette
implements IAdaptable {

/** Removed all palette stuff which works fine */

public CompositeEditor() {
setEditDomain(new DefaultEditDomain(this));
}

protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
ScrollingGraphicalViewer viewer =
(ScrollingGraphicalViewer)getGraphicalViewer();
viewer.setContents(getCompositeEditorInput().getCompositeGui ());
}

protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
ScrollingGraphicalViewer viewer =
(ScrollingGraphicalViewer)getGraphicalViewer();
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setEditPartFactory(new ModelEditPartFactory());
}
}

And the edit part factory is:

public class ModelEditPartFactory implements EditPartFactory {

public EditPart createEditPart(EditPart aContext, Object aModel) {
EditPart part = new CompositeEditPart();
part.setModel(aModel);
return part;
}
}
Re: NEWBIE: can't see anything [message #183765 is a reply to message #183751] Tue, 07 June 2005 15:04 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 161
Registered: July 2009
Senior Member
Maybe the label is too small.
Try label.setPreferredSize(...) in refreshVisuals().

Regards
Hao

"IlBalla" <ilballa@email.it> ???? news:d84asm$is$1@news.eclipse.org...
> Hi all,
>
> I tried to create a minimal example of an editor using GEF, but without
> much success (is it too minimal ?); the editor is open and I can
> correctly draw selection rectangles, but the label does not appear.
>
> Does anyone have a clue of what is wrong ?
>
> Thanks in advance,
>
> Andrea
> ________________________________________________________
>
> I have a very simple EditPart
>
> public class CompositeEditPart extends AbstractGraphicalEditPart {
>
> protected IFigure createFigure() {
> Figure f = new Label("XXX");
> f.setOpaque(true);
> return f;
> }
>
> protected void createEditPolicies() {
> // TODO Auto-generated method stub
> }
>
> protected void refreshVisuals() {
> ((Label)getFigure()).setVisible(true);
> }
> }
>
> Tracing the flow of execution I checked that methods createFigure and
> refreshVisuals get executed.
>
> The Editor is also very simple.
>
> public final class CompositeEditor
> extends GraphicalEditorWithFlyoutPalette
> implements IAdaptable {
>
> /** Removed all palette stuff which works fine */
>
> public CompositeEditor() {
> setEditDomain(new DefaultEditDomain(this));
> }
>
> protected void initializeGraphicalViewer() {
> super.initializeGraphicalViewer();
> ScrollingGraphicalViewer viewer =
> (ScrollingGraphicalViewer)getGraphicalViewer();
> viewer.setContents(getCompositeEditorInput().getCompositeGui ());
> }
>
> protected void configureGraphicalViewer() {
> super.configureGraphicalViewer();
> ScrollingGraphicalViewer viewer =
> (ScrollingGraphicalViewer)getGraphicalViewer();
> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
> viewer.setEditPartFactory(new ModelEditPartFactory());
> }
> }
>
> And the edit part factory is:
>
> public class ModelEditPartFactory implements EditPartFactory {
>
> public EditPart createEditPart(EditPart aContext, Object aModel) {
> EditPart part = new CompositeEditPart();
> part.setModel(aModel);
> return part;
> }
> }
Re: NEWBIE: can't see anything [message #183816 is a reply to message #183751] Wed, 08 June 2005 01:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

In refreshVisuals(), do this:
((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new
Rectangle(50, 50, -1, -1);


"IlBalla" <ilballa@email.it> wrote in message
news:d84asm$is$1@news.eclipse.org...
> Hi all,
>
> I tried to create a minimal example of an editor using GEF, but without
> much success (is it too minimal ?); the editor is open and I can
> correctly draw selection rectangles, but the label does not appear.
>
> Does anyone have a clue of what is wrong ?
>
> Thanks in advance,
>
> Andrea
> ________________________________________________________
>
> I have a very simple EditPart
>
> public class CompositeEditPart extends AbstractGraphicalEditPart {
>
> protected IFigure createFigure() {
> Figure f = new Label("XXX");
> f.setOpaque(true);
> return f;
> }
>
> protected void createEditPolicies() {
> // TODO Auto-generated method stub
> }
>
> protected void refreshVisuals() {
> ((Label)getFigure()).setVisible(true);
> }
> }
>
> Tracing the flow of execution I checked that methods createFigure and
> refreshVisuals get executed.
>
> The Editor is also very simple.
>
> public final class CompositeEditor
> extends GraphicalEditorWithFlyoutPalette
> implements IAdaptable {
>
> /** Removed all palette stuff which works fine */
>
> public CompositeEditor() {
> setEditDomain(new DefaultEditDomain(this));
> }
>
> protected void initializeGraphicalViewer() {
> super.initializeGraphicalViewer();
> ScrollingGraphicalViewer viewer =
> (ScrollingGraphicalViewer)getGraphicalViewer();
> viewer.setContents(getCompositeEditorInput().getCompositeGui ());
> }
>
> protected void configureGraphicalViewer() {
> super.configureGraphicalViewer();
> ScrollingGraphicalViewer viewer =
> (ScrollingGraphicalViewer)getGraphicalViewer();
> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
> viewer.setEditPartFactory(new ModelEditPartFactory());
> }
> }
>
> And the edit part factory is:
>
> public class ModelEditPartFactory implements EditPartFactory {
>
> public EditPart createEditPart(EditPart aContext, Object aModel) {
> EditPart part = new CompositeEditPart();
> part.setModel(aModel);
> return part;
> }
> }
Re: NEWBIE: can't see anything [message #183910 is a reply to message #183816] Wed, 08 June 2005 13:54 Go to previous message
Eclipse UserFriend
Originally posted by: timo.glaesser.gmx.net

The last proposal at least didn't work for me. I think however that the
LayoutManager in the Example given by IlBalla and in mine is missing,
but I can't find where to set it. I would like to use the
DirectedGraphLayout.

Timo&*


Pratik Shah wrote:
> In refreshVisuals(), do this:
> ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new
> Rectangle(50, 50, -1, -1);
>
>
> "IlBalla" <ilballa@email.it> wrote in message
> news:d84asm$is$1@news.eclipse.org...
>>Hi all,
>>
>>I tried to create a minimal example of an editor using GEF, but without
>>much success (is it too minimal ?); the editor is open and I can
>>correctly draw selection rectangles, but the label does not appear.
>>
>>Does anyone have a clue of what is wrong ?
>>
>>Thanks in advance,
>>
>>Andrea
>>________________________________________________________
>>
>>I have a very simple EditPart
>>
>>public class CompositeEditPart extends AbstractGraphicalEditPart {
>>
>>protected IFigure createFigure() {
>> Figure f = new Label("XXX");
>> f.setOpaque(true);
>> return f;
>>}
>>
>>protected void createEditPolicies() {
>> // TODO Auto-generated method stub
>>}
>>
>>protected void refreshVisuals() {
>> ((Label)getFigure()).setVisible(true);
>>}
>>}
>>
>>Tracing the flow of execution I checked that methods createFigure and
>>refreshVisuals get executed.
>>
>>The Editor is also very simple.
>>
>>public final class CompositeEditor
>> extends GraphicalEditorWithFlyoutPalette
>>implements IAdaptable {
>>
>>/** Removed all palette stuff which works fine */
>>
>>public CompositeEditor() {
>> setEditDomain(new DefaultEditDomain(this));
>>}
>>
>>protected void initializeGraphicalViewer() {
>> super.initializeGraphicalViewer();
>> ScrollingGraphicalViewer viewer =
>> (ScrollingGraphicalViewer)getGraphicalViewer();
>> viewer.setContents(getCompositeEditorInput().getCompositeGui ());
>>}
>>
>>protected void configureGraphicalViewer() {
>> super.configureGraphicalViewer();
>> ScrollingGraphicalViewer viewer =
>> (ScrollingGraphicalViewer)getGraphicalViewer();
>> viewer.setRootEditPart(new ScalableFreeformRootEditPart());
>> viewer.setEditPartFactory(new ModelEditPartFactory());
>>}
>>}
>>
>>And the edit part factory is:
>>
>>public class ModelEditPartFactory implements EditPartFactory {
>>
>>public EditPart createEditPart(EditPart aContext, Object aModel) {
>> EditPart part = new CompositeEditPart();
>> part.setModel(aModel);
>> return part;
>>}
>>}
>
>
Previous Topic:Debugging view activation errors
Next Topic:Outline View icons
Goto Forum:
  


Current Time: Sat Sep 21 20:47:17 GMT 2024

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

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

Back to the top