org.eclipse.draw2d.parts.ScrollableThumbnail Java Examples

The following examples show how to use org.eclipse.draw2d.parts.ScrollableThumbnail. 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: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void showThumbnail() {
	if (quickMode) {
		return;
	}
	// RootEditPart�̃r���[���\�[�X�Ƃ��ăT���l�C�����쐬
	ScalableFreeformRootEditPart editPart = (ScalableFreeformRootEditPart) this.graphicalViewer
			.getRootEditPart();

	if (this.thumbnail != null) {
		this.thumbnail.deactivate();
	}

	this.thumbnail = new ScrollableThumbnail((Viewport) editPart
			.getFigure());
	this.thumbnail.setSource(editPart
			.getLayer(LayerConstants.PRINTABLE_LAYERS));

	this.lws.setContents(this.thumbnail);

}
 
Example #2
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void showThumbnail() {
    if (quickMode) {
        return;
    }
    final ScalableFreeformRootEditPart editPart = (ScalableFreeformRootEditPart) graphicalViewer.getRootEditPart();
    if (thumbnail != null) {
        thumbnail.deactivate();
    }
    this.thumbnail = new ScrollableThumbnail((Viewport) editPart.getFigure());
    thumbnail.setSource(editPart.getLayer(LayerConstants.PRINTABLE_LAYERS));
    lws.setContents(thumbnail);
}
 
Example #3
Source File: SankeyMiniViewAction.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	Composite composite = createForm(parent);
	createScale(composite);
	Canvas canvas = new Canvas(composite, SWT.BORDER);
	canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	LightweightSystem lws = new LightweightSystem(canvas);
	ScrollableThumbnail thumbnail = createThumbnail();
	lws.setContents(thumbnail);
	viewer.getControl().addDisposeListener((e) -> {
		if (!closed)
			close();
	});
	return super.createContents(parent);
}
 
Example #4
Source File: SankeyMiniViewAction.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private ScrollableThumbnail createThumbnail() {
	Viewport port = (Viewport) part.getFigure();
	IFigure figure = part.getLayer(LayerConstants.PRINTABLE_LAYERS);
	ScrollableThumbnail thumbnail = new ScrollableThumbnail(port);
	thumbnail.setSource(figure);
	return thumbnail;
}
 
Example #5
Source File: OpenMiniatureViewAction.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
private void refresh() {
	thumbnail = new ScrollableThumbnail(port);
	thumbnail.setSource(figure);
	lws.setContents(thumbnail);
}
 
Example #6
Source File: OpenMiniatureViewAction.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {
	FormToolkit toolkit = new FormToolkit(Display.getCurrent());
	ScrolledForm scrolledForm = toolkit.createScrolledForm(parent);
	Composite body = scrolledForm.getBody();
	body.setLayout(new FillLayout());
	toolkit.paintBordersFor(body);

	SashForm sashForm = new SashForm(body, SWT.VERTICAL);
	toolkit.adapt(sashForm, true, true);

	Section categorySection = toolkit
			.createSection(sashForm, ExpandableComposite.NO_TITLE
					| ExpandableComposite.EXPANDED);
	categorySection.setText("");
	Composite composite = toolkit.createComposite(categorySection,
			SWT.NONE);
	composite.setLayout(new GridLayout());
	categorySection.setClient(composite);
	toolkit.paintBordersFor(composite);
	final Scale scale = new Scale(composite, SWT.NONE);
	scale.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	final double[] values = GraphConfig.ZOOM_LEVELS;
	final int increment = 100 / (values.length - 1);
	scale.setIncrement(increment);
	scale.setMinimum(0);
	scale.setMaximum(100);
	Controls.onSelect(scale, (e) -> {
		zoomManager.setZoom(values[scale.getSelection() / increment]);
	});
	scale.setSelection(increment * (values.length - 1) / 2);
	Canvas canvas = new Canvas(composite, SWT.BORDER);
	canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	lws = new LightweightSystem(canvas);
	thumbnail = new ScrollableThumbnail(port);
	thumbnail.setSource(figure);
	lws.setContents(thumbnail);
	disposeListener = new DisposeListener() {

		@Override
		public void widgetDisposed(final DisposeEvent e) {
			if (thumbnail != null) {
				thumbnail.deactivate();
				thumbnail = null;
			}
			if (control != null && !control.isDisposed())
				control.removeDisposeListener(disposeListener);
			close();
		}
	};
	control.addDisposeListener(disposeListener);
	return super.createContents(parent);
}