Package smilehouse.tools.ui.web

Examples of smilehouse.tools.ui.web.TableTool


        int numberOfLogEntries = pers.getNumberOfLogMessageEntries(pipeId);
        int numberOfPages = numberOfLogEntries > 0 ? (int) Math.ceil(((double) numberOfLogEntries)
                / ((double) LOG_ENTRIES_PER_PAGE)) : 1;
        String pager = getPager(page, numberOfPages, labels);

        TableTool tt = new TableTool();
        tt.setZebra(true);
        Table logTable = tt.getInnerTable().addElement(
            tt.getHeaderRow(new String[] {
                    labels.getLabel("time"),
                    labels.getLabel("pipe"),
                    labels.getLabel("status"),
                    labels.getLabel("lastuser"),
                    labels.getLabel("messages")}));

        //colorIndex needed for abort and error colors
        int colorIndex = 0;
        LogEntry logEntryOld = null;
      TD messageCell = new TD();
      boolean firstEntry = true;
        for(Iterator i = entries.iterator(); i.hasNext();) {

            LogMessageEntry entry = (LogMessageEntry) i.next();
           
          LogEntry logEntry = entry.getLog();
          /* 
           * Rows are added to table immediately after logEntry has changed.
           * To detect the change, logEntryOld is used for comparison.
           * When entering the for-loop for the first time logEntryOld is set to logEntry.
           */
          if (firstEntry){
            logEntryOld = logEntry;
            firstEntry = false;
            //check if entry is continued from previous page
            if(entry.getIndex() != 1){
              messageCell.addElement("...");
                messageCell.addElement(new BR());
            }
          }
          /*
           * When logEntry gets new value, the previously collected log message entries are written
           * to table and new TD() is created
           */
        if(!logEntry.equals(logEntryOld)){
              colorIndex = 1 - colorIndex;
              writeRow(logEntryOld, dFormat, colorIndex, tt, logTable, messageCell, labels);

              messageCell = new TD();
              messageCell.setAlign("left"); // IE6 would center the contents by default

              logEntryOld = logEntry;
          }
       
        messageCell.addElement(entry.getMessage());
        messageCell.addElement(new BR());
       
          //write last row (complete or incomplete entry)
        if (!i.hasNext()){
          //check if entry is continued on next page
          if (entry.getIndex() < pers.getMaxMessageIndex(logEntry.getId()))
              messageCell.addElement("...");
          colorIndex = 1 - colorIndex;
              writeRow(logEntryOld, dFormat, colorIndex, tt, logTable, messageCell, labels);
        }
         
        }
       
        ElementContainer content = new ElementContainer()
            .addElement(new BR())
            .addElement(pager)
            .addElement(tt.getOuterTable(logTable))
            .addElement(pager)
            .addElement(new HR().addElement(form));

        return content.toString();
    }
View Full Code Here


                    return componentType1 - componentType2;
                }
            }
        });
       
        TableTool tt = new TableTool();
        tt.setZebra(true);
        Table componentTable = tt.getInnerTable().setWidth("100%");
        componentTable.addElement(tt.getHeaderRow(new String[] {
                labels.getLabel(NAME),
                labels.getLabel(TYPE),
                labels.getLabel(COMPONENT_ID),
                labels.getLabel(DESCRIPTION),
                Entities.NBSP}));
        Locale locale = labels.getLocale();
        for(Iterator iter = components.iterator(); iter.hasNext();) {
            PipeComponentIF impl = (PipeComponentIF) iter.next();
            TR row = tt.getRow();
            row.addElement(new TD().addElement(impl.getName()))
                .addElement(
                    new TD().addElement(labels.getLabel("component_type"
                        + impl.getType())))
                        .addElement(new TD().addElement(impl.getID()))
                        .addElement(new TD().addElement(impl.getDescription(locale)));
            if(pers.isDynamicComponent(impl)) {
                row.setClass("dynamicComponent");
            }
            componentTable.addElement(row);
        }

        Input reloadComponentsButton = new Input(Input.BUTTON, "reload_components", labels
            .getLabel("reload_components"));
        reloadComponentsButton.setOnClick("document.forms[0]." + ACTION + ".value=1;document.forms[0].submit();");

      
        ElementContainer content = new ElementContainer().addElement(
            tt.getOuterTable(componentTable).setWidth("100%")).addElement(new HR()).
            addElement(reloadComponentsButton);

       
        Form form = getForm("Components", content.toString(), labels, false, false).addElement(
            new Input(Input.HIDDEN, ACTION, "0"));
View Full Code Here

        labels, false, false);
    form.addElement(new Input(Input.HIDDEN, ACTION, "0"));

    List entries = pers.getPipeExecutionRequests(null);

    TableTool tt = new TableTool();
    tt.setZebra(true);
    Table queueTable = tt.getInnerTable().addElement(
        tt.getHeaderRow(new String[] { labels.getLabel("pipe"),
            labels.getLabel("createtime"),
            labels.getLabel("starttime") }));

    int colorIndex = 0;
    for (Iterator i = entries.iterator(); i.hasNext(); colorIndex = 1 - colorIndex) {
      PipeExecutionRequest entry = (PipeExecutionRequest) i.next();

      TR row = tt.getRow();

      Date creationTime = entry.getCreatedDate();
      String formattedCreationTime;
      if (creationTime != null) {
        formattedCreationTime = dFormat.format(creationTime);
      } else {
        formattedCreationTime = "";
      }
      Date startTime = entry.getStartedDate();
      String formattedStartTime;
      if (startTime != null) {
        formattedStartTime = dFormat.format(startTime);
      } else {
        formattedStartTime = "Queued";
      }
      queueTable.addElement(row.addElement(
          new TD().addElement(new A("EditPipe?pipeid="
              + entry.getPipe().getId(), entry.getPipe()
              .getName()))).addElement(
          new TD().addElement(formattedCreationTime)).addElement(
          new TD().addElement(formattedStartTime)));

    }

    ElementContainer content = new ElementContainer().addElement(new BR())
        .addElement(new P().setAlign(AlignType.CENTER))
        .addElement(tt.getOuterTable(queueTable))
        .addElement(new HR().addElement(form));

    return content.toString();
  }
View Full Code Here

TOP

Related Classes of smilehouse.tools.ui.web.TableTool

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.