Пример #1
0
 public ElementMenuEntry(String text, UFont font, SpriteContainer spriteContainer) {
   final FontConfiguration config = new FontConfiguration(font, HtmlColor.BLACK);
   this.block =
       TextBlockUtils.create(
           Arrays.asList(text), config, HorizontalAlignement.LEFT, spriteContainer);
   this.text = text;
 }
Пример #2
0
  public EntityImageUseCase(ILeaf entity, ISkinParam skinParam) {
    super(entity, skinParam);
    final Stereotype stereotype = entity.getStereotype();

    final TextBlock tmp =
        new BodyEnhanced(
            entity.getDisplay(),
            FontParam.USECASE,
            skinParam,
            HorizontalAlignment.CENTER,
            stereotype,
            true,
            false);

    if (stereotype == null || stereotype.getLabel() == null) {
      this.desc = tmp;
    } else {
      final TextBlock stereo =
          TextBlockUtils.create(
              Display.getWithNewlines(stereotype.getLabel()),
              new FontConfiguration(
                  SkinParamUtils.getFont(getSkinParam(), FontParam.ACTOR_STEREOTYPE, stereotype),
                  SkinParamUtils.getFontColor(getSkinParam(), FontParam.ACTOR_STEREOTYPE, null),
                  getSkinParam().getHyperlinkColor()),
              HorizontalAlignment.CENTER,
              skinParam);
      this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER);
    }
    this.url = entity.getUrl99();
  }
Пример #3
0
 public EntityImageUsecase(Entity entity) {
   super(entity);
   this.name =
       TextBlockUtils.create(
           StringUtils.getWithNewlines(entity.getDisplay()),
           new FontConfiguration(getFont14(), Color.BLACK),
           HorizontalAlignement.CENTER);
 }
Пример #4
0
 private TextBlock createTextBloc() {
   final UFont font = skinParam.getFont(FontParam.PACKAGE, null);
   final HtmlColor textColor = skinParam.getFontHtmlColor(FontParam.PACKAGE, null);
   final TextBlock bloc =
       TextBlockUtils.create(
           name, new FontConfiguration(font, textColor), HorizontalAlignement.LEFT);
   return bloc;
 }
Пример #5
0
 public EntityImageDefault(Entity entity) {
   super(entity);
   this.textBlock =
       TextBlockUtils.create(
           entity.getDisplay2(),
           new FontConfiguration(getFont14(), HtmlColor.BLACK),
           HorizontalAlignement.CENTER,
           new SpriteContainerEmpty());
 }
Пример #6
0
 private void manage(UGraphic ug, double x, double y, int n, String last, double pendingX) {
   final double width = n * dayWidth - pendingX;
   ug.draw(x + pendingX, y, new URectangle(width, getHeight()));
   final TextBlock b =
       TextBlockUtils.create(
           Arrays.asList(last), fontConfig, HorizontalAlignement.LEFT, new SpriteContainerEmpty());
   final Dimension2D dimText = b.calculateDimension(ug.getStringBounder());
   final double diffX = width - dimText.getWidth();
   final double diffY = getHeight() - dimText.getHeight();
   b.drawU(ug, x + pendingX + diffX / 2, y + diffY / 2);
 }
Пример #7
0
 private double getQualifierMargin(
     StringBounder stringBounder,
     UFont fontQualif,
     String qualif,
     SpriteContainer spriteContainer) {
   if (qualif != null) {
     final TextBlock b =
         TextBlockUtils.create(
             Arrays.asList(qualif),
             new FontConfiguration(fontQualif, HtmlColorUtils.BLACK),
             HorizontalAlignement.LEFT,
             spriteContainer);
     final Dimension2D dim = b.calculateDimension(stringBounder);
     return Math.max(dim.getWidth(), dim.getHeight());
   }
   return 0;
 }
Пример #8
0
  public EntityImageBlock(
      IEntity entity, Rose rose, ISkinParam param, Collection<Link> links, FontParam titleParam) {
    this.entity = entity;
    this.param = param;
    this.rose = rose;
    this.links = links;

    if (StringUtils.isNotEmpty(entity.getDisplay2())) {
      this.name =
          TextBlockUtils.create(
              entity.getDisplay2(),
              new FontConfiguration(param.getFont(titleParam, null), HtmlColor.BLACK),
              HorizontalAlignement.CENTER,
              param);
    } else {
      this.name = null;
    }
  }
Пример #9
0
  @Override
  protected void drawInternalU(UGraphic ug, Area area) {
    final StringBounder stringBounder = ug.getStringBounder();
    ug =
        ug.apply(new UChangeBackColor(HtmlColorUtils.LIGHT_GRAY))
            .apply(new UChangeColor(HtmlColorUtils.BLACK));
    ug.draw(new URectangle(getPreferredWidth(stringBounder), getPreferredHeight(stringBounder)));

    final String n = type.name();
    final int split = 9;
    final List<String> strings = new ArrayList<String>();
    for (int i = 0; i < n.length(); i += split) {
      strings.add(n.substring(i, Math.min(i + split, n.length())));
    }

    final TextBlock textBlock =
        TextBlockUtils.create(
            Display.create(strings),
            new FontConfiguration(NORMAL, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE),
            HorizontalAlignment.LEFT,
            new SpriteContainerEmpty());
    textBlock.drawU(ug);
  }