@Override
  public void init(final GridBasePresenter presenter) {
    this.presenter = presenter;
    listContainer.clear();
    listGrid = new ExtendedPagedTable<DataMockSummary>(10, null);

    presenter.addDataDisplay(listGrid);
    listContainer.add(listGrid);
    this.initGridColumns();

    Button refreshButton = new Button();
    refreshButton.setIcon(IconType.REFRESH);
    refreshButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            presenter.refreshList();
          }
        });
    listGrid.getToolbar().add(refreshButton);
    Button createServerDataButton = new Button();
    createServerDataButton.setText("Create Server Side Data");
    createServerDataButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            presenter.createData();
          }
        });

    listGrid.getToolbar().add(createServerDataButton);
  }
  private void initFiltersBar() {
    HorizontalPanel filtersBar = new HorizontalPanel();

    parentLink = new Button();
    parentLink.setIcon(IconType.BACKWARD);
    parentLink.setSize(ButtonSize.SMALL);
    parentLink.setText(constants.Parent());
    parentLink.setEnabled(true);
    parentLink.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (BrowserEvents.CLICK.equalsIgnoreCase(event.getNativeEvent().getType())) {
              parentDocEvent.fire(new DocumentsParentSearchEvent());
              pathLink.setText(presenter.currentCMSContentSummary.getParent().getPath());
            }
          }
        });

    homeLink = new Button();
    homeLink.setIcon(IconType.HOME);
    homeLink.setSize(ButtonSize.SMALL);
    homeLink.setText(constants.Home());
    homeLink.setEnabled(true);
    homeLink.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (BrowserEvents.CLICK.equalsIgnoreCase(event.getNativeEvent().getType())) {
              homeDocEvent.fire(new DocumentsHomeSearchEvent());
              pathLink.setText("/");
            }
          }
        });

    newLink = new Button();
    newLink.setIcon(IconType.PLUS);
    newLink.setSize(ButtonSize.SMALL);
    newLink.setText(constants.New());
    newLink.setEnabled(true);
    newLink.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            DefaultPlaceRequest req = new DefaultPlaceRequest("New Document");
            String folder =
                (presenter.currentCMSContentSummary == null)
                    ? "/"
                    : presenter.currentCMSContentSummary.getPath();
            req.addParameter("folder", folder);
            placeManager.goTo(req);
          }
        });

    filtersButtonGroup = new ButtonGroup(parentLink, homeLink, newLink);

    filtersBar.add(filtersButtonGroup);
    listGrid.getCenterToolbar().add(filtersBar);
  }
  public void createRefreshToggleButton(final Button refreshIntervalSelector) {

    refreshIntervalSelector.setToggle(true);
    refreshIntervalSelector.setIcon(IconType.COG);
    refreshIntervalSelector.setTitle(Constants.INSTANCE.AutoRefresh());
    refreshIntervalSelector.setSize(ButtonSize.MINI);

    popup.getElement().getStyle().setZIndex(Integer.MAX_VALUE);
    popup.addAutoHidePartner(refreshIntervalSelector.getElement());
    popup.addCloseHandler(
        new CloseHandler<PopupPanel>() {
          public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
            if (popupPanelCloseEvent.isAutoClosed()) {
              refreshIntervalSelector.setActive(false);
            }
          }
        });

    refreshIntervalSelector.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!refreshIntervalSelector.isActive()) {
              showSelectRefreshIntervalPopup(
                  refreshIntervalSelector.getAbsoluteLeft()
                      + refreshIntervalSelector.getOffsetWidth(),
                  refreshIntervalSelector.getAbsoluteTop()
                      + refreshIntervalSelector.getOffsetHeight(),
                  refreshIntervalSelector);
            } else {
              popup.hide(false);
            }
          }
        });
  }
 @Override
 public void addSalvarHandler(ClickEnterUpHandler handler) {
   salvar.addClickHandler(handler);
   nome.addKeyUpHandler(handler);
   sobrenome.addKeyUpHandler(handler);
   telefone.addKeyUpHandler(handler);
   email.addKeyUpHandler(handler);
   //    dataNascimento.add
 }
  private void createButtons(
      final String identifier, final ParameterizedCommand<String> deselectCommand) {

    collapse = GWT.create(Button.class);
    collapse.setSize(ButtonSize.MINI);
    collapse.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            deselectCommand.execute(identifier);
          }
        });
  }
  private void showSelectRefreshIntervalPopup(
      final int left, final int top, final Button refreshIntervalSelector) {
    VerticalPanel popupContent = new VerticalPanel();

    // int configuredSeconds = presenter.getAutoRefreshSeconds();
    int configuredSeconds = view.getRefreshValue();
    if (configuredSeconds > 0) {
      updateRefreshInterval(true, configuredSeconds);
    } else {
      updateRefreshInterval(false, 0);
    }

    RadioButton oneMinuteRadioButton =
        createTimeSelectorRadioButton(
            60, "1 Minute", configuredSeconds, refreshIntervalSelector, popupContent);
    RadioButton fiveMinuteRadioButton =
        createTimeSelectorRadioButton(
            300, "5 Minutes", configuredSeconds, refreshIntervalSelector, popupContent);
    RadioButton tenMinuteRadioButton =
        createTimeSelectorRadioButton(
            600, "10 Minutes", configuredSeconds, refreshIntervalSelector, popupContent);

    popupContent.add(oneMinuteRadioButton);
    popupContent.add(fiveMinuteRadioButton);
    popupContent.add(tenMinuteRadioButton);

    Button resetButton = new Button("Disable Autorefresh");
    resetButton.setSize(ButtonSize.MINI);
    resetButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            updateRefreshInterval(false, 0);
            view.saveRefreshValue(0);
            refreshIntervalSelector.setActive(false);
            popup.hide();
          }
        });

    popupContent.add(resetButton);

    popup.setWidget(popupContent);
    popup.show();
    int finalLeft = left - popup.getOffsetWidth();
    popup.setPopupPosition(finalLeft, top);
  }
 @Override
 public void addBuscarSridHandler(ClickHandler handler) {
   modal_btBuscar.addClickHandler(handler);
 }
 @Override
 public void addAcionarModalHandler(ClickHandler handler) {
   btBuscarSrid.addClickHandler(handler);
 }
Example #9
0
  public CopyPopup(
      final Path path,
      final Validator validator,
      final CommandWithFileNameAndCommitMessage command) {
    super(CommonImages.INSTANCE.edit(), CommonConstants.INSTANCE.CopyPopupTitle());

    checkNotNull("validator", validator);
    checkNotNull("path", path);
    checkNotNull("command", command);

    // Make sure it appears on top of other popups
    getElement().getStyle().setZIndex(Integer.MAX_VALUE);
    setGlassEnabled(true);

    nameTextBox.setTitle(CommonConstants.INSTANCE.NewName());
    nameTextBox.setWidth("200px");
    addAttribute(CommonConstants.INSTANCE.NewNameColon(), nameTextBox);

    checkInCommentTextBox.setTitle(CommonConstants.INSTANCE.CheckInComment());
    checkInCommentTextBox.setWidth("200px");
    addAttribute(CommonConstants.INSTANCE.CheckInCommentColon(), checkInCommentTextBox);

    final HorizontalPanel hp = new HorizontalPanel();
    final Button create = new Button(CommonConstants.INSTANCE.CopyPopupCreateACopy());
    create.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent arg0) {

            final String baseFileName = nameTextBox.getText();
            final String originalFileName = path.getFileName();
            final String extension =
                (originalFileName.lastIndexOf(".") > 0
                    ? originalFileName.substring(originalFileName.lastIndexOf("."))
                    : "");
            final String fileName = baseFileName + extension;

            validator.validate(
                fileName,
                new ValidatorCallback() {
                  @Override
                  public void onSuccess() {
                    hide();
                    command.execute(
                        new FileNameAndCommitMessage(
                            baseFileName, checkInCommentTextBox.getText()));
                  }

                  @Override
                  public void onFailure() {
                    Window.alert(CommonConstants.INSTANCE.InvalidFileName0(baseFileName));
                  }
                });
          }
        });
    hp.add(create);

    final Button cancel = new Button(CommonConstants.INSTANCE.Cancel());
    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent arg0) {
            hide();
          }
        });
    hp.add(new HTML("&nbsp"));
    hp.add(cancel);
    addAttribute("", hp);
  }
  @Override
  public void init(final DocumentListPresenter presenter) {

    List<String> bannedColumns = new ArrayList<String>();
    bannedColumns.add(constants.DocumentID());
    bannedColumns.add(constants.DocumentName());
    bannedColumns.add(constants.Actions());
    List<String> initColumns = new ArrayList<String>();
    initColumns.add(constants.DocumentID());
    initColumns.add(constants.DocumentName());
    initColumns.add(constants.Actions());

    super.init(
        presenter, new GridGlobalPreferences("DocumentListGrid", initColumns, bannedColumns));

    initFiltersBar();
    initPathLink();

    selectionModel = new NoSelectionModel<CMSContentSummary>();
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            boolean close = false;
            if (selectedRow == -1) {
              listGrid.setRowStyles(selectedStyles);
              selectedRow = listGrid.getKeyboardSelectedRow();
              listGrid.redraw();
            } else if (listGrid.getKeyboardSelectedRow() != selectedRow) {

              listGrid.setRowStyles(selectedStyles);
              selectedRow = listGrid.getKeyboardSelectedRow();
              listGrid.redraw();
            } else {
              close = true;
            }

            selectedItem = selectionModel.getLastSelectedObject();
          }
        });

    noActionColumnManager =
        DefaultSelectionEventManager.createCustomManager(
            new DefaultSelectionEventManager.EventTranslator<CMSContentSummary>() {

              @Override
              public boolean clearCurrentSelection(CellPreviewEvent<CMSContentSummary> event) {
                return false;
              }

              @Override
              public DefaultSelectionEventManager.SelectAction translateSelectionEvent(
                  CellPreviewEvent<CMSContentSummary> event) {
                NativeEvent nativeEvent = event.getNativeEvent();
                if (BrowserEvents.CLICK.equals(nativeEvent.getType())) {
                  // Ignore if the event didn't occur in the correct
                  // column.
                  if (listGrid.getColumnIndex(actionsColumn) == event.getColumn()) {
                    return DefaultSelectionEventManager.SelectAction.IGNORE;
                  }
                }
                return DefaultSelectionEventManager.SelectAction.DEFAULT;
              }
            });
    listGrid.setSelectionModel(selectionModel, noActionColumnManager);

    Button configRepoButton = new Button();
    configRepoButton.setIcon(IconType.COG);
    configRepoButton.setTitle(Constants.INSTANCE.ConfigurationPanel());
    configRepoButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            PlaceStatus instanceDetailsStatus =
                placeManager.getStatus(new DefaultPlaceRequest("CMIS Configuration"));
            if (instanceDetailsStatus == PlaceStatus.OPEN) {
              placeManager.closePlace("CMIS Configuration");
            }
            placeManager.goTo("CMIS Configuration");
          }
        });

    listGrid.getRightToolbar().add(configRepoButton);
    listGrid.setEmptyTableCaption(constants.No_Documents_Available());
    listGrid.setRowStyles(selectedStyles);
  }
 @Override
 public void addExcluirHandler(ClickHandler handler) {
   excluir.addClickHandler(handler);
 }
 @Override
 public void addNovoHandler(ClickHandler handler) {
   novo.addClickHandler(handler);
 }
 @Override
 public void addCancelarHandler(ClickHandler handler) {
   cancelar.addClickHandler(handler);
 }