protected Widget createGroupHeader(Object text, String textColor, String backgroundColor) {
   Label title = Widgets.text(text);
   Style style = title.getElement().getStyle();
   style.setColor(textColor);
   style.setBackgroundColor(backgroundColor);
   style.setPadding(Widgets.defaultSpacing, Unit.PX);
   return title;
 }
 private Label createErrorLabel() {
   Label label = new Label();
   Style style = label.getElement().getStyle();
   style.setDisplay(Display.NONE);
   style.setColor("#cc0000");
   style.setMarginTop(Widgets.defaultSpacing, Unit.PX);
   style.setMarginBottom(Widgets.defaultSpacing, Unit.PX);
   return label;
 }
示例#3
0
  /**
   * Sets the title to display with this menu button.
   *
   * @param label
   */
  public void setLabel(String label) {

    this.label = label;

    HTMLPanel labelHtml = new HTMLPanel(label);
    Style labelStyle = labelHtml.getElement().getStyle();
    labelStyle.setColor("white");
    labelStyle.setFontSize(0.8, Unit.EM);
    labelStyle.setFontWeight(FontWeight.BOLD);
    labelStyle.setPosition(Position.ABSOLUTE);
    labelStyle.setTextAlign(TextAlign.CENTER);
    labelStyle.setTop(75, Unit.PCT);
    labelStyle.setWidth(100, Unit.PCT);

    panel.add(labelHtml);
  }
  protected void onUpdate() {
    if (sortColumnIndex == -1) {
      sortColumnIndex = getInitialSortColumnIndex();
      reverseSort = isInitialSortReverse();
    }

    Collection<O> objects;
    try {
      objects = getObjects();
    } catch (Exception ex) {
      throw new RuntimeException(Str.getSimpleName(getClass()) + ".getObjects() failed.", ex);
    }

    log.info("Objects loaded:", objects.size());

    int rowIndex = -1;

    if (isColumnTitlesEnabled()) {
      rowIndex++;
      for (AColumn column : columns) {
        String columnTitle;
        try {
          columnTitle = column.getTitle();
        } catch (Exception ex) {
          log.error(ex);
          columnTitle = "ERROR: " + Str.formatException(ex);
        }

        boolean customSortingEnabled = isCustomSortingEnabled();

        Widget titleWidget = Widgets.textFieldlabel(columnTitle, false);
        if (titleWidget != null && customSortingEnabled && isShowColumnSortingToggleIcon())
          titleWidget.addStyleName("columnTitleWithSortToggle");

        if (titleWidget != null && (sortColumnIndex == column.index)) {
          // Sortierte Spalte hervorheben
          Style style = titleWidget.getElement().getStyle();
          style.setColor("#444");
          style.setFontWeight(FontWeight.BOLD);
          if (reverseSort) style.setFontStyle(FontStyle.ITALIC);
        }

        table.setWidget(
            rowIndex,
            column.index,
            Widgets.frame(
                titleWidget,
                Widgets.defaultSpacing,
                0,
                Widgets.defaultSpacing,
                Widgets.defaultSpacing / 2));

        if (customSortingEnabled) {
          for (int col = 0; col < columns.size(); col++) {
            table.getCellFormatter().setStyleName(rowIndex, col, "clickable");
          }
        }
      }
    }

    if (isColumnFilteringEnabled()) {
      rowIndex++;
      for (AColumn column : columns) {
        TextBox filterTextbox = column.getFilterWidget();
        SimplePanel frame = Widgets.frame(filterTextbox, Widgets.defaultSpacing);
        table.setWidget(rowIndex, column.index, frame);
      }
    }

    try {
      rows = createRows(objects, rowIndex);
    } catch (Exception ex) {
      throw new RuntimeException(Str.getSimpleName(getClass()) + ".createRows() failed.", ex);
    }
    table.setVisible(!rows.isEmpty());

    for (Row row : rows) {
      appendRow(row);
      rowIndex++;
    }

    for (int i = 0; i < getFootRowCount(); i++) {
      rowIndex++;
      for (AColumn column : columns) {
        table.setWidget(rowIndex, column.index, column.getFootCellWidget(i));
      }
    }
  }