当前位置: 首页>>代码示例>>Java>>正文


Java JSVGCanvas.setDocumentState方法代码示例

本文整理汇总了Java中org.apache.batik.swing.JSVGCanvas.setDocumentState方法的典型用法代码示例。如果您正苦于以下问题:Java JSVGCanvas.setDocumentState方法的具体用法?Java JSVGCanvas.setDocumentState怎么用?Java JSVGCanvas.setDocumentState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.batik.swing.JSVGCanvas的用法示例。


在下文中一共展示了JSVGCanvas.setDocumentState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCanvasHandler

import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
public JSVGCanvasHandler createCanvasHandler() {
    return new JSVGCanvasHandler(this, this) {
            public JSVGCanvas createCanvas() {
                JSVGCanvas ret = new JSVGCanvas();
                ret.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
                return ret;
            }
        };
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:10,代码来源:TextSelectionTest.java

示例2: noViewDemo

import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
private static void noViewDemo() {
  JFrame frame = new JFrame("Svg Awt Demo");
  frame.setLayout(new BorderLayout());

  JSVGCanvas svgCanvas = new JSVGCanvas();
  svgCanvas.setDocumentState(AbstractJSVGComponent.ALWAYS_DYNAMIC);

  final SvgSvgElement svgRoot = DemoModel.createModel();
  SvgRootDocumentMapper mapper = new SvgRootDocumentMapper(svgRoot);
  mapper.attachRoot();

  svgCanvas.setSVGDocument(mapper.getTarget());

  svgCanvas.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      super.mouseClicked(e);
      DemoModel.addCircle(svgRoot, e.getX(), e.getY());
    }
  });

  frame.add(svgCanvas);
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  frame.setSize(800, 600);
  frame.setVisible(true);
}
 
开发者ID:JetBrains,项目名称:jetpad-projectional-open-source,代码行数:27,代码来源:AwtDemo.java

示例3: createDiagramPanel

import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
private JPanel createDiagramPanel(Workflow workflow) {
	final JPanel diagramPanel = new JPanel(new BorderLayout());

	// get the default diagram settings
	Alignment alignment = Alignment.valueOf(graphViewConfiguration
			.getProperty(ALIGNMENT));
	PortStyle portStyle = PortStyle.valueOf(graphViewConfiguration
			.getProperty(PORT_STYLE));
	boolean animationEnabled = Boolean.parseBoolean(graphViewConfiguration
			.getProperty(ANIMATION_ENABLED));
	int animationSpeed = Integer.parseInt(graphViewConfiguration
			.getProperty(ANIMATION_SPEED));

	// create an SVG canvas
	final JSVGCanvas svgCanvas = new JSVGCanvas(null, true, false);
	svgCanvas.setEnableZoomInteractor(false);
	svgCanvas.setEnableRotateInteractor(false);
	svgCanvas.setDocumentState(ALWAYS_DYNAMIC);
	svgCanvas.setTransferHandler(new ServiceTransferHandler(editManager,
			menuManager, selectionManager, serviceRegistry));

	AutoScrollInteractor asi = new AutoScrollInteractor(svgCanvas);
	svgCanvas.addMouseListener(asi);
	svgCanvas.addMouseMotionListener(asi);

	final JSVGScrollPane svgScrollPane = new MySvgScrollPane(svgCanvas);

	GVTTreeRendererAdapter gvtTreeRendererAdapter = new GVTTreeRendererAdapter() {
		@Override
		public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
			logger.info("Rendered svg");
			svgScrollPane.reset();
			diagramPanel.revalidate();
		}
	};
	svgCanvas.addGVTTreeRendererListener(gvtTreeRendererAdapter);

	// create a graph controller
	SVGGraphController svgGraphController = new SVGGraphController(
			workflow, selectionManager.getSelectedProfile(), false,
			svgCanvas, alignment, portStyle, editManager, menuManager,
			colourManager, workbenchConfiguration);
	svgGraphController.setDataflowSelectionModel(selectionManager
			.getDataflowSelectionModel(workflow.getParent()));
	svgGraphController.setAnimationSpeed(animationEnabled ? animationSpeed
			: 0);

	graphControllerMap.put(workflow, svgGraphController);

	// Toolbar with actions related to graph
	JToolBar graphActionsToolbar = graphActionsToolbar(workflow,
			svgGraphController, svgCanvas, alignment, portStyle);
	graphActionsToolbar.setAlignmentX(LEFT_ALIGNMENT);
	graphActionsToolbar.setFloatable(false);

	// Panel to hold the toolbars
	JPanel toolbarPanel = new JPanel();
	toolbarPanel.setLayout(new BoxLayout(toolbarPanel, PAGE_AXIS));
	toolbarPanel.add(graphActionsToolbar);

	diagramPanel.add(toolbarPanel, NORTH);
	diagramPanel.add(svgScrollPane, CENTER);

	// JTextField workflowHierarchy = new JTextField(workflow.getName());
	// diagramPanel.add(workflowHierarchy, BorderLayout.SOUTH);

	return diagramPanel;
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:69,代码来源:GraphViewComponent.java

示例4: GraphPanel

import org.apache.batik.swing.JSVGCanvas; //导入方法依赖的package包/类
public GraphPanel(KinDiagramPanel kinDiagramPanel, final ArbilWindowManager arbilWindowManager, SessionStorage sessionStorage, ArbilDataNodeLoader dataNodeLoader) {
        this.kinDiagramPanel = kinDiagramPanel;
        this.dialogHandler = arbilWindowManager;
        this.sessionStorage = sessionStorage;
        this.dataNodeLoader = dataNodeLoader;
//        this.entityCollection = entityCollection;
        dataStoreSvg = new DataStoreSvg();
        entitySvg = new EntitySvg(dialogHandler);
        dataStoreSvg.setDefaults();
        svgUpdateHandler = new SvgUpdateHandler(this, kinDiagramPanel, dialogHandler);
        selectedGroupId = new ArrayList<UniqueIdentifier>();
        graphPanelSize = new GraphPanelSize();
        this.setLayout(new BorderLayout());
        boolean eventsEnabled = true;
        boolean selectableText = false;
        svgCanvas = new JSVGCanvas(new GraphUserAgent(this, dialogHandler, dataNodeLoader), eventsEnabled, selectableText);
//        svgCanvas.setMySize(new Dimension(600, 400));
        svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
//        drawNodes();
        svgCanvas.setEnableImageZoomInteractor(false);
        svgCanvas.setEnablePanInteractor(false);
        svgCanvas.setEnableRotateInteractor(false);
        svgCanvas.setEnableZoomInteractor(false);
        svgCanvas.addMouseWheelListener(new MouseWheelListener() {
            public void mouseWheelMoved(final MouseWheelEvent e) {
                UpdateManager updateManager = svgCanvas.getUpdateManager();
                if (updateManager != null) {
                    updateManager.getUpdateRunnableQueue().invokeLater(new Runnable() {
                        public void run() {
                            double scale = 1 - e.getUnitsToScroll() / 10.0;
                            double tx = -e.getX() * (scale - 1);
                            double ty = -e.getY() * (scale - 1);
//                                System.out.println("scale: " + scale);
//                                System.out.println("scale: " + svgCanvas.getRenderingTransform().getScaleX());
                            AffineTransform at = new AffineTransform();
                            if (e.isAltDown()) {
                                at.translate(tx, ty);
                                at.scale(scale, scale);
                            } else if (e.isShiftDown()) {
                                at.translate(-tx, 0);
                            } else {
                                at.translate(0, -ty);
                            }
                            at.concatenate(svgCanvas.getRenderingTransform());
//                                System.out.println("new scale: " + at.getScaleX());
                            if (at.getScaleX() > 0.1) {
                                svgCanvas.setRenderingTransform(at);
                            }
                        }
                    });
                }
                e.consume();
                //  show a ToolTip or StatusBar to give hints "Hold modifier + mouse wheel to zoom"
                GraphPanel.this.kinDiagramPanel.setStatusBarText("hint: alt + mouse wheel to zoom; shift + mouse wheel to pan; mouse wheel to scroll.");
            }
        });
//        svgCanvas.setEnableResetTransformInteractor(true);
//        svgCanvas.setDoubleBufferedRendering(true); // todo: look into reducing the noticable aliasing on the canvas

        jSVGScrollPane = new JSVGScrollPane(svgCanvas);
//        svgCanvas.setBackground(Color.LIGHT_GRAY);
        this.add(BorderLayout.CENTER, jSVGScrollPane);
    }
 
开发者ID:KinshipSoftware,项目名称:KinOathKinshipArchiver,代码行数:64,代码来源:GraphPanel.java


注:本文中的org.apache.batik.swing.JSVGCanvas.setDocumentState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。