private void embeddedReadonlyProp(INameable resource, PropertyTextUnitPlaceholder propOrText, String tag, LocaleId locId) { setPropertyBasedOnLocale(resource, locId, new Property(propOrText.getName(), propOrText.getValue(), true)); currentSkeleton.add(tag.substring(propOrText.getMainStartPos(), propOrText.getMainEndPos())); }
/** * Appends an existing list placeholders to this text run. * @param text optional text to add to the run * @param offset the offset of the placeholders (added to the start / end) * @param propertyTextUnitPlaceholders The existing placeholders to add. */ public void appendWithPropertyTextUnitPlaceholders(String text, int offset, List<PropertyTextUnitPlaceholder> propertyTextUnitPlaceholders) { if ( text != null ) this.text.append(text); for(PropertyTextUnitPlaceholder p : propertyTextUnitPlaceholders) { p.setMainStartPos(p.getMainStartPos()+offset); p.setMainEndPos(p.getMainEndPos()+offset); p.setValueStartPos(p.getValueStartPos()+offset); p.setValueEndPos(p.getValueEndPos()+offset); if (this.propertyTextUnitPlaceholders==null) this.propertyTextUnitPlaceholders = new ArrayList<PropertyTextUnitPlaceholder>(); this.propertyTextUnitPlaceholders.add(p); } }
private void embeddedWritableProp(INameable resource, PropertyTextUnitPlaceholder propOrText, String tag, LocaleId locale) { setPropertyBasedOnLocale(resource, locale, new Property(propOrText.getName(), propOrText.getValue(), false)); currentSkeleton.add(tag.substring(propOrText.getMainStartPos(), propOrText.getValueStartPos())); currentSkeleton.addValuePlaceholder(resource, propOrText.getName(), locale); currentSkeleton.add(tag.substring(propOrText.getValueEndPos(), propOrText.getMainEndPos())); }
PropertyTextUnitPlaceholder pt1 = propertyTextUnitPlaceholders.get(propOrTextId - 1); PropertyTextUnitPlaceholder pt2 = propertyTextUnitPlaceholders.get(propOrTextId); currentSkeleton.add(tag.substring(pt1.getMainEndPos(), pt2.getMainStartPos())); currentSkeleton.add(tag.substring(pt.getMainEndPos()));
private ITextUnit embeddedTextUnit(PropertyTextUnitPlaceholder propOrText, String tag) { ITextUnit tu = new TextUnit(textUnitId.createId(), propOrText.getValue()); tu.setPreserveWhitespaces(this.preserveWhitespace); tu.setMimeType(propOrText.getMimeType()); tu.setIsReferent(true); tu.setType(propOrText.getElementType() == null ? propOrText.getName() : propOrText.getElementType()); GenericSkeleton skel = new GenericSkeleton(); skel.add(tag.substring(propOrText.getMainStartPos(), propOrText.getValueStartPos())); skel.addContentPlaceholder(tu); skel.add(tag.substring(propOrText.getValueEndPos(), propOrText.getMainEndPos())); tu.setSkeleton(skel); postProcessTextUnit(tu); return tu; }