public class BoxBag extends AbstractBox implements Cloneable, Resizable
AbstractBox
that contains
a collection of "boxes" (objects also derived from AbstractBox). The boxes are stores into
a protected ArrayList
. The class implements methods to add, remove and
retrieve boxes, and to manage some of its properties like visibility, status, location
and size.Rectangle2D.Double, Rectangle2D.Float
Modifier and Type | Field and Description |
---|---|
protected AbstractBox |
backgroundBox |
protected ArrayList<AbstractBox> |
cells |
protected Rectangle2D |
preferredBounds |
border, shape, specialShape
height, width, x, y
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
BoxBag(AbstractBox parent,
JComponent container,
BoxBase boxBase)
Creates new ActiveBoxBag
|
Modifier and Type | Method and Description |
---|---|
void |
addBox(AbstractBox bx) |
int |
boxIndex(Object bx) |
Object |
clone() |
int |
countInactiveCells() |
void |
end() |
void |
ensureCapacity(int n) |
AbstractBox |
findBox(Point2D p) |
AbstractBox |
getBackgroundBox() |
AbstractBox |
getBox(int id) |
Dimension |
getMinimumSize() |
int |
getNumCells() |
Dimension |
getPreferredSize() |
Dimension |
getScaledSize(double scale) |
static Dimension |
layoutDouble(Dimension desiredMaxSize,
Resizable rsA,
Resizable rsB,
int boxGridPos,
int margin) |
static Dimension |
layoutSingle(Dimension preferredMaxSize,
Resizable rs,
int margin) |
void |
recalcSize() |
void |
setAlternative(boolean newVal) |
void |
setBackgroundBox(AbstractBox bx) |
void |
setBorder(boolean newVal) |
void |
setBounds(Rectangle2D r) |
void |
setBoxBase(BoxBase setBb) |
void |
setContainer(JComponent newContainer) |
void |
setVisible(boolean newVal) |
boolean |
update(Graphics2D g2,
Rectangle dirtyRegion,
ImageObserver io) |
boolean |
updateContent(Graphics2D g2,
Rectangle dirtyRegion,
ImageObserver io) |
checkHostedComponent, contains, drawBorder, finalize, getAbsoluteLocation, getAbsoulteMiddleLocation, getBorderBounds, getBoxBaseResolve, getBoxBaseX, getContainerResolve, getContainerX, getHostedComponent, getLocation, getParent, getShape, hasBorder, isAlternative, isFocused, isInactive, isInverted, isMarked, isTemporaryHidden, isVisible, repaint, setBounds, setFocused, setHostedComponent, setInactive, setInverted, setLocation, setLocation, setMarked, setParent, setShape, setSize, setSize, setTemporaryHidden, translate
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, toString
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
getBounds, getBounds2D, setBounds
protected ArrayList<AbstractBox> cells
protected Rectangle2D preferredBounds
protected AbstractBox backgroundBox
public BoxBag(AbstractBox parent, JComponent container, BoxBase boxBase)
public Object clone()
clone
in class AbstractBox
public void setContainer(JComponent newContainer)
setContainer
in class AbstractBox
public void end()
end
in class AbstractBox
public Dimension getPreferredSize()
getPreferredSize
in interface Resizable
public Dimension getMinimumSize()
getMinimumSize
in interface Resizable
public Dimension getScaledSize(double scale)
getScaledSize
in interface Resizable
public void ensureCapacity(int n)
public void addBox(AbstractBox bx)
public int boxIndex(Object bx)
public AbstractBox getBox(int id)
public AbstractBox getBackgroundBox()
public void setBackgroundBox(AbstractBox bx)
public void recalcSize()
public int getNumCells()
public void setBorder(boolean newVal)
setBorder
in class AbstractBox
public void setVisible(boolean newVal)
setVisible
in class AbstractBox
public void setAlternative(boolean newVal)
setAlternative
in class AbstractBox
public void setBoxBase(BoxBase setBb)
setBoxBase
in class AbstractBox
public void setBounds(Rectangle2D r)
setBounds
in interface Resizable
setBounds
in class AbstractBox
public boolean update(Graphics2D g2, Rectangle dirtyRegion, ImageObserver io)
update
in class AbstractBox
public boolean updateContent(Graphics2D g2, Rectangle dirtyRegion, ImageObserver io)
updateContent
in class AbstractBox
public AbstractBox findBox(Point2D p)
public int countInactiveCells()
public static Dimension layoutSingle(Dimension preferredMaxSize, Resizable rs, int margin)
Copyright © 2004-15 Francesc Busquets (fbusquets@xtec.cat) & Departament d'Educació de la Generalitat de Catalunya (info@xtec.cat)
Licensed under the terms of the GNU General Public License.