org.jfree.experimental.swt.SWTUtils Java Examples

The following examples show how to use org.jfree.experimental.swt.SWTUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp = 
            (this.zoomPoint != null ? this.zoomPoint : 
                new org.eclipse.swt.graphics.Point(0,0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(), 
                SWTUtils.toAwtPoint(zp)); 
    }
}
 
Example #2
Source File: ChartComposite.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #3
Source File: ChartComposite.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #4
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #5
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #6
Source File: ChartComposite.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #7
Source File: ChartComposite.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #8
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #9
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #10
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp = 
            (this.zoomPoint != null ? this.zoomPoint : 
                new org.eclipse.swt.graphics.Point(0,0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(), 
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #11
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #12
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #13
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the domain axis.
 */
public void restoreAutoDomainBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomDomainAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #14
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Restores the auto-range calculation on the range axis.
 */
public void restoreAutoRangeBounds() {
    Plot p = this.chart.getPlot();
    if (p instanceof ValueAxisPlot) {
        Zoomable z = (Zoomable) p;
        // we need to guard against this.zoomPoint being null
        org.eclipse.swt.graphics.Point zp =
                (this.zoomPoint != null ? this.zoomPoint
                : new org.eclipse.swt.graphics.Point(0, 0));
        z.zoomRangeAxes(0.0, this.info.getPlotInfo(),
                SWTUtils.toAwtPoint(zp));
    }
}
 
Example #15
Source File: SWTOtherEditor.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Updates the chart.
 *
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));
}
 
Example #16
Source File: SWTOtherEditor.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new instance.
 * 
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));
    
    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, 
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());
    
    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE, 
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #17
Source File: SWTOtherEditor.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Updates the chart.
 * 
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));        
}
 
Example #18
Source File: SWTOtherEditor.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Updates the chart.
 *
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));
}
 
Example #19
Source File: SWTOtherEditor.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #20
Source File: SWTOtherEditor.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #21
Source File: SWTOtherEditor.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Updates the chart.
 *
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));
}
 
Example #22
Source File: SWTOtherEditor.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #23
Source File: SWTOtherEditor.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Updates the chart.
 *
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));
}
 
Example #24
Source File: SWTOtherEditor.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #25
Source File: SWTOtherEditor.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #26
Source File: SWTOtherEditor.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Updates the chart.
 *
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));
}
 
Example #27
Source File: SWTOtherEditor.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Updates the chart.
 *
 * @param chart  the chart.
 */
public void updateChartProperties(JFreeChart chart) {
    chart.setAntiAlias(this.antialias.getSelection());
    chart.setBackgroundPaint(SWTUtils.toAwtColor(
            this.backgroundPaintCanvas.getColor()));
}
 
Example #28
Source File: SWTOtherEditor.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example #29
Source File: SWTAxisEditor.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the current label font.
 *
 * @return The current label font.
 */
public java.awt.Font getTickLabelFont() {
    return SWTUtils.toAwtFont(getDisplay(), this.tickLabelFont, true);
}
 
Example #30
Source File: SWTAxisEditor.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the current label font.
 *
 * @return The current label font.
 */
public java.awt.Font getTickLabelFont() {
    return SWTUtils.toAwtFont(getDisplay(), this.tickLabelFont, true);
}