com-sun-tools-visualvm-charts

16:33:45.200 INFO  jd.cli.Main - Decompiling com-sun-tools-visualvm-charts.jar
package com.sun.tools.visualvm.charts;

public final class ChartFactory
{
  public static SimpleXYChartSupport createSimpleXYChart(SimpleXYChartDescriptor descriptor)
  {
    return new SimpleXYChartSupport(descriptor.getChartTitle(), descriptor.getXAxisDescription(), descriptor.getYAxisDescription(), descriptor.getChartType(), descriptor.getInitialYMargin(), descriptor.getItemNames(), descriptor.getItemColors(), descriptor.getLineWidths(), descriptor.getLineColors(), descriptor.getFillColors1(), descriptor.getFillColors2(), descriptor.getMinValue(), descriptor.getMaxValue(), descriptor.getChartFactor(), descriptor.areItemsHideable(), descriptor.getValuesBuffer(), descriptor.getDetailsItems());
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.ChartFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

import java.awt.Color;

final class ColorFactory
{
  private static final Color[] PREDEFINED_COLORS = { new Color(241, 154, 42), new Color(32, 171, 217), new Color(144, 97, 207), new Color(158, 156, 0) };
  private static final Color[][] PREDEFINED_GRADIENTS = { { new Color(245, 204, 152), new Color(255, 243, 226) }, { new Color(151, 223, 246), new Color(227, 248, 255) }, { new Color(200, 163, 248), new Color(242, 232, 255) }, { new Color(212, 211, 131), new Color(244, 243, 217) } };
  
  public static int getPredefinedColorsCount()
  {
    return PREDEFINED_COLORS.length;
  }
  
  public static Color getPredefinedColor(int index)
  {
    return PREDEFINED_COLORS[index];
  }
  
  public static int getPredefinedGradientsCount()
  {
    return PREDEFINED_GRADIENTS.length;
  }
  
  public static Color[] getPredefinedGradient(int index)
  {
    return PREDEFINED_GRADIENTS[index];
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.ColorFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

public final class SimpleXYChartDescriptor
{
  private final int chartType;
  private final long minValue;
  private final long maxValue;
  private final long initialYMargin;
  private final boolean hideableItems;
  private final double chartFactor;
  private final int valuesBuffer;
  
  public static SimpleXYChartDescriptor decimal(long initialYMargin, boolean hideableItems, int valuesBuffer)
  {
    return decimal(initialYMargin, 1.0D, hideableItems, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor decimal(long initialYMargin, double chartFactor, boolean hideableItems, int valuesBuffer)
  {
    return decimal(0L, Long.MIN_VALUE, initialYMargin, chartFactor, hideableItems, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor decimal(long minValue, long maxValue, long initialYMargin, double chartFactor, boolean hideableItems, int valuesBuffer)
  {
    return new SimpleXYChartDescriptor(0, minValue, maxValue, initialYMargin, hideableItems, chartFactor, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor bytes(long initialYMargin, boolean hideableItems, int valuesBuffer)
  {
    return bytes(0L, Long.MIN_VALUE, initialYMargin, hideableItems, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor bytes(long minValue, long maxValue, long initialYMargin, boolean hideableItems, int valuesBuffer)
  {
    return new SimpleXYChartDescriptor(1, minValue, maxValue, initialYMargin, hideableItems, 1.0D, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor percent(boolean hideableItems, int valuesBuffer)
  {
    return percent(hideableItems, 1.0D, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor percent(boolean hideableItems, double chartFactor, int valuesBuffer)
  {
    return percent(0L, 100L, 100L, hideableItems, chartFactor, valuesBuffer);
  }
  
  public static SimpleXYChartDescriptor percent(long minValue, long maxValue, long initialYMargin, boolean hideableItems, double chartFactor, int valuesBuffer)
  {
    long max = Math.ceil(maxValue / chartFactor);
    long init = Math.ceil(initialYMargin / chartFactor);
    return new SimpleXYChartDescriptor(2, minValue, max, init, hideableItems, chartFactor, valuesBuffer);
  }
  
  public void addLineItems(String... itemNames)
  {
    for (String itemName : itemNames)
    {
      Color color = getNextItemColor();
      addItem(itemName, color, 2.0F, color, null, null);
    }
  }
  
  public void addFillItems(String... itemNames)
  {
    for (String itemName : itemNames)
    {
      Color[] gradients = getNextItemGradient();
      addItem(itemName, gradients[0], 2.0F, null, gradients[0], gradients[1]);
    }
  }
  
  public void addLineFillItems(String... itemNames)
  {
    for (String itemName : itemNames)
    {
      Color color = getNextItemColor();
      Color[] gradients = getNextItemGradient();
      addItem(itemName, color, 2.0F, color, gradients[0], gradients[1]);
    }
  }
  
  public void addItem(String itemName, Color itemColor, float lineWidth, Color lineColor, Color fillColor1, Color fillColor2)
  {
    itemNames.add(itemName);
    itemColors.add(itemColor);
    lineWidths.add(Float.valueOf(lineWidth));
    lineColors.add(lineColor);
    fillColors1.add(fillColor1);
    fillColors2.add(fillColor2);
  }
  
  private Color getNextItemColor()
  {
    int newItemIndex = itemNames.size();
    int colorsCount = ColorFactory.getPredefinedColorsCount();
    Color color = null;
    if (newItemIndex >= colorsCount)
    {
      color = ColorFactory.getPredefinedColor(newItemIndex % colorsCount);
      int darkerFactor = newItemIndex / colorsCount;
      while (darkerFactor-- > 0) {
        color = color.darker();
      }
    }
    else
    {
      color = ColorFactory.getPredefinedColor(newItemIndex);
    }
    return color;
  }
  
  private Color[] getNextItemGradient()
  {
    int newItemIndex = itemNames.size();
    int colorsCount = ColorFactory.getPredefinedColorsCount();
    Color[] color = null;
    if (newItemIndex >= colorsCount)
    {
      color = ColorFactory.getPredefinedGradient(newItemIndex % colorsCount);
      int darkerFactor = newItemIndex / colorsCount;
      while (darkerFactor-- > 0)
      {
        color[0] = color[0].darker();
        color[1] = color[1].darker();
      }
    }
    else
    {
      color = ColorFactory.getPredefinedGradient(newItemIndex);
    }
    return color;
  }
  
  public void setDetailsItems(String[] detailNames)
  {
    this.detailNames = (detailNames != null ? (String[])detailNames.clone() : null);
  }
  
  public void setChartTitle(String chartTitle)
  {
    this.chartTitle = chartTitle;
  }
  
  public void setXAxisDescription(String xAxisDescription)
  {
    this.xAxisDescription = xAxisDescription;
  }
  
  public void setYAxisDescription(String yAxisDescription)
  {
    this.yAxisDescription = yAxisDescription;
  }
  
  int getChartType()
  {
    return chartType;
  }
  
  long getMinValue()
  {
    return minValue;
  }
  
  long getMaxValue()
  {
    return maxValue;
  }
  
  long getInitialYMargin()
  {
    return initialYMargin;
  }
  
  boolean areItemsHideable()
  {
    return hideableItems;
  }
  
  double getChartFactor()
  {
    return chartFactor;
  }
  
  int getValuesBuffer()
  {
    return valuesBuffer;
  }
  
  String[] getItemNames()
  {
    return (String[])itemNames.toArray(new String[itemNames.size()]);
  }
  
  Color[] getItemColors()
  {
    return (Color[])itemColors.toArray(new Color[itemColors.size()]);
  }
  
  float[] getLineWidths()
  {
    if (lineWidths.isEmpty()) {
      return null;
    }
    float[] floats = new float[lineWidths.size()];
    for (int i = 0; i < floats.length; i++) {
      floats[i] = ((Float)lineWidths.get(i)).floatValue();
    }
    return floats;
  }
  
  Color[] getLineColors()
  {
    return lineColors.isEmpty() ? null : (Color[])lineColors.toArray(new Color[lineColors.size()]);
  }
  
  Color[] getFillColors1()
  {
    return fillColors1.isEmpty() ? null : (Color[])fillColors1.toArray(new Color[fillColors1.size()]);
  }
  
  Color[] getFillColors2()
  {
    return fillColors2.isEmpty() ? null : (Color[])fillColors2.toArray(new Color[fillColors2.size()]);
  }
  
  String[] getDetailsItems()
  {
    return detailNames;
  }
  
  String getChartTitle()
  {
    return chartTitle;
  }
  
  String getXAxisDescription()
  {
    return xAxisDescription;
  }
  
  String getYAxisDescription()
  {
    return yAxisDescription;
  }
  
  private final List<String> itemNames = new ArrayList();
  private final List<Color> itemColors = new ArrayList();
  private final List<Float> lineWidths = new ArrayList();
  private final List<Color> lineColors = new ArrayList();
  private final List<Color> fillColors1 = new ArrayList();
  private final List<Color> fillColors2 = new ArrayList();
  private String[] detailNames;
  private String chartTitle;
  private String xAxisDescription;
  private String yAxisDescription;
  
  private SimpleXYChartDescriptor(int chartType, long minValue, long maxValue, long initialYMargin, boolean hideableItems, double chartFactor, int valuesBuffer)
  {
    this.chartType = chartType;
    this.minValue = minValue;
    this.maxValue = maxValue;
    this.initialYMargin = initialYMargin;
    this.hideableItems = hideableItems;
    this.chartFactor = chartFactor;
    this.valuesBuffer = valuesBuffer;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.SimpleXYChartDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItemsModel;

class SimpleXYChartSupport$1
  implements Runnable
{
  SimpleXYChartSupport$1(SimpleXYChartSupport paramSimpleXYChartSupport) {}
  
  public void run()
  {
    SimpleXYChartSupport.access$000(this$0).valuesAdded();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.SimpleXYChartSupport.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

import com.sun.tools.visualvm.charts.xy.XYStorage;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItemsModel;

class SimpleXYChartSupport$2
  implements Runnable
{
  SimpleXYChartSupport$2(SimpleXYChartSupport paramSimpleXYChartSupport, long paramLong, long[] paramArrayOfLong) {}
  
  public void run()
  {
    SimpleXYChartSupport.access$100(this$0).addValues(val$timestamp, val$values);
    try
    {
      SimpleXYChartSupport.access$000(this$0).valuesAdded();
    }
    catch (IllegalArgumentException e)
    {
      SimpleXYChartSupport.access$200().log(Level.INFO, "Results not synchronized", e);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.SimpleXYChartSupport.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

import com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.DetailsHandle;

class SimpleXYChartSupport$3
  implements Runnable
{
  SimpleXYChartSupport$3(SimpleXYChartSupport paramSimpleXYChartSupport, String[] paramArrayOfString) {}
  
  public void run()
  {
    SimpleXYChartSupport.access$300(this$0).updateDetails(val$values);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.SimpleXYChartSupport.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

import com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils;
import com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.DetailsHandle;
import com.sun.tools.visualvm.charts.xy.XYPaintersModel;
import com.sun.tools.visualvm.charts.xy.XYStorage;
import java.awt.Color;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItemsModel;

public final class SimpleXYChartSupport
{
  private static final Logger LOGGER = Logger.getLogger(SimpleXYChartSupport.class.getName());
  public static final long MIN_UNDEFINED = Long.MAX_VALUE;
  public static final long MAX_UNDEFINED = Long.MIN_VALUE;
  private final String chartTitle;
  private final String xAxisDescription;
  private final String yAxisDescription;
  private final int chartType;
  private final boolean hideItems;
  private final Color[] itemColors;
  private final long initialYMargin;
  private final String[] detailsItems;
  private final double chartFactor;
  private final XYStorage storage;
  private final SynchronousXYItemsModel itemsModel;
  private final XYPaintersModel paintersModel;
  private JComponent chartUI;
  private SimpleXYChartUtils.DetailsHandle detailsHandle;
  
  public JComponent getChart()
  {
    if (chartUI == null)
    {
      chartUI = SimpleXYChartUtils.createChartUI(chartTitle, xAxisDescription, yAxisDescription, chartType, itemColors, initialYMargin, hideItems, chartFactor, storage, itemsModel, paintersModel);
      if (detailsItems != null) {
        detailsHandle = SimpleXYChartUtils.createDetailsArea(detailsItems, chartUI);
      }
    }
    return chartUI;
  }
  
  public void saveValues(OutputStream os)
    throws IOException
  {
    storage.saveValues(os);
  }
  
  public void loadValues(InputStream is)
    throws IOException
  {
    storage.loadValues(is);
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        itemsModel.valuesAdded();
      }
    });
  }
  
  public void addValues(final long timestamp, long[] values)
  {
    Runnable valuesUpdater = new Runnable()
    {
      public void run()
      {
        storage.addValues(timestamp, val$values);
        try
        {
          itemsModel.valuesAdded();
        }
        catch (IllegalArgumentException e)
        {
          SimpleXYChartSupport.LOGGER.log(Level.INFO, "Results not synchronized", e);
        }
      }
    };
    if (SwingUtilities.isEventDispatchThread()) {
      valuesUpdater.run();
    } else {
      SwingUtilities.invokeLater(valuesUpdater);
    }
  }
  
  public void updateDetails(final String[] values)
  {
    Runnable detailsUpdater = new Runnable()
    {
      public void run()
      {
        detailsHandle.updateDetails(values);
      }
    };
    if (SwingUtilities.isEventDispatchThread()) {
      detailsUpdater.run();
    } else {
      SwingUtilities.invokeLater(detailsUpdater);
    }
  }
  
  public String formatDecimal(long value)
  {
    return SimpleXYChartUtils.formatDecimal(value * chartFactor);
  }
  
  public String formatBytes(long value)
  {
    return SimpleXYChartUtils.formatBytes((value * chartFactor));
  }
  
  public String formatPercent(long value)
  {
    return SimpleXYChartUtils.formatPercent(value * chartFactor);
  }
  
  public String formatTime(long value)
  {
    int timestamps = storage.getTimestampsCount();
    if (timestamps == 0) {
      return SimpleXYChartUtils.formatTime(value, value, value);
    }
    return SimpleXYChartUtils.formatTime(value, storage.getTimestamp(0), storage.getTimestamp(timestamps - 1));
  }
  
  SimpleXYChartSupport(String chartTitle, String xAxisDescription, String yAxisDescription, int chartType, long initialYMargin, String[] itemNames, Color[] itemColors, float[] lineWidths, Color[] lineColors, Color[] fillColors1, Color[] fillColors2, long minValue, long maxValue, double chartFactor, boolean hideItems, int valuesBuffer, String[] detailsItems)
  {
    this.chartTitle = chartTitle;
    this.xAxisDescription = xAxisDescription;
    this.yAxisDescription = yAxisDescription;
    
    this.chartType = chartType;
    this.hideItems = hideItems;
    this.itemColors = itemColors;
    this.initialYMargin = initialYMargin;
    this.detailsItems = detailsItems;
    this.chartFactor = chartFactor;
    
    storage = SimpleXYChartUtils.createStorage(valuesBuffer);
    itemsModel = SimpleXYChartUtils.createItemsModel(storage, itemNames, minValue, maxValue);
    paintersModel = SimpleXYChartUtils.createPaintersModel(lineWidths, lineColors, fillColors1, fillColors2, itemsModel);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.SimpleXYChartSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts;

interface package-info {}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.package-info
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.swing;

import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.plaf.basic.BasicLabelUI;
import javax.swing.text.View;

public class RotateLabelUI
  extends BasicLabelUI
{
  private static final double ROTATE_0 = 0.0D;
  private static final double ROTATE_90 = 1.5707963267948966D;
  private static final double ROTATE_180 = 3.141592653589793D;
  private static final double ROTATE_270 = -1.5707963267948966D;
  public static final RotateLabelUI R0 = ;
  public static final RotateLabelUI R90 = rotate90();
  public static final RotateLabelUI R180 = rotate180();
  public static final RotateLabelUI R270 = rotate270();
  private final double rotation;
  private final boolean vertical;
  
  private static RotateLabelUI rotate0()
  {
    return new RotateLabelUI(0.0D);
  }
  
  private static RotateLabelUI rotate90()
  {
    return new RotateLabelUI(1.5707963267948966D);
  }
  
  private static RotateLabelUI rotate180()
  {
    return new RotateLabelUI(3.141592653589793D);
  }
  
  private static RotateLabelUI rotate270()
  {
    return new RotateLabelUI(-1.5707963267948966D);
  }
  
  private RotateLabelUI(double rotation)
  {
    this.rotation = rotation;
    vertical = ((rotation == 1.5707963267948966D) || (rotation == -1.5707963267948966D));
  }
  
  private static Rectangle paintIconR = new Rectangle();
  private static Rectangle paintTextR = new Rectangle();
  private static Rectangle paintViewR = new Rectangle();
  private static Insets paintViewInsets = new Insets(0, 0, 0, 0);
  
  public void paint(Graphics g, JComponent c)
  {
    JLabel label = (JLabel)c;
    String text = label.getText();
    Icon icon = label.isEnabled() ? label.getIcon() : label.getDisabledIcon();
    if ((icon == null) && (text == null)) {
      return;
    }
    Graphics2D g2 = (Graphics2D)g;
    AffineTransform transform = null;
    if (rotation != 0.0D)
    {
      transform = g2.getTransform();
      g2.rotate(rotation);
      if (rotation == 1.5707963267948966D) {
        g2.translate(0, -c.getWidth());
      } else if (rotation == 3.141592653589793D) {
        g2.translate(-c.getWidth(), -c.getHeight());
      } else if (rotation == -1.5707963267948966D) {
        g2.translate(-c.getHeight(), 0);
      }
    }
    FontMetrics fm = g.getFontMetrics();
    String clippedText = layout(label, fm, c.getWidth(), c.getHeight());
    if (icon != null) {
      icon.paintIcon(c, g, paintIconRx, paintIconRy);
    }
    if (text != null)
    {
      View v = (View)c.getClientProperty("html");
      if (v != null)
      {
        v.paint(g, paintTextR);
      }
      else
      {
        int textX = paintTextRx;
        int textY = paintTextRy + fm.getAscent();
        if (label.isEnabled()) {
          paintEnabledText(label, g, clippedText, textX, textY);
        } else {
          paintDisabledText(label, g, clippedText, textX, textY);
        }
      }
    }
    if (transform != null) {
      g2.setTransform(transform);
    }
  }
  
  private String layout(JLabel label, FontMetrics fm, int width, int height)
  {
    Insets insets = label.getInsets(paintViewInsets);
    String text = label.getText();
    Icon icon = label.isEnabled() ? label.getIcon() : label.getDisabledIcon();
    paintViewRx = left;
    paintViewRy = top;
    if (vertical)
    {
      paintViewRheight = (width - (left + right));
      paintViewRwidth = (height - (top + bottom));
    }
    else
    {
      paintViewRwidth = (width - (left + right));
      paintViewRheight = (height - (top + bottom));
    }
    paintIconRx = (paintIconRy = paintIconRwidth = paintIconRheight = 0);
    paintTextRx = (paintTextRy = paintTextRwidth = paintTextRheight = 0);
    return layoutCL(label, fm, text, icon, paintViewR, paintIconR, paintTextR);
  }
  
  public Dimension getPreferredSize(JComponent c)
  {
    return getDimension(super.getPreferredSize(c));
  }
  
  public Dimension getMinimumSize(JComponent c)
  {
    return getDimension(super.getMinimumSize(c));
  }
  
  public Dimension getMaximumSize(JComponent c)
  {
    return getDimension(super.getMaximumSize(c));
  }
  
  private Dimension getDimension(Dimension dimension)
  {
    if (!vertical) {
      return dimension;
    }
    int width = width;
    width = height;
    height = width;
    return dimension;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.swing.RotateLabelUI
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

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

final class ColorIcon
  implements Icon
{
  private Color borderColor = Color.BLACK;
  private Color color = Color.BLACK;
  private int height = 5;
  private int width = 5;
  
  public ColorIcon() {}
  
  public ColorIcon(Color color)
  {
    this();
    setColor(color);
  }
  
  public ColorIcon(Color color, int width, int height)
  {
    this(color);
    setIconWidth(width);
    setIconHeight(height);
  }
  
  public ColorIcon(Color color, Color borderColor, int width, int height)
  {
    this(color, width, height);
    setBorderColor(borderColor);
  }
  
  public void setBorderColor(Color borderColor)
  {
    this.borderColor = borderColor;
  }
  
  public Color getBorderColor()
  {
    return borderColor;
  }
  
  public void setColor(Color color)
  {
    this.color = color;
  }
  
  public Color getColor()
  {
    return color;
  }
  
  public void setIconHeight(int height)
  {
    this.height = height;
  }
  
  public int getIconHeight()
  {
    return height;
  }
  
  public void setIconWidth(int width)
  {
    this.width = width;
  }
  
  public int getIconWidth()
  {
    return width;
  }
  
  public void paintIcon(Component c, Graphics g, int x, int y)
  {
    if (color != null)
    {
      g.setColor(color);
      g.fillRect(x, y, width, height);
    }
    if (borderColor != null)
    {
      g.setColor(borderColor);
      g.drawRect(x, y, width - 1, height - 1);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.ColorIcon
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import org.netbeans.lib.profiler.charts.ChartContext;
import org.netbeans.lib.profiler.charts.Timeline;
import org.netbeans.lib.profiler.charts.axis.TimelineMarksComputer;

final class SimpleXYChartUtils$1
  extends TimelineMarksComputer
{
  SimpleXYChartUtils$1(Timeline x0, ChartContext x1, int x2)
  {
    super(x0, x1, x2);
  }
  
  protected int getMinMarksDistance()
  {
    return SimpleXYChartUtils.access$000();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import javax.swing.JLabel;
import javax.swing.plaf.LabelUI;

final class SimpleXYChartUtils$10
  extends JLabel
{
  SimpleXYChartUtils$10(String x0, int x1, LabelUI paramLabelUI)
  {
    super(x0, x1);
  }
  
  public void updateUI()
  {
    if (getUI() != val$labelUI) {
      setUI(val$labelUI);
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.10
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import org.netbeans.lib.profiler.charts.ChartContext;
import org.netbeans.lib.profiler.charts.xy.DecimalXYItemMarksComputer;
import org.netbeans.lib.profiler.charts.xy.XYItem;
import org.netbeans.lib.profiler.charts.xy.XYItemPainter;

final class SimpleXYChartUtils$2
  extends DecimalXYItemMarksComputer
{
  SimpleXYChartUtils$2(XYItem x0, XYItemPainter x1, ChartContext x2, int x3)
  {
    super(x0, x1, x2, x3);
  }
  
  protected int getMinMarksDistance()
  {
    return SimpleXYChartUtils.access$100();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import org.netbeans.lib.profiler.charts.ChartContext;
import org.netbeans.lib.profiler.charts.xy.BytesXYItemMarksComputer;
import org.netbeans.lib.profiler.charts.xy.XYItem;
import org.netbeans.lib.profiler.charts.xy.XYItemPainter;

final class SimpleXYChartUtils$3
  extends BytesXYItemMarksComputer
{
  SimpleXYChartUtils$3(XYItem x0, XYItemPainter x1, ChartContext x2, int x3)
  {
    super(x0, x1, x2, x3);
  }
  
  protected int getMinMarksDistance()
  {
    return SimpleXYChartUtils.access$100();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import org.netbeans.lib.profiler.charts.ChartContext;
import org.netbeans.lib.profiler.charts.xy.DecimalXYItemMarksComputer;
import org.netbeans.lib.profiler.charts.xy.XYItem;
import org.netbeans.lib.profiler.charts.xy.XYItemPainter;

final class SimpleXYChartUtils$4
  extends DecimalXYItemMarksComputer
{
  SimpleXYChartUtils$4(XYItem x0, XYItemPainter x1, ChartContext x2, int x3)
  {
    super(x0, x1, x2, x3);
  }
  
  protected int getMinMarksDistance()
  {
    return SimpleXYChartUtils.access$100();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import com.sun.tools.visualvm.uisupport.HTMLTextArea;
import java.awt.Component;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.BorderFactory;
import javax.swing.JComponent;

final class SimpleXYChartUtils$5
  extends ComponentAdapter
{
  SimpleXYChartUtils$5(HTMLTextArea paramHTMLTextArea, JComponent paramJComponent) {}
  
  public void componentResized(ComponentEvent e)
  {
    boolean visible = e.getComponent().getHeight() > SimpleXYChartUtils.access$200();
    val$detailsArea.setVisible(visible);
    val$containerCenter.setBorder(BorderFactory.createEmptyBorder(visible ? 6 : 10, 10, 0, 10));
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import com.sun.tools.visualvm.uisupport.HTMLTextArea;

final class SimpleXYChartUtils$6
  implements SimpleXYChartUtils.DetailsHandle
{
  SimpleXYChartUtils$6(HTMLTextArea paramHTMLTextArea, String[] paramArrayOfString) {}
  
  public void updateDetails(String[] details)
  {
    try
    {
      int selStart = val$detailsArea.getSelectionStart();
      int selEnd = val$detailsArea.getSelectionEnd();
      val$detailsArea.setText(SimpleXYChartUtils.access$300(val$detailsItems, details));
      val$detailsArea.select(selStart, selEnd);
    }
    catch (Exception e) {}
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.Icon;

final class SimpleXYChartUtils$7
  extends SimpleXYChartUtils.IconCheckBox
{
  SimpleXYChartUtils$7(String x0, Icon x1, boolean x2, XYPainter paramXYPainter, XYPaintersModel paramXYPaintersModel)
  {
    super(x0, x1, x2);
  }
  
  public Dimension getPreferredSize()
  {
    Dimension ps = super.getPreferredSize();
    height = SimpleXYChartUtils.access$400();
    return ps;
  }
  
  protected void fireActionPerformed(ActionEvent e)
  {
    val$painter.setPainting(isSelected());
    val$paintersModel.painterChanged(val$painter);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import java.awt.Dimension;
import javax.swing.Icon;
import javax.swing.JLabel;

final class SimpleXYChartUtils$8
  extends JLabel
{
  SimpleXYChartUtils$8(String x0, Icon x1, int x2)
  {
    super(x0, x1, x2);
  }
  
  public Dimension getPreferredSize()
  {
    Dimension ps = super.getPreferredSize();
    height = SimpleXYChartUtils.access$400();
    return ps;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.8
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import java.awt.Color;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItem;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItemsModel;

final class SimpleXYChartUtils$9
  implements XYTooltipModel
{
  SimpleXYChartUtils$9(XYStorage paramXYStorage, SynchronousXYItemsModel paramSynchronousXYItemsModel, Color[] paramArrayOfColor, double paramDouble, int paramInt) {}
  
  public String getTimeValue(long timestamp)
  {
    int timestamps = val$storage.getTimestampsCount();
    if (timestamps == 0) {
      return SimpleXYChartUtils.formatTime(timestamp, timestamp, timestamp);
    }
    return SimpleXYChartUtils.formatTime(timestamp, val$storage.getTimestamp(0), val$storage.getTimestamp(timestamps - 1));
  }
  
  public int getRowsCount()
  {
    return val$itemsModel.getItemsCount();
  }
  
  public String getRowName(int index)
  {
    return val$itemsModel.getItem(index).getName();
  }
  
  public Color getRowColor(int index)
  {
    return val$itemColors[index];
  }
  
  public String getRowValue(int index, long itemValue)
  {
    double value = itemValue * val$chartFactor;
    switch (val$chartType)
    {
    case 1: 
      return SimpleXYChartUtils.formatBytes(value);
    case 2: 
      return SimpleXYChartUtils.formatPercent(value);
    }
    return SimpleXYChartUtils.formatDecimal(value);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.9
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

public abstract interface SimpleXYChartUtils$DetailsHandle
{
  public abstract void updateDetails(String[] paramArrayOfString);
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.DetailsHandle
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import javax.swing.Icon;
import javax.swing.JCheckBox;

class SimpleXYChartUtils$IconCheckBox$1
  extends JCheckBox
{
  SimpleXYChartUtils$IconCheckBox$1(SimpleXYChartUtils.IconCheckBox paramIconCheckBox, String x0, Icon x1)
  {
    super(x0, x1);
  }
  
  public boolean hasFocus()
  {
    return this$0.hasFocus();
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.IconCheckBox.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import com.sun.tools.visualvm.uisupport.UISupport;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.Icon;
import javax.swing.JCheckBox;

class SimpleXYChartUtils$IconCheckBox
  extends JCheckBox
{
  private static final int CHECKBOX_OFFSET = ;
  private final JCheckBox renderer;
  
  public SimpleXYChartUtils$IconCheckBox(String text, Icon icon, boolean selected)
  {
    renderer = new JCheckBox(text, icon)
    {
      public boolean hasFocus()
      {
        return SimpleXYChartUtils.IconCheckBox.this.hasFocus();
      }
    };
    renderer.setOpaque(false);
    renderer.setBorderPainted(false);
    setSelected(selected);
    setBorderPainted(false);
  }
  
  protected void paintComponent(Graphics g)
  {
    super.paintComponent(g);
    g.translate(renderer.getX(), renderer.getY());
    renderer.paint(g);
    g.translate(-renderer.getX(), -renderer.getY());
  }
  
  public void setBounds(int x, int y, int width, int height)
  {
    Dimension d = super.getPreferredSize();
    renderer.setBounds(width - CHECKBOX_OFFSET, 0, width - width + CHECKBOX_OFFSET, height);
    
    super.setBounds(x, y, width, height);
  }
  
  public Dimension getPreferredSize()
  {
    Dimension d = super.getPreferredSize();
    width += renderer.getPreferredSize().width - CHECKBOX_OFFSET;
    return d;
  }
  
  private static int getCheckBoxOffset()
  {
    if (UISupport.isWindowsLookAndFeel()) {
      return 3;
    }
    if (UISupport.isNimbusLookAndFeel()) {
      return -3;
    }
    if (UISupport.isMetalLookAndFeel()) {
      return 3;
    }
    if (UISupport.isAquaLookAndFeel()) {
      return 6;
    }
    return 0;
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.charts.xy.SimpleXYChartUtils.IconCheckBox
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.charts.xy;

import com.sun.tools.visualvm.charts.swing.RotateLabelUI;
import com.sun.tools.visualvm.uisupport.HTMLTextArea;
import com.sun.tools.visualvm.uisupport.UISupport;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.text.Format;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.plaf.LabelUI;
import org.netbeans.lib.profiler.charts.ChartContext;
import org.netbeans.lib.profiler.charts.ChartItem;
import org.netbeans.lib.profiler.charts.ChartSelectionModel;
import org.netbeans.lib.profiler.charts.ItemPainter;
import org.netbeans.lib.profiler.charts.ItemsModel;
import org.netbeans.lib.profiler.charts.Timeline;
import org.netbeans.lib.profiler.charts.axis.AxisComponent;
import org.netbeans.lib.profiler.charts.axis.AxisMarksPainter;
import org.netbeans.lib.profiler.charts.axis.AxisMarksPainter.Abstract;
import org.netbeans.lib.profiler.charts.axis.BytesMarksPainter;
import org.netbeans.lib.profiler.charts.axis.TimeAxisUtils;
import org.netbeans.lib.profiler.charts.axis.TimeMarksPainter;
import org.netbeans.lib.profiler.charts.axis.TimelineMarksComputer;
import org.netbeans.lib.profiler.charts.swing.CrossBorderLayout;
import org.netbeans.lib.profiler.charts.swing.LongRect;
import org.netbeans.lib.profiler.charts.xy.BytesXYItemMarksComputer;
import org.netbeans.lib.profiler.charts.xy.DecimalXYItemMarksComputer;
import org.netbeans.lib.profiler.charts.xy.XYItem;
import org.netbeans.lib.profiler.charts.xy.XYItemPainter;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYChart;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItem;
import org.netbeans.lib.profiler.charts.xy.synchronous.SynchronousXYItemsModel;
import org.openide.util.NbBundle;

public class SimpleXYChartUtils
{
  public static final int TYPE_DECIMAL = 0;
  public static final int TYPE_BYTES = 1;
  public static final int TYPE_PERCENT = 2;
  private static final NumberFormat DECIMAL_FORMATTER = ;
  private static final NumberFormat PERCENT_FORMATTER;
  
  static
  {
    DECIMAL_FORMATTER.setGroupingUsed(true);
    DECIMAL_FORMATTER.setMaximumFractionDigits(2);
    
    PERCENT_FORMATTER = NumberFormat.getPercentInstance();
    PERCENT_FORMATTER.setMinimumFractionDigits(1);
    PERCENT_FORMATTER.setMaximumIntegerDigits(3);
  }
  
  private static final int DEFAULT_BUFFER_STEP = 50;
  private static final Color AXIS_FONT_COLOR = new Color(90, 90, 90);
  private static final Color BACKGROUND_COLOR = UISupport.getDefaultBackground();
  private static final int VALUES_SPACING = Math.max(new TimeMarksPainter().getFont().getSize(), 15) + 10;
  private static final int TIMELINE_SPACING = 80;
  private static int LEGEND_HEIGHT = -1;
  private static final int DETAILS_HEIGHT_THRESHOLD = 180;
  private static final Map<String, Format> FORMATS = new HashMap();
  
  public static XYStorage createStorage(int valuesBuffer)
  {
    return new XYStorage(valuesBuffer, DEFAULT_BUFFER_STEP);
  }
  
  public static SynchronousXYItemsModel createItemsModel(XYStorage storage, String[] itemNames, long minValue, long maxValue)
  {
    SynchronousXYItem[] items = new SynchronousXYItem[itemNames.length];
    for (int i = 0; i < items.length; i++) {
      items[i] = storage.addItem(itemNames[i], minValue, maxValue);
    }
    return new SynchronousXYItemsModel(storage, items);
  }
  
  public static XYPaintersModel createPaintersModel(float[] lineWidths, Color[] lineColors, Color[] fillColors1, Color[] fillColors2, ItemsModel itemsModel)
  {
    ChartItem[] items = new ChartItem[itemsModel.getItemsCount()];
    for (int i = 0; i < items.length; i++) {
      items[i] = itemsModel.getItem(i);
    }
    ItemPainter[] painters = new ItemPainter[items.length];
    for (int i = 0; i < painters.length; i++) {
      painters[i] = XYPainter.absolutePainter((lineWidths == null ? null : Float.valueOf(lineWidths[i])).floatValue(), lineColors == null ? null : lineColors[i], fillColors1 == null ? null : fillColors1[i], fillColors2 == null ? null : fillColors2[i]);
    }
    return new XYPaintersModel(items, painters);
  }
  
  public static JComponent createChartUI(String chartTitle, String xAxisDescription, String yAxisDescription, int chartType, Color[] itemColors, long initialYMargin, boolean hideItems, double chartFactor, XYStorage storage, SynchronousXYItemsModel itemsModel, XYPaintersModel paintersModel)
  {
    SynchronousXYChart chart = new SynchronousXYChart(itemsModel, paintersModel);
    
    chart.setFitsHeight(true);
    chart.setFitsWidth(true);
    chart.setBottomBased(true);
    chart.setViewInsets(new Insets(10, 0, 0, 0));
    chart.setInitialDataBounds(new LongRect(System.currentTimeMillis(), 0L, 2500L, initialYMargin));
    
    chart.addPreDecorator(new XYBackground());
    
    TimelineMarksComputer hComputer = new TimelineMarksComputer(storage, chart.getChartContext(), 0)
    {
      protected int getMinMarksDistance()
      {
        return SimpleXYChartUtils.TIMELINE_SPACING;
      }
    };
    AxisComponent hAxis = new XYAxisComponent(chart, hComputer, customizeMarksPainter(new TimeMarksPainter()), 5, 2);
    
    AxisComponent vAxis = null;
    if (chartType == 2)
    {
      SynchronousXYItem item = itemsModel.getItem(0);
      XYItemPainter painter = (XYItemPainter)paintersModel.getPainter(item);
      DecimalXYItemMarksComputer vComputer = new DecimalXYItemMarksComputer(item, painter, chart.getChartContext(), 1)
      {
        protected int getMinMarksDistance()
        {
          return SimpleXYChartUtils.VALUES_SPACING;
        }
      };
      vAxis = new XYAxisComponent(chart, vComputer, customizeMarksPainter(new XYPercentMarksPainter(0L, 100L, chartF
1 2 3

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