Skip to content
Snippets Groups Projects
Commit 0d01d14e authored by Amit Kumar Mondal's avatar Amit Kumar Mondal
Browse files

Commented Zoom-related methods and statements

parent b476f387
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ $Id: CLASS.java 11213 2016-03-04 16:27:08Z MONDAL $ ...@@ -18,7 +18,7 @@ $Id: CLASS.java 11213 2016-03-04 16:27:08Z MONDAL $
package org.fortiss.tooling.spiderchart.builder; package org.fortiss.tooling.spiderchart.builder;
import static java.util.Objects.requireNonNull; 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.AbstractChartColor.YELLOW;
import static org.fortiss.tooling.spiderchart.gc.AbstractGraphicsSupplier.getColor; import static org.fortiss.tooling.spiderchart.gc.AbstractGraphicsSupplier.getColor;
import static org.fortiss.tooling.spiderchart.style.FillStyle.GRADIENT_VERTICAL; import static org.fortiss.tooling.spiderchart.style.FillStyle.GRADIENT_VERTICAL;
...@@ -90,7 +90,7 @@ public final class SpiderChartBuilder { ...@@ -90,7 +90,7 @@ public final class SpiderChartBuilder {
this.chart = this.chart =
new SpiderChart(chartConfiguration.getTitle(), chartConfiguration.getPlotter()); new SpiderChart(chartConfiguration.getTitle(), chartConfiguration.getPlotter());
this.chart.setBackStyle(new FillStyle(getColor(YELLOW))); this.chart.setBackStyle(new FillStyle(getColor(YELLOW)));
this.chart.setBackgroundCanvasColor(ANTIQUEWHITE); this.chart.setBackgroundCanvasColor(WHITE);
this.chart.getBackStyle().setGradientType(GRADIENT_VERTICAL); this.chart.getBackStyle().setGradientType(GRADIENT_VERTICAL);
this.chart.setLegend(chartConfiguration.getLegend()); this.chart.setLegend(chartConfiguration.getLegend());
this.chart.setRepaintAll(true); this.chart.setRepaintAll(true);
......
...@@ -25,8 +25,6 @@ import static org.eclipse.swt.SWT.VERTICAL; ...@@ -25,8 +25,6 @@ import static org.eclipse.swt.SWT.VERTICAL;
import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener; 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.graphics.Cursor;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
...@@ -129,81 +127,82 @@ public final class SpiderChartViewer extends Composite { ...@@ -129,81 +127,82 @@ public final class SpiderChartViewer extends Composite {
this.vSlider = new Slider(this, VERTICAL); this.vSlider = new Slider(this, VERTICAL);
this.canvas.setFocus(); this.canvas.setFocus();
this.zoomPanel = new Composite(this, NONE); // this.zoomPanel = new Composite(this, NONE);
this.zoomPanel.setSize(90, this.scrollBarWidth); // this.zoomPanel.setSize(90, this.scrollBarWidth);
this.zoomInButton = new Button(this.zoomPanel, NONE); // this.zoomInButton = new Button(this.zoomPanel, NONE);
this.zoomInButton.setLocation(0, 0); // this.zoomInButton.setLocation(0, 0);
this.zoomInButton.setText("Maximize"); // this.zoomInButton.setText("Maximize");
//
this.zoomInButton.setSize(25, this.scrollBarWidth); // this.zoomInButton.setSize(25, this.scrollBarWidth);
this.zoomOutButton = new Button(this.zoomPanel, NONE); // this.zoomOutButton = new Button(this.zoomPanel, NONE);
this.zoomOutButton.setLocation(26, 0); // this.zoomOutButton.setLocation(26, 0);
this.zoomOutButton.setSize(25, this.scrollBarWidth); // this.zoomOutButton.setSize(25, this.scrollBarWidth);
this.zoomOutButton.setText("Minimize"); // this.zoomOutButton.setText("Minimize");
this.zoom = new Label(this.zoomPanel, 16777216); // this.zoom = new Label(this.zoomPanel, 16777216);
this.zoom.setLocation(52, 0); // this.zoom.setLocation(52, 0);
this.zoom.setSize(38, this.scrollBarWidth); // 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() { this.addControlListener(new ControlListener() {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
...@@ -217,8 +216,9 @@ public final class SpiderChartViewer extends Composite { ...@@ -217,8 +216,9 @@ public final class SpiderChartViewer extends Composite {
if(SpiderChartViewer.this.canvas.getChart() == null) { if(SpiderChartViewer.this.canvas.getChart() == null) {
return; return;
} }
SpiderChartViewer.this.placeZoomControls(); setCanvasSize();
SpiderChartViewer.this.updateSize(); // SpiderChartViewer.this.placeZoomControls();
// SpiderChartViewer.this.updateSize();
} }
}); });
this.defaultCursor = new Cursor(parent.getDisplay(), CURSOR_ARROW); this.defaultCursor = new Cursor(parent.getDisplay(), CURSOR_ARROW);
...@@ -383,6 +383,10 @@ public final class SpiderChartViewer extends Composite { ...@@ -383,6 +383,10 @@ public final class SpiderChartViewer extends Composite {
if(this.canvas.getChart().getVirtualHeight() > 0) { if(this.canvas.getChart().getVirtualHeight() > 0) {
vSliderWidth = this.scrollBarWidth; 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.setSize(this.getSize().x - vSliderWidth, this.getSize().y - hSliderHeight);
this.canvas.setLocation(0, 0); this.canvas.setLocation(0, 0);
...@@ -456,13 +460,22 @@ public final class SpiderChartViewer extends Composite { ...@@ -456,13 +460,22 @@ public final class SpiderChartViewer extends Composite {
this.originalWidth = this.canvas.getChart().getVirtualWidth(); this.originalWidth = this.canvas.getChart().getVirtualWidth();
this.resetChart(); this.resetChart();
this.placeZoomControls(); setCanvasSize();
this.updateSize(); // this.placeZoomControls();
// this.updateSize();
if(this.changePointer) { if(this.changePointer) {
this.canvas.getChart().addChartListener(this.chartAdapter); 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 */ /** setter for current zoom percentage */
public void setCurrentZoom(final int currentZoom) { public void setCurrentZoom(final int currentZoom) {
this.currentZoom = currentZoom; this.currentZoom = currentZoom;
...@@ -629,7 +642,7 @@ public final class SpiderChartViewer extends Composite { ...@@ -629,7 +642,7 @@ public final class SpiderChartViewer extends Composite {
/** zoom updated */ /** zoom updated */
private void zoomUpdated() { private void zoomUpdated() {
this.zoom.setText("" + this.currentZoom + " %"); this.zoom.setText("" + this.currentZoom + " %");
this.updateSize(); // this.updateSize();
this.canvas.redraw(); this.canvas.redraw();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment