/[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 862 by alfonx, Sat May 22 01:24:46 2010 UTC
# Line 25  Line 25 
25   *   *
26   * Contributors:   * Contributors:
27   *     Martin O. J. Schmitz - initial API and implementation   *     Martin O. J. Schmitz - initial API and implementation
28   *     Stefan A. Krüger - additional utility classes   *     Stefan A. Tzeggai - additional utility classes
29   ******************************************************************************/   ******************************************************************************/
30  package skrueger.geotools;  package skrueger.geotools;
31    
# Line 53  import javax.swing.JToolBar; Line 53  import javax.swing.JToolBar;
53  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
54    
55  import schmitzm.geotools.gui.SelectableXMapPane;  import schmitzm.geotools.gui.SelectableXMapPane;
56    import schmitzm.geotools.gui.XMapPaneEvent;
57    import schmitzm.geotools.gui.XMapPaneTool;
58  import schmitzm.geotools.map.event.JMapPaneListener;  import schmitzm.geotools.map.event.JMapPaneListener;
59  import schmitzm.geotools.map.event.MapAreaChangedEvent;  import schmitzm.geotools.map.event.MapAreaChangedEvent;
 import schmitzm.geotools.map.event.MapPaneEvent;  
60  import schmitzm.lang.LangUtil;  import schmitzm.lang.LangUtil;
61  import schmitzm.lang.ResourceProvider;  import schmitzm.lang.ResourceProvider;
62  import schmitzm.swing.ButtonGroup;  import schmitzm.swing.ButtonGroup;
 import schmitzm.swing.SwingUtil;  
63  import skrueger.swing.SmallButton;  import skrueger.swing.SmallButton;
64  import skrueger.swing.SmallToggleButton;  import skrueger.swing.SmallToggleButton;
65    
# Line 74  import com.vividsolutions.jts.geom.Envel Line 74  import com.vividsolutions.jts.geom.Envel
74   *   *
75   * @author <a href="mailto:[email protected]">Martin Schmitz</a>   * @author <a href="mailto:[email protected]">Martin Schmitz</a>
76   *         (University of Bonn/Germany)   *         (University of Bonn/Germany)
77   * @version 1.2 Stefan Krüger   * @version 1.2 Stefan Tzeggai
78   */   */
79  public class MapPaneToolBar extends JToolBar {  public class MapPaneToolBar extends JToolBar {
80          private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class          private static final Logger LOGGER = Logger.getLogger(MapPaneToolBar.class
# Line 96  public class MapPaneToolBar extends JToo Line 96  public class MapPaneToolBar extends JToo
96    
97          /** Constant for the tool "Zoom In" (110). */          /** Constant for the tool "Zoom In" (110). */
98          public static final int TOOL_ZOOMIN = 110;          public static final int TOOL_ZOOMIN = 110;
99            public static final int ACTION_ZOOM_DEFAULT = 150;
100          /** Constant for the tool "Zoom Out" (120). */          /** Constant for the tool "Zoom Out" (120). */
101          public static final int TOOL_ZOOMOUT = 120;          public static final int TOOL_ZOOMOUT = 120;
102          /** Constant for the action "Zoom back" (130). */          /** Constant for the action "Zoom back" (130). */
# Line 208  public class MapPaneToolBar extends JToo Line 209  public class MapPaneToolBar extends JToo
209    
210                  // Create a Listener to listen to the zooms on the JMapPane                  // Create a Listener to listen to the zooms on the JMapPane
211                  this.mapPaneListener = new JMapPaneListener() {                  this.mapPaneListener = new JMapPaneListener() {
212                          public void performMapPaneEvent(MapPaneEvent e) {                          public void performMapPaneEvent(XMapPaneEvent e) {
213                                  if (!(e instanceof MapAreaChangedEvent))                                  if (!(e instanceof MapAreaChangedEvent))
214                                          return;                                          return;
215    
# Line 318  public class MapPaneToolBar extends JToo Line 319  public class MapPaneToolBar extends JToo
319  //                              MapView.class.getResource("resource/icons/info.png")),  //                              MapView.class.getResource("resource/icons/info.png")),
320  //                              R("MapPaneButtons.Info.TT")), false);  //                              R("MapPaneButtons.Info.TT")), false);
321                  addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false);                  addTool(new MapPaneToolBarAction(TOOL_INFO, this, XMapPaneTool.INFO), false);
322                    
323                  // Zoom in                  // Zoom in
324                  addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false);                  addTool(new MapPaneToolBarAction(TOOL_ZOOMIN, this, XMapPaneTool.ZOOM_IN), false);
325                                    
# Line 461  public class MapPaneToolBar extends JToo Line 462  public class MapPaneToolBar extends JToo
462  //                      mapPane.setState(SelectableXMapPane.ZOOM_OUT);  //                      mapPane.setState(SelectableXMapPane.ZOOM_OUT);
463  //                      mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);  //                      mapPane.setNormalCursor(SwingUtil.ZOOMOUT_CURSOR);
464                          break;                          break;
465                  default:  //              default:
466                          // Set map actions to default                          // Set map actions to default
467                          mapPane.setState(SelectableXMapPane.NONE);  //                      mapPane.setState(SelectableXMapPane.NONE);
468  //                      mapPane.setNormalCursor(null);  //                      mapPane.setNormalCursor(null);
469                          break;  //                      break;
470                  }                  }
471  //              mapPane.updateCursorAndRepaintTimer();  //              mapPane.updateCursorAndRepaintTimer();
472          }          }
# Line 491  public class MapPaneToolBar extends JToo Line 492  public class MapPaneToolBar extends JToo
492          protected void performActionButton(int action, ActionEvent e) {          protected void performActionButton(int action, ActionEvent e) {
493                  if (mapPane == null)                  if (mapPane == null)
494                          return;                          return;
495                    
496                  // Perform the action "Zoom back": Revert the last zoom                  // Perform the action "Zoom back": Revert the last zoom
497                  if (action == ACTION_ZOOM_BACK) {                  if (action == ACTION_ZOOM_BACK) {
498                          if (zoomBackIndex <= 1)                          if (zoomBackIndex <= 1)
# Line 641  public class MapPaneToolBar extends JToo Line 642  public class MapPaneToolBar extends JToo
642           *         {@linkplain #getToolButton(int) tool button}           *         {@linkplain #getToolButton(int) tool button}
643           */           */
644          public AbstractButton getButton(int id) {          public AbstractButton getButton(int id) {
645                    
646                    //ACHUTNG: Das ist ein SK QUICK FIX! TODO
647                    if (!(toolAndActionButtons.get(id) instanceof AbstractButton)) return null;
648                    
649                  AbstractButton button = (AbstractButton) toolAndActionButtons.get(id);                  AbstractButton button = (AbstractButton) toolAndActionButtons.get(id);
650                  if (button == null)                  if (button == null)
651                          LOGGER.warn("Unknown tool or action ID: " + id);                          LOGGER.warn("Unknown tool or action ID: " + id);
# Line 782  public class MapPaneToolBar extends JToo Line 787  public class MapPaneToolBar extends JToo
787           *            is {@code false}           *            is {@code false}
788           */           */
789          public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {          public void setAllToolsEnabled(boolean enabled, boolean hideOnDisable) {
790                  for (int tool : toolAndActionButtons.keySet())                  for (int id : toolAndActionButtons.keySet()) {
791                          setButtonEnabled(tool, enabled, hideOnDisable);                          if (toolAndActionButtons.get(id) instanceof JToggleButton) {
792                            setButtonEnabled(id, enabled, hideOnDisable);
793                            }
794                    }
795          }          }
796            
797          /**          /**
798           * Sets the activation for all actions.           * Sets the activation for all actions.
799           *           *
# Line 907  public class MapPaneToolBar extends JToo Line 915  public class MapPaneToolBar extends JToo
915                  }                  }
916    
917                  public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, XMapPaneTool tool) {                  public MapPaneToolBarAction(int id, MapPaneToolBar toolBar, XMapPaneTool tool) {
918                          this(id, toolBar, "", tool.icon, tool.toolTip);                          this(id, toolBar, "", tool.getIcon(), tool.getToolTip());
919                  }                  }
920    
921                  /**                  /**

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26