Package cz.vutbr.fit.layout.impl
Class DefaultGridTopology
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.AreaListGridTopology
-
- cz.vutbr.fit.layout.impl.DefaultGridTopology
-
- All Implemented Interfaces:
AreaTopology
public class DefaultGridTopology extends AreaListGridTopology
The default topology that creates a grid of child areas within a parent area.- Author:
- burgetr
-
-
Constructor Summary
Constructors Constructor Description DefaultGridTopology(Area area)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RectangularcomputeAreaBounds()Obtains the absolute bounds of the parent area where the child areas are positioned.voiddrawLayout(OutputDisplay disp)Graphically displays the topology on a graphical output device.ContentRectfindAreaAt(int x, int y)Finds an area at the specified position in the grid.AreagetArea()RectangulargetPosition(ContentRect area)Obtains the position of the given area within this topology.booleanisDirty()voidsetAreas(List<ContentRect> areas)voidsetDirty(boolean dirty)RectangulartoPixelPosition(Rectangular gp)Translates the bounds in the topology to pixel bounds.RectangulartoPixelPositionAbsolute(Rectangular gp)Translates the bounds in the topology to absolute pixel bounds.voidupdate()Recomputes the topology.-
Methods inherited from class cz.vutbr.fit.layout.impl.AreaListGridTopology
findAllAreasAt, findAllAreasIntersecting, getAreas, getPositionMap, getTopologyHeight, getTopologyPosition, getTopologyWidth, setPosition, toTopologyX, toTopologyY
-
-
-
-
Constructor Detail
-
DefaultGridTopology
public DefaultGridTopology(Area area)
-
-
Method Detail
-
getArea
public Area getArea()
-
isDirty
public boolean isDirty()
-
setDirty
public void setDirty(boolean dirty)
-
setAreas
public void setAreas(List<ContentRect> areas)
- Overrides:
setAreasin classAreaListGridTopology
-
getPosition
public Rectangular getPosition(ContentRect area)
Description copied from interface:AreaTopologyObtains the position of the given area within this topology.- Specified by:
getPositionin interfaceAreaTopology- Overrides:
getPositionin classAreaListGridTopology- Parameters:
area- The area whose position we want to obtain.- Returns:
- The area position in this topology or
nullwhen the area position is not described by this topology.
-
findAreaAt
public ContentRect findAreaAt(int x, int y)
Description copied from interface:AreaTopologyFinds an area at the specified position in the grid. If there are multiple areas sharing the same position, the first of them is returned in a non-deterministic way. Therefore, this method should be used for topologies that do not allow overlapping areas.- Specified by:
findAreaAtin interfaceAreaTopology- Overrides:
findAreaAtin classAreaListGridTopology- Parameters:
x- the x coordinate of the grid celly- the y coordinate of the grid cell- Returns:
- the area at the specified position or
nullwhen there is no such area
-
toPixelPosition
public Rectangular toPixelPosition(Rectangular gp)
Description copied from interface:AreaTopologyTranslates the bounds in the topology to pixel bounds.- Specified by:
toPixelPositionin interfaceAreaTopology- Overrides:
toPixelPositionin classAreaListGridTopology- Parameters:
gp- the position within the topology- Returns:
- the pixle position
-
toPixelPositionAbsolute
public Rectangular toPixelPositionAbsolute(Rectangular gp)
Description copied from interface:AreaTopologyTranslates the bounds in the topology to absolute pixel bounds.- Specified by:
toPixelPositionAbsolutein interfaceAreaTopology- Overrides:
toPixelPositionAbsolutein classAreaListGridTopology- Parameters:
gp- the position within the topology- Returns:
- the pixle position
-
drawLayout
public void drawLayout(OutputDisplay disp)
Description copied from interface:AreaTopologyGraphically displays the topology on a graphical output device.- Specified by:
drawLayoutin interfaceAreaTopology- Overrides:
drawLayoutin classAreaListGridTopology- Parameters:
disp- the ouptut display to be used
-
update
public void update()
Description copied from interface:AreaTopologyRecomputes the topology. This should be used when the underlying areas have changed (some areas have been added, removed or resized).- Specified by:
updatein interfaceAreaTopology- Overrides:
updatein classAreaListGridTopology
-
computeAreaBounds
protected Rectangular computeAreaBounds()
Description copied from class:AreaListGridTopologyObtains the absolute bounds of the parent area where the child areas are positioned.- Overrides:
computeAreaBoundsin classAreaListGridTopology- Returns:
- The absloute area bounds in pixels.
-
-