Styling > Customizing Network Elements > Customizing Network Element Functions

This section explains how to create new network element functions and their related icons. This operation is performed in three steps:

  1. A new entry is added to the IltNetworkElement.Function enumeration by instantiating the class IltNetworkElement.Function.
  2. An Image corresponding to the icon that will be associated with the new function is created.
  3. The icon is mapped with the function instance. Refer to the SetValue member function in the class IltSettings.

The following example shows how to add a Router function and associate it with an icon, which is stored in a file called router.gif.

How to Add a Function and Associate It with an Icon (using the API)
IlpContext context = IltSystem.GetDefaultContext();
IltNetworkElement.Function router = new IltNetworkElement.Function("router");
Image routerIcon = context.getImageRepository().getImage("router.gif");
IltSettings.SetValue("NetworkElement.Function.Router.Icon", routerIcon);
How to Add a Function and Associate It with an Icon (using CSS)

You can also create new network element functions by using global CSS settings (see Using Global Settings in Chapter 2, Using Cascading Style Sheets for more information):

setting."ilog.tgo.model.IltNetworkElement"{
  functions[0]: @+neFunction0;
}
Subobject#neFunction0 {
  class: 'ilog.tgo.model.IltNetworkElement.Function'; 
  name: "router";
}

Likewise, you can customize the icon using global CSS settings. To do so, you need to specify the full path to the object to be customized, as well as the value of its name attribute in order to match the right object in the system. The CSS property to customize here is icon.

setting."ilog.tgo.model.IltNetworkElement.Function"[name="router"] { 
   icon: '@|image("router.gif")';
}

The following property is used to customize the display of network element functions:

Table 3.11 CSS Properties for Network Element Functions
Property Name 
Type 
Default Value 
Description 
functionVisible 
boolean 
true 
Controls whether the function icon of a network element is shown or not 

Network element functions provide a default tooltip which is retrieved from the JViews TGO resource bundle (see About Internationalization in the Context and Deployment Descriptor documentation).

The resource that applies to network element functions is:

For the predefined network element functions, you can edit the value directly in the JViews TGO resource bundle file.

For newly created network element functions, the tooltip information will also be retrieved from this resource bundle. As you declare new network element functions, register the corresponding entries into the resource bundle file.

Considering that you have created the network element function "router", you should declare the entry in the resource bundle file as follows: