Do not poll for output on hidden windows. Improves performance with many windows open.
git-svn-id: file:///home/svn/framework3/trunk@10066 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
2545410bc7
commit
6c38930db6
Binary file not shown.
|
@ -700,6 +700,14 @@ is divided into following sections:
|
|||
<include name="**/*.java"/>
|
||||
</fileset>
|
||||
</javadoc>
|
||||
<copy todir="${dist.javadoc.dir}">
|
||||
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
|
||||
<filename name="**/doc-files/**"/>
|
||||
</fileset>
|
||||
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
|
||||
<include name="**/doc-files/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
|
||||
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
|
||||
|
|
|
@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.1.45
|
|||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=84c180dd
|
||||
nbproject/build-impl.xml.script.CRC32=dcb7e251
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=78c6a6ee@1.38.1.45
|
||||
nbproject/build-impl.xml.script.CRC32=49dce8a6
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=f33e10ff@1.38.2.45
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
</SyntheticProperties>
|
||||
<Events>
|
||||
<EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
|
||||
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
|
||||
<EventHandler event="windowActivated" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowActivated"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
|
||||
|
|
|
@ -22,13 +22,14 @@ import org.jdesktop.swingworker.SwingWorker;
|
|||
public class InteractWindow extends MsfFrame {
|
||||
public final ReentrantLock lock = new ReentrantLock();
|
||||
public static final char POLL = 'r';
|
||||
public static final char PAUSE = 'p';
|
||||
public static final char STOP_POLLING = 's';
|
||||
private final Map session;
|
||||
private final RpcConnection rpcConn;
|
||||
private final String cmdPrefix;
|
||||
private String prompt;
|
||||
private Object sid;
|
||||
private StringBuffer timerCommand;//synchronized mutable object as command placeholder for polling thread
|
||||
private final StringBuffer timerCommand;//synchronized mutable object as command placeholder for polling thread
|
||||
private static ArrayList commands;
|
||||
private static int currentCommand = 0;
|
||||
static{
|
||||
|
@ -93,7 +94,13 @@ public class InteractWindow extends MsfFrame {
|
|||
new SwingWorker() {
|
||||
protected Object doInBackground() throws Exception {
|
||||
long time = 100;
|
||||
while (timerCommand.charAt(0) == POLL) {
|
||||
while (timerCommand.charAt(0) != STOP_POLLING) {
|
||||
if (timerCommand.charAt(0)== PAUSE){
|
||||
synchronized(timerCommand){
|
||||
timerCommand.wait();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (lock.tryLock() == false) {
|
||||
this.publish("locked");
|
||||
lock.lock();
|
||||
|
@ -174,12 +181,15 @@ public class InteractWindow extends MsfFrame {
|
|||
promptLabel = new javax.swing.JLabel();
|
||||
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosed(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosed(evt);
|
||||
}
|
||||
public void windowOpened(java.awt.event.WindowEvent evt) {
|
||||
formWindowOpened(evt);
|
||||
}
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
public void windowActivated(java.awt.event.WindowEvent evt) {
|
||||
formWindowActivated(evt);
|
||||
}
|
||||
});
|
||||
|
||||
outputScrollPane.setAutoscrolls(true);
|
||||
|
@ -267,10 +277,6 @@ public class InteractWindow extends MsfFrame {
|
|||
inputFieldActionPerformed(evt);
|
||||
}//GEN-LAST:event_submitButtonActionPerformed
|
||||
|
||||
private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
|
||||
timerCommand.setCharAt(0, STOP_POLLING);
|
||||
}//GEN-LAST:event_formWindowClosed
|
||||
|
||||
private void inputFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputFieldKeyPressed
|
||||
if(evt.getKeyCode() == KeyEvent.VK_UP){
|
||||
currentCommand = (currentCommand - 1 + commands.size()) % commands.size();
|
||||
|
@ -285,6 +291,17 @@ public class InteractWindow extends MsfFrame {
|
|||
inputField.requestFocusInWindow();
|
||||
}//GEN-LAST:event_formWindowOpened
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
timerCommand.setCharAt(0, PAUSE);
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
|
||||
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
|
||||
timerCommand.setCharAt(0, POLL);
|
||||
synchronized(timerCommand){
|
||||
timerCommand.notify();
|
||||
}
|
||||
}//GEN-LAST:event_formWindowActivated
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JTextField inputField;
|
||||
private javax.swing.JTextArea outputArea;
|
||||
|
|
Loading…
Reference in New Issue