Пример #1
0
  private TreeGrid createTreeSelector() {
    TreeGrid treeGrid = new TreeGrid();
    treeGrid.setCanSort(false);
    treeGrid.setDataSource(RelationDataSource.getInstance());
    TreeGridField parentId = new TreeGridField(RelationDataSource.FIELD_PARENT);
    TreeGridField label =
        new TreeGridField(
            RelationDataSource.FIELD_LABEL, i18n.DigitalObjectSearchView_ListHeaderLabel_Title());
    TreeGridField model =
        new TreeGridField(
            RelationDataSource.FIELD_MODEL,
            i18n.DigitalObjectSearchView_ListHeaderModel_Title(),
            150);
    model.setAlign(Alignment.CENTER);
    TreeGridField pid =
        new TreeGridField(
            RelationDataSource.FIELD_PID, i18n.DigitalObjectSearchView_ListHeaderPid_Title(), 100);
    pid.setAlign(Alignment.CENTER);
    TreeGridField created =
        new TreeGridField(
            RelationDataSource.FIELD_CREATED,
            i18n.DigitalObjectSearchView_ListHeaderCreated_Title(),
            100);
    created.setAlign(Alignment.CENTER);
    TreeGridField modified =
        new TreeGridField(
            RelationDataSource.FIELD_MODIFIED,
            i18n.DigitalObjectSearchView_ListHeaderModified_Title(),
            100);
    modified.setAlign(Alignment.CENTER);
    TreeGridField owner =
        new TreeGridField(
            RelationDataSource.FIELD_OWNER,
            i18n.DigitalObjectSearchView_ListHeaderOwner_Title(),
            100);
    TreeGridField export =
        new TreeGridField(
            SearchDataSource.FIELD_EXPORT,
            i18n.DigitalObjectSearchView_ListHeaderExport_Title(),
            100);
    export.setCellFormatter(
        new CellFormatter() {

          @Override
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            return value == null || "0".equals(value)
                ? i18nSmartGwt.dialog_NoButtonTitle()
                : i18nSmartGwt.dialog_YesButtonTitle();
          }
        });
    treeGrid.setFields(parentId, label, model, pid, created, modified, owner, export);
    treeGrid.setTitleField(RelationDataSource.FIELD_LABEL);
    treeGrid.setShowConnectors(true);
    treeGrid.setEmptyMessage(i18n.DigitalObjectTreeView_EmptySelection_Msg());
    treeGrid.setAlternateRecordStyles(true);
    treeGrid.setSelectionType(SelectionStyle.SINGLE);
    treeGrid.setContextMenu(Actions.createMenu());
    treeGrid.addDataArrivedHandler(
        new DataArrivedHandler() {

          @Override
          public void onDataArrived(DataArrivedEvent event) {
            selectAndExpandRootNode(event);
          }
        });
    return treeGrid;
  }
Пример #2
0
 private ToolStrip createToolbar() {
   ToolStrip toolbar = Actions.createToolStrip();
   return toolbar;
 }