Пример #1
0
 @Override
 public void setProportion(float proportion) {
   int width = myTabs.getWidth();
   if (myTabs.getTabsPosition() == JBTabsPosition.left) {
     setSideTabsLimit((int) Math.max(JBTabsImpl.MIN_TAB_WIDTH, proportion * width));
   } else if (myTabs.getTabsPosition() == JBTabsPosition.right) {
     setSideTabsLimit(width - (int) Math.max(JBTabsImpl.MIN_TAB_WIDTH, proportion * width));
   }
 }
Пример #2
0
  protected int getNonSelectedOffset() {
    if (myTabs.isEditorTabs()) {
      int offset = (TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT / 2);
      if (myTabs.isSingleRow()) {
        return myTabs.getTabsPosition() == JBTabsPosition.bottom ? -(offset + 1) : -offset + 1;
      } else {
        return ((TableLayout) myTabs.getEffectiveLayout()).isLastRow(getInfo())
            ? -offset + 1
            : offset - 1;
      }
    }

    return 2;
  }
Пример #3
0
  @Override
  public Dimension getPreferredSize() {
    final Dimension size = super.getPreferredSize();
    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:
        size.height +=
            myTabs.isEditorTabs() ? TabsUtil.ACTIVE_TAB_UNDERLINE_HEIGHT : getSelectedOffset();
        break;
      case left:
      case right:
        size.width += getSelectedOffset();
        break;
    }

    return size;
  }
Пример #4
0
  public void doTranslate(PairConsumer<Integer, Integer> consumer) {
    final JBTabsPosition pos = myTabs.getTabsPosition();

    int dX = 0;
    int dXs = 0;
    int dY = 0;
    int dYs = 0;
    int selected = getSelectedOffset();
    int plain = getNonSelectedOffset();

    switch (pos) {
      case bottom:
        dY = -plain;
        dYs = -selected;
        break;
      case left:
        dX = plain;
        dXs = selected;
        break;
      case right:
        dX = -plain;
        dXs = -selected;
        break;
      case top:
        dY = plain;
        dYs = selected;
        break;
    }

    if (!myTabs.isDropTarget(myInfo)) {
      if (myTabs.getSelectedInfo() != myInfo) {
        consumer.consume(dX, dY);
      } else {
        consumer.consume(dXs, dYs);
      }
    }
  }