/*
* Copyright (C) 2004 TiongHiang Lee
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Email: thlee@onemindsoft.org
*/
package org.onemind.swingweb.mapinput.peerdelegate;
import java.awt.AWTEvent;
import java.util.Map;
import org.onemind.awtbridge.event.BridgeEventQueue;
import org.onemind.awtbridge.input.BridgeInputContext;
import org.onemind.awtbridge.input.InputException;
import org.onemind.awtbridge.peer.BridgePeer;
/**
* The default map input delegate
* @author TiongHiang Lee (thlee@onemindsoft.org)
*
*/
public class DefaultMapInputDelegate extends MapInputDelegate
{
/** the instance **/
public static MapInputDelegate INSTANCE = new DefaultMapInputDelegate();
/**
* {@inheritDoc}
*/
public boolean hasEvent(BridgePeer peer, Map form)
{
return form.containsKey(peer.getId());
}
/**
* {@inheritDoc}
*/
public void processInput(BridgePeer peer, BridgeInputContext context, Map inputForm) throws InputException
{
//do nothing
}
/**
* Post an event
* @param context the context
* @param peer the peer
* @param evt the event
*/
protected final void postEvent(BridgeInputContext context, AWTEvent evt)
{
BridgeEventQueue q = (BridgeEventQueue) context.getEventQueue();
q.postEvent(evt);
}
/**
* Post an event with specific priority
* @param context the context
* @param peer the peer
* @param disp the event dispatcher
* @param evt the event
* @param priority the priority
*/
protected final void postEvent(BridgeInputContext context, AWTEvent evt, int priority)
{
BridgeEventQueue q = (BridgeEventQueue) context.getEventQueue();
q.postEvent(evt, priority);
}
}