當前位置: 首頁>>代碼示例>>Java>>正文


Java ToolWindowAnchor.LEFT屬性代碼示例

本文整理匯總了Java中com.intellij.openapi.wm.ToolWindowAnchor.LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java ToolWindowAnchor.LEFT屬性的具體用法?Java ToolWindowAnchor.LEFT怎麽用?Java ToolWindowAnchor.LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.intellij.openapi.wm.ToolWindowAnchor的用法示例。


在下文中一共展示了ToolWindowAnchor.LEFT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBorderInsets

@Override
public Insets getBorderInsets(Component c) {
  Stripe stripe = (Stripe)c;
  ToolWindowAnchor anchor = stripe.getAnchor();

  Insets result = new Insets(0, 0, 0, 0);
  final int off = UIUtil.isUnderDarcula() ? 1 : 0;
  if (anchor == ToolWindowAnchor.LEFT) {
    result.top = 1;
    result.right = 1 + off;
  }
  else if (anchor == ToolWindowAnchor.RIGHT) {
    result.left = 1 + off;
    result.top = 1;
  }
  else if (anchor == ToolWindowAnchor.TOP) {
    result.bottom = 0;
    //result.bottom = 1;
    result.top = 1;
  }
  else {
    result.top = 1 + off;
  }

  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:Stripe.java

示例2: paintComponent

@Override
protected void paintComponent(final Graphics g) {
  super.paintComponent(g);
  if (!myFinishingDrop && isDroppingButton() && myDragButton.getParent() != this) {
    g.setColor(getBackground().brighter());
    g.fillRect(0, 0, getWidth(), getHeight());
  }
  if (UIUtil.isUnderDarcula()) return;
  ToolWindowAnchor anchor = getAnchor();
  g.setColor(new Color(255, 255, 255, 40));
  Rectangle r = getBounds();
  if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) {
    g.drawLine(0, 0, 0, r.height);
    g.drawLine(r.width - 2, 0, r.width - 2, r.height);
  }
  else {
    g.drawLine(0, 1, r.width, 1);
    g.drawLine(0, r.height - 1, r.width, r.height - 1);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:Stripe.java

示例3: setComponent

/**
 * Sets (docks) specified component to the specified anchor.
 */
private void setComponent(final JComponent component, final ToolWindowAnchor anchor, final float weight) {
  if (ToolWindowAnchor.TOP == anchor) {
    myVerticalSplitter.setFirstComponent(component);
    myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight));
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    myHorizontalSplitter.setFirstComponent(component);
    myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight));
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    myVerticalSplitter.setLastComponent(component);
    myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight));
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    myHorizontalSplitter.setLastComponent(component);
    myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight));
  }
  else {
    LOG.error("unknown anchor: " + anchor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:ToolWindowsPane.java

示例4: getComponentAt

private JComponent getComponentAt(ToolWindowAnchor anchor) {
  if (ToolWindowAnchor.TOP == anchor) {
    return myVerticalSplitter.getFirstComponent();
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    return myHorizontalSplitter.getFirstComponent();
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    return myVerticalSplitter.getLastComponent();
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    return myHorizontalSplitter.getLastComponent();
  }
  else {
    LOG.error("unknown anchor: " + anchor);
    return null;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:ToolWindowsPane.java

示例5: getStripeFor

@Nullable
Stripe getStripeFor(String id) {
  ToolWindow window = myManager.getToolWindow(id);
  if (window == null) {
    return null;
  }

  final ToolWindowAnchor anchor = myManager.getToolWindow(id).getAnchor();
  if (ToolWindowAnchor.TOP == anchor) {
    return myTopStripe;
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    return myBottomStripe;
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    return myLeftStripe;
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    return myRightStripe;
  }

  throw new IllegalArgumentException("Anchor=" + anchor);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:ToolWindowsPane.java

示例6: run

public final void run() {
  try {
    final ToolWindowAnchor anchor = myInfo.getAnchor();
    if (ToolWindowAnchor.TOP == anchor) {
      myTopStripe.addButton(myButton, myComparator);
    }
    else if (ToolWindowAnchor.LEFT == anchor) {
      myLeftStripe.addButton(myButton, myComparator);
    }
    else if (ToolWindowAnchor.BOTTOM == anchor) {
      myBottomStripe.addButton(myButton, myComparator);
    }
    else if (ToolWindowAnchor.RIGHT == anchor) {
      myRightStripe.addButton(myButton, myComparator);
    }
    else {
      LOG.error("unknown anchor: " + anchor);
    }
    validate();
    repaint();
  }
  finally {
    finish();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:ToolWindowsPane.java

示例7: setBoundsInPaletteLayer

public final void setBoundsInPaletteLayer(final Component component, final ToolWindowAnchor anchor, float weight) {
  if (weight < .0f) {
    weight = WindowInfoImpl.DEFAULT_WEIGHT;
  }
  else if (weight > 1.0f) {
    weight = 1.0f;
  }
  if (ToolWindowAnchor.TOP == anchor) {
    component.setBounds(0, 0, getWidth(), (int)(getHeight() * weight + .5f));
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    component.setBounds(0, 0, (int)(getWidth() * weight + .5f), getHeight());
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    final int height = (int)(getHeight() * weight + .5f);
    component.setBounds(0, getHeight() - height, getWidth(), height);
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    final int width = (int)(getWidth() * weight + .5f);
    component.setBounds(getWidth() - width, 0, width, getHeight());
  }
  else {
    LOG.error("unknown anchor " + anchor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:ToolWindowsPane.java

示例8: is

private boolean is(boolean first) {
  Container parent = getParent();
  if (parent == null) return false;
  
  int max = first ? Integer.MAX_VALUE : 0;
  ToolWindowAnchor anchor = getAnchor();
  Component c = null;
  int count = parent.getComponentCount();
  for (int i = 0; i < count; i++) {
    Component component = parent.getComponent(i);
    if (!component.isVisible()) continue;
    Rectangle r = component.getBounds();
    if (anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT) {
      if (first && max > r.y || !first && max < r.y) {
        max = r.y;
        c = component;
      }
    } else {
      if (first && max > r.x || !first && max < r.x) {
        max = r.x;
        c = component;
      }
    }
  }
  
  
  return c == this;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:StripeButton.java

示例9: getPreferredSize

public Dimension getPreferredSize(final JComponent c){
  final AnchoredButton button=(AnchoredButton)c;
  final Dimension dim=super.getPreferredSize(button);

  dim.width=(int)(JBUI.scale(4) + dim.width*1.1f);
  dim.height+= JBUI.scale(2);

  final ToolWindowAnchor anchor=button.getAnchor();
  if(ToolWindowAnchor.LEFT==anchor||ToolWindowAnchor.RIGHT==anchor){
    return new Dimension(dim.height,dim.width);
  } else{
    return dim;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:StripeButtonUI.java

示例10: runMovement

public final void runMovement() {
  if (!isShowing()) {
    return;
  }
  final int distance;
  final Rectangle bounds = getBounds();
  if (myAnchor == ToolWindowAnchor.LEFT || myAnchor == ToolWindowAnchor.RIGHT) {
    distance = bounds.width;
  }
  else {
    distance = bounds.height;
  }
  int count = 0;
  myOffset = 0;
  paintImmediately(0, 0, getWidth(), getHeight());//first paint requires more time than next ones
  final long startTime = System.currentTimeMillis();


  while (true) {
    paintImmediately(0, 0, getWidth(), getHeight());
    final long timeSpent = System.currentTimeMillis() - startTime;
    count++;
    if (timeSpent >= myDesiredTimeToComplete) break;
    final double onePaintTime = (double)timeSpent / count;
    int iterations = (int)((myDesiredTimeToComplete - timeSpent) / onePaintTime);
    iterations = Math.max(1, iterations);
    myOffset += (distance - myOffset) / iterations;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:Surface.java

示例11: stretch

private void stretch(ToolWindow wnd, int value) {
  Pair<Resizer, Component> pair = findResizerAndComponent(wnd);
  if (pair == null) return;

  boolean vertical = wnd.getAnchor() == ToolWindowAnchor.TOP || wnd.getAnchor() == ToolWindowAnchor.BOTTOM;
  int actualSize = (vertical ? pair.second.getHeight() : pair.second.getWidth()) + value;
  boolean first = wnd.getAnchor() == ToolWindowAnchor.LEFT  || wnd.getAnchor() == ToolWindowAnchor.TOP;
  int maxValue = vertical ? myVerticalSplitter.getMaxSize(first) : myHorizontalSplitter.getMaxSize(first);
  int minValue = vertical ? myVerticalSplitter.getMinSize(first) : myHorizontalSplitter.getMinSize(first);;

  pair.first.setSize(Math.max(minValue, Math.min(maxValue, actualSize)));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:ToolWindowsPane.java

示例12: paint

public final void paint(final Graphics g) {
  final Rectangle bounds = getBounds();
  if (myAnchor == ToolWindowAnchor.LEFT) {
    if (myDirection == 1) {
      g.setClip(null);
      g.clipRect(myOffset, 0, bounds.width - myOffset, bounds.height);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(0, 0, myOffset, bounds.height);
      UIUtil.drawImage(g, myTopImage, myOffset - bounds.width, 0, null);
    }
    else {
      g.setClip(null);
      g.clipRect(bounds.width - myOffset, 0, myOffset, bounds.height);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(0, 0, bounds.width - myOffset, bounds.height);
      UIUtil.drawImage(g, myTopImage, -myOffset, 0, null);
    }
    myTopImage.flush();
  }
  else if (myAnchor == ToolWindowAnchor.RIGHT) {
    if (myDirection == 1) {
      g.setClip(null);
      g.clipRect(0, 0, bounds.width - myOffset, bounds.height);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(bounds.width - myOffset, 0, myOffset, bounds.height);
      UIUtil.drawImage(g, myTopImage, bounds.width - myOffset, 0, null);
    }
    else {
      g.setClip(null);
      g.clipRect(0, 0, myOffset, bounds.height);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(myOffset, 0, bounds.width - myOffset, bounds.height);
      UIUtil.drawImage(g, myTopImage, myOffset, 0, null);
    }
  }
  else if (myAnchor == ToolWindowAnchor.TOP) {
    if (myDirection == 1) {
      g.setClip(null);
      g.clipRect(0, myOffset, bounds.width, bounds.height - myOffset);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(0, 0, bounds.width, myOffset);
      UIUtil.drawImage(g, myTopImage, 0, -bounds.height + myOffset, null);
    }
    else {
      g.setClip(null);
      g.clipRect(0, bounds.height - myOffset, bounds.width, myOffset);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(0, 0, bounds.width, bounds.height - myOffset);
      UIUtil.drawImage(g, myTopImage, 0, -myOffset, null);
    }
  }
  else if (myAnchor == ToolWindowAnchor.BOTTOM) {
    if (myDirection == 1) {
      g.setClip(null);
      g.clipRect(0, 0, bounds.width, bounds.height - myOffset);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(0, bounds.height - myOffset, bounds.width, myOffset);
      UIUtil.drawImage(g, myTopImage, 0, bounds.height - myOffset, null);
    }
    else {
      g.setClip(null);
      g.clipRect(0, 0, bounds.width, myOffset);
      UIUtil.drawImage(g, myBottomImage, 0, 0, null);
      g.setClip(null);
      g.clipRect(0, myOffset, bounds.width, bounds.height - myOffset);
      UIUtil.drawImage(g, myTopImage, 0, myOffset, null);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:76,代碼來源:Surface.java

示例13: findResizerAndComponent

@Nullable
private Pair<Resizer, Component> findResizerAndComponent(ToolWindow wnd) {
  if (!wnd.isVisible()) return null;

  Resizer resizer = null;
  Component cmp = null;

  if (wnd.getType() == ToolWindowType.DOCKED) {
    cmp = getComponentAt(wnd.getAnchor());

    if (cmp != null) {
      if (wnd.getAnchor().isHorizontal()) {
        resizer = myVerticalSplitter.getFirstComponent() == cmp
                  ? new Resizer.Splitter.FirstComponent(myVerticalSplitter)
                  : new Resizer.Splitter.LastComponent(myVerticalSplitter);
      }
      else {
        resizer = myHorizontalSplitter.getFirstComponent() == cmp
                  ? new Resizer.Splitter.FirstComponent(myHorizontalSplitter)
                  : new Resizer.Splitter.LastComponent(myHorizontalSplitter);
      }
    }
  }
  else if (wnd.getType() == ToolWindowType.SLIDING) {
    cmp = wnd.getComponent();
    while (cmp != null) {
      if (cmp.getParent() == myLayeredPane) break;
      cmp = cmp.getParent();
    }

    if (cmp != null) {
      if (wnd.getAnchor() == ToolWindowAnchor.TOP) {
        resizer = new Resizer.LayeredPane.Top(cmp);
      }
      else if (wnd.getAnchor() == ToolWindowAnchor.BOTTOM) {
        resizer = new Resizer.LayeredPane.Bottom(cmp);
      }
      else if (wnd.getAnchor() == ToolWindowAnchor.LEFT) {
        resizer = new Resizer.LayeredPane.Left(cmp);
      }
      else if (wnd.getAnchor() == ToolWindowAnchor.RIGHT) {
        resizer = new Resizer.LayeredPane.Right(cmp);
      }
    }
  }

  return resizer != null ? Pair.create(resizer, cmp) : null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:48,代碼來源:ToolWindowsPane.java

示例14: getPaletteAnchor

@NotNull
@Override
public ToolWindowAnchor getPaletteAnchor() {
  return ToolWindowAnchor.LEFT;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:AndroidDesignerCustomizations.java

示例15: getAnchor

@Override
protected ToolWindowAnchor getAnchor() {
  return ToolWindowAnchor.LEFT;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:DesignerToolWindowManager.java


注:本文中的com.intellij.openapi.wm.ToolWindowAnchor.LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。