Ejemplo n.º 1
0
 @Override
 public void messageArrived(Message<Dtos.UserDto> message) {
   if (message instanceof UserAddedMessage) {
     usersList.addNewItem(message.getPayload());
   } else if (message instanceof UserDeletedMessage) {
     usersList.removeItem(message.getPayload());
   } else if (message instanceof UserEditedMessage) {
     usersList.refresh(message.getPayload());
   }
 }
    private void resetButtonAvailability() {
      boolean enabled = parent.isEnabled(selectedDto);

      editButton.setEnabled(parent.isEditEnabled(selectedDto));
      deleteButton.setEnabled(parent.isDeleteEnabled(selectedDto));

      if (parent.isEditEnabled(selectedDto)) {
        editButton.getUpFace().setImage(new Image(KanbanikResources.INSTANCE.editButtonImage()));
      } else {
        editButton
            .getUpFace()
            .setImage(new Image(KanbanikResources.INSTANCE.editButtonDisabledImage()));
      }

      if (parent.isDeleteEnabled(selectedDto)) {
        deleteButton
            .getUpFace()
            .setImage(new Image(KanbanikResources.INSTANCE.deleteButtonImage()));
      } else {
        deleteButton
            .getUpFace()
            .setImage(new Image(KanbanikResources.INSTANCE.deleteButtonDisabledImage()));
      }
    }
Ejemplo n.º 3
0
  public BoardsBox(final ConfigureWorkflowModule configureWorkflowModule) {

    class IdProvider implements ListBoxWithAddEditDelete.IdProvider<Dtos.BoardWithProjectsDto> {

      @Override
      public String getId(Dtos.BoardWithProjectsDto dto) {
        return dto.getBoard().getId();
      }
    }

    class LabelProvider
        implements ListBoxWithAddEditDelete.LabelProvider<Dtos.BoardWithProjectsDto> {

      @Override
      public String getLabel(Dtos.BoardWithProjectsDto dto) {
        return dto.getBoard().getName();
      }
    }

    class Refresher implements ListBoxWithAddEditDelete.Refresher<Dtos.BoardWithProjectsDto> {

      @Override
      public void refrehs(
          List<Dtos.BoardWithProjectsDto> items, Dtos.BoardWithProjectsDto newItem, int index) {
        items.get(index).setBoard(newItem.getBoard());
      }
    }

    class OnChangeListener
        implements ListBoxWithAddEditDelete.OnChangeListener<Dtos.BoardWithProjectsDto> {

      @Override
      public void onChanged(
          List<Dtos.BoardWithProjectsDto> items, Dtos.BoardWithProjectsDto selectedItem) {
        if (items.isEmpty()) {
          if (projectToBoardAdding != null) {
            projectToBoardAdding.disable();
          }
        } else {
          configureWorkflowModule.selectedBoardChanged(selectedItem);
        }

        classOfServicesListManager.selectedBoardChanged(
            selectedItem == null ? null : selectedItem.getBoard());
      }
    }

    boardsList =
        new ListBoxWithAddEditDelete<>(
            "Boards",
            new IdProvider(),
            new LabelProvider(),
            new BoardCreatingComponent(),
            new BoardEditingComponent(),
            new BoardDeletingComponent(),
            new Refresher());

    classOfServiceList = classOfServicesListManager.create();

    boardsList.setOnChangeListener(new OnChangeListener());

    new MessageListeners();

    initWidget(uiBinder.createAndBindUi(this));

    addProjectButton.setEnabled(true);
    addProjectButton.getUpFace().setImage(new Image(KanbanikResources.INSTANCE.addButtonImage()));
    new ProjectCreatingComponent(addProjectButton);
  }
Ejemplo n.º 4
0
 public void setBoards(List<Dtos.BoardWithProjectsDto> allBoards) {
   boardsList.setContent(allBoards);
 }