예제 #1
0
  public void initSettingsFromText(NewGridElement element) {
    propertiesTextToDraw = new ArrayList<String>();
    this.elementSettings = element.getSettings();
    this.propCfg = new PropertiesConfig(element.getSettings());

    for (String line : getPanelAttributesAsList()) {
      boolean drawText = true;
      for (Facet gf : elementSettings.getGlobalFacets()) {
        if (gf.checkStart(line)) {
          gf.handleLine(line, drawer, propCfg);
          if (gf.replacesText(line)) drawText = false;
        }
      }
      if (drawText && !line.startsWith("//")) propertiesTextToDraw.add(line);
    }

    handleAutoresize(element);
    this.propCfg.setGridElementSize(element.getRealSize());
  }
예제 #2
0
  private DimensionFloat getExpectedElementDimensionsOnDefaultZoom(NewGridElement element) {
    // add all ypos changes to simulate the real ypos for xlimit calculation etc.
    PropertiesConfig tmpPropCfg =
        new PropertiesConfig(element.getSettings(), element.getRealSize());
    tmpPropCfg.addToYPos(
        calcTopDisplacementToFitLine(calcStartPointFromVAlign(tmpPropCfg), tmpPropCfg));
    handleWordWrapAndIterate(elementSettings, tmpPropCfg, drawer.getPseudoDrawHandler());

    float textHeight =
        tmpPropCfg.getyPos()
            - drawer
                .textHeight(); // subtract last ypos step (because the print-text pos is always on
                               // the bottom)
    return new DimensionFloat(tmpPropCfg.getMaxTextWidth(), textHeight);
  }