001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/chat/trunk/chat-tool/tool/src/java/org/sakaiproject/chat/tool/ChatDelivery.java $
003: * $Id: ChatDelivery.java 14062 2006-08-27 03:44:18Z csev@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.chat2.tool;
021:
022: import org.apache.commons.logging.Log;
023: import org.apache.commons.logging.LogFactory;
024: import org.sakaiproject.chat2.model.ChatMessage;
025: import org.sakaiproject.time.api.Time;
026: import org.sakaiproject.time.cover.TimeService; //import org.sakaiproject.chat.cover.ChatService;
027: //import org.sakaiproject.entity.api.Reference;
028: //import org.sakaiproject.entity.cover.EntityManager;
029: import org.sakaiproject.event.api.UsageSession;
030: import org.sakaiproject.event.cover.UsageSessionService; //import org.sakaiproject.exception.IdUnusedException;
031: //import org.sakaiproject.exception.PermissionException;
032: import org.sakaiproject.chat2.model.ChatChannel;
033: import org.sakaiproject.user.api.User;
034: import org.sakaiproject.user.cover.UserDirectoryService;
035: import org.sakaiproject.user.api.UserNotDefinedException;
036: import org.sakaiproject.util.BaseDelivery;
037: import org.sakaiproject.util.StringUtil;
038: import org.sakaiproject.util.Web;
039:
040: /**
041: * <p>
042: * ChatDelivery is a Delivery that causes a chat message to be appended to a table of chat messages in the HTML element identified by the address and elementID.
043: * </p>
044: */
045: public class AlertDelivery extends BaseDelivery {
046:
047: /**
048: * Construct.
049: *
050: * @param address
051: * The address.
052: * @param elementId
053: * The elementId.
054: */
055: public AlertDelivery(String address) {
056: super (address, null);
057:
058: } // ChatDelivery
059:
060: /**
061: * Construct.
062: *
063: * @param address
064: * The address.
065: * @param elementId
066: * The elementId.
067: */
068: public AlertDelivery(String address, String id) {
069: super (address, id);
070:
071: } // ChatDelivery
072:
073: /**
074: * Compose a javascript message for delivery to the browser client window.
075: *
076: * @return The javascript message to send to the browser client window.
077: */
078: public String compose() {
079: if (getElement() == null)
080: return "alert(\"AlertDelivery\");";
081: return "alert(" + getElement() + ");";
082:
083: } // compose
084:
085: /**
086: * Display.
087: */
088: public String toString() {
089: return super .toString() + " : alert delivery";
090:
091: } // toString
092:
093: /**
094: * Are these the same?
095: *
096: * @return true if obj is the same Delivery as this one.
097: */
098: public boolean equals(Object obj) {
099: return super.equals(obj);
100: }
101: }
|