public void addSessionInfo() {
    TreeItem sessionInfo = new TreeItem(SESSION_INFO_ID);
    sessionInfo.put(NAME, "Session Info");
    treeStore.insert(0, sessionInfo);

    String tagsStr = "";
    TreeItem itemActiveKernels = new TreeItem(ACTIVE_KERNELS);
    TreeItem itemTaskExecuted = new TreeItem(TASKS_EXECUTED);
    TreeItem itemTaskFailed = new TreeItem(TASKS_FAILED);
    TreeItem itemDateStart = new TreeItem(START_DATE);
    TreeItem itemDateEnd = new TreeItem(END_DATE);
    TreeItem itemComment = new TreeItem(COMMENT);
    TreeItem itemUserComment = new TreeItem(USER_COMMENT);
    TreeItem itemTags = new TreeItem(SESSION_TAGS);

    itemActiveKernels.put(NAME, ACTIVE_KERNELS);
    itemTaskExecuted.put(NAME, TASKS_EXECUTED);
    itemTaskFailed.put(NAME, TASKS_FAILED);
    itemDateStart.put(NAME, START_DATE);
    itemDateEnd.put(NAME, END_DATE);
    itemComment.put(NAME, COMMENT);
    if (webClientProperties.isUserCommentStoreAvailable()) itemUserComment.put(NAME, USER_COMMENT);
    if (webClientProperties.isTagsStoreAvailable()) itemTags.put(NAME, SESSION_TAGS);

    for (SessionDataDto session : chosenSessions) {
      itemActiveKernels.put(
          SESSION_HEADER + session.getSessionId(), session.getActiveKernelsCount() + "");
      itemTaskExecuted.put(
          SESSION_HEADER + session.getSessionId(), session.getTasksExecuted() + "");
      itemTaskFailed.put(SESSION_HEADER + session.getSessionId(), session.getTasksFailed() + "");
      itemDateStart.put(
          SESSION_HEADER + session.getSessionId(), dateFormatter.format(session.getStartDate()));
      itemDateEnd.put(
          SESSION_HEADER + session.getSessionId(), dateFormatter.format(session.getEndDate()));
      itemComment.put(SESSION_HEADER + session.getSessionId(), session.getComment());
      if (webClientProperties.isUserCommentStoreAvailable()) {
        String userComment = session.getUserComment() == null ? "" : session.getUserComment();
        itemUserComment.put(SESSION_HEADER + session.getSessionId(), userComment);
      }
      if (webClientProperties.isTagsStoreAvailable()) {
        for (int i = 0; i < session.getTags().size(); i++) {
          if (i == session.getTags().size() - 1) tagsStr += session.getTags().get(i).getName();
          else tagsStr += session.getTags().get(i).getName() + ", ";
        }
        itemTags.put(SESSION_HEADER + session.getSessionId(), tagsStr);
        tagsStr = "";
      }
    }
    treeStore.add(sessionInfo, itemComment);
    if (webClientProperties.isUserCommentStoreAvailable())
      treeStore.add(sessionInfo, itemUserComment);
    if (webClientProperties.isTagsStoreAvailable()) treeStore.add(sessionInfo, itemTags);
    treeStore.add(sessionInfo, itemDateStart);
    treeStore.add(sessionInfo, itemDateEnd);

    treeStore.add(sessionInfo, itemActiveKernels);
    treeStore.add(sessionInfo, itemTaskExecuted);
    treeStore.add(sessionInfo, itemTaskFailed);
  }
Exemple #2
0
  public BlogEntry(Entry entry, Blog blog) {
    setStyleName(CssClasses.BLOG_ENTRY);

    this.blog = blog;

    HTML msg = new HTML();
    msg.setHTML(entry.getText());
    msg.setStyleName(CssClasses.BLOG_TEXT);

    Label author = new Label();
    author.setText(entry.getAuthor().getName());
    author.setStyleName(CssClasses.AUTHOR);

    Label date = new Label();
    date.setText(DateTimeFormat.getFormat("dd. MMM yyyy, HH:mm").format(entry.getDate()));
    date.setStyleName(CssClasses.DATE);

    commentContainer.setStyleName(CssClasses.BLOG_ENTRY_COMMENT_CONTAINER);

    add(msg);
    add(date);
    add(author);
    add(new Separator());
    add(new CommentForm(this));
    add(commentContainer);
  }
  public void addTestInfo(TaskDataDto test, Map<String, TestInfoDto> testInfoMap) {

    TreeItem testItem = getTestItem(test);

    String testInfoId = testItem.getKey() + TEST_INFO;
    if (treeStore.findModelWithKey(testInfoId) != null) {
      return;
    }

    String testItemName = getTestItemName(test);
    TreeItem testInfo = new TreeItem(testInfoId);
    testInfo.put(NAME, TEST_INFO);
    testInfo.put(TEST_DESCRIPTION, test.getDescription());
    testInfo.put(TEST_NAME, testItemName);
    treeStore.insert(testItem, 0, testInfo);

    TreeItem clock = new TreeItem(testItem.getKey() + "Clock");
    clock.put(NAME, "Clock");
    clock.put(TEST_DESCRIPTION, test.getDescription());
    clock.put(TEST_NAME, testItemName);
    clock.put(TEST_INFO, TEST_INFO);
    for (SessionDataDto session : chosenSessions) {
      if (testInfoMap.get(session.getSessionId()) != null)
        clock.put(
            SESSION_HEADER + session.getSessionId(),
            testInfoMap.get(session.getSessionId()).getClock());
    }
    treeStore.add(testInfo, clock);

    TreeItem termination = new TreeItem(testItem.getKey() + "Termination");
    termination.put(NAME, "Termination");
    termination.put(TEST_DESCRIPTION, test.getDescription());
    termination.put(TEST_NAME, testItemName);
    termination.put(TEST_INFO, TEST_INFO);
    for (SessionDataDto session : chosenSessions) {
      if (testInfoMap.get(session.getSessionId()) != null)
        termination.put(
            SESSION_HEADER + session.getSessionId(),
            testInfoMap.get(session.getSessionId()).getTermination());
    }
    treeStore.add(testInfo, termination);

    TreeItem startTime = new TreeItem(testItem.getKey() + "Start time");
    startTime.put(NAME, "Start time");
    startTime.put(TEST_DESCRIPTION, test.getDescription());
    startTime.put(TEST_NAME, testItemName);
    startTime.put(TEST_INFO, TEST_INFO);
    for (SessionDataDto session : chosenSessions) {
      if (testInfoMap.get(session.getSessionId()) != null) {
        Date date = testInfoMap.get(session.getSessionId()).getStartTime();
        startTime.put(SESSION_HEADER + session.getSessionId(), dateFormatter.format(date));
      }
    }
    treeStore.add(testInfo, startTime);
  }
  @Override
  public Widget asWidget() {
    // reduce the padding on text element as we have widgets in the cells
    SafeStyles textStyles = SafeStylesUtils.fromTrustedString("padding: 1px 3px;");

    ColumnConfig<Plant, String> cc1 =
        new ColumnConfig<Plant, String>(properties.name(), 100, "Name");
    // IMPORTANT we want the text element (cell parent) to only be as wide as the cell and not fill
    // the cell
    cc1.setColumnTextClassName(CommonStyles.get().inlineBlock());
    cc1.setColumnTextStyle(textStyles);

    TextButtonCell button = new TextButtonCell();
    button.addSelectHandler(
        new SelectHandler() {

          @Override
          public void onSelect(SelectEvent event) {
            Context c = event.getContext();
            int row = c.getIndex();
            Plant p = store.get(row);
            Info.display("Event", "The " + p.getName() + " was clicked.");
          }
        });
    cc1.setCell(button);

    DateCell dateCell = new DateCell();
    dateCell.setPropertyEditor(
        new DateTimePropertyEditor(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT)));

    ColumnConfig<Plant, Date> cc2 =
        new ColumnConfig<Plant, Date>(properties.available(), 100, "Date");
    cc2.setColumnTextStyle(textStyles);
    cc2.setCell(dateCell);

    List<ColumnConfig<Plant, ?>> l = new ArrayList<ColumnConfig<Plant, ?>>();
    l.add(cc1);
    l.add(cc2);
    ColumnModel<Plant> cm = new ColumnModel<Plant>(l);

    store = new ListStore<Plant>(properties.key());
    store.addAll(TestData.getPlants());

    Grid<Plant> grid = new Grid<Plant>(store, cm);
    grid.getView().setForceFit(true);

    ContentPanel cp = new ContentPanel();
    cp.setHeadingText("Cell Grid");
    cp.setWidget(grid);
    cp.setPixelSize(500, 400);
    cp.addStyleName("margin-10");
    return cp;
  }
Exemple #5
0
 private String formatDate(Date date, String pattern) {
   return DateTimeFormat.getFormat(pattern).format(date);
 }