Hi Mark,

this is how it's done in ActionSaveAllGraphics:

        for (Project p : ProjectManager.getManager().getOpenProjects()) {
            TargetManager tm = TargetManager.getInstance();
            for (ArgoDiagram d : p.getDiagramList()) {
                tm.setTarget(d);
                if (!trySaveDiagram(d, dir)) {
                    result = false;
                }
            }
        }

HTH,
Thomas

-------- Original-Nachricht --------
> Datum: Thu, 30 Jul 2009 08:11:28 -0700
> Von: Mark Fortner <[email protected]>
> An: [email protected]
> Betreff: [argouml-dev] Selecting a Diagram

> I recently updated my local copy of argouml-app to the latest version in
> the
> trunk, and began retesting the argoprint module.  Somewhere along the line
> a
> recent change was made that now prevents us from being able to select a
> diagram. The following utility method in DiagramUtils is used to render a
> diagram as inline svg.
> 
> public static String getDiagramAsSVG(ArgoDiagram diagram){
>         // this is ugly, but it is the only way for now.
>         // we need to simulate that the diagram is active,
>         // then we save our graphics, and lately we leave all as it was
>         // before.
>         final ArgoDiagram activeDiagram = DiagramUtils.getActiveDiagram();
>         TargetManager.getInstance().setTarget(diagram);
> 
>         ByteArrayOutputStream buff = new ByteArrayOutputStream();
>         Editor ce = Globals.curEditor();
>         Layer layer = ce.getLayerManager().getActiveLayer();
>         Rectangle drawingArea = layer.calcDrawingArea();
>         try {
>             SvgWriter writer = new SvgWriter(buff, drawingArea, true);
>             if (writer != null) {
>                 ce.print(writer);
>                 writer.dispose();
>             }
>         } catch (IOException e) {
>             e.printStackTrace();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>         TargetManager.getInstance().setTarget(activeDiagram);
>         return buff.toString();
>     }
> 
> It seems that when we set the diagram using
> "TargetManager.getInstance().setTarget(diagram);" and then attempt to get
> the diagram as a layer using "Layer layer =
> ce.getLayerManager().getActiveLayer();" that all we get now is the
> currently
> displayed diagram.
> 
> As a result, instead of iterating through each diagram and outputting the
> diagram as SVG in our template, we get the same diagram over and over
> again.
> 
> Is there a new way of selecting a diagram and returning it as a layer that
> we should be using?
> 
> -- 
> Mark Fortner
> 
> blog: http://feeds.feedburner.com/jroller/ideafactory
> 
> ------------------------------------------------------
> http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2377004
> 
> To unsubscribe from this discussion, e-mail:
> [[email protected]].
> To be allowed to post to the list contact the mailing list moderator,
> email: [[email protected]]

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=450&dsMessageId=2377336

To unsubscribe from this discussion, e-mail: 
[[email protected]].
To be allowed to post to the list contact the mailing list moderator, email: 
[[email protected]]

Reply via email to