Search in sources :

Example 1 with Scale

use of com.biglybt.ui.swt.components.graphics.Scale 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);
}
Also used : BufferedLabel(com.biglybt.ui.swt.components.BufferedLabel) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Canvas(org.eclipse.swt.widgets.Canvas) Color(org.eclipse.swt.graphics.Color) BufferedLabel(com.biglybt.ui.swt.components.BufferedLabel) Label(org.eclipse.swt.widgets.Label) TabFolder(org.eclipse.swt.widgets.TabFolder) ValueFormater(com.biglybt.ui.swt.components.graphics.ValueFormater) Scale(com.biglybt.ui.swt.components.graphics.Scale) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite)

Aggregations

BufferedLabel (com.biglybt.ui.swt.components.BufferedLabel)1 Scale (com.biglybt.ui.swt.components.graphics.Scale)1 ValueFormater (com.biglybt.ui.swt.components.graphics.ValueFormater)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 Color (org.eclipse.swt.graphics.Color)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Canvas (org.eclipse.swt.widgets.Canvas)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 TabFolder (org.eclipse.swt.widgets.TabFolder)1 TabItem (org.eclipse.swt.widgets.TabItem)1