com.crashlytics.tools.eclipse.app_1.6.1.201405061826

16:34:23.976 INFO  jd.cli.Main - Decompiling com.crashlytics.tools.eclipse.app_1.6.1.201405061826.jar
package com.crashlytics.swing;

class AbstractExpandableListModel$1
  implements Runnable
{
  AbstractExpandableListModel$1(AbstractExpandableListModel paramAbstractExpandableListModel) {}
  
  public void run()
  {
    for (ExpandableListModelListener<T> listener : AbstractExpandableListModel.access$0(this$0)) {
      listener.itemsChanged();
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AbstractExpandableListModel.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.swing.SwingUtilities;

public abstract class AbstractExpandableListModel<T>
  implements ExpandableListModel<T>
{
  private final List<ExpandableListModelListener<T>> _listeners = new CopyOnWriteArrayList();
  
  public void addExpandableListModelListener(ExpandableListModelListener<T> listener)
  {
    if (listener != null) {
      _listeners.add(listener);
    }
  }
  
  public void removeExpandableListModelListener(ExpandableListModelListener<T> listener)
  {
    if (listener != null) {
      _listeners.remove(listener);
    }
  }
  
  protected void fireItemsChanged()
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        for (ExpandableListModelListener<T> listener : _listeners) {
          listener.itemsChanged();
        }
      }
    });
  }
  
  protected void fireItemAdded(T item, int index)
  {
    for (ExpandableListModelListener<T> listener : _listeners) {
      listener.itemAdded(item, index);
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AbstractExpandableListModel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

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

class AccordionListView$1
  extends MouseAdapter
{
  boolean wasClicking;
  
  AccordionListView$1(AccordionListView paramAccordionListView, CollapsiblePanel paramCollapsiblePanel) {}
  
  public void mouseExited(MouseEvent arg0)
  {
    wasClicking = false;
  }
  
  public void mousePressed(MouseEvent arg0)
  {
    wasClicking = true;
  }
  
  public void mouseReleased(MouseEvent arg0)
  {
    if (wasClicking) {
      AccordionListView.access$5(this$0, val$item.getUID(), false);
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AccordionListView.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

class AccordionListView$SwitchSelectionAnimation$1
  implements Runnable
{
  AccordionListView$SwitchSelectionAnimation$1(AccordionListView.SwitchSelectionAnimation paramSwitchSelectionAnimation) {}
  
  public void run()
  {
    AccordionListView tmp7_4 = AccordionListView.SwitchSelectionAnimation.access$2(this$1);AccordionListView.access$1(tmp7_4, AccordionListView.access$0(tmp7_4) + 15);
    double ratio = AccordionListView.access$0(AccordionListView.SwitchSelectionAnimation.access$2(this$1)) / 150.0D;
    if (ratio < 1.0D)
    {
      if (AccordionListView.SwitchSelectionAnimation.access$0(this$1) != null) {
        AccordionListView.SwitchSelectionAnimation.access$0(this$1).setExpandedAmount(1.0D - ratio);
      }
      if (AccordionListView.SwitchSelectionAnimation.access$1(this$1) != null) {
        AccordionListView.SwitchSelectionAnimation.access$1(this$1).setExpandedAmount(ratio);
      }
      AccordionListView.access$2(AccordionListView.SwitchSelectionAnimation.access$2(this$1)).schedule(this, 15L, TimeUnit.MILLISECONDS);
    }
    else
    {
      AccordionListView.access$3(AccordionListView.SwitchSelectionAnimation.access$2(this$1), false);
      if (AccordionListView.SwitchSelectionAnimation.access$0(this$1) != null) {
        AccordionListView.SwitchSelectionAnimation.access$0(this$1).setExpandedAmount(0.0D);
      }
      if (AccordionListView.SwitchSelectionAnimation.access$1(this$1) != null) {
        AccordionListView.SwitchSelectionAnimation.access$1(this$1).setExpandedAmount(1.0D);
      }
    }
    for (CollapsiblePanel accordion : AccordionListView.access$4(AccordionListView.SwitchSelectionAnimation.access$2(this$1))) {
      accordion.revalidate();
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AccordionListView.SwitchSelectionAnimation.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.swing.SwingUtilities;

class AccordionListView$SwitchSelectionAnimation
  implements Runnable
{
  private CollapsiblePanel _previous;
  private CollapsiblePanel _newlySelected;
  
  public AccordionListView$SwitchSelectionAnimation(AccordionListView paramAccordionListView, CollapsiblePanel previous, CollapsiblePanel newlySelected)
  {
    _previous = previous;
    _newlySelected = newlySelected;
  }
  
  public void run()
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        AccordionListView tmp7_4 = this$0;AccordionListView.access$1(tmp7_4, AccordionListView.access$0(tmp7_4) + 15);
        double ratio = AccordionListView.access$0(this$0) / 150.0D;
        if (ratio < 1.0D)
        {
          if (_previous != null) {
            _previous.setExpandedAmount(1.0D - ratio);
          }
          if (_newlySelected != null) {
            _newlySelected.setExpandedAmount(ratio);
          }
          AccordionListView.access$2(this$0).schedule(this, 15L, TimeUnit.MILLISECONDS);
        }
        else
        {
          AccordionListView.access$3(this$0, false);
          if (_previous != null) {
            _previous.setExpandedAmount(0.0D);
          }
          if (_newlySelected != null) {
            _newlySelected.setExpandedAmount(1.0D);
          }
        }
        for (CollapsiblePanel accordion : AccordionListView.access$4(this$0)) {
          accordion.revalidate();
        }
      }
    });
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AccordionListView.SwitchSelectionAnimation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class AccordionListView
  extends JPanel
{
  private static final int ANIMATION_NUM_STEPS = 10;
  private static final int ANIMATION_TOTAL_MILLIS = 150;
  private static final int ANIMATION_MILLIS_PER_STEP = 15;
  private ScheduledExecutorService _scheduler = Executors.newScheduledThreadPool(1);
  private List<CollapsiblePanel> _items = Collections.emptyList();
  private boolean _isSwitchingSelectedItem = false;
  private int _currentSelected = -1;
  private int _currentMillis = 0;
  private boolean _allowNoneSelected;
  
  public AccordionListView(List<CollapsiblePanel> items, boolean allowNoneSelected)
  {
    this(allowNoneSelected);
    setItems(items);
  }
  
  public AccordionListView(boolean allowNoneSelected)
  {
    _allowNoneSelected = allowNoneSelected;
    setLayout(new BoxLayout(this, 3));
  }
  
  public void setItems(List<CollapsiblePanel> items)
  {
    if ((_items != null) && (_items.size() > 0)) {
      for (CollapsiblePanel item : _items)
      {
        MouseListener[] arrayOfMouseListener;
        int j = (arrayOfMouseListener = item.getMouseListeners()).length;
        for (int i = 0; i < j; i++)
        {
          MouseListener listener = arrayOfMouseListener[i];
          item.removeMouseListener(listener);
        }
        remove(item);
      }
    }
    _items = new LinkedList(items);
    for (final CollapsiblePanel item : _items)
    {
      add(item);
      item.addMouseListener(new MouseAdapter()
      {
        boolean wasClicking;
        
        public void mouseExited(MouseEvent arg0)
        {
          wasClicking = false;
        }
        
        public void mousePressed(MouseEvent arg0)
        {
          wasClicking = true;
        }
        
        public void mouseReleased(MouseEvent arg0)
        {
          if (wasClicking) {
            AccordionListView.this.setSelected(item.getUID(), false);
          }
        }
      });
    }
    if ((!_allowNoneSelected) && (items.size() > 0)) {
      setSelected(((CollapsiblePanel)items.get(0)).getUID(), true);
    }
  }
  
  private void setSelected(String selected, boolean noAnimation)
  {
    if (!_isSwitchingSelectedItem)
    {
      int newSelectedId = -1;
      for (CollapsiblePanel item : _items)
      {
        newSelectedId++;
        if (item.getUID().equals(selected)) {
          break;
        }
      }
      int previousSelected = _currentSelected;
      _currentSelected = newSelectedId;
      if (previousSelected == newSelectedId) {
        if (_allowNoneSelected)
        {
          _currentSelected = -1;
          newSelectedId = -1;
        }
        else
        {
          return;
        }
      }
      CollapsiblePanel previous = null;
      if (previousSelected != -1)
      {
        previous = (CollapsiblePanel)_items.get(previousSelected);
        previous.setExpanding(false);
      }
      CollapsiblePanel newlySelected = null;
      if (newSelectedId != -1)
      {
        newlySelected = (CollapsiblePanel)_items.get(newSelectedId);
        newlySelected.setExpanding(true);
      }
      _currentMillis = 0;
      if (noAnimation)
      {
        if (previous != null) {
          previous.setExpandedAmount(0.0D);
        }
        if (newlySelected != null) {
          newlySelected.setExpandedAmount(1.0D);
        }
        for (CollapsiblePanel accordion : _items) {
          accordion.revalidate();
        }
      }
      else
      {
        _isSwitchingSelectedItem = true;
        _scheduler.schedule(new SwitchSelectionAnimation(previous, newlySelected), 15L, 
        
          TimeUnit.MILLISECONDS);
      }
    }
  }
  
  private class SwitchSelectionAnimation
    implements Runnable
  {
    private CollapsiblePanel _previous;
    private CollapsiblePanel _newlySelected;
    
    public SwitchSelectionAnimation(CollapsiblePanel previous, CollapsiblePanel newlySelected)
    {
      _previous = previous;
      _newlySelected = newlySelected;
    }
    
    public void run()
    {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          _currentMillis += 15;
          double ratio = _currentMillis / 150.0D;
          if (ratio < 1.0D)
          {
            if (_previous != null) {
              _previous.setExpandedAmount(1.0D - ratio);
            }
            if (_newlySelected != null) {
              _newlySelected.setExpandedAmount(ratio);
            }
            _scheduler.schedule(this, 15L, TimeUnit.MILLISECONDS);
          }
          else
          {
            _isSwitchingSelectedItem = false;
            if (_previous != null) {
              _previous.setExpandedAmount(0.0D);
            }
            if (_newlySelected != null) {
              _newlySelected.setExpandedAmount(1.0D);
            }
          }
          for (CollapsiblePanel accordion : _items) {
            accordion.revalidate();
          }
        }
      });
    }
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AccordionListView
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.util.TimerTask;

class AlphaJLabel$1
  extends TimerTask
{
  AlphaJLabel$1(AlphaJLabel paramAlphaJLabel) {}
  
  public void run()
  {
    this$0.fadeIn();
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AlphaJLabel.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import javax.swing.JLabel;
import org.jdesktop.core.animation.timing.Animator;
import org.jdesktop.core.animation.timing.Animator.Builder;
import org.jdesktop.core.animation.timing.PropertySetter;

public class AlphaJLabel
  extends JLabel
{
  private static final long serialVersionUID = 1539409202545855600L;
  private static final int FADE_DURATION_MS = 500;
  private final Animator _animator;
  private float _alpha = 1.0F;
  private boolean _alreadyHidden = true;
  
  public AlphaJLabel(String label, int alignment, boolean useWorkaround)
  {
    super(label, alignment);
    float maxAlpha = useWorkaround ? 0.999F : 1.0F;
    _animator = new Animator.Builder().addTarget(PropertySetter.getTarget(this, "alpha", new Float[] { Float.valueOf(0.0F), Float.valueOf(maxAlpha) }))
      .setDuration(500L, TimeUnit.MILLISECONDS).build();
    setAlpha(0.0F);
  }
  
  protected void paintComponent(Graphics g)
  {
    Graphics2D g2 = (Graphics2D)g.create();
    g2.setComposite(AlphaComposite.getInstance(3, _alpha));
    super.paintComponent(g2);
    g2.dispose();
  }
  
  public void setAlpha(float alpha)
  {
    _alpha = alpha;
    repaint();
  }
  
  public float getAlpha()
  {
    return _alpha;
  }
  
  public void fadeIn(int delay)
  {
    new Timer().schedule(new TimerTask()
    {
      public void run()
      {
        fadeIn();
      }
    }, delay);
  }
  
  public void fadeIn()
  {
    if (_animator.isRunning()) {
      _animator.restart();
    } else {
      _animator.start();
    }
    _alreadyHidden = false;
  }
  
  public void fadeOut()
  {
    if ((!_alreadyHidden) && (!_animator.reverseNow())) {
      _animator.restartReverse();
    }
    _alreadyHidden = true;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AlphaJLabel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import org.jdesktop.core.animation.timing.Interpolator;

public class AnticipateOvershootInterpolator
  implements Interpolator
{
  private final double mTension;
  
  public AnticipateOvershootInterpolator()
  {
    mTension = 3.0D;
  }
  
  public double interpolate(double v)
  {
    if (v < 0.5D) {
      return 0.5D * a(v * 2.0D, mTension);
    }
    return 0.5D * (o(v * 2.0D - 2.0D, mTension) + 2.0D);
  }
  
  private static double a(double t, double s)
  {
    return t * t * ((s + 1.0D) * t - s);
  }
  
  private static double o(double t, double s)
  {
    return t * t * ((s + 1.0D) * t + s);
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AnticipateOvershootInterpolator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class AppIconNameLabel
  extends JLabel
{
  private static final Font FONT_APP_NAME = UiUtils.createFont("Lucida Grande", 13, 0);
  private static final int PADDING_X = 10;
  private JLabel _appIconLabel;
  private JLabel _appBundleID;
  private JLabel _appName;
  
  public AppIconNameLabel()
  {
    _appIconLabel = new JLabel();
    _appIconLabel.setBounds(35, 28, 42, 42);
    _appIconLabel.setVerticalTextPosition(0);
    _appIconLabel.setHorizontalTextPosition(0);
    add(_appIconLabel);
    
    _appName = new JLabel();
    _appName.setFont(FONT_APP_NAME);
    _appName.setForeground(UiUtils.COLOR_TEXT_PRIMARY);
    _appName.setLocation(87, 28);
    
    _appName.setText("No app selected");
    _appName.setSize(300 - _appName.getLocation().x, _appName.getPreferredSize().height);
    add(_appName);
    
    _appBundleID = new JLabel();
    _appBundleID.setFont(FONT_APP_NAME);
    _appBundleID.setForeground(UiUtils.COLOR_TEXT_SECONDARY);
    _appBundleID.setLocation(87, 48);
    
    _appBundleID.setText("Select an app");
    _appBundleID.setSize(300 - _appBundleID.getLocation().x, _appBundleID.getPreferredSize().height);
    add(_appBundleID);
    
    setSize(300, 42 + _appName.getSize().height + _appBundleID.getSize().height);
  }
  
  public JLabel getAppIconLabel()
  {
    return _appIconLabel;
  }
  
  public void setAppIcon(ImageIcon icon)
  {
    _appIconLabel.setIcon(icon);
  }
  
  public void setNameText(String name)
  {
    _appName.setText(name);
  }
  
  public void setBundleIDText(String bundleID)
  {
    _appBundleID.setText(bundleID);
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AppIconNameLabel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import com.crashlytics.api.App;

public abstract interface AppSelectionListener
{
  public abstract void onAppClick(App paramApp);
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AppSelectionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import com.crashlytics.api.App;
import com.crashlytics.tools.ide.app.AppOrgTable.AppElement;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.JViewport;
import javax.swing.ListSelectionModel;

public abstract class AppTableSelectionListener
  extends MouseAdapter
  implements AppSelectionListener
{
  private JTable _table;
  private JComponent _header;
  private JViewport _view;
  
  public AppTableSelectionListener(JTable table, JComponent header, JViewport view)
  {
    _table = table;
    _header = header;
    _view = view;
  }
  
  public void mousePressed(MouseEvent e)
  {
    int rowAtPoint = _table.rowAtPoint(e.getPoint());
    Object o = _table.getValueAt(rowAtPoint, 0);
    if ((o instanceof AppOrgTable.AppElement)) {
      _table.getSelectionModel().setSelectionInterval(rowAtPoint, rowAtPoint);
    }
  }
  
  public void mouseReleased(MouseEvent e)
  {
    if (getPointy > _header.getHeight() + _view.getViewPosition().y)
    {
      int rowAtPoint = _table.rowAtPoint(e.getPoint());
      if ((rowAtPoint != -1) && (rowAtPoint == _table.getSelectedRow()))
      {
        Object o = _table.getValueAt(rowAtPoint, 0);
        if ((o instanceof AppOrgTable.AppElement))
        {
          App app = ((AppOrgTable.AppElement)o).getApp();
          onAppClick(app);
        }
      }
    }
  }
  
  public abstract void onAppClick(App paramApp);
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.AppTableSelectionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing.borders;

import com.crashlytics.swing.UiUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.border.AbstractBorder;

public class ElevatedBorder
  extends AbstractBorder
{
  private static final Color COLOR_MENU_BLACK = UiUtils.alphaColor(Color.BLACK, 200);
  private static final Color COLOR_MENU_GRAY = UiUtils.alphaColor(Color.GRAY, 50);
  
  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
  {
    super.paintBorder(c, g, x, y, width, height);
    
    g.setColor(COLOR_MENU_BLACK);
    g.drawLine(x + 1, y + height - 2, x + width - 2, y + height - 2);
    g.setColor(COLOR_MENU_GRAY);
    g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
    
    g.setColor(COLOR_MENU_BLACK);
    g.drawLine(x + 1, y + 1, x + 1, y + height - 2);
    g.setColor(COLOR_MENU_GRAY);
    g.drawLine(x, y, x, y + height - 1);
    
    g.setColor(COLOR_MENU_BLACK);
    g.drawLine(x + width - 2, y + 1, x + width - 2, y + height - 2);
    g.setColor(COLOR_MENU_GRAY);
    g.drawLine(x + width - 1, y, x + width - 1, y + height - 1);
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.borders.ElevatedBorder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing.borders;

import com.crashlytics.swing.UiUtils;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.border.AbstractBorder;

public class RowBorder
  extends AbstractBorder
{
  private static final Color COLOR_MENU_BLACK = UiUtils.alphaColor(Color.BLACK, 200);
  private static final Color COLOR_MENU_GRAY = UiUtils.alphaColor(Color.GRAY, 50);
  
  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
  {
    super.paintBorder(c, g, x, y, width, height);
    g.setColor(COLOR_MENU_BLACK);
    g.drawLine(x, y + height - 2, x + width - 1, y + height - 2);
    g.setColor(COLOR_MENU_GRAY);
    g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.borders.RowBorder
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import com.crashlytics.tools.ide.app.Resources;
import java.awt.image.BufferedImage;
import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToggleButtonUI;

public class CircleCheckboxUi
  extends BasicToggleButtonUI
{
  public static ComponentUI createUI(JComponent c)
  {
    return new CircleCheckboxUi();
  }
  
  private static final BufferedImage DEFAULT_IMAGE = Resources.createImage("resources/controls/control.circle.checkbox.normal.png");
  private static final BufferedImage SELECTED_IMAGE = Resources.createImage("resources/controls/control.circle.checkbox.selected.png");
  private static final ImageIcon DEFAULT_ICON = new ImageIcon(DEFAULT_IMAGE);
  private static final ImageIcon SELECTED_ICON = new ImageIcon(SELECTED_IMAGE);
  private boolean _oldOpaque;
  private boolean _oldBorderPainted;
  private boolean _oldContentAreaFilled;
  private Icon _oldIcon;
  private Icon _oldSelectedIcon;
  private int _oldIconTextGap;
  private int _oldHorizontalAlignment;
  
  public void installUI(JComponent c)
  {
    super.installUI(c);
    
    AbstractButton button = (AbstractButton)c;
    
    _oldOpaque = button.isOpaque();
    _oldBorderPainted = button.isBorderPainted();
    _oldContentAreaFilled = button.isContentAreaFilled();
    
    _oldIcon = button.getIcon();
    _oldSelectedIcon = button.getSelectedIcon();
    
    _oldIconTextGap = button.getIconTextGap();
    _oldHorizontalAlignment = button.getHorizontalAlignment();
    
    button.setOpaque(false);
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
    
    button.setIcon(DEFAULT_ICON);
    button.setSelectedIcon(SELECTED_ICON);
    
    button.setIconTextGap(0);
    button.setHorizontalAlignment(0);
  }
  
  public void uninstallUI(JComponent c)
  {
    AbstractButton button = (AbstractButton)c;
    
    button.setOpaque(_oldOpaque);
    button.setBorderPainted(_oldBorderPainted);
    button.setContentAreaFilled(_oldContentAreaFilled);
    
    button.setIcon(_oldIcon);
    button.setSelectedIcon(_oldSelectedIcon);
    
    button.setIconTextGap(_oldIconTextGap);
    button.setHorizontalAlignment(_oldHorizontalAlignment);
    
    super.uninstallUI(c);
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.CircleCheckboxUi
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import com.crashlytics.tools.android.onboard.CodeChange;
import com.crashlytics.tools.ide.app.AppTable;
import com.crashlytics.tools.ide.app.Resources;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class CodePanelFactory
{
  private static final Font INSTRUCTION_FONT = UiUtils.createSystemFont(11, 1);
  private static final int CODE_PANE_SIZE = 300;
  public static final BufferedImage ACCORDION_EXPANDED = Resources.createImage("resources/controls/control.accordion.header.expanded.png");
  public static final BufferedImage ACCORDION_CONTRACTED = Resources.createImage("resources/controls/control.accordion.header.collapsed.png");
  public static final BufferedImage ARROW_WEST = Resources.createImage("resources/controls/control.arrow.west.png");
  public static final BufferedImage ARROW_SOUTH = Resources.createImage("resources/controls/control.arrow.south.png");
  
  public static CollapsiblePanel create(CodeChange changes)
    throws IOException
  {
    BufferedImage backgroundImage = AppTable.IMG_TABLE_BG;
    return create(changes.getPrettyTitle(), changes, INSTRUCTION_FONT, backgroundImage, 300);
  }
  
  public static CollapsiblePanel createWithJustText(String title, String contents)
  {
    BufferedImage backgroundImage = AppTable.IMG_TABLE_BG;
    
    ScrollableCodePane codePane = createCodePane(backgroundImage, 300);
    codePane.setContent(contents);
    JLabel collapsedLabel = createCollapsedLabel(title);
    JLabel expandedLabel = createExpandedLabel(title);
    return new CollapsiblePanel(collapsedLabel, expandedLabel, codePane);
  }
  
  private static CollapsiblePanel create(String title, CodeChange changes, Font font, BufferedImage backgroundImage, int codePaneSize)
    throws IOException
  {
    ScrollableCodePane codePane = createCodePane(backgroundImage, codePaneSize);
    codePane.setContent(changes);
    JLabel collapsedLabel = createCollapsedLabel(title);
    JLabel expandedLabel = createExpandedLabel(title);
    return new CollapsiblePanel(collapsedLabel, expandedLabel, codePane);
  }
  
  private static JLabel createCollapsedLabel(String title)
  {
    return createLabel(new ImageIcon(ACCORDION_CONTRACTED), String.format("<html>%s</html>", new Object[] { title }), 
      new ImageIcon(ARROW_WEST), UiUtils.COLOR_TEXT_SECONDARY);
  }
  
  private static JLabel createExpandedLabel(String title)
  {
    return createLabel(new ImageIcon(ACCORDION_EXPANDED), String.format("<html><b>%s</b></html>", new Object[] { title }), 
      new ImageIcon(ARROW_SOUTH), UiUtils.COLOR_TEXT_PRIMARY);
  }
  
  private static ScrollableCodePane createCodePane(BufferedImage backgroundImage, int codePaneSize)
  {
    ScrollableCodePane codePane = new ScrollableCodePane();
    
    codePane.setMinimumSize(new Dimension(0, codePaneSize));
    
    codePane.setBackgroundImage(backgroundImage);
    codePane.setBorder(BorderFactory.createEtchedBorder(1, Color.DARK_GRAY, Color.BLACK));
    return codePane;
  }
  
  private static JLabel createLabel(ImageIcon backgroundIcon, String format, ImageIcon rightAlignedIcon, Color textColor)
  {
    JLabel imageLayer = new JLabel(backgroundIcon);
    imageLayer.setLayout(new BoxLayout(imageLayer, 0));
    JLabel text = new JLabel();
    text.setLayout(new BorderLayout());
    JLabel icon = new JLabel(rightAlignedIcon);
    text.add(icon, "East");
    text.setForeground(textColor);
    text.setAlignmentX(0.0F);
    text.setText(format);
    imageLayer.add(Box.createRigidArea(new Dimension(10, 0)));
    imageLayer.add(text);
    return imageLayer;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.CodePanelFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.UUID;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;

public class CollapsiblePanel
  extends JPanel
{
  private final int _labelHeight;
  private final int _contentExpandedHeight;
  private final JComponent _contents;
  private final JComponent _collapsedLabel;
  private final JComponent _expandedLabel;
  private final String _uid;
  private JComponent _currentLabel;
  
  public CollapsiblePanel(JComponent collapsedLabel, JComponent expandedLabel, JComponent contentPane)
  {
    setLayout(new BoxLayout(this, 3));
    _collapsedLabel = collapsedLabel;
    _expandedLabel = expandedLabel;
    _currentLabel = collapsedLabel;
    _uid = UUID.randomUUID().toString();
    
    JPanel contentContainer = new JPanel();
    contentContainer.setLayout(new BorderLayout());
    contentContainer.add(contentPane);
    _contents = contentContainer;
    _contentExpandedHeight = getMinimumSizeheight;
    _labelHeight = getPreferredSizeheight;
    setMinimumSize(new Dimension(Integer.MAX_VALUE, _labelHeight));
    setMaximumSize(new Dimension(Integer.MAX_VALUE, _labelHeight));
    setPreferredSize(new Dimension(Integer.MAX_VALUE, _labelHeight));
    
    add(_collapsedLabel);
    add(_expandedLabel);
    add(_contents);
    setExpanding(false);
  }
  
  public void setExpanding(boolean expandingState)
  {
    if (expandingState)
    {
      _currentLabel.setVisible(false);
      _currentLabel = _expandedLabel;
      _currentLabel.setVisible(true);
    }
    else
    {
      _currentLabel.setVisible(false);
      _currentLabel = _collapsedLabel;
      _currentLabel.setVisible(true);
    }
  }
  
  public void setExpandedAmount(double contentVisibilityRatio)
  {
    int newHeight = (int)(_labelHeight + _contentExpandedHeight * contentVisibilityRatio);
    setMaximumSize(new Dimension(getMaximumSizewidth, newHeight));
    setPreferredSize(new Dimension(getPreferredSizewidth, newHeight));
  }
  
  public void setMinimumSize(Dimension dim)
  {
    super.setMinimumSize(dim);
    _expandedLabel.setMinimumSize(dim);
    _collapsedLabel.setMinimumSize(dim);
    _contents.setMinimumSize(new Dimension(0, 0));
  }
  
  public void setMaximumSize(Dimension dim)
  {
    super.setMaximumSize(dim);
    int labelHeight = Math.min(height, _labelHeight);
    int textVisibleHeight = Math.max(0, height - labelHeight);
    _expandedLabel.setMaximumSize(new Dimension(width, labelHeight));
    _collapsedLabel.setMaximumSize(new Dimension(width, labelHeight));
    _contents.setMaximumSize(new Dimension(width, textVisibleHeight));
  }
  
  public void setPreferredSize(Dimension dim)
  {
    super.setPreferredSize(dim);
    int labelHeight = Math.min(height, _labelHeight);
    int textVisibleHeight = Math.max(0, height - labelHeight);
    _expandedLabel.setPreferredSize(new Dimension(width, labelHeight));
    _collapsedLabel.setPreferredSize(new Dimension(width, labelHeight));
    _contents.setPreferredSize(new Dimension(width, textVisibleHeight));
  }
  
  public String getUID()
  {
    return _uid;
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.CollapsiblePanel
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import javax.swing.JProgressBar;
import org.jdesktop.core.animation.timing.Animator;
import org.jdesktop.core.animation.timing.TimingTargetAdapter;

class CustomProgressBarUi$1
  extends TimingTargetAdapter
{
  CustomProgressBarUi$1(CustomProgressBarUi paramCustomProgressBarUi, JProgressBar paramJProgressBar) {}
  
  public void timingEvent(Animator source, double fraction)
  {
    CustomProgressBarUi.access$0(this$0, 5.0D * fraction);
    val$bar.repaint();
  }
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.CustomProgressBarUi.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import org.jdesktop.core.animation.timing.Animator;

class CustomProgressBarUi$2
  implements AncestorListener
{
  CustomProgressBarUi$2(CustomProgressBarUi paramCustomProgressBarUi) {}
  
  public void ancestorRemoved(AncestorEvent e)
  {
    if (CustomProgressBarUi.access$1(this$0).isRunning()) {
      CustomProgressBarUi.access$2(this$0);
    }
  }
  
  public void ancestorAdded(AncestorEvent event) {}
  
  public void ancestorMoved(AncestorEvent event) {}
}

/* Location:
 * Qualified Name:     com.crashlytics.swing.CustomProgressBarUi.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.crashlytics.swing;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Composite;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.util.concurrent.TimeUnit;
import javax.swing.BoundedRangeModel;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ProgressBarUI;
import org.jdesktop.core.animation.timing.Animator;
import org.jdesktop.core.animation.timing.Animator.Builder;
import org.jdesktop.core.animation.timing.Animator.RepeatBehavior;
import org.jdesktop.core.animation.timing.TimingSource;
import org.jdesktop.core.animation.timing.TimingTarget;
import org.jdesktop.core.animation.timing.TimingTargetAdapter;
import org.jdesktop.core.animation.timing.interpolators.AccelerationInterpolator;
import org.jdesktop.swing.animation.timing.sources.SwingTimerTimingSource;

public class CustomProgressBarUi
  extends ProgressBarUI
{
  private static final TimingSource TIMING_SOURCE = new SwingTimerTimingSource();
  private static final float BAR_BG_OPACITY = 0.25F;
  private static final int BAR_VERTICAL_OFFSET = 5;
  
  static
  {
    TIMING_SOURCE.init();
  }
  
  private static final Color BAR_VALUE_TOP_COLOR = new Color(5556467);
  private static final Color BAR_VALUE_BOTTOM_COLOR = new Color(1945322);
  private static final Color TRANSPARENT_GLOW_COLOR = new Color(BAR_VALUE_TOP_COLOR.getRed(), 
    BAR_VALUE_TOP_COLOR.getGreen(), 
    BAR_VALUE_TOP_COLOR.getBlue(), 10);
  private static final Color OPAQUE_GLOW_COLOR = new Color(BAR_VALUE_TOP_COLOR.getRed(), 
    BAR_VALUE_TOP_COLOR.getGreen(), 
    BAR_VALUE_TOP_COLOR.getBlue(), 110);
  private static final int VALUE_BAR_TRACK_OFFSET = 1;
  private static final int VALUE_BAR_SHADOW_OFFSET = 1;
  private AncestorListener _removalListener;
  private boolean _oldOpaque;
  private Animator _animator;
  private double _glowOffset = 5.0D;
  
  public static ComponentUI createUI(JComponent c)
  {
    return new CustomProgressBarUi();
  }
  
  public void installUI(JComponent c)
  {
    super.installUI(c);
    
    final JProgressBar bar = (JProgressBar)c;
    
    TimingTarget target = new TimingTargetAdapter()
    {
      public void timingEvent(Animator source, double fraction)
      {
        _glowOffset = (5.0D * fraction);
        bar.repaint();
      }
    };
    _animator = new Animator.Builder(TIMING_SOURCE).addTarget(target).setDuration(500L, TimeUnit.MILLISECONDS)
      .setInterpolator(new AccelerationInterpolator(0.8500000238418579D, 0.14900000393390656D))
      .setRepeatBehavior(Animator.RepeatBehavior.REVERSE)
      .setRepeatCount(-1L).build();
    
    _oldOpaque = bar.isOpaque();
    
    bar.setOpaque(false);
    
    _removalListener = new AncestorListener()
    {
      public void ancestorRemoved(AncestorEvent e)
      {
        if (_animator.isRunning()) {
          CustomProgressBarUi.this.stopAnimator();
        }
      }
      
      public void ancestorAdded(AncestorEvent event) {}
      
      public void ancestorMoved(AncestorEvent event) {}
    };
    bar.addAncestorListener(_removalListener);
  }
  
  public void uninstallUI(JComponent c)
  {
    JProgressBar bar = (JProgressBar)c;
    bar.removeAncestorListener(_removalListener);
    bar.setOpaque(_oldOpaque);
    
    stopAnimator();
    
    super.uninstallUI(c);
  }
  
  public void paint(Graphics g, JComponent c)
  {
    JProgressBar bar = (JProgressBar)c;
    
    Graphics2D g2d = (Graphics2D)g.create();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    
    drawBarBackground(g2d, bar);
    drawBarTopBorder(g2d, bar);
    drawBarBottomBorder(g2d, bar);
    
    BoundedRangeModel model = bar.getModel();
    if (model.getValue() > model.getMinimum())
    {
      drawValueBarGlow(g2d, bar);
      drawValueBar(g2d, bar);
      if (!_animator.isRunning()) {
        _animator.start();
      }
    }
    else if (_animator.isRunning())
    {
      stopAnimator();
    }
    g2d.dispose();
  }
  
  private void stopAnimator()
  {
    _animator.stop();
    _glowOffset = 5.0D;
  }
  
  private void drawBarBackground(Graphics2D g2d, JProgressBar bar)
  {
    Composite oldComposite = g2d.getComposite();
    
    g2d.setComposite(AlphaComposite.getInstance(3, 0.25F));
    g2d.setColor(Color.WHITE);
    
    g2d.fillRoundRect(0, 5, baseWidthFor(bar), barHeightFor(bar), cornerRadiusFor(bar), cornerRadiusFor(bar));
    
    g2d.setComposite(oldComposite);
  }
  
  private void drawBarTopBorder(Graphics2D g2d, JProgressBar bar)
  {
    Shape oldClip = g2d.getClip();
    
    g2d.setClip(getTopHalfOf(bar));
    g2d.setColor(Color.BLACK);
    g2d.drawRoundRect(0, 5, baseWidthFor(bar), barHeightFor(bar), cornerRadiusFor(bar), cornerRadiusFor(bar));
    
    g2d.setClip(oldClip);
  }
  
  private void drawBarBottomBorder(Graphics2D g2d, JProgressBar bar)
  {
    Shape oldClip = g2d.getClip();
    
    g2d.setClip(getBottomHalfOf(bar));
    
    Point2D gradientStartPoint = new Point2D.Double(0.0D, bar.getHeight() / 2 - cornerRadiusFor(bar) / 2);
    Point2D gradientEndPoint = new Point2D.Double(0.0D, bar.getHeight() - cornerRadiusFor(bar));
    g2d.setPaint(new GradientPaint(gradientStartPoint, Color.BLACK, gradientEndPoint, Color.GRAY));
    
    g2d.drawRoundRect(0, 5, baseWidthFor(bar), barHeightFor(bar), cornerRadiusFor(bar), cornerRadiusFor(bar));
    
    g2d.setClip(oldClip);
  }
  
  private void drawValueBarGlow(Graphics2D g2d, JProgressBar bar)
  {
    g2d.setColor(BAR_VALUE_TOP_COLOR);
    
    int glowY = (int)_glowOffset;
    int glowWidth = valueBarWidthFor(bar, 1) + 2;
    int glowHeight = baseHeightFor(bar) - (int)(2.0D * _glowOffset);
    int cornerRadius = cornerRadiusFor(bar) * 3;
    
    Point2D gradientStartPoint = new Point2D.Double(0.0D, glowY);
    Point2D gradientEndPoint = new Point2D.Double(0.0D, bar.getHeight() / 2);
    g2d.setPaint(new GradientPaint(gradientStartPoint, TRANSPARENT_GLOW_COLOR, gradientEndPoint, OPAQUE_GLOW_COLOR, true));
    g2d.fillRoundRect(0, glowY, glowWidth, glowHeight, cornerRadius, cornerRadius);
  }
  
  private void drawValueBar(Graphics2D g2d, JProgressBar bar)
  {
    Shape oldClip = g2d.getClip();
    
    int valueBarWidth = valueBarWidthFor(bar, 1);
    int valueBarHeight = barHeightFor(bar) - 1 - 1;
    int cornerRadius = cornerRadiusFor(bar);
    
    g2d.setColor(Color.BLACK);
    g2d.drawRoundRect(1, 6, valueBarWidth, valueBarHeight, cornerRadius, cornerRadius);
    
    g2d.setClip(getTopHalfOf(bar));
    g2d.setColor(BAR_VALUE_TOP_COLOR);
    g2d.fillRoundRect(1, 6, valueBarWidth, valueBarHeight, cornerRadius, cornerRadius);
    
    g2d.setClip(getBottomHalfOf(bar));
    g2d.setColor(BAR_VALUE_BOTTOM_COLOR);
    g2d.fillRoundRect(1, 6, valueBarWidth, valueBarHeight, cornerRadius, cornerRadius);
    
    g2d.setClip(oldClip);
  }
  
  private int valueBarWidthFor(JProgressBar bar, int trackOffset)
  {
    return (int)(baseWidthFor(bar) * getProgressRatioFor(bar)) - trackOffset;
  }
  
  private int baseWidthFor(JProgressBar bar)
  {
    return bar.getWidth() - 1;
  }
  
  private int baseHeightFor(JProgressBar bar)
  {
    return bar.getHeight() - 1;
  }
  
  private int barHeightFor(JProgressBar bar)
  {
    retu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

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