Customizing the representation of subnetworks

How to customize the overview object of a subnetwork

In the collapsed representation, the subnetwork is displayed using an overview object, which is the graphic representation of the parent object as defined in the business model.

The following application is provided as part of the product_name demonstration software. It shows how to define a subnetwork with specific properties: <installdir> /samples/network/basic.

The properties are as follows:

  • Business class: IltNetworkElement

  • Identifier: SubNetwork1

  • Name: SubNetwork

  • Type: IltNetworkElement.Type.NMW

The graphical representation of the subnetwork in its collapsed state is provided by the same attributes and properties defined for network element objects. When customizing your subnetwork objects, you should use the CSS properties that apply to the business class used as the overview object.

 

#SubNetwork1 {

  functionVisible: false;

  detailLevel: MaximumDetails;

}

How to customize the expanded representation of a subnetwork

The following example illustrates the use of CSS to customize the graphical representation of an expanded subnetwork:

 

object."test.MyObject" {

  subnetworkTitle: @name;

  subnetworkTitleJustification: CENTER;

  subnetworkFrame: TITLEBAR_FRAME;

  subnetworkTitleColor: white;

  subnetworkRightMargin: 3;

  subnetworkLeftMargin: 3;

}

The following table lists all properties that can be used to customize subnetworks in their expanded representation.

CSS properties for expanded subnetworks

Property Name

Type

Default Value

Description

subnetworkBackground

Color

Color(128,128,128,128)

Denotes the background color of a subnetwork.

subnetworkBottomMargin

float

5

Denotes the bottom margin of the frame of a subnetwork.

subnetworkCollapseIconVisible

boolean

true

Denotes whether the collapse icon is added to the detail objects of a subnetwork.

subnetworkExpansionIconVisible

boolean

true

Denotes whether the in-place expansion icon is added to the overview object of a subnetwork.

subnetworkForeground

Color

Color.black

Denotes the color of the frame around the subnetwork.

subnetworkFrame

IlpObjectFrameType

FILLED_RECTANGLE_FRAME

Denotes the type of frame used by the subnetwork. The possible values are:

TITLEBAR_FRAME

FILLED_RECTANGLE_FRAME

NO_FRAME

subnetworkLeftMargin

float

5

Denotes the left margin of the frame of a subnetwork.

subnetworkOpaque

boolean

false

Defines whether the subnetwork is opaque or not. The value of this property is taken into account only if property subnetworkFrame is set to TITLEBAR_FRAME. If subnetworkFrame is set to NO_FRAME, subnetworkOpaque is automatically set to false. If subnetworkFrame is set to FILLED_RECTANGLE_FRAME, subnetworkOpaque is automatically set to true.

subnetworkRightMargin

float

5

Denotes the right margin of the frame of a subnetwork.

subnetworkShowingTitle

boolean

false

Defines whether the subnetwork shows the title or not.

subnetworkTitle

String

Empty string

Defines the title of the subnetwork.

subnetworkTitleColor

Color

Color.white

Defines the color used in the title of the subnetwork.

subnetworkTitleJustification

int

Left|Top

Defines the justification of the title of the subnetwork. The possible values are:

Left|Top

Right|Top

Center|Top

Left|Bottom

Right|Bottom

Center|Bottom

Left|Top|Wrapped

Right|Top|Wrapped

Center|Top|Wrapped

Left|Bottom|Wrapped

Right|Bottom|Wrapped

Center|Bottom|Wrapped

Examples of values:

Left|Top|Wrapped, or Right|Bottom

subnetworkTopMargin

float

5

Denotes the top margin of the frame of a subnetwork.

How to use subnetwork properties in a user-defined class

 

object."mypackage.MyType" {

    subnetworkTitle: @name;

    subnetworkTitleJustification: Center;

    subnetworkFrame: TITLEBAR_FRAME;

    subnetworkTitleColor: blue;

    subnetworkRightMargin: 3;

    subnetworkLeftMargin: 3;

}

How to customize subnetwork interactors

You can use the IlpGraphController methods setCollapsionBackgroundInteractor and setExpandInteractor to customize subnetwork interactors to replace the default behavior of expand/collapse when double-clicking a subnetwork.

 

IlpDefaultObjectInteractor objInteractor = new IlpDefaultObjectInteractor();

Action myAction = new TestAction();

objInteractor.setGestureAction(IlpGesture.BUTTON1_DOUBLE_CLICKED, myAction);

objInteractor.setPopupMenuFactory(new TestPopupMenuFactory());

networkComponent.getController().

  setCollapsionBackgroundInteractor(objInteractor);

networkComponent.getController().setExpansionInteractor(objInteractor);