001    package edu.nrao.sss.model.source.experiment;
002    
003    import java.awt.Dimension;
004    
005    import javax.swing.BoxLayout;
006    import javax.swing.JPanel;
007    
008    /**
009     * An wrapper of a {@link SourceMapComponent} that has a display of the
010     * mouse's current celestial sphere coordinates and a set of
011     * controls to manipulate the map.
012     * <p>
013     * <i>This class is a stubbed prototype.  It's API needs many additions
014     * before it is ready for production.  We may even throw it away.
015     * At this time there are no active controls</i></p>
016     * <p>
017     * <b>Version Info:</b>
018     * <table style="margin-left:2em">
019     *   <tr><td>$Revision: 1711 $</td></tr>
020     *   <tr><td>$Date: 2008-11-14 13:00:45 -0700 (Fri, 14 Nov 2008) $</td></tr>
021     *   <tr><td>$Author: dharland $ (last person to modify)</td></tr>
022     * </table></p>
023     * 
024     * @author David M. Harland
025     * @since 2007-06-14
026     */
027    public class ControlledSourceMapPanel
028      extends JPanel
029    {
030      private static final long serialVersionUID = 1L;
031    
032      private SourceMapComponent     bullseye;
033      private SourceMapPositionLabel positionLabel;
034    //private SourceMapControl       controlPanel;
035    
036      /** Creates a new instance. */
037      public ControlledSourceMapPanel()
038      {
039        bullseye      = new SourceMapComponent();
040        positionLabel = new SourceMapPositionLabel(bullseye);
041      //controlPanel  = new SourceMapControl(bullseye);
042        
043        configureView();
044      }
045    
046      /** Initializes view-oriented properties. */
047      private void configureView()
048      {
049        JPanel leftBox = new JPanel();
050        leftBox.setLayout(new BoxLayout(leftBox, BoxLayout.Y_AXIS));
051        leftBox.add(bullseye);
052        leftBox.add(positionLabel);
053        
054        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
055        add(leftBox);
056        //add(controlPanel);
057        
058        double prefWidth  = bullseye.getPreferredSize().getWidth() +
059                            /*controlPanel.getPreferredSize().getWidth()*/ 0;
060        
061        double prefHeight = bullseye.getPreferredSize().getHeight() +
062                            positionLabel.getPreferredSize().getHeight();
063        
064        setPreferredSize(new Dimension((int)prefWidth, (int)prefHeight));
065      }
066    
067      /**
068       * Returns the wrapped map.
069       * @return the wrapped map.
070       */
071      public SourceMapComponent getBullseye()
072      {
073        return bullseye;
074      }
075    }