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


Java Balloon.getPreferredSize方法代碼示例

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


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

示例1: createColumns

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private List<ArrayList<Balloon>> createColumns(Rectangle layoutRec) {
  List<ArrayList<Balloon>> columns = new ArrayList<ArrayList<Balloon>>();

  ArrayList<Balloon> eachColumn = new ArrayList<Balloon>();
  columns.add(eachColumn);

  int eachColumnHeight = 0;
  for (Balloon each : myBalloons) {
    final Dimension eachSize = each.getPreferredSize();
    if (eachColumnHeight + eachSize.height > layoutRec.getHeight()) {
      eachColumn = new ArrayList<Balloon>();
      columns.add(eachColumn);
      eachColumnHeight = 0;
    }
    eachColumn.add(each);
    eachColumnHeight += eachSize.height;
  }
  return columns;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:BalloonLayoutImpl.java

示例2: showNotification

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private static void showNotification(@NotNull DiffViewerBase viewer, @NotNull Notification notification) {
  JComponent component = viewer.getComponent();

  Window window = UIUtil.getWindow(component);
  if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
    notification.notify(viewer.getProject());
    return;
  }

  Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true);
  Disposer.register(viewer, balloon);

  Dimension componentSize = component.getSize();
  Dimension balloonSize = balloon.getPreferredSize();

  int width = Math.min(balloonSize.width, componentSize.width);
  int height = Math.min(balloonSize.height, componentSize.height);

  // top-right corner, 20px to the edges
  RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
  balloon.show(point, Balloon.Position.above);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:AnnotateDiffViewerAction.java

示例3: showNotification

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private static void showNotification(@Nonnull DiffViewerBase viewer, @Nonnull Notification notification) {
  JComponent component = viewer.getComponent();

  Window window = UIUtil.getWindow(component);
  if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
    notification.notify(viewer.getProject());
    return;
  }

  Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true, null, viewer);

  Dimension componentSize = component.getSize();
  Dimension balloonSize = balloon.getPreferredSize();

  int width = Math.min(balloonSize.width, componentSize.width);
  int height = Math.min(balloonSize.height, componentSize.height);

  // top-right corner, 20px to the edges
  RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
  balloon.show(point, Balloon.Position.above);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:22,代碼來源:AnnotateDiffViewerAction.java

示例4: relayout

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private void relayout() {
  final Dimension size = myParent.getSize();

  size.width -= myInsets.left + myInsets.right;
  size.height -= myInsets.top + myInsets.bottom;

  final Rectangle layoutRec = new Rectangle(new Point(myInsets.left, myInsets.top), size);

  List<ArrayList<Balloon>> columns = createColumns(layoutRec);
  while (columns.size() > 1) {
    myBalloons.remove(0);
    columns = createColumns(layoutRec);
  }
  List<Integer> columnWidths = computeWidths(columns);

  int eachCoumnX = (int)layoutRec.getMaxX(); 
  for (int i = 0; i < columns.size(); i++) {
    final ArrayList<Balloon> eachColumn = columns.get(i);
    final Integer eachWidth = columnWidths.get(i);
    eachCoumnX -= eachWidth.intValue();
    int eachY = layoutRec.y;
    for (Balloon eachBalloon : eachColumn) {
      final Rectangle eachRec = new Rectangle();
      final Dimension eachPrefSize = eachBalloon.getPreferredSize();
      eachRec.setSize(eachPrefSize);
      eachRec.setLocation(eachCoumnX + eachWidth.intValue() - eachRec.width, eachY);
      eachBalloon.setBounds(eachRec);
      eachY += eachRec.height;
    }
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:32,代碼來源:BalloonLayoutImpl.java

示例5: getSize

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
@Nonnull
private Dimension getSize(@Nonnull Balloon balloon) {
  BalloonLayoutData layoutData = myLayoutData.get(balloon);
  if (layoutData == null) {
    Dimension size = balloon.getPreferredSize();
    return myWidth == null ? size : new Dimension(myWidth, size.height);
  }
  return new Dimension(myWidth, layoutData.height);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:10,代碼來源:DesktopBalloonLayoutImpl.java

示例6: calculateSize

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private void calculateSize() {
  myWidth = null;

  for (Balloon balloon : myBalloons) {
    BalloonLayoutData layoutData = myLayoutData.get(balloon);
    if (layoutData != null) {
      layoutData.height = balloon.getPreferredSize().height;
    }
  }

  myWidth = BalloonLayoutConfiguration.FixedWidth;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:13,代碼來源:DesktopBalloonLayoutImpl.java

示例7: relayout

import com.intellij.openapi.ui.popup.Balloon; //導入方法依賴的package包/類
private void relayout() {
  final Dimension size = myLayeredPane.getSize();

  JBInsets.removeFrom(size, myInsets);

  final Rectangle layoutRec = new Rectangle(new Point(myInsets.left, myInsets.top), size);

  List<ArrayList<Balloon>> columns = createColumns(layoutRec);
  while (columns.size() > 1) {
    myBalloons.remove(0);
    columns = createColumns(layoutRec);
  }
  List<Integer> columnWidths = computeWidths(columns);

  ToolWindowsPane pane = UIUtil.findComponentOfType(myParent, ToolWindowsPane.class);
  JComponent component = pane != null ? pane : myParent;
  int paneOnScreen = component.isShowing() ? component.getLocationOnScreen().y : 0;
  int layerOnScreen = myLayeredPane.isShowing() ? myLayeredPane.getLocationOnScreen().y : 0;
  int toolbarsOffset = paneOnScreen - layerOnScreen;
  
  JComponent layeredPane = pane != null ? pane.getMyLayeredPane() : null;
  int eachColumnX = (layeredPane == null ? myLayeredPane.getWidth() : layeredPane.getX() + layeredPane.getWidth()) - 4; 
  
  for (int i = 0; i < columns.size(); i++) {
    final ArrayList<Balloon> eachColumn = columns.get(i);
    final Integer eachWidth = columnWidths.get(i);
    eachColumnX -= eachWidth.intValue();
    int eachY = toolbarsOffset + 2;
    for (Balloon eachBalloon : eachColumn) {
      final Rectangle eachRec = new Rectangle();
      final Dimension eachPrefSize = eachBalloon.getPreferredSize();
      eachRec.setSize(eachPrefSize);
      if (((BalloonImpl)eachBalloon).hasShadow()) {
        final int shadowSize = ((BalloonImpl)eachBalloon).getShadowBorderSize();
        eachRec.width += 2 * shadowSize;
        eachRec.height += 2 * shadowSize;
      }
      eachY += 2; //space between two notifications
      eachRec.setLocation(eachColumnX + eachWidth.intValue() - eachRec.width, eachY);
      eachBalloon.setBounds(eachRec);
      eachY += eachRec.height;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:45,代碼來源:BalloonLayoutImpl.java


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