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 $
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);
......
......@@ -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();
}
}
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