コード例 #1
0
 private void addElementToDiagram(
     Entity e, DiagramHandler d, boolean setchanged, Rectangle bounds, String state) {
   Entity e2 = e.CloneFromMe();
   e2.assignToDiagram(d);
   e2.setState(state);
   e2.setBounds(bounds);
   d.getDrawPanel().add(e2);
   if (setchanged) d.setChanged(true);
 }
コード例 #2
0
  private void updatePreview(Entity e) {
    if (e != null) {
      Vector<Entity> entities = this.preview.getDrawPanel().getAllEntities();
      if (entities.size() > 0) {
        e.setBounds(entities.get(0).getBounds());
        e.setState(entities.get(0).getState());
        if (this.preview.getDrawPanel().getSelector().getSelectedEntities().size() > 0)
          this.preview.getDrawPanel().getSelector().singleSelectWithoutUpdatePropertyPanel(e);
        this.preview.getDrawPanel().remove(entities.get(0));
      }

      e.assignToDiagram(this.preview);
      this.preview.getDrawPanel().add(e);
      e.repaint();
    }
  }