org.kwis.msp.lwc
Class ContainerComponent

java.lang.Object
  |
  +--org.kwis.msp.lwc.Component
        |
        +--org.kwis.msp.lwc.ContainerComponent
Direct Known Subclasses:
FormComponent, ShellComponent

public abstract class ContainerComponent
extends Component

다른 컴포넌트의 상위 부모 컴포넌트가 될수 있는 컴포넌트. 자식 컴포넌트의 위치와 크기를 결정해 주며, 포커스 관리를 해줍니다. 컴포넌트는 addComponent함수로 자식 컴포넌트로 등록할 수 있으며, removeComponent함수로 삭제할 수 있습니다. 컴포넌트는 상위 부모 컴포넌트가 있으며, 그 맨 상위 부모 컴포넌트가 ShellComponent이며 show함수로 보여질 때 화면에 나타나게 됩니다. 컨테이너 컴포넌트는 layout함수를 통해서 하위 자식 컴포넌트들의 크기와 위치를 결정해줍니다. 컨테이너 내에는 인셋(Inset)이 있어 하위 자식 컴포넌트들이 인셋내부에만 나타나고, 인셋 밖에는 출력되지 않도록 되어 있습니다. 특정 컴포넌트가 키 입력을 받기 위해서는 setFocus 함수를 호출해 주어야만 합니다.

See Also:
ShellComponent, Component

Field Summary
protected  Component cmpFocus
           
protected  Component[] cmps
           
protected  short insetBottom
           
protected  short insetLeft
           
protected  short insetRight
           
protected  short insetTop
           
protected  int ncomp
           
protected  int offsetX
           
protected  int offsetY
           
protected  boolean useFrame
          프레임의 사용여부.
 
Fields inherited from class org.kwis.msp.lwc.Component
bg, evtListener, evtListenerObj, fg, FOCUS_NOTIFY, h, HAS_FOCUS_MASK, INPUT_MASK, KEY_NOTIFY, KEY_PRESSED, KEY_RELEASED, KEY_REPEATED, KEY_TYPED, LAYOUT_BOTTOM, LAYOUT_HCENTER, LAYOUT_LEFT, LAYOUT_RIGHT, LAYOUT_TOP, LAYOUT_VCENTER, mask, parent, POINT_DRAGGED, POINT_PRESSED, POINT_RELEASED, POINTER_NOTIFY, POS_MASK, PREFER_SIZE_MASK, prefH, prefW, SHOW_NOTIFY, SIZE_MASK, VALID_MASK, w, x, y
 
Constructor Summary
protected ContainerComponent()
           
 
Method Summary
 int addComponent(Component cmp)
          자식 컴포넌트를 하나 추가합니다.
 void addComponent(int index, Component cmp)
          자식 컴포넌트를 하나 추가합니다.
protected  void controlInset(boolean flag)
          ContainerComponent에서 사용할 테두리 두께값을 제어합니다.
 Component getComponent(int i)
          특정 stack 순서의 컴포넌트를 가져옵니다.
 int getIndexOf(Component cmp)
          컴포넌트의 stack 순서를 가져옵니다.
protected  Component getNextTraversalComponent()
          포커스 가질 수 있는 다음 컴포넌트를 돌려줍니다.
 int getNumberOfComponent()
          등록된 Component의 수를 수합니다
protected  Component getPrevTraversalComponent()
          포커스 가질 수 있는 이전 컴포넌트를 돌려줍니다.
protected  boolean keyNotify(int type, int key)
          키 입력을 받으면 호출됩니다.
protected  void paint(Graphics g)
           
protected  void paintFrame(Graphics g)
          useFrame의 인수를true으로 호출하는 경우에 화면을 그릴때 호출됩니다.
protected  boolean processEvent(int type, int subtype, int param1, int param2)
          이벤트를 처리합니다.
 void removeAllComponents()
          모든 컴포넌트를 삭제합니다.
 void removeComponent(Component cmp)
          지정된 컴포넌트를 삭제합니다.
 void removeComponent(int index)
          지정된 순서의 컴포넌트를 삭제합니다. index번째 있는 컴포넌트를 삭제합니다.
 void repaint()
          화면의 내용을 갱신할 필요가 있을때 부릅니다.
 void repaint(int x, int y, int w, int h)
          화면의 내용을 갱신할 필요가 있을때 부릅니다.
protected  boolean scrollTo(int dx, int dy)
          특정 위치로 화면을 이동합니다.
 void setComponent(int index, Component cmp)
          자식 컴포넌트를 하나 대치합니다.
 void useFrame(boolean useFrame)
          ContainterComponent에서 테두리를 화면에 출력할 것인지를 지정합니다.
 void validate()
          컴포넌트에 유효한 좌표와 크기를 가지게 합니다.
 
Methods inherited from class org.kwis.msp.lwc.Component
calcPreferredSize, canHandleInput, configure, focusNotify, getBackground, getCard, getForeground, getHeight, getPreferredHeight, getPreferredHeight, getPreferredWidth, getWidth, getX, getXOnScreen, getY, getYOnScreen, hasFocus, invalidate, isShown, isValid, layout, paintContent, pointerNotify, serviceRepaints, setBackground, setEventListener, setFocus, setForeground, showNotify, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cmps

protected Component[] cmps

ncomp

protected int ncomp

cmpFocus

protected Component cmpFocus

offsetX

protected int offsetX

offsetY

protected int offsetY

insetTop

protected short insetTop

insetBottom

protected short insetBottom

insetLeft

protected short insetLeft

insetRight

protected short insetRight

useFrame

protected boolean useFrame
프레임의 사용여부.
Constructor Detail

ContainerComponent

protected ContainerComponent()
Method Detail

addComponent

public void addComponent(int index,
                         Component cmp)
자식 컴포넌트를 하나 추가합니다. 지정한 위치에 cmp가 가르키는 컴포넌트를 추가합니다.

cmpnull인경우 NullPointerException이 발생합니다. 또한 cmp가 이미 다른 부모 컴포넌트를 가지는 경우 IllegalArgumentException이 발생 합니다.

index값이 '0'보다 작거나 추가된 컴포넌트의 갯수보다 큰 경우 IndexOutOfBoundsException이 발생합니다.

Parameters:
index - 넣을 위치
cmp - 넣을 컴포넌트
Throws:
IllegalArgumentException - cmp가 이미 다른 부모 컴포넌트를 가지고 있는 경우 발생
IndexOutOfBoundsException - index가 유효한 영역을 벗어나 있는 경우
NullPointerException - cmpnull인 경우

addComponent

public int addComponent(Component cmp)
자식 컴포넌트를 하나 추가합니다. 맨 위에 자식 컴포넌트를 추가합니다.
Parameters:
cmp - 추가할 자식 컴포넌트
Throws:
IllegalArgumentException - cmp가 이미 다른 부모 컴포넌트를 가지는 경우
NullPointerException - cmpnull인 경우

setComponent

public void setComponent(int index,
                         Component cmp)
자식 컴포넌트를 하나 대치합니다. 지정한 인덱스의 컴포넌트를 주어진 컴포넌트로로 대치합니다. cmpnull인경우 NullPointerException이 발생합니다. 또한 cmp가 이미 다른 부모 컴포넌트를 가지는 경우 IllegalArgumentException이 발생 합니다.

index값이 '0'보다 작거나 추가된 컴포넌트의 갯수보다 큰 경우 IndexOutOfBoundsException이 발생합니다.

Parameters:
index - 바꿀 위치
cmp - 바뀔 컴포넌트
Throws:
IllegalArgumentException - cmp가 이미 다른 부모 컴포넌트를 가지고 있는 경우
Component cmp)