org.eclipse.draw2d.FreeformViewport Java Examples

The following examples show how to use org.eclipse.draw2d.FreeformViewport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomSubprocessShapeCompartmentFigure.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureFigure(IMapMode mm) {
	ScrollPane scrollpane = getScrollPane();
	if(scrollpane==null){
		scrollpane = scrollPane = new ScrollPane();
	}
	scrollpane.setViewport(new FreeformViewport());
	scrollPane.setScrollBarVisibility(ScrollPane.NEVER);
	scrollPane.setVerticalScrollBar(null);
	scrollpane.setLayoutManager(new ScrollPaneLayout() );

	IFigure contents = new BorderItemsAwareFreeFormLayer();
	contents.setLayoutManager(new FreeFormLayoutEx());
	scrollpane.setContents(contents);

	int MB = mm.DPtoLP(0);
	scrollpane.setBorder(new MarginBorder(MB, MB,MB, MB));
	int W_SZ = mm.DPtoLP(10);
	int H_SZ = mm.DPtoLP(10);
	scrollpane.setMinimumSize(new Dimension(W_SZ, H_SZ));

	this.setFont(FONT_TITLE);
}
 
Example #2
Source File: CustomShapeCompartmentFigure.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void configureFigure(IMapMode mm) {
    ScrollPane scrollpane = getScrollPane();
    if (scrollpane == null) {
        scrollpane = scrollPane = new ScrollPane();
    }
    scrollpane.setViewport(new FreeformViewport());
    scrollPane.setScrollBarVisibility(ScrollPane.NEVER);
    scrollPane.setVerticalScrollBar(null);
    scrollpane.setLayoutManager(new ScrollPaneLayout());

    IFigure contents = new BorderItemsAwareFreeFormLayer();
    contents.setLayoutManager(new FreeFormLayoutEx());
    scrollpane.setContents(contents);

    int MB = mm.DPtoLP(0);
    scrollpane.setBorder(new MarginBorder(MB, MB, MB, MB));
    int W_SZ = mm.DPtoLP(10);
    int H_SZ = mm.DPtoLP(10);
    scrollpane.setMinimumSize(new Dimension(W_SZ, H_SZ));

    this.setFont(FONT_TITLE);
}
 
Example #3
Source File: ZoomAction.java    From JDeodorant with MIT License 5 votes vote down vote up
private void scaleToFit(){
	if(isFreeform){
		FreeformViewport viewport = (FreeformViewport) freeformRoot.getParent();
		Rectangle viewArea = viewport.getClientArea();

		this.freeformRoot.setScale(1);
		Rectangle rootArea = freeformRoot.getFreeformExtent().union(0,0);

		double wScale = ((double) viewArea.width)/rootArea.width;
		double hScale = ((double) viewArea.height)/rootArea.height;
		double newScale = Math.min(wScale, hScale);

		this.freeformRoot.setScale(newScale);
	}
}