skip to main content
Programmers documentation > Business objects and data sources > Shelves and cards > Shelves
 
Shelves
Describes the facilities available for shelves.
*Overview of shelves
*Provides details about the components of a shelf.
*Shelf class
*Describes the attributes of the IltShelf class.
*Loading a shelf defined in XML
*Shows how to load a shelf from an XML file in a data source.
*Creating a shelf with the API
*Shows how to create a shelf using the API and how to add it to the data source.
Overview of shelves
A standard shelf is a rectangular frame made up of smaller rectangles (slots) placed side by side in a line. Each slot is assigned a number (slot number) that graphically identifies the slot in the shelf.
A complex shelf is a rectangular frame made up of an array of slots, each column being assigned a number (slot numbering) that graphically identifies it within the shelf.
Each slot can hold one card object. There are three different types of card object: cards, empty slots, and card carriers. Each of these types is described in this topic.
Although states and alarms can be associated with a shelf, it is not possible to display them in the shelf graphic representation. This is not necessary since shelves are only holders of shelf items. On the other hand, the states and alarms associated with shelf items can be represented graphically.
It is possible to set a label for any shelf, but it will only be visible in the logical and tiny representations. The symbolic representation does not display it.
For information on other styling capabilities available for shelves, refer to CSS properties for the representation of shelves, card carriers, cards and ports .
Slots are numbered sequentially (slot numbering), starting from the initial index which is passed as an argument to the constructor ( logicalFirstIndex argument in most IltShelf constructors). By default, the slot labels display the sequential numbers, but you can customize them using cascading style sheets.
Slots in a shelf can be defined as fixed-width, where all slots have the same width, or variable-width, where each slot has its width set individually. A slot is not displayed when its width is set to zero, which breaks the sequence of the slot numbering. The width of the slots can be defined either when constructing a shelf or by invoking the shelf API (method setSlotSizes ).
For array shelves, slot columns are numbered sequentially and both the horizontal and the vertical dimensions can be defined as fixed-width or variable-width using an API similar to standard linear shelves.
Since the shelf determines the size of the slots and consequently the size of the shelf items, it is important to design it with the card objects that will be placed in the slots in mind. For example, cards which contain card items such as ports and LEDs must be placed in slots big enough to host them. In addition, even when using cards without ports and LEDs, small shelves with tiny slots tend to overlap alarm representations and labels, which is confusing for the end user.
The positioning point of a shelf is given by the PositionAttribute attribute (from class IltObject); it is based on the IlpPoint object and defines its top left corner.
The slots of a shelf are accessed through a pair of XY indices defining a column (X index) and a row (Y index). The top left slot is assigned the indices (0,0). The X index increases horizontally from left to right and the Y index increases vertically from top to bottom. For linear shelves, the Y index is handled automatically. Objects are placed on a shelf based on X and Y slot indices plus an X and Y span, which defines how much the object will expand over its neighboring slots. An X span of 2.0, for instance, determines that the object will fully occupy the slot on its right.
Shelf class
Shelves are predefined business objects of the class IltShelf that are top-level containers in a hierarchy of predefined business objects used to model telecommunication equipment.
The IltShelf class defines the following attributes:
*Type —Specifies the category of a shelf. There is one predefined type of shelf, but you can define new types.
Name: type
Value class: IltShelf.Type
Attribute: IltShelf.TypeAttribute
*Direction —Specifies the direction of a shelf. The possible values are IlpDirection. Right, IlpDirection. Left, IlpDirection. Top or IlpDirection. Bottom. The default value is Right, and corresponds to a shelf with slot numbers at the bottom. The shelf direction affects the slot numbering (ascending or descending), but not the slot number position, which is given by the setSlotNumsOnTop method of the IltShelf class.
Name: direction
Value class: IlpDirection
Attribute: IltShelf.DirectionAttribute
*Slot sizes —Specifies the width and height of each column and row of slots.
Name: slotSizes
Value class: IlpSlotSizes
Attribute: IltShelf.SlotSizesAttribute
*XSlotIndex —Specifies the initial number displayed to count the slots.
Name: xslotindex
Value class: java.lang.Integer
Attribute: IltShelf.XSlotIndexAttribute
Loading a shelf defined in XML
All you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as shown below.
 
IlpDataSource datasource = new IltDefaultDataSource();
datasource.parse("ShelfXMLFile.xml");
For detailed information about data sources, see Data sources.
How to define a shelf in XML
The following is an example of a shelf defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .
 
<cplData>
<addObject id="Shelf">
  <class>ilog.tgo.model.IltShelf</class>
  <attribute name="name">Shelf</attribute>
  <attribute name="slotSizes" javaClass="ilog.cpl.equipment.IlpSlotSizes">
    <width>
      <value>30</value>
      <value>20</value>
      <value>40</value>
    </width>
    <height>
      <value>90</value>
      <value>20</value>
    </height>
  </attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
    <x>100</x> <y>50</y>
  </attribute>
</addObject>
</cplData>
The result looks like this:
An array shelf defined in an XML file
Creating a shelf with the API
All you have to do is create a shelf using the class IltShelf and add it to a data source, as shown in the following example.
How to create a linear shelf with the API
 
IltShelf s1 = new IltShelf(10,//Number of slots in the shelf
   20,//Width of all the slots in the shelf
   100,//Height of all the slots in the shelf
   0);//Value of the first slot number
IlpDataSource dataSource = new IltDefaultDataSource();
dataSource.addObject(s1);
The result looks like this:
A linear shelf without cards
How to create an array shelf with the API
The following code creates an empty 4x3 array shelf:
 
IltShelf s1 = new IltShelf(4,//Number of slots along the x axis
   25,//Width of a slot on the x axis
   3,//Number of slots along the y axis
   30,//Width of a slot on the y axis
   0);//Value of the first slot number
s1.setAttributeValue(IltShelf.PositionAttribute, new IlpPoint(50, 50));
IlpDataSource dataSource = new IltDefaultDataSource();
dataSource.addObject(s1);
The result looks like this:
An empty 4x3 array shelf with fixed-width slots

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.