Package org.openbp.cockpit.modeler.drawing

Examples of org.openbp.cockpit.modeler.drawing.WorkspaceDrawingView


   * @return The new region
   */
  protected ViewDropRegion createNodeDropRegion(String regionId, List flavors)
  {
    // We are a region
    WorkspaceDrawingView view = getDrawing().getView();

    RectangularShape shape = presentationFigure.createRectangularShape();
    Rectangle r = presentationFigure.displayBox();
    r = view.applyScale(r, false);
    shape.setFrame(r);

    Color color = ModelerColors.DROP_REGION;
    if (flavors.contains(ModelerFlavors.COLOR))
      color = null;
View Full Code Here


    {
      PluginMgr.getInstance().removeInstance(modeler);
      return null;
    }

    WorkspaceDrawingView view = new WorkspaceDrawingView(modeler);
    view.setDrawing(modeler.getDrawing());
    view.setScaleFactor(scaleFactor);

    ImageExporter imageExporter = null;
    try
    {
      // Generate SVG content
      DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
      SVGDocument svgDocument = (SVGDocument) domImpl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg", null);

      // Second, create an instance of the generator.
      // The generator will use the domFactory to create the various SVG elements.
      SVGGraphics2D generator = new SVGGraphics2D(svgDocument);

      int width = view.getWidth();
      int height = view.getHeight();
      if (width != 0 && height != 0)
      {
        width = CommonUtil.rnd(width * scaleFactor);
        height = CommonUtil.rnd(height * scaleFactor);
        generator.setSVGCanvasSize(new Dimension(width, height));
      }
      generator.scale(scaleFactor, scaleFactor);

      // Turn on antialiasing
      generator.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      generator.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      generator.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
      generator.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
      generator.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);

      // Draw the image
      view.drawShadow(generator);
      view.drawDrawing(generator);
      view.drawHandles(generator);

      // Populate the document root with the generated SVG content.
      generator.getRoot(svgDocument.getDocumentElement());

      // Create the image
      imageExporter = new ImageExporter(svgDocument, generator.getSVGCanvasSize());
    }
    finally
    {
      // Cleanup
      view.unregister();
      PluginMgr.getInstance().removeInstance(modeler);
    }

    return imageExporter;
  }
View Full Code Here

  /**
   * @see org.openbp.jaspira.gui.plugin.AbstractVisiblePlugin#initializeComponents()
   */
  protected void initializeComponents()
  {
    workspaceView = new WorkspaceDrawingView(this);

    // We don't need no oversize for a one-node workspace (to prevent unnessecary scrolling)
    workspaceView.setSizeOffset(0);

    // This is just temporary; will be reinitialized when calling setNode
View Full Code Here

    }

    if (accept)
    {
      // We are a region
      WorkspaceDrawingView view = getDrawing().getView();

      Rectangle r;
      if (iconFigure != null)
      {
        r = iconFigure.displayBox();
      }
      else if (titleFigure != null)
      {
        r = titleFigure.displayBox();
      }
      else
      {
        r = new Rectangle();
      }
      r = view.applyScale(r, false);

      ViewDropRegion region = new ViewDropRegion("global", this, r, view);
      region.setPaint(ModelerColors.DROP_REGION);
      return Collections.singletonList(region);
    }
View Full Code Here

  public List getDropRegions(List flavors, Transferable data, MouseEvent mouseEvent)
  {
    if (flavors.contains(ModelerFlavors.COLOR))
    {
      // Use the whole figure as target
      WorkspaceDrawingView view = getDrawing().getView();
      Rectangle r = view.applyScale(displayBox(), false);
      return Collections.singletonList(new ViewDropRegion(REGION_COLOR, this, r, view));
    }

    return null;
  }
View Full Code Here

    return null;
  }

  public List getImportersAt(Point p)
  {
    WorkspaceDrawingView view = getDrawing().getView();

    Point docPoint = SwingUtil.convertFromGlassCoords(p, view);
    if (containsPoint(docPoint.x, docPoint.y))
      return Collections.singletonList(new Importer(REGION_COLOR, this, new DataFlavor[]
      {
View Full Code Here

    if (je.getSourcePlugin() == modeler)
    {
      boolean flipableSelected = false;

      // Check if the selection contains something that is flipable
      WorkspaceDrawingView workspaceView = modeler.getDrawingView();
      if (workspaceView != null)
      {
        List selectedFigures = workspaceView.selection();

        int n = selectedFigures.size();
        if (n > 0)
        {
          for (int i = 0; i < n; ++i)
View Full Code Here

      modeler.focusPlugin();

      ProcessElementContainer pec = modeler.getDrawing().getFigureByQualifier(qualifier);
      if (pec != null)
      {
        WorkspaceDrawingView view = modeler.getDrawingView();
        view.singleSelect(pec);
      }

      return EVENT_CONSUMED;
    }
View Full Code Here

  {
    if (modeler.getPluginComponent().isShowing())
    {
      double factor = ((Double) je.getObject()).doubleValue();

      WorkspaceDrawingView view = modeler.getDrawingView();
      view.setScaleFactor(factor);
      view.redraw();
      view.revalidate();

      modeler.focusPlugin();

      return EVENT_CONSUMED;
    }
View Full Code Here

  {
    // Update the tag state of all tags
    int state = ViewModeMgr.getInstance().getTagState(modeler);
    modeler.getDrawing().setTagState(state);

    WorkspaceDrawingView view = modeler.getDrawingView();

    // Clear the selection in order to prevent having invisible objects selected
    view.clearSelection();

    // Redraw to reflect the changes
    view.redraw();

    return EVENT_HANDLED;
  }
View Full Code Here

TOP

Related Classes of org.openbp.cockpit.modeler.drawing.WorkspaceDrawingView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.