コード例 #1
0
  // reloads the element on all open panels and adds it to the custom element panel if not already
  // there.
  private void updateElement(Entity element) {

    //		if a new element has been created add it to current diagram
    if (this.originalElement == null) {
      DiagramHandler current = null;
      DrawPanel c = Umlet.getInstance().getGUI().getCurrentDiagram();
      if (c == null) {
        Umlet.getInstance().doNew();
        current = Umlet.getInstance().getGUI().getCurrentDiagram().getHandler();
      } else current = c.getHandler();

      Vector<Entity> ents = current.getDrawPanel().getAllEntities();
      // set location for element
      int x = 10, y = 10;
      for (Entity e : ents) {
        if (e.getY() + e.getHeight() + 10 > y) y = e.getY() + e.getHeight() + 10;
      }

      Rectangle bounds = new Rectangle(x, y, element.getWidth(), element.getHeight());
      this.addElementToDiagram(element, current, true, bounds, element.getState());
    } else { // replace edited element (and ONLY edited element)
      this.originalElement.getHandler().getDrawPanel().remove(this.originalElement);
      this.addElementToDiagram(
          element,
          this.originalElement.getHandler(),
          true,
          this.originalElement.getBounds(),
          this.originalElement.getState());
    }
  }
コード例 #2
0
ファイル: Entity.java プロジェクト: aaronc/UMLet
 public void setManualResized() {
   if (autoresizeandmanualresizeenabled) {
     if (!this.isManResized()) {
       this.setState(this.getState() + Constants.newline + Constants.noautoresize);
       if (this.equals(Umlet.getInstance().getEditedEntity()))
         Umlet.getInstance().setPropertyPanelToEntity(this);
     }
   }
 }
コード例 #3
0
ファイル: SynchBarVertical.java プロジェクト: aaronc/UMLet
  public void paintEntity(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setFont(this.handler.getFont());
    colorize(g2); // enable colors
    g2.setColor(_activeColor);
    this.handler.getFRC(g2);

    int yPos = 0;
    textHeight = 0; // reset

    Vector<String> tmp = Constants.decomposeStrings(this.getPanelAttributes(), "\n");
    textHeight = tmp.size() * (this.handler.getFontsize() + this.handler.getDistTextToText());
    boolean ADAPT_SIZE = false;

    for (int i = 0; i < tmp.size(); i++) {
      String s = (String) tmp.elementAt(i);
      yPos += this.handler.getFontsize();
      TextLayout l = new TextLayout(s, this.handler.getFont(), this.handler.getFRC(g2));
      Rectangle2D r2d = l.getBounds();
      int width = (int) r2d.getWidth();
      if ((this.getWidth() / 2 - width / 2) < 0) {
        ADAPT_SIZE = true;
        break;
      }
      this.handler.writeText(g2, s, this.getWidth() / 2, yPos, true);
      yPos += this.handler.getDistTextToText();
    }

    if (ADAPT_SIZE) {
      (new Resize(this, -Umlet.getInstance().getMainUnit(), 0, 0, 0)).execute(this.handler);
      (new Resize(this, 0, 0, Umlet.getInstance().getMainUnit(), 0)).execute(this.handler);
      return;
    }
    if (yPos > this.getHeight()) {
      (new Resize(this, 0, 0, 0, this.handler.getFontsize() + this.handler.getDistTextToText()))
          .execute(this.handler);
      return;
    }

    g2.fillRect(
        this.getWidth() / 2 - 3,
        textHeight + this.handler.getDistTextToLine(),
        5,
        this.getHeight() - textHeight - this.handler.getDistTextToLine() * 2);
  }
コード例 #4
0
 public boolean closeEntity() {
   if (this.changed) {
     /*          int ch=JOptionPane.showOptionDialog(Umlet.getInstance().getGUI(),"Save changes?","CustomElement",JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE,null, null, null);
     if (ch==JOptionPane.YES_OPTION)
         this.saveEntity();
     else if (ch==JOptionPane.CANCEL_OPTION)
         return false;
     else
      this.setChanged(false);*/
     this.setChanged(false);
   }
   this.stop();
   this.preview.closePreview();
   this.preview.getDrawPanel().getSelector().deselectAll();
   DrawPanel dia = Umlet.getInstance().getGUI().getCurrentDiagram();
   if (dia != null) dia.getSelector().updateSelectorInformation();
   else Umlet.getInstance().setPropertyPanelToEntity(null);
   return true;
 }
コード例 #5
0
 private void setChanged(boolean changed) {
   this.changed = changed;
   Umlet.getInstance().getGUI().setCustomElementChanged(this, changed);
 }
コード例 #6
0
ファイル: AboutWindow.java プロジェクト: aaronc/UMLet
 @Override
 public void setVisible() {
   Umlet.getInstance().getGUI().openDialog("About UMLet", this);
 }
コード例 #7
0
ファイル: AboutWindow.java プロジェクト: aaronc/UMLet
 @Override
 protected String getStartUpFileName() {
   return Umlet.getInstance().getHomePath() + "html/aboutumlet.html";
 }