private void addFileNameColumn() {
   Column<MessageConsoleServiceRow, HyperLinkCell.HyperLink> column =
       new Column<MessageConsoleServiceRow, HyperLinkCell.HyperLink>(new HyperLinkCell()) {
         @Override
         public HyperLinkCell.HyperLink getValue(MessageConsoleServiceRow row) {
           if (row.getMessagePath() != null) {
             return HyperLinkCell.HyperLink.newLink(row.getMessagePath().getFileName());
           } else {
             return HyperLinkCell.HyperLink.newText("-");
           }
         }
       };
   column.setFieldUpdater(
       new FieldUpdater<MessageConsoleServiceRow, HyperLinkCell.HyperLink>() {
         @Override
         public void update(
             final int index,
             final MessageConsoleServiceRow row,
             final HyperLinkCell.HyperLink value) {
           if (row.getMessagePath() != null) {
             placeManager.goTo(row.getMessagePath());
           }
         }
       });
   dataGrid.addColumn(column, MessageConsoleResources.CONSTANTS.FileName());
   dataGrid.setColumnWidth(column, 60, Style.Unit.PCT);
 }
Beispiel #2
0
  private Column<FileSystemItem, ImageResource> addIconColumn(
      final FileTypeRegistry fileTypeRegistry) {
    Column<FileSystemItem, ImageResource> iconColumn =
        new Column<FileSystemItem, ImageResource>(new ImageResourceCell()) {

          @Override
          public ImageResource getValue(FileSystemItem object) {
            if (object == parentPath_) return FileIconResources.INSTANCE.iconUpFolder();
            else return fileTypeRegistry.getIconForFile(object);
          }
        };
    iconColumn.setSortable(true);
    filesDataGrid_.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    filesDataGrid_.setColumnWidth(iconColumn, ICON_COLUMN_WIDTH_PIXELS, Unit.PX);

    sortHandler_.setComparator(
        iconColumn,
        new FilesListComparator() {
          @Override
          public int doCompare(FileSystemItem arg0, FileSystemItem arg1) {
            if (arg0.isDirectory() && !arg1.isDirectory()) return 1;
            else if (arg1.isDirectory() && !arg0.isDirectory()) return -1;
            else return arg0.getExtension().compareTo(arg1.getExtension());
          }
        });

    return iconColumn;
  }
  private void addRemoveRowColumn() {
    Column<PropertyRow, String> column =
        new Column<PropertyRow, String>(
            new ButtonCell(IconType.TRASH, ButtonType.DANGER, ButtonSize.SMALL)) {
          @Override
          public String getValue(PropertyRow propertyRow) {
            return Constants.INSTANCE.persistence_unit_property_grid_action_delete();
          }
        };

    column.setFieldUpdater(
        new FieldUpdater<PropertyRow, String>() {
          @Override
          public void update(int index, PropertyRow propertyRow, String value) {

            if (!readOnly) {
              onRemoveProperty(propertyRow);
            }
          }
        });

    dataGrid.addColumn(
        column, Constants.INSTANCE.persistence_unit_property_grid_property_action_column());
    dataGrid.setColumnWidth(column, 10, Style.Unit.PCT);
  }
Beispiel #4
0
  @Override
  protected void configureDisplay(CellTable<IndexedDIP> display) {

    dateCreated =
        new Column<IndexedDIP, Date>(
            new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) {
          @Override
          public Date getValue(IndexedDIP dip) {
            return dip != null ? dip.getDateCreated() : null;
          }
        };

    lastModified =
        new Column<IndexedDIP, Date>(
            new DateCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) {
          @Override
          public Date getValue(IndexedDIP dip) {
            return dip != null ? dip.getLastModified() : null;
          }
        };

    titleColumn =
        new TextColumn<IndexedDIP>() {

          @Override
          public String getValue(IndexedDIP dip) {
            return dip != null ? dip.getTitle() : null;
          }
        };

    titleColumn.setSortable(true);
    dateCreated.setSortable(true);
    lastModified.setSortable(true);

    display.addColumn(titleColumn, messages.aipGenericTitle());
    display.addColumn(dateCreated, messages.dipCreatedDate());
    display.addColumn(lastModified, messages.dipLastModified());

    Label emptyInfo = new Label(messages.noItemsToDisplay());
    display.setEmptyTableWidget(emptyInfo);

    // define default sorting
    display.getColumnSortList().push(new ColumnSortInfo(titleColumn, true));

    // display.setColumnWidth(titleColumn, 7.0, Unit.EM);
    display.setColumnWidth(dateCreated, 13.0, Unit.EM);
    display.setColumnWidth(lastModified, 13.0, Unit.EM);

    dateCreated.setCellStyleNames("nowrap");
    lastModified.setCellStyleNames("nowrap");

    addStyleName("my-collections-table");
    emptyInfo.addStyleName("my-collections-empty-info");
  }
  private Column column4Column() {
    Column<DataMockSummary, String> column4Column =
        new Column<DataMockSummary, String>(new TextCell()) {

          @Override
          public String getValue(DataMockSummary unit) {
            return unit.getColumn4();
          }
        };
    column4Column.setSortable(true);
    return column4Column;
  }
  private Column<CMSContentSummary, ?> initNameColumn() {
    Column<CMSContentSummary, String> processNameColumn =
        new Column<CMSContentSummary, String>(new TextCell()) {
          @Override
          public String getValue(CMSContentSummary object) {
            return object.getName();
          }
        };
    processNameColumn.setSortable(true);

    return processNameColumn;
  }
Beispiel #7
0
  public void createOffersTable() {

    TextColumn<Offre> titleCollumn =
        new TextColumn<Offre>() {

          @Override
          public String getValue(Offre offre) {

            return offre.getLibelle();
          }
        };

    TextColumn<Offre> priceColumn =
        new TextColumn<Offre>() {

          @Override
          public String getValue(Offre offre) {

            return String.valueOf(offre.getPrix());
          }
        };

    this.multiSelectionModel = new MultiSelectionModel<Offre>();
    cellTable.setSelectionModel(
        multiSelectionModel, DefaultSelectionEventManager.<Offre>createCheckboxManager());

    ButtonCell cellButton = new ButtonCell();
    Column<Offre, String> column =
        new Column<Offre, String>(cellButton) {

          @Override
          public String getValue(Offre object) {
            return "DELETE";
          }
        };
    column.setFieldUpdater(
        new FieldUpdater<Offre, String>() {

          @Override
          public void update(int index, Offre object, String value) {
            listOffers.getList().remove(object);
          }
        });

    // Add the columns.
    cellTable.addColumn(titleCollumn, "Intitulle");
    cellTable.addColumn(priceColumn, "Prix");
    cellTable.addColumn(column);
    //		final SimplePager pager = new SimplePager();
    //		pager.setDisplay(cellTable);

    listOffers.addDataDisplay(cellTable);
  }
 private Column initDescriptionColumn() {
   // start time
   Column<ProcessInstanceSummary, String> descriptionColumn =
       new Column<ProcessInstanceSummary, String>(new TextCell()) {
         @Override
         public String getValue(ProcessInstanceSummary object) {
           return object.getProcessInstanceDescription();
         }
       };
   descriptionColumn.setSortable(true);
   descriptionColumn.setDataStoreName("log.processInstanceDescription");
   return descriptionColumn;
 }
  private Column initInitiatorColumn() {
    Column<ProcessInstanceSummary, String> processInitiatorColumn =
        new Column<ProcessInstanceSummary, String>(new TextCell()) {
          @Override
          public String getValue(ProcessInstanceSummary object) {
            return object.getInitiator();
          }
        };
    processInitiatorColumn.setSortable(true);
    processInitiatorColumn.setDataStoreName("log.identity");

    return processInitiatorColumn;
  }
 private Column initJobTypeColumn() {
   // Job type
   Column<RequestSummary, String> jobTypeColumn =
       new Column<RequestSummary, String>(new TextCell()) {
         @Override
         public String getValue(RequestSummary object) {
           return object.getCommandName();
         }
       };
   jobTypeColumn.setSortable(true);
   jobTypeColumn.setDataStoreName(COLUMN_COMMANDNAME);
   return jobTypeColumn;
 }
 private Column initDueDateColumn() {
   // Time
   Column<RequestSummary, String> dueDateColumn =
       new Column<RequestSummary, String>(new TextCell()) {
         @Override
         public String getValue(RequestSummary object) {
           return DateUtils.getDateTimeStr(object.getTime());
         }
       };
   dueDateColumn.setSortable(true);
   dueDateColumn.setDataStoreName(COLUMN_TIMESTAMP);
   return dueDateColumn;
 }
 private Column initJobNameColumn() {
   // Job name
   Column<RequestSummary, String> jobNameColumn =
       new Column<RequestSummary, String>(new TextCell()) {
         @Override
         public String getValue(RequestSummary object) {
           return object.getKey();
         }
       };
   jobNameColumn.setSortable(true);
   jobNameColumn.setDataStoreName(COLUMN_BUSINESSKEY);
   return jobNameColumn;
 }
  private Column initJobIdColumn() {
    // Id
    Column<RequestSummary, Number> jobIdColumn =
        new Column<RequestSummary, Number>(new NumberCell()) {
          @Override
          public Number getValue(RequestSummary object) {
            return object.getJobId();
          }
        };
    jobIdColumn.setSortable(true);
    jobIdColumn.setDataStoreName(COLUMN_ID);

    return jobIdColumn;
  }
  private Column initStatusColumn() {
    // Status
    Column<RequestSummary, String> statusColumn =
        new Column<RequestSummary, String>(new TextCell()) {
          @Override
          public String getValue(RequestSummary object) {
            return object.getStatus();
          }
        };
    statusColumn.setSortable(true);
    statusColumn.setDataStoreName(COLUMN_STATUS);

    return statusColumn;
  }
  private Column initProcessVersionColumn() {
    // Process Version.
    Column<ProcessInstanceSummary, String> processVersionColumn =
        new Column<ProcessInstanceSummary, String>(new TextCell()) {
          @Override
          public String getValue(ProcessInstanceSummary object) {
            return object.getProcessVersion();
          }
        };
    processVersionColumn.setSortable(true);
    processVersionColumn.setDataStoreName("log.processVersion");

    return processVersionColumn;
  }
  private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> principals = createColumn("principals");
    Column<ModelNode, String> roles = createColumn("roles");
    principals.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    roles.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(principals, "Principals");
    table.addColumn(roles, "Roles");
    table.setColumnWidth(principals, 30, Style.Unit.PCT);
    table.setColumnWidth(roles, 30, Style.Unit.PCT);
  }
Beispiel #17
0
  protected void initializeValueColumn() {

    ValueMapCell cell =
        new ValueMapCell() {

          @Override
          protected String getText(ValueMapEntry entry) {
            return entry.getValue();
          }
        };

    Column<ValueMapEntry, ValueMapEntry> valueColumn = new ValueMapColumn(cell);
    valueColumn.setCellStyleNames("original-value");
    table.addColumn(valueColumn, translations.originalValueLabel());
  }
Beispiel #18
0
  private void initializeLabelColumn() {

    ValueMapCell cell =
        new ValueMapCell() {

          @Override
          protected String getText(ValueMapEntry entry) {
            return entry.getLabel();
          }
        };

    Column<ValueMapEntry, ValueMapEntry> labelColumn = new ValueMapColumn(cell);
    labelColumn.setCellStyleNames("original-label");
    table.addColumn(labelColumn, translations.originalLabelLabel());
  }
Beispiel #19
0
  private <C> Column<RuleInfo, C> addColumn(
      Cell<C> cell,
      String headerText,
      final GetValue<C> getter,
      FieldUpdater<RuleInfo, C> fieldUpdater) {
    Column<RuleInfo, C> column =
        new Column<RuleInfo, C>(cell) {
          @Override
          public C getValue(RuleInfo object) {
            return getter.getValue(object);
          }
        };
    column.setFieldUpdater(fieldUpdater);

    dataGrid.addColumn(column, headerText);
    return column;
  }
 private <C> void addColumn(
     Cell<C> cell,
     String headerText,
     final GetValue<C> getter,
     FieldUpdater<MaterialListProxy, C> fieldUpdater) {
   Column<MaterialListProxy, C> column =
       new Column<MaterialListProxy, C>(cell) {
         @Override
         public C getValue(MaterialListProxy object) {
           return getter.getValue(object);
         }
       };
   column.setFieldUpdater(fieldUpdater);
   if (cell instanceof AbstractEditableCell<?, ?>) {
     editableCells.add((AbstractEditableCell<?, ?>) cell);
   }
   table.addColumn(column);
 }
  private Column<LawProxy, String> getNameColumn(final AbstractCell nameCell) {
    Column<LawProxy, String> column =
        new Column<LawProxy, String>(nameCell) {
          @Override
          public String getValue(LawProxy object) {
            return object.getTitle();
          }
        };

    column.setFieldUpdater(
        new FieldUpdater<LawProxy, String>() {
          @Override
          public void update(int index, LawProxy object, String value) {
            handler.onResultClick(new CellTableClickEvent(object.getKey()));
          }
        });

    return column;
  }
  private Column initStartDateColumn() {
    // start time
    Column<ProcessInstanceSummary, String> startTimeColumn =
        new Column<ProcessInstanceSummary, String>(new TextCell()) {
          @Override
          public String getValue(ProcessInstanceSummary object) {
            Date startTime = object.getStartTime();
            if (startTime != null) {
              DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy HH:mm");
              return format.format(startTime);
            }
            return "";
          }
        };
    startTimeColumn.setSortable(true);
    startTimeColumn.setDataStoreName("log.start");

    return startTimeColumn;
  }
Beispiel #23
0
  private void initializeMissingColumn() {
    // Missing
    Column<ValueMapEntry, Boolean> missingColumn =
        new Column<ValueMapEntry, Boolean>(new CheckboxCell()) {

          @Override
          public Boolean getValue(ValueMapEntry entry) {
            return entry.isMissing();
          }
        };
    missingColumn.setCellStyleNames("new-missing");
    table.addColumn(missingColumn, translations.missingLabel());
    missingColumn.setFieldUpdater(
        new FieldUpdater<ValueMapEntry, Boolean>() {
          @Override
          public void update(int index, ValueMapEntry entry, Boolean value) {
            entry.setMissing(value);
          }
        });
  }
  private void addPropertyNameColumn() {
    Column<PropertyRow, String> column =
        new Column<PropertyRow, String>(new EditTextCell()) {
          @Override
          public String getValue(PropertyRow propertyRow) {
            if (propertyRow.getName() != null) {
              return propertyRow.getName();
            } else {
              return "";
            }
          }
        };

    column.setFieldUpdater(
        new PropertyNameFieldUpdater<PropertyRow, String>((EditTextCell) column.getCell()));

    dataGrid.addColumn(
        column, Constants.INSTANCE.persistence_unit_property_grid_property_name_column());
    dataGrid.setColumnWidth(column, 45, Style.Unit.PCT);
  }
Beispiel #25
0
 protected void addDeleteColumn() {
   Column<T, String> deleteColumn =
       new Column<T, String>(new ButtonCell()) {
         @Override
         public String getValue(T service) {
           if (service.isDummy()) {
             return "add";
           }
           return "delete";
         }
       };
   deleteColumn.setFieldUpdater(
       new FieldUpdater<T, String>() {
         @Override
         public void update(int index, T service, String value) {
           if (service.isDummy()) {
             try {
               service.validate();
               service.setDummy(false);
               services.add(getNewEntry());
               serviceTable.setRowData(services);
               serviceTable.redraw();
               syncHandler.sync();
             } catch (RuntimeException e) {
               e.printStackTrace();
               Window.alert(
                   "Please fill out the table row completely before adding.\n\nGot error: "
                       + e.getMessage());
             }
           } else {
             if (Window.confirm("Are you sure you want to remove service: " + service.getName())) {
               services.remove(index);
               serviceTable.setRowData(services);
               serviceTable.redraw();
               syncHandler.sync();
             }
           }
         }
       });
   serviceTable.addColumn(deleteColumn);
 }
Beispiel #26
0
  private Column<FileSystemItem, Boolean> addSelectionColumn() {
    Column<FileSystemItem, Boolean> checkColumn =
        new Column<FileSystemItem, Boolean>(
            new CheckboxCell(true, false) {
              @Override
              public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
                // don't render the check box if its for the parent path
                if (parentPath_ == null || context.getIndex() > 0) super.render(context, value, sb);
              }
            }) {
          @Override
          public Boolean getValue(FileSystemItem item) {
            return selectionModel_.isSelected(item);
          }
        };
    checkColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    filesDataGrid_.addColumn(checkColumn);
    filesDataGrid_.setColumnWidth(checkColumn, CHECK_COLUMN_WIDTH_PIXELS, Unit.PX);

    return checkColumn;
  }
Beispiel #27
0
  private void initializeNewValueColumn() {

    // New Value
    Cell<String> cell = hasValueChoices() ? new SelectionCell(valueChoices) : new TextInputCell();
    Column<ValueMapEntry, String> newValueColumn =
        new Column<ValueMapEntry, String>(cell) {
          @Override
          public String getValue(ValueMapEntry entry) {
            return entry.getNewValue();
          }
        };
    newValueColumn.setCellStyleNames("new-value");
    table.addColumn(newValueColumn, translations.newValueLabel());
    table.setColumnWidth(newValueColumn, "10em");
    newValueColumn.setFieldUpdater(
        new FieldUpdater<ValueMapEntry, String>() {
          @Override
          public void update(int index, ValueMapEntry entry, String value) {
            entry.setNewValue(value);
          }
        });
  }
  private Column initProcessStateColumn() {
    // Process State
    Column<ProcessInstanceSummary, String> processStateColumn =
        new Column<ProcessInstanceSummary, String>(new TextCell()) {
          @Override
          public String getValue(ProcessInstanceSummary object) {
            String statusStr = constants.Unknown();
            switch (object.getState()) {
              case ProcessInstance.STATE_ACTIVE:
                statusStr = constants.Active();
                break;
              case ProcessInstance.STATE_ABORTED:
                statusStr = constants.Aborted();
                break;
              case ProcessInstance.STATE_COMPLETED:
                statusStr = constants.Completed();
                break;
              case ProcessInstance.STATE_PENDING:
                statusStr = constants.Pending();
                break;
              case ProcessInstance.STATE_SUSPENDED:
                statusStr = constants.Suspended();
                break;

              default:
                break;
            }

            return statusStr;
          }
        };
    processStateColumn.setSortable(true);
    processStateColumn.setDataStoreName("log.status");

    return processStateColumn;
  }
  private void setupTable() {
    table = new DefaultCellTable<>(5);
    table.setSelectionModel(selectionModel);

    // columns
    Column<ModelNode, String> classNameColumn = createColumn("class-name");
    Column<ModelNode, String> moduleColumn = createColumn("module");
    Column<ModelNode, String> targetNameColumn = createColumn("target-name");
    Column<ModelNode, String> actionColumn = createColumn("action");
    classNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    moduleColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    targetNameColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    actionColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    table.addColumn(classNameColumn, "Class name");
    table.addColumn(moduleColumn, "Module");
    table.addColumn(targetNameColumn, "Target name");
    table.addColumn(actionColumn, "Action");
    table.setColumnWidth(classNameColumn, 40, Style.Unit.PCT);
    table.setColumnWidth(moduleColumn, 20, Style.Unit.PCT);
    table.setColumnWidth(targetNameColumn, 25, Style.Unit.PCT);
    table.setColumnWidth(actionColumn, 15, Style.Unit.PCT);
  }
  public TagCategoriesView() {
    super(PressGangCCMSUI.INSTANCE.PressGangCCMS(), PressGangCCMSUI.INSTANCE.TagCategories());

    getPossibleChildrenResults().addColumn(idColumn, PressGangCCMSUI.INSTANCE.CategoryID());
    getPossibleChildrenResults().addColumn(nameColumn, PressGangCCMSUI.INSTANCE.CategoryName());
    getPossibleChildrenResults().addColumn(buttonColumn, PressGangCCMSUI.INSTANCE.AddRemove());

    idColumn.setSortable(true);
    nameColumn.setSortable(true);
    buttonColumn.setSortable(true);

    /*
       Allow the table to be sorted.
    */
    @NotNull
    final ColumnSortEvent.AsyncHandler columnSortHandler =
        new ColumnSortEvent.AsyncHandler(getPossibleChildrenResults());
    getPossibleChildrenResults().addColumnSortHandler(columnSortHandler);

    getExistingChildrenResults().addColumn(tagIdColumn, PressGangCCMSUI.INSTANCE.TagID());
    getExistingChildrenResults().addColumn(tagNameColumn, PressGangCCMSUI.INSTANCE.TagName());
    getExistingChildrenResults().addColumn(tagUpButtonColumn, PressGangCCMSUI.INSTANCE.Up());
    getExistingChildrenResults().addColumn(tagDownButtonColumn, PressGangCCMSUI.INSTANCE.Down());
  }