Пример #1
0
 @Check("isAdmin")
 public static void remove() {
   Session session;
   String idSession = params.get("session.id");
   session = Session.getSessionById(Long.parseLong(idSession));
   if (session != null) {
     session.delete();
   }
   Sessions.show();
 }
Пример #2
0
 @Check("isAdmin")
 public static void move() {
   try {
     Session session = Session.getSessionById(Long.parseLong(params.get("id")));
     SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyHHmm");
     session.dateDepart = sdf.parse(params.get("start"));
     session.dateFin = sdf.parse(params.get("end"));
     session.save();
   } catch (ParseException ex) {
     Logger.getLogger(Disponibilites.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
Пример #3
0
  @Check("isAdmin")
  public static void edit(String idSession) {
    Session sessions = Session.getSessionById(Long.parseLong(idSession));
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
    String dateDebut = sdf.format(sessions.dateDepart);
    String dateFin = sdf.format(sessions.dateFin);

    List<ProduitType> listProduitTypes = Arrays.asList(ProduitType.values());

    Circuit tempCircuit = sessions.circuit;

    sessions.circuit = null;
    sessions.save();

    sessions = Session.getSessionById(Long.parseLong(idSession));
    sessions.circuit = tempCircuit;

    boolean isAvailableCircuit =
        Circuit.isAvailableCircuitByAgence(sessions.dateDepart, sessions.dateFin, sessions.agence);

    Agence agence = sessions.agence;
    render(
        "Sessions/add.html",
        sessions,
        dateDebut,
        dateFin,
        isAvailableCircuit,
        listProduitTypes,
        agence);
  }
Пример #4
0
  public static List<Vehicule> getAvailableVehiculesByAgence(
      Date startDate, Date endDate, Agence agence) {
    List<Vehicule> listVehiculesByAgence = Vehicule.getVehiculesByAgence(agence);
    List<Vehicule> listAvailableVehicules = new ArrayList<Vehicule>();
    List<Session> listSessionsByAgence = Session.getSessionsByAgence(agence);
    List<Revision> listRevisionsByVehicule;
    Calendar calendar = new GregorianCalendar();
    Date startRevision;
    Date endRevision;

    for (Vehicule vehicule : listVehiculesByAgence) {
      boolean isAvailable = true;
      listRevisionsByVehicule = Revision.getRevisionsByVehicule(vehicule);
      for (Revision revision : listRevisionsByVehicule) {
        startRevision = revision.date;
        calendar.setTime(revision.date);
        calendar.add(Calendar.DATE, 7);
        endRevision = calendar.getTime();

        if (startDate.equals(startRevision)
            || endDate.equals(startRevision)
            || startDate.equals(endRevision)
            || endDate.equals(endRevision)
            || (startDate.after(startRevision) && startDate.before(endRevision))
            || (endDate.after(startRevision) && endDate.before(endRevision))) {

          isAvailable = false;
        }
      }

      if (isAvailable) {
        for (Session session : listSessionsByAgence) {
          if (startDate.equals(session.dateDepart)
              || endDate.equals(session.dateDepart)
              || startDate.equals(session.dateFin)
              || endDate.equals(session.dateFin)
              || (startDate.after(session.dateDepart) && startDate.before(session.dateFin))
              || (endDate.after(session.dateDepart) && endDate.before(session.dateFin))) {
            if (session.vehicule.id == vehicule.id) {
              isAvailable = false;
            }
          }
        }
      }

      if (isAvailable) {
        listAvailableVehicules.add(vehicule);
      }
    }

    return listAvailableVehicules;
  }
Пример #5
0
//
// NOTE: This file was generated from: japidviews/_tags/SampleTag.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class SampleTag extends cn.bran.japid.template.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/_tags/SampleTag.html";

  {
    headers.put("Content-Type", "text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public SampleTag() {
    super(null);
  }

  public SampleTag(StringBuilder out) {
    super(out);
  }

  private String a;

  public cn.bran.japid.template.RenderResult render(String a) {
    this.a = a;
    long t = -1;
    super.layout();
    return new cn.bran.japid.template.RenderResult(this.headers, getOut(), t);
  }

  @Override
  protected void doLayout() {
    // ------
    ; // line 1
    p("Hi "); // line 1
    p(a); // line 2
    p("!\n"); // line 2
  }
}
Пример #6
0
//
// NOTE: This file was generated from: japidviews/more/MyController/myLayout.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public abstract class myLayout extends cn.bran.japid.template.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/more/MyController/myLayout.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public myLayout() {
    super(null);
  }

  public myLayout(StringBuilder out) {
    super(out);
  }

  @Override
  public void layout() {
    p("<p>"); // line 1
    title(); // line 1
    p("</p>\n" + "<p>"); // line 1
    side(); // line 2
    p("</p>\n" + "<p>\n"); // line 2
    doLayout(); // line 4
    p("</p>"); // line 4
  }

  protected void title() {};

  protected void side() {};

  protected abstract void doLayout();
}
Пример #7
0
  @Check("isClient")
  public static void positionSession(String idSession) {
    long nbrH = 0;
    Session sessions = Session.getSessionById(Long.parseLong(idSession));

    Calendar calendar1 = new GregorianCalendar();
    calendar1.setTime(sessions.dateDepart);

    Calendar calendar2 = new GregorianCalendar();
    calendar2.setTime(sessions.dateFin);

    nbrH = calendar2.get(Calendar.HOUR) - calendar1.get(Calendar.HOUR);

    Client client = Client.getClientByUsername(Security.connected());

    boolean alreadyPosition = false;

    for (Session s : client.sessions) {
      if (s.id == sessions.id) {
        alreadyPosition = true;
      }
    }

    boolean canPositionSession = false;
    switch (sessions.typeProduit) {
      case CirculationMoto:
        if (client.heureCirculationMoto >= nbrH) {
          canPositionSession = true;
        }
        break;
      case CirculationScooter125:
        if (client.heureCirculationScooter >= nbrH) {
          canPositionSession = true;
        }
        break;
      case CirculationScooter50:
        if (client.heureCirculationScooter >= nbrH) {
          canPositionSession = true;
        }
        break;
      case CirculationVoiture:
        if (client.heureCirculationVoiture >= nbrH) {
          canPositionSession = true;
        }
        break;
      case EvaluationAuto:
        if (client.heureEvaluationAuto >= nbrH) {
          canPositionSession = true;
        }
        break;
      case PlateauMoto:
        if (client.heurePlateauMoto >= nbrH) {
          canPositionSession = true;
        }
        break;
      case PlateauScooter125:
        if (client.heurePlateauScooter >= nbrH) {
          canPositionSession = true;
        }
        break;
      case PlateauScooter50:
        if (client.heurePlateauScooter >= nbrH) {
          canPositionSession = true;
        }
        break;
      case PlateauScooterMP3:
        if (client.heurePlateauScooter >= nbrH) {
          canPositionSession = true;
        }
        break;
      case PlateauVoiture:
        if (client.heurePlateauVoiture >= nbrH) {
          canPositionSession = true;
        }
        break;
      case Stage1:
        if (client.heureStage1 >= nbrH) {
          canPositionSession = true;
        }
        break;
      case Stage2:
        if (client.heureStage2 >= nbrH) {
          canPositionSession = true;
        }
        break;
      case Stage3:
        if (client.heureStage3 >= nbrH) {
          canPositionSession = true;
        }
        break;
      case Code:
        if (client.heureCode >= nbrH) {
          canPositionSession = true;
        }
        break;
    }

    render(canPositionSession, alreadyPosition, sessions);
  }
Пример #8
0
  @Check("isClient")
  public static void findEventsForClient() {
    Client utilisateur = Client.getClientByUsername(Security.connected());
    // Agence agence = Agence.getAgenceById(Long.parseLong(idAgence));
    List<Session> listSessions = Session.getSessionsByAgence(utilisateur.agence);
    System.out.println(listSessions.size());
    List<FullCalendarEvent> listEvents = new ArrayList<FullCalendarEvent>();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    FullCalendarEvent event;
    for (Session session : listSessions) {
      event = new FullCalendarEvent();
      event.start = dateFormat.format(session.dateDepart);
      event.end = dateFormat.format(session.dateFin);
      event.id = session.id.toString();

      event.allDay = "";

      if (Session.canAddClientToSession(session)) {
        event.title = session.commentaires + " (" + session.id + ")";
        event.url = "/sessions/positionSession/" + session.id.toString();
      } else {
        event.title = session.commentaires + " (" + session.id + ") - COMPLET";
        event.url = "";
      }

      switch (session.typeProduit) {
        case CirculationMoto:
          event.color = "blue";
          break;
        case CirculationScooter125:
          event.color = "red";
          break;
        case CirculationScooter50:
          event.color = "yellow";
          event.textColor = "black";
          break;
        case CirculationVoiture:
          event.color = "green";
          break;
        case EvaluationAuto:
          event.color = "DarkOrchid";
          break;
        case PlateauMoto:
          event.color = "Orange";
          break;
        case PlateauScooter125:
          event.color = "Pink";
          event.textColor = "black";
          break;
        case PlateauScooter50:
          event.color = "Magenta";
          break;
        case PlateauScooterMP3:
          event.color = "Silver";
          break;
        case PlateauVoiture:
          event.color = "Turquoise";
          break;
        case Stage1:
          event.color = "Lime";
          break;
        case Stage2:
          event.color = "DeepSkyBlue";
          break;
        case Stage3:
          event.color = "Beige";
          break;
        case Code:
          event.color = "Maroon";
          break;
        default:
          event.color = "white";
      }

      listEvents.add(event);
    }

    Gson gson = new Gson();
    System.out.println(gson.toJson(listEvents));
    renderJSON(gson.toJson(listEvents));
  }
Пример #9
0
//
// NOTE: This file was generated from: japidviews/Application/decorateName.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class decorateName extends cn.bran.play.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/Application/decorateName.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public decorateName() {
    super(null);
  }

  public decorateName(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "s",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "String",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.Application.decorateName.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  private String s;

  public cn.bran.japid.template.RenderResult render(String s) {
    this.s = s;
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    }
    return new cn.bran.japid.template.RenderResultPartial(getHeaders(), getOut(), t, actionRunners);
  }

  @Override
  protected void doLayout() {
    // ------
    ; // line 1
    p("\n" + "^^^_ "); // line 1
    p(s); // line 3
    p(" _^^^\n"); // line 3
  }
}
Пример #10
0
//
// NOTE: This file was generated from: japidviews/templates/AllPost2.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class AllPost2 extends Layout {
  public static final String sourceTemplate = "japidviews/templates/AllPost2.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
    setContentType("text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public AllPost2() {
    super(null);
  }

  public AllPost2(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "blogTitle", "allPost",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "String", "List<Post>",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null, null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.templates.AllPost2.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  private String blogTitle; // line 3
  private List<Post> allPost; // line 3

  public cn.bran.japid.template.RenderResult render(String blogTitle, List<Post> allPost) {
    this.blogTitle = blogTitle;
    this.allPost = allPost;
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    } // line 3
    return new cn.bran.japid.template.RenderResultPartial(
        getHeaders(), getOut(), t, actionRunners, sourceTemplate);
  }

  @Override
  protected void doLayout() {
    beginDoLayout(sourceTemplate);
    // ------
    ; // line 1
    p("\n"); // line 3
    p("\n" + "\n"); // line 5
    if (allPost.size() > 0) { // line 8
      p("	<p></p>\n" + "	"); // line 8
      for (Post p : allPost) { // line 10
        p("	    "); // line 10
        final Display _Display1 = new Display(getOut());
        _Display1.setActionRunners(getActionRunners()).setOut(getOut());
        _Display1.render( // line 11
            new Display.DoBody<String>() { // line 11
              public void render(final String title) { // line 11
                // line 11
                p("			<p>The real title is: "); // line 11
                p(title); // line 12
                p(";</p>\n" + "	    "); // line 12
              }

              StringBuilder oriBuffer;

              @Override
              public void setBuffer(StringBuilder sb) {
                oriBuffer = getOut();
                setOut(sb);
              }

              @Override
              public void resetBuffer() {
                setOut(oriBuffer);
              }
            },
            named("post", p),
            named("as", "home")); // line 11
        p("	"); // line 13
      } // line 14
    } else { // line 15
      p("	<p>There is no post at this moment</p>\n"); // line 15
    } // line 17
    p("\n"); // line 17
    final Tag2 _Tag22 = new Tag2(getOut());
    _Tag22.setActionRunners(getActionRunners()).setOut(getOut());
    _Tag22.render(named("msg", blogTitle), named("age", 1000)); // line 19// line 19
    p("\n" + "<p>end of it</p>"); // line 19

    endDoLayout(sourceTemplate);
  }

  @Override
  protected void title() {
    p("Home");
    ;
  }
}
Пример #11
0
 public static Session getSessionById(Long id) {
   return Session.all().filter("id", id).get();
 }
Пример #12
0
//
// NOTE: This file was generated from: japidviews/_tags/paramWithDefaults.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class paramWithDefaults extends cn.bran.play.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/_tags/paramWithDefaults.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
    setContentType("text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public paramWithDefaults() {
    super(null);
  }

  public paramWithDefaults(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
        /* args of the template*/
        "msg", "m2", "age",
      };
  public static final String[] argTypes =
      new String[] {
        /* arg types of the template*/
        "String", "String", "Integer",
      };
  public static final Object[] argDefaults =
      new Object[] {
        "message 1 default value", new String("m2message"), 20,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews._tags.paramWithDefaults.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  private String msg; // line 1
  private String m2; // line 1
  private Integer age; // line 1

  public cn.bran.japid.template.RenderResult render(String msg, String m2, Integer age) {
    this.msg = msg;
    this.m2 = m2;
    this.age = age;
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    } // line 1
    return new cn.bran.japid.template.RenderResultPartial(
        getHeaders(), getOut(), t, actionRunners, sourceTemplate);
  }

  @Override
  protected void doLayout() {
    beginDoLayout(sourceTemplate);
    // ------
    ; // line 1
    p("\n" + "<span>"); // line 5
    p(msg); // line 6
    p("</span>\n" + "<span>"); // line 6
    p(m2); // line 7
    p("</span>\n" + "<span>"); // line 7
    p(age); // line 8
    p("</span>\n" + "\n"); // line 8

    endDoLayout(sourceTemplate);
  }
}
Пример #13
0
//
// NOTE: This file was generated from: japidviews/templates/Set.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class Set extends japidviews._layouts.SetLayout {
  public static final String sourceTemplate = "japidviews/templates/Set.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
    setContentType("text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public Set() {
    super(null);
  }

  public Set(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "a",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "String",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.templates.Set.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  private String a; // line 2

  public cn.bran.japid.template.RenderResult render(String a) {
    this.a = a;
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    } // line 2
    return new cn.bran.japid.template.RenderResultPartial(
        getHeaders(), getOut(), t, actionRunners, sourceTemplate);
  }

  @Override
  protected void doLayout() {
    beginDoLayout(sourceTemplate);
    // ------
    ; // line 1
    p("\n"); // line 2
    p("\n" + "\n"); // line 11
    p("\n" + "\n"); // line 13

    // line 17

    endDoLayout(sourceTemplate);
  }

  @Override
  protected void footer() {
    // line 17
    p("    great footer. Call a tag: "); // line 17
    final dummyTag _dummyTag2 = new dummyTag(getOut());
    _dummyTag2.setActionRunners(getActionRunners()).setOut(getOut());
    _dummyTag2.render("me"); // line 18// line 18
    ;
  }

  @Override
  protected void title() {
    p("Home away" + a);
    ;
  }
}
Пример #14
0
//
// NOTE: This file was generated from: japidviews/templates/SimpleTemp.txt
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class SimpleTemp_txt extends cn.bran.japid.template.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/templates/SimpleTemp.txt";

  {
    putHeader("Content-Type", "text/plain; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public SimpleTemp_txt() {
    super(null);
  }

  public SimpleTemp_txt(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "blogTitle",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "String",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.templates.SimpleTemp_txt.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
  }
  ////// end of named args stuff

  private String blogTitle;

  public cn.bran.japid.template.RenderResult render(String blogTitle) {
    this.blogTitle = blogTitle;
    long t = -1;
    super.layout();
    return new cn.bran.japid.template.RenderResultPartial(getHeaders(), getOut(), t, actionRunners);
  }

  @Override
  protected void doLayout() {
    // ------
    ; // line 1
    p("\n" + "blog title:  "); // line 1
    p(blogTitle); // line 3
    p("\n"); // line 3
  }
}
Пример #15
0
//
// NOTE: This file was generated from: japidviews/templates/def.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class def extends defLayout {
  public static final String sourceTemplate = "japidviews/templates/def.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public def() {
    super(null);
  }

  public def(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames = new String[] {
        /* args of the template*/
      };
  public static final String[] argTypes = new String[] {
        /* arg types of the template*/
      };
  public static final Object[] argDefaults = new Object[] {};
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.templates.def.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  public cn.bran.japid.template.RenderResult render() {
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    }
    return new cn.bran.japid.template.RenderResultPartial(getHeaders(), getOut(), t, actionRunners);
  }

  @Override
  protected void doLayout() {

    // -- set up the tag objects
    final dummyTag _dummyTag4 = new dummyTag(getOut());
    {
      _dummyTag4.setActionRunners(getActionRunners());
    }

    // -- end of the tag objects

    // ------
    ; // line 1
    p("\n" + "<p>check 1</p>\n"); // line 1
    p("\n" + "\n" + "\n"); // line 4
    // line 7
    p("\n" + "<p>check 2</p>\n"); // line 12
    // line 15
    p("<p>check 3</p>\n" + "\n"); // line 18
    p("\n" + "\n"); // line 21
    // line 23
    p("\n" + "\n" + "<p>check 4</p>\n"); // line 26
    _dummyTag4.setOut(getOut());
    _dummyTag4.render(get("bar")); // line 29
    p("\n" + "\n"); // line 29
    p("<p>check 5</p>\n" + "\n"); // line 31
    p(foo()); // line 34
    p("\n" + "\n" + "<p>check 6</p>\n" + "\n"); // line 34
    String a = "";
    // line 39
    a += "bssdfsdf";
    // line 40
    p("\n"); // line 41
    if (a.length() > 0) { // line 42
      p(a); // line 43
    } // line 44
    p("\n"); // line 44
  }

  public String foo2(String p) {
    StringBuilder sb = new StringBuilder();
    StringBuilder ori = getOut();
    this.setOut(sb);
    final dummyTag _dummyTag1 = new dummyTag(getOut());
    {
      _dummyTag1.setActionRunners(getActionRunners());
    }

    // line 7
    p("	<p>hi "); // line 7
    p(p); // line 8
    p("!,</p> \n" + "	<p>from "); // line 8
    p(request.action); // line 9
    p("</p>\n" + "	<p>OK you can call a tag:</p>\n" + "	"); // line 9
    _dummyTag1.setOut(getOut());
    _dummyTag1.render(p); // line 11

    this.setOut(ori);
    return sb.toString();
  }

  public String foo() {
    StringBuilder sb = new StringBuilder();
    StringBuilder ori = getOut();
    this.setOut(sb);
    // line 15
    p("	"); // line 15
    String s = "hi there"; // line 16
    p("	<p>foo hello "); // line 16
    p(foo2(s)); // line 17
    p("</p>\n"); // line 17

    this.setOut(ori);
    return sb.toString();
  }

  public String bar() {
    StringBuilder sb = new StringBuilder();
    StringBuilder ori = getOut();
    this.setOut(sb);
    // line 23
    p("\n" + "	"); // line 23
    String s = "hi2"; // line 24
    p("	<p>bar hi "); // line 24
    p(s); // line 25
    p("!</p>\n"); // line 25

    this.setOut(ori);
    return sb.toString();
  }
}
Пример #16
0
  @Check("isClient")
  public static void validPosition() {
    Session session = Session.getSessionById(Long.parseLong(params.get("session_id")));
    String result = params.get("positionSession");
    Client client = Client.getClientByUsername(Security.connected());

    Calendar calendar1 = new GregorianCalendar();
    calendar1.setTime(session.dateDepart);

    Calendar calendar2 = new GregorianCalendar();
    calendar2.setTime(session.dateFin);

    int nbrH = (int) calendar2.get(Calendar.HOUR) - calendar1.get(Calendar.HOUR);

    boolean alreadyPosition = false;
    for (Session s : client.sessions) {
      if (s.id == session.id) {
        alreadyPosition = true;
      }
    }

    if (result.equals("true")) {
      if (!alreadyPosition) {
        client.sessions.add(session);
        switch (session.typeProduit) {
          case CirculationMoto:
            client.heureCirculationMoto -= nbrH;
            break;
          case CirculationScooter125:
            client.heureCirculationScooter -= nbrH;
            break;
          case CirculationScooter50:
            client.heureCirculationScooter -= nbrH;
            break;
          case CirculationVoiture:
            client.heureCirculationVoiture -= nbrH;
            break;
          case EvaluationAuto:
            client.heureEvaluationAuto -= nbrH;
            break;
          case PlateauMoto:
            client.heurePlateauMoto -= nbrH;
            break;
          case PlateauScooter125:
            client.heurePlateauScooter -= nbrH;
            break;
          case PlateauScooter50:
            client.heurePlateauScooter -= nbrH;
            break;
          case PlateauScooterMP3:
            client.heurePlateauScooter -= nbrH;
            break;
          case PlateauVoiture:
            client.heurePlateauVoiture -= nbrH;
            break;
          case Stage1:
            client.heureStage1 -= nbrH;
            break;
          case Stage2:
            client.heureStage2 -= nbrH;
            break;
          case Stage3:
            client.heureStage3 -= nbrH;
            break;
          case Code:
            client.heureCode -= nbrH;
            break;
        }
      }
    } else {
      if (alreadyPosition) {
        client.sessions.remove(session);
        switch (session.typeProduit) {
          case CirculationMoto:
            client.heureCirculationMoto += nbrH;
            break;
          case CirculationScooter125:
            client.heureCirculationScooter += nbrH;
            break;
          case CirculationScooter50:
            client.heureCirculationScooter += nbrH;
            break;
          case CirculationVoiture:
            client.heureCirculationVoiture += nbrH;
            break;
          case EvaluationAuto:
            client.heureEvaluationAuto += nbrH;
            break;
          case PlateauMoto:
            client.heurePlateauMoto += nbrH;
            break;
          case PlateauScooter125:
            client.heurePlateauScooter += nbrH;
            break;
          case PlateauScooter50:
            client.heurePlateauScooter += nbrH;
            break;
          case PlateauScooterMP3:
            client.heurePlateauScooter += nbrH;
            break;
          case PlateauVoiture:
            client.heurePlateauVoiture += nbrH;
            break;
          case Stage1:
            client.heureStage1 += nbrH;
            break;
          case Stage2:
            client.heureStage2 += nbrH;
            break;
          case Stage3:
            client.heureStage3 += nbrH;
            break;
          case Code:
            client.heureCode += nbrH;
            break;
        }
      }
    }

    client.save();
    Sessions.showSessions();
  }
Пример #17
0
//
// NOTE: This file was generated from: japidviews/Application/search.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class search extends cn.bran.japid.template.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/Application/search.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public search() {
    super(null);
  }

  public search(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
        /* args of the template*/
        "sp",
      };
  public static final String[] argTypes =
      new String[] {
        /* arg types of the template*/
        "SearchParams",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.Application.search.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
  }
  ////// end of named args stuff

  private SearchParams sp;

  public cn.bran.japid.template.RenderResult render(SearchParams sp) {
    this.sp = sp;
    long t = -1;
    super.layout();
    return new cn.bran.japid.template.RenderResultPartial(getHeaders(), getOut(), t, actionRunners);
  }

  @Override
  protected void doLayout() {
    // ------
    ; // line 1
    p("\n" + "\n" + "keys: "); // line 1
    try {
      Object o = sp.keywords;
      if (o.toString().length() == 0) {
        p("没有 keywords");
      } else {
        p(o);
      }
    } catch (NullPointerException npe) {
      p("没有 keywords");
    } // line 3
    p(", mode: "); // line 3
    try {
      Object o = sp.mode;
      if (o.toString().length() == 0) {
        p("no mode");
      } else {
        p(o);
      }
    } catch (NullPointerException npe) {
      p("no mode");
    } // line 3
    p("\n" + "\n" + "true/false: "); // line 3
    p(true ? "class=\"someclass\"" : ""); // line 5
    ; // line 5
  }
}
Пример #18
0
//
// NOTE: This file was generated from: japidviews/templates/EachCall.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class EachCall extends cn.bran.play.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/templates/EachCall.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
    setContentType("text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public EachCall() {
    super(null);
  }

  public EachCall(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "posts",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "List<String>",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.templates.EachCall.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  private List<String> posts; // line 1

  public cn.bran.japid.template.RenderResult render(List<String> posts) {
    this.posts = posts;
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    } // line 1
    return new cn.bran.japid.template.RenderResultPartial(
        getHeaders(), getOut(), t, actionRunners, sourceTemplate);
  }

  @Override
  protected void doLayout() {
    beginDoLayout(sourceTemplate);
    // ------
    ; // line 1
    p(
        "\n"
            + "<p>\n"
            + "The \"each/Each\" command is a for loop on steroid, with lots of loop information. \n"
            + "</p>\n"
            + "\n"
            + "<p> \n"
            + "The instance variable is defined after the | line, the same way as any tag render-back\n"
            + "</p>\n"
            + "\n"); // line 1
    final Each _Each0 = new Each(getOut());
    _Each0.setOut(getOut());
    _Each0.render( // line 11
        posts,
        new Each.DoBody<String>() { // line 11
          public void render(
              final String p,
              final int _size,
              final int _index,
              final boolean _isOdd,
              final String _parity,
              final boolean _isFirst,
              final boolean _isLast) { // line 11
            // line 11
            p("    <p>index: "); // line 11
            p(_index); // line 12
            p(", parity: "); // line 12
            p(_parity); // line 12
            p(", is odd? "); // line 12
            p(_isOdd); // line 12
            p(", is first? "); // line 12
            p(_isFirst); // line 12
            p(", is last? "); // line 12
            p(_isLast); // line 12
            p(", total size: "); // line 12
            p(_size); // line 12
            p(" </p>\n" + "    call a tag:  "); // line 12
            final SampleTag _SampleTag1 = new SampleTag(getOut());
            _SampleTag1.setActionRunners(getActionRunners()).setOut(getOut());
            _SampleTag1.render(p); // line 13// line 13
          }

          StringBuilder oriBuffer;

          @Override
          public void setBuffer(StringBuilder sb) {
            oriBuffer = getOut();
            setOut(sb);
          }

          @Override
          public void resetBuffer() {
            setOut(oriBuffer);
          }
        }); // line 11
    p("\n"); // line 14
    final SampleTag _SampleTag2 = new SampleTag(getOut());
    _SampleTag2.setActionRunners(getActionRunners()).setOut(getOut());
    _SampleTag2.render("end"); // line 16// line 16
    p(
        "\n"
            + "<p> now we have an enhanced for loop (the \"open for loop\") that also makes all the loop properties available</p>\n"
            + "\n"); // line 16
    int k = 1; // line 20
    final Each _Each3 = new Each(getOut());
    _Each3.setOut(getOut());
    _Each3.render( // line 21
        posts,
        new Each.DoBody<String>() { // line 21
          public void render(
              final String p,
              final int _size,
              final int _index,
              final boolean _isOdd,
              final String _parity,
              final boolean _isFirst,
              final boolean _isLast) { // line 21
            // line 21
            p("    <p>index: "); // line 21
            p(_index); // line 22
            p(", parity: "); // line 22
            p(_parity); // line 22
            p(", is odd? "); // line 22
            p(_isOdd); // line 22
            p(", is first? "); // line 22
            p(_isFirst); // line 22
            p(", is last? "); // line 22
            p(_isLast); // line 22
            p(", total size: "); // line 22
            p(_size); // line 22
            p(" </p>\n" + "    call a tag:  "); // line 22
            final SampleTag _SampleTag4 = new SampleTag(getOut());
            _SampleTag4.setActionRunners(getActionRunners()).setOut(getOut());
            _SampleTag4.render(p); // line 23// line 23
          }

          StringBuilder oriBuffer;

          @Override
          public void setBuffer(StringBuilder sb) {
            oriBuffer = getOut();
            setOut(sb);
          }

          @Override
          public void resetBuffer() {
            setOut(oriBuffer);
          }
        }); // line 21
    p("\n" + "\n"); // line 24
    int[] ints = {1, 2, 3}; // line 27
    final Each _Each5 = new Each(getOut());
    _Each5.setOut(getOut());
    _Each5.render( // line 28
        ints,
        new Each.DoBody<Integer>() { // line 28
          public void render(
              final Integer i,
              final int _size,
              final int _index,
              final boolean _isOdd,
              final String _parity,
              final boolean _isFirst,
              final boolean _isLast) { // line 28
            // line 28
            p("    --> "); // line 28
            p(escape(i)); // line 29
            p("\n"); // line 29
          }

          StringBuilder oriBuffer;

          @Override
          public void setBuffer(StringBuilder sb) {
            oriBuffer = getOut();
            setOut(sb);
          }

          @Override
          public void resetBuffer() {
            setOut(oriBuffer);
          }
        }); // line 28
    ; // line 30

    endDoLayout(sourceTemplate);
  }
}
Пример #19
0
  @Check("isAdmin")
  public static void save() {
    Session session;
    String idSession = params.get("session.id");
    System.out.println(idSession);
    if (idSession != null && !idSession.equals("")) {
      session = Session.getSessionById(Long.parseLong(params.get("session.id")));
    } else {
      session = new Session();
    }

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");

    try {
      session.dateDepart = sdf.parse(params.get("session.dateDebut"));
      session.dateFin = sdf.parse(params.get("session.dateFin"));
    } catch (ParseException ex) {
      Logger.getLogger(Disponibilites.class.getName()).log(Level.SEVERE, null, ex);
    }

    session.commentaires = params.get("session.commentaires");
    String nbPlace = params.get("session.nbMaxPlaces");
    if (nbPlace != null && !nbPlace.equals("")) {
      session.nbMaxPlaces = Integer.parseInt(nbPlace);
    }

    Agence agence = Agence.getAgenceById(Long.parseLong(params.get("session.agence").toString()));
    session.agence = agence;
    String resultCircuit = params.get("session.circuit");
    if (resultCircuit.equals("indisponible") || resultCircuit.equals("false")) {
      session.circuit = null;
    } else {
      session.circuit = Circuit.getCircuitByAgence(agence);
    }
    session.typeProduit = ProduitType.valueOf(params.get("session.type"));
    session.employe = Employe.getEmployeById(Long.parseLong(params.get("session.employe")));
    session.vehicule = Vehicule.getVehiculeById(Long.parseLong(params.get("session.vehicule")));

    validation.valid(session);

    if (Validation.hasErrors()) {
      params.flash();
      Validation.keep();
      if (idSession != null && !idSession.equals("")) {
        Sessions.edit(idSession);
      } else {
        Sessions.add(
            formatDateToCalendar(params.get("session.dateDebut").toString()),
            formatDateToCalendar(params.get("session.dateFin").toString()),
            params.get("session.agence").toString());
      }
    } else {
      session.save();
      Sessions.show();
    }
  }
Пример #20
0
//
// NOTE: This file was generated from: japidviews/_tags/picka.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class picka extends cn.bran.japid.template.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/_tags/picka.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public picka() {
    super(null);
  }

  public picka(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "a", "b",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "String", "String",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null, null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews._tags.picka.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
  }
  ////// end of named args stuff

  private String a;
  private String b;

  public cn.bran.japid.template.RenderResult render(
      DoBody body, cn.bran.japid.compiler.NamedArgRuntime... named) {
    Object[] args = buildArgs(named, body);
    return runRenderer(args);
  }

  private DoBody body;

  public static interface DoBody<A> {
    void render(A a);
  }

  public cn.bran.japid.template.RenderResult render(String a, String b, DoBody body) {
    this.body = body;
    this.a = a;
    this.b = b;
    long t = -1;
    super.layout();
    return new cn.bran.japid.template.RenderResultPartial(getHeaders(), getOut(), t, actionRunners);
  }

  @Override
  protected void doLayout() {
    // ------
    ; // line 1
    p("<p>\n" + "some text \n" + "</p>\n" + "<p>\n"); // line 1
    if (body != null) body.render(a + b);
    p("</p>\n" + "<p>\n" + "more text \n" + "</p>\n" + " "); // line 6
  }
}
Пример #21
0
  @Check("isAdmin")
  public static void findEvents(String idAgence) {
    Agence agence = Agence.getAgenceById(Long.parseLong(idAgence));
    List<Session> listSessions = Session.getSessionsByAgence(agence);

    List<FullCalendarEvent> listEvents = new ArrayList<FullCalendarEvent>();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    FullCalendarEvent event;
    for (Session session : listSessions) {
      event = new FullCalendarEvent();
      event.start = dateFormat.format(session.dateDepart);
      event.end = dateFormat.format(session.dateFin);
      event.id = session.id.toString();
      event.title = session.commentaires + " (" + session.id + ")";
      event.allDay = "";

      switch (session.typeProduit) {
        case CirculationMoto:
          event.color = "blue";
          break;
        case CirculationScooter125:
          event.color = "red";
          break;
        case CirculationScooter50:
          event.color = "yellow";
          event.textColor = "black";
          break;
        case CirculationVoiture:
          event.color = "green";
          break;
        case EvaluationAuto:
          event.color = "DarkOrchid";
          break;
        case PlateauMoto:
          event.color = "Orange";
          break;
        case PlateauScooter125:
          event.color = "Pink";
          event.textColor = "black";
          break;
        case PlateauScooter50:
          event.color = "Magenta";
          break;
        case PlateauScooterMP3:
          event.color = "Silver";
          break;
        case PlateauVoiture:
          event.color = "Turquoise";
          break;
        case Stage1:
          event.color = "Lime";
          break;
        case Stage2:
          event.color = "DeepSkyBlue";
          break;
        case Stage3:
          event.color = "Beige";
          break;
        case Code:
          event.color = "Maroon";
          break;
        default:
          event.color = "white";
      }

      listEvents.add(event);
    }

    Gson gson = new Gson();
    System.out.println(gson.toJson(listEvents));
    renderJSON(gson.toJson(listEvents));
  }
Пример #22
0
//
// NOTE: This file was generated from: japidviews/more/Portlets/panel2.html
// Change to this file will be lost next time the template file is compiled.
//
@cn.bran.play.NoEnhance
public class panel2 extends cn.bran.play.JapidTemplateBase {
  public static final String sourceTemplate = "japidviews/more/Portlets/panel2.html";

  {
    putHeader("Content-Type", "text/html; charset=utf-8");
    setContentType("text/html; charset=utf-8");
  }

  // - add implicit fields with Play

  final Request request = Request.current();
  final Response response = Response.current();
  final Session session = Session.current();
  final RenderArgs renderArgs = RenderArgs.current();
  final Params params = Params.current();
  final Validation validation = Validation.current();
  final cn.bran.play.FieldErrors errors = new cn.bran.play.FieldErrors(validation);
  final play.Play _play = new play.Play();

  // - end of implicit fields with Play

  public panel2() {
    super(null);
  }

  public panel2(StringBuilder out) {
    super(out);
  }
  /* based on https://github.com/branaway/Japid/issues/12
   */
  public static final String[] argNames =
      new String[] {
          /* args of the template*/
        "a",
      };
  public static final String[] argTypes =
      new String[] {
          /* arg types of the template*/
        "String",
      };
  public static final Object[] argDefaults =
      new Object[] {
        null,
      };
  public static java.lang.reflect.Method renderMethod =
      getRenderMethod(japidviews.more.Portlets.panel2.class);

  {
    setRenderMethod(renderMethod);
    setArgNames(argNames);
    setArgTypes(argTypes);
    setArgDefaults(argDefaults);
    setSourceTemplate(sourceTemplate);
  }
  ////// end of named args stuff

  private String a; // line 1

  public cn.bran.japid.template.RenderResult render(String a) {
    this.a = a;
    long t = -1;
    try {
      super.layout();
    } catch (RuntimeException e) {
      super.handleException(e);
    } // line 1
    return new cn.bran.japid.template.RenderResultPartial(
        getHeaders(), getOut(), t, actionRunners, sourceTemplate);
  }

  @Override
  protected void doLayout() {
    beginDoLayout(sourceTemplate);
    // ------
    ; // line 1
    p("<p>panel-2 "); // line 1
    p(a); // line 2
    p(": "); // line 2
    p(new Date()); // line 2
    p("</p>\n"); // line 2

    endDoLayout(sourceTemplate);
  }
}