/* * 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. */ package monitoring.web.controls.configurator; import java.util.logging.Level; import monitoring.shared.CommonUtils; import monitoring.shared.LoggingUtils; import monitoring.web.SampleConstants; import monitoring.web.controls.NetworkControls; import ilog.cpl.model.IlpObject; /** * The component configurator that ensures that the appropriate * style files are loaded on the network module's network after drill downs * take place. */ public class NetworkConfigurator extends AbstractComponentConfigurator { //Network controls private NetworkControls networkControls; /** * Creates a network configurator and saves the <code>NetworkControls</code> * reference. */ public NetworkConfigurator(NetworkControls networkControls) { super(); this.networkControls = networkControls; } /** * Network implementation. * * @see monitoring.web.controls.configurator.AbstractComponentConfigurator#getCurrentStyleSheets() */ protected String getCurrentStyleSheets() { return networkControls.getNetworkNetworkView().getStyleSheets(); } /** * Network implementation. * * @see monitoring.web.controls.configurator.AbstractComponentConfigurator#getDetailsConfiguration(ilog.cpl.model.IlpObject) */ protected String getDetailsConfiguration(IlpObject object) { return CommonUtils.computeConfigurationFileNameForNetworkElement(object); } /** * Network implementation. * * @see monitoring.web.controls.configurator.AbstractComponentConfigurator#getRootConfiguration() */ protected String getRootConfiguration() { return SampleConstants.NETWORK_NETWORK_ROOT_CONFIG_FILE; } /** * Network implementation. * * @see monitoring.web.controls.configurator.AbstractComponentConfigurator#updateStyleSheets(java.lang.String) */ protected void updateStyleSheets(String styleSheets) { networkControls.getNetworkNetworkView().setStyleSheets(styleSheets); try { networkControls.getNetworkNetworkView().getNetwork().setStyleSheets(getStringArrayForStyleString(styleSheets)); } catch (Exception e) { LoggingUtils.getSampleLogger().log( Level.SEVERE, "Could not update style sheets on network with this exception:", e.getLocalizedMessage()); } } }