|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
edu.rice.cs.util.swing.SwingFrame
edu.rice.cs.drjava.ui.predictive.PredictiveInputFrame<T>
public class PredictiveInputFrame<T extends Comparable<? super T>>
Frame with predictive string input based on a list of strings.
| Nested Class Summary | |
|---|---|
static interface |
PredictiveInputFrame.CloseAction<X extends Comparable<? super X>>
Interface for an action to be performed when the user closes the frame, either by using "OK" or "Cancel". |
static class |
PredictiveInputFrame.FrameState
Class to save the frame state, i.e. |
static interface |
PredictiveInputFrame.InfoSupplier<X>
Interface that is used to generate additional information about an item. |
private class |
PredictiveInputFrame.PredictiveInputListener
Listener for several events. |
| Nested classes/interfaces inherited from class javax.swing.JFrame |
|---|
JFrame.AccessibleJFrame |
| Nested classes/interfaces inherited from class java.awt.Frame |
|---|
Frame.AccessibleAWTFrame |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private ArrayList<PredictiveInputFrame.CloseAction<T>> |
_actions
Action to be performed when the user closes the frame using "OK". |
private String |
_buttonPressed
Code for the last button that was pressed. |
private JButton[] |
_buttons
Action buttons. |
private int |
_cancelIndex
The index in the _actions list that cancels the dialog. |
private PredictiveInputModel.MatchingStrategy<T> |
_currentStrategy
Currently used strategy. |
private boolean |
_force
True if the user is forced to select one of the items. |
private PredictiveInputFrame.InfoSupplier<? super T> |
_info
Info supplier. |
private JLabel |
_infoLabel
Text area for additional information. |
private PredictiveInputFrame.FrameState |
_lastState
Last frame state. |
private PredictiveInputFrame.PredictiveInputListener |
_listener
Listener for several events. |
private JList |
_matchList
List with matches. |
protected JComponent[] |
_optionalComponents
Optional components for the _optionsPanel. |
protected JPanel |
_optionsPanel
Panel for additional options. |
private SwingFrame |
_owner
Owner frame. |
private PredictiveInputModel<T> |
_pim
Predictive input model |
private JLabel |
_sharedExtLabel
Label with shared extension. |
private List<PredictiveInputModel.MatchingStrategy<T>> |
_strategies
Array of strategies. |
private JComboBox |
_strategyBox
Combo box. |
private JLabel |
_tabCompletesLabel
Label with "Tab completes:" string. |
private JTextField |
_textField
Text field for string input. |
protected Runnable1<WindowEvent> |
CANCEL
Runnable that calls _cancel. |
| Fields inherited from class javax.swing.JFrame |
|---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Frame |
|---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
PredictiveInputFrame(SwingFrame owner,
String title,
boolean force,
boolean ignoreCase,
PredictiveInputFrame.InfoSupplier<? super T> info,
List<PredictiveInputModel.MatchingStrategy<T>> strategies,
List<PredictiveInputFrame.CloseAction<T>> actions,
int cancelIndex,
Collection<T> items)
Create a new predictive string input frame. |
|
PredictiveInputFrame(SwingFrame owner,
String title,
boolean force,
boolean ignoreCase,
PredictiveInputFrame.InfoSupplier<? super T> info,
List<PredictiveInputModel.MatchingStrategy<T>> strategies,
List<PredictiveInputFrame.CloseAction<T>> actions,
int cancelIndex,
T... items)
Create a new predictive string input frame. |
|
| Method Summary | |
|---|---|
private void |
_setupOptionsPanel(JComponent[] components)
Creates the panel with the optional components. |
private void |
addListener()
Add the listener. |
private void |
buttonPressed(PredictiveInputFrame.CloseAction<T> a)
Handle button pressed. |
private void |
cancel()
Cancel the dialog. |
String |
getButtonPressed()
Return the name for the last button that was pressed. |
PredictiveInputFrame.FrameState |
getFrameState()
Returns the last state of the frame, i.e. |
T |
getItem()
Return the item that was selected or null the user entered a mask not in the list and force == false. |
List<T> |
getItems()
Return a copy of the list of items in the model. |
String |
getMask()
Return the raw, unforced text in the text field. |
String |
getText()
Return the string that was entered in the text field. |
private void |
init(boolean info)
Initialize the frame. |
protected JComponent[] |
makeOptions()
Creates the optional components. |
private void |
removeListener()
Remove the listener. |
void |
resetFocus()
Focus back in the text field. |
void |
selectStrategy()
Select the strategy for matching. |
void |
setCurrentItem(T item)
Set the currently selected item. |
void |
setFrameState(PredictiveInputFrame.FrameState ds)
Sets state of the frame, i.e. |
void |
setFrameState(String s)
Sets state of the frame, i.e. |
void |
setItems(boolean ignoreCase,
Collection<T> items)
Set the items. |
void |
setItems(boolean ignoreCase,
T... items)
Set the items. |
void |
setMask(String mask)
Set the mask in the text field. |
void |
setModel(boolean ignoreCase,
PredictiveInputModel<T> pim)
Set the predictive input model. |
void |
setOwnerEnabled(boolean b)
Enable or disable owner. |
void |
setVisible(boolean vis)
Toggle visibility of this frame. |
private void |
updateExtensionLabel()
Update the extension label based on the model. |
private void |
updateInfo()
Update the information. |
private void |
updateList()
Update the match list based on the model. |
private void |
updateTextField()
Update the text field based on the model. |
| Methods inherited from class edu.rice.cs.util.swing.SwingFrame |
|---|
duringInit, initDone |
| Methods inherited from class java.awt.Frame |
|---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
|---|
getFont, postEvent |
| Field Detail |
|---|
private volatile PredictiveInputModel<T extends Comparable<? super T>> _pim
private volatile String _buttonPressed
private final JButton[] _buttons
private final JTextField _textField
protected JPanel _optionsPanel
protected JComponent[] _optionalComponents
private final JLabel _tabCompletesLabel
private final JList _matchList
private final boolean _force
private final JLabel _sharedExtLabel
private final PredictiveInputFrame.PredictiveInputListener _listener
private final PredictiveInputFrame.InfoSupplier<? super T extends Comparable<? super T>> _info
private final JLabel _infoLabel
private final SwingFrame _owner
private final ArrayList<PredictiveInputFrame.CloseAction<T extends Comparable<? super T>>> _actions
private final int _cancelIndex
private final List<PredictiveInputModel.MatchingStrategy<T extends Comparable<? super T>>> _strategies
private final JComboBox _strategyBox
private volatile PredictiveInputFrame.FrameState _lastState
private volatile PredictiveInputModel.MatchingStrategy<T extends Comparable<? super T>> _currentStrategy
protected final Runnable1<WindowEvent> CANCEL
| Constructor Detail |
|---|
public PredictiveInputFrame(SwingFrame owner,
String title,
boolean force,
boolean ignoreCase,
PredictiveInputFrame.InfoSupplier<? super T> info,
List<PredictiveInputModel.MatchingStrategy<T>> strategies,
List<PredictiveInputFrame.CloseAction<T>> actions,
int cancelIndex,
Collection<T> items)
owner - owner frameforce - true if the user is forced to select one of the itemsignoreCase - true if case should be ignoredinfo - information supplier to use for additional information displaystrategies - array of matching strategiesactions - actions to be performed when the user closes the frame, e.g. "OK" and "Cancel"; "Cancel" has to be lastitems - list of items
public PredictiveInputFrame(SwingFrame owner,
String title,
boolean force,
boolean ignoreCase,
PredictiveInputFrame.InfoSupplier<? super T> info,
List<PredictiveInputModel.MatchingStrategy<T>> strategies,
List<PredictiveInputFrame.CloseAction<T>> actions,
int cancelIndex,
T... items)
owner - owner frameforce - true if the user is forced to select one of the itemsinfo - information supplier to use for additional information displaystrategies - array of matching strategiesactions - actions to be performed when the user closes the frame, e.g. "OK" and "Cancel"; "Cancel" has to be lastitems - varargs/array of items| Method Detail |
|---|
public PredictiveInputFrame.FrameState getFrameState()
public void setFrameState(PredictiveInputFrame.FrameState ds)
ds - State to update to, or null to resetpublic void setFrameState(String s)
s - State to update to, or null to resetpublic List<T> getItems()
public void setModel(boolean ignoreCase,
PredictiveInputModel<T> pim)
ignoreCase - true if case should be ignoredpim - predictive input model
public void setItems(boolean ignoreCase,
Collection<T> items)
ignoreCase - true if case should be ignoreditems - list of itemspublic void setCurrentItem(T item)
item - item to select
public void setItems(boolean ignoreCase,
T... items)
ignoreCase - true if case should be ignoreditems - varargs/array of itemspublic String getButtonPressed()
public String getMask()
public void setMask(String mask)
mask - for text fieldpublic String getText()
public T getItem()
private void init(boolean info)
info - true if additional information is desiredprotected JComponent[] makeOptions()
private void _setupOptionsPanel(JComponent[] components)
public void setOwnerEnabled(boolean b)
b - whether the owner should be enabled (true) or disabledpublic void setVisible(boolean vis)
setVisible in class Windowprivate void addListener()
private void removeListener()
private void updateTextField()
public void resetFocus()
private void updateExtensionLabel()
private void updateList()
private void updateInfo()
private void cancel()
private void buttonPressed(PredictiveInputFrame.CloseAction<T> a)
public void selectStrategy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||