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

trunk/src/skrueger/geotools/MapPaneToolBar.java revision 256 by alfonx, Fri Jul 31 14:43:47 2009 UTC branches/1.0-gt2-2.6/src/skrueger/geotools/MapPaneToolBar.java revision 336 by alfonx, Thu Aug 27 09:10:10 2009 UTC
# Line 122  public class MapPaneToolBar extends JToo Line 122  public class MapPaneToolBar extends JToo
122           */           */
123          public static final int TOOL_SELECTION_REMOVE = 230;          public static final int TOOL_SELECTION_REMOVE = 230;
124    
125            public static final int ACTION_CHARTS = 401;
126    
127          /** Tool currently selected */          /** Tool currently selected */
128          protected int selectedTool = TOOL_ZOOMIN;          protected int selectedTool = TOOL_ZOOMIN;
129    
# Line 357  public class MapPaneToolBar extends JToo Line 359  public class MapPaneToolBar extends JToo
359                          // Set the mouse tool to "Panning"                          // Set the mouse tool to "Panning"
360                          mapPane.setWindowSelectionState(JMapPane.NONE);                          mapPane.setWindowSelectionState(JMapPane.NONE);
361                          mapPane.setState(JMapPane.PAN);                          mapPane.setState(JMapPane.PAN);
                         mapPane.setHighlight(false);  
362                          mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);                          mapPane.setNormalCursor(SwingUtil.PAN_CURSOR);
363                          break;                          break;
364                  case TOOL_INFO:                  case TOOL_INFO:
# Line 365  public class MapPaneToolBar extends JToo Line 366  public class MapPaneToolBar extends JToo
366                          mapPane.setWindowSelectionState(JMapPane.NONE);                          mapPane.setWindowSelectionState(JMapPane.NONE);
367                          mapPane.setState(JMapPane.SELECT_TOP); // Why not:                          mapPane.setState(JMapPane.SELECT_TOP); // Why not:
368                          // JMapPane.SELECT_TOP_ONEONLY                          // JMapPane.SELECT_TOP_ONEONLY
                         mapPane.setHighlight(false);// SK: Was true, but since it not works  
369                          // properly removed it to save                          // properly removed it to save
370                          // performance                          // performance
371                          mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);                          mapPane.setNormalCursor(SwingUtil.CROSSHAIR_CURSOR);
# Line 374  public class MapPaneToolBar extends JToo Line 374  public class MapPaneToolBar extends JToo
374                          // Set the mouse tool to "Zoom in"                          // Set the mouse tool to "Zoom in"
375                          mapPane.setWindowSelectionState(JMapPane.ZOOM_IN);                          mapPane.setWindowSelectionState(JMapPane.ZOOM_IN);
376                          mapPane.setState(JMapPane.ZOOM_IN);                          mapPane.setState(JMapPane.ZOOM_IN);
                         mapPane.setHighlight(false);  
377                          mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);                          mapPane.setNormalCursor(SwingUtil.ZOOMIN_CURSOR);
378                          break;                          break;
379                  case TOOL_ZOOMOUT:                  case TOOL_ZOOMOUT:
380                          // Set the mouse tool to "Zoom out"                          // Set the mouse tool to "Zoom out"
381                          mapPane.setWindowSelectionState(JMapPane.NONE);                          mapPane.setWindowSelectionState(JMapPane.NONE);
382                          mapPane.setState(JMapPane.ZOOM_OUT);                          mapPane.setState(JMapPane.ZOOM_OUT);
                         mapPane.setHighlight(false);  
383                          mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);                          mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);
384                          break;                          break;
385                  default:                  default:
386                          // Set map actions to default                          // Set map actions to default
387                          mapPane.setWindowSelectionState(JMapPane.NONE);                          mapPane.setWindowSelectionState(JMapPane.NONE);
388                          mapPane.setState(JMapPane.NONE);                          mapPane.setState(JMapPane.NONE);
                         mapPane.setHighlight(false);  
389                          mapPane.setNormalCursor(null);                          mapPane.setNormalCursor(null);
390                          break;                          break;
391                  }                  }
# Line 472  public class MapPaneToolBar extends JToo Line 469  public class MapPaneToolBar extends JToo
469                          initToolBar();                          initToolBar();
470          }          }
471    
472    
473    
474          /**          /**
475           * Adds a tool to the tool bar and resets the toolbar GUI.           * Adds a tool to the tool bar and resets the toolbar GUI.
476           *           *
# Line 507  public class MapPaneToolBar extends JToo Line 506  public class MapPaneToolBar extends JToo
506                  if (resetToolBar)                  if (resetToolBar)
507                          initToolBar();                          initToolBar();
508          }          }
509            
510            /**
511             * Adds any JComponent to the tool bar. Does nothing if a tool or action with the
512             * specified ID already exists!
513             *
514             * @param component A {@link JComponent} that shall be added
515             * @param id The ID associaded with the {@link JComponent}
516             * @param resetToolBar
517             *            indicates whether the toolbar GUI is reset after adding the
518             *            button (if adding several actions it useful only to reset the
519             *            GUI for the last added tool)
520             */
521            public void addJComponent(JComponent component, int id,
522                            boolean resetToolBar) {
523    
524                    if (isButtonIDUsed(id)) {
525                            LOGGER
526                            .warn("addAction(.) ignored because ID already used for tool or action: "
527                                            + id);
528                            return;
529                    }
530                    
531                    toolAndActionButtons.put(id, component);
532                    if (resetToolBar)
533                            initToolBar();
534            }
535    
536          public void addSeparator(int id, Separator separator) {          public void addSeparator(int id, Separator separator) {
537                  if (isButtonIDUsed(id)) {                  if (isButtonIDUsed(id)) {

Legend:
Removed from v.256  
changed lines
  Added in v.336

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26