Package com.bbn.openmap.layer.location

Source Code of com.bbn.openmap.layer.location.LocationCBMenuItem

// **********************************************************************
//
// <copyright>
//
//  BBN Technologies
//  10 Moulton Street
//  Cambridge, MA 02138
//  (617) 873-8000
//
//  Copyright (C) BBNT Solutions LLC. All rights reserved.
//
// </copyright>
// **********************************************************************
//
// $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/layer/location/LocationCBMenuItem.java,v $
// $RCSfile: LocationCBMenuItem.java,v $
// $Revision: 1.2.2.1 $
// $Date: 2004/10/14 18:27:10 $
// $Author: dietrick $
//
// **********************************************************************

package com.bbn.openmap.layer.location;

import java.awt.event.*;

import javax.swing.JCheckBoxMenuItem;

/**
* This is an checkbox item that sits on the popup menu. It knows how
* to get information it needs from the menu, and recenters the map,
* or brings up more information about the location.
*/
public class LocationCBMenuItem extends JCheckBoxMenuItem implements
        ActionListener {

    protected LocationPopupMenu clp;
    protected LocationLayer layer;

    public LocationCBMenuItem() {}

    public LocationCBMenuItem(String text) {
        super(text);
        this.addActionListener(this);
    }

    public LocationCBMenuItem(String text, LocationPopupMenu aCLP,
            LocationLayer aLayer) {
        this(text);
        setLocationPopupMenu(aCLP);
        setLayer(aLayer);
    }

    public void setLocationPopupMenu(LocationPopupMenu aCLP) {
        clp = aCLP;
    }

    public LocationPopupMenu getLocationPopupMenu() {
        return clp;
    }

    public void setLayer(LocationLayer aLayer) {
        layer = aLayer;
    }

    public LocationLayer getLayer() {
        return layer;
    }

    public void actionPerformed(java.awt.event.ActionEvent e) {
        //          Debug.output("Action: " + e);
        String command = e.getActionCommand();

        if (layer != null && e.getSource().equals(this)) {
            if (command.equals(LocationHandler.showname)) {
                JCheckBoxMenuItem btn = (JCheckBoxMenuItem) e.getSource();
                clp.getLoc().setShowName(btn.getState());
                layer.repaint();
            }
        }
    }
}
TOP

Related Classes of com.bbn.openmap.layer.location.LocationCBMenuItem

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.