Package org.jvnet.substance

Examples of org.jvnet.substance.SubstanceTreeUI


    this.hasFocus = hasFocus;
    this.setText(stringValue);

    TreeUI treeUI = tree.getUI();
    if (treeUI instanceof SubstanceTreeUI) {
      SubstanceTreeUI ui = (SubstanceTreeUI) treeUI;
      TreePathId pathId = new TreePathId(tree.getPathForRow(row));
      ComponentState state = ui.getPathState(pathId);
      ComponentState prevState = ui.getPrevPathState(pathId);
      SubstanceColorScheme scheme = (state == ComponentState.DEFAULT) ? ui
          .getDefaultColorScheme()
          : SubstanceColorSchemeUtilities.getColorScheme(tree,
              ColorSchemeAssociationKind.HIGHLIGHT, state);
      if (scheme == null) {
        scheme = SubstanceColorSchemeUtilities.getColorScheme(tree,
            ColorSchemeAssociationKind.HIGHLIGHT, state);
      }

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

      Color color = SubstanceColorUtilities
          .getInterpolatedForegroundColor(tree, pathId, scheme,
              state, prevScheme, prevState, FadeKind.SELECTION,
              FadeKind.ROLLOVER);

      // System.out.println("[" + row + "," + column + "] - "
      // + prevState.name() + ":" + state.name() + ":" + color);

      super.setForeground(new ColorUIResource(color));
    } else {
      if (sel)
        this.setForeground(UIManager
            .getColor("Tree.selectionForeground"));
      else
        this.setForeground(UIManager.getColor("Tree.textForeground"));
    }

    if (SubstanceLookAndFeel.isCurrentLookAndFeel())
      SubstanceStripingUtils.applyStripedBackground(tree, row, this);

    // There needs to be a way to specify disabled icons.
    if (!tree.isEnabled()) {
      this.setEnabled(false);
      if (leaf) {
        this.setDisabledIcon(SubstanceImageCreator
            .toGreyscale(SubstanceImageCreator.makeTransparent(
                tree, this.getDefaultLeafIcon(), 0.5)));
      } else if (expanded) {
        this.setDisabledIcon(SubstanceImageCreator
            .toGreyscale(SubstanceImageCreator.makeTransparent(
                tree, this.getDefaultOpenIcon(), 0.5)));
        // setIcon(SubstanceImageCreator.toGreyscale(
        // SubstanceImageCreator
        // .makeTransparent(getDefaultOpenIcon(), 0.5)));
      } else {
        this.setDisabledIcon(SubstanceImageCreator
            .toGreyscale(SubstanceImageCreator.makeTransparent(
                tree, this.getDefaultClosedIcon(), 0.5)));
        // setIcon(SubstanceImageCreator.toGreyscale(
        // SubstanceImageCreator
        // .makeTransparent(getDefaultClosedIcon(), 0.5)));
      }
    } else {
      this.setEnabled(true);
      if (leaf) {
        this.setIcon(this.getDefaultLeafIcon());
      } else if (expanded) {
        this.setIcon(this.getDefaultOpenIcon());
      } else {
        this.setIcon(this.getDefaultClosedIcon());
      }
    }
    this.setComponentOrientation(tree.getComponentOrientation());

    this.setOpaque(false);

    this.selected = sel;

    if (treeUI instanceof SubstanceTreeUI) {
      SubstanceTreeUI ui = (SubstanceTreeUI) treeUI;
      Insets regInsets = ui.getCellRendererInsets();
      this
          .setBorder(new BorderUIResource.EmptyBorderUIResource(
              regInsets));
    }
View Full Code Here

TOP

Related Classes of org.jvnet.substance.SubstanceTreeUI

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.