NEWBIE: can't see anything [message #183751] |
Tue, 07 June 2005 14:25 |
Eclipse User |
|
|
|
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 #183816 is a reply to message #183751] |
Wed, 08 June 2005 01:05 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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;
>>}
>>}
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04067 seconds