/******************************************************************* Copyright (c) 2001-2010 Apprisant Technologies Inc. All rights reserved. Apprisant Technologies permits non-exclusive royalty free use, copying and modification of this demo program source code for the purposes of evaluating the Apprisant Toolkit or building applications that use it. This software and documentation is provided "AS IS". APPRISANT TECHNOLOGIES DISCLAIMS ANY REPRESENTATIONS AND WARRANTIES, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY AND FITNESS OF THIS PRODUCT FOR ANY PARTICULAR PURPOSE. APPRISANT TECHNOLOGIES SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY ANY PARTY, INCLUDING LOST PROFITS, ARISING FROM THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ITS DERIVATIONS. ********************************************************************/ package staffsched; import apprisant.diagram.ElementFactory; import apprisant.resourcechart.ResourceElement; /** Display element class for the Staff Schedule demo. This class provides the data properties in the form needed by the ResourceChart. A fourth property, duration, is obtained directly from the data object. This class must extend the toolkit's ResourceElement class to work with the ResourceModel. */ public class ApptElement extends ResourceElement { public ApptElement (Object key, Object dataObject) { super(key, dataObject); } public int getChartIndex() { Appointment d = (Appointment) getDataObject(); return d.getDay(); } public int getResourceIndex() { Appointment d = (Appointment) getDataObject(); return d.getName().ordinal(); } public double getStart() { Appointment d = (Appointment) getDataObject(); return d.getStartTime() - StaffData.HOUR_START; } /* Element factory class to instantiate ApptElements. */ public static class Factory implements ElementFactory { public Factory() { } public ApptElement createElement (Object key, Object data) { return new ApptElement(key, data); } } }