protected final void doActionPerformed(ActionEvent evt) {
    try {
      ApplicationDiagram diag =
          (ApplicationDiagram) (ApplicationContext.getFocusManager().getFocusObject());
      Point clickPosition = getDiagramLocation(evt);
      if (clickPosition == null)
        clickPosition = GraphicUtil.rectangleGetCenter(diag.getMainView().getViewRect());
      java.awt.Image image = SRSystemClipboard.getClipboardImage();
      if (image == null) return;
      DbObject diagGo = diag.getDiagramGO();
      Db db = diagGo.getDb();

      ImageIcon icon = new ImageIcon(image);
      int imageHeigth = icon.getIconHeight();
      int imageWidth = icon.getIconWidth();

      db.beginTrans(Db.WRITE_TRANS, LocaleMgr.action.getString("pasteDiagramImage"));

      DbObject imageGo = diagGo.createComponent(DbGraphic.fImageGoDiagramImage.getMetaClass());
      imageGo.set(DbGraphic.fImageGoDiagramImage, image);
      imageGo.set(
          DbGraphic.fGraphicalObjectRectangle,
          new Rectangle(
              clickPosition.x - (imageWidth / 2),
              clickPosition.y - (imageHeigth / 2),
              imageWidth,
              imageHeigth));
      db.commitTrans();
    } catch (Exception e) {
      org.modelsphere.jack.util.ExceptionHandler.processUncatchedException(
          ApplicationContext.getDefaultMainFrame(), e);
    }
  }
 public static String getItemName(ApplicationDiagram diag) {
   if (diag.getMainView().hasPageBreak()) return LocaleMgr.action.getString("hidePageBreaks");
   else return LocaleMgr.action.getString("showPageBreaks");
 }
 protected final void doActionPerformed() {
   ApplicationDiagram diag =
       (ApplicationDiagram) ApplicationContext.getFocusManager().getFocusObject();
   DiagramView view = diag.getMainView();
   view.setPageBreak(!view.hasPageBreak());
 }
  public boolean expand(Writer output, Serializable object, Rule.RuleOptions options)
      throws IOException, RuleException {
    boolean expanded = false;

    try {
      DbORTableGo tableGo = (DbORTableGo) object;
      DbORDiagram diagram = (DbORDiagram) tableGo.getComposite();
      ;
      GraphicComponent gc;
      Rectangle rect;
      Point origin;

      DefaultMainFrame frame = null;
      try {
        Class claz = Class.forName("org.modelsphere.sms.MainFrame"); // NOT LOCALIZABLE
        java.lang.reflect.Method method =
            claz.getDeclaredMethod("getSingleton", new Class[] {}); // NOT LOCALIZABLE
        frame = (DefaultMainFrame) method.invoke(null, new Object[] {});
      } catch (Exception ex) {
        ex.printStackTrace(System.out);
      }
      DiagramInternalFrame diagramInternalFrame = frame.getDiagramInternalFrame(diagram);
      ApplicationDiagram appDiagram;
      boolean deleteApplicationDiagram = false;

      if (diagramInternalFrame == null) {
        DbSemanticalObject so = (DbSemanticalObject) diagram.getComposite();
        SMSToolkit kit = SMSToolkit.getToolkit(so);
        appDiagram =
            new ApplicationDiagram(
                so, diagram, kit.createGraphicalComponentFactory(), frame.getDiagramsToolGroup());
        deleteApplicationDiagram = true;
      } else {
        appDiagram = diagramInternalFrame.getDiagram();
      }

      gc = (GraphicComponent) tableGo.getGraphicPeer();
      rect = (Rectangle) gc.getRectangle().clone();
      origin =
          new Point(
              GraphicComponent.LINE_BOLD_WIDTH - appDiagram.getContentRect().x,
              GraphicComponent.LINE_BOLD_WIDTH - appDiagram.getContentRect().y);

      if (deleteApplicationDiagram) {
        appDiagram.delete();
      }

      rect.translate(origin.x, origin.y);

      if (prefixModifier != null) {
        prefixModifier.expand(output, object, options);
      }

      // write the converted text
      output.write(
          rect.x + "," + rect.y + "," + (rect.x + rect.width) + "," + (rect.y + rect.height));
      expanded = true;

      if (suffixModifier != null) {
        suffixModifier.expand(output, object, options);
      }

    } catch (DbException ex) {
      throw new RuleException(ex.getMessage());
    }

    return expanded;
  }