Revision 40331 branches/v2_0_0_prep/libraries/libIverUtiles/src/org/gvsig/utils/console/JConsole.java
JConsole.java | ||
---|---|---|
45 | 45 |
package org.gvsig.utils.console; |
46 | 46 |
|
47 | 47 |
import java.awt.BorderLayout; |
48 |
import java.awt.Component; |
|
49 |
import java.awt.Container; |
|
48 | 50 |
import java.awt.Dimension; |
49 | 51 |
import java.awt.event.KeyAdapter; |
50 | 52 |
import java.awt.event.KeyEvent; |
... | ... | |
79 | 81 |
public static int ERROR=3; |
80 | 82 |
private static TextAreaDefaults defaults; |
81 | 83 |
private JConsole theContainer = null; |
84 |
|
|
85 |
private boolean redispatch_key_events = false; |
|
82 | 86 |
/** |
83 | 87 |
* This is the default constructor |
84 | 88 |
*/ |
... | ... | |
89 | 93 |
((ConsoleInputHandler)defaults.inputHandler).addConsoleListener(this); |
90 | 94 |
theContainer = this; |
91 | 95 |
} |
96 |
|
|
92 | 97 |
|
93 | 98 |
/** |
99 |
* With this constructor, we decide whether the key events |
|
100 |
* are re-dispatched to the parent of this component. |
|
101 |
* This is necessary to prevent the console from consuming |
|
102 |
* key events (short-cuts) while editing. the component |
|
103 |
* which originally receives the key event is the JEditTextArea |
|
104 |
* but this console is receiving also key-pressed notifications. |
|
105 |
* |
|
106 |
* @param redisp_key_events |
|
107 |
*/ |
|
108 |
public JConsole(boolean redisp_key_events) { |
|
109 |
this(); |
|
110 |
redispatch_key_events = redisp_key_events; |
|
111 |
} |
|
112 |
|
|
113 |
|
|
114 |
/** |
|
94 | 115 |
* This method initializes this |
95 | 116 |
*/ |
96 | 117 |
private void initialize() { |
... | ... | |
340 | 361 |
}else{ |
341 | 362 |
} |
342 | 363 |
} |
364 |
|
|
365 |
if (redispatch_key_events) { |
|
366 |
Container cont = this.getParent(); |
|
367 |
if (cont != null && cont instanceof Component) { |
|
368 |
Component comp = (Component) cont; |
|
369 |
comp.dispatchEvent(e); |
|
370 |
} |
|
371 |
} |
|
343 | 372 |
} |
344 | 373 |
|
345 | 374 |
public void keyReleased(KeyEvent e) { |
Also available in: Unified diff