Examples of UiTemplate


Examples of com.google.gwt.uibinder.client.UiTemplate

     * for any classloader to find it as a resource.
     */
    private static String deduceTemplateFile(MortalLogger logger,
            JClassType interfaceType) throws UnableToCompleteException {
        String templateName = null;
        UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
        if (annotation == null) {
            // if the interface is defined as a nested class, use the name of the
            // enclosing type
            if (interfaceType.getEnclosingType() != null) {
                interfaceType = interfaceType.getEnclosingType();
            }
            return slashify(interfaceType.getQualifiedBinaryName()) + TEMPLATE_SUFFIX;
        } else {
            templateName = annotation.value();
            if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
                logger.die("Template file name must end with " + TEMPLATE_SUFFIX);
            }

      /*
 
View Full Code Here

Examples of com.google.gwt.uibinder.client.UiTemplate

   * for any classloader to find it as a resource.
   */
  private static String deduceTemplateFile(MortalLogger logger,
      JClassType interfaceType) throws UnableToCompleteException {
    String templateName = null;
    UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
    if (annotation == null) {
      // if the interface is defined as a nested class, use the name of the
      // enclosing type
      if (interfaceType.getEnclosingType() != null) {
        interfaceType = interfaceType.getEnclosingType();
      }
      return slashify(interfaceType.getQualifiedSourceName()) + TEMPLATE_SUFFIX;
    } else {
      templateName = annotation.value();
      if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
        logger.die("Template file name must end with "
            + TEMPLATE_SUFFIX);
      }

View Full Code Here

Examples of com.google.gwt.uibinder.client.UiTemplate

   * for any classloader to find it as a resource.
   */
  private static String deduceTemplateFile(MortalLogger logger,
      JClassType interfaceType) throws UnableToCompleteException {
    String templateName = null;
    UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
    if (annotation == null) {
      // if the interface is defined as a nested class, use the name of the
      // enclosing type
      if (interfaceType.getEnclosingType() != null) {
        interfaceType = interfaceType.getEnclosingType();
      }
      return slashify(interfaceType.getQualifiedSourceName()) + TEMPLATE_SUFFIX;
    } else {
      templateName = annotation.value();
      if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
        logger.die("Template file name must end with "
            + TEMPLATE_SUFFIX);
      }

View Full Code Here

Examples of com.google.gwt.uibinder.client.UiTemplate

   * for any classloader to find it as a resource.
   */
  private static String deduceTemplateFile(MortalLogger logger,
      JClassType interfaceType) throws UnableToCompleteException {
    String templateName = null;
    UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
    if (annotation == null) {
      // if the interface is defined as a nested class, use the name of the
      // enclosing type
      if (interfaceType.getEnclosingType() != null) {
        interfaceType = interfaceType.getEnclosingType();
      }
      return slashify(interfaceType.getQualifiedSourceName()) + TEMPLATE_SUFFIX;
    } else {
      templateName = annotation.value();
      if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
        logger.die("Template file name must end with " + TEMPLATE_SUFFIX);
      }

      /*
 
View Full Code Here

Examples of com.google.gwt.uibinder.client.UiTemplate

   * for any classloader to find it as a resource.
   */
  private static String deduceTemplateFile(MortalLogger logger,
      JClassType interfaceType) throws UnableToCompleteException {
    String templateName = null;
    UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
    if (annotation == null) {
      // if the interface is defined as a nested class, use the name of the
      // enclosing type
      if (interfaceType.getEnclosingType() != null) {
        interfaceType = interfaceType.getEnclosingType();
      }
      return slashify(interfaceType.getQualifiedBinaryName()) + TEMPLATE_SUFFIX;
    } else {
      templateName = annotation.value();
      if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
        logger.die("Template file name must end with " + TEMPLATE_SUFFIX);
      }

      /*
 
View Full Code Here

Examples of com.google.gwt.uibinder.client.UiTemplate

   * for any classloader to find it as a resource.
   */
  private static String deduceTemplateFile(MortalLogger logger,
      JClassType interfaceType) throws UnableToCompleteException {
    String templateName = null;
    UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
    if (annotation == null) {
      // if the interface is defined as a nested class, use the name of the
      // enclosing type
      if (interfaceType.getEnclosingType() != null) {
        interfaceType = interfaceType.getEnclosingType();
      }
      return slashify(interfaceType.getQualifiedSourceName()) + TEMPLATE_SUFFIX;
    } else {
      templateName = annotation.value();
      if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
        logger.die("Template file name must end with " + TEMPLATE_SUFFIX);
      }

      /*
 
View Full Code Here

Examples of com.google.gwt.uibinder.client.UiTemplate

   * for any classloader to find it as a resource.
   */
  private static String deduceTemplateFile(MortalLogger logger,
      JClassType interfaceType) throws UnableToCompleteException {
    String templateName = null;
    UiTemplate annotation = interfaceType.getAnnotation(UiTemplate.class);
    if (annotation == null) {
      // if the interface is defined as a nested class, use the name of the
      // enclosing type
      if (interfaceType.getEnclosingType() != null) {
        interfaceType = interfaceType.getEnclosingType();
      }
      return slashify(interfaceType.getQualifiedBinaryName()) + TEMPLATE_SUFFIX;
    } else {
      templateName = annotation.value();
      if (!templateName.endsWith(TEMPLATE_SUFFIX)) {
        logger.die("Template file name must end with " + TEMPLATE_SUFFIX);
      }

      /*
 
View Full Code Here

Examples of org.apache.hama.manager.util.UITemplate

      } else { // log viewer

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        UITemplate uit = new UITemplate();
        String tplPath = "webapp/commons/tpl/"; // UI tempalet file path
        String tplfile = uit.load(tplPath + "tpl.logview.html"); // UI tmepalte
                                                                 // file

        HashMap<String, String> vars = new HashMap<String, String>();

        String tplHead = uit.getArea(tplfile, "head");
        String tplTail = uit.getArea(tplfile, "tail");

        vars.put("title", "logview");
        vars.put("hamaLogDir", hamaLogDir);

        out.println(uit.convert(tplHead, vars));
        vars.clear();

        if (pageType.equals("list")) { // list

          String[] listArea = new String[4];
          listArea[0] = uit.getArea(tplfile, "list0");
          listArea[1] = uit.getArea(tplfile, "list1");
          listArea[2] = uit.getArea(tplfile, "list2");
          listArea[3] = uit.getArea(tplfile, "list3");

          vars.put("hamaLogDir", hamaLogDir);
          vars.put("dirName", dirName);
          vars.put("targetUri", targetUri);
          out.println(uit.convert(listArea[0], vars));
          vars.clear();

          List<File> arrayList = LogView.getLogFileList(logDirPath);
          File file;

          for (int i = 0; i < arrayList.size(); i++) {
            file = arrayList.get(i);
            vars.put("dirName", dirName);
            vars.put("fileName", file.getName());
            vars.put("fileLastModified",
                new Date(file.lastModified()).toString());
            vars.put("targetUri", targetUri);

            if (file.isDirectory()) {
              vars.put("type", "dir");
              out.println(uit.convert(listArea[1], vars));
            } else {
              vars.put("fileLength", LogView.convertFileSize(file.length()));
              vars.put("type", "file");
              out.println(uit.convert(listArea[2], vars));
            }
          }

          vars.clear();
          out.println(uit.convert(listArea[3], vars));

        } else if (pageType.equals("detail")) { // detail

          String[] detailArea = new String[4];
          detailArea[0] = uit.getArea(tplfile, "detail0");
          detailArea[1] = uit.getArea(tplfile, "detail1");
          detailArea[2] = uit.getArea(tplfile, "detail2");

          vars.put("dirName", dirName);
          vars.put("fileName", fileName);
          vars.put("hamaLogDir", hamaLogDir);
          vars.put("targetUri", targetUri);

          out.println(uit.convert(detailArea[0], vars));

          BufferedReader br = null;
          String logLine;

          try {
            br = new BufferedReader(new FileReader(logfilePath));

            while ((logLine = br.readLine()) != null) {
              vars.put("logLine", logLine);
              out.println(uit.convert(detailArea[1], vars));
            }

          } catch (IOException e) {
            e.printStackTrace();
          } finally {
            if (br != null) {
              br.close();
            }

          }

          out.println(uit.convert(detailArea[2], vars));

        } else if (pageType.equals("tail")) { // tail
          String tailLine = request.getParameter("tailLine");
          tailLine = (tailLine == null) ? "100" : tailLine;

          String[] tailArea = new String[3];
          tailArea[0] = uit.getArea(tplfile, "logtail0");
          tailArea[1] = uit.getArea(tplfile, "logtail1");
          tailArea[2] = uit.getArea(tplfile, "logtail2");

          vars.put("hamaLogDir", hamaLogDir);
          vars.put("dirName", dirName);
          vars.put("fileName", fileName);
          vars.put("tailLine", tailLine);
          vars.put("pageType", pageType);
          vars.put("targetUri", targetUri);

          out.println(uit.convert(tailArea[0], vars));
          vars.clear();

          InputStream is = null;
          InputStreamReader isr = null;
          BufferedReader br = null;

          try {

            String tailcmd = "tail -" + tailLine + "  " + logfilePath;
            Runtime runtime = Runtime.getRuntime();
            Process process = runtime.exec(tailcmd);

            is = process.getInputStream();
            isr = new InputStreamReader(is);
            br = new BufferedReader(isr);
            String eachLine = "";

            int lineNum = 0;
            while ((eachLine = br.readLine()) != null) {
              vars.put("lineNum", Integer.toString(++lineNum));
              vars.put("logLine", eachLine);
              out.println(uit.convert(tailArea[1], vars));
            }

          } catch (IOException e) {
            e.printStackTrace();
          } finally {
            if (br != null) {
              br.close();
            }
            if (isr != null) {
              isr.close();
            }
            if (is != null) {
              is.close();
            }
          }

          vars.clear();
          out.println(uit.convert(tailArea[2], vars));

        } else if (pageType.equals("tasklist")) { // job list
          String jobId = request.getParameter("jobId");
          String[] listArea = new String[3];
          listArea[0] = uit.getArea(tplfile, "tasklist0");
          listArea[1] = uit.getArea(tplfile, "tasklist1");
          listArea[2] = uit.getArea(tplfile, "tasklist2");

          ServletContext ctx = getServletContext();
          BSPMaster tracker = (BSPMaster) ctx.getAttribute("bsp.master");
          ClusterStatus status = tracker.getClusterStatus(true);
          JobStatus jobStatus = tracker.getJobStatus(BSPJobID.forName(jobId));

          vars.put("hamaLogDir", hamaLogDir);
          vars.put("dirName", dirName);
          vars.put("targetUri", targetUri);
          vars.put("jobId", jobId);
          vars.put("jobStatus", jobStatus.getState().toString());
          vars.put("jobName", jobStatus.getName());

          out.println(uit.convert(listArea[0], vars));
          vars.clear();

          for (Entry<String, GroomServerStatus> entry : status
              .getActiveGroomServerStatus().entrySet()) {
            vars.put("jobId", jobId);
            vars.put("dirName", dirName);
            vars.put("serverName", entry.getKey());
            vars.put("hostName", entry.getValue().getGroomHostName());
            vars.put("targetUri", targetUri);
            vars.put("type", "dir");
            out.println(uit.convert(listArea[1], vars));

          }

          vars.clear();
          out.println(uit.convert(listArea[2], vars));
        }

        out.println(tplTail);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.