GridLayout layout = new GridLayout();
layout.numColumns = 8;
layout.makeColumnsEqualWidth = true;
autoSpeedInfoPanel.setLayout(layout);
Canvas pingCanvas = new Canvas(autoSpeedInfoPanel,SWT.NO_BACKGROUND);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 4;
pingCanvas.setLayoutData(gridData);
pingGraph = PingGraphic.getInstance();
pingGraph.initialize(pingCanvas);
TabFolder folder = new TabFolder(autoSpeedInfoPanel, SWT.LEFT);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 4;
folder.setLayoutData(gridData);
folder.setBackground(Colors.background);
ValueFormater speed_formatter =
new ValueFormater()
{
public String
format(
int value)
{
return( DisplayFormatters.formatByteCountToKiBEtc( value ));
}
};
ValueFormater time_formatter =
new ValueFormater()
{
public String
format(
int value)
{
return( value + " ms" );
}
};
ValueFormater[] formatters = new ValueFormater[]{ speed_formatter, speed_formatter, time_formatter };
String[] labels = new String[]{ "up", "down", "ping" };
SpeedManagerPingMapper[] mappers = speedManager.getMappers();
plot_views = new plotView[mappers.length];
zone_views = new zoneView[mappers.length];
for (int i=0;i<mappers.length;i++){
SpeedManagerPingMapper mapper = mappers[i];
TabItem plot_item = new TabItem(folder, SWT.NULL);
plot_item.setText( "Plot " + mapper.getName());
Canvas plotCanvas = new Canvas(folder,SWT.NO_BACKGROUND);
gridData = new GridData(GridData.FILL_BOTH);
plotCanvas.setLayoutData(gridData);
plot_views[i] = new plotView( mapper, plotCanvas, labels, formatters );
plot_item.setControl( plotCanvas );
TabItem zones_item = new TabItem(folder, SWT.NULL);
zones_item.setText( "Zones " + mapper.getName() );
Canvas zoneCanvas = new Canvas(folder,SWT.NO_BACKGROUND);
gridData = new GridData(GridData.FILL_BOTH);
zoneCanvas.setLayoutData(gridData);
zone_views[i] = new zoneView( mapper, zoneCanvas, labels, formatters );
zones_item.setControl( zoneCanvas );
}