/* * Licensed Materials - Property of Rogue Wave Software, Inc. * © Copyright Rogue Wave Software, Inc. 2014, 2015 * © Copyright IBM Corp. 2009, 2014 * © Copyright ILOG 1996, 2009 * All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * The Software and Documentation were developed at private expense and * are "Commercial Items" as that term is defined at 48 CFR 2.101, * consisting of "Commercial Computer Software" and * "Commercial Computer Software Documentation", as such terms are * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4, * as applicable. */ import ilog.cpl.IlpEquipment; import ilog.cpl.datasource.IlpDefaultDataSource; import ilog.cpl.graphic.IlpGraphicComponent; import ilog.tgo.faces.equipment.component.IltFacesEquipmentView; import ilog.tgo.model.IltPort; import ilog.tgo.model.IltCard; import ilog.tgo.resource.IltSettings; import java.net.URL; /** * This is the context object that provides the objects needed for this * sample to function properly. It also handles the initialization of such * objects. */ public class SampleContext extends AbstractSampleContext { public SampleContext() { super("equipment.image.renderer"); } ////////////////////////////////////////////////////////////////////////////// //Context Objects Accessors ////////////////////////////////////////////////////////////////////////////// /** * Returns the IlpEquipment that is used by the sample. */ public IlpEquipment getEquipment() { return (IlpEquipment)component; } ////////////////////////////////////////////////////////////////////////////// //Sample Dependent ////////////////////////////////////////////////////////////////////////////// /** * Creates the IlpEquipment that will be used by the sample. * Note that the default Faces configuration file is passed. */ protected IlpGraphicComponent createComponent() { // Get the default configuration file name String config = IltFacesEquipmentView.DefaultConfigurationFileName; IlpEquipment equipment = new IlpEquipment(config, getContext()); IlpDefaultDataSource dataSource = new IlpDefaultDataSource(equipment.getContext()); try { URL project = context.getURLAccessService().getFileLocation("project.itpr"); equipment.setProject(project); } catch(Exception e) { logger.severe ("Cannot set the default project on the equipment component with this exception:\n" + e.getLocalizedMessage()); } return equipment; } /** * Initalizes the samples settings and customizations. */ protected void initializeSample() { //Initialize samples' custom types try { IltSettings settings = new IltSettings(getContext()); String[] settingsArray = {"settings.css"}; settings.setStyleSheets(settingsArray); } catch (Exception e) { logger.severe("Exception caught while loading sample settings:\n" + e.getLocalizedMessage()); } } }