Package org.olat.core.gui.render

Examples of org.olat.core.gui.render.StringOutput


    ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] {FolderRunController.FORM_ACTION }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    target.append("\" onsubmit=\"if ( b_briefcase_isChecked('").append(formName)
      .append("', '").append(Formatter.escapeSingleAndDoubleQuotes(StringEscapeUtils.escapeHtml(translator.translate("alert")).toString()))
      .append("')) { if(o_info.linkbusy) return false; else o_beforeserver(); return true; } else {return false; }\"");
    if (iframePostEnabled) { // add ajax iframe target
      StringOutput so = new StringOutput();
      ubu.appendTarget(so);
      target.append(so.toString());
    }
    target.append(">");

    target.append("<div class=\"b_briefcase_createactions b_clearfix\"><ul>");
    if (canWrite) {
      // add folder actions: upload file, create new folder, creat new file

      if(canVersion) {
      // deleted files
        target.append("<li><a class=\"b_briefcase_deletedfiles\" href=\"");
        ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "dfiles"  }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        target.append("\"");
        if (iframePostEnabled) { // add ajax iframe target
          StringOutput so = new StringOutput();
          ubu.appendTarget(so);
          target.append(so.toString());
        }
        target.append(">");
        target.append(translator.translate("dfiles"));
        target.append("</a></li>");
      }
     
      if(canWrite) {
        // option upload 
        target.append("<li><a class=\"b_briefcase_upload\" href=\"");
        ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "ul"  }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        target.append("\"");
        if (iframePostEnabled) { // add ajax iframe target
          StringOutput so = new StringOutput();
          ubu.appendTarget(so);
          target.append(so.toString());
        }
        target.append(">");
        target.append(translator.translate("ul"));     
        target.append("</a></li>");
 
        // option new folder
        target.append("<li><a class=\"b_briefcase_newfolder\" href=\"");
        ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "cf"  }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        target.append("\"");
        if (iframePostEnabled) { // add ajax iframe target
          StringOutput so = new StringOutput();
          ubu.appendTarget(so);
          target.append(so.toString());
        }
        target.append(">");
        target.append(translator.translate("cf"));
        target.append("</a></li>");
 
        // option new file
        target.append("<li><a class=\"b_briefcase_newfile\" href=\"");
        ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "cfile"  }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        target.append("\"");
        if (iframePostEnabled) { // add ajax iframe target
          StringOutput so = new StringOutput();
          ubu.appendTarget(so);
          target.append(so.toString());
        }
        target.append(">");
        target.append(translator.translate("cfile"));
        target.append("</a></li>");
      }
View Full Code Here


    }
  }

  private void updateComponentTree() {
    Window win = wboImpl.getWindow();
    StringOutput sb = new StringOutput();
    renderDebugInfo(win.getContentPane(), sb, true);
    myContent.contextPut("compdump", sb.toString());
  }
View Full Code Here

   *          don't add version (but allow browsers to cache even when resource
   *          has changed). Only use false when really needed
   * @return
   */
  public static String createStaticURIFor(String URI, boolean addVersionID) {
    StringOutput so = new StringOutput();
    renderStaticURI(so, URI, addVersionID);
    return so.toString();
  }
View Full Code Here

  public String toString(int rowid) {
    Object obj = getModelData(rowid);;
    if(obj instanceof Date){
      return "[date]";
    }
    StringOutput sb = new StringOutput();
    renderValue(sb,rowid,null);
    return sb.toString();
  }
View Full Code Here

      // brasato:: fix it
      //Translator comptrans = tree.getCompTrans();
      //target.append(comptrans.translate("sr.intro", new String[] {String.valueOf(cnt)}));
      for (int i = 0; i < cnt; i++) {
        TreeNode tn = (TreeNode) selNode.getChildAt(i);
        StringOutput so = new StringOutput();
        so.append("<a href=\"");
        ubu.buildURI(so, new String[] { MenuTree.NODE_IDENT }, new String[] { tn.getIdent() });
        so.append("\" title=\"").append(StringEscapeUtils.escapeHtml(tn.getAltText())).append("\">").append(tn.getTitle()).append("</a>");
       
        //target.append(comptrans.translate("sr.treenode", new String[] {so.toString(), tn.getAltText()}));
      }
      //target.append(comptrans.translate("sr.endintro"));
    }
View Full Code Here

   * @param iframePostEnabled
   * @return  HTML fragment of briefcase path
   */
  public final String render(FolderComponent fc, URLBuilder ubu, boolean renderLinks, boolean iframePostEnabled) {

    StringOutput pathLink = new StringOutput();
    ubu.buildURI(pathLink, null, null, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    StringOutput sb = new StringOutput();
   
    // append toplevel node
    sb.append("<div class=\"b_briefcase_breadcrumb\">/&nbsp;");
    if (renderLinks) {
      sb.append("<a href=\"");
      sb.append(pathLink);
      sb.append("\"");
      if (iframePostEnabled) { // add ajax iframe target
        StringOutput so = new StringOutput();
        ubu.appendTarget(so);
        sb.append(so.toString());
      }
      sb.append(">");
    }
    sb.append(fc.getRootContainer().getName());
    if (renderLinks)
      sb.append("</a>");
   
    StringTokenizer st = new StringTokenizer(fc.getCurrentContainerPath(), "/", false);
    while (st.hasMoreElements()) {
      String token = st.nextToken();
      pathLink.append(StringHelper.urlEncodeUTF8(token));
      sb.append("&nbsp;/&nbsp;");
      if (st.hasMoreElements() && renderLinks) {
        sb.append("<a href=\"");
        sb.append(pathLink.toString());
        sb.append("\"");
        if (iframePostEnabled) { // add ajax iframe target
          StringOutput so = new StringOutput();
          ubu.appendTarget(so);
          sb.append(so.toString());
        }
        sb.append(">");
        sb.append(token);
        sb.append("</a>");
      } else {
View Full Code Here

   * @param translator
   * @param iframePostEnabled
   * @return Render results.
   */
  public String render(FolderComponent fc, URLBuilder ubu, Translator translator, boolean iframePostEnabled) {
    StringOutput sb = new StringOutput();   

    List<VFSItem> children = fc.getCurrentContainerChildren();
    // folder empty?
    if (children.size() == 0) {
      sb.append("<div class=\"b_briefcase_empty\">");
      sb.append(translator.translate("NoFiles"));
      sb.append("</div>");
      return sb.toString();
    }

    boolean canVersion = FolderConfig.versionsEnabled(fc.getCurrentContainer());
   
    sb.append("<table class=\"b_briefcase_filetable\">");
    // header
    sb.append("<thead><tr><th class=\"b_briefcase_col_name b_first_child\">");
   
    // TODO:laeb: set css class depending on sorting state like following and add sort arrow pics as css background image
//    String cssClass;
//    if (FolderComponent.sortCol.equals(FolderComponent.SORT_NAME)) {
//      if (FolderComponent.sortAsc) cssClass = "o_cfc_col_srt_asc";
//      else                         cssClass = "o_cfc_col_srt_desc";
//    } else                         cssClass = "o_cfc_col_unsorted";
   
    sb.append("<a href=\"");                                                                              // file name column
    ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_NAME }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    sb.append("\"");
    if (iframePostEnabled) { // add ajax iframe target
      StringOutput so = new StringOutput();
      ubu.appendTarget(so);
      sb.append(so.toString());
    }
    sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("header.Name"))).append("\">")
      .append(translator.translate("header.Name")).append("</a>");
    sb.append("</th><th class=\"b_briefcase_col_size\">");
   
    sb.append("<a href=\"");                                                                              // file size column
    ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_SIZE }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    sb.append("\"");
    if (iframePostEnabled) { // add ajax iframe target
      StringOutput so = new StringOutput();
      ubu.appendTarget(so);
      sb.append(so.toString());
    }
    sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("header.Size"))).append("\">")
      .append(translator.translate("header.Size")).append("</a>");

    sb.append("</th><th class=\"b_briefcase_col_type\">");

    sb.append("<a href=\"");                                                                              // file type column
    ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_TYPE }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    sb.append("\"");
    if (iframePostEnabled) { // add ajax iframe target
      StringOutput so = new StringOutput();
      ubu.appendTarget(so);
      sb.append(so.toString());
    }
    sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("header.Type"))).append("\">")
      .append(translator.translate("header.Type")).append("</a>");
   
    if(canVersion) {
      sb.append("</th><th class=\"b_briefcase_col_rev\">")
        .append("<a href=\"");                                                                              // file size column
      ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_REV }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
      sb.append("\"");
      if (iframePostEnabled) { // add ajax iframe target
        StringOutput so = new StringOutput();
        ubu.appendTarget(so);
        sb.append(so.toString());
      }
      sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("header.Version"))).append("\">")
        .append(translator.translate("header.Version")).append("</a>");
    }
   
    sb.append("</th><th class=\"b_briefcase_col_date\">");

    sb.append("<a href=\"");                                                                              // file modification date column
    ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_DATE }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    sb.append("\"");
    if (iframePostEnabled) { // add ajax iframe target
      StringOutput so = new StringOutput();
      ubu.appendTarget(so);
      sb.append(so.toString());
    }
    sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("header.Modified"))).append("\">")
      .append(translator.translate("header.Modified")).append("</a>");
    sb.append("</th>");
    sb.append("<th class=\"b_briefcase_col_info\">");
   
   
   
    sb.append("<a href=\"");                                                                              // file lock
    ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_LOCK }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
    sb.append("\"");
    if (iframePostEnabled) { // add ajax iframe target
      StringOutput so = new StringOutput();
      ubu.appendTarget(so);
      sb.append(so.toString());
    }
    sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("header.Status"))).append("\">")
      .append(translator.translate("header.Status")).append("</a>");
   
    // meta data column
View Full Code Here

    sb.append("<a href=\"");
    if (isContainer) { // for directories... normal module URIs
      ubu.buildURI(sb, null, null, pathAndName, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
      sb.append("\"");
      if (iframePostEnabled) { // add ajax iframe target
        StringOutput so = new StringOutput();
        ubu.appendTarget(so);
        sb.append(so.toString());
      }
    } else { // for files, add PARAM_SERV command
      ubu.buildURI(sb, new String[] { PARAM_SERV }, new String[] { "x" }, pathAndName, AJAXFlags.MODE_NORMAL);
      sb.append("\" target=\"_blank\"");
    }
    // icon css
    sb.append(" class=\"b_with_small_icon_left ");
    if (isContainer) sb.append(CSSHelper.CSS_CLASS_FILETYPE_FOLDER);
    else sb.append(CSSHelper.createFiletypeIconCssClassFor(name));
    sb.append("\"");
    // file metadata
    if (metaInfo != null) {
      sb.append(" ext:qtip=\"<div class='b_ext_tooltip_wrapper b_briefcase_meta'>");
      if (StringHelper.containsNonWhitespace(metaInfo.getTitle())) {       
        sb.append("<h5>").append(Formatter.escapeDoubleQuotes(metaInfo.getTitle())).append("</h5>");   
      }
      if (StringHelper.containsNonWhitespace(metaInfo.getComment())) {
        sb.append(Formatter.escapeDoubleQuotes(metaInfo.getComment()));     
      }
      String author = metaInfo.getAuthor();
      if (StringHelper.containsNonWhitespace(author)) {
        sb.append("<p>").append(Formatter.escapeDoubleQuotes(translator.translate("mf.author")));
        sb.append(": ").append(Formatter.escapeDoubleQuotes(author)).append("</p>");     
      }
      sb.append("</div>\"");
    }
    sb.append(">");
    // name
    if (isAbstract) sb.append("<i>");
    sb.append(name);
    if (isAbstract) sb.append("</i>");
    sb.append("</a></td><td>");
   
    // filesize
    if (!isContainer) {
      // append filesize
      sb.append(StringHelper.formatMemory(leaf.getSize()));
    }
    sb.append("</td><td>");

    // type
    if (isContainer) {
      sb.append(translator.translate("Directory"));
    }
    else {
      if (type.equals(TYPE_FILE)) {
        sb.append(translator.translate("UnknownFile"));
      }
      else {
        sb.append(type.toUpperCase());
        sb.append(" ").append(translator.translate(TYPE_FILE));
      }
    }
    sb.append("</td><td>");
   
    if(canContainerVersion) {
      if (canVersion)
        sb.append(versions.getRevisionNr());
      sb.append("</td><td>");
    }
   
    // last modified
    long lastModified = child.getLastModified();
    if (lastModified != VFSConstants.UNDEFINED)
      sb.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, translator.getLocale()).format(new Date(lastModified)));
    else
      sb.append("-");
    sb.append("</td><td>");
   
    //locked
    if(metaInfo != null) {
      if(metaInfo.isLocked()) {
        Identity lockedBy = identityMap.get(metaInfo.getLockedBy());
        if(lockedBy == null) {
          lockedBy = metaInfo.getLockedByIdentity();
          if(lockedBy != null) {
            identityMap.put(lockedBy.getKey(), lockedBy);
          }
        }
       
        sb.append("<span class=\"b_small_icon b_briefcase_locked_file_icon\" ext:qtip=\"");
        if(lockedBy != null) {
          String firstName = lockedBy.getUser().getProperty(UserConstants.FIRSTNAME, translator.getLocale());
          String lastName = lockedBy.getUser().getProperty(UserConstants.LASTNAME, translator.getLocale());
          String date = "";
          if(metaInfo.getLockedDate() != null) {
            date = fc.getDateTimeFormat().format(metaInfo.getLockedDate());
          }
          sb.append(translator.translate("Locked", new String[]{firstName, lastName, date}));
        }
        sb.append("\">&#160;</span>");
      }
    }
    sb.append("</td><td class=\"b_last_child\">");

    // Info link
    if (canWrite) {
      String nameLowerCase = name.toLowerCase();
      if (!lockedForUser &&
          (nameLowerCase.endsWith(".html") || nameLowerCase.endsWith(".htm") || nameLowerCase.endsWith(".txt")
              || nameLowerCase.endsWith(".css"))) {
       
        sb.append("<a href=\"");
        ubu.buildURI(sb, new String[] { PARAM_CONTENTEDITID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
        sb.append("\"");
        if (iframePostEnabled) { // add ajax iframe target
          StringOutput so = new StringOutput();
          ubu.appendTarget(so);
          sb.append(so.toString());
        }
        sb.append(" ext:qtip=\"").append(StringEscapeUtils.escapeHtml(translator.translate("editor")));
        sb.append("\" class=\"b_small_icon b_briefcase_edit_file_icon\"></a>");
      }
     
      boolean canMetaData = MetaInfoHelper.canMetaInfo(child);
      if(canMetaData) {
        if(lockedForUser) {
        // Metadata link disabled...
          sb.append("<span ext:qtip=\"")
            .append(StringEscapeUtils.escapeHtml(translator.translate("edit")))
            .append("\" class=\" b_small_icon b_briefcase_edit_meta_dis_icon\">&#160;</span>");
        } else {
          // Metadata edit link... also handles rename for non-OlatRelPathImpls
          sb.append("<a href=\"");
          ubu.buildURI(sb, new String[] { PARAM_EDTID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
          sb.append("\"");
          if (iframePostEnabled) { // add ajax iframe target
            StringOutput so = new StringOutput();
            ubu.appendTarget(so);
            sb.append(so.toString());
          }
          sb.append(" ext:qtip=\"")
            .append(StringEscapeUtils.escapeHtml(translator.translate("mf.edit")))
            .append("\" class=\" b_small_icon b_briefcase_edit_meta_icon\"></a>");
        }
      }

      if(canVersion) {
        //Versions link
        if(lockedForUser) {
          sb.append("<span ext:qtip=\"")
            .append(StringEscapeUtils.escapeHtml(translator.translate("versions")))
            .append("\" class=\" b_small_icon b_briefcase_versions_dis_icon\">&#160;</span>");
        } else {
          sb.append("<a href=\"");
          ubu.buildURI(sb, new String[] { PARAM_VERID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
          sb.append("\"");
          if (iframePostEnabled) { // add ajax iframe target
            StringOutput so = new StringOutput();
            ubu.appendTarget(so);
            sb.append(so.toString());
          }
          sb.append(" ext:qtip=\"")
            .append(StringEscapeUtils.escapeHtml(translator.translate("versions")))
            .append("\" class=\" b_small_icon b_briefcase_versions_icon\"></a>");
        }
View Full Code Here

            ColumnDescriptor cd = table.getColumnDescriptor(c);
            if (cd instanceof StaticColumnDescriptor) {
              // ignore static column descriptors - of no value in excel download!
              continue;
            }
            StringOutput so = new StringOutput();
            cd.renderValue(so, r, null);
            String cellValue = so.toString();
            cellValue = StringHelper.stripLineBreaks(cellValue);
            sb.append('\t').append(cellValue);
          }
          sb.append('\n');
        }
View Full Code Here

    Object val = getModelData(row);
    customCellRenderer.render(sb, renderer, val, getLocale(), getAlignment(), getAction(row));
  }
 
  public String toString(int rowid) {
    StringOutput sb = new StringOutput();
    renderValue(sb,rowid,null);
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.render.StringOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.