|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectd.g.ObjectStateDisplay
private static final class g.ObjectStateDisplay
...
Like typical Java GUI code, this class is not multithread safe:
it expects to only be called by EventQueue
's dispatch thread
.
This threading limitation is checked in every public method.
+++ actually, the above statement is false:
--the constructor, which can be called by any thread, seems to rely on the fact that its params get turned into final fields for their thread safety
--then this class relies on synchronozed for the run/waitOnUser interaction to safely work
Need to rethink this totally...
Field Summary | |
---|---|
private JButton |
closeButton
|
private JButton |
continueButton
|
private JFrame |
frame
|
private long |
instanceId
Records this instance's Id. |
private static AtomicLong |
instanceIdNext
The next ObjectStateDisplay instance's instanceId field. |
private String |
label
|
private static int |
latestX
Every time any ObjectStateDisplay instance is moved, this field stores its latest x position. |
private static int |
latestY
Every time any ObjectStateDisplay instance is moved, this field stores its latest y position. |
private ObjectState |
objectState
|
private boolean |
pauseExecution
|
private static long |
serialVersionUID
|
private boolean |
shouldWait
|
private static int |
tabSize
Specifies how many spaces a tab char will expand to when display Strings. |
private Object |
waitObject
Condition predicate for this instance's condition queue (i.e. the wait/notifyAll calls below; see "Java Concurrency in Practice" by Goetz et al p. 296ff, especially p. 299). |
Constructor Summary | |
---|---|
private |
g.ObjectStateDisplay(String label,
Object obj,
boolean pauseExecution)
|
Method Summary | |
---|---|
private JComponent |
buildButtons()
|
private JComponent |
buildFieldsDisplay()
|
private JComponent |
buildGui()
|
private void |
handleWindowClose()
This method calls onContinueExecution(), and then calls dispose(). |
private String |
makeTitle()
|
private void |
onContinueExecution()
This method always disables continueButton and sets its label to indicate that execution has proceeded. |
void |
run()
... |
private void |
waitOnUser()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private static final int tabSize
private static final AtomicLong instanceIdNext
instanceId
field.
Contract: is initialized to 0, and if this field has that value, it means that no instances have been created.
private static int latestX
private static int latestY
private final long instanceId
private final String label
private final ObjectState objectState
private final boolean pauseExecution
private boolean shouldWait
private final Object waitObject
private JFrame frame
private JButton continueButton
private JButton closeButton
Constructor Detail |
---|
private g.ObjectStateDisplay(String label, Object obj, boolean pauseExecution) throws IllegalStateException
IllegalStateException
Method Detail |
---|
public void run() throws IllegalStateException
run
in interface Runnable
IllegalStateException
- if calling thread is not EventQueue
's dispatch thread
private String makeTitle()
private JComponent buildGui()
private JComponent buildFieldsDisplay()
private JComponent buildButtons()
private void handleWindowClose()
private void onContinueExecution()
private void waitOnUser() throws IllegalStateException, InterruptedException
IllegalStateException
InterruptedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |