/* * 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.IlpNetwork; import ilog.cpl.datasource.IlpDefaultDataSource; import ilog.cpl.graphic.IlpGraphicComponent; import ilog.cpl.service.IlpImageRepository; import ilog.tgo.faces.network.component.IltFacesNetworkView; import ilog.tgo.graphic.IltLinkPort; import ilog.tgo.graphic.renderer.IltBaseRenderer; import ilog.tgo.graphic.renderer.IltBaseRendererFactory; import ilog.tgo.model.IltLink; import ilog.tgo.model.IltNetworkElement; 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("network.customization"); } ////////////////////////////////////////////////////////////////////////////// //Context Objects Accessors ////////////////////////////////////////////////////////////////////////////// /** * Returns the IlpNetwork that is used by the sample. */ public IlpNetwork getNetwork() { return (IlpNetwork)component; } ////////////////////////////////////////////////////////////////////////////// //Sample Dependent ////////////////////////////////////////////////////////////////////////////// /** * Creates the IlpNetwork 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 = IltFacesNetworkView.DefaultConfigurationFileName; IlpNetwork network = new IlpNetwork(config, getContext()); IlpDefaultDataSource dataSource = new IlpDefaultDataSource(network.getContext()); try { URL project = context.getURLAccessService().getFileLocation("project.itpr"); network.setProject(project); } catch(Exception e) { logger.severe ("Cannot set the default project on the network component with this exception:\n" + e.getLocalizedMessage()); } return network; } /** * 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()); } } }