Search in sources :

Example 1 with BalloonLayoutImpl

use of com.intellij.ui.BalloonLayoutImpl in project intellij-community by JetBrains.

the class InfoAndProgressPanel method buildInInlineIndicator.

private void buildInInlineIndicator(@NotNull final InlineProgressIndicator inline) {
    removeAll();
    setLayout(new InlineLayout());
    final JRootPane pane = getRootPane();
    // e.g. project frame is closed
    if (pane == null)
        return;
    add(myRefreshAndInfoPanel);
    final JPanel inlinePanel = new JPanel(new BorderLayout());
    inline.getComponent().setBorder(JBUI.Borders.empty(1, 0, 0, 2));
    final JComponent inlineComponent = inline.getComponent();
    inlineComponent.setOpaque(false);
    inlinePanel.add(inlineComponent, BorderLayout.CENTER);
    //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder());
    inlinePanel.add(myProgressIcon, BorderLayout.WEST);
    inline.updateProgressNow();
    inlinePanel.setOpaque(false);
    add(inlinePanel);
    myRefreshAndInfoPanel.revalidate();
    myRefreshAndInfoPanel.repaint();
    final PresentationModeProgressPanel panel = new PresentationModeProgressPanel(inline);
    MyInlineProgressIndicator delegate = new MyInlineProgressIndicator(true, inline.getInfo(), inline) {

        @Override
        protected void updateProgress() {
            super.updateProgress();
            panel.update();
        }
    };
    Disposer.register(inline, delegate);
    Component anchor = getAnchor(pane);
    final BalloonLayoutImpl balloonLayout = getBalloonLayout(pane);
    final Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(panel.getProgressPanel()).setFadeoutTime(0).setFillColor(Gray.TRANSPARENT).setShowCallout(false).setBorderColor(Gray.TRANSPARENT).setBorderInsets(JBUI.emptyInsets()).setAnimationCycle(0).setCloseButtonEnabled(false).setHideOnClickOutside(false).setDisposable(inline).setHideOnFrameResize(false).setHideOnKeyOutside(false).setBlockClicksThroughBalloon(true).setHideOnAction(false).createBalloon();
    if (balloonLayout != null) {
        class MyListener implements JBPopupListener, Runnable {

            @Override
            public void beforeShown(LightweightWindowEvent event) {
                balloonLayout.addListener(this);
            }

            @Override
            public void onClosed(LightweightWindowEvent event) {
                balloonLayout.removeListener(this);
            }

            @Override
            public void run() {
                if (!balloon.isDisposed()) {
                    balloon.revalidate();
                }
            }
        }
        balloon.addListener(new MyListener());
    }
    balloon.show(new PositionTracker<Balloon>(anchor) {

        @Override
        public RelativePoint recalculateLocation(Balloon object) {
            Component c = getAnchor(pane);
            int y = c.getHeight() - 45;
            if (balloonLayout != null && !isBottomSideToolWindowsVisible(pane)) {
                Component component = balloonLayout.getTopBalloonComponent();
                if (component != null) {
                    y = SwingUtilities.convertPoint(component, 0, -45, c).y;
                }
            }
            return new RelativePoint(c, new Point(c.getWidth() - 150, y));
        }
    }, Balloon.Position.above);
}
Also used : RelativePoint(com.intellij.ui.awt.RelativePoint) RelativePoint(com.intellij.ui.awt.RelativePoint) BalloonLayoutImpl(com.intellij.ui.BalloonLayoutImpl)

Example 2 with BalloonLayoutImpl

use of com.intellij.ui.BalloonLayoutImpl in project intellij-community by JetBrains.

the class IdeRootPane method uiSettingsChanged.

@Override
public void uiSettingsChanged(UISettings uiSettings) {
    setMemoryIndicatorVisible(uiSettings.getShowMemoryIndicator());
    updateToolbarVisibility();
    updateStatusBarVisibility();
    for (IdeRootPaneNorthExtension component : myNorthComponents) {
        component.uiSettingsChanged(uiSettings);
    }
    IdeFrame frame = UIUtil.getParentOfType(IdeFrame.class, this);
    BalloonLayout layout = frame != null ? frame.getBalloonLayout() : null;
    if (layout instanceof BalloonLayoutImpl)
        ((BalloonLayoutImpl) layout).queueRelayout();
}
Also used : BalloonLayout(com.intellij.ui.BalloonLayout) BalloonLayoutImpl(com.intellij.ui.BalloonLayoutImpl)

Aggregations

BalloonLayoutImpl (com.intellij.ui.BalloonLayoutImpl)2 BalloonLayout (com.intellij.ui.BalloonLayout)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1