package org.mwc.debrief.lite.menu;

import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractAction;
import javax.swing.JLabel;

import org.geotools.swing.JMapPane;
import org.geotools.swing.action.PanAction;
import org.geotools.swing.action.ZoomInAction;
import org.mwc.debrief.lite.gui.FitToWindow;
import org.mwc.debrief.lite.gui.ZoomOut;
import org.mwc.debrief.lite.map.GeoToolMapRenderer;
import org.mwc.debrief.lite.map.RangeBearingAction;
import org.pushingpixels.flamingo.api.ribbon.JRibbon;
import org.pushingpixels.flamingo.api.ribbon.JRibbonBand;
import org.pushingpixels.flamingo.api.ribbon.RibbonElementPriority;
import org.pushingpixels.flamingo.api.ribbon.RibbonTask;
import org.pushingpixels.flamingo.api.ribbon.resize.CoreRibbonResizePolicies;
import org.pushingpixels.flamingo.api.ribbon.resize.CoreRibbonResizePolicies.IconRibbonBandResizePolicy;
import org.pushingpixels.flamingo.api.ribbon.resize.RibbonBandResizePolicy;

import MWC.GUI.Layers;

public class DebriefRibbonView
{
  protected static void addViewTab(final JRibbon ribbon,
      final GeoToolMapRenderer _geoMapRenderer, final Layers layers, JLabel statusBar)
  {
    final JRibbonBand viewBand = new JRibbonBand("View", null);
    final JMapPane mapPane = (JMapPane) _geoMapRenderer.getMap();
    final AbstractAction doFit = new FitToWindow(layers, mapPane);
        
    viewBand.startGroup();
    MenuUtils.addCommand("Pan", "images/16/hand.png", new PanAction(mapPane),
        viewBand, RibbonElementPriority.TOP);
    final ZoomInAction zoomInAction = new ZoomInAction(mapPane);
    MenuUtils.addCommand("Zoom In", "images/16/zoomin.png", zoomInAction,
        viewBand, RibbonElementPriority.TOP);
    final RangeBearingAction rangeAction = new RangeBearingAction(mapPane, statusBar);
    MenuUtils.addCommand("Rne/Brg", "images/16/rng_brg.png", rangeAction,
        viewBand, RibbonElementPriority.TOP);
    
    
    viewBand.startGroup();
    MenuUtils.addCommand("Zoom Out", "images/16/zoomout.png", new ZoomOut(
        mapPane), viewBand, RibbonElementPriority.TOP);
    MenuUtils.addCommand("Fit to Window", "images/16/fit_to_win.png",
        doFit, viewBand, null);
    final List<RibbonBandResizePolicy> policies = new ArrayList<>();
    policies.add(new CoreRibbonResizePolicies.Mirror(viewBand));
    policies.add(new CoreRibbonResizePolicies.Mid2Low(viewBand));
    policies.add(new IconRibbonBandResizePolicy(viewBand));
    viewBand.setResizePolicies(policies);
    final RibbonTask fileTask = new RibbonTask("View", viewBand);
    ribbon.addTask(fileTask);

    // lastly, run the zoom-in event, to put the map into that mode
  //  zoomInAction.actionPerformed(new ActionEvent(viewBand,
    //    ActionEvent.ACTION_PERFORMED, "Click"));
  }
}

@@ -453,32 +453,121 @@
 eBearingAction;%0A
+import org.pushingpixels.flamingo.api.common.FlamingoCommand.FlamingoCommandToggleGroup;%0A
 import org.pushi
@@ -1449,24 +1449,159 @@
 pPane);%0A
+%0A
     
-    
+// group for the mosue mode radio buttons%0A    final FlamingoCommandToggleGroup mouseModeGroup =%0A        new FlamingoCommandToggleGroup();%0A
 %0A    vie
@@ -1644,16 +1644,28 @@
 dCommand
+ToggleButton
 (%22Pan%22, 
@@ -1745,32 +1745,61 @@
 mentPriority.TOP
+, true, mouseModeGroup, false
 );%0A    final Zoo
@@ -1870,24 +1870,36 @@
 s.addCommand
+ToggleButton
 (%22Zoom In%22, 
@@ -1975,24 +1975,52 @@
 Priority.TOP
+, true, mouseModeGroup, true
 );%0A    final
@@ -2121,16 +2121,28 @@
 dCommand
+ToggleButton
 (%22Rne/Br
@@ -2226,23 +2226,47 @@
 rity.TOP
-);%0A    
+, true, mouseModeGroup, false);
 %0A    %0A  
@@ -2924,189 +2924,8 @@
 sk);
-%0A%0A    // lastly, run the zoom-in event, to put the map into that mode%0A  //  zoomInAction.actionPerformed(new ActionEvent(viewBand,%0A    //    ActionEvent.ACTION_PERFORMED, %22Click%22));
 %0A  %7D

Make the mouse mode buttons have radio button behaviour