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 Rectangular
computeAreaBounds()
Obtains the absolute bounds of the parent area where the child areas are positioned.void
drawLayout(OutputDisplay disp)
Graphically displays the topology on a graphical output device.ContentRect
findAreaAt(int x, int y)
Finds an area at the specified position in the grid.Area
getArea()
Rectangular
getPosition(ContentRect area)
Obtains the position of the given area within this topology.boolean
isDirty()
void
setAreas(List<ContentRect> areas)
void
setDirty(boolean dirty)
Rectangular
toPixelPosition(Rectangular gp)
Translates the bounds in the topology to pixel bounds.Rectangular
toPixelPositionAbsolute(Rectangular gp)
Translates the bounds in the topology to absolute pixel bounds.void
update()
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:
setAreas
in classAreaListGridTopology
-
getPosition
public Rectangular getPosition(ContentRect area)
Description copied from interface:AreaTopology
Obtains the position of the given area within this topology.- Specified by:
getPosition
in interfaceAreaTopology
- Overrides:
getPosition
in classAreaListGridTopology
- Parameters:
area
- The area whose position we want to obtain.- Returns:
- The area position in this topology or
null
when the area position is not described by this topology.
-
findAreaAt
public ContentRect findAreaAt(int x, int y)
Description copied from interface:AreaTopology
Finds 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:
findAreaAt
in interfaceAreaTopology
- Overrides:
findAreaAt
in 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
null
when there is no such area
-
toPixelPosition
public Rectangular toPixelPosition(Rectangular gp)
Description copied from interface:AreaTopology
Translates the bounds in the topology to pixel bounds.- Specified by:
toPixelPosition
in interfaceAreaTopology
- Overrides:
toPixelPosition
in classAreaListGridTopology
- Parameters:
gp
- the position within the topology- Returns:
- the pixle position
-
toPixelPositionAbsolute
public Rectangular toPixelPositionAbsolute(Rectangular gp)
Description copied from interface:AreaTopology
Translates the bounds in the topology to absolute pixel bounds.- Specified by:
toPixelPositionAbsolute
in interfaceAreaTopology
- Overrides:
toPixelPositionAbsolute
in classAreaListGridTopology
- Parameters:
gp
- the position within the topology- Returns:
- the pixle position
-
drawLayout
public void drawLayout(OutputDisplay disp)
Description copied from interface:AreaTopology
Graphically displays the topology on a graphical output device.- Specified by:
drawLayout
in interfaceAreaTopology
- Overrides:
drawLayout
in classAreaListGridTopology
- Parameters:
disp
- the ouptut display to be used
-
update
public void update()
Description copied from interface:AreaTopology
Recomputes the topology. This should be used when the underlying areas have changed (some areas have been added, removed or resized).- Specified by:
update
in interfaceAreaTopology
- Overrides:
update
in classAreaListGridTopology
-
computeAreaBounds
protected Rectangular computeAreaBounds()
Description copied from class:AreaListGridTopology
Obtains the absolute bounds of the parent area where the child areas are positioned.- Overrides:
computeAreaBounds
in classAreaListGridTopology
- Returns:
- The absloute area bounds in pixels.
-
-