public class TextListController extends TextController implements java.awt.event.ActionListener, java.awt.ItemSelectable
TextListController class implements a view of a MVC model
for the text list. The model of the MVC model is a TextListModel
object and the view of the MVC model is a TextListView object.TextListModel,
TextListView,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected java.awt.event.ActionListener |
actionListener |
protected static java.lang.String |
actionListenerK
Internal constant for serialization
|
protected boolean |
deselectionEnabled |
protected java.awt.event.ItemListener |
itemListener |
protected static java.lang.String |
itemListenerK
Internal constant for serialization
|
protected int |
lastShiftSelectedIndex |
protected TextListModel |
model |
protected boolean |
movingSelectionEnabled |
static int |
MULTIPLE_SELECTIONS
Allows AWT style multiple selections.
|
protected java.awt.PopupMenu |
popupMenu |
protected int |
selectionMode |
static int |
SHIFT_MULTIPLE_SELECTIONS
Allows Windows style multiple selections.
|
static int |
SINGLE_SELECTION
Allows single selection.
|
protected TextListView |
view |
A_COPY, A_CUT, A_FIND, A_PASTE, A_PRINT, A_UNDO, CLICK_TO_FOCUS, clickToFocus, L_COPY, L_CUT, L_EDIT, L_FIND, L_PASTE, L_PRINT, L_UNDO, lostClipboardOwnership, selectionVisibleAtFocus| コンストラクタと説明 |
|---|
TextListController(TextListView view)
Constructs a text list controller with the specified text list view.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Invoked when an action occurs.
|
void |
addActionListener(java.awt.event.ActionListener l)
Adds the specified action listener to receive action events from
this controller.
|
void |
addItem(java.lang.String[] item,
int index)
Adds the specified string row item to the specified row index.
|
void |
addItem(Text[] item,
int index)
Adds the specified text row item to the specified row index.
|
void |
addItemListener(java.awt.event.ItemListener l)
Adds the specified item listener to receive item events from
this controller.
|
void |
addTextItem(Text[] item,
int index)
Adds the specified text row item to the specified row index.
|
protected Dialog |
createFindDialog(java.lang.String initStr)
Creates a dialog for the find operation with the specified initial
string.
|
protected java.awt.MenuItem |
createMenuItem(java.lang.String label,
java.lang.String action,
java.lang.String shortcut)
Creates a menu item with the specified label and shortcut.
|
protected java.awt.PopupMenu |
createPopupMenu()
Creates a popup menu.
|
void |
deselect(int index)
Deselects the row at the specified index.
|
void |
deselect(int index,
int column,
boolean makeVisible,
boolean emitEvent)
Deselects the row at the specified index.
|
void |
findTextLine()
Finds the string in the text lists.
|
boolean |
findTextLine(java.lang.String str)
Finds the specified string in the text lists.
|
protected boolean |
findTextLine(java.lang.String str,
int startIndex)
Finds the specified string in the text lists starting at the specified
index.
|
protected int |
getColumn(java.awt.event.MouseEvent e)
Returns the column from the specified mouse event.
|
int |
getColumnCount()
Returns the number of columns in the list.
|
java.lang.String |
getItem(int index,
int column)
Returns the string item associated with the specified index (row)
and column.
|
int |
getItemCount()
Returns the number of items in the list.
|
java.lang.String[] |
getItems(int column)
Returns the string items associated with the specified column index.
|
TextListModel |
getModel()
Returns the model of this controller.
|
java.awt.PopupMenu |
getPopupMenu()
Returns the popup menu of this controller.
|
java.lang.String |
getRowItem(int index)
Returns the item associated with the specified row index.
|
java.lang.String[] |
getRowItems(int index)
Returns the string items associated with the specified row index.
|
int |
getRows()
Returns the number of visible lines in the view.
|
Text |
getRowTextItem(int index)
Returns the text item associated with the specified row index.
|
Text[] |
getRowTextItems(int index)
Returns the text items associated with the specified row index.
|
int |
getSelectedIndex()
Returns the index of the selected row.
|
int[] |
getSelectedIndexes()
Returns the indices of the selected rows.
|
java.lang.Object[] |
getSelectedObjects()
Returns the selected items or null if no items are selected.
|
int |
getSelectionMode()
Returns the selection mode.
|
Text |
getTextItem(int index,
int column)
Returns the text item associated with the specified index (row)
and column.
|
Text[] |
getTextItems(int column)
Returns the text items associated with the specified column index.
|
TextView |
getView()
Returns the view of this controller.
|
int |
getVisibleIndex()
Returns the index of the row that was last made visible.
|
boolean |
isDeselectionEnabled()
Tests if the deselection is enabled when the selection mode is a single
selection.
|
boolean |
isIndexSelected(int index)
Checks if the row at the specified index is selected.
|
boolean |
isMovingSelectionEnabled()
Tests if the selection follows the mouse.
|
boolean |
isMultipleMode()
Checks if this controller allows multiple selections.
|
void |
keyPressed(java.awt.event.KeyEvent e)
Invoked when a key has been pressed.
|
void |
makeVisible(int index)
Makes the row at the specified index visible.
|
protected void |
mouseDragAction(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when the mouse button is pressed on a component and then dragged.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when the mouse has been pressed on a component.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when the mouse has been released on a component.
|
protected void |
notifyActionListeners(java.lang.String command,
Text item,
int row,
int column)
Notifies the action event to the action listeners.
|
protected void |
notifyActionListeners(Text item,
int row,
int column)
Notifies the action event to the action listeners.
|
protected void |
notifyItemListeners(int index,
int[] indices,
boolean selected)
Notifies the item event to the item listeners.
|
protected void |
notifyItemListeners(int row,
int column,
boolean selected)
Notifies the item event to the item listeners.
|
void |
remove(int position)
Remove the item at the specified row position.
|
void |
remove(int[] indices)
Remove the items at the specified row indices.
|
void |
remove(int start,
int end)
Remove the items at the specified row range.
|
void |
removeActionListener(java.awt.event.ActionListener l)
Removes the specified action listener so it no longer receives action
events from this controller.
|
void |
removeAll()
Removes all items from the list.
|
void |
removeItemListener(java.awt.event.ItemListener l)
Removes the specified item listener so it no longer receives item
events from this controller.
|
void |
removeSelectedIndexes()
Remove the items at the indices of the selected rows.
|
void |
replaceItem(java.lang.String[] newValue,
int index)
Replaces the item at the specified row index with the new strings.
|
void |
replaceItem(Text[] newValue,
int index)
Replaces the item at the specified row index with the new texts.
|
void |
replaceTextItem(Text[] newValue,
int index)
Replaces the item at the specified row index with the new texts.
|
void |
select(int index)
Selects the row at the specified index.
|
void |
select(int index,
int column,
boolean makeVisible,
boolean emitEvent)
Selects the row at the specified index.
|
void |
setDeselectionEnabled(boolean b)
Makes the deselection enabled when the selection mode is a single
selection.
|
void |
setItem(int index,
int column,
java.lang.String item)
Sets the item associated with the specified index (row) and column
to the specified string value.
|
void |
setItem(int index,
int column,
Text item)
Sets the item associated with the specified index (row) and column
to the specified text value.
|
void |
setItems(java.lang.String[][] items)
Sets the items of the list to the specified string row by column items.
|
void |
setItems(Text[][] items)
Sets the items of the list to the specified text row by column items.
|
protected void |
setMenuEnabled(java.awt.Menu menu,
boolean b)
Enables or disables the specified menu.
|
void |
setMovingSelectionEnabled(boolean b)
Makes the selection follow the mouse.
|
void |
setMultipleMode(boolean b)
Sets the flag that determines whether this controller allows
multiple selections.
|
void |
setPopupMenu(java.awt.PopupMenu menu)
Sets the popup menu of this controller.
|
void |
setSelectionMode(int mode)
Sets the selection mode.
|
void |
setTextItem(int index,
int column,
Text item)
Sets the item associated with the specified index (row) and column
to the specified text value.
|
void |
setTextItems(Text[][] items)
Sets the items of the list to the specified text row by column items.
|
protected void |
shiftMultipleSelectAction(int lineIndex,
int column,
boolean isShiftDown)
Does an action for SHIFT_MULTIPLE_SELECTIONS.
|
addToView, focusGained, focusLost, getClipboardString, getClipboardText, getClipboardText, getCutBufferText, getResourceString, isClickToFocus, isMouseFocus, isSelectionVisibleAtFocus, keyReleased, keyTyped, lostOwnership, mouseClicked, mouseEntered, mouseExited, removeFromView, setClickToFocus, setClipboardString, setClipboardText, setCutBuffer, setMouseFocus, setSelectionVisibleAtFocusprotected TextListModel model
protected TextListView view
protected int selectionMode
protected boolean deselectionEnabled
protected boolean movingSelectionEnabled
protected int lastShiftSelectedIndex
protected java.awt.PopupMenu popupMenu
protected transient java.awt.event.ItemListener itemListener
protected transient java.awt.event.ActionListener actionListener
public static final int SINGLE_SELECTION
public static final int MULTIPLE_SELECTIONS
public static final int SHIFT_MULTIPLE_SELECTIONS
protected static final java.lang.String itemListenerK
protected static final java.lang.String actionListenerK
public TextListController(TextListView view)
view - the text list view.public TextListModel getModel()
public TextView getView()
getView クラス内 TextControllerpublic java.lang.Object[] getSelectedObjects()
getSelectedObjects インタフェース内 java.awt.ItemSelectableItemSelectablepublic void addItemListener(java.awt.event.ItemListener l)
addItemListener インタフェース内 java.awt.ItemSelectablel - the item listener.ItemSelectablepublic void removeItemListener(java.awt.event.ItemListener l)
removeItemListener インタフェース内 java.awt.ItemSelectablel - the item listener.ItemSelectableprotected void notifyItemListeners(int row,
int column,
boolean selected)
row - the row index.column - the column index.selected - true if the item has been selected.protected void notifyItemListeners(int index,
int[] indices,
boolean selected)
index - the index of the changed items.indices - the row indices of the changed items.selected - true if the items have been selected.public void addActionListener(java.awt.event.ActionListener l)
l - the action listener.public void removeActionListener(java.awt.event.ActionListener l)
l - the action listener.protected void notifyActionListeners(Text item, int row, int column)
item - the item.row - the row index.column - the column index.protected void notifyActionListeners(java.lang.String command,
Text item,
int row,
int column)
command - the action command.item - the item.row - the row index.column - the column index.public int getSelectionMode()
public void setSelectionMode(int mode)
public boolean isDeselectionEnabled()
public void setDeselectionEnabled(boolean b)
isDeselectionEnabled()public boolean isMovingSelectionEnabled()
public void setMovingSelectionEnabled(boolean b)
public java.awt.PopupMenu getPopupMenu()
public void setPopupMenu(java.awt.PopupMenu menu)
getPopupMenu()public int getItemCount()
public int getColumnCount()
public java.lang.String getItem(int index,
int column)
public Text getTextItem(int index, int column)
public void setItem(int index,
int column,
java.lang.String item)
public void setItem(int index,
int column,
Text item)
public void setTextItem(int index,
int column,
Text item)
public void setItems(java.lang.String[][] items)
public void setItems(Text[][] items)
public void setTextItems(Text[][] items)
public java.lang.String[] getRowItems(int index)
public Text[] getRowTextItems(int index)
public java.lang.String getRowItem(int index)
public Text getRowTextItem(int index)
public java.lang.String[] getItems(int column)
public Text[] getTextItems(int column)
public void addItem(java.lang.String[] item,
int index)
public void addItem(Text[] item, int index)
public void addTextItem(Text[] item, int index)
public void replaceItem(java.lang.String[] newValue,
int index)
public void replaceItem(Text[] newValue, int index)
public void replaceTextItem(Text[] newValue, int index)
public void removeAll()
public void remove(int position)
public void remove(int start,
int end)
start - the starting row position, inclusive.end - the ending row position, inclusive.public void remove(int[] indices)
indices - the row indices to be removed.public void removeSelectedIndexes()
public boolean isIndexSelected(int index)
public int getSelectedIndex()
public int[] getSelectedIndexes()
public void select(int index)
index - the position of the row to select.public void select(int index,
int column,
boolean makeVisible,
boolean emitEvent)
index - the position of the row to select.column - the position of the column to select.makeVisible - if true, makes the selected row visible.emitEvent - if true, emits the item event.public void deselect(int index)
index - the position of the row to deselect.public void deselect(int index,
int column,
boolean makeVisible,
boolean emitEvent)
index - the position of the row to deselect.column - the position of the column to deselect.makeVisible - if true, makes the deselected row visible.emitEvent - if true, emits the item event.public boolean isMultipleMode()
public void setMultipleMode(boolean b)
public int getVisibleIndex()
makeVisible(int)public void makeVisible(int index)
getVisibleIndex()public int getRows()
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed インタフェース内 java.awt.event.MouseListenermousePressed クラス内 TextControllerMouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased インタフェース内 java.awt.event.MouseListenermouseReleased クラス内 TextControllerMouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved インタフェース内 java.awt.event.MouseMotionListenermouseMoved クラス内 TextControllerMouseMotionListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged インタフェース内 java.awt.event.MouseMotionListenermouseDragged クラス内 TextControllerMouseMotionListenerprotected void mouseDragAction(java.awt.event.MouseEvent e)
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed インタフェース内 java.awt.event.KeyListenerkeyPressed クラス内 TextControllerKeyListenerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed インタフェース内 java.awt.event.ActionListenerActionListenerprotected int getColumn(java.awt.event.MouseEvent e)
protected void shiftMultipleSelectAction(int lineIndex,
int column,
boolean isShiftDown)
protected java.awt.PopupMenu createPopupMenu()
protected java.awt.MenuItem createMenuItem(java.lang.String label,
java.lang.String action,
java.lang.String shortcut)
protected void setMenuEnabled(java.awt.Menu menu,
boolean b)
public void findTextLine()
public boolean findTextLine(java.lang.String str)
protected boolean findTextLine(java.lang.String str,
int startIndex)
protected Dialog createFindDialog(java.lang.String initStr)