org.kwis.msp.lwc
Class CommandBarComponent

java.lang.Object
  |
  +--org.kwis.msp.lwc.Component
        |
        +--org.kwis.msp.lwc.CommandBarComponent

public class CommandBarComponent
extends Component

Command 컴포넌트. 등록된 하나 이상의 커맨드를 바 형태로 구성합니다. 화면에 현재 화면에 사용자가 내릴 수 있는 명령어를 보여주며, 사용자로 부터 명령을 선택 받습니다. Active된 Index의 초기값은 -1입니다.


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
CommandBarComponent()
          커맨드 바 컴포넌트를 생성합니다.
 
Method Summary
 int addCommand(Command cmd)
          커맨드를 하나 추가 시킵니다.
 int getActiveIndex()
          선택된 커맨드의 인덱스를 돌려줍니다.
 Command getCommand(int index)
          커맨드를 돌려줍니다.
 int getPreferredHeight()
          컴포넌트의 적절한 높이를 결정합니다.
 int getPreferredHeight(int w)
          컴포넌트의 적절한 높이를 결정합니다.
 int getPreferredWidth()
          컴포넌트의 적절한 폭을 결정합니다.
 int getSize()
          등록된 커맨드의 개수를 구합니다
protected  boolean keyNotify(int type, int chr)
          키 입력을 받으면 호출됩니다.
 void paintContent(Graphics g)
          내부를 칠합니다.
protected  boolean pointerNotify(int type, int x, int y)
          포인터 입력을 받으면 호출됩니다.
 void removeAll()
          모든 커맨드를 삭제합니다.
 void removeCommand(Command cmd)
          커맨드를 삭제합니다.
 void setActiveIndex(int index)
          선택된 커맨드를 지정합니다.
 void setCommandListener(CommandListener cl, Object obj)
          커맨드 리스너를 지정합니다.
 
Methods inherited from class org.kwis.msp.lwc.Component
calcPreferredSize, canHandleInput, configure, focusNotify, getBackground, getCard, getForeground, getHeight, getWidth, getX, getXOnScreen, getY, getYOnScreen, hasFocus, invalidate, isShown, isValid, layout, processEvent, repaint, repaint, serviceRepaints, setBackground, setEventListener, setFocus, setForeground, showNotify, toString, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommandBarComponent

public CommandBarComponent()
커맨드 바 컴포넌트를 생성합니다.
Method Detail

getPreferredHeight

public int getPreferredHeight(int w)
Description copied from class: Component
컴포넌트의 적절한 높이를 결정합니다. 지정된 제한된 폭을 가질 경우의 컴포넌트의 높이를 돌려줍니다. 만일 LabelComponentTextFieldComponent, TextAreaComponent와 같이 포맷팅이 가능한 컴포넌트인 경우에는 가변 폭을 가질수가 있습니다. 가변 폭을 가지게 되면, 폭에 따라서 높이가 달라지게 됩니다. 이때 이 함수를 통해서 컴포넌트의 높이를 얻어 옵니다. 만일, w가 -1이 면 폭에 제한이 없는 것으로 계산됩니다.
Overrides:
getPreferredHeight in class Component
Following copied from class: org.kwis.msp.lwc.Component
Parameters:
w - 가변폭.
Returns:
컴포넌트의 높이.

getPreferredHeight

public int getPreferredHeight()
Description copied from class: Component
컴포넌트의 적절한 높이를 결정합니다. ContainerComponent에서 컴포넌트의 크기를 결정할 때에 이 함수가 돌려주는 값을 참조하여 결정합니다.
Overrides:
getPreferredHeight in class Component
Following copied from class: org.kwis.msp.lwc.Component
Returns:
컴포넌트의 높이

getPreferredWidth

public int getPreferredWidth()
Description copied from class: Component
컴포넌트의 적절한 폭을 결정합니다. Container에서 컴포넌트의 크기를 결정할 때에 이 함수가 돌려주는 값을 참조하여 결정합니다.
Overrides:
getPreferredWidth in class Component
Following copied from class: org.kwis.msp.lwc.Component
Returns:
컴포넌트의 폭.

getSize

public int getSize()
등록된 커맨드의 개수를 구합니다
Returns:
등록된 Command의 개수

addCommand

public int addCommand(Command cmd)
커맨드를 하나 추가 시킵니다. 초기에 커맨드가 추가된 상태에서는 Active된 Index는 -1입니다. setActiveIndex를 이용하여 원하는 인덱스의 Command를 Active하여야 합니다.
Parameters:
cmd - 추가할 커맨드
Returns:
추가된 Command의 Index , 실패한경우 -1을 리턴합니다.
See Also:
Command, setActiveIndex(int)

removeCommand

public void removeCommand(Command cmd)
커맨드를 삭제합니다. 지정한 커맨드를 삭제합니다.
Parameters:
cmd - 삭제할 커맨드
See Also:
Command

removeAll

public void removeAll()
모든 커맨드를 삭제합니다.
Parameters:
cmd - 삭제할 커맨드
See Also:
Command

setActiveIndex

public void setActiveIndex(int index)
선택된 커맨드를 지정합니다.
Parameters:
index - 선택할 커맨드의 인덱스

getActiveIndex

public int getActiveIndex()
선택된 커맨드의 인덱스를 돌려줍니다. 만일 선택된 인덱스가 없는 경우라면 -1을 돌려줍니다.
Returns:
선택된 커맨드의 인덱스

getCommand

public Command getCommand(int index)
커맨드를 돌려줍니다. 인덱스에 대응하는 커맨드를 돌려줍니다. 만일 해당하는 인덱스에 커맨드가 존재하지 않으면 null을 돌려줍니다.
Parameters:
index - 가져올 커맨드의 인덱스
Returns:
지정한 커맨드

setCommandListener

public void setCommandListener(CommandListener cl,
                               Object obj)
커맨드 리스너를 지정합니다. 커맨드가 선택되었거나 커맨드의 포커스가 변경되었을때 이 함수를 호출합니다.
Parameters:
cl - 커맨드 리스너
obj - commandAction시에 넘어가는 Object

keyNotify

protected boolean keyNotify(int type,
                            int chr)
Description copied from class: Component
키 입력을 받으면 호출됩니다. 사용자가 키를 입력하면, setFocus함수에 의해서 입력 포커스를 가지는 컴포넌트의 이 함수가 호출됩니다. typeKEY_PRESSED, KEY_RELEASED, KEY_REPEATED, KEY_TYPED이며, chr는 키 입력값이 됩니다.
Overrides:
keyNotify in class Component
Following copied from class: org.kwis.msp.lwc.Component
Parameters:
type - 키 입력의 타입; 키를 누르는 경우 KEY_PRESSED, 키를 떼면 KEY_RELEASED, 키를 연속적으로 누르면 KEY_REPEATED, 한번 눌려서 떼인 경우라면 KEY_TYPED이 됨
chr - 눌린 키의 문자; '0'-'9'와 '*', '#'은 기본이며 이외의 문자도 넘어 올 수 있습니다.
Returns:
만일 컴포넌트가 인수로 넘오는 키를 이 컴포넌트가 처리했다면, true를 넘겨 줍니다. 그렇지 않았다면 false를 돌려줍니다.

pointerNotify

protected boolean pointerNotify(int type,
                                int x,
                                int y)
Description copied from class: Component
포인터 입력을 받으면 호출됩니다. 현재 모든 휴대폰이 포인팅 디바이스가 없으므로 이 함수는 불리지 않습니다.
Overrides:
pointerNotify in class Component
Following copied from class: org.kwis.msp.lwc.Component
Parameters:
type - 포인팅 디바이스의 타입
x - 디바이스의 'x'축 좌표
y - 디바이스의 'y'축 좌표
Returns:
만일 컴포넌트가 인수로 넘오는 이벤트를 이 컴포넌트가 처리했다면, false를 넘김

paintContent

public void paintContent(Graphics g)
Description copied from class: Component
내부를 칠합니다. 먼저 validate함수를 호출하여, 컴포넌트의 위치를 유효화(컴포넌트의 위치와 크기 재 계산)한 후 내부의 색상으로 화면을 칠하게 됩니다. 색상이 -1이면, 칠하진 않습니다.
Overrides:
paintContent in class Component
Following copied from class: org.kwis.msp.lwc.Component
Parameters:
g - 칠할 Graphics.
See Also:
Graphics


AromaSoft Corp. Proprietary and Confidential

(C)opyright 2003 AromaSoft Corp. All right reserved.
Contact : contact@aromasoft.com