LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  April 2015

HPS-SVN April 2015

Subject:

r2725 - /java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Thu, 16 Apr 2015 22:54:43 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (169 lines)

Author: [log in to unmask]
Date: Thu Apr 16 15:54:37 2015
New Revision: 2725

Log:
Run panel redraw on the Swing EDT.

Modified:
    java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java

Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java
 =============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java	(original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java	Thu Apr 16 15:54:37 2015
@@ -2,6 +2,8 @@
 
 import java.awt.Point;
 import java.util.ArrayList;
+
+import javax.swing.SwingUtilities;
 
 import org.hps.monitoring.ecal.eventdisplay.event.Association;
 import org.hps.monitoring.ecal.eventdisplay.event.Cluster;
@@ -11,7 +13,7 @@
 /**
  * Class <code>PEventViewer</code> represents a <code>PassiveViewer
  * </code> implementation which displays hits and clusters.
- * 
+ *
  * @author Kyle McCarty
  */
 public class PEventViewer extends PassiveViewer {
@@ -20,73 +22,92 @@
     protected ArrayList<Cluster> clusterList = new ArrayList<Cluster>();
     // Stores hit objects.
     protected ArrayList<EcalHit> hitList = new ArrayList<EcalHit>();
-    
+
     @Override
-    public void addHit(CalorimeterHit lcioHit) { hitList.add(toPanelHit(lcioHit)); }
-    
+    public void addCluster(final Cluster cluster) {
+        this.clusterList.add(cluster);
+    }
+
     @Override
-    public void addHit(EcalHit hit) { hitList.add(hit); }
-    
+    public void addCluster(final org.lcsim.event.Cluster lcioCluster) {
+        this.clusterList.add(toPanelCluster(lcioCluster));
+    }
+
     @Override
-    public void addCluster(Cluster cluster) { clusterList.add(cluster); }
-    
+    public void addHit(final CalorimeterHit lcioHit) {
+        this.hitList.add(toPanelHit(lcioHit));
+    }
+
     @Override
-    public void addCluster(org.lcsim.event.Cluster lcioCluster) { clusterList.add(toPanelCluster(lcioCluster)); }
-    
+    public void addHit(final EcalHit hit) {
+        this.hitList.add(hit);
+    }
+
+    /**
+     * Removes all of the cluster data from the viewer.
+     */
+    public void clearClusters() {
+        this.hitList.clear();
+    }
+
     /**
      * Removes all of the hit data from the viewer.
      */
-    public void clearHits() { hitList.clear(); }
-    
-    /**
-     * Removes all of the cluster data from the viewer.
-     */
-    public void clearClusters() { hitList.clear(); }
-    
+    public void clearHits() {
+        this.hitList.clear();
+    }
+
     @Override
     public void resetDisplay() {
         // Reset the hit and cluster lists.
-        hitList.clear();
-        clusterList.clear();
+        this.hitList.clear();
+        this.clusterList.clear();
     }
-    
+
     @Override
     public void updateDisplay() {
         // Suppress the calorimeter panel's redrawing.
-        ecalPanel.setSuppressRedraw(true);
-        
+        this.ecalPanel.setSuppressRedraw(true);
+
         // Clear the panel data.
-        ecalPanel.clearCrystals();
-        
+        this.ecalPanel.clearCrystals();
+
         // Display the hits.
-        for (EcalHit h : hitList) {
-            int ix = toPanelX(h.getX());
-            int iy = toPanelY(h.getY());
-            ecalPanel.addCrystalEnergy(ix, iy, h.getEnergy());
+        for (final EcalHit h : this.hitList) {
+            final int ix = toPanelX(h.getX());
+            final int iy = toPanelY(h.getY());
+            this.ecalPanel.addCrystalEnergy(ix, iy, h.getEnergy());
         }
-        
+
         // Display the clusters.
-        for(Cluster cluster : clusterList) {
-            Point rawCluster = cluster.getClusterCenter();
-            Point clusterCenter = toPanelPoint(rawCluster);
-            ecalPanel.setCrystalCluster(clusterCenter.x, clusterCenter.y, true);
-            
+        for (final Cluster cluster : this.clusterList) {
+            final Point rawCluster = cluster.getClusterCenter();
+            final Point clusterCenter = toPanelPoint(rawCluster);
+            this.ecalPanel.setCrystalCluster(clusterCenter.x, clusterCenter.y, true);
+
             // Add component hits to the calorimeter panel.
-            for(Point ch : cluster.getComponentHits()) {
-                ecalPanel.addAssociation(new Association(clusterCenter, toPanelPoint(ch), HIGHLIGHT_CLUSTER_COMPONENT));
+            for (final Point ch : cluster.getComponentHits()) {
+                this.ecalPanel.addAssociation(new Association(clusterCenter, toPanelPoint(ch),
+                        HIGHLIGHT_CLUSTER_COMPONENT));
             }
-            
+
             // Add shared hits to the calorimeter panel.
-            for(Point sh : cluster.getSharedHits()) {
-                ecalPanel.addAssociation(new Association(clusterCenter, toPanelPoint(sh), HIGHLIGHT_CLUSTER_SHARED));
+            for (final Point sh : cluster.getSharedHits()) {
+                this.ecalPanel
+                        .addAssociation(new Association(clusterCenter, toPanelPoint(sh), HIGHLIGHT_CLUSTER_SHARED));
             }
         }
-        
+
         // Stop suppressing the redraw and order the panel to update.
-        ecalPanel.setSuppressRedraw(false);
-        ecalPanel.repaint();
-        
+        this.ecalPanel.setSuppressRedraw(false);
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                PEventViewer.this.ecalPanel.repaint();
+            }
+        });
+
         // Update the status panel to account for the new event.
-        updateStatusPanel();
+        this.updateStatusPanel();
     }
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use