Exemple #1
0
 public HtmlColor getHtmlColor(ColorParam param, String stereotype) {
   if (stereotype != null) {
     checkStereotype(stereotype);
     final String value2 = getValue(param.name() + "color" + stereotype);
     if (value2 != null && HtmlColor.isValid(value2)) {
       return HtmlColor.getColorIfValid(value2);
     }
   }
   final String value = getValue(param.name() + "color");
   if (value == null || HtmlColor.isValid(value) == false) {
     return null;
   }
   return HtmlColor.getColorIfValid(value);
 }
  @Override
  protected CommandExecutionResult executeArg(List<String> arg) {
    final String pos = arg.get(0);
    final Entity note = getSystem().createNote("GN" + UniqueSequence.getValue(), arg.get(2));
    note.setSpecificBackcolor(HtmlColor.getColorIfValid(arg.get(1)));

    IEntity activity = getSystem().getLastEntityConsulted();
    if (activity == null) {
      activity = getSystem().getStart();
    }

    final Position position =
        Position.valueOf(pos.toUpperCase()).withRankdir(getSystem().getRankdir());
    final Link link;

    final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getDashed();
    if (position == Position.RIGHT) {
      link = new Link(activity, note, type, null, 1);
    } else if (position == Position.LEFT) {
      link = new Link(note, activity, type, null, 1);
    } else if (position == Position.BOTTOM) {
      link = new Link(activity, note, type, null, 2);
    } else if (position == Position.TOP) {
      link = new Link(note, activity, type, null, 2);
    } else {
      throw new IllegalArgumentException();
    }
    getSystem().addLink(link);
    return CommandExecutionResult.ok();
  }
 @Override
 protected CommandExecutionResult executeArg(List<String> arg) {
   final String code;
   final String display;
   if (arg.get(1) == null) {
     if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0)).length() == 0) {
       code = "##" + UniqueSequence.getValue();
       display = null;
     } else {
       code = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0));
       display = code;
     }
   } else {
     display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0));
     code = arg.get(1);
   }
   final Group currentPackage = getSystem().getCurrentGroup();
   // if (getSystem().entityExist(code)) {
   // return CommandExecutionResult.error("Package cannot have the same
   // name as an existing class");
   // }
   final Group p =
       getSystem().getOrCreateGroup(code, display, null, GroupType.PACKAGE, currentPackage);
   p.setBold(true);
   final String color = arg.get(2);
   if (color != null) {
     p.setBackColor(HtmlColor.getColorIfValid(color));
   }
   return CommandExecutionResult.ok();
 }
Exemple #4
0
 public HtmlColor getFontHtmlColor(FontParam param, String stereotype) {
   String value = null;
   if (stereotype != null) {
     checkStereotype(stereotype);
     value = getValue(param.name() + "fontcolor" + stereotype);
   }
   if (value == null || HtmlColor.isValid(value) == false) {
     value = getValue(param.name() + "fontcolor");
   }
   if (value == null || HtmlColor.isValid(value) == false) {
     value = getValue("defaultfontcolor");
   }
   if (value == null || HtmlColor.isValid(value) == false) {
     value = param.getDefaultColor();
   }
   return HtmlColor.getColorIfValid(value);
 }
abstract class AbstractEntityImage {

  private final IEntity entity;

  private final HtmlColor red = HtmlColor.getColorIfValid("#A80036");

  private final HtmlColor yellow = HtmlColor.getColorIfValid("#FEFECE");
  private final HtmlColor yellowNote = HtmlColor.getColorIfValid("#FBFB77");

  private final UFont font14 = new UFont("SansSerif", Font.PLAIN, 14);
  private final UFont font17 = new UFont("Courier", Font.BOLD, 17);
  private final HtmlColor green = HtmlColor.getColorIfValid("#ADD1B2");
  private final HtmlColor violet = HtmlColor.getColorIfValid("#B4A7E5");
  private final HtmlColor blue = HtmlColor.getColorIfValid("#A9DCDF");
  private final HtmlColor rose = HtmlColor.getColorIfValid("#EB937F");

  public AbstractEntityImage(IEntity entity) {
    if (entity == null) {
      throw new IllegalArgumentException("entity null");
    }
    this.entity = entity;
  }

  public abstract Dimension2D getDimension(StringBounder stringBounder);

  public abstract void draw(ColorMapper colorMapper, Graphics2D g2d);

  protected final IEntity getEntity() {
    return entity;
  }

  protected final HtmlColor getRed() {
    return red;
  }

  protected final HtmlColor getYellow() {
    return yellow;
  }

  protected final UFont getFont17() {
    return font17;
  }

  protected final UFont getFont14() {
    return font14;
  }

  protected final HtmlColor getGreen() {
    return green;
  }

  protected final HtmlColor getViolet() {
    return violet;
  }

  protected final HtmlColor getBlue() {
    return blue;
  }

  protected final HtmlColor getRose() {
    return rose;
  }

  protected final HtmlColor getYellowNote() {
    return yellowNote;
  }
}