예제 #1
0
 @Override
 protected void setup() {
   // Set up backwards.
   backwards = new PushButton();
   backwards.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(-1);
         }
       });
   backwards.getUpFace().setHTML("‹");
   backwards.setStyleName(BASE_NAME + "PreviousButton");
   forwards = new PushButton();
   forwards.getUpFace().setHTML("›");
   forwards.setStyleName(BASE_NAME + "NextButton");
   forwards.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(+1);
         }
       });
   // Set up backwards year
   backwardsYear = new PushButton();
   backwardsYear.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(-12);
         }
       });
   backwardsYear.getUpFace().setHTML("«");
   backwardsYear.setStyleName(BASE_NAME + "PreviousButton");
   forwardsYear = new PushButton();
   forwardsYear.getUpFace().setHTML("»");
   forwardsYear.setStyleName(BASE_NAME + "NextButton");
   forwardsYear.addClickHandler(
       new ClickHandler() {
         @Override
         public void onClick(ClickEvent event) {
           addMonths(+12);
         }
       });
   // Set up grid.
   grid = new Grid(1, 5);
   grid.setWidget(0, previousYearColumn, backwardsYear);
   grid.setWidget(0, previousMonthColumn, backwards);
   grid.setWidget(0, nextMonthColumn, forwards);
   grid.setWidget(0, nextYearColumn, forwardsYear);
   CellFormatter formatter = grid.getCellFormatter();
   formatter.setStyleName(0, monthColumn, BASE_NAME + "Month");
   formatter.setWidth(0, previousYearColumn, "1");
   formatter.setWidth(0, previousMonthColumn, "1");
   formatter.setWidth(0, monthColumn, "100%");
   formatter.setWidth(0, nextMonthColumn, "1");
   formatter.setWidth(0, nextYearColumn, "1");
   grid.setStyleName(BASE_NAME + "MonthSelector");
   initWidget(grid);
 }
  /**
   * Adds a button that enables to go the the Home panel
   *
   * @param eventBus
   * @return
   */
  private PushButton goHomeButton() {

    goHomeButton = new PushButton(BaseNLS.constants().button_home());
    goHomeButton.setStyleName(imogResources.imogStyle().imogButton());
    goHomeButton.addStyleName(imogResources.imogStyle().imogButton2());
    goHomeButton.addStyleName("Dynatable-Button");
    return goHomeButton;
  }
예제 #3
0
  public AnnotationWidget(Annotation a, Labels labels) {
    this.annotation = a;

    // Construct annotation panel
    annotationPanel = new FlowPanel();
    annotationPanel.setStyleName("yuma-annotation-content");

    // Username will be undefined in server-less mode!
    InlineHTML username = null;
    if (annotation.getUserRealName() != null) {
      username = new InlineHTML(annotation.getUserRealName());
    } else if (annotation.getUsername() != null) {
      username = new InlineHTML(annotation.getUsername());
    }

    if (username != null) {
      username.setStyleName("yuma-annotation-username");
      annotationPanel.add(username);
    }

    // Timestamps will be -1 in server-less mode!
    InlineHTML timestamp = new InlineHTML();
    long modified = annotation.getModified();
    if (modified > 0) {
      timestamp.setHTML(DateTimeFormat.getFormat(DATE_FORMAT).format(new Date(modified)));
      timestamp.setStyleName("yuma-annotation-modified");
    }

    annotationPanel.add(new InlineHTML(annotation.getText() + "<br/>"));
    annotationPanel.add(timestamp);

    annotationPanel.addDomHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            btnEdit.removeStyleName(CSS_HIDDEN);
            btnDelete.removeStyleName(CSS_HIDDEN);
          }
        },
        MouseOverEvent.getType());

    // Construct button panel
    buttonPanel = new FlowPanel();
    buttonPanel.setStyleName("yuma-annotation-buttons");

    btnDelete = new PushButton();
    btnDelete.setStyleName("yuma-button");
    btnDelete.addStyleName("yuma-button-delete");
    btnDelete.addStyleName(CSS_HIDDEN);
    btnDelete.getElement().getStyle().setFloat(Float.RIGHT);
    btnDelete.getElement().getStyle().setCursor(Cursor.POINTER);

    btnEdit = new PushButton();
    btnEdit.setStyleName("yuma-button");
    btnEdit.addStyleName("yuma-button-edit");
    btnEdit.addStyleName(CSS_HIDDEN);
    btnEdit.getElement().getStyle().setFloat(Float.RIGHT);
    btnEdit.getElement().getStyle().setCursor(Cursor.POINTER);

    if (labels == null) {
      btnDelete.setTitle("Delete this Comment");
      btnEdit.setTitle("Edit this Comment");
    } else {
      btnDelete.setTitle(labels.deleteTooltip());
      btnEdit.setTitle(labels.editTooltip());
    }
    buttonPanel.add(btnDelete);
    buttonPanel.add(btnEdit);

    // Wrap everything into the container panel
    container = new FlowPanel();
    container.setStyleName("yuma-annotation");
    container.add(annotationPanel);
    container.add(buttonPanel);

    container.addDomHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            btnEdit.addStyleName(CSS_HIDDEN);
            btnDelete.addStyleName(CSS_HIDDEN);
          }
        },
        MouseOutEvent.getType());

    initWidget(container);
  }