
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

//class ImageObserverImpl implements java.awt.image.ImageObserver {
//    public boolean updateImage(Image img, int infoflags, int x, int y, int width, int height) {
//        System.out.println("w = "+width+",h = "+height);
//    }
//}

public class WifiLinkViewer extends javax.swing.JFrame {

    private Image bgImage;
    private java.awt.image.ImageObserver io;
    private Hashtable datasets;
    private Hashtable mapImages;
    
    public WifiLinkViewer() {
        this.datasets = new Hashtable();
        this.mapImages = new Hashtable();
        
        io = new java.awt.Component() {
            public boolean updateImage(Image img, int infoflags, int x, int y, int width, int height) {
                System.out.println("w = "+width+",h = "+height);
                
                return true;
            }
        };
        
        bgImage = Toolkit.getDefaultToolkit().getImage("../meb3fl-2.jpg");
        mapImages.put("Floor4/WSN",bgImage);
        
        try {
            MediaTracker tracker = new MediaTracker(this);
            tracker.addImage(bgImage, 0);
            tracker.waitForID(0);
            //System.out.println("width = "+bgImage.getWidth(io));
        }
        catch (InterruptedException ex) {
            ex.printStackTrace();
        }
        
        // in the applet, we'll read in the possible datasets and 
        
        WirelessData defaultData = null;
        NodePosition defaultPositions = null;
        MapDataModel defaultModel = null;
        String defaultDatasetName = "Floor4/WSN";
        
        try {
            //defaultData = ILEStats.parseDumpFile("../wifi_data.log", "pcwf");
            defaultData = ILEStats.parseDumpFile("../wifi_test.log", "pcwf");
            defaultPositions = NodePositions.parseFile("../wifi_positions");
            
            defaultModel = new MapDataModel(defaultData,defaultPositions);
            datasets.put(defaultDatasetName,defaultModel);
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(-2);
        }
        
        initComponents();
        
        
        
        ;
        
    }
    
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        nodeMapScrollPane = new javax.swing.JScrollPane();
        nodeMapPanel = new NodeMapPanel();
        //nodeMapPanel.setBackgroundImage(bgImage);
        //nodeMapPanel.setPositions(positions);
        //nodeMapPanel.setILEStats(model);
        controlPanel = new ControlPanel(datasets,mapImages,nodeMapPanel);

        getContentPane().setLayout(new java.awt.GridBagLayout());

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        nodeMapScrollPane.setBackground(new java.awt.Color(255, 255, 255));
        nodeMapScrollPane.setViewportView(nodeMapPanel);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        getContentPane().add(nodeMapScrollPane, gridBagConstraints);

        controlPanel.setPreferredSize(new java.awt.Dimension(200, 247));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        getContentPane().add(controlPanel, gridBagConstraints);

        pack();
    }
    // </editor-fold>//GEN-END:initComponents
        
    public static void main(final String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new WifiLinkViewer().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private ControlPanel controlPanel;
    private NodeMapPanel nodeMapPanel;
    private javax.swing.JScrollPane nodeMapScrollPane;
    // End of variables declaration//GEN-END:variables
    
}

@@ -545,16 +545,31 @@
 kViewer(
+String dataFile
 ) %7B%0A    
@@ -1677,59 +1677,48 @@
 y %7B%0A
+%09
     
-        //defaultData = ILEStats.parseDump
+if ( dataFile == null ) data
 File
-(
+ = 
 %22../
@@ -1726,27 +1726,30 @@
 ifi_
-data
+test
 .log%22
-, %22pcwf%22);
+; // Default.
 %0A   
@@ -1794,34 +1794,24 @@
 umpFile(
-%22../wifi_test.log%22
+dataFile
 , %22pcwf%22
@@ -3877,24 +3877,95 @@
 oid run() %7B%0A
+%09%09String dataFile = null;%0A%09%09if ( args.length %3E 0 ) dataFile = args%5B0%5D;%0A
             
@@ -3987,16 +3987,24 @@
 kViewer(
+dataFile
 ).setVis

Add data file arg to WifiLinkViewer app.