001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032:
033: package com.vividsolutions.jump.workbench.ui.cursortool;
034:
035: import java.awt.event.MouseEvent;
036: import java.util.Iterator;
037:
038: /**
039: * Enables multiple CursorTools to operate at the same time. Events are passed
040: * to all CursorTools in sequence.
041: * @see OrCompositeTool
042: */
043: public class AndCompositeTool extends CompositeTool {
044: public AndCompositeTool() {
045: this (new CursorTool[] {});
046: }
047:
048: public AndCompositeTool(CursorTool[] cursorTools) {
049: super (cursorTools);
050: }
051:
052: public String getName() {
053: return getName("&");
054: }
055:
056: public void setCursorTool(CursorTool cursorTool) {
057: cursorTools.clear();
058: add(cursorTool);
059: }
060:
061: public void mouseClicked(MouseEvent e) {
062: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
063: CursorTool cursorTool = (CursorTool) i.next();
064: cursorTool.mouseClicked(e);
065: }
066: }
067:
068: public void mousePressed(MouseEvent e) {
069: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
070: CursorTool cursorTool = (CursorTool) i.next();
071: cursorTool.mousePressed(e);
072: }
073: }
074:
075: public void mouseReleased(MouseEvent e) {
076: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
077: CursorTool cursorTool = (CursorTool) i.next();
078: cursorTool.mouseReleased(e);
079: }
080: }
081:
082: public void mouseEntered(MouseEvent e) {
083: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
084: CursorTool cursorTool = (CursorTool) i.next();
085: cursorTool.mouseEntered(e);
086: }
087: }
088:
089: public void mouseExited(MouseEvent e) {
090: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
091: CursorTool cursorTool = (CursorTool) i.next();
092: cursorTool.mouseExited(e);
093: }
094: }
095:
096: public void mouseDragged(MouseEvent e) {
097: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
098: CursorTool cursorTool = (CursorTool) i.next();
099: cursorTool.mouseDragged(e);
100: }
101: }
102:
103: public void mouseMoved(MouseEvent e) {
104: for (Iterator i = cursorTools.iterator(); i.hasNext();) {
105: CursorTool cursorTool = (CursorTool) i.next();
106: cursorTool.mouseMoved(e);
107: }
108: }
109: }
|