com-sun-tools-visualvm-host-views

16:33:51.104 INFO  jd.cli.Main - Decompiling com-sun-tools-visualvm-host-views.jar
package com.sun.tools.visualvm.host.views;

import com.sun.tools.visualvm.core.ui.DataSourceViewsManager;
import com.sun.tools.visualvm.core.ui.PluggableDataSourceViewProvider;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.views.overview.HostOverviewViewProvider;

public final class HostViewsSupport
{
  private static HostViewsSupport sharedInstance;
  private HostOverviewViewProvider viewProvider = new HostOverviewViewProvider();
  
  public static synchronized HostViewsSupport sharedInstance()
  {
    if (sharedInstance == null) {
      sharedInstance = new HostViewsSupport();
    }
    return sharedInstance;
  }
  
  public PluggableDataSourceViewProvider<Host> getOverviewView()
  {
    return viewProvider;
  }
  
  private HostViewsSupport()
  {
    DataSourceViewsManager.sharedInstance().addViewProvider(viewProvider, Host.class);
  }
}

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

import org.openide.modules.ModuleInstall;

final class Installer
  extends ModuleInstall
{
  public void restored()
  {
    HostViewsSupport.sharedInstance();
  }
}

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

public class BoundedDynamicXYChartModel {}

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

class HostOverviewView$1$1
  implements Runnable
{
  HostOverviewView$1$1(HostOverviewView.1 param1, long paramLong) {}
  
  public void run()
  {
    this$1.val$cpuLoadViewSupport.refresh(HostOverviewView.access$000(this$1.this$0), val$time);
    this$1.val$physicalMemoryViewSupport.refresh(HostOverviewView.access$000(this$1.this$0), val$time);
    this$1.val$swapMemoryViewSupport.refresh(HostOverviewView.access$000(this$1.this$0), val$time);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.host.views.overview.HostOverviewView.1.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.host.views.overview;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.SwingUtilities;

class HostOverviewView$1
  implements ActionListener
{
  HostOverviewView$1(HostOverviewView paramHostOverviewView, HostOverviewView.CpuLoadViewSupport paramCpuLoadViewSupport, HostOverviewView.PhysicalMemoryViewSupport paramPhysicalMemoryViewSupport, HostOverviewView.SwapMemoryViewSupport paramSwapMemoryViewSupport) {}
  
  public void actionPerformed(ActionEvent e)
  {
    final long time = System.currentTimeMillis();
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        val$cpuLoadViewSupport.refresh(HostOverviewView.access$000(this$0), time);
        val$physicalMemoryViewSupport.refresh(HostOverviewView.access$000(this$0), time);
        val$swapMemoryViewSupport.refresh(HostOverviewView.access$000(this$0), time);
      }
    });
  }
}

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

import com.sun.tools.visualvm.charts.ChartFactory;
import com.sun.tools.visualvm.charts.SimpleXYChartDescriptor;
import com.sun.tools.visualvm.charts.SimpleXYChartSupport;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.DetailsView;
import com.sun.tools.visualvm.core.ui.components.NotSupportedDisplayer;
import com.sun.tools.visualvm.host.model.HostOverview;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import org.openide.util.NbBundle;

class HostOverviewView$CpuLoadViewSupport
  extends JPanel
{
  private boolean cpuMonitoringSupported;
  private static final String LOAD_AVERAGE = NbBundle.getMessage(HostOverviewView.class, "LBL_Load_average");
  private SimpleXYChartSupport chartSupport;
  
  public HostOverviewView$CpuLoadViewSupport(HostOverview hostOverview, boolean cpuSupported, int chartCache)
  {
    cpuMonitoringSupported = cpuSupported;
    initModels(chartCache);
    initComponents();
  }
  
  public DataViewComponent.DetailsView getDetailsView()
  {
    return new DataViewComponent.DetailsView(NbBundle.getMessage(HostOverviewView.class, "LBL_CPU_load"), null, 10, this, null);
  }
  
  public void refresh(HostOverview hostOverview, long time)
  {
    if (cpuMonitoringSupported)
    {
      long load = (hostOverview.getSystemLoadAverage() * 1000.0D);
      
      chartSupport.addValues(time, new long[] { load });
      chartSupport.updateDetails(new String[] { chartSupport.formatDecimal(load) });
    }
  }
  
  private void initModels(int chartCache)
  {
    SimpleXYChartDescriptor chartDescriptor = SimpleXYChartDescriptor.decimal(1L, 0.001D, false, chartCache);
    
    chartDescriptor.addLineItems(new String[] { LOAD_AVERAGE });
    chartDescriptor.setDetailsItems(new String[] { LOAD_AVERAGE });
    
    chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
  }
  
  private void initComponents()
  {
    setLayout(new BorderLayout());
    setOpaque(false);
    if (cpuMonitoringSupported) {
      add(chartSupport.getChart(), "Center");
    } else {
      add(new NotSupportedDisplayer(NotSupportedDisplayer.HOST), "Center");
    }
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.host.views.overview.HostOverviewView.CpuLoadViewSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.host.views.overview;

import com.sun.tools.visualvm.core.ui.components.DataViewComponent.MasterView;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.model.HostOverview;
import com.sun.tools.visualvm.host.model.HostOverviewFactory;
import com.sun.tools.visualvm.uisupport.HTMLTextArea;
import java.awt.BorderLayout;
import java.text.NumberFormat;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import org.openide.util.NbBundle;

class HostOverviewView$MasterViewSupport
  extends JPanel
{
  public HostOverviewView$MasterViewSupport(Host host)
  {
    initComponents(host);
  }
  
  public DataViewComponent.MasterView getMasterView()
  {
    return new DataViewComponent.MasterView(NbBundle.getMessage(HostOverviewView.class, "LBL_Overview"), null, this);
  }
  
  private void initComponents(Host host)
  {
    setLayout(new BorderLayout());
    setOpaque(false);
    
    HTMLTextArea area = new HTMLTextArea("<nobr>" + getGeneralInfo(host) + "</nobr>");
    area.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8));
    
    add(area, "Center");
  }
  
  String getGeneralInfo(Host host)
  {
    HostOverview so = HostOverviewFactory.getSystemOverviewFor(host);
    StringBuilder data = new StringBuilder();
    String hostIp = NbBundle.getMessage(HostOverviewView.class, "LBL_Host_IP");
    data.append("<b>" + hostIp + ":</b> " + so.getHostAddress() + "<br>");
    
    String hostname = NbBundle.getMessage(HostOverviewView.class, "LBL_Hostname");
    data.append("<b>" + hostname + ":</b> " + so.getHostName() + "<br><br>");
    
    String name = so.getName();
    String ver = so.getVersion();
    String patch = so.getPatchLevel();
    
    patch = "unknown".equals(patch) ? "" : patch;
    String os = NbBundle.getMessage(HostOverviewView.class, "LBL_OS");
    String arch = NbBundle.getMessage(HostOverviewView.class, "LBL_Architecture");
    String proc = NbBundle.getMessage(HostOverviewView.class, "LBL_Processors");
    String memory = NbBundle.getMessage(HostOverviewView.class, "LBL_Total_memory_size");
    String swap = NbBundle.getMessage(HostOverviewView.class, "LBL_Swap_size");
    String mb = NbBundle.getMessage(HostOverviewView.class, "LBL_MB");
    data.append("<b>" + os + ":</b> " + name + " (" + ver + ")" + " " + patch + "<br>");
    data.append("<b>" + arch + ":</b> " + so.getArch() + "<br>");
    data.append("<b>" + proc + ":</b> " + so.getAvailableProcessors() + "<br><br>");
    data.append("<b>" + memory + ":</b> " + formatBytes(so.getTotalPhysicalMemorySize()) + " " + mb + "<br>");
    data.append("<b>" + swap + ":</b> " + formatBytes(so.getTotalSwapSpaceSize()) + " " + mb + "<br>");
    
    return data.toString();
  }
  
  private String formatBytes(long l)
  {
    return NumberFormat.getInstance().format(10L * l / 1024L / 1024L / 10.0D);
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.host.views.overview.HostOverviewView.MasterViewSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.host.views.overview;

import com.sun.tools.visualvm.charts.ChartFactory;
import com.sun.tools.visualvm.charts.SimpleXYChartDescriptor;
import com.sun.tools.visualvm.charts.SimpleXYChartSupport;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.DetailsView;
import com.sun.tools.visualvm.host.model.HostOverview;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import org.openide.util.NbBundle;

class HostOverviewView$PhysicalMemoryViewSupport
  extends JPanel
{
  private static String USED_MEMORY = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_memory");
  private static String USED_MEMORY_LEG = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_memory_leg");
  private static String TOTAL_MEMORY = NbBundle.getMessage(HostOverviewView.class, "LBL_Total_memory");
  private SimpleXYChartSupport chartSupport;
  
  public HostOverviewView$PhysicalMemoryViewSupport(int chartCache)
  {
    initModels(chartCache);
    initComponents();
  }
  
  public DataViewComponent.DetailsView getDetailsView()
  {
    return new DataViewComponent.DetailsView(NbBundle.getMessage(HostOverviewView.class, "LBL_Physical_memory"), null, 10, this, null);
  }
  
  public void refresh(HostOverview hostOverview, long time)
  {
    long memoryMax = hostOverview.getTotalPhysicalMemorySize();
    long memoryUsed = memoryMax - hostOverview.getFreePhysicalMemorySize();
    
    chartSupport.addValues(time, new long[] { memoryUsed });
    chartSupport.updateDetails(new String[] { chartSupport.formatBytes(memoryUsed), chartSupport.formatBytes(memoryMax) });
  }
  
  private void initModels(int chartCache)
  {
    SimpleXYChartDescriptor chartDescriptor = SimpleXYChartDescriptor.bytes(134217728L, false, chartCache);
    
    chartDescriptor.addLineFillItems(new String[] { USED_MEMORY_LEG });
    chartDescriptor.setDetailsItems(new String[] { USED_MEMORY, TOTAL_MEMORY });
    
    chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
  }
  
  private void initComponents()
  {
    setLayout(new BorderLayout());
    setOpaque(false);
    
    add(chartSupport.getChart(), "Center");
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.host.views.overview.HostOverviewView.PhysicalMemoryViewSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.host.views.overview;

import com.sun.tools.visualvm.charts.ChartFactory;
import com.sun.tools.visualvm.charts.SimpleXYChartDescriptor;
import com.sun.tools.visualvm.charts.SimpleXYChartSupport;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.DetailsView;
import com.sun.tools.visualvm.host.model.HostOverview;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import org.openide.util.NbBundle;

class HostOverviewView$SwapMemoryViewSupport
  extends JPanel
{
  private static final String USED_SWAP = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_swap");
  private static final String USED_SWAP_LEG = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_swap_leg");
  private static final String TOTAL_SWAP = NbBundle.getMessage(HostOverviewView.class, "LBL_Total_swap");
  private SimpleXYChartSupport chartSupport;
  
  public HostOverviewView$SwapMemoryViewSupport(int chartCache)
  {
    initModels(chartCache);
    initComponents();
  }
  
  public DataViewComponent.DetailsView getDetailsView()
  {
    return new DataViewComponent.DetailsView(NbBundle.getMessage(HostOverviewView.class, "LBL_Swap_memory"), null, 20, this, null);
  }
  
  public void refresh(HostOverview hostOverview, long time)
  {
    long memorySwapMax = hostOverview.getTotalSwapSpaceSize();
    long memorySwapUsed = memorySwapMax - hostOverview.getFreeSwapSpaceSize();
    
    chartSupport.addValues(time, new long[] { memorySwapUsed });
    chartSupport.updateDetails(new String[] { chartSupport.formatBytes(memorySwapUsed), chartSupport.formatBytes(memorySwapMax) });
  }
  
  private void initModels(int chartCache)
  {
    SimpleXYChartDescriptor chartDescriptor = SimpleXYChartDescriptor.bytes(134217728L, false, chartCache);
    
    chartDescriptor.addLineFillItems(new String[] { USED_SWAP_LEG });
    chartDescriptor.setDetailsItems(new String[] { USED_SWAP, TOTAL_SWAP });
    
    chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
  }
  
  private void initComponents()
  {
    setLayout(new BorderLayout());
    setOpaque(false);
    
    add(chartSupport.getChart(), "Center");
  }
}

/* Location:
 * Qualified Name:     com.sun.tools.visualvm.host.views.overview.HostOverviewView.SwapMemoryViewSupport
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.tools.visualvm.host.views.overview;

import com.sun.tools.visualvm.charts.ChartFactory;
import com.sun.tools.visualvm.charts.SimpleXYChartDescriptor;
import com.sun.tools.visualvm.charts.SimpleXYChartSupport;
import com.sun.tools.visualvm.core.datasupport.DataRemovedListener;
import com.sun.tools.visualvm.core.options.GlobalPreferences;
import com.sun.tools.visualvm.core.ui.DataSourceView;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.DetailsAreaConfiguration;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.DetailsView;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.MasterView;
import com.sun.tools.visualvm.core.ui.components.DataViewComponent.MasterViewConfiguration;
import com.sun.tools.visualvm.core.ui.components.NotSupportedDisplayer;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.model.HostOverview;
import com.sun.tools.visualvm.host.model.HostOverviewFactory;
import com.sun.tools.visualvm.uisupport.HTMLTextArea;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;

class HostOverviewView
  extends DataSourceView
  implements DataRemovedListener<Host>
{
  private static final String IMAGE_PATH = "com/sun/tools/visualvm/host/views/resources/overview.png";
  private Timer timer;
  private HostOverview hostOverview;
  
  public HostOverviewView(Host host)
  {
    super(host, NbBundle.getMessage(HostOverviewView.class, "LBL_Overview"), new ImageIcon(ImageUtilities.loadImage("com/sun/tools/visualvm/host/views/resources/overview.png", true)).getImage(), 0, false);
  }
  
  protected void willBeAdded()
  {
    hostOverview = HostOverviewFactory.getSystemOverviewFor((Host)getDataSource());
  }
  
  protected void removed()
  {
    timer.stop();
  }
  
  public void dataRemoved(Host dataSource)
  {
    timer.stop();
  }
  
  protected DataViewComponent createComponent()
  {
    GlobalPreferences preferences = GlobalPreferences.sharedInstance();
    int chartCache = preferences.getMonitoredHostCache() * 60 / preferences.getMonitoredHostPoll();
    
    DataViewComponent dvc = new DataViewComponent(new MasterViewSupport((Host)getDataSource()).getMasterView(), new DataViewComponent.MasterViewConfiguration(false));
    
    boolean cpuSupported = hostOverview.getSystemLoadAverage() >= 0.0D;
    final CpuLoadViewSupport cpuLoadViewSupport = new CpuLoadViewSupport(hostOverview, cpuSupported, chartCache);
    dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(NbBundle.getMessage(HostOverviewView.class, "LBL_CPU"), true), 1);
    dvc.addDetailsView(cpuLoadViewSupport.getDetailsView(), 1);
    if (!cpuSupported) {
      dvc.hideDetailsArea(1);
    }
    final PhysicalMemoryViewSupport physicalMemoryViewSupport = new PhysicalMemoryViewSupport(chartCache);
    dvc.configureDetailsArea(new DataViewComponent.DetailsAreaConfiguration(NbBundle.getMessage(HostOverviewView.class, "LBL_Memory"), true), 2);
    dvc.addDetailsView(physicalMemoryViewSupport.getDetailsView(), 2);
    
    final SwapMemoryViewSupport swapMemoryViewSupport = new SwapMemoryViewSupport(chartCache);
    dvc.addDetailsView(swapMemoryViewSupport.getDetailsView(), 2);
    
    timer = new Timer(2000, new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        final long time = System.currentTimeMillis();
        SwingUtilities.invokeLater(new Runnable()
        {
          public void run()
          {
            val$cpuLoadViewSupport.refresh(hostOverview, time);
            val$physicalMemoryViewSupport.refresh(hostOverview, time);
            val$swapMemoryViewSupport.refresh(hostOverview, time);
          }
        });
      }
    });
    timer.setInitialDelay(800);
    timer.start();
    ((Host)getDataSource()).notifyWhenRemoved(this);
    
    return dvc;
  }
  
  private static class MasterViewSupport
    extends JPanel
  {
    public MasterViewSupport(Host host)
    {
      initComponents(host);
    }
    
    public DataViewComponent.MasterView getMasterView()
    {
      return new DataViewComponent.MasterView(NbBundle.getMessage(HostOverviewView.class, "LBL_Overview"), null, this);
    }
    
    private void initComponents(Host host)
    {
      setLayout(new BorderLayout());
      setOpaque(false);
      
      HTMLTextArea area = new HTMLTextArea("<nobr>" + getGeneralInfo(host) + "</nobr>");
      area.setBorder(BorderFactory.createEmptyBorder(14, 8, 14, 8));
      
      add(area, "Center");
    }
    
    String getGeneralInfo(Host host)
    {
      HostOverview so = HostOverviewFactory.getSystemOverviewFor(host);
      StringBuilder data = new StringBuilder();
      String hostIp = NbBundle.getMessage(HostOverviewView.class, "LBL_Host_IP");
      data.append("<b>" + hostIp + ":</b> " + so.getHostAddress() + "<br>");
      
      String hostname = NbBundle.getMessage(HostOverviewView.class, "LBL_Hostname");
      data.append("<b>" + hostname + ":</b> " + so.getHostName() + "<br><br>");
      
      String name = so.getName();
      String ver = so.getVersion();
      String patch = so.getPatchLevel();
      
      patch = "unknown".equals(patch) ? "" : patch;
      String os = NbBundle.getMessage(HostOverviewView.class, "LBL_OS");
      String arch = NbBundle.getMessage(HostOverviewView.class, "LBL_Architecture");
      String proc = NbBundle.getMessage(HostOverviewView.class, "LBL_Processors");
      String memory = NbBundle.getMessage(HostOverviewView.class, "LBL_Total_memory_size");
      String swap = NbBundle.getMessage(HostOverviewView.class, "LBL_Swap_size");
      String mb = NbBundle.getMessage(HostOverviewView.class, "LBL_MB");
      data.append("<b>" + os + ":</b> " + name + " (" + ver + ")" + " " + patch + "<br>");
      data.append("<b>" + arch + ":</b> " + so.getArch() + "<br>");
      data.append("<b>" + proc + ":</b> " + so.getAvailableProcessors() + "<br><br>");
      data.append("<b>" + memory + ":</b> " + formatBytes(so.getTotalPhysicalMemorySize()) + " " + mb + "<br>");
      data.append("<b>" + swap + ":</b> " + formatBytes(so.getTotalSwapSpaceSize()) + " " + mb + "<br>");
      
      return data.toString();
    }
    
    private String formatBytes(long l)
    {
      return NumberFormat.getInstance().format(10L * l / 1024L / 1024L / 10.0D);
    }
  }
  
  private static class CpuLoadViewSupport
    extends JPanel
  {
    private boolean cpuMonitoringSupported;
    private static final String LOAD_AVERAGE = NbBundle.getMessage(HostOverviewView.class, "LBL_Load_average");
    private SimpleXYChartSupport chartSupport;
    
    public CpuLoadViewSupport(HostOverview hostOverview, boolean cpuSupported, int chartCache)
    {
      cpuMonitoringSupported = cpuSupported;
      initModels(chartCache);
      initComponents();
    }
    
    public DataViewComponent.DetailsView getDetailsView()
    {
      return new DataViewComponent.DetailsView(NbBundle.getMessage(HostOverviewView.class, "LBL_CPU_load"), null, 10, this, null);
    }
    
    public void refresh(HostOverview hostOverview, long time)
    {
      if (cpuMonitoringSupported)
      {
        long load = (hostOverview.getSystemLoadAverage() * 1000.0D);
        
        chartSupport.addValues(time, new long[] { load });
        chartSupport.updateDetails(new String[] { chartSupport.formatDecimal(load) });
      }
    }
    
    private void initModels(int chartCache)
    {
      SimpleXYChartDescriptor chartDescriptor = SimpleXYChartDescriptor.decimal(1L, 0.001D, false, chartCache);
      
      chartDescriptor.addLineItems(new String[] { LOAD_AVERAGE });
      chartDescriptor.setDetailsItems(new String[] { LOAD_AVERAGE });
      
      chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
    }
    
    private void initComponents()
    {
      setLayout(new BorderLayout());
      setOpaque(false);
      if (cpuMonitoringSupported) {
        add(chartSupport.getChart(), "Center");
      } else {
        add(new NotSupportedDisplayer(NotSupportedDisplayer.HOST), "Center");
      }
    }
  }
  
  private static class PhysicalMemoryViewSupport
    extends JPanel
  {
    private static String USED_MEMORY = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_memory");
    private static String USED_MEMORY_LEG = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_memory_leg");
    private static String TOTAL_MEMORY = NbBundle.getMessage(HostOverviewView.class, "LBL_Total_memory");
    private SimpleXYChartSupport chartSupport;
    
    public PhysicalMemoryViewSupport(int chartCache)
    {
      initModels(chartCache);
      initComponents();
    }
    
    public DataViewComponent.DetailsView getDetailsView()
    {
      return new DataViewComponent.DetailsView(NbBundle.getMessage(HostOverviewView.class, "LBL_Physical_memory"), null, 10, this, null);
    }
    
    public void refresh(HostOverview hostOverview, long time)
    {
      long memoryMax = hostOverview.getTotalPhysicalMemorySize();
      long memoryUsed = memoryMax - hostOverview.getFreePhysicalMemorySize();
      
      chartSupport.addValues(time, new long[] { memoryUsed });
      chartSupport.updateDetails(new String[] { chartSupport.formatBytes(memoryUsed), chartSupport.formatBytes(memoryMax) });
    }
    
    private void initModels(int chartCache)
    {
      SimpleXYChartDescriptor chartDescriptor = SimpleXYChartDescriptor.bytes(134217728L, false, chartCache);
      
      chartDescriptor.addLineFillItems(new String[] { USED_MEMORY_LEG });
      chartDescriptor.setDetailsItems(new String[] { USED_MEMORY, TOTAL_MEMORY });
      
      chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
    }
    
    private void initComponents()
    {
      setLayout(new BorderLayout());
      setOpaque(false);
      
      add(chartSupport.getChart(), "Center");
    }
  }
  
  private static class SwapMemoryViewSupport
    extends JPanel
  {
    private static final String USED_SWAP = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_swap");
    private static final String USED_SWAP_LEG = NbBundle.getMessage(HostOverviewView.class, "LBL_Used_swap_leg");
    private static final String TOTAL_SWAP = NbBundle.getMessage(HostOverviewView.class, "LBL_Total_swap");
    private SimpleXYChartSupport chartSupport;
    
    public SwapMemoryViewSupport(int chartCache)
    {
      initModels(chartCache);
      initComponents();
    }
    
    public DataViewComponent.DetailsView getDetailsView()
    {
      return new DataViewComponent.DetailsView(NbBundle.getMessage(HostOverviewView.class, "LBL_Swap_memory"), null, 20, this, null);
    }
    
    public void refresh(HostOverview hostOverview, long time)
    {
      long memorySwapMax = hostOverview.getTotalSwapSpaceSize();
      long memorySwapUsed = memorySwapMax - hostOverview.getFreeSwapSpaceSize();
      
      chartSupport.addValues(time, new long[] { memorySwapUsed });
      chartSupport.updateDetails(new String[] { chartSupport.formatBytes(memorySwapUsed), chartSupport.formatBytes(memorySwapMax) });
    }
    
    private void initModels(int chartCache)
    {
      SimpleXYChartDescriptor chartDescriptor = SimpleXYChartDescriptor.bytes(134217728L, false, chartCache);
      
      chartDescriptor.addLineFillItems(new String[] { USED_SWAP_LEG });
      chartDescriptor.setDetailsItems(new String[] { USED_SWAP, TOTAL_SWAP });
      
      chartSupport = ChartFactory.createSimpleXYChart(chartDescriptor);
    }
    
    private void initComponents()
    {
      setLayout(new BorderLayout());
      setOpaque(false);
      
      add(chartSupport.getChart(), "Center");
    }
  }
}

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

import com.sun.tools.visualvm.core.ui.DataSourceView;
import com.sun.tools.visualvm.core.ui.PluggableDataSourceViewProvider;
import com.sun.tools.visualvm.host.Host;
import com.sun.tools.visualvm.host.model.HostOverview;
import com.sun.tools.visualvm.host.model.HostOverviewFactory;
import java.util.Set;

public class HostOverviewViewProvider
  extends PluggableDataSourceViewProvider<Host>
{
  protected boolean supportsViewFor(Host host)
  {
    return HostOverviewFactory.getSystemOverviewFor(host).getName() != null;
  }
  
  protected DataSourceView createView(Host host)
  {
    return new HostOverviewView(host);
  }
  
  public Set<Integer> getPluggableLocations(DataSourceView view)
  {
    return ALL_LOCATIONS;
  }
}

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

interface package-info {}

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

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