Styling > Customizing Links > Customizing Link Media

This section shows how to create a new link medium. This operation is similar to adding a new function or family for network elements and involves two steps.

How to Create a New Link Medium (using the API)
  1. Extend the IltLink.Media enumeration.
  2. Map the new medium to an icon.
IltLink.Media satellite = new IltLink.Media("satellite");
IlpContext context = IltSystem.GetDefaultContext();
IlpImageRepository imageRep = context.getImageRepository();
Image satelliteImage = imageRep.getImage("sat.png");
IltSettings.SetValue("Link.Media.satellite.Icon", satelliteImage);
How to Create a New Link Medium (using CSS)

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

setting."ilog.tgo.model.IltLink"{
  media[0]: @+linkMedia0;
}
Subobject#linkMedia0 {
  class: 'ilog.tgo.model.IltLink.Media'; 
  name: "satellite";
}

You can obtain the same customization as with the API by 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.IltLink.Media"[name="satellite"] {
   icon: '@|image("sat.png")';
}

The following properties allow you to customize the representation of link media:

Table 5.5 CSS Properties for Link Media
Property Name 
Type 
Set 
Default Value 
Description 
mediaVisible 
boolean 
No 
true 
Defines whether the media icon is visible or not. 
mediaIcon 
Image 
Yes 
The image defined for each media value in IltSettings 
Defines the image to be used to represent the media in a given link. 

How to Hide Link Media

You can show or hide link media using the property mediaVisible as follows:

object."ilog.tgo.model.IltLink" {
  mediaVisible: false;
}

Link media are associated with 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 link media is:

For the predefined link media, you can edit this value directly in the JViews TGO resource bundle file.

For newly created media values, the tooltip information will also be retrieved from this resource bundle. As you declare new media, register the corresponding entry into the resource bundle file so that tooltips can be automatically displayed.

Considering that you have created the link media "satellite", you should declare the entry in the resource bundle file as follows: