/[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

revision 621 by alfonx, Thu Jan 28 10:06:05 2010 UTC revision 656 by alfonx, Wed Feb 3 12:18:35 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;
62    import schmitzm.swing.SwingUtil;
63  import skrueger.swing.SmallButton;  import skrueger.swing.SmallButton;
64  import skrueger.swing.SmallToggleButton;  import skrueger.swing.SmallToggleButton;
65    
# Line 306  public class MapPaneToolBar extends JToo Line 307  public class MapPaneToolBar extends JToo
307           */           */
308          protected void initToolsAndActions() {          protected void initToolsAndActions() {
309                  // Panning                  // Panning
310                  addTool(new MapPaneToolBarAction(TOOL_PAN, this, "", new ImageIcon(  //              addTool(new MapPaneToolBarAction(TOOL_PAN, this, "", new ImageIcon(
311                                  MapView.class.getResource("resource/icons/pan.png")),  //                              MapView.class.getResource("resource/icons/pan.png")),
312                                  R("MapPaneButtons.Pan.TT")), false);  //                              R("MapPaneButtons.Pan.TT")), false);
                 // Info  
                 addTool(new MapPaneToolBarAction(TOOL_INFO, this, "", new ImageIcon(  
                                 MapView.class.getResource("resource/icons/info.png")),  
                                 R("MapPaneButtons.Info.TT")), false);  
313    
314                    addTool(new MapPaneToolBarAction(TOOL_PAN, this, XMapPaneTool.PAN), false);
315                    
316                    // Info
317    //              addTool(new MapPaneToolBarAction(TOOL_INFO, this, "", new ImageIcon(
318    //                              MapView.class.getResource("resource/icons/info.png")),
319    //                              R("MapPaneButtons.Info.TT")), false);
320                    addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false);
321                    
322                  // Zoom in                  // Zoom in
323                  addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, "", new ImageIcon(                  addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false);
324                                  MapView.class.getResource("resource/icons/zoom_in.png")),                  
                                 R("MapPaneButtons.ZoomIn.TT")), false);  
325                  // Zoom out                  // Zoom out
326                  addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, "", new ImageIcon(                  addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, XMapPaneTool.ZOOM_OUT), false);
327                                  MapView.class.getResource("resource/icons/zoom_out.png")),                  
328                                  R("MapPaneButtons.ZoomOut.TT")), false);                  
329    //              // Zoom in
330    //              addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, "", new ImageIcon(
331    //                              MapView.class.getResource("resource/icons/zoom_in.png")),
332    //                              R("MapPaneButtons.ZoomIn.TT")), false);
333    //              
334    //              // Zoom out
335    //              addTool(new MapPaneToolBarAction(TOOL_ZOOMOUT, this, "", new ImageIcon(
336    //                              MapView.class.getResource("resource/icons/zoom_out.png")),
337    //                              R("MapPaneButtons.ZoomOut.TT")), false);
338                    
339                    
340    
341                  // Action button to revert the last zoom                  // Action button to revert the last zoom
342                  addAction(new MapPaneToolBarAction(ACTION_ZOOM_BACK, this, "",                  addAction(new MapPaneToolBarAction(ACTION_ZOOM_BACK, this, "",
# Line 425  public class MapPaneToolBar extends JToo Line 440  public class MapPaneToolBar extends JToo
440                  switch (tool) {                  switch (tool) {
441                  case TOOL_PAN:                  case TOOL_PAN:
442                          // Set the mouse tool to "Panning"                          // Set the mouse tool to "Panning"
443                          mapPane.setState(SelectableXMapPane.PAN);  //                      mapPane.setState(SelectableXMapPane.PAN);
444                            mapPane.setTool(XMapPaneTool.PAN);
445  //                      mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);  //                      mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);
446                          break;                          break;
447                  case TOOL_INFO:                  case TOOL_INFO:
448                          // Set the mouse tool to "Info"                          // Set the mouse tool to "Info"
449                          mapPane.setState(SelectableXMapPane.SELECT_ONE_FROM_TOP);                          mapPane.setTool(XMapPaneTool.INFO);
450    //                      mapPane.setState(SelectableXMapPane.SELECT_ONE_FROM_TOP);
451  //                      mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);  //                      mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);
452                          break;                          break;
453                  case TOOL_ZOOMIN:                  case TOOL_ZOOMIN:
454                          // Set the mouse tool to "Zoom in"                          // Set the mouse tool to "Zoom in"
455                          mapPane.setState(SelectableXMapPane.ZOOM_IN);                          mapPane.setTool(XMapPaneTool.ZOOM_IN);
456  //                      mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);  //                      mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);
457                          break;                          break;
458                  case TOOL_ZOOMOUT:                  case TOOL_ZOOMOUT:
459                          // Set the mouse tool to "Zoom out"                          // Set the mouse tool to "Zoom out"
460                          mapPane.setState(SelectableXMapPane.ZOOM_OUT);                          mapPane.setTool(XMapPaneTool.ZOOM_OUT);
461    //                      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 623  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 689  public class MapPaneToolBar extends JToo Line 711  public class MapPaneToolBar extends JToo
711                          return -1;                          return -1;
712                  return selectedTool;                  return selectedTool;
713          }          }
714            
715          /**          /**
716           * Sets whether a tool or action is activated or not. The visible property           * Sets whether a tool or action is activated or not. The visible property
717           * of the button is not affected.           * of the button is not affected.
# Line 764  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 888  public class MapPaneToolBar extends JToo Line 913  public class MapPaneToolBar extends JToo
913                          this.toolBar = toolBar;                          this.toolBar = toolBar;
914                  }                  }
915    
916                    public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, XMapPaneTool tool) {
917                            this(id, toolBar, "", tool.getIcon(), tool.getToolTip());
918                    }
919    
920                  /**                  /**
921                   * Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)} or                   * Calls {@link MapPaneToolBar#performToolButton(int, ActionEvent)} or
922                   * {@link MapPaneToolBar#performActionButton(int, ActionEvent)}                   * {@link MapPaneToolBar#performActionButton(int, ActionEvent)}

Legend:
Removed from v.621  
changed lines
  Added in v.656

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26