geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r443161 [1/3] - in /geronimo/daytrader/trunk/modules: streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/ streamer/src/main/resources/images/ wsappclient/src/main/images/ wsappclient/src/main/java/ wsappclient/src/main/java...
Date Wed, 13 Sep 2006 23:04:28 GMT
Author: djencks
Date: Wed Sep 13 16:04:27 2006
New Revision: 443161

URL: http://svn.apache.org/viewvc?view=rev&rev=443161
Log:
DAYTRADER-2 Fix the image file problems (sort of) in the streamer and ws app clients

Added:
    geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/copyRight.gif   (with
props)
    geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/dayTraderLogo.gif
  (with props)
    geronimo/daytrader/trunk/modules/wsappclient/src/main/resources/images/
    geronimo/daytrader/trunk/modules/wsappclient/src/main/resources/images/dayTraderLogo.gif
  (with props)
Removed:
    geronimo/daytrader/trunk/modules/wsappclient/src/main/images/
    geronimo/daytrader/trunk/modules/wsappclient/src/main/java/Main.java
    geronimo/daytrader/trunk/modules/wsappclient/src/main/java/org/apache/geronimo/samples/daytrader/App.java
Modified:
    geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java
    geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java
    geronimo/daytrader/trunk/modules/wsappclient/src/main/java/org/apache/geronimo/samples/daytrader/client/ws/ClientApp.java

Modified: geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java?view=diff&rev=443161&r1=443160&r2=443161
==============================================================================
--- geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java
(original)
+++ geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClient.java
Wed Sep 13 16:04:27 2006
@@ -17,24 +17,26 @@
 
 package org.apache.geronimo.samples.daytrader.client;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Timer;
+import java.util.TimerTask;
+
 import javax.naming.InitialContext;
 import javax.rmi.PortableRemoteObject;
 
-import org.apache.geronimo.samples.daytrader.ejb.*;
-
-import org.apache.geronimo.samples.daytrader.*;
+import org.apache.geronimo.samples.daytrader.QuoteDataBean;
+import org.apache.geronimo.samples.daytrader.ejb.Trade;
+import org.apache.geronimo.samples.daytrader.ejb.TradeHome;
 
-public class TradeClient implements Runnable {
+public class TradeClient {
 
 	public static final int DEFAULT_UPDATE_INTERVAL = 2;
 	public static final int DEFAULT_MAX_PER_SECOND = 10;
 
 	// Various components
 	private TradeQuoteAuditStats auditStats;
-	private TradeClientMessageListener listener;
-	private TradeClientGUI gui;
-	private int maxPerSecond = DEFAULT_MAX_PER_SECOND;
+    private TradeClientGUI gui;
 
 	private static TradeClient tradeClient;
 
@@ -44,7 +46,9 @@
 	private boolean useENC = true;
 
 	// Updater thread
-	private int updateInterval = DEFAULT_UPDATE_INTERVAL;
+    private final Timer timer = new Timer();
+    private TimerTask updater;
+    private int updateInterval = DEFAULT_UPDATE_INTERVAL;
 
 	public static void main(String[] args) {
 		try	{
@@ -61,7 +65,7 @@
 
 			tradeClient = streamer;
 			streamer.startClient();
-		}
+        }
 		catch (Exception e)	{
 			System.err.println("Caught an unexpected exception!");
 			e.printStackTrace();
@@ -72,18 +76,15 @@
 		return tradeClient;
 	}
 
-	public void startClient() throws Exception {
+	private void startClient() throws Exception {
 		auditStats = new TradeQuoteAuditStats();
 		setupEJB();
-		listener = new TradeClientMessageListener(this, useENC);
+		TradeClientMessageListener listener = new TradeClientMessageListener(this, useENC);
 		listener.subscribe();
 		resetStatsFromServer();
 		gui = new TradeClientGUI(this);
 		gui.show();
-		Thread t = new Thread(this);
-		t.setDaemon(true);
-		t.start();
-	}
+    }
 
 	public TradeQuoteAuditStats getAuditStats() {
 		return auditStats;
@@ -130,20 +131,20 @@
 
 	public void setUpdateInterval(int updateInterval) {
 		this.updateInterval = updateInterval;
-	}
+        if (updater != null) {
+            updater.cancel();
+        }
+        updater = new TimerTask() {
+            public void run() {
+                auditStats.fireTableDataChanged();
+                System.out.println("Updating");
+            }
+        };
+        timer.scheduleAtFixedRate(updater, (long)updateInterval*1000, (long)updateInterval*1000);
+    }
 
 	public void closeClient() {
-		System.exit(1);
+        System.exit(1);
 	}
 
-	public void run() {
-		while(true) {
-			try {
-				Thread.sleep((long)updateInterval*1000);
-			}
-			catch (InterruptedException ie) {
-			}
-			auditStats.fireTableDataChanged();
-		}
-	}
 }

Modified: geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java?view=diff&rev=443161&r1=443160&r2=443161
==============================================================================
--- geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java
(original)
+++ geronimo/daytrader/trunk/modules/streamer/src/main/java/org/apache/geronimo/samples/daytrader/client/TradeClientGUI.java
Wed Sep 13 16:04:27 2006
@@ -31,8 +31,8 @@
 	private JLabel webLabel, ejbLabel;
 	private TradeClientGUIProperties props;
 
-	private static final String TRADELOGO_FILENAME = "/images/tradeLogoSmall.gif";
-	private static final String WEBSPHERELOGO_FILENAME = "/images/WEBSPHERE_18P_UNIX.GIF";
+	private static final String TRADELOGO_FILENAME = "/images/dayTraderLogo.gif";
+	private static final String WEBSPHERELOGO_FILENAME = "/images/copyRight.gif";
 
 	public TradeClientGUI(TradeClient client) {
 		this.client = client;
@@ -57,10 +57,10 @@
 		JScrollPane scrollpane1 = new JScrollPane(auditTable);
 
 		ImageIcon iconTrade = new ImageIcon(this.getClass().getResource(TRADELOGO_FILENAME));
-		ImageIcon iconWS = new ImageIcon(this.getClass().getResource(WEBSPHERELOGO_FILENAME));
+//		ImageIcon iconWS = new ImageIcon(this.getClass().getResource(WEBSPHERELOGO_FILENAME));
 
 		topImagePanel.add(new JLabel(iconTrade), BorderLayout.WEST);
-		topImagePanel.add(new JLabel(iconWS), BorderLayout.EAST);
+//		topImagePanel.add(new JLabel(iconWS), BorderLayout.EAST);
 
 		streamerPanel.setLayout(new BorderLayout());
 		streamerPanel.add(topImagePanel, BorderLayout.NORTH);

Added: geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/copyRight.gif
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/copyRight.gif?view=auto&rev=443161
==============================================================================
Binary file - no diff available.

Propchange: geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/copyRight.gif
------------------------------------------------------------------------------
    svn:mime-type = image/gif

Added: geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/dayTraderLogo.gif
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/dayTraderLogo.gif?view=auto&rev=443161
==============================================================================
Binary file - no diff available.

Propchange: geronimo/daytrader/trunk/modules/streamer/src/main/resources/images/dayTraderLogo.gif
------------------------------------------------------------------------------
    svn:mime-type = image/gif



Mime
View raw message