Package com.bbn.openmap.omGraphics.editable

Source Code of com.bbn.openmap.omGraphics.editable.ListUnselectedState

// **********************************************************************
//
// <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/omGraphics/editable/ListUnselectedState.java,v
// $
// $RCSfile: ListUnselectedState.java,v $
// $Revision: 1.2.2.2 $
// $Date: 2005/08/10 22:45:10 $
// $Author: dietrick $
//
// **********************************************************************

package com.bbn.openmap.omGraphics.editable;

import java.awt.event.MouseEvent;

import com.bbn.openmap.omGraphics.EditableOMGraphic;
import com.bbn.openmap.omGraphics.GrabPoint;
import com.bbn.openmap.util.Debug;

public class ListUnselectedState extends GraphicUnselectedState {

    public ListUnselectedState(EditableOMGraphic eomg) {
        super(eomg);
    }

    /**
     * In this state, we need to change states only if the graphic, or
     * it's grab points are clicked on. If a point is clicked on, then
     * it should become the moving point, and the graphic should be
     * changed to edit mode.
     */
    public boolean mousePressed(MouseEvent e) {
        Debug.message("eomg", "ListStateMachine|unselected state|mousePressed");
        GrabPoint mp = graphic.getMovingPoint(e);

        if (mp != null) {
            // Else, set the moving point, and go to edit mode. If
            // the mouse is released, we'll consider ourselves
            // unselected again.
            graphic.getStateMachine().setEdit();
            graphic.fireEvent(EOMGCursors.EDIT, "");
            graphic.redraw(e, true);
        }
        return getMapMouseListenerResponse();
    }

    public boolean mouseReleased(MouseEvent e) {
        Debug.message("eomg", "ListStateMachine|unselected state|mouseReleased");
        GrabPoint mp = graphic.getMovingPoint(e);

        if (mp != null) {
            graphic.getStateMachine().setSelected();
            graphic.fireEvent(EOMGCursors.EDIT, "");
            graphic.setMovingPoint(null);
        }
        return getMapMouseListenerResponse();
    }

    public boolean mouseMoved(MouseEvent e) {
        Debug.message("eomgdetail",
                "ListStateMachine|unselected state|mouseMoved");

        GrabPoint mp = graphic.getMovingPoint(e);
        if (mp != null) {
            graphic.fireEvent(EOMGCursors.EDIT,
                    i18n.get(ListUnselectedState.class,
                            "Click_to_select_the_graphic.",
                            "Click to select the graphic."));
        } else {
            graphic.fireEvent(EOMGCursors.DEFAULT, "");
        }
        return false;
    }
}
TOP

Related Classes of com.bbn.openmap.omGraphics.editable.ListUnselectedState

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.