1 package org.wcb.autohome.util; 2 /*** 3 * Copyright (C) 1999 Walter Bogaardt 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 18 * 19 */ 20 import javax.swing.Icon; 21 import org.wcb.autohome.interfaces.X10DeviceConstants; 22 23 /*** 24 *Filename: $Id: TriggerItem.java,v 1.4 2004/02/27 01:29:53 wbogaardt Exp $ 25 * 26 * Abstract: This class simply is an object holder for an icon and some 27 * detail information for table cell rendering. 28 *@author wbogaardt 29 *@version 1.0 30 */ 31 public class TriggerItem implements X10DeviceConstants { 32 private int iType; 33 private Icon icon; 34 35 /*** 36 * This sets up the trigger items and puts them in icon form 37 * @param array The objects in the array 38 */ 39 public TriggerItem(Object[] array) { 40 iType = ((Integer) array[0]).intValue(); 41 icon = (Icon) array[1]; 42 } 43 44 /*** 45 * Return the image of component. 46 * @return X10 trigger type. either time or event icons 47 */ 48 public Icon getIcon() { 49 return icon; 50 } 51 52 /*** 53 * The int value of the trigger type 54 * 55 * @return Can be either 10 for timer or 11 for trigger event. 56 */ 57 public int getType() { 58 return iType; 59 } 60 61 /*** 62 * String representation of the type so that 63 * it is easily understood by the end-user, which will 64 * see the name "trigger" or "event" instead. 65 * @return String of Event or Time. 66 */ 67 public String toString() 68 { 69 return (iType == TRIGGER_EVENT ? "Event" : "Time"); 70 } 71 } 72 73 74 75