Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Setting SnapToGrid
Setting SnapToGrid [message #245381] Mon, 08 September 2008 13:29 Go to next message
Eclipse UserFriend
Originally posted by: ardiangunawan.yahoo.com

Hello,
I tried to extend the Shape editor using SnapToGrid.
It works, but I would like to set the grid size to bigger size (let's
say 24x24 pixels) and set the color to light green.
is it possible? thank you for any help....

regards,
Ardian
Re: Setting SnapToGrid [message #245389 is a reply to message #245381] Tue, 09 September 2008 04:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lifesting.gmail.com

Ardian Eko wrote:
> Hello,
> I tried to extend the Shape editor using SnapToGrid.
> It works, but I would like to set the grid size to bigger size (let's
> say 24x24 pixels) and set the color to light green.
> is it possible? thank you for any help....
>
> regards,
> Ardian
Customize GridLayer before return in ScalableFreeformRootEditPart as blow:

public class XXXEditor extends GraphicalEditorWithFlyoutPalette {
....
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer)
getGraphicalViewer();
ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart(){
@Override
protected GridLayer createGridLayer() {
return new GridLayer(){
{
setForegroundColor(ColorConstants.lightGreen);
}
@Override
protected void paintFigure(Graphics graphics) {
FigureUtilities.paintGrid(graphics, this, origin, 24, 24);
}
};
}
};
viewer.setRootEditPart(root);
....
}
....
}
Re: Setting SnapToGrid [message #245394 is a reply to message #245389] Tue, 09 September 2008 08:38 Go to previous message
Eclipse UserFriend
Originally posted by: ardiangunawan.yahoo.com

Thanks a lot for your help.
It works perfectly as expected..... Thanks...

regards,
Ardian

David BY Chan schrieb:
> Ardian Eko wrote:
>> Hello,
>> I tried to extend the Shape editor using SnapToGrid.
>> It works, but I would like to set the grid size to bigger size (let's
>> say 24x24 pixels) and set the color to light green.
>> is it possible? thank you for any help....
>>
>> regards,
>> Ardian
> Customize GridLayer before return in ScalableFreeformRootEditPart as blow:
>
> public class XXXEditor extends GraphicalEditorWithFlyoutPalette {
> ...
> protected void configureGraphicalViewer() {
> super.configureGraphicalViewer();
> ScrollingGraphicalViewer viewer = (ScrollingGraphicalViewer)
> getGraphicalViewer();
> ScalableFreeformRootEditPart root = new
> ScalableFreeformRootEditPart(){
> @Override
> protected GridLayer createGridLayer() {
> return new GridLayer(){
> {
> setForegroundColor(ColorConstants.lightGreen);
> }
> @Override
> protected void paintFigure(Graphics graphics) {
> FigureUtilities.paintGrid(graphics, this,
> origin, 24, 24);
> }
> };
> }
> };
> viewer.setRootEditPart(root);
> ...
> }
> ...
> }
Previous Topic:How to make width of palette persistent
Next Topic:Selection Behavior like Marquee behavior
Goto Forum:
  


Current Time: Thu Mar 28 11:46:20 GMT 2024

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

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

Back to the top