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


Java JSVGCanvas类代码示例

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


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

示例1: FindDialog

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
/**
 * Constructs a new <code>FindDialog</code>.
 */
public FindDialog(Frame owner, JSVGCanvas svgCanvas) {
    super(owner, resources.getString("Dialog.title"));
    this.svgCanvas = svgCanvas;

    buttonFactory = new ButtonFactory(bundle, this);

    listeners.put(FIND_ACTION,
                  new FindButtonAction());

    listeners.put(CLEAR_ACTION,
                  new ClearButtonAction());

    listeners.put(CLOSE_ACTION,
                  new CloseButtonAction());

    JPanel p = new JPanel(new BorderLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    p.add(createFindPanel(), BorderLayout.CENTER);
    p.add(createShowResultPanel(), BorderLayout.SOUTH);

    getContentPane().add(p, BorderLayout.CENTER);
    getContentPane().add(createButtonsPanel(), BorderLayout.SOUTH);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:27,代码来源:FindDialog.java

示例2: ThumbnailDialog

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
/**
 * Constructs a new <code>ThumbnailDialog</code> for the specified canvas.
 *
 * @param owner the owner frame
 * @param svgCanvas the canvas that owns the SVG document to display
 */
public ThumbnailDialog(Frame owner, JSVGCanvas svgCanvas) {
    super(owner, resources.getString("Dialog.title"));

    addWindowListener(new ThumbnailListener());

    // register listeners to maintain consistency
    this.svgCanvas = svgCanvas;
    svgCanvas.addGVTTreeRendererListener(new ThumbnailGVTListener());
    svgCanvas.addSVGDocumentLoaderListener(new ThumbnailDocumentListener());
    svgCanvas.addComponentListener(new ThumbnailCanvasComponentListener());

    // create the thumbnail
    svgThumbnailCanvas = new JGVTComponent();
    overlay = new AreaOfInterestOverlay();
    svgThumbnailCanvas.getOverlays().add(overlay);
    svgThumbnailCanvas.setPreferredSize(new Dimension(150, 150));
    svgThumbnailCanvas.addComponentListener(new ThumbnailComponentListener());
    aoiListener = new AreaOfInterestListener();
    svgThumbnailCanvas.addMouseListener(aoiListener);
    svgThumbnailCanvas.addMouseMotionListener(aoiListener);
    getContentPane().add(svgThumbnailCanvas, BorderLayout.CENTER);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:ThumbnailDialog.java

示例3: run

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
@Override
public void run() {
	WorkflowBundle currentDataflow = fileManager.getCurrentDataflow();
	if (currentDataflow == null)
		return;
	SVGGraphController graphController = (SVGGraphController) graphView
			.getGraphController(currentDataflow.getMainWorkflow());
	if (graphController == null)
		return;
	JSVGCanvas svgCanvas = graphController.getSVGCanvas();
	Object dataflowSource = fileManager
			.getDataflowSource(currentDataflow);
	if (utils.currentDataflowIsComponent())
		svgCanvas.setBorder(new ComponentBorder(
				(Version.ID) dataflowSource));
	else
		svgCanvas.setBorder(null);
	svgCanvas.repaint();
}
 
开发者ID:apache,项目名称:incubator-taverna-plugin-component,代码行数:20,代码来源:FileManagerObserver.java

示例4: 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

示例5: NotationComposite

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
public NotationComposite(Composite parent, SVGDocument initImage) {
	super(parent, SWT.EMBEDDED);

	canvas = new JSVGCanvas();
	canvas.setSVGDocument(initImage);
	canvas.setLayout(new BorderLayout());
       frame = SWT_AWT.new_Frame(this);
       
       Panel panel = new Panel();
	JRootPane rootPane = new JRootPane();
	panel.add(rootPane);
	java.awt.Container contentPane = rootPane.getContentPane();
	contentPane.setLayout(new BorderLayout());
	contentPane.add(BorderLayout.CENTER, new JScrollPane(canvas));
	
	frame.setLayout(new BorderLayout());
	frame.add(BorderLayout.CENTER, panel);
	frame.setEnabled(true);
}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:20,代码来源:NotationComposite.java

示例6: 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

示例7: canvasDone

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
public void canvasDone(JSVGCanvas canvas) {
    synchronized (this) {
        done = true;
        if (failReport != null)
            return;

        try {
            // Get the base image
            BufferedImage theImage = copyImage(canvas.getOffScreen());

            // Capture the overlays
            List overlays = canvas.getOverlays();

            // Paint the overlays
            Graphics2D g = theImage.createGraphics();
            Iterator it = overlays.iterator();
            while (it.hasNext()) {
                ((Overlay)it.next()).paint(g);
            }

            saveImage(theImage, fos);
        } catch (IOException ioe) {
            StringWriter trace = new StringWriter();
            ioe.printStackTrace(new PrintWriter(trace));
            DefaultTestReport report = new DefaultTestReport(this);
            report.setErrorCode(ERROR_SAVE_FAILED);
            report.setDescription(new TestReport.Entry[] { 
                new TestReport.Entry
                (fmt(ENTRY_KEY_ERROR_DESCRIPTION, null),
                 fmt(ERROR_SAVE_FAILED, 
                     new Object[]{ srcURL.toString(),
                                   trace.toString()}))
            });
            report.setPassed(false);
            failReport = report;
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:39,代码来源:JSVGRenderingAccuracyTest.java

示例8: JSVG

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
public JSVG(String url) {
    super(url);
    JSVGCanvas canvas = new JSVGCanvas(new SVGUserAgentGUIAdapter(this),
                                       true, true) {
            /**
             * This method is called when the component knows the desired
             * size of the window (based on width/height of outermost SVG
             * element). We override it to immediately pack this frame.
             */
            public void setMySize(Dimension d) {
                setPreferredSize(d);
                invalidate();
                JSVG.this.pack();
            }
        };

    getContentPane().add(canvas, BorderLayout.CENTER);
    canvas.setURI(url);
    setVisible(true);
    addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                windowCount--;
                if (windowCount == 0)
                    System.exit(0);
            }
        });
    windowCount++;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:29,代码来源:JSVG.java

示例9: display

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
public void display() {
    SVGDocument doc = this.getSvgDoc();
    JSVGCanvas canvas = new JSVGCanvas();
    org.w3c.dom.Element root = doc.getDocumentElement();
    this.getRoot(root);
    JFrame f = new JFrame();
    f.getContentPane().add(canvas);
    canvas.setSVGDocument(doc);
    f.pack();
    f.setVisible(true);
    //f.dispose();
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:13,代码来源:SvgFactory.java

示例10: showDialog

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
/**
 * TODO
 * 
 * @param chart
 * @param svgCanvas
 */
public static void showDialog(final FireChartSVG chart, final JSVGCanvas svgCanvas) {
	
	SeriesListDialog dialog = new SeriesListDialog(chart, svgCanvas);
	dialog.setLocationRelativeTo(svgCanvas);
	
	dialog.setVisible(true);
}
 
开发者ID:petebrew,项目名称:fhaes,代码行数:14,代码来源:SeriesListDialog.java

示例11: SVGGraphController

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
public SVGGraphController(Workflow dataflow, Profile profile,
		boolean interactive, JSVGCanvas svgCanvas, EditManager editManager,
		MenuManager menuManager, ColourManager colourManager,
		WorkbenchConfiguration workbenchConfiguration) {
	super(dataflow, profile, interactive, svgCanvas, editManager,
			menuManager, colourManager);
	this.svgCanvas = svgCanvas;
	this.workbenchConfiguration = workbenchConfiguration;
	installUpdateManager();
	layoutSVGDocument(svgCanvas.getBounds());
	svgCanvas.setDocument(getSVGDocument());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:13,代码来源:SVGGraphController.java

示例12: createWorkflowGraphic

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
/**
 * Creates an SVGCanvas loaded with the SVGDocument for the Dataflow.
 *
 * @param dataflow
 * @return
 */
private JSVGCanvas createWorkflowGraphic(Workflow worklfow) {
	JSVGCanvas svgCanvas = new JSVGCanvas();
	//SVGGraphController graphController = GraphViewComponent.graphControllerMap.get(workflow);
	//if (graphController != null) {
	// 	SVGDocument svgDoc = graphController.getSVGDocument();
	// 	svgCanvas.setDocument((SVGDocument) svgDoc.cloneNode(true));
	//}
	return svgCanvas;
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:16,代码来源:WorkflowLaunchWindow.java

示例13: graphActionsToolbar

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
protected JToolBar graphActionsToolbar(String workflowRun, JSVGCanvas svgCanvas) {
	JToolBar toolBar = new JToolBar();
	toolBar.setAlignmentX(LEFT_ALIGNMENT);
	toolBar.setFloatable(false);

	JButton resetDiagramButton = new JButton();
	resetDiagramButton.setBorder(new EmptyBorder(0, 2, 0, 2));
	JButton zoomInButton = new JButton();
	zoomInButton.setBorder(new EmptyBorder(0, 2, 0, 2));
	JButton zoomOutButton = new JButton();
	zoomOutButton.setBorder(new EmptyBorder(0, 2, 0, 2));

	Action resetDiagramAction = svgCanvas.new ResetTransformAction();
	ResetDiagramAction.setResultsAction(resetDiagramAction);
	resetDiagramAction.putValue(SHORT_DESCRIPTION, "Reset Diagram");
	resetDiagramAction.putValue(SMALL_ICON, refreshIcon);
	resetDiagramButton.setAction(resetDiagramAction);

	Action zoomInAction = svgCanvas.new ZoomAction(1.2);
	ZoomInAction.setResultsAction(zoomInAction);
	zoomInAction.putValue(SHORT_DESCRIPTION, "Zoom In");
	zoomInAction.putValue(SMALL_ICON, zoomInIcon);
	zoomInButton.setAction(zoomInAction);

	Action zoomOutAction = svgCanvas.new ZoomAction(1 / 1.2);
	ZoomOutAction.setResultsAction(zoomOutAction);
	zoomOutAction.putValue(SHORT_DESCRIPTION, "Zoom Out");
	zoomOutAction.putValue(SMALL_ICON, zoomOutIcon);
	zoomOutButton.setAction(zoomOutAction);

	// diagramActionsMap.put(workflowRun, new Action[] { resetDiagramAction, zoomInAction,
	// zoomOutAction });

	toolBar.add(resetDiagramButton);
	toolBar.add(zoomInButton);
	toolBar.add(zoomOutButton);

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

示例14: createMainComponent

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
@Override
protected JComponent createMainComponent() {
    //scene = new Scene();
    //JScrollPane scenePane = new JScrollPane(scene.createView());
    JSVGCanvas svgCanvas = new JSVGCanvas();
    svgCanvas.setEnableImageZoomInteractor(true);
    svgCanvas.setEnablePanInteractor(true);
    svgCanvas.setEnableZoomInteractor(true);
    return svgCanvas;
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:11,代码来源:DrawingTopComponent.java

示例15: documentLoaded

import org.apache.batik.swing.JSVGCanvas; //导入依赖的package包/类
@Override
public void documentLoaded() {
    JSVGCanvas svgCanvas = (JSVGCanvas) getMainComponent();
    Document document = (Document) getDataObject().getDocument();
    svgCanvas.setDocument(document);
    svgCanvas.putClientProperty("print.printable", Boolean.TRUE);
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:8,代码来源:DrawingTopComponent.java


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