Skip to content

Commit

Permalink
#28 Adapt Chronograph for Passage Operator
Browse files Browse the repository at this point in the history
Rename ChronographCanvas to Stage

Signed-off-by: Alexander Fedorov <[email protected]>
  • Loading branch information
ruspl-afed committed May 16, 2020
1 parent 3533591 commit 95d9747
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.eclipse.chronograph.internal.api.Styler;
import org.eclipse.chronograph.internal.api.providers.ContainerProvider;
import org.eclipse.chronograph.internal.base.UnitConverter;
import org.eclipse.chronograph.internal.swt.stage.ChronographCanvas;
import org.eclipse.chronograph.internal.swt.stage.Stage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
Expand All @@ -33,11 +33,11 @@
*
*/
public class SWTChronograph implements Chronograph {
private final ChronographCanvas stage;
private final Stage stage;
private final List<Styler> stylers;

public SWTChronograph(Composite parent, ContainerProvider provider) {
this.stage = new ChronographCanvas(parent, provider);
this.stage = new Stage(parent, provider);
this.stage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
this.stage.navigateToUnit(UnitConverter.localDatetoUnits(LocalDate.now().minusDays(7)));
stylers = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;

public final class ChronographCanvas extends Canvas {
public final class Stage extends Canvas {

private final AreaRectangle areaRectangle;
private final ActualBricks actualBricks;
Expand Down Expand Up @@ -86,11 +86,11 @@ public final class ChronographCanvas extends Canvas {

private static ChronographManagerRenderers INSTANCE = ChronographManagerRenderers.getInstance();

public ChronographCanvas(Composite parent, ContainerProvider provider) {
public Stage(Composite parent, ContainerProvider provider) {
this(parent, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED | SWT.V_SCROLL | SWT.H_SCROLL, provider);
}

public ChronographCanvas(Composite parent, int style, ContainerProvider provider) {
public Stage(Composite parent, int style, ContainerProvider provider) {
super(parent, style);
this.areaRectangle = new AreaRectangle();
this.actualBricks = new ActualBricks();
Expand Down Expand Up @@ -176,7 +176,7 @@ protected void horizontalScroll(Event event) {
return;
}
setPositionByX(scrollBarHorizontal.getSelection() * pxlHint * stageScale);
getHint();
applyHint();
redraw();
}

Expand Down Expand Up @@ -434,7 +434,7 @@ private void drawSelectedObjects(final GC gc, Area area, final Collection<? exte

public void navigateToUnit(int hint) {
pX = hint * pxlHint * stageScale;
getHint();
applyHint();
redraw();
}

Expand Down Expand Up @@ -502,11 +502,11 @@ public void redraw() {
super.redraw();
}

public int getPositionByX() {
int getPositionByX() {
return pX;
}

public void setPositionByX(int x) {
void setPositionByX(int x) {
this.pX = x;
}

Expand All @@ -515,7 +515,7 @@ public Rectangle getClientArea() {
return super.getClientArea();
}

public void getHint() {
void applyHint() {
pXhint = pX / (pxlHint * stageScale);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
*/
final class StageMouse implements MouseListener, MouseMoveListener, MouseTrackListener {

private ChronographCanvas stage;
private Stage stage;
private static final Cursor CURSOR_NONE = new Cursor(Display.getDefault(), SWT.NONE);
private static final Cursor CURSOR_HAND = new Cursor(Display.getDefault(), SWT.CURSOR_HAND);
private Point startPoint;
private Tracker tracker;
private boolean isMouseDown;
private int xPosition = 0;

public StageMouse(ChronographCanvas stage) {
public StageMouse(Stage stage) {
this.stage = stage;
}

Expand All @@ -59,7 +59,7 @@ public void mouseMove(MouseEvent me) {
deltaXPosition = 0;
}
stage.setPositionByX(deltaXPosition);
stage.getHint();
stage.applyHint();
stage.redraw();
stage.updateScrollers();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

final class StagePaint implements PaintListener {

private final ChronographCanvas sceneComposer;
private final Stage sceneComposer;

public StagePaint(ChronographCanvas sceneComposer) {
public StagePaint(Stage sceneComposer) {
this.sceneComposer = sceneComposer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

final class StageResize implements Listener {

private final ChronographCanvas stage;
private final Stage stage;

public StageResize(ChronographCanvas stage) {
public StageResize(Stage stage) {
this.stage = stage;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

final class StageWheel implements Listener {

private final ChronographCanvas stage;
private final Stage stage;

public StageWheel(ChronographCanvas stage) {
public StageWheel(Stage stage) {
this.stage = stage;
}

Expand Down

0 comments on commit 95d9747

Please sign in to comment.