Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » using Rulers
using Rulers [message #216294] Wed, 17 May 2006 00:06 Go to next message
Damian Biollo is currently offline Damian BiolloFriend
Messages: 19
Registered: July 2009
Junior Member
Hi there,

I was wondering if there are any sample apps that demonstrate the use of GEF
rulers.

I've hooked them up using the RulerComposite and RulerProvider, however it
seems very limited in what can be customized. Maybe I'm missing something,
but most implementation methods or classes are private.

Ideally I would like to be able to enh or modify rulers to make them
comparable to the rulers in Office products.
At the very least I'd like to be able to prevent guidelines from being added
to the rulers (ie clicking on the ruler should not show a guideline).

Thanks
Damian
Re: using Rulers [message #216774 is a reply to message #216294] Wed, 24 May 2006 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cmahoney.ca.ibm.com

Damian,

The Eclipse GMF project uses GEF rulers. You could take a look at the GMF
code if you wanted to see if that helps any.

Regards,
Cherie

"Damian" <damian_biollo@hotmail.com> wrote in message
news:e4dper$fpc$1@utils.eclipse.org...
> Hi there,
>
> I was wondering if there are any sample apps that demonstrate the use of
GEF
> rulers.
>
> I've hooked them up using the RulerComposite and RulerProvider, however it
> seems very limited in what can be customized. Maybe I'm missing something,
> but most implementation methods or classes are private.
>
> Ideally I would like to be able to enh or modify rulers to make them
> comparable to the rulers in Office products.
> At the very least I'd like to be able to prevent guidelines from being
added
> to the rulers (ie clicking on the ruler should not show a guideline).
>
> Thanks
> Damian
>
>
Re: using Rulers [message #216899 is a reply to message #216294] Fri, 26 May 2006 19:57 Go to previous message
J Aaron Farr is currently offline J Aaron FarrFriend
Messages: 18
Registered: July 2009
Junior Member
Damian wrote:
> Hi there,
>
> I was wondering if there are any sample apps that demonstrate the use of GEF
> rulers.
>
> I've hooked them up using the RulerComposite and RulerProvider, however it
> seems very limited in what can be customized. Maybe I'm missing something,
> but most implementation methods or classes are private.
>
> Ideally I would like to be able to enh or modify rulers to make them
> comparable to the rulers in Office products.
> At the very least I'd like to be able to prevent guidelines from being added
> to the rulers (ie clicking on the ruler should not show a guideline).

I ended up writing my own simpler ruler implementation using just
Draw2D. There's really no way (as I can see) that one can significantly
customize the existing GEF ruler implementation without accessing and
extending internal classes.

Moreover, the GEF implementation of the rulers use GEF. That is, you
end up with three GraphicalViewers -- one for each ruler and the main
viewer for your own GEF canvas. Unless you really need the "edit"
capabilities of GEF for the rulers, you can just as easily draw them
using draw2D. The trickiest part is implementing the scroll bar
listeners. Here's an example:

class ScrollListener implements Listener {

ScrollBar bar;
FigureCanvas canvas; // this is the RULER canvas
Composite c; // this is your center composite
// GEF viewer or otherwise
boolean h = false;

public ScrollListener(FigureCanvas fc,
Composite comp,boolean horizontal){
h = horizontal;
canvas = fc;
c = comp;
bar = h? c.getHorizontalBar() : c.getVerticalBar();
}

public void handleEvent(Event event) {
int s = bar.getSelection();

// account for the trim of the scroll bars
if(!h && c.getHorizontalBar() != null &&
c.getHorizontalBar().isVisible()){
s -= c.getHorizontalBar().getSize().y;
}

// scroll the ruler canvas
if(h)
canvas.scrollToX(s);
else
canvas.scrollToY(s);
}

}

jaaron
Previous Topic:ediagram example src
Next Topic:Drag and drop inside and outside a viewer
Goto Forum:
  


Current Time: Thu Apr 25 23:19:40 GMT 2024

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

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

Back to the top