View Javadoc
1 /************************************************************ 2 * Copyright * 3 * Portions of this software are Copyright (c) 1993 - 2002, * 4 * Chad Z. Hower (Kudzu) and the Indy Pit Crew * 5 * - http://www.nevrona.com/Indy/ * 6 ************************************************************/ 7 package org.indy; 8 9 import java.text.MessageFormat; 10 11 import java.util.EventObject; 12 13 14 /*** 15 * Represents a state change in an {@link IndyComponent}. 16 */ 17 public class IndyStatusEvent extends EventObject { 18 private final Status status; 19 private String cacheString; 20 private final Object[] args; 21 22 /*** 23 * Constructs a new <code>IndyStatusEvent</code>. 24 * 25 * @param source The sender of the event 26 * @param s The new {@link Status}. 27 * @param args Any arguments to be included in a string representation of this event. May be <code>null</code>. 28 */ 29 public IndyStatusEvent(IndyComponent source, Status s, Object[] args) { 30 super(source); 31 status = s; 32 this.args = args; 33 } 34 35 /*** 36 * Constructs a new <code>IndyStatusEvent</code>. 37 * 38 * This is the equivalent of 39 * <pre> 40 * new IndyStatusEvent(source,s,null); 41 * </pre> 42 * @param source The source of this event 43 * @param s The new {@link Status} 44 */ 45 public IndyStatusEvent(IndyComponent source, Status s) { 46 this(source, s, null); 47 } 48 49 /*** 50 * Returns the new {@link Status} of <code>source</code>. 51 * 52 * @return The new <code>Status</code> of the event source. 53 */ 54 public Status getStatus() { 55 return status; 56 } 57 58 /*** 59 * Produces a string representation of this event, using the <code>args</code> it was 60 * constructed with, if avialable. 61 * 62 * @return A string representing this event. 63 */ 64 public String toString() { 65 if (cacheString == null) { 66 if (args == null) { 67 cacheString = status.toString(); 68 } 69 else { 70 cacheString = MessageFormat.format(status.toString(), args); 71 } 72 } 73 74 return cacheString; 75 } 76 }

This page was automatically generated by Maven