org-netbeans-core-ui

16:39:35.710 INFO  jd.cli.Main - Decompiling org-netbeans-core-ui.jar
package org.netbeans.core.ui.notifications;

import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;

final class BalloonManager$1
  implements ComponentListener
{
  public void componentResized(ComponentEvent paramComponentEvent) {}
  
  public void componentMoved(ComponentEvent paramComponentEvent) {}
  
  public void componentShown(ComponentEvent paramComponentEvent) {}
  
  public void componentHidden(ComponentEvent paramComponentEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;

final class BalloonManager$2
  implements WindowStateListener
{
  public void windowStateChanged(WindowEvent paramWindowEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

final class BalloonManager$3
  implements Runnable
{
  BalloonManager$3(int paramInt) {}
  
  public void run()
  {
    if (BalloonManager.access$300() != null) {
      BalloonManager.access$300().startDismissTimer(val$timeout);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

final class BalloonManager$4
  implements Runnable
{
  public void run()
  {
    if (BalloonManager.access$300() != null) {
      BalloonManager.access$300().stopDismissTimer();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class BalloonManager$Balloon$1
  implements ActionListener
{
  BalloonManager$Balloon$1(BalloonManager.Balloon paramBalloon) {}
  
  public void actionPerformed(ActionEvent paramActionEvent) {}
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.Balloon.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComponent;
import javax.swing.ToolTipManager;

class BalloonManager$Balloon$2
  implements MouseListener
{
  BalloonManager$Balloon$2(BalloonManager.Balloon paramBalloon, ActionListener paramActionListener, JComponent paramJComponent) {}
  
  public void mouseClicked(MouseEvent paramMouseEvent)
  {
    
    if (null != val$defaultAction) {
      val$defaultAction.actionPerformed(new ActionEvent(this$0, 0, "", paramMouseEvent.getWhen(), paramMouseEvent.getModifiers()));
    }
  }
  
  public void mousePressed(MouseEvent paramMouseEvent) {}
  
  public void mouseReleased(MouseEvent paramMouseEvent) {}
  
  public void mouseEntered(MouseEvent paramMouseEvent)
  {
    if (null != val$defaultAction) {
      val$content.setCursor(Cursor.getPredefinedCursor(12));
    }
    this$0.stopDismissTimer();
    this$0.repaint();
  }
  
  public void mouseExited(MouseEvent paramMouseEvent)
  {
    val$content.setCursor(Cursor.getDefaultCursor());
    if (BalloonManager.Balloon.access$200(this$0) > 0) {
      this$0.startDismissTimer(ToolTipManager.sharedInstance().getDismissDelay());
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.Balloon.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

class BalloonManager$Balloon$3
  implements Runnable
{
  BalloonManager$Balloon$3(BalloonManager.Balloon paramBalloon, int paramInt) {}
  
  public void run()
  {
    this$0.startDismissTimer(val$timeoutMillis);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.Balloon.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

class BalloonManager$Balloon$4
  extends MouseAdapter
{
  BalloonManager$Balloon$4(BalloonManager.Balloon paramBalloon) {}
  
  public void mouseEntered(MouseEvent paramMouseEvent)
  {
    BalloonManager.Balloon.access$402(this$0, true);
    this$0.repaint();
  }
  
  public void mouseExited(MouseEvent paramMouseEvent)
  {
    BalloonManager.Balloon.access$402(this$0, false);
    this$0.repaint();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.Balloon.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class BalloonManager$Balloon$5
  implements ActionListener
{
  BalloonManager$Balloon$5(BalloonManager.Balloon paramBalloon) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    BalloonManager.Balloon.access$524(this$0, 0.03F);
    if (BalloonManager.Balloon.access$500(this$0) <= 0.03F)
    {
      this$0.stopDismissTimer();
      BalloonManager.dismiss();
    }
    this$0.repaint();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.Balloon.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.awt.geom.RoundRectangle2D.Float;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;

class BalloonManager$Balloon
  extends JPanel
{
  private static final int Y_OFFSET = 8;
  private static final int ARC = 15;
  private static final int SHADOW_SIZE = 3;
  private JComponent content;
  private MouseListener mouseListener;
  private ActionListener defaultAction;
  private JButton btnDismiss;
  private int arrowLocation = 14;
  private float currentAlpha = 1.0F;
  private Timer dismissTimer;
  private int timeoutMillis;
  private boolean isMouseOverEffect = false;
  private static final float ALPHA_DECREMENT = 0.03F;
  private static final int DISMISS_REPAINT_REPEAT = 100;
  
  public BalloonManager$Balloon(final JComponent paramJComponent, final ActionListener paramActionListener1, ActionListener paramActionListener2, final int paramInt)
  {
    super(new GridBagLayout());
    content = paramJComponent;
    defaultAction = paramActionListener1;
    timeoutMillis = paramInt;
    paramJComponent.setOpaque(false);
    
    btnDismiss = new BalloonManager.DismissButton();
    btnDismiss.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent) {}
    });
    if (null != paramActionListener2) {
      btnDismiss.addActionListener(paramActionListener2);
    }
    add(paramJComponent, new GridBagConstraints(0, 0, 1, 1, 1.0D, 1.0D, 11, 1, new Insets(0, 0, 0, 0), 0, 0));
    add(btnDismiss, new GridBagConstraints(1, 0, 1, 1, 0.0D, 0.0D, 12, 0, new Insets(7, 0, 0, 7), 0, 0));
    
    setOpaque(false);
    
    mouseListener = new MouseListener()
    {
      public void mouseClicked(MouseEvent paramAnonymousMouseEvent)
      {
        
        if (null != paramActionListener1) {
          paramActionListener1.actionPerformed(new ActionEvent(BalloonManager.Balloon.this, 0, "", paramAnonymousMouseEvent.getWhen(), paramAnonymousMouseEvent.getModifiers()));
        }
      }
      
      public void mousePressed(MouseEvent paramAnonymousMouseEvent) {}
      
      public void mouseReleased(MouseEvent paramAnonymousMouseEvent) {}
      
      public void mouseEntered(MouseEvent paramAnonymousMouseEvent)
      {
        if (null != paramActionListener1) {
          paramJComponent.setCursor(Cursor.getPredefinedCursor(12));
        }
        stopDismissTimer();
        repaint();
      }
      
      public void mouseExited(MouseEvent paramAnonymousMouseEvent)
      {
        paramJComponent.setCursor(Cursor.getDefaultCursor());
        if (timeoutMillis > 0) {
          startDismissTimer(ToolTipManager.sharedInstance().getDismissDelay());
        }
      }
    };
    paramJComponent.addMouseListener(mouseListener);
    if (paramInt > 0) {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          startDismissTimer(paramInt);
        }
      });
    }
    MouseAdapter local4 = new MouseAdapter()
    {
      public void mouseEntered(MouseEvent paramAnonymousMouseEvent)
      {
        isMouseOverEffect = true;
        repaint();
      }
      
      public void mouseExited(MouseEvent paramAnonymousMouseEvent)
      {
        isMouseOverEffect = false;
        repaint();
      }
    };
    addMouseListener(local4);
    paramJComponent.addMouseListener(local4);
    btnDismiss.addMouseListener(local4);
    
    handleMouseOver(paramJComponent, local4);
  }
  
  private void handleMouseOver(Container paramContainer, MouseListener paramMouseListener)
  {
    paramContainer.addMouseListener(paramMouseListener);
    for (Component localComponent : paramContainer.getComponents())
    {
      localComponent.addMouseListener(paramMouseListener);
      if ((localComponent instanceof Container)) {
        handleMouseOver((Container)localComponent, paramMouseListener);
      }
    }
  }
  
  synchronized void startDismissTimer(int paramInt)
  {
    stopDismissTimer();
    currentAlpha = 1.0F;
    dismissTimer = new Timer(100, new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        BalloonManager.Balloon.access$524(BalloonManager.Balloon.this, 0.03F);
        if (currentAlpha <= 0.03F)
        {
          stopDismissTimer();
          BalloonManager.dismiss();
        }
        repaint();
      }
    });
    dismissTimer.setInitialDelay(paramInt);
    dismissTimer.start();
  }
  
  synchronized void stopDismissTimer()
  {
    if (null != dismissTimer)
    {
      dismissTimer.stop();
      dismissTimer = null;
      currentAlpha = 1.0F;
    }
  }
  
  void setArrowLocation(int paramInt)
  {
    arrowLocation = paramInt;
    if ((paramInt == 12) || (paramInt == 18)) {
      setBorder(BorderFactory.createEmptyBorder(0, 0, 8, btnDismiss.getWidth()));
    } else {
      setBorder(BorderFactory.createEmptyBorder(8, 0, 0, btnDismiss.getWidth()));
    }
  }
  
  private Shape getMask(int paramInt1, int paramInt2)
  {
    paramInt1--;
    paramInt1 -= 3;
    GeneralPath localGeneralPath = new GeneralPath();
    Area localArea = null;
    switch (arrowLocation)
    {
    case 14: 
      localArea = new Area(new RoundRectangle2D.Float(0.0F, 8.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
      localGeneralPath.moveTo(7.0F, 0.0F);
      localGeneralPath.lineTo(7.0F, 8.0F);
      localGeneralPath.lineTo(15.0F, 8.0F);
      break;
    case 12: 
      localArea = new Area(new RoundRectangle2D.Float(0.0F, 3.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
      localGeneralPath.moveTo(7.0F, paramInt2 - 1);
      localGeneralPath.lineTo(7.0F, paramInt2 - 1 - 8);
      localGeneralPath.lineTo(15.0F, paramInt2 - 1 - 8);
      break;
    case 16: 
      localArea = new Area(new RoundRectangle2D.Float(0.0F, 8.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
      localGeneralPath.moveTo(paramInt1 - 7, 0.0F);
      localGeneralPath.lineTo(paramInt1 - 7, 8.0F);
      localGeneralPath.lineTo(paramInt1 - 7 - 8, 8.0F);
      break;
    case 18: 
      localArea = new Area(new RoundRectangle2D.Float(0.0F, 3.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
      localGeneralPath.moveTo(paramInt1 - 7, paramInt2 - 1);
      localGeneralPath.lineTo(paramInt1 - 7 - 8, paramInt2 - 1 - 8);
      localGeneralPath.lineTo(paramInt1 - 7, paramInt2 - 1 - 8);
    }
    localGeneralPath.closePath();
    localArea.add(new Area(localGeneralPath));
    return localArea;
  }
  
  private Shape getShadowMask(Shape paramShape)
  {
    Area localArea = new Area(paramShape);
    
    AffineTransform localAffineTransform = new AffineTransform();
    localAffineTransform.translate(3.0D, 3.0D);
    localArea.transform(localAffineTransform);
    localArea.subtract(new Area(paramShape));
    return localArea;
  }
  
  protected void paintBorder(Graphics paramGraphics) {}
  
  protected void paintComponent(Graphics paramGraphics)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    
    localGraphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    
    Composite localComposite = localGraphics2D.getComposite();
    Shape localShape = getMask(getWidth(), getHeight());
    
    localGraphics2D.setComposite(AlphaComposite.getInstance(3, 0.25F * currentAlpha));
    localGraphics2D.setColor(Color.black);
    localGraphics2D.fill(getShadowMask(localShape));
    
    localGraphics2D.setColor(UIManager.getColor("ToolTip.background"));
    localGraphics2D.setComposite(AlphaComposite.getInstance(3, currentAlpha));
    Point localPoint = localShape.getBounds().getLocation();
    Point2D.Double localDouble = new Point2D.Double(localPoint.getX(), localPoint.getY() + localShape.getBounds().getHeight());
    if (isMouseOverEffect) {
      localGraphics2D.setPaint(new GradientPaint(localDouble, mouseOverGradientStartColor, localPoint, mouseOverGradientFinishColor));
    } else {
      localGraphics2D.setPaint(new GradientPaint(localDouble, defaultGradientStartColor, localPoint, defaultGradientFinishColor));
    }
    localGraphics2D.fill(localShape);
    localGraphics2D.setColor(Color.black);
    localGraphics2D.draw(localShape);
    localGraphics2D.setComposite(localComposite);
  }
  
  protected void paintChildren(Graphics paramGraphics)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
    Composite localComposite = localGraphics2D.getComposite();
    localGraphics2D.setComposite(AlphaComposite.getInstance(3, currentAlpha));
    super.paintChildren(paramGraphics);
    localGraphics2D.setComposite(localComposite);
  }
  
  private static final Color mouseOverGradientStartColor = new Color(224, 224, 185);
  private static final Color mouseOverGradientFinishColor = new Color(255, 255, 241);
  private static final Color defaultGradientStartColor = new Color(225, 225, 225);
  private static final Color defaultGradientFinishColor = new Color(255, 255, 255);
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.Balloon
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.Graphics;
import javax.swing.BorderFactory;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JButton;
import org.openide.util.ImageUtilities;

class BalloonManager$DismissButton
  extends JButton
{
  public BalloonManager$DismissButton()
  {
    setIcon(ImageUtilities.loadImageIcon("org/netbeans/core/ui/resources/dismiss_enabled.png", true));
    setRolloverIcon(ImageUtilities.loadImageIcon("org/netbeans/core/ui/resources/dismiss_rollover.png", true));
    setPressedIcon(ImageUtilities.loadImageIcon("org/netbeans/core/ui/resources/dismiss_pressed.png", true));
    
    setBorder(BorderFactory.createEmptyBorder());
    setBorderPainted(false);
    setFocusable(false);
    setOpaque(false);
    setRolloverEnabled(true);
  }
  
  public void paint(Graphics paramGraphics)
  {
    Icon localIcon = null;
    if ((getModel().isArmed()) && (getModel().isPressed())) {
      localIcon = getPressedIcon();
    } else if (getModel().isRollover()) {
      localIcon = getRolloverIcon();
    } else {
      localIcon = getIcon();
    }
    localIcon.paintIcon(this, paramGraphics, 0, 0);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager.DismissButton
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.awt.geom.RoundRectangle2D.Float;
import javax.swing.BorderFactory;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import org.openide.util.ImageUtilities;

class BalloonManager
{
  private static Balloon currentBalloon;
  private static JLayeredPane currentPane;
  private static ComponentListener listener;
  private static WindowStateListener windowListener;
  private static Window ownerWindow;
  
  public static synchronized void show(JComponent paramJComponent1, JComponent paramJComponent2, ActionListener paramActionListener1, ActionListener paramActionListener2, int paramInt)
  {
    assert (null != paramJComponent1);
    assert (null != paramJComponent2);
    
    dismiss();
    
    currentBalloon = new Balloon(paramJComponent2, paramActionListener1, paramActionListener2, paramInt);
    currentPane = JLayeredPane.getLayeredPaneAbove(paramJComponent1);
    
    listener = new ComponentListener()
    {
      public void componentResized(ComponentEvent paramAnonymousComponentEvent) {}
      
      public void componentMoved(ComponentEvent paramAnonymousComponentEvent) {}
      
      public void componentShown(ComponentEvent paramAnonymousComponentEvent) {}
      
      public void componentHidden(ComponentEvent paramAnonymousComponentEvent) {}
    };
    windowListener = new WindowStateListener()
    {
      public void windowStateChanged(WindowEvent paramAnonymousWindowEvent) {}
    };
    ownerWindow = SwingUtilities.getWindowAncestor(paramJComponent1);
    if (null != ownerWindow) {
      ownerWindow.addWindowStateListener(windowListener);
    }
    currentPane.addComponentListener(listener);
    configureBalloon(currentBalloon, currentPane, paramJComponent1);
    currentPane.add(currentBalloon, new Integer(JLayeredPane.POPUP_LAYER.intValue() - 1));
  }
  
  public static synchronized void dismiss()
  {
    if (null != currentBalloon)
    {
      currentBalloon.setVisible(false);
      currentBalloon.stopDismissTimer();
      currentPane.remove(currentBalloon);
      currentPane.repaint();
      currentPane.removeComponentListener(listener);
      if (null != ownerWindow) {
        ownerWindow.removeWindowStateListener(windowListener);
      }
      currentBallooncontent.removeMouseListener(currentBalloonmouseListener);
      currentBalloon = null;
      currentPane = null;
      listener = null;
      ownerWindow = null;
      windowListener = null;
    }
  }
  
  public static synchronized void dismissSlowly(int paramInt)
  {
    if (null != currentBalloon) {
      if (currentBalloontimeoutMillis > 0) {
        SwingUtilities.invokeLater(new Runnable()
        {
          public void run()
          {
            if (BalloonManager.currentBalloon != null) {
              BalloonManager.currentBalloon.startDismissTimer(val$timeout);
            }
          }
        });
      } else {
        dismiss();
      }
    }
  }
  
  public static synchronized void stopDismissSlowly()
  {
    if ((null != currentBalloon) && 
      (currentBalloontimeoutMillis > 0))
    {
      currentBalloontimeoutMillis = ToolTipManager.sharedInstance().getDismissDelay();
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          if (BalloonManager.currentBalloon != null) {
            BalloonManager.currentBalloon.stopDismissTimer();
          }
        }
      });
    }
  }
  
  private static void configureBalloon(Balloon paramBalloon, JLayeredPane paramJLayeredPane, JComponent paramJComponent)
  {
    Rectangle localRectangle = paramJComponent.getBounds();
    localRectangle = SwingUtilities.convertRectangle(paramJComponent.getParent(), localRectangle, paramJLayeredPane);
    
    int i = paramJLayeredPane.getWidth();
    int j = paramJLayeredPane.getHeight();
    
    Dimension localDimension = paramBalloon.getPreferredSize();
    height += 15;
    if ((x + width + width < i) && (y + height + height + 15 < j))
    {
      paramBalloon.setArrowLocation(14);
      paramBalloon.setBounds(x + width - 7, y + height, width + 15, height);
    }
    else if ((x + width + width < i) && (y - height - 15 > 0))
    {
      paramBalloon.setArrowLocation(12);
      paramBalloon.setBounds(x + width - 7, y - height, width + 15, height);
    }
    else if ((x - width > 0) && (y + height + height + 15 < j))
    {
      paramBalloon.setArrowLocation(16);
      paramBalloon.setBounds(x - width + 7, y + height, width + 15, height);
    }
    else
    {
      paramBalloon.setArrowLocation(18);
      paramBalloon.setBounds(x - width, y - height, width + 15, height);
    }
  }
  
  private static class Balloon
    extends JPanel
  {
    private static final int Y_OFFSET = 8;
    private static final int ARC = 15;
    private static final int SHADOW_SIZE = 3;
    private JComponent content;
    private MouseListener mouseListener;
    private ActionListener defaultAction;
    private JButton btnDismiss;
    private int arrowLocation = 14;
    private float currentAlpha = 1.0F;
    private Timer dismissTimer;
    private int timeoutMillis;
    private boolean isMouseOverEffect = false;
    private static final float ALPHA_DECREMENT = 0.03F;
    private static final int DISMISS_REPAINT_REPEAT = 100;
    
    public Balloon(final JComponent paramJComponent, final ActionListener paramActionListener1, ActionListener paramActionListener2, final int paramInt)
    {
      super();
      content = paramJComponent;
      defaultAction = paramActionListener1;
      timeoutMillis = paramInt;
      paramJComponent.setOpaque(false);
      
      btnDismiss = new BalloonManager.DismissButton();
      btnDismiss.addActionListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent paramAnonymousActionEvent) {}
      });
      if (null != paramActionListener2) {
        btnDismiss.addActionListener(paramActionListener2);
      }
      add(paramJComponent, new GridBagConstraints(0, 0, 1, 1, 1.0D, 1.0D, 11, 1, new Insets(0, 0, 0, 0), 0, 0));
      add(btnDismiss, new GridBagConstraints(1, 0, 1, 1, 0.0D, 0.0D, 12, 0, new Insets(7, 0, 0, 7), 0, 0));
      
      setOpaque(false);
      
      mouseListener = new MouseListener()
      {
        public void mouseClicked(MouseEvent paramAnonymousMouseEvent)
        {
          
          if (null != paramActionListener1) {
            paramActionListener1.actionPerformed(new ActionEvent(BalloonManager.Balloon.this, 0, "", paramAnonymousMouseEvent.getWhen(), paramAnonymousMouseEvent.getModifiers()));
          }
        }
        
        public void mousePressed(MouseEvent paramAnonymousMouseEvent) {}
        
        public void mouseReleased(MouseEvent paramAnonymousMouseEvent) {}
        
        public void mouseEntered(MouseEvent paramAnonymousMouseEvent)
        {
          if (null != paramActionListener1) {
            paramJComponent.setCursor(Cursor.getPredefinedCursor(12));
          }
          stopDismissTimer();
          repaint();
        }
        
        public void mouseExited(MouseEvent paramAnonymousMouseEvent)
        {
          paramJComponent.setCursor(Cursor.getDefaultCursor());
          if (timeoutMillis > 0) {
            startDismissTimer(ToolTipManager.sharedInstance().getDismissDelay());
          }
        }
      };
      paramJComponent.addMouseListener(mouseListener);
      if (paramInt > 0) {
        SwingUtilities.invokeLater(new Runnable()
        {
          public void run()
          {
            startDismissTimer(paramInt);
          }
        });
      }
      MouseAdapter local4 = new MouseAdapter()
      {
        public void mouseEntered(MouseEvent paramAnonymousMouseEvent)
        {
          isMouseOverEffect = true;
          repaint();
        }
        
        public void mouseExited(MouseEvent paramAnonymousMouseEvent)
        {
          isMouseOverEffect = false;
          repaint();
        }
      };
      addMouseListener(local4);
      paramJComponent.addMouseListener(local4);
      btnDismiss.addMouseListener(local4);
      
      handleMouseOver(paramJComponent, local4);
    }
    
    private void handleMouseOver(Container paramContainer, MouseListener paramMouseListener)
    {
      paramContainer.addMouseListener(paramMouseListener);
      for (Component localComponent : paramContainer.getComponents())
      {
        localComponent.addMouseListener(paramMouseListener);
        if ((localComponent instanceof Container)) {
          handleMouseOver((Container)localComponent, paramMouseListener);
        }
      }
    }
    
    synchronized void startDismissTimer(int paramInt)
    {
      stopDismissTimer();
      currentAlpha = 1.0F;
      dismissTimer = new Timer(100, new ActionListener()
      {
        public void actionPerformed(ActionEvent paramAnonymousActionEvent)
        {
          BalloonManager.Balloon.access$524(BalloonManager.Balloon.this, 0.03F);
          if (currentAlpha <= 0.03F)
          {
            stopDismissTimer();
            BalloonManager.dismiss();
          }
          repaint();
        }
      });
      dismissTimer.setInitialDelay(paramInt);
      dismissTimer.start();
    }
    
    synchronized void stopDismissTimer()
    {
      if (null != dismissTimer)
      {
        dismissTimer.stop();
        dismissTimer = null;
        currentAlpha = 1.0F;
      }
    }
    
    void setArrowLocation(int paramInt)
    {
      arrowLocation = paramInt;
      if ((paramInt == 12) || (paramInt == 18)) {
        setBorder(BorderFactory.createEmptyBorder(0, 0, 8, btnDismiss.getWidth()));
      } else {
        setBorder(BorderFactory.createEmptyBorder(8, 0, 0, btnDismiss.getWidth()));
      }
    }
    
    private Shape getMask(int paramInt1, int paramInt2)
    {
      paramInt1--;
      paramInt1 -= 3;
      GeneralPath localGeneralPath = new GeneralPath();
      Area localArea = null;
      switch (arrowLocation)
      {
      case 14: 
        localArea = new Area(new RoundRectangle2D.Float(0.0F, 8.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
        localGeneralPath.moveTo(7.0F, 0.0F);
        localGeneralPath.lineTo(7.0F, 8.0F);
        localGeneralPath.lineTo(15.0F, 8.0F);
        break;
      case 12: 
        localArea = new Area(new RoundRectangle2D.Float(0.0F, 3.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
        localGeneralPath.moveTo(7.0F, paramInt2 - 1);
        localGeneralPath.lineTo(7.0F, paramInt2 - 1 - 8);
        localGeneralPath.lineTo(15.0F, paramInt2 - 1 - 8);
        break;
      case 16: 
        localArea = new Area(new RoundRectangle2D.Float(0.0F, 8.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
        localGeneralPath.moveTo(paramInt1 - 7, 0.0F);
        localGeneralPath.lineTo(paramInt1 - 7, 8.0F);
        localGeneralPath.lineTo(paramInt1 - 7 - 8, 8.0F);
        break;
      case 18: 
        localArea = new Area(new RoundRectangle2D.Float(0.0F, 3.0F, paramInt1, paramInt2 - 8 - 3, 15.0F, 15.0F));
        localGeneralPath.moveTo(paramInt1 - 7, paramInt2 - 1);
        localGeneralPath.lineTo(paramInt1 - 7 - 8, paramInt2 - 1 - 8);
        localGeneralPath.lineTo(paramInt1 - 7, paramInt2 - 1 - 8);
      }
      localGeneralPath.closePath();
      localArea.add(new Area(localGeneralPath));
      return localArea;
    }
    
    private Shape getShadowMask(Shape paramShape)
    {
      Area localArea = new Area(paramShape);
      
      AffineTransform localAffineTransform = new AffineTransform();
      localAffineTransform.translate(3.0D, 3.0D);
      localArea.transform(localAffineTransform);
      localArea.subtract(new Area(paramShape));
      return localArea;
    }
    
    protected void paintBorder(Graphics paramGraphics) {}
    
    protected void paintComponent(Graphics paramGraphics)
    {
      Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
      
      localGraphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      
      Composite localComposite = localGraphics2D.getComposite();
      Shape localShape = getMask(getWidth(), getHeight());
      
      localGraphics2D.setComposite(AlphaComposite.getInstance(3, 0.25F * currentAlpha));
      localGraphics2D.setColor(Color.black);
      localGraphics2D.fill(getShadowMask(localShape));
      
      localGraphics2D.setColor(UIManager.getColor("ToolTip.background"));
      localGraphics2D.setComposite(AlphaComposite.getInstance(3, currentAlpha));
      Point localPoint = localShape.getBounds().getLocation();
      Point2D.Double localDouble = new Point2D.Double(localPoint.getX(), localPoint.getY() + localShape.getBounds().getHeight());
      if (isMouseOverEffect) {
        localGraphics2D.setPaint(new GradientPaint(localDouble, mouseOverGradientStartColor, localPoint, mouseOverGradientFinishColor));
      } else {
        localGraphics2D.setPaint(new GradientPaint(localDouble, defaultGradientStartColor, localPoint, defaultGradientFinishColor));
      }
      localGraphics2D.fill(localShape);
      localGraphics2D.setColor(Color.black);
      localGraphics2D.draw(localShape);
      localGraphics2D.setComposite(localComposite);
    }
    
    protected void paintChildren(Graphics paramGraphics)
    {
      Graphics2D localGraphics2D = (Graphics2D)paramGraphics;
      Composite localComposite = localGraphics2D.getComposite();
      localGraphics2D.setComposite(AlphaComposite.getInstance(3, currentAlpha));
      super.paintChildren(paramGraphics);
      localGraphics2D.setComposite(localComposite);
    }
    
    private static final Color mouseOverGradientStartColor = new Color(224, 224, 185);
    private static final Color mouseOverGradientFinishColor = new Color(255, 255, 241);
    private static final Color defaultGradientStartColor = new Color(225, 225, 225);
    private static final Color defaultGradientFinishColor = new Color(255, 255, 255);
  }
  
  static class DismissButton
    extends JButton
  {
    public DismissButton()
    {
      setIcon(ImageUtilities.loadImageIcon("org/netbeans/core/ui/resources/dismiss_enabled.png", true));
      setRolloverIcon(ImageUtilities.loadImageIcon("org/netbeans/core/ui/resources/dismiss_rollover.png", true));
      setPressedIcon(ImageUtilities.loadImageIcon("org/netbeans/core/ui/resources/dismiss_pressed.png", true));
      
      setBorder(BorderFactory.createEmptyBorder());
      setBorderPainted(false);
      setFocusable(false);
      setOpaque(false);
      setRolloverEnabled(true);
    }
    
    public void paint(Graphics paramGraphics)
    {
      Icon localIcon = null;
      if ((getModel().isArmed()) && (getModel().isPressed())) {
        localIcon = getPressedIcon();
      } else if (getModel().isRollover()) {
        localIcon = getRolloverIcon();
      } else {
        localIcon = getIcon();
      }
      localIcon.paintIcon(this, paramGraphics, 0, 0);
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.BalloonManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class FlashingIcon$1$1
  implements ActionListener
{
  FlashingIcon$1$1(FlashingIcon.1 param1) {}
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    this$1.val$n.clear();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.FlashingIcon.1.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

class FlashingIcon$1
  implements Runnable
{
  FlashingIcon$1(FlashingIcon paramFlashingIcon, NotificationImpl paramNotificationImpl) {}
  
  public void run()
  {
    if ((null == FlashingIcon.access$100(this$0)) || (null == FlashingIcon.access$100(this$0).getBalloonComp())) {
      return;
    }
    BalloonManager.show(this$0, FlashingIcon.access$100(this$0).getBalloonComp(), null, new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        val$n.clear();
      }
    }, 3000);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.FlashingIcon.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.Component;
import java.awt.Graphics;
import javax.swing.Icon;

class FlashingIcon$MyIcon
  implements Icon
{
  private Icon orig;
  
  public FlashingIcon$MyIcon(FlashingIcon paramFlashingIcon, Icon paramIcon)
  {
    orig = paramIcon;
  }
  
  public void paintIcon(Component paramComponent, Graphics paramGraphics, int paramInt1, int paramInt2)
  {
    if (FlashingIcon.access$500(this$0)) {
      orig.paintIcon(paramComponent, paramGraphics, paramInt1, paramInt2);
    }
  }
  
  public int getIconWidth()
  {
    return orig.getIconWidth();
  }
  
  public int getIconHeight()
  {
    return orig.getIconHeight();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.FlashingIcon.MyIcon
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import org.openide.util.RequestProcessor.Task;

class FlashingIcon$Timer
  implements Runnable
{
  private FlashingIcon$Timer(FlashingIcon paramFlashingIcon) {}
  
  public void run()
  {
    synchronized (this$0)
    {
      long l = System.currentTimeMillis();
      if (FlashingIcon.access$200(this$0)) {
        if (l - FlashingIcon.access$300(this$0) < this$0.STOP_FLASHING_DELAY)
        {
          this$0.flashIcon();
        }
        else
        {
          this$0.stopFlashing();
          if (this$0.DISAPPEAR_DELAY_MILLIS == -1) {
            FlashingIcon.access$402(this$0, null);
          }
        }
      }
      if ((this$0.DISAPPEAR_DELAY_MILLIS > 0) && (l - FlashingIcon.access$300(this$0) >= this$0.DISAPPEAR_DELAY_MILLIS)) {
        this$0.timeout();
      } else if (null != FlashingIcon.access$400(this$0)) {
        FlashingIcon.access$400(this$0).schedule(this$0.FLASHING_FREQUENCY);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.ui.notifications.FlashingIcon.Timer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.ui.notifications;

import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JToolTip;
import javax.swing.SwingUtilities;
import org.openide.util.RequestProcessor;
import org.openide.util.RequestProcessor.Task;

class FlashingIcon
  extends JLabel
  implements MouseListener, PropertyChangeListener
{
  protected int STOP_FLASHING_DELAY = 5000;
  protected int DISAPPEAR_DELAY_MILLIS = STOP_FLASHING_DELAY + 50000;
  protected int FLASHING_FREQUENCY = 500;
  private boolean keepRunning = false;
  private boolean isIconVisible = false;
  private boolean keepFlashing = true;
  private long startTime = 0L;
  private RequestProcessor.Task timerTask;
  private NotificationImpl currentNotification;
  
  protected FlashingIcon()
  {
    addMouseListener(this);
    setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
  }
  
  public void addNotify()
  {
    super.addNotify();
    NotificationDisplayerImpl localNotificationDisplayerImpl = NotificationDisplayerImpl.getInstance();
    int i = localNotificationDisplayerImpl.size();
    setText(i > 1 ? String.valueOf(i) : null);
    currentNotification = localNotificationDisplayerImpl.getTopNotification();
    if (null != currentNotification)
    {
      setIcon(currentNotification.getIcon());
      setToolTipText(currentNotification.getTitle());
    }
    setVisible(localNotificationDisplayerImpl.size() > 0);
    localNotificationDisplayerImpl.addPropertyChangeListener(this);
  }
  
  public void removeNotify()
  {
    NotificationDisplayerImpl localNotificationDisplayerImpl = NotificationDisplayerImpl.getInstance();
    if (localNotificationDisplayerImpl != null) {
      localNotificationDisplayerImpl.removePropertyChangeListener(this);
    }
    currentNotification = null;
    super.removeNotify();
  }
  
  public void startFlashing()
  {
    synchronized (this)
    {
      startTime = System.currentTimeMillis();
      isIconVisible = (!isIconVisible);
      keepRunning = true;
      keepFlashing = true;
      if (null == timerTask) {
        timerTask = RequestProcessor.getDefault().post(new Timer(null));
      } else {
        timerTask.run();
      }
      setVisible(true);
    }
    repaint();
  }
  
  public void disappear()
  {
    synchronized (this)
    {
      keepRunning = false;
      isIconVisible = false;
      keepFlashing = false;
      if (null != timerTask) {
        timerTask.cancel();
      }
      timerTask = null;
      setToolTipText(null);
      setVisible(false);
    }
    repaint();
  }
  
  public void stopFlashing()
  {
    synchronized (this)
    {
      if ((keepRunning) && (!isIconVisible))
      {
        isIconVisible = true;
        repaint();
      }
    }
    keepFlashing = false;
    isIconVisible = true;
  }
  
  protected void flashIcon()
  {
    isIconVisible = (!isIconVisible);
    
    invalidate();
    revalidate();
    repaint();
  }
  
  public void setIcon(Icon paramIcon)
  {
    if (null
1 2 3 4 5 6 7

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd