001 // GraphLab Project: http://graphlab.sharif.edu 002 // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology 003 // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ 004 package graphlab.plugins.algorithmanimator.core.atoms; 005 006 import graphlab.graph.ui.GTabbedGraphPane; 007 import graphlab.library.event.Event; 008 import graphlab.library.event.MessageEvent; 009 import graphlab.platform.core.BlackBoard; 010 import graphlab.plugins.algorithmanimator.core.AtomAnimator; 011 012 013 /** 014 * @author Omid Aladini 015 */ 016 public class ShowMessage implements AtomAnimator<MessageEvent> { 017 public boolean isAnimatable(Event event) { 018 if (event instanceof MessageEvent) 019 return true; 020 else 021 return false; 022 } 023 024 public MessageEvent animate(MessageEvent event, BlackBoard b) { 025 if (event.isNotification) 026 GTabbedGraphPane.showTimeNotificationMessage(event.getMessage(), b, event.durationShowTime, true); 027 else GTabbedGraphPane.setMessage(event.getMessage(), b, true); 028 return event; 029 } 030 }