Java 类com.intellij.ui.tabs.TabsUtil 实例源码

项目:intellij-ce-playground    文件:TabsBorder.java   
public Insets getEffectiveBorder() {
  if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone();

  myPosition = myTabs.getTabsPosition();

  if (myTabs.isEditorTabs()) {
    // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :(
    myEffectiveBorder = new Insets(myPosition == JBTabsPosition.top ? TabsUtil.TABS_BORDER : 0, 0, 0, 0);
  }
  else {
    myEffectiveBorder = new Insets(
      myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top,
      myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left,
      myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom,
      myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right
    );
  }


  return (Insets)myEffectiveBorder.clone();
}
项目:intellij-ce-playground    文件:TabLabel.java   
@Override
public Dimension getPreferredSize() {
  final Dimension size = super.getPreferredSize();
  size.height = TabsUtil.getTabsHeight();
  if (myActionPanel != null && !myActionPanel.isVisible()) {
    final Dimension actionPanelSize = myActionPanel.getPreferredSize();
    size.width += actionPanelSize.width;
  }

  final JBTabsPosition pos = myTabs.getTabsPosition();
  switch (pos) {
    case top:
    case bottom:
      if (myTabs.hasUnderline()) size.height += myTabs.getActiveTabUnderlineHeight() - 1;
      break;
    case left:
    case right:
      size.width += getSelectedOffset();
      break;
  }

  return size;
}
项目:intellij-ce-playground    文件:ToolWindowAlikePanel.java   
Header(@NotNull String title) {
  super(new BorderLayout());

  JLabel titleLabel = new JLabel(title);
  titleLabel.setFont(BaseLabel.getLabelFont());
  titleLabel.setForeground(JBColor.foreground());
  titleLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
  add(titleLabel, BorderLayout.CENTER);

  myButtonPanel = new JPanel();
  myButtonPanel.setOpaque(false);
  myButtonPanel.setLayout(new BoxLayout(myButtonPanel, BoxLayout.X_AXIS));
  myButtonPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));

  add(myButtonPanel, BorderLayout.EAST);
  setBorder(BorderFactory.createEmptyBorder(TabsUtil.TABS_BORDER, 1, TabsUtil.TABS_BORDER, 1));
}
项目:tools-idea    文件:TabsBorder.java   
public Insets getEffectiveBorder() {
  if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone();

  myPosition = myTabs.getTabsPosition();

  if (myTabs.isEditorTabs()) {
    // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :(
    myEffectiveBorder = new Insets(TabsUtil.TABS_BORDER, 
                                   /*myPosition == JBTabsPosition.right ? TabsUtil.TABS_BORDER : */0, 0, 0);
  }
  else {
    myEffectiveBorder = new Insets(
      myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top,
      myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left,
      myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom,
      myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right
    );
  }


  return (Insets)myEffectiveBorder.clone();
}
项目:tools-idea    文件:TabLabel.java   
@Override
public Dimension getPreferredSize() {
  final Dimension size = super.getPreferredSize();
  size.height = TabsUtil.getTabsHeight();
  if (myActionPanel != null && !myActionPanel.isVisible()) {
    final Dimension actionPanelSize = myActionPanel.getPreferredSize();
    size.width += actionPanelSize.width;
  }

  final JBTabsPosition pos = myTabs.getTabsPosition();
  switch (pos) {
    case top:
    case bottom:
      if (myTabs.hasUnderline()) size.height += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1;
      break;
    case left: case right: size.width += getSelectedOffset(); break;
  }

  return size;
}
项目:tools-idea    文件:JBRunnerTabs.java   
@Override
protected void doPaintInactive(Graphics2D g2d,
                               boolean leftGhostExists,
                               TabLabel label,
                               Rectangle effectiveBounds,
                               boolean rightGhostExists, int row, int column) {
  Insets insets = getTabsBorder().getEffectiveBorder();
  final boolean dark = UIUtil.isUnderDarcula();
  int _x = effectiveBounds.x + insets.left;
  int _y = effectiveBounds.y + insets.top + 3;
  int _width = effectiveBounds.width - insets.left - insets.right;
  int _height = effectiveBounds.height - insets.top - insets.bottom - 3;
  _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
  if (dark) {
    g2d.setPaint(UIUtil.getGradientPaint(_x, _y, ColorUtil.shift(UIUtil.getListBackground(), 1.3), _x, _y + effectiveBounds.height, UIUtil.getPanelBackground()));
    g2d.fillRect(_x, _y, _width, _height);

    g2d.setColor(Gray._0.withAlpha(50));
  } else {
    g2d.setPaint(UIUtil.getGradientPaint(_x, _y, new Color(255, 255, 255, 180), _x, _y + effectiveBounds.height, new Color(255, 255, 255, 100)));
    g2d.fillRect(_x, _y, _width, _height);

    g2d.setColor(new Color(255, 255, 255, 100));
    g2d.drawRect(_x, _y, _width - 1, _height - 1);
  }
}
项目:jediterm    文件:TabsBorder.java   
public Insets getEffectiveBorder() {
  if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone();

  myPosition = myTabs.getTabsPosition();

  if (myTabs.isEditorTabs()) {
    // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :(
    myEffectiveBorder = new Insets(myPosition == JBTabsPosition.top ? TabsUtil.TABS_BORDER : 0, 0, 0, 0);
  }
  else {
    myEffectiveBorder = new Insets(
      myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top,
      myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left,
      myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom,
      myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right
    );
  }


  return (Insets)myEffectiveBorder.clone();
}
项目:jediterm    文件:TabLabel.java   
@Override
public Dimension getPreferredSize() {
    final Dimension size = super.getPreferredSize();
    size.height = TabsUtil.getTabsHeight();

    final JBTabsPosition pos = myTabs.getTabsPosition();
    switch (pos) {
        case top:
        case bottom:
            if (myTabs.hasUnderline()) size.height += myTabs.getActiveTabUnderlineHeight() - 1;
            break;
        case left:
        case right:
            size.width += getSelectedOffset();
            break;
    }

    return size;
}
项目:consulo    文件:TabsBorder.java   
public Insets getEffectiveBorder() {
  if (myEffectiveBorder != null && myTabs.getTabsPosition() == myPosition) return (Insets)myEffectiveBorder.clone();

  myPosition = myTabs.getTabsPosition();

  if (myTabs.isEditorTabs()) {
    // it seems like all of the borders should be defined in splitters. this is wrong, but I just can not fix it right now :(
    myEffectiveBorder = JBUI.insets(myPosition == JBTabsPosition.top ? TabsUtil.TABS_BORDER : 0, 0, 0, 0);
  }
  else {
    myEffectiveBorder = JBUI.insets(
      myPosition == JBTabsPosition.top ? myTabBorderSize : myBorderSize.top,
      myPosition == JBTabsPosition.left ? myTabBorderSize : myBorderSize.left,
      myPosition == JBTabsPosition.bottom ? myTabBorderSize : myBorderSize.bottom,
      myPosition == JBTabsPosition.right ? myTabBorderSize : myBorderSize.right
    );
  }


  return (Insets)myEffectiveBorder.clone();
}
项目:consulo    文件:TabLabel.java   
@Override
public Dimension getPreferredSize() {
  final Dimension size = super.getPreferredSize();
  size.height = TabsUtil.getTabsHeight();
  if (myActionPanel != null && !myActionPanel.isVisible()) {
    final Dimension actionPanelSize = myActionPanel.getPreferredSize();
    size.width += actionPanelSize.width;
  }

  final JBTabsPosition pos = myTabs.getTabsPosition();
  switch (pos) {
    case top:
    case bottom:
      if (myTabs.hasUnderline()) size.height += myTabs.getActiveTabUnderlineHeight() - 1;
      break;
    case left:
    case right:
      size.width += getSelectedOffset();
      break;
  }

  return size;
}
项目:tools-idea    文件:JBEditorTabs.java   
protected void doPaintInactive(Graphics2D g2d,
                               boolean leftGhostExists,
                               TabLabel label,
                               Rectangle effectiveBounds,
                               boolean rightGhostExists, int row, int column) {
  Insets insets = getTabsBorder().getEffectiveBorder();

  int _x = effectiveBounds.x + insets.left;
  int _y = effectiveBounds.y + insets.top;
  int _width = effectiveBounds.width - insets.left - insets.right + (getTabsPosition() == JBTabsPosition.right ? 1 : 0);
  int _height = effectiveBounds.height - insets.top - insets.bottom;


  if ((!isSingleRow() /* for multiline */) || (isSingleRow() && isHorizontalTabs()))  {
    if (isSingleRow() && getPosition() == JBTabsPosition.bottom) {
      _y += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
    } else {
      if (isSingleRow()) {
        _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
      } else {
        TabInfo info = label.getInfo();
        if (((TableLayout)getEffectiveLayout()).isLastRow(info)) {
          _height -= TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
        }
      }
    }
  }

  final boolean vertical = getTabsPosition() == JBTabsPosition.left || getTabsPosition() == JBTabsPosition.right;
  final Color tabColor = label.getInfo().getTabColor();
  getPainter().doPaintInactive(g2d, effectiveBounds, _x, _y, _width, _height, tabColor, row, column, vertical);
}
项目:tools-idea    文件:JBEditorTabs.java   
protected ShapeInfo _computeSelectedLabelShape() {
  final ShapeInfo shape = new ShapeInfo();

  shape.path = getEffectiveLayout().createShapeTransform(getSize());
  shape.insets = shape.path.transformInsets(getLayoutInsets());
  shape.labelPath = shape.path.createTransform(getSelectedLabel().getBounds());

  shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1);
  shape.labelTopY =
    shape.labelPath.getY() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? shape.labelPath.deltaY(1) : 0) ;
  shape.labelLeftX = shape.labelPath.getX() + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(
    1));
  shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1);

  int leftX = shape.insets.left + (getPosition() == JBTabsPosition.top || getPosition() == JBTabsPosition.bottom ? 0 : shape.labelPath.deltaX(1));

  shape.path.moveTo(leftX, shape.labelBottomY);
  shape.path.lineTo(shape.labelLeftX, shape.labelBottomY);
  shape.path.lineTo(shape.labelLeftX, shape.labelTopY);
  shape.path.lineTo(shape.labelRightX, shape.labelTopY);
  shape.path.lineTo(shape.labelRightX, shape.labelBottomY);

  int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right);

  shape.path.lineTo(lastX, shape.labelBottomY);
  shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1));
  shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1));

  shape.path.closePath();
  shape.fillPath = shape.path.copy();

  return shape;
}
项目:tools-idea    文件:JBRunnerTabs.java   
protected ShapeInfo _computeSelectedLabelShape(Rectangle r) {
  final ShapeInfo shape = new ShapeInfo();

  shape.path = getEffectiveLayout().createShapeTransform(getSize());
  shape.insets = shape.path.transformInsets(getLayoutInsets());
  shape.labelPath = shape.path.createTransform(r);

  shape.labelBottomY = shape.labelPath.getMaxY() - shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1);
  shape.labelTopY = shape.labelPath.getY() + shape.labelPath.deltaY(1);
  shape.labelLeftX = shape.labelPath.getX();
  shape.labelRightX = shape.labelPath.getMaxX() - shape.labelPath.deltaX(1);

  int leftX = shape.insets.left;

  shape.path.moveTo(leftX, shape.labelBottomY);
  shape.path.lineTo(shape.labelLeftX, shape.labelBottomY);
  shape.path.lineTo(shape.labelLeftX, shape.labelTopY);
  shape.path.lineTo(shape.labelRightX, shape.labelTopY);
  shape.path.lineTo(shape.labelRightX, shape.labelBottomY);

  int lastX = shape.path.getWidth() - shape.path.deltaX(shape.insets.right);

  shape.path.lineTo(lastX, shape.labelBottomY);
  shape.path.lineTo(lastX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1));
  shape.path.lineTo(leftX, shape.labelBottomY + shape.labelPath.deltaY(TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT - 1));

  shape.path.closePath();
  shape.fillPath = shape.path.copy();

  return shape;
}
项目:intellij-ce-playground    文件:ToolWindowHeader.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:intellij-ce-playground    文件:ToolWindowHeader.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:intellij-ce-playground    文件:LightToolWindow.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:intellij-ce-playground    文件:LightToolWindow.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:intellij-ce-playground    文件:ToolWindowAlikePanel.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:intellij-ce-playground    文件:ToolWindowAlikePanel.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:tools-idea    文件:TabLabel.java   
protected int getNonSelectedOffset() {
  if (myTabs.isEditorTabs() && (myTabs.isSingleRow() || ((TableLayout)myTabs.getEffectiveLayout()).isLastRow(getInfo()))) {
    return -TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT / 2 + 1;
  }
  return 1;
}
项目:tools-idea    文件:ToolWindowHeader.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:tools-idea    文件:ToolWindowHeader.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:tools-idea    文件:JBRunnerTabs.java   
@Override
public Dimension getPreferredSize() {
  Dimension result = super.getPreferredSize();
  result.height += TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT;
  return result;
}
项目:tools-idea    文件:LightToolWindow.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:tools-idea    文件:LightToolWindow.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:cordovastudio    文件:LightToolWindow.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:cordovastudio    文件:LightToolWindow.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:consulo    文件:LightToolWindow.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:consulo    文件:LightToolWindow.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:consulo    文件:DesktopToolWindowHeader.java   
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}
项目:consulo    文件:DesktopToolWindowHeader.java   
@Override
public Dimension getMinimumSize() {
  Dimension size = super.getMinimumSize();
  return new Dimension(size.width, TabsUtil.getTabsHeight());
}