public void setModel(Object model, String tag) {

    if (model instanceof Articolo) {
      Articolo product = (Articolo) model;
      Delegate<Articolo> delegate =
          new Delegate<Articolo>() {
            public void execute(Articolo product) {
              shortHtmlContentEditor.setModel(product.getHtmlContent(HtmlContent.Type.SMALL));
              mediumHtmlContentEditor.setModel(product.getHtmlContent(HtmlContent.Type.MEDIUM));
            }
          };
      if (product.areHtmlsInitialized()) {
        delegate.execute(product);
      } else {
        getPresenter().fetchHtmls(product, delegate);
      }
    }
  }
Ejemplo n.º 2
0
 private void iterateTimbriForSave(final Iterator<Timbro> it, final Delegate<Void> delegate) {
   if (it.hasNext()) {
     Timbro timbro = it.next();
     dao.saveTimbro(
         timbro,
         new Delegate<Timbro>() {
           public void execute(Timbro savedTimbro) {
             iterateTimbriForSave(it, delegate);
           }
         });
   } else {
     delegate.execute(null);
   }
 }