/[schmitzm]/trunk/src/skrueger/geotools/MapPaneToolBar.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/MapPaneToolBar.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/2.0-RC2/src/skrueger/geotools/MapPaneToolBar.java revision 653 by alfonx, Mon Feb 1 15:09:18 2010 UTC trunk/src/skrueger/geotools/MapPaneToolBar.java revision 694 by alfonx, Fri Feb 12 11:28:41 2010 UTC
# Line 59  import schmitzm.geotools.map.event.MapPa Line 59  import schmitzm.geotools.map.event.MapPa
59  import schmitzm.lang.LangUtil;  import schmitzm.lang.LangUtil;
60  import schmitzm.lang.ResourceProvider;  import schmitzm.lang.ResourceProvider;
61  import schmitzm.swing.ButtonGroup;  import schmitzm.swing.ButtonGroup;
 import schmitzm.swing.SwingUtil;  
62  import skrueger.swing.SmallButton;  import skrueger.swing.SmallButton;
63  import skrueger.swing.SmallToggleButton;  import skrueger.swing.SmallToggleButton;
64    
# Line 96  public class MapPaneToolBar extends JToo Line 95  public class MapPaneToolBar extends JToo
95    
96          /** Constant for the tool "Zoom In" (110). */          /** Constant for the tool "Zoom In" (110). */
97          public static final int TOOL_ZOOMIN = 110;          public static final int TOOL_ZOOMIN = 110;
98            public static final int ACTION_ZOOM_DEFAULT = 150;
99          /** Constant for the tool "Zoom Out" (120). */          /** Constant for the tool "Zoom Out" (120). */
100          public static final int TOOL_ZOOMOUT = 120;          public static final int TOOL_ZOOMOUT = 120;
101          /** Constant for the action "Zoom back" (130). */          /** Constant for the action "Zoom back" (130). */
# Line 318  public class MapPaneToolBar extends JToo Line 318  public class MapPaneToolBar extends JToo
318  //                              MapView.class.getResource("resource/icons/info.png")),  //                              MapView.class.getResource("resource/icons/info.png")),
319  //                              R("MapPaneButtons.Info.TT")), false);  //                              R("MapPaneButtons.Info.TT")), false);
320                  addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false);                  addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false);
321                    
322                  // Zoom in                  // Zoom in
323                  addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false);                  addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false);
324                                    
# Line 461  public class MapPaneToolBar extends JToo Line 461  public class MapPaneToolBar extends JToo
461  //                      mapPane.setState(SelectableXMapPane.ZOOM_OUT);  //                      mapPane.setState(SelectableXMapPane.ZOOM_OUT);
462  //                      mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);  //                      mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);
463                          break;                          break;
464                  default:  //              default:
465                          // Set map actions to default                          // Set map actions to default
466                          mapPane.setState(SelectableXMapPane.NONE);  //                      mapPane.setState(SelectableXMapPane.NONE);
467  //                      mapPane.setNormalCursor(null);  //                      mapPane.setNormalCursor(null);
468                          break;  //                      break;
469                  }                  }
470  //              mapPane.updateCursorAndRepaintTimer();  //              mapPane.updateCursorAndRepaintTimer();
471          }          }
# Line 491  public class MapPaneToolBar extends JToo Line 491  public class MapPaneToolBar extends JToo
491          protected void performActionButton(int action, ActionEvent e) {          protected void performActionButton(int action, ActionEvent e) {
492                  if (mapPane == null)                  if (mapPane == null)
493                          return;                          return;
494                    
495                  // Perform the action "Zoom back": Revert the last zoom                  // Perform the action "Zoom back": Revert the last zoom
496                  if (action == ACTION_ZOOM_BACK) {                  if (action == ACTION_ZOOM_BACK) {
497                          if (zoomBackIndex <= 1)                          if (zoomBackIndex <= 1)
# Line 641  public class MapPaneToolBar extends JToo Line 641  public class MapPaneToolBar extends JToo
641           *         {@linkplain #getToolButton(int) tool button}           *         {@linkplain #getToolButton(int) tool button}
642           */           */
643          public AbstractButton getButton(int id) {          public AbstractButton getButton(int id) {
644                    
645                    //ACHUTNG: Das ist ein SK QUICK FIX! TODO
646                    if (!(toolAndActionButtons.get(id) instanceof AbstractButton)) return null;
647                    
648                  AbstractButton button = (AbstractButton) toolAndActionButtons.get(id);                  AbstractButton button = (AbstractButton) toolAndActionButtons.get(id);
649                  if (button == null)                  if (button == null)
650                          LOGGER.warn("Unknown tool or action ID: " + id);                          LOGGER.warn("Unknown tool or action ID: " + id);
# Line 782  public class MapPaneToolBar extends JToo Line 786  public class MapPaneToolBar extends JToo
786           *            is {@code false}           *            is {@code false}
787           */           */
788          public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {          public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {
789                  for (int tool : toolAndActionButtons.keySet())                  for (int id : toolAndActionButtons.keySet()) {
790                          setButtonEnabled(tool, enabled, hideOnDisable);                          if (toolAndActionButtons.get(id) instanceof JToggleButton) {
791                            setButtonEnabled(id, enabled, hideOnDisable);
792                            }
793                    }
794          }          }
795            
796          /**          /**
797           * Sets the activation for all actions.           * Sets the activation for all actions.
798           *           *
# Line 907  public class MapPaneToolBar extends JToo Line 914  public class MapPaneToolBar extends JToo
914                  }                  }
915    
916                  public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, XMapPaneTool tool) {                  public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, XMapPaneTool tool) {
917                          this(id, toolBar, "", tool.icon, tool.toolTip);                          this(id, toolBar, "", tool.getIcon(), tool.getToolTip());
918                  }                  }
919    
920                  /**                  /**

Legend:
Removed from v.653  
changed lines
  Added in v.694

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26