/*
   * (non-Javadoc)
   *
   * @see org.jvnet.flamingo.common.ui.BasicCommandButtonUI#updateBorder()
   */
  @Override
  protected void updateBorder() {
    Border currBorder = this.commandButton.getBorder();
    if ((currBorder == null) || (currBorder instanceof UIResource)) {
      Insets extra =
          SubstanceSizeUtils.getDefaultBorderInsets(
              SubstanceSizeUtils.getComponentFontSize(this.commandButton));
      double hgapScaleFactor = this.commandButton.getHGapScaleFactor();
      double vgapScaleFactor = this.commandButton.getVGapScaleFactor();

      int top = 1 + (int) (vgapScaleFactor * extra.top);
      int left = 2 + (int) (hgapScaleFactor * (1 + extra.left));
      int bottom = 0 + (int) (vgapScaleFactor * extra.bottom);
      int right = 2 + (int) (hgapScaleFactor * (1 + extra.right));
      this.commandButton.setBorder(
          new BorderUIResource.EmptyBorderUIResource(top, left, bottom, right));
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.jvnet.flamingo.common.ui.BasicCommandButtonUI#createPopupActionIcon()
  */
 @Override
 protected ResizableIcon createPopupActionIcon() {
   final int fontSize = SubstanceSizeUtils.getComponentFontSize(this.commandButton);
   int arrowIconHeight = (int) SubstanceSizeUtils.getArrowIconHeight(fontSize);
   int arrowIconWidth = (int) SubstanceSizeUtils.getArrowIconWidth(fontSize);
   ResizableIcon icon =
       new TransitionAwareResizableIcon(
           this.commandButton,
           new TransitionAwareResizableIcon.StateTransitionTrackerDelegate() {
             @Override
             public StateTransitionTracker getStateTransitionTracker() {
               return getPopupTransitionTracker();
             }
           },
           new TransitionAwareResizableIcon.Delegate() {
             @Override
             public Icon getColorSchemeIcon(SubstanceColorScheme scheme, int width, int height) {
               CommandButtonPopupOrientationKind orientation =
                   ((JCommandButton) commandButton).getPopupOrientationKind();
               int direction =
                   (orientation == CommandButtonPopupOrientationKind.DOWNWARD)
                       ? SwingConstants.SOUTH
                       : (commandButton.getComponentOrientation().isLeftToRight()
                           ? SwingConstants.EAST
                           : SwingConstants.WEST);
               // System.out.println(direction + ":" + width + ":"
               // + height);
               Icon result =
                   SubstanceImageCreator.getArrowIcon(
                       width,
                       height,
                       SubstanceSizeUtils.getArrowStrokeWidth(fontSize) - 0.5f,
                       direction,
                       scheme);
               // System.out.println(" --> " + result.getIconWidth()
               // + "*" + result.getIconHeight());
               return result;
             }
           },
           new Dimension(arrowIconWidth, arrowIconHeight));
   return icon;
 }