Setting SnapToGrid [message #245381] |
Mon, 08 September 2008 13:29 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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);
> ...
> }
> ...
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03037 seconds