Package org.pushingpixels.substance.internal.ui

Examples of org.pushingpixels.substance.internal.ui.SubstanceTableUI$TableStateListener


    if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
      return super.getTableCellRendererComponent(table, value,
          isSelected, hasFocus, row, column);

    TableUI tableUI = table.getUI();
    SubstanceTableUI ui = (SubstanceTableUI) tableUI;

    // Recompute the focus indication to prevent flicker - JTable
    // registers a listener on selection changes and repaints the
    // relevant cell before our listener (in TableUI) gets the
    // chance to start the fade sequence. The result is that the
    // first frame uses full opacity, and the next frame starts the
    // fade sequence. So, we use the UI delegate to compute the
    // focus indication.
    hasFocus = ui.isFocusedCell(row, column);

    TableCellId cellId = new TableCellId(row, column);
    Comparable<?> compId = ui.getId(row, column);
    ComponentState state = ui.getCellState(cellId);
    ComponentState prevState = ui.getPrevCellState(cellId);

    SubstanceColorScheme scheme = (state == ComponentState.DEFAULT) ? ui
        .getDefaultColorScheme() : ui.getHighlightColorScheme(state);
    if (scheme == null) {
      scheme = (state == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
          .getColorScheme(table, state)
          : SubstanceColorSchemeUtilities.getColorScheme(table,
              ColorSchemeAssociationKind.HIGHLIGHT, state);
    }
    SubstanceColorScheme prevScheme = scheme;
    if (prevState != state) {
      prevScheme = (prevState == ComponentState.DEFAULT) ? ui
          .getDefaultColorScheme() : ui
          .getHighlightColorScheme(prevState);
      if (prevScheme == null) {
        prevScheme = (prevState == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
            .getColorScheme(table, prevState)
            : SubstanceColorSchemeUtilities
                .getColorScheme(table,
                    ColorSchemeAssociationKind.HIGHLIGHT,
                    prevState);
      }
    }

    // SubstanceColorScheme scheme = (state == ComponentState.DEFAULT) ?
    // ui
    // .getDefaultColorScheme() : SubstanceColorSchemeUtilities
    // .getColorScheme(table, state);
    if (scheme == null)
      scheme = SubstanceColorSchemeUtilities.getColorScheme(table, state);

    if (ui.hasRolloverAnimations() || ui.hasSelectionAnimations()) {
      super.setForeground(new ColorUIResource(SubstanceColorUtilities
          .getInterpolatedForegroundColor(table, compId, scheme,
              state, prevScheme, prevState, FadeKind.SELECTION,
              FadeKind.ROLLOVER)));
    } else {
      super
          .setForeground(new ColorUIResource(scheme
              .getForegroundColor()));
    }

    SubstanceStripingUtils.applyStripedBackground(table, row, this);

    this.setFont(table.getFont());

    TableCellId cellFocusId = new TableCellId(row, column);
    // set indication to make exact comparison (since
    // focus can be only on one cell).
    cellFocusId.setExactComparison(true);
    FadeState focusState = SubstanceFadeUtilities.getFadeState(table,
        cellFocusId, FadeKind.FOCUS);

    Insets regInsets = ui.getCellRendererInsets();
    if (hasFocus || (focusState != null)) {
      SubstanceBorder border = new SubstanceBorder(regInsets);

      // System.out.println("[" + row + ":" + column + "] hasFocus : "
      // + hasFocus + ", focusState : " + focusState);
View Full Code Here


          .booleanValue()));
      this.setEnabled(table.isEnabled());

      TableUI tableUI = table.getUI();
      if (tableUI instanceof SubstanceTableUI) {
        SubstanceTableUI ui = (SubstanceTableUI) tableUI;

        // Recompute the focus indication to prevent flicker - JTable
        // registers a listener on selection changes and repaints the
        // relevant cell before our listener (in TableUI) gets the
        // chance to start the fade sequence. The result is that the
        // first frame uses full opacity, and the next frame starts the
        // fade sequence. So, we use the UI delegate to compute the
        // focus indication.
        hasFocus = ui.isFocusedCell(row, column);

        TableCellId cellFocusId = new TableCellId(row, column);
        // set indication to make exact comparison (since
        // focus can be only on one cell).
        cellFocusId.setExactComparison(true);
View Full Code Here

    if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
      return super.getTableCellRendererComponent(table, value,
          isSelected, hasFocus, row, column);

    TableUI tableUI = table.getUI();
    SubstanceTableUI ui = (SubstanceTableUI) tableUI;

    // Recompute the focus indication to prevent flicker - JTable
    // registers a listener on selection changes and repaints the
    // relevant cell before our listener (in TableUI) gets the
    // chance to start the fade sequence. The result is that the
    // first frame uses full opacity, and the next frame starts the
    // fade sequence. So, we use the UI delegate to compute the
    // focus indication.
    hasFocus = ui.isFocusedCell(row, column);

    TableCellId cellId = new TableCellId(row, column);

    StateTransitionTracker.ModelStateInfo modelStateInfo = ui
        .getModelStateInfo(cellId);
    ComponentState currState = ui.getCellState(cellId);
    // special case for drop location
    JTable.DropLocation dropLocation = table.getDropLocation();
    boolean isDropLocation = (dropLocation != null
        && !dropLocation.isInsertRow()
        && !dropLocation.isInsertColumn()
        && dropLocation.getRow() == row && dropLocation.getColumn() == column);

    if (!isDropLocation && (modelStateInfo != null)) {
      if (ui.hasRolloverAnimations() || ui.hasSelectionAnimations()) {
        Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo
            .getStateContributionMap();
        SubstanceColorScheme colorScheme = getColorSchemeForState(
            table, ui, currState);
        if (currState.isDisabled() || (activeStates == null)
            || (activeStates.size() == 1)) {
          super.setForeground(new ColorUIResource(colorScheme
              .getForegroundColor()));
        } else {
          float aggrRed = 0;
          float aggrGreen = 0;
          float aggrBlue = 0;
          for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : modelStateInfo
              .getStateContributionMap().entrySet()) {
            ComponentState activeState = activeEntry.getKey();
            SubstanceColorScheme scheme = getColorSchemeForState(
                table, ui, activeState);
            Color schemeFg = scheme.getForegroundColor();
            float contribution = activeEntry.getValue()
                .getContribution();
            aggrRed += schemeFg.getRed() * contribution;
            aggrGreen += schemeFg.getGreen() * contribution;
            aggrBlue += schemeFg.getBlue() * contribution;
          }
          super.setForeground(new ColorUIResource(new Color(
              (int) aggrRed, (int) aggrGreen, (int) aggrBlue)));
        }
      } else {
        SubstanceColorScheme scheme = getColorSchemeForState(table, ui,
            currState);
        super.setForeground(new ColorUIResource(scheme
            .getForegroundColor()));
      }
    } else {
      SubstanceColorScheme scheme = getColorSchemeForState(table, ui,
          currState);
      if (isDropLocation) {
        scheme = SubstanceColorSchemeUtilities.getColorScheme(table,
            ColorSchemeAssociationKind.TEXT_HIGHLIGHT, currState);
      }
      super
          .setForeground(new ColorUIResource(scheme
              .getForegroundColor()));
    }

    SubstanceStripingUtils.applyStripedBackground(table, row, this);

    this.setFont(table.getFont());

    TableCellId cellFocusId = new TableCellId(row, column);

    StateTransitionTracker focusStateTransitionTracker = ui
        .getStateTransitionTracker(cellFocusId);

    Insets regInsets = ui.getCellRendererInsets();
    if (hasFocus || (focusStateTransitionTracker != null)) {
      SubstanceTableCellBorder border = new SubstanceTableCellBorder(
          regInsets, ui, cellFocusId);

      // System.out.println("[" + row + ":" + column + "] hasFocus : "
View Full Code Here

          .booleanValue()));
      this.setEnabled(table.isEnabled());

      TableUI tableUI = table.getUI();
      if (tableUI instanceof SubstanceTableUI) {
        SubstanceTableUI ui = (SubstanceTableUI) tableUI;

        // Recompute the focus indication to prevent flicker - JTable
        // registers a listener on selection changes and repaints the
        // relevant cell before our listener (in TableUI) gets the
        // chance to start the fade sequence. The result is that the
        // first frame uses full opacity, and the next frame starts the
        // fade sequence. So, we use the UI delegate to compute the
        // focus indication.
        hasFocus = ui.isFocusedCell(row, column);

        TableCellId cellFocusId = new TableCellId(row, column);

        StateTransitionTracker stateTransitionTracker = ui
            .getStateTransitionTracker(cellFocusId);
        if (hasFocus || (stateTransitionTracker != null)) {
          SubstanceTableCellBorder border = new SubstanceTableCellBorder(
              new Insets(0, 0, 0, 0), ui, cellFocusId);
          if (stateTransitionTracker != null) {
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.internal.ui.SubstanceTableUI$TableStateListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.