twaver.network
Class UIBounds

java.lang.Object
  extended by twaver.Size
      extended by twaver.Rect
          extended by twaver.network.UIBounds
All Implemented Interfaces:
twaver.core.topo.IShape, IStruct, ISerializable

public class UIBounds
extends Rect

UI元素范围,继承于矩形,为UI主体部分的范围大小,主体之外还可设置padding, selection border和outline,共同构成UI的范围信息 UI范围分四种,从小到大分别为:body,fill bounds, content bounds, view bounds fill bounds = body + padding content bounds = fill bounds + outline view bounds = content bounds + selection border

 ----------------------
 |  selectionBorder   |
 | ------------------ |
 | |     outline    | |
 | | -------------- | |
 | | |   padding  | | |
 | | |  --------  | | |
 | | |  | body |  | | |
 | | |  --------  | | |
 | | |fill bounds | | |
 | | -------------- | |
 | | content bounds | |
 | |----------------| |
 |     view bounds    |
 ---------------------|
 


Field Summary
 
Fields inherited from class twaver.Rect
x, y
 
Fields inherited from class twaver.Size
height, width
 
Constructor Summary
UIBounds()
           
 
Method Summary
 UIBounds clone()
          拷贝一份新的数据,避免对原始数据的更改
 Rect getContentBounds()
          content bounds = fill bounds + outline
 Rect getFillBounds()
          fill bounds = body + padding
 Rect getLayoutBounds()
          布局范围,与content bounds相同
 float getOutline()
           selectionBorder ------------------ | outline | | ------------ | | | padding | | | | -------- | | | | | body | | | | | -------- | | | ------------ | |----------------|
 Insets getPadding()
           selectionBorder ------------------ | outline | | ------------ | | | padding | | | | -------- | | | | | body | | | | | -------- | | | ------------ | |----------------|
 float getSelectionBorder()
           selectionBorder ------------------ | outline | | ------------ | | | padding | | | | -------- | | | | | body | | | | | -------- | | | ------------ | |----------------|
 Rect getViewBounds()
          UI总计范围 view bounds = content bounds + selection border
 boolean setOutline(float outline)
          边框宽度
 void setPadding(Insets padding)
          填充间隙
 boolean setSelectionBorder(float selectionBorder)
          选中边框宽度
 
Methods inherited from class twaver.Rect
add, add, add, contains, deserialize, equals, equals, getBottom, getCenter, getCenterX, getCenterY, getLeft, getLocation, getRight, getTop, getX, getY, grow, grow, grow, intersection, intersects, intersects, intersects, intersects, intersects, isEmpty, offset, offset, reset, serialize, set, set, set, toGraphicRect, toGraphicRectF, toString, translate, union
 
Methods inherited from class twaver.Size
setHeight, setWidth
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UIBounds

public UIBounds()
Method Detail

setPadding

public void setPadding(Insets padding)
填充间隙
   selectionBorder
 ------------------
 |     outline    |
 |  ------------  |
 |  |  padding |  |
 |  | -------- |  |
 |  | | body | |  |
 |  | -------- |  |
 |  ------------  |
 |----------------|
 

Parameters:
padding - 填充间距
See Also:
getPadding(), getFillBounds(), getContentBounds(), getViewBounds()

getPadding

public Insets getPadding()
   selectionBorder
 ------------------
 |     outline    |
 |  ------------  |
 |  |  padding |  |
 |  | -------- |  |
 |  | | body | |  |
 |  | -------- |  |
 |  ------------  |
 |----------------|
 

Returns:
填充间隙
See Also:
setPadding(Insets), getFillBounds(), getContentBounds(), getViewBounds()

setSelectionBorder

public boolean setSelectionBorder(float selectionBorder)
选中边框宽度
   selectionBorder
 ------------------
 |     outline    |
 |  ------------  |
 |  |  padding |  |
 |  | -------- |  |
 |  | | body | |  |
 |  | -------- |  |
 |  ------------  |
 |----------------|
 

Parameters:
selectionBorder - 选中边框宽度
Returns:
是否设置成功
See Also:
getViewBounds()

getSelectionBorder

public float getSelectionBorder()
   selectionBorder
 ------------------
 |     outline    |
 |  ------------  |
 |  |  padding |  |
 |  | -------- |  |
 |  | | body | |  |
 |  | -------- |  |
 |  ------------  |
 |----------------|
 

Returns:
选中边框宽度
See Also:
setSelectionBorder(float), getViewBounds()

setOutline

public boolean setOutline(float outline)
边框宽度
   selectionBorder
 ------------------
 |     outline    |
 |  ------------  |
 |  |  padding |  |
 |  | -------- |  |
 |  | | body | |  |
 |  | -------- |  |
 |  ------------  |
 |----------------|
 

Parameters:
outline - 边框宽度
Returns:
是否设置成功
See Also:
getContentBounds(), getViewBounds()

getOutline

public float getOutline()
   selectionBorder
 ------------------
 |     outline    |
 |  ------------  |
 |  |  padding |  |
 |  | -------- |  |
 |  | | body | |  |
 |  | -------- |  |
 |  ------------  |
 |----------------|
 

Returns:
边框宽度

getFillBounds

public Rect getFillBounds()
fill bounds = body + padding

Returns:
UI填充范围
See Also:
setPadding(Insets), getPadding()

getContentBounds

public Rect getContentBounds()
content bounds = fill bounds + outline

Returns:
UI内容范围
See Also:
getFillBounds(), getOutline(), setOutline(float), getPadding(), setPadding(Insets)

getLayoutBounds

public Rect getLayoutBounds()
布局范围,与content bounds相同

Returns:
布局范围,与content bounds相同
See Also:
getContentBounds()

getViewBounds

public Rect getViewBounds()
UI总计范围 view bounds = content bounds + selection border

Returns:
UI总计范围
See Also:
getContentBounds(), getSelectionBorder(), setSelectionBorder(float)

clone

public UIBounds clone()
Description copied from interface: IStruct
拷贝一份新的数据,避免对原始数据的更改

Specified by:
clone in interface IStruct
Overrides:
clone in class Rect
Returns:
新拷贝的数据