コード例 #1
0
ファイル: GridRidget.java プロジェクト: turesheim/riena
  /**
   * {@inheritDoc}
   *
   * <p>Sets for every item the tool tip text. The text can be configured with the {@link
   * IColumnFormatter}.
   *
   * <p><i>note: The tool tip of a grid is only shown, if in a cell not the complete text can be
   * displayed.</i>
   */
  @Override
  protected final void updateToolTipSupport() {

    final Grid control = getUIControl();
    if (control == null) {
      return;
    }
    int colCount = getColumnCount();
    final GridItem[] items = control.getItems();
    for (final GridItem item : items) {
      for (final int colIndex = 0; colCount < colCount; colCount++) {
        String toolTip = null;
        if (toolTip == null) {
          toolTip = getToolTipText(item, colIndex);
        }
        item.setToolTipText(colIndex, toolTip);
      }
    }
  }
コード例 #2
0
  /** Updates this cell - delayed. */
  protected void updateCellValuesDelayed() {
    /*
     * Check if the cell has been disposed
     */
    if (getColumn() == null) return;
    // LogUtils.debug(GridBindingCellInformationImpl.this, "");
    final IGridBinding grid = getGrid();
    final GridColumn gridColumn = getColumn().getGridColumn();
    final GridItem gridItem = getRow().getGridItem();

    /*
     * Update the cell
     */
    final IUIAttribute attr = getLabelUIAttribute();
    final IObservableValue currentValue = attr.getCurrentValue();
    if (currentValue.isDisposed()) return;
    final IObservableValue v = getObjectValue();

    final String text = (String) currentValue.getValue();
    final Color foreground = attr.getForeground();
    final Color background = attr.getBackground();
    final Image image = attr.getImage();
    final Font font = attr.getFont();
    final String tooltip = attr.getTooltip();
    // TODO: the rest: cursor, enabled, style range
    if (gridItem == null) {
      /*
       * Column header:
       */
      gridColumn.setText(text == null ? "" : text);
      gridColumn.setImage(image);
      // TODO gridColumn.set
      /*
       * The changes in the column name and image only take effect when the table is redrawn
       */
      grid.getGrid().redraw();
    } else if (gridColumn == null) {
      /*
       * Row Header
       */
      gridItem.setHeaderText(text == null ? "" : text);
      gridItem.setHeaderImage(image);
      gridItem.setHeaderForeground(foreground);
      gridItem.setHeaderBackground(background);
    } else {
      /*
       * Normal cell
       */
      final int index = grid.getGrid().indexOf(gridColumn);
      Assert.isTrue(index != -1);

      // gridItem.setChecked(index, v.getValue() == Boolean.TRUE);
      // gridItem.setText(index, null);
      // gridItem.setImage(index, null);
      // gridItem.setFont(index, null);

      gridItem.setText(index, text == null ? "" : text);
      gridItem.setImage(index, image);
      gridItem.setFont(index, font);
      gridItem.setForeground(index, foreground);
      gridItem.setBackground(index, background);
      gridItem.setToolTipText(index, tooltip);
    }
  }