use of org.eclipse.swt.widgets.Canvas in project BiglyBT by BiglySoftware.
the class TransferStatsView method createConnectionPanel.
private void createConnectionPanel() {
connectionPanel = new Composite(mainPanel, SWT.NONE);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(connectionPanel, gridData);
GridLayout panelLayout = new GridLayout();
panelLayout.numColumns = 2;
panelLayout.makeColumnsEqualWidth = true;
connectionPanel.setLayout(panelLayout);
Composite conn_area = new Composite(connectionPanel, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(conn_area, gridData);
panelLayout = new GridLayout();
panelLayout.numColumns = 2;
conn_area.setLayout(panelLayout);
Label label = new Label(conn_area, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.con");
connection_label = new BufferedLabel(conn_area, SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(connection_label, gridData);
Composite upload_area = new Composite(connectionPanel, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(upload_area, gridData);
panelLayout = new GridLayout();
panelLayout.numColumns = 2;
upload_area.setLayout(panelLayout);
label = new Label(upload_area, SWT.NULL);
Messages.setLanguageText(label, "SpeedView.stats.upload");
upload_label = new BufferedLabel(upload_area, SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(upload_label, gridData);
// connections
con_folder = new TabFolder(connectionPanel, SWT.LEFT);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 1;
Utils.setLayoutData(con_folder, gridData);
con_folder.setBackground(Colors.background);
// connection counts
TabItem conn_item = new TabItem(con_folder, SWT.NULL);
conn_item.setText(MessageText.getString("label.connections"));
Canvas connection_canvas = new Canvas(con_folder, SWT.NO_BACKGROUND);
conn_item.setControl(connection_canvas);
gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 200;
Utils.setLayoutData(connection_canvas, gridData);
connection_graphic = SpeedGraphic.getInstance(new Scale(false), new ValueFormater() {
@Override
public String format(int value) {
return (String.valueOf(value));
}
});
connection_graphic.initialize(connection_canvas);
Color[] colors = connection_graphic.colors;
connection_graphic.setLineColors(colors);
// route info
TabItem route_info_tab = new TabItem(con_folder, SWT.NULL);
route_info_tab.setText(MessageText.getString("label.routing"));
Composite route_tab_comp = new Composite(con_folder, SWT.NULL);
Utils.setLayoutData(route_tab_comp, new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout routeTabLayout = new GridLayout();
routeTabLayout.numColumns = 1;
route_tab_comp.setLayout(routeTabLayout);
route_info_tab.setControl(route_tab_comp);
ScrolledComposite sc = new ScrolledComposite(route_tab_comp, SWT.V_SCROLL);
Utils.setLayoutData(sc, new GridData(SWT.FILL, SWT.FILL, true, true));
route_comp = new Composite(sc, SWT.NULL);
Utils.setLayoutData(route_comp, new GridData(SWT.FILL, SWT.FILL, true, true));
GridLayout routeLayout = new GridLayout();
routeLayout.numColumns = 3;
// routeLayout.makeColumnsEqualWidth = true;
route_comp.setLayout(routeLayout);
sc.setContent(route_comp);
buildRouteComponent(5);
// upload queued
Canvas upload_canvas = new Canvas(connectionPanel, SWT.NO_BACKGROUND);
gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 200;
Utils.setLayoutData(upload_canvas, gridData);
upload_graphic = SpeedGraphic.getInstance(new ValueFormater() {
@Override
public String format(int value) {
return DisplayFormatters.formatByteCountToKiBEtc(value);
}
});
upload_graphic.initialize(upload_canvas);
}
use of org.eclipse.swt.widgets.Canvas in project BiglyBT by BiglySoftware.
the class TransferStatsView method createAutoSpeedPanel.
private void createAutoSpeedPanel() {
autoSpeedPanel = new Group(mainPanel, SWT.NONE);
GridData generalPanelData = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(autoSpeedPanel, generalPanelData);
Messages.setLanguageText(autoSpeedPanel, "SpeedView.stats.autospeed", new String[] { String.valueOf(MAX_DISPLAYED_PING_MILLIS_DISP) });
autoSpeedPanelLayout = new StackLayout();
autoSpeedPanel.setLayout(autoSpeedPanelLayout);
autoSpeedInfoPanel = new Composite(autoSpeedPanel, SWT.NULL);
Utils.setLayoutData(autoSpeedInfoPanel, new GridData(GridData.FILL_BOTH));
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;
Utils.setLayoutData(pingCanvas, gridData);
pingGraph.initialize(pingCanvas);
TabFolder folder = new TabFolder(autoSpeedInfoPanel, SWT.LEFT);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 4;
Utils.setLayoutData(folder, gridData);
folder.setBackground(Colors.background);
ValueFormater speed_formatter = new ValueFormater() {
@Override
public String format(int value) {
return (DisplayFormatters.formatByteCountToKiBEtc(value));
}
};
ValueFormater time_formatter = new ValueFormater() {
@Override
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);
Utils.setLayoutData(plotCanvas, 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);
Utils.setLayoutData(zoneCanvas, gridData);
zone_views[i] = new zoneView(mapper, zoneCanvas, labels, formatters);
zones_item.setControl(zoneCanvas);
}
autoSpeedDisabledPanel = new Composite(autoSpeedPanel, SWT.NULL);
autoSpeedDisabledPanel.setLayout(new GridLayout());
Label disabled = new Label(autoSpeedDisabledPanel, SWT.NULL);
disabled.setEnabled(false);
Messages.setLanguageText(disabled, "SpeedView.stats.autospeed.disabled");
Utils.setLayoutData(disabled, new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL));
autoSpeedPanelLayout.topControl = speedManager.isAvailable() ? autoSpeedInfoPanel : autoSpeedDisabledPanel;
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 8;
Legend.createLegendComposite(autoSpeedInfoPanel, PingGraphic.defaultColors, new String[] { "TransferStatsView.legend.pingaverage", "TransferStatsView.legend.ping1", "TransferStatsView.legend.ping2", "TransferStatsView.legend.ping3" }, gridData);
}
use of org.eclipse.swt.widgets.Canvas in project webtools.sourceediting by eclipse.
the class ADTFloatingToolbar method createControl.
public Control createControl(Composite composite) {
Canvas canvas = new Canvas(composite, SWT.NONE);
canvas.setBackground(ColorConstants.white);
setControl(canvas);
return getControl();
}
use of org.eclipse.swt.widgets.Canvas in project org.csstudio.display.builder by kasemir.
the class LEDRepresentation method createSWTControl.
@Override
protected Canvas createSWTControl(final Composite parent) throws Exception {
createColors();
// Unfortunately, the canvas is not transparent..
final Canvas canvas = new Canvas(parent, SWT.NO_FOCUS | SWT.NO_BACKGROUND | SWT.TRANSPARENT);
canvas.addPaintListener(this::doPaint);
canvas.addDisposeListener((e) -> {
for (final Color color : colors) color.dispose();
});
return canvas;
}
use of org.eclipse.swt.widgets.Canvas in project netxms by netxms.
the class LineChart method setZoomEnabled.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.charts.api.HistoricalDataChart#setZoomEnabled(boolean)
*/
@Override
public void setZoomEnabled(boolean enableZoom) {
this.zoomEnabled = enableZoom;
final Canvas plotArea = getPlotArea();
if (enableZoom) {
plotArea.addMouseListener(zoomMouseListener);
plotArea.addPaintListener(zoomPaintListener);
} else {
plotArea.removeMouseListener(zoomMouseListener);
plotArea.removePaintListener(zoomPaintListener);
}
}
Aggregations