public ViewPortHandler(FigureSWTApplet parent, List<Overlap> overlapFigures){
this.parent = parent;
this.figure = parent.getFigure();
this.overlapFigures = overlapFigures;
parentSize = new BoundingBox();
viewPortLocation = new Coordinate(0,0);
zoom = new Coordinate(1,1);
viewPortSize = new BoundingBox();
setScrollbars();
horBar = parent.getHorizontalBar();
verBar = parent.getVerticalBar();
int horY = horBar == null ? 0 : horBar.getSize().y;
int verX = verBar == null ? 0 : verBar.getSize().x;
scrollbarSize = new BoundingBox(verX, horY);
for(Dimension d: HOR_VER){
if(scrollBars.get(d) != null){
scrollBars.get(d).setVisible(false);
}
}
if(horBar != null){
horBar.addSelectionListener(this);
}
if(verBar != null){
verBar.addSelectionListener(this);
}
scrollBarsVisible = new TwoDimensional<Boolean>(false, false);
scrollableMinSize = new BoundingBox(MIN_SIZE + scrollbarSize.getX(), MIN_SIZE+ scrollbarSize.getY());
swtVisiblityMangager = new SWTElementsVisibilityManager();
zorderManager = new SWTZOrderManager(parent,overlapFigures);
gc = new SWTGraphicsContext();
topLevel = new TransformMatrix();
viewPortRectangle = new Rectangle(viewPortLocation, viewPortSize);