コード例 #1
0
ファイル: LessonsComposite.java プロジェクト: WebHiob/WebHiob
  private void buildLessonTree(Response response) {
    TreeItem item = null;
    JsArray<LessonCategoryJS> lessonJSArray = JsonUtils.safeEval(response.getText());

    for (int i = 0; i < lessonJSArray.length(); i++) {
      LessonCategoryJS lessonCategoryJS = lessonJSArray.get(i);
      TreeItem category = new TreeItem();
      category.setText(lessonCategoryJS.getName());

      JsArray<LessonJS> lessons = lessonCategoryJS.getChildren();
      for (int j = 0; j < lessons.length(); j++) {
        LessonJS lesson = lessons.get(j);

        TreeItem lessonItem = new TreeItem();
        Storage sessionStorage = Storage.getSessionStorageIfSupported();
        String lastUrl = sessionStorage.getItem("lastUrl");
        lessonItem.setText(lesson.getText());
        category.addItem(lessonItem);
        lessonsTreeMap.put(lessonItem.getText(), lesson);
        if (lesson.getTechnology().equals(LessonTechnology.GWT.toString())) {
          addLessonToMap(lesson);
        }
        if (lastUrl != null && lastUrl.equals(lesson.getUrl())) {
          item = lessonItem;
          lessonPanel.setSelectedLesson(lesson);
          category.setState(true);
        }
      }
      lessonTree.addItem(category);
    }
    lessonTree.setSelectedItem(item);
  }
コード例 #2
0
ファイル: LessonsComposite.java プロジェクト: WebHiob/WebHiob
  public LessonsComposite() {
    initWidget(uiBinder.createAndBindUi(this));
    setWidth("100%");
    setHeight(Window.getClientHeight() + "px");

    lessonTreeTitle.getElement().getStyle().setFontSize(16, Style.Unit.PX);
    lessonPanel.setLessonsMap(lessonViewNameToWidgetMap);
    getAllTreeLessons();
    initLessonTree();
  }