當前位置: 首頁>>代碼示例>>Java>>正文


Java EditPart.refresh方法代碼示例

本文整理匯總了Java中org.eclipse.gef.EditPart.refresh方法的典型用法代碼示例。如果您正苦於以下問題:Java EditPart.refresh方法的具體用法?Java EditPart.refresh怎麽用?Java EditPart.refresh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.gef.EditPart的用法示例。


在下文中一共展示了EditPart.refresh方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: deepRefresh

import org.eclipse.gef.EditPart; //導入方法依賴的package包/類
/**
 * Refresh {@link EditPart} in depth.
 */
private void deepRefresh() {
	refresh();
	for (Branch branch : getModelChildren()) {
		final EditPart branchEditPart = (EditPart)getViewer().getEditPartRegistry().get(branch);
		branchEditPart.refresh();
		for (Choice choice : branch.getChoices()) {
			final EditPart choiceEditPart = (EditPart)getViewer().getEditPartRegistry().get(choice);
			choiceEditPart.refresh();
			for (PossibleStep possibleStep : choice.getPossibleSteps()) {
				final EditPart possibleStepEditPart = (EditPart)getViewer().getEditPartRegistry().get(
						possibleStep);
				possibleStepEditPart.refresh();
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:20,代碼來源:TimelineWindowEditPart.java

示例2: createImage

import org.eclipse.gef.EditPart; //導入方法依賴的package包/類
public static ImageInfo createImage(final GraphicalViewer viewer, final int format, final String path) {
    GC figureCanvasGC = null;
    GC imageGC = null;

    try {
        final ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) viewer.getRootEditPart();
        rootEditPart.refresh();
        final IFigure rootFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);

        final EditPart editPart = viewer.getContents();
        editPart.refresh();
        final ERDiagram diagram = (ERDiagram) editPart.getModel();

        final Rectangle rootFigureBounds = getBounds(diagram, rootEditPart, rootFigure.getBounds());

        final Control figureCanvas = viewer.getControl();
        figureCanvasGC = new GC(figureCanvas);

        final Image img = new Image(Display.getCurrent(), rootFigureBounds.width + 20, rootFigureBounds.height + 20);
        imageGC = new GC(img);

        imageGC.setBackground(figureCanvasGC.getBackground());
        imageGC.setForeground(figureCanvasGC.getForeground());
        imageGC.setFont(figureCanvasGC.getFont());
        imageGC.setLineStyle(figureCanvasGC.getLineStyle());
        imageGC.setLineWidth(figureCanvasGC.getLineWidth());
        imageGC.setAntialias(SWT.OFF);
        // imageGC.setInterpolation(SWT.HIGH);

        final Graphics imgGraphics = new SWTGraphics(imageGC);
        imgGraphics.setBackgroundColor(figureCanvas.getBackground());
        imgGraphics.fillRectangle(0, 0, rootFigureBounds.width + 20, rootFigureBounds.height + 20);

        final int translateX = translateX(rootFigureBounds.x);
        final int translateY = translateY(rootFigureBounds.y);

        imgGraphics.translate(translateX, translateY);

        rootFigure.paint(imgGraphics);

        final Map<TableView, Location> tableLoacationMap = getTableLocationMap(rootEditPart, translateX, translateY, diagram);

        final ImageInfo imageInfo = new ImageInfo(img, tableLoacationMap);
        imageInfo.setFormat(format);
        imageInfo.setPath(path);

        return imageInfo;

    } finally {
        if (figureCanvasGC != null) {
            figureCanvasGC.dispose();
        }
        if (imageGC != null) {
            imageGC.dispose();
        }
    }
}
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:58,代碼來源:ImageInfo.java

示例3: createImage

import org.eclipse.gef.EditPart; //導入方法依賴的package包/類
public static ImageInfo createImage(GraphicalViewer viewer, int format,
		String path) {
	GC figureCanvasGC = null;
	GC imageGC = null;

	try {
		ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) viewer
				.getRootEditPart();
		rootEditPart.refresh();
		IFigure rootFigure = ((LayerManager) rootEditPart)
				.getLayer(LayerConstants.PRINTABLE_LAYERS);

		EditPart editPart = viewer.getContents();
		editPart.refresh();
		ERDiagram diagram = (ERDiagram) editPart.getModel();

		Rectangle rootFigureBounds = getBounds(diagram, rootEditPart,
				rootFigure.getBounds());

		Control figureCanvas = viewer.getControl();
		figureCanvasGC = new GC(figureCanvas);

		Image img = new Image(Display.getCurrent(),
				rootFigureBounds.width + 20, rootFigureBounds.height + 20);
		imageGC = new GC(img);

		imageGC.setBackground(figureCanvasGC.getBackground());
		imageGC.setForeground(figureCanvasGC.getForeground());
		imageGC.setFont(figureCanvasGC.getFont());
		imageGC.setLineStyle(figureCanvasGC.getLineStyle());
		imageGC.setLineWidth(figureCanvasGC.getLineWidth());
		imageGC.setAntialias(SWT.OFF);
		// imageGC.setInterpolation(SWT.HIGH);

		Graphics imgGraphics = new SWTGraphics(imageGC);
		imgGraphics.setBackgroundColor(figureCanvas.getBackground());
		imgGraphics.fillRectangle(0, 0, rootFigureBounds.width + 20,
				rootFigureBounds.height + 20);

		int translateX = translateX(rootFigureBounds.x);
		int translateY = translateY(rootFigureBounds.y);

		imgGraphics.translate(translateX, translateY);

		rootFigure.paint(imgGraphics);

		Map<TableView, Location> tableLoacationMap = getTableLocationMap(
				rootEditPart, translateX, translateY, diagram);

		ImageInfo imageInfo = new ImageInfo(img, tableLoacationMap);
		imageInfo.setFormat(format);
		imageInfo.setPath(path);

		return imageInfo;

	} finally {
		if (figureCanvasGC != null) {
			figureCanvasGC.dispose();
		}
		if (imageGC != null) {
			imageGC.dispose();
		}
	}
}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:65,代碼來源:ImageInfo.java


注:本文中的org.eclipse.gef.EditPart.refresh方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。