|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor¡¡ ¡¡ | ¸Þ¼µå | »ó¼¼: Çʵå | constructor¡¡ ¡¡ | ¸Þ¼µå |
public interface TreeSelectionModel
ÀÌ ÀÎÅÍÆäÀ̽º´Â Æ®¸® ÄÄÆÛ³ÍÆ®ÀÇ ÇöÀçÀÇ ¼±Åà »óȲÀ» ³ªÅ¸³À´Ï´Ù. Æ®¸® ¼±Åà ¸ðµ¨ÀÇ »ó¼¼ ¹× »ç¿ë¿¹´Â ¡¸The Java Tutorial¡¹ÀÇ ¡¸How to Use Trees¡¹¼½¼ÇÀ» ÂüÁ¶ÇϽʽÿÀ.
Æ®¸® ¼±ÅÃÀÇ »óȲÀº TreePath
¼³Á¤, ¶Ç ¿É¼ÇÀ¸·Î Á¤¼ö ¼³Á¤¿¡ ÀÇÇØ ½Äº°µË´Ï´Ù. TreePath ·ÎºÎÅÍ Á¤¼ö¿¡´Â RowMapper
ÀνºÅϽº¿¡ ÀÇÇØ ¸ÅÇÎ µË´Ï´Ù. TreeSelectionModel°¡ RowMapper¸¦ ¿Ã¹Ù¸£°Ô Á¶ÀÛÇÒ ÇÊ¿ä´Â ¾ø°í, RowMapper°¡ ¾ø´Â °æ¿ì´Â getSelectionRows
´Â nullÀ»
¸®ÅÏÇÕ´Ï´Ù.
TreeSelectionModel´Â ´ÜÀÏ ÆÐ½º (SINGLE_TREE_SELECTION
), º¹¼öÀÇ ¿¬¼Ó ÆÐ½º (CONTIGUOUS_TREE_SELECTION
), º¹¼öÀÇ ºñ¿¬¼Ó ÆÐ½º (DISCONTIGUOUS_TREE_SELECTION
)¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. RowMapper
¸¦ »ç¿ëÇØ TreePath°¡ ¿¬¼ÓÇϰí ÀÖ´ÂÁö¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. RowMapper°¡ ¾ø´Â °æ¿ì´Â CONTIGUOUS_TREE_SELECTION
¹× DISCONTIGUOUS_TREE_SELECTION
´Â ¶È°°ÀÌ µ¿ÀÛÇØ, TreeSelectionModel¿¡´Â ÆÐ½º¸¦ ¸î°³¿¡¼µµ Æ÷ÇÔÇÒ ¼ö ÀÖ°Ô µË´Ï´Ù.
CONTIGUOUS_TREE_SELECTION
¼±Åà ¸ðµ¨Àº ¾ðÁ¦¶óµµ ÆÐ½º´Â º¯°æ ¼º°ú (setSelectionPath
, addSelectionPath
... ¿¡
ÇØ), TreePath¸¦ ÀçÂ÷ ÆÇÁ¤ÇØ ¿¬¼ÓÀ¸·Î ÇÒ ¼öµµ ÀÖ½À´Ï´Ù. resetRowSelection
À»
È£ÃâÇØ TreePath
ÆÇÁ¤À» ÇÒ ¼öµµ ÀÖ½À´Ï´Ù. ºñ¿¬¼Ó TreePath
¼³Á¤À» ¿¬¼Ó ¼³Á¤¿¡ ¸ÅÇÎ ÇÏ´Â ¹æ¹ýÀº ƯÁ¤ÀÇ Á¤Ã¥¸¦ Àû¿ëÇϱâ À§Çؼ ÀÌ ÀÎÅÍÆäÀ̽ºÀÇ ±¸ÇöÀÚ¿¡°Ô ÀÏÀÓ µÇ°í ÀÖ½À´Ï´Ù.
±¸ÇöÇØ¼´Â ¼±Åà ¹üÀ§¿¡ Ãß°¡µÈ Áߺ¹ ÇÏ´Â TreePath¸¦ °áÇÕÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î ´ÙÀ½ÀÇ ÄÚµåÀÇ °æ¿ì´Â
TreePath[] paths = new TreePath[] { treePath, treePath }; treeSelectionModel.setSelectionPaths(paths);ÇϳªÀÇ ÆÐ½º
treePath
¸¸ÀÌ ¼±Åõǵµ·Ï ÇØ, treePath
Ä«Çǰ¡ 2°³
¼±ÅõÇÁö ¾Ê°Ô ÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù.
¸®µå TreePath´Â Ãß°¡ ¶Ç´Â ¼³Á¤µÈ ¸¶Áö¸· ÆÐ½ºÀÔ´Ï´Ù. µû¶ó¼, ¸®µåÇàÀº RowMapper¿¡ ÀÇÇØ ÆÇÁ¤µÈ TreePath¿¡ ´ëÀÀÇÏ´Â ÇàÀÌ µË´Ï´Ù.
ÇÊµå °³¿ä | |
---|---|
static int |
CONTIGUOUS_TREE_SELECTION
¼±Åà ¹üÀ§ÀÇ Ç׸ñÀº ¿¬¼ÓÇϰí ÀÖÀ» Çʿ䰡 ÀÖ½À´Ï´Ù. |
static int |
DISCONTIGUOUS_TREE_SELECTION
¼±Åà ¹üÀ§ÀÇ Ç׸ñ¼ö¿¡ Á¦ÇÑÀº ¾ø°í, °¢ Ç׸ñÀº ¿¬¼ÓÇϰí ÀÖÀ» ÇÊ¿ä´Â ¾ø½À´Ï´Ù. |
static int |
SINGLE_TREE_SELECTION
¼±Åà ¹üÀ§¿¡´Â µ¿½Ã¿¡ º¹¼öÀÇ ÆÐ½º¸¦ ÁöÁ¤ÇÒ ¼ö ¾ø½À´Ï´Ù. |
¸Þ¼µå °³¿ä | |
---|---|
void |
addPropertyChangeListener (PropertyChangeListener listener)
PropertyChangeListener¸¦ ¸®½º³Ê ¸®½ºÆ®¿¡ Ãß°¡ÇÕ´Ï´Ù. |
void |
addSelectionPath (TreePath path)
ÇöÀçÀÇ ¼±Åà ¹üÀ§¿¡ ÆÐ½º¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
addSelectionPaths (TreePath [] paths)
ÇöÀçÀÇ ¼±Åà ¹üÀ§¿¡ ÆÐ½º¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
addTreeSelectionListener (TreeSelectionListener x)
¼±ÅÃµÈ TreePath ¼³Á¤ÀÌ º¯°æµÉ ¶§¸¶´Ù ÅëÁö¸¦ ¹Þ´Â ¸®½º³ÊÀÇ ¸®½ºÆ®¿¡ x¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
clearSelection ()
ÇöÀçÀÇ ¼±Åà ¹üÀ§¸¦ ºñ¿ó´Ï´Ù. |
TreePath |
getLeadSelectionPath ()
Ãß°¡µÈ ¸¶Áö¸· ÆÐ½º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getLeadSelectionRow ()
¼±Åà ¹üÀ§ÀÇ ¸®µå À妽º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getMaxSelectionRow ()
¼±ÅÃÇÑ ÇöÀçÀÇ TreePath ¼³Á¤ÀÇ RowMapper ·ÎºÎÅÍ ÃëµæÇÑ ÃÖ´ë°ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getMinSelectionRow ()
¼±ÅÃÇÑ ÇöÀçÀÇ TreePath ¼³Á¤ÀÇ RowMapper ·ÎºÎÅÍ ÃëµæÇÑ ÃÖ¼Ò°ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
RowMapper |
getRowMapper ()
TreePath¸¦ Çà¿¡ ¸Ê ÇÒ ¼ö ÀÖ´Â RowMapper ÀνºÅϽº¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getSelectionCount ()
¼±Åõǰí ÀÖ´Â ÆÐ½ºÀÇ ¼ö¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getSelectionMode ()
ÇöÀçÀÇ ¼±Åà ¸ðµå¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
TreePath |
getSelectionPath ()
¼±Åà ¹üÀ§ÀÇ ¼±µÎÀÇ ÆÐ½º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
TreePath [] |
getSelectionPaths ()
¼±Åà ¹üÀ§ÀÇ ÆÐ½º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int[] |
getSelectionRows ()
ÇöÀç ¼±Åà ¶°³¯ ¼ö ÀÖ¾î ¸ðµç ÇàÀ» ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isPathSelected (TreePath path)
ÆÐ½º path °¡ ÇöÀçÀÇ ¼±Åà ¹üÀ§¿¡ ÀÖ´Â °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isRowSelected (int row)
row ·Î
½Äº°µÇ´Â ÇàÀÌ ¼±Åõǰí ÀÖ´Â °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isSelectionEmpty ()
¼±Åà ¹üÀ§°¡ ÇöÀçºñ¾îÀÖ´Â °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
void |
removePropertyChangeListener (PropertyChangeListener listener)
PropertyChangeListener¸¦ ¸®½º³Ê ¸®½ºÆ®·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù. |
void |
removeSelectionPath (TreePath path)
¼±Åà ¹üÀ§·ÎºÎÅÍ ÆÐ½º¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
removeSelectionPaths (TreePath [] paths)
¼±Åà ¹üÀ§·ÎºÎÅÍ ÆÐ½º¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
removeTreeSelectionListener (TreeSelectionListener x)
¼±ÅÃµÈ TreePath ¼³Á¤ÀÌ º¯°æµÉ ¶§¸¶´Ù ÅëÁö¸¦ ¹Þ´Â ¸®½º³ÊÀÇ ¸®½ºÆ®·ÎºÎÅÍ x¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
resetRowSelection ()
ÀÌ °´Ã¼ÀÇ TreePath ·ÎºÎÅÍ Çà¿¡ÀÇ ¸ÅÇÎÀ» °»½ÅÇÕ´Ï´Ù. |
void |
setRowMapper (RowMapper newMapper)
RowMapper ÀνºÅϽº¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelectionMode (int mode)
¼±Åà ¸ðµ¨À» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelectionPath (TreePath path)
¼±Åà ¹üÀ§¸¦ ÆÐ½º·Î ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelectionPaths (TreePath [] paths)
¼±Åà ¹üÀ§¸¦ ÆÐ½º·Î ¼³Á¤ÇÕ´Ï´Ù. |
ÇʵåÀÇ »ó¼¼ |
---|
static final int SINGLE_TREE_SELECTION
static final int CONTIGUOUS_TREE_SELECTION
static final int DISCONTIGUOUS_TREE_SELECTION
¸Þ¼µåÀÇ »ó¼¼ |
---|
void setSelectionMode(int mode)
ÇöÀçÀÇ ¼±Åà ¹üÀ§°¡ »õ·Î¿î ¸ðµå¿¡ ´ëÇØ¼ À¯È¿ÇÏÁö ¾ÊÀº °æ¿ì´Â ¼±Åà ¹üÀ§¸¦ º¯°æÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î
¸ðµå°¡ SINGLE_TREE_SELECTION
À¸·Î º¯°æÇßÀ» ¶§¿¡ 3°³ÀÇ TreePath°¡ ¼±ÅõǾúÀ» °æ¿ì, ÇϳªÀÇ TreePath ¸¸À» ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù. ¾î´À TreePath¸¦ ¼±ÅÃÇÒ±î´Â »ç¿ëÇϴ ƯÁ¤ÀÇ ±¸Çö¿¡ ÀÇÇØ Á¤ÇØÁý´Ï´Ù.
int getSelectionMode()
SINGLE_TREE_SELECTION
, CONTIGUOUS_TREE_SELECTION
, DISCONTIGUOUS_TREE_SELECTION
¾ðÁ¨°¡µË´Ï´Ù.
void setSelectionPath(TreePath path)
path
°¡ nullÀÎ °æ¿ì´Â clearSelection
À»
È£ÃâÇßÀ» °æ¿ì¿Í °°°Ô µË´Ï´Ù.
path
- ¼±ÅÃÇÏ´Â »õ·Î¿î ÆÐ½ºvoid setSelectionPaths(TreePath [] paths)
path
°¡ nullÀÎ °æ¿ì´Â clearSelection
À»
È£ÃâÇßÀ» °æ¿ì¿Í °°°Ô µË´Ï´Ù.
paths
- »õ·Î¿î ¼±Åà ¹üÀ§void addSelectionPath(TreePath path)
path
°¡ nullÀÎ °æ¿ì´Â ¿µÇâÀº ¾ø½À´Ï´Ù.
path
- ÇöÀçÀÇ ¼±Åà ¹üÀ§¿¡ Ãß°¡ÇÏ´Â »õ·Î¿î ÆÐ½ºvoid addSelectionPaths(TreePath [] paths)
path
°¡ nullÀÎ °æ¿ì´Â ¿µÇâÀº ¾ø½À´Ï´Ù.
paths
- ÇöÀçÀÇ ¼±Åà ¹üÀ§¿¡ Ãß°¡ÇÏ´Â »õ·Î¿î ÆÐ½ºvoid removeSelectionPath(TreePath path)
path
°¡ nullÀÎ °æ¿ì´Â ¿µÇâÀº ¾ø½À´Ï´Ù.
path
- ¼±Åà ¹üÀ§·ÎºÎÅÍ »èÁ¦ÇÏ´Â ÆÐ½ºvoid removeSelectionPaths(TreePath [] paths)
paths
³»ÀÇ ÆÐ½ºÁß ÇÑÂÊÀÌ ¼±Åà ¹üÀ§¿¡ ÀÖ´Â °æ¿ì´Â TreeSelectionListeners°¡ ÅëÁö¸¦ ¹Þ½À´Ï´Ù. paths
°¡ nullÀÎ °æ¿ì, ÀÌ ¸Þ¼µå´Â ¿µÇâÀ» ¹ÞÁö ¾Ê½À´Ï´Ù.
paths
- ¼±Åà ¹üÀ§·ÎºÎÅÍ »èÁ¦ÇÏ´Â ÆÐ½ºTreePath getSelectionPath()
RowMapper
°¡ ÆÇÁ¤ÇÑ ÃÖ¼Ò Á¤¼ö°ªÀ» °¡Áö´Â TreePath ÀÏ ÇÊ¿ä´Â ¾ø½À´Ï´Ù.
TreePath [] getSelectionPaths()
int getSelectionCount()
boolean isPathSelected(TreePath path)
path
°¡ ÇöÀçÀÇ ¼±Åà ¹üÀ§¿¡ ÀÖ´Â °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
boolean isSelectionEmpty()
void clearSelection()
void setRowMapper(RowMapper newMapper)
RowMapper getRowMapper()
int[] getSelectionRows()
int getMinSelectionRow()
int getMaxSelectionRow()
boolean isRowSelected(int row)
row
·Î
½Äº°µÇ´Â ÇàÀÌ ¼±Åõǰí ÀÖ´Â °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
void resetRowSelection()
ÀϹÝÀûÀ¸·Î È£ÃâÇÒ ÇÊ¿ä´Â ¾ø½À´Ï´Ù. JTree¿Í °Å±â¿¡ °ü·ÃµÈ ¸®½º³Ê°¡ È£ÃâµË´Ï´Ù. µ¶ÀÚÀûÀÎ ºäÅ©¶ó½º¸¦ ±¸ÇöÁßÀÇ °æ¿ì´Â ½º½º·Î È£ÃâÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù.
int getLeadSelectionRow()
TreePath getLeadSelectionPath()
void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeEvent´Â ¼±Åà ¹üÀ§ ¸ðµå°¡ º¯°æµÇ¸é Æ®¸®°Å µË´Ï´Ù.
listener
- Ãß°¡ÇÏ´Â PropertyChangeListenervoid removePropertyChangeListener(PropertyChangeListener listener)
listener
- »èÁ¦ÇÏ´Â PropertyChangeListenervoid addTreeSelectionListener(TreeSelectionListener x)
x
- Ãß°¡µÇ´Â »õ·Î¿î ¸®½º³Êvoid removeTreeSelectionListener(TreeSelectionListener x)
x
- »èÁ¦ÇÏ´Â ¸®½º³Ê
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor¡¡ ¡¡ | ¸Þ¼µå | »ó¼¼: Çʵå | constructor¡¡ ¡¡ | ¸Þ¼µå |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.