|
||||||||||
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. |
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 | |
---|---|
protected JComponent[] |
_optionalComponents
Optional components for the _optionsPanel. |
protected JPanel |
_optionsPanel
Panel for additional options. |
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,
List<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 | |
---|---|
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> |
getList()
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. |
protected JComponent[] |
makeOptions()
Creates the optional components. |
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,
List<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. |
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 |
---|
protected JPanel _optionsPanel
protected JComponent[] _optionalComponents
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, List<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 itemspublic 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 itemsMethod 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> getList()
public void setModel(boolean ignoreCase, PredictiveInputModel<T> pim)
ignoreCase
- true if case should be ignoredpim
- predictive input modelpublic void setItems(boolean ignoreCase, List<T> items)
ignoreCase
- true if case should be ignoreditems
- list of itemspublic void setCurrentItem(T item)
item
- item to selectpublic 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()
protected JComponent[] makeOptions()
public void setOwnerEnabled(boolean b)
b
- whether the owner should be enabled (true) or disabledpublic void setVisible(boolean vis)
setVisible
in class Window
public void resetFocus()
public void selectStrategy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |