code: protected CmsTreeItem createTreeItem(
          CmsGalleryFolderBean galleryInfo,
          List<String> selectedGalleries,
          boolean forTree) {
  
          CmsListItemWidget listItemWidget = new CmsListItemWidget(galleryInfo);
          listItemWidget.setUnselectable();
          CmsCheckBox checkBox = new CmsCheckBox();
          SelectionHandler selectionHandler = new SelectionHandler(galleryInfo.getPath(), checkBox);
          checkBox.addClickHandler(selectionHandler);
          listItemWidget.addClickHandler(selectionHandler);
          if ((selectedGalleries != null) && selectedGalleries.contains(galleryInfo.getPath())) {
              checkBox.setChecked(true);
          }
  
          if (galleryInfo.isEditable()) {
              if (CmsEditExternalLinkDialog.LINK_GALLERY_RESOURCE_TYPE_NAME.equals(galleryInfo.getType())) {
                  CmsPushButton createExternalLink = createNewExternalLinkButton(galleryInfo.getPath());
                  if (createExternalLink != null) {
                      listItemWidget.addButton(createExternalLink);
                  }
              } else {
                  listItemWidget.addButton(createUploadButtonForTarget(galleryInfo.getPath(), false));
              }
          }
          listItemWidget.addButton(createSelectButton(selectionHandler));
          if (m_tabHandler.hasGalleriesSelectable()) {
              CmsPushButton selectButton = createSelectResourceButton(
                  galleryInfo.getPath(),
                  CmsUUID.getNullUUID(),
                  "",
                  "");
              listItemWidget.addButton(selectButton);
          }
  
          CmsTreeItem treeItem = new CmsTreeItem(forTree, checkBox, listItemWidget);
          treeItem.setId(galleryInfo.getPath());
          return treeItem;
      }
docs: Creates a tree item widget used in list and tree view of this tab.<p>
  
  @param galleryInfo the gallery folder bean
  @param selectedGalleries the selected galleries
  @param forTree <code>true</code> if the item is used within tree view
  
  @return the tree item