|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tbee.swing.FocusInterpreter
public class FocusInterpreter
This class interpretes keyboard focus movements and determines if the focus is lost - to a component within the same application (LOSING_FOCUS followed by a FOCUS_LOST) - or to something outside the application (just LOSING_FOCUS). This allows for more fine tuned behaviour in JTable by force writing an editing cell on FOCUS_LOST. Special consideration is take for popup menus: if though it would be a FOCUS_LOST, this is degraded to a LOSING_FOCUS. All components in the hierarchy to the one actually having focus are assumed to have focus also. This could be a JPanel with a component or a JTable where an editor is active. Listeners for this information must register using addFocusInterpreterListener( FocusInterpreter.FocusInterpreterListener ) This component weak-binds itself to the component, so that if the component could be garbage collected, the FocusInterpreter does not block that. On the next focus event, the FocusInterpreter will detect that the component is gone and will remove itself from the listeners and thus be garbage collected itself.
| Nested Class Summary | |
|---|---|
static class |
FocusInterpreter.FocusInterpreterEvent
|
static interface |
FocusInterpreter.FocusInterpreterListener
|
| Field Summary | |
|---|---|
static org.apache.log4j.Logger |
log4j
|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
static int |
STATE_FOCUS_LOST
|
static int |
STATE_GAINED_FOCUS
|
static int |
STATE_LOSING_FOCUS
|
| Constructor Summary | |
|---|---|
FocusInterpreter(Component component)
remember the component and start listening |
|
| Method Summary | |
|---|---|
void |
addFocusListener(FocusInterpreter.FocusInterpreterListener l)
|
static String |
describeState(int state)
|
void |
fireFocusEvent(int state,
Component oldComponent,
Component newComponent)
|
int |
getState()
|
boolean |
isActive()
|
void |
propertyChange(PropertyChangeEvent ev)
Interprete focus events |
void |
removeFocusListener(FocusInterpreter.FocusInterpreterListener l)
|
void |
setState(int value)
|
void |
start()
start interpreting focus events |
void |
stop()
stop interpreting focus events |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
public static org.apache.log4j.Logger log4j
public static final int STATE_FOCUS_LOST
public static final int STATE_GAINED_FOCUS
public static final int STATE_LOSING_FOCUS
| Constructor Detail |
|---|
public FocusInterpreter(Component component)
| Method Detail |
|---|
public void start()
public void stop()
public boolean isActive()
public void propertyChange(PropertyChangeEvent ev)
propertyChange in interface PropertyChangeListenerpublic int getState()
public void setState(int value)
public static String describeState(int state)
state -
public void addFocusListener(FocusInterpreter.FocusInterpreterListener l)
public void removeFocusListener(FocusInterpreter.FocusInterpreterListener l)
public void fireFocusEvent(int state,
Component oldComponent,
Component newComponent)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||