/** * End the current {@link TextUnit} and place the {@link Event} on the event queue. * * @return the ended {@link TextUnit} */ public ITextUnit endTextUnit() { return endTextUnit(null, null, null); }
/** * End the current {@link TextUnit} and place the {@link Event} on the event queue. * * @param endMarker * the tag that ends the complex {@link TextUnit} * @return the ended {@link TextUnit} */ public ITextUnit endTextUnit(GenericSkeleton endMarker) { return endTextUnit(endMarker, null, null); }
/** * Start and end a {@link TextUnit}. Also create a TextUnit {@link Event} and add it to the event queue. * * @param text * the text used to prime the {@link TextUnit} */ public void addTextUnit(String text) { startTextUnit(text, null, null, null); endTextUnit(); }
/** * Flush all remaining events from the {@link Event} queues */ public void flushRemainingTempEvents() { if (hasUnfinishedSkeleton()) { endDocumentPart(); } else if (!tempFilterEventStack.isEmpty()) { // go through filtered object stack and close them one by one while (!tempFilterEventStack.isEmpty()) { Event fe = tempFilterEventStack.peek(); if (fe.getEventType() == EventType.START_GROUP) { StartGroup sg = (StartGroup) fe.getResource(); endGroup((GenericSkeleton) sg.getSkeleton()); } else if (fe.getEventType() == EventType.START_SUBFILTER) { StartSubfilter sf = (StartSubfilter) fe.getResource(); endGroup((GenericSkeleton) sf.getSkeleton()); } else if (fe.getEventType() == EventType.TEXT_UNIT) { endTextUnit(); } } } }
/** * Create a {@link DocumentPart} and store it for later processing. * * @param part * the {@link DocumentPart} (aka skeleton) * @return the newly created DocumentPart */ public DocumentPart startDocumentPart(String part) { if (hasUnfinishedSkeleton()) { endDocumentPart(); } else if (isCurrentTextUnit()) { endTextUnit(); } currentSkeleton = new GenericSkeleton(part); currentDocumentPart = new DocumentPart(documentPartId.createId(), false); currentDocumentPart.setSkeleton(currentSkeleton); return currentDocumentPart; }
/** * Create a {@link DocumentPart} that references actionable (i.e., translatable, localizable) properties and store * it for later processing. * * @param part * the {@link DocumentPart} (aka skeleton) * @param name * the name * @param locale * the language of any actionable items * @param propertyTextUnitPlaceholders * the list of actionable {@link TextUnit} or {@link Properties} with offset information into the tag. */ public void startDocumentPart(String part, String name, LocaleId locale, List<PropertyTextUnitPlaceholder> propertyTextUnitPlaceholders) { if (hasUnfinishedSkeleton()) { endDocumentPart(); } else if (isCurrentTextUnit()) { endTextUnit(); } currentSkeleton = new GenericSkeleton(); currentDocumentPart = new DocumentPart(documentPartId.createId(), false); currentDocumentPart.setSkeleton(currentSkeleton); processAllEmbedded(part, locale, propertyTextUnitPlaceholders, false); }