From 0d01d14e50be613ebd8956fd96fcbae6776d06ed Mon Sep 17 00:00:00 2001 From: Amit Kumar Mondal <mondal@fortiss.org> Date: Wed, 30 Mar 2016 12:39:14 +0000 Subject: [PATCH] Commented Zoom-related methods and statements --- .../builder/SpiderChartBuilder.java | 4 +- .../spiderchart/swt/SpiderChartViewer.java | 175 ++++++++++-------- 2 files changed, 96 insertions(+), 83 deletions(-) diff --git a/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/builder/SpiderChartBuilder.java b/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/builder/SpiderChartBuilder.java index 419f0434d..d92659d49 100644 --- a/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/builder/SpiderChartBuilder.java +++ b/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/builder/SpiderChartBuilder.java @@ -18,7 +18,7 @@ $Id: CLASS.java 11213 2016-03-04 16:27:08Z MONDAL $ package org.fortiss.tooling.spiderchart.builder; import static java.util.Objects.requireNonNull; -import static org.fortiss.tooling.spiderchart.gc.AbstractChartColor.ANTIQUEWHITE; +import static org.fortiss.tooling.spiderchart.gc.AbstractChartColor.WHITE; import static org.fortiss.tooling.spiderchart.gc.AbstractChartColor.YELLOW; import static org.fortiss.tooling.spiderchart.gc.AbstractGraphicsSupplier.getColor; import static org.fortiss.tooling.spiderchart.style.FillStyle.GRADIENT_VERTICAL; @@ -90,7 +90,7 @@ public final class SpiderChartBuilder { this.chart = new SpiderChart(chartConfiguration.getTitle(), chartConfiguration.getPlotter()); this.chart.setBackStyle(new FillStyle(getColor(YELLOW))); - this.chart.setBackgroundCanvasColor(ANTIQUEWHITE); + this.chart.setBackgroundCanvasColor(WHITE); this.chart.getBackStyle().setGradientType(GRADIENT_VERTICAL); this.chart.setLegend(chartConfiguration.getLegend()); this.chart.setRepaintAll(true); diff --git a/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/swt/SpiderChartViewer.java b/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/swt/SpiderChartViewer.java index 8c425269d..9b2dd020f 100644 --- a/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/swt/SpiderChartViewer.java +++ b/org.fortiss.tooling.spiderchart.ui/trunk/src/org/fortiss/tooling/spiderchart/swt/SpiderChartViewer.java @@ -25,8 +25,6 @@ import static org.eclipse.swt.SWT.VERTICAL; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -129,81 +127,82 @@ public final class SpiderChartViewer extends Composite { this.vSlider = new Slider(this, VERTICAL); this.canvas.setFocus(); - this.zoomPanel = new Composite(this, NONE); - this.zoomPanel.setSize(90, this.scrollBarWidth); - this.zoomInButton = new Button(this.zoomPanel, NONE); - this.zoomInButton.setLocation(0, 0); - this.zoomInButton.setText("Maximize"); - - this.zoomInButton.setSize(25, this.scrollBarWidth); - this.zoomOutButton = new Button(this.zoomPanel, NONE); - this.zoomOutButton.setLocation(26, 0); - this.zoomOutButton.setSize(25, this.scrollBarWidth); - this.zoomOutButton.setText("Minimize"); - this.zoom = new Label(this.zoomPanel, 16777216); - this.zoom.setLocation(52, 0); - this.zoom.setSize(38, this.scrollBarWidth); + // this.zoomPanel = new Composite(this, NONE); + // this.zoomPanel.setSize(90, this.scrollBarWidth); + // this.zoomInButton = new Button(this.zoomPanel, NONE); + // this.zoomInButton.setLocation(0, 0); + // this.zoomInButton.setText("Maximize"); + // + // this.zoomInButton.setSize(25, this.scrollBarWidth); + // this.zoomOutButton = new Button(this.zoomPanel, NONE); + // this.zoomOutButton.setLocation(26, 0); + // this.zoomOutButton.setSize(25, this.scrollBarWidth); + // this.zoomOutButton.setText("Minimize"); + // this.zoom = new Label(this.zoomPanel, 16777216); + // this.zoom.setLocation(52, 0); + // this.zoom.setSize(38, this.scrollBarWidth); + // + // this.zoom.setText("" + this.currentZoom + " %"); + // + // this.zoomOutButton.addSelectionListener(new SelectionListener() { + // /** {@inheritDoc} */ + // @Override + // public void widgetDefaultSelected(final SelectionEvent e) { + // // Not used + // } + // + // /** {@inheritDoc} */ + // @Override + // public void widgetSelected(final SelectionEvent e) { + // SpiderChartViewer.this.zoomOut(); + // } + // }); + // this.zoomInButton.addSelectionListener(new SelectionListener() { + // /** {@inheritDoc} */ + // @Override + // public void widgetDefaultSelected(final SelectionEvent e) { + // // Not used + // } + // + // /** {@inheritDoc} */ + // @Override + // public void widgetSelected(final SelectionEvent e) { + // SpiderChartViewer.this.zoomIn(); + // } + // }); + // this.hSlider.addSelectionListener(new SelectionListener() { + // /** {@inheritDoc} */ + // @Override + // public void widgetDefaultSelected(final SelectionEvent e) { + // // Not used + // } + // + // /** {@inheritDoc} */ + // @Override + // public void widgetSelected(final SelectionEvent e) { + // if(SpiderChartViewer.this.canvas.getChart() == null) { + // return; + // } + // SpiderChartViewer.this.hSliderScroll(); + // } + // }); + // this.vSlider.addSelectionListener(new SelectionListener() { + // /** {@inheritDoc} */ + // @Override + // public void widgetDefaultSelected(final SelectionEvent e) { + // // Not used + // } + // + // /** {@inheritDoc} */ + // @Override + // public void widgetSelected(final SelectionEvent e) { + // if(SpiderChartViewer.this.canvas.getChart() == null) { + // return; + // } + // SpiderChartViewer.this.vSliderScroll(); + // } + // }); - this.zoom.setText("" + this.currentZoom + " %"); - - this.zoomOutButton.addSelectionListener(new SelectionListener() { - /** {@inheritDoc} */ - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - // Not used - } - - /** {@inheritDoc} */ - @Override - public void widgetSelected(final SelectionEvent e) { - SpiderChartViewer.this.zoomOut(); - } - }); - this.zoomInButton.addSelectionListener(new SelectionListener() { - /** {@inheritDoc} */ - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - // Not used - } - - /** {@inheritDoc} */ - @Override - public void widgetSelected(final SelectionEvent e) { - SpiderChartViewer.this.zoomIn(); - } - }); - this.hSlider.addSelectionListener(new SelectionListener() { - /** {@inheritDoc} */ - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - // Not used - } - - /** {@inheritDoc} */ - @Override - public void widgetSelected(final SelectionEvent e) { - if(SpiderChartViewer.this.canvas.getChart() == null) { - return; - } - SpiderChartViewer.this.hSliderScroll(); - } - }); - this.vSlider.addSelectionListener(new SelectionListener() { - /** {@inheritDoc} */ - @Override - public void widgetDefaultSelected(final SelectionEvent e) { - // Not used - } - - /** {@inheritDoc} */ - @Override - public void widgetSelected(final SelectionEvent e) { - if(SpiderChartViewer.this.canvas.getChart() == null) { - return; - } - SpiderChartViewer.this.vSliderScroll(); - } - }); this.addControlListener(new ControlListener() { /** {@inheritDoc} */ @Override @@ -217,8 +216,9 @@ public final class SpiderChartViewer extends Composite { if(SpiderChartViewer.this.canvas.getChart() == null) { return; } - SpiderChartViewer.this.placeZoomControls(); - SpiderChartViewer.this.updateSize(); + setCanvasSize(); + // SpiderChartViewer.this.placeZoomControls(); + // SpiderChartViewer.this.updateSize(); } }); this.defaultCursor = new Cursor(parent.getDisplay(), CURSOR_ARROW); @@ -383,6 +383,10 @@ public final class SpiderChartViewer extends Composite { if(this.canvas.getChart().getVirtualHeight() > 0) { vSliderWidth = this.scrollBarWidth; } + System.out.println("X ==>" + this.getSize().x); + System.out.println("vSliderWidth ==>" + vSliderWidth); + System.out.println("hSliderHeight ==>" + hSliderHeight); + System.out.println("Y ==>" + this.getSize().y); this.canvas.setSize(this.getSize().x - vSliderWidth, this.getSize().y - hSliderHeight); this.canvas.setLocation(0, 0); @@ -456,13 +460,22 @@ public final class SpiderChartViewer extends Composite { this.originalWidth = this.canvas.getChart().getVirtualWidth(); this.resetChart(); - this.placeZoomControls(); - this.updateSize(); + setCanvasSize(); + // this.placeZoomControls(); + // this.updateSize(); if(this.changePointer) { this.canvas.getChart().addChartListener(this.chartAdapter); } } + /** + * + */ + private void setCanvasSize() { + this.canvas.setSize(this.getSize().x, this.getSize().y); + this.canvas.setLocation(0, 0); + } + /** setter for current zoom percentage */ public void setCurrentZoom(final int currentZoom) { this.currentZoom = currentZoom; @@ -629,7 +642,7 @@ public final class SpiderChartViewer extends Composite { /** zoom updated */ private void zoomUpdated() { this.zoom.setText("" + this.currentZoom + " %"); - this.updateSize(); + // this.updateSize(); this.canvas.redraw(); } } -- GitLab