Exemple #1
0
 public static synchronized Title getTitle(Section section) throws ExlpXpathNotFoundException {
   for (Object o : section.getContent()) {
     if (o instanceof Title) {
       return (Title) o;
     }
   }
   throw new ExlpXpathNotFoundException("No " + Title.class.getSimpleName() + " in this section");
 }
  public void render(Section section) throws OfxAuthoringException {

    // Rekursiver Aufruf des Sectionrenderers, um verschiedene Ebenen (z.B. Untertitel) anzuzeigen
    for (Object o : section.getContent()) {
      if (o instanceof Title) {
        renderTitle((Title) o, lvl);
      }
    }

    // Prüfung auf Inhalt
    for (Object o : section.getContent()) {
      if (o instanceof Section) {
        renderSection((Section) o);
      } else if (o instanceof String) {
        txt.add((String) o);
      } else if (o instanceof Paragraph) {
        paragraphRenderer((Paragraph) o);
      } else if (o instanceof List) {
        // TODO ListRenderer
      }
    }
  }
Exemple #3
0
 public static synchronized Section getRenderer(Section section, String id)
     throws ExlpXpathNotFoundException, ExlpXpathNotUniqueException {
   Section result = null;
   for (Object o : section.getContent()) {
     if (o instanceof Section) {
       Section child = (Section) o;
       if (child.getId().equals(id)) {
         if (result != null) {
           throw new ExlpXpathNotUniqueException(
               "No unique " + Section.class.getSimpleName() + " for id=" + id);
         }
         result = child;
       }
     }
   }
   if (result == null) {
     throw new ExlpXpathNotFoundException(
         "No " + Section.class.getSimpleName() + " found for id=" + id);
   }
   return result;
 }