Package org.pushingpixels.substance.internal.ui

Examples of org.pushingpixels.substance.internal.ui.SubstanceTableHeaderUI$ScrollPaneCornerFiller


    JTableHeader tableHeader = table.getTableHeader();
    TableHeaderUI tableHeaderUI = tableHeader.getUI();
    if (SubstanceLookAndFeel.isCurrentLookAndFeel()
        && (tableHeaderUI instanceof SubstanceTableHeaderUI)) {
      SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;
      ComponentState state = ui.getColumnState(column);
      ComponentState prevState = ui.getPrevColumnState(column);
      SubstanceColorScheme scheme = (state == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
          .getColorScheme(tableHeader, state)
          : SubstanceColorSchemeUtilities.getColorScheme(tableHeader,
              ColorSchemeAssociationKind.HIGHLIGHT, state);
      SubstanceColorScheme prevScheme = (prevState == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
          .getColorScheme(tableHeader, prevState)
          : SubstanceColorSchemeUtilities.getColorScheme(tableHeader,
              ColorSchemeAssociationKind.HIGHLIGHT, prevState);
      Color color = SubstanceColorUtilities
          .getInterpolatedForegroundColor(tableHeader, column,
              scheme, state, prevScheme, prevState,
              FadeKind.SELECTION, FadeKind.ROLLOVER);

      // System.out.println("[column " + column + "] - " +
      // prevState.name() + ":"
      // + state.name() + ":" + color + " from "
      // + scheme.getDisplayName());

      super.setForeground(new ColorUIResource(color));
    } else {
      super.setForeground(table.getForeground());
    }

    this.setBackground(tableHeader.getBackground());

    // fix for issue 319 - using font from the table header
    if (tableHeader.getFont() != null) {
      setFont(tableHeader.getFont());
    } else {
      setFont(table.getFont());
    }

    TableUI tableUI = table.getUI();
    if (SubstanceLookAndFeel.isCurrentLookAndFeel()
        && (tableUI instanceof SubstanceTableUI)) {
      this.setBorder(new EmptyBorder(((SubstanceTableUI) tableUI)
          .getCellRendererInsets()));
    }

    this.setValue(value);
    this.setOpaque(false);

    this.setEnabled(tableHeader.isEnabled() && table.isEnabled());

    // fix for defect 242 - not showing sort icon
    if (SubstanceLookAndFeel.isCurrentLookAndFeel()) {
      this.setIcon(null);
      RowSorter<? extends TableModel> rowSorter = table.getRowSorter();
      if (rowSorter != null) {
        setHorizontalTextPosition(JLabel.LEADING);
        java.util.List<? extends RowSorter.SortKey> sortKeys = rowSorter
            .getSortKeys();
        Icon sortIcon = null;
        SubstanceColorScheme scheme = null;
        if (tableHeaderUI instanceof SubstanceTableHeaderUI) {
          SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;
          ComponentState state = ui.getColumnState(column);
          scheme = (state == ComponentState.DEFAULT) ? SubstanceColorSchemeUtilities
              .getColorScheme(tableHeader, state)
              : SubstanceColorSchemeUtilities
                  .getColorScheme(
                      tableHeader,
View Full Code Here


    JTableHeader tableHeader = table.getTableHeader();
    TableHeaderUI tableHeaderUI = tableHeader.getUI();
    if (SubstanceLookAndFeel.isCurrentLookAndFeel()
        && (tableHeaderUI instanceof SubstanceTableHeaderUI)) {
      SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;

      StateTransitionTracker.ModelStateInfo modelStateInfo = ui
          .getModelStateInfo(column);
      ComponentState currState = ui.getColumnState(column);

      if (modelStateInfo != null) {
        Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo
            .getStateContributionMap();
        SubstanceColorScheme colorScheme = getColorSchemeForState(
            tableHeader, 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(
                tableHeader, 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(
            tableHeader, currState);
        super.setForeground(new ColorUIResource(scheme
            .getForegroundColor()));
      }
    } else {
      super.setForeground(table.getForeground());
    }

    this.setBackground(tableHeader.getBackground());

    // fix for issue 319 - using font from the table header
    if (tableHeader.getFont() != null) {
      setFont(tableHeader.getFont());
    } else {
      setFont(table.getFont());
    }

    TableUI tableUI = table.getUI();
    if (SubstanceLookAndFeel.isCurrentLookAndFeel()
        && (tableUI instanceof SubstanceTableUI)) {
      this.setBorder(new EmptyBorder(((SubstanceTableUI) tableUI)
          .getCellRendererInsets()));
    }

    this.setValue(value);
    this.setOpaque(false);

    this.setEnabled(tableHeader.isEnabled() && table.isEnabled());

    // fix for defect 242 - not showing sort icon
    if (SubstanceLookAndFeel.isCurrentLookAndFeel()) {
      this.setIcon(null);
      RowSorter<? extends TableModel> rowSorter = table.getRowSorter();
      if (rowSorter != null) {
        setHorizontalTextPosition(JLabel.LEADING);
        java.util.List<? extends RowSorter.SortKey> sortKeys = rowSorter
            .getSortKeys();
        Icon sortIcon = null;
        SubstanceColorScheme scheme = null;
        if (tableHeaderUI instanceof SubstanceTableHeaderUI) {
          SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;
          ComponentState state = ui.getColumnState(column);
          ColorSchemeAssociationKind colorSchemeAssociationKind = (state == ComponentState.ENABLED) ? ColorSchemeAssociationKind.MARK
              : ColorSchemeAssociationKind.HIGHLIGHT_MARK;
          scheme = SubstanceColorSchemeUtilities.getColorScheme(
              tableHeader, colorSchemeAssociationKind, state);
        } else {
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.internal.ui.SubstanceTableHeaderUI$ScrollPaneCornerFiller

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.