18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

BUILDING APPLICATIONS WITH VISUAL JAVABEANS<br />

3. Run the application.<br />

The map document has been loaded into the pageLayout component, and the<br />

toc component lists the data layers in the map document. Use the toc component<br />

to toggle layer visibility. By default, the focus map of the map document<br />

is loaded into the map component. Also note that the commands have been<br />

added to the toolbar component.<br />

Creating popup menu using ToolbarMenu<br />

<strong>ArcGIS</strong> <strong>Engine</strong> provides a ToolbarMenu component that can be used to add<br />

popup menus to other components, such as MapBean and PageLayoutBean. In<br />

this step, you will add a popup menu to the pageLayout component. The popup<br />

menu will contain prebuilt commands from the com.esri.arcgis.controlcommands<br />

package.<br />

To display the popup menu, an event handler will be added to the pageLayout<br />

component for the onMouseDown event. If the right mouse button is clicked,<br />

the menu will be displayed.<br />

1. Add the following imports to MapViewerFrame.java:<br />

import com.esri.arcgis.beans.toolbar.ToolbarMenu;<br />

import<br />

com.esri.arcgis.beans.pagelayout.IPageLayoutControlEventsOnMouseDownEvent;<br />

import com.esri.arcgis.controlcommands.ControlsPageZoomInFixedCommand;<br />

import com.esri.arcgis.controlcommands.ControlsPageZoomOutFixedCommand;<br />

2. Add a member variable for the ToolbarMenu as shown below:<br />

public class MapViewerFrame extends JFrame{<br />

PageLayoutBean pageLayout;<br />

MapBean map;<br />

TOCBean toc;<br />

ToolbarBean toolbar;<br />

ToolbarMenu popupMenu;<br />

JLabel statusLabel;<br />

Chapter 6 • <strong>Developer</strong> scenarios • 313

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!