Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [ZEST]Zoom to a rectangle area
[ZEST]Zoom to a rectangle area [message #247851] Sat, 21 March 2009 02:35 Go to next message
Eclipse UserFriend
Originally posted by: zzhangh.cn.ibm.com

Hi,
What I'm trying to achieve is to display a large graph.
Does zest supports letting user select an area on the canvas and zoom to that area? and thumbnail as well?
If not, can you shed some lights on how best to implement this, thanks!

Regards,
Hao
Re: [ZEST]Zoom to a rectangle area [message #248814 is a reply to message #247851] Wed, 06 May 2009 00:42 Go to previous message
Tiago Proenca is currently offline Tiago ProencaFriend
Messages: 6
Registered: July 2009
Junior Member
I have a code for implementing a thumbnail directly in a view... to use,
uou can extend ThumbnailView in the following way:

public class DummieView extends ThumbnailView{

/** */
//private Graph graph;
int level = 0;

/* (non-Javadoc)
* @see
edu.uci.lighthouse.ui.views.ThumbnailView#createPartControl( org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);

final Graph graph = new Graph(parent, SWT.None);
graph.setLayoutAlgorithm(new
SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);

// Set the parameters for the thumbnail view
setViewport(graph.getViewport());
setSource(graph.getContents());
setMainComposite(graph);
}
}
xx-------------------------------------------xx

public class ThumbnailView extends ViewPart{

/** */
Composite composite;

/** */
FigureCanvas thumbnail;

/** */
ScrollableThumbnail tb;

/* (non-Javadoc)
* @see
org.eclipse.ui.part.WorkbenchPart#createPartControl(org.ecli pse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
FormData data;
parent.setLayout(new FormLayout());
data = new FormData();
data.top = new FormAttachment(100,-130);
data.left = new FormAttachment(100,-130);
data.right = new FormAttachment(100,-30);
data.bottom = new FormAttachment(100,-30);

thumbnail = new FigureCanvas(parent, SWT.NONE);
thumbnail.setBackground(ColorConstants.white);
thumbnail.setLayoutData(data);

tb = new ScrollableThumbnail();
tb.setBorder(new LineBorder(1));
thumbnail.setContents(tb);
}

/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
if (composite != null){
composite.setFocus();
}
}

/**
* @param port
*/
protected void setViewport(Viewport port){
if (tb != null) {
tb.setViewport(port);
}
}

/**
* @param fig
*/
protected void setSource(IFigure fig){
if (tb != null){
tb.setSource(fig);
}
}

/**
* @param composite
*/
protected void setMainComposite(Composite composite){
FormData data = new FormData();
data.top = new FormAttachment(0,0);
data.left = new FormAttachment(0,0);
data.right = new FormAttachment(100,0);
data.bottom = new FormAttachment(100,0);
composite.setLayoutData(data);
this.composite = composite;
}
}

Hao Zhang wrote:
> Hi,
> What I'm trying to achieve is to display a large graph.
> Does zest supports letting user select an area on the canvas and zoom to that area? and thumbnail as well?
> If not, can you shed some lights on how best to implement this, thanks!
>
> Regards,
> Hao
Previous Topic:[Announce] GEF 3.5.0 I200905041850 is available
Next Topic:Arguments contra GMF and pro GEF
Goto Forum:
  


Current Time: Fri Apr 19 05:07:09 GMT 2024

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

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

Back to the top