Esempio n. 1
0
 void appendText(String text) {
   switch (currentType) {
     case STRING:
       accumulatedText.append(text);
       break;
     case SCRIPTLET:
       writer.appendScriptlet(text);
       break;
     case EXPR:
       writer.appendExpression(text);
       break;
   }
 }
Esempio n. 2
0
 void appendLineBreak(Location position) {
   switch (currentType) {
     case STRING:
       accumulatedText.append("\n");
       break;
     case SCRIPTLET:
       writer.appendLineBreak(currentType, position);
       break;
     case EXPR:
       writer.appendLineBreak(currentType, position);
       break;
   }
 }
Esempio n. 3
0
  void end() {
    if (currentType == null) {
      throw new IllegalStateException();
    }

    //
    switch (currentType) {
      case STRING:
        if (accumulatedText.length() > 0) {
          writer.appendText(accumulatedText.toString());
          accumulatedText.setLength(0);
        }
        break;
      case SCRIPTLET:
        writer.endScriptlet();
        break;
      case EXPR:
        writer.endExpression();
        break;
    }

    //
    this.currentType = null;
  }
Esempio n. 4
0
  void begin(SectionType sectionType, Location pos) {
    if (sectionType == null) {
      throw new NullPointerException();
    }
    if (pos == null) {
      throw new NullPointerException();
    }
    if (currentType != null) {
      throw new IllegalStateException();
    }
    this.currentType = sectionType;

    //
    switch (currentType) {
      case STRING:
        break;
      case SCRIPTLET:
        writer.startScriptlet(pos);
        break;
      case EXPR:
        writer.startExpression(pos);
        break;
    }
  }