Containers package includes the container elements and the base classes that the library developer has to extend to create new container elements.
The relationship between the interfaces, the base classes and the classes describing the container elements is shown in Figure 1. The class names are placed inside rectangles. The partial class names are placed inside rectangles with dashed line borders. An arrow going from a rectangle A, containing one class, to a rectangle B, indicates that the classes contained in rectangle B inherit from the class contained in rectangle A.
Name | Description |
---|---|
![]() | Base class of the classes describing windows |
![]() | Base class of the panels that doesn't host drawable elements |
![]() | Base class of the panels that host drawable elements |
![]() | Main window |
![]() | Dialog window |
![]() | Panel |
![]() | Drawing panel |
![]() | Plotting panel |
Window class is inhereted from classes describing interactive graphic elements that create windows. This class inherits from the IContainer class. It contains the declaration of the parameters needed to specify the title of the window, its width and position and its number of row and columns if the GridLayout policy is selected.
Type | Name | Default | Description |
---|---|---|---|
LayoutPolicy | LayoutPolicy | "BorderLayout()" | Layout policy |
String | title | "MainFrame" | Text display as title |
Integer | xPosition | 0 | X coordinate of the window upper left corner in pixels |
Integer | yPosition | 0 | Y coordinate of the window upper left corner in pixels |
Integer | Width | 400 | Window width in pixels |
Integer | Height | 400 | Window height in pixels |
Integer | nRows | 1 | Number of rows when GridLayout policy is selected |
Integer | nColumns | 1 | Number of columns when GridLayout policy is selected |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLRight | Connector of non drawable components - Child information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
partial model Window "Base class of the classes describing windows" extends Interfaces.IContainer; import Modelica.Utilities.*; parameter String title="MainFrame" "Text display as title"; parameter Integer xPosition = 0 "X coordinate of the window upper left corner in pixels"; parameter Integer yPosition = 0 "Y coordinate of the window upper left corner in pixels"; parameter Integer Width=400 "Window width in pixels"; parameter Integer Height=400 "Window height in pixels"; parameter Integer nRows=1 "Number of rows when GridLayout policy is selected"; parameter Integer nColumns=1 "Number of columns when GridLayout policy is selected"; protected outer parameter String fileName "Name of the java file"; outer parameter String fComponent "Name of the file used by the processingFile function"; parameter Integer size[2]={Width,Height} "Window size in pixels"; String LayoutPolicyL=if (Strings.compare(LayoutPolicy, "GridLayout") == Types.Compare.Equal) then LayoutPolicy + "(" + String(nRows) + "," + String(nColumns) + ")" else LayoutPolicy; end Window;
Container class is inhereted from classes describing interactive graphic elements that create panels which can't host drawables elements. This class inherits from the IContainer class.
Type | Name | Default | Description |
---|---|---|---|
LayoutPolicy | LayoutPolicy | "BorderLayout()" | Layout policy |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLRight | Connector of non drawable components - Child information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
partial model Container "Base class of the panels that doesn't host drawable elements" extends Interfaces.IContainer; import Modelica.Utilities.*; protected outer parameter String fileName "Name of the java file"; outer parameter String fComponent "Name of the file used by the processingFile function"; Integer positionSelection = if pLLeft.borderLayout then 1 else 0; end Container;
ContainerDrawables class is inhereted from classes describing interactive graphic elements that create panels which can only host drawables elements. This class inherits from the IContainerDrawable class.
Type | Name | Default | Description |
---|---|---|---|
positioninLayout | position | "CENTER" | Position inside its container when this container has the BorderLayout layout policy |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
Child | cRight | Connector of drawable components - Child information |
partial model ContainerDrawables "Base class of the panels that host drawable elements" extends Interfaces.IContainerDrawables; import Modelica.Utilities.*; parameter TypesDef.positioninLayout position = "CENTER" "Position inside its container when this container has the BorderLayout layout policy"; protected outer parameter String fileName "Name of the java file"; outer parameter String fComponent "Name of the file used by the processingFile function"; parameter String positionL = "BorderLayout."+position; Integer positionSelection = if pLLeft.borderLayout then 1 else 0; end ContainerDrawables;
Creates a window where containers and interactive controls can be placed. The view can contain only one MainFrame object. The user can stop the simulation by closing this window. This class inherits from Window class.
Type | Name | Default | Description |
---|---|---|---|
LayoutPolicy | LayoutPolicy | "BorderLayout()" | Layout policy |
String | title | "MainFrame" | Text display as title |
Integer | xPosition | 0 | X coordinate of the window upper left corner in pixels |
Integer | yPosition | 0 | Y coordinate of the window upper left corner in pixels |
Integer | Width | 400 | Window width in pixels |
Integer | Height | 400 | Window height in pixels |
Integer | nRows | 1 | Number of rows when GridLayout policy is selected |
Integer | nColumns | 1 | Number of columns when GridLayout policy is selected |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLRight | Connector of non drawable components - Child information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
model MainFrame "Main window" extends Window(title = "MainFrame"); import Modelica.Utilities.*; initial algorithm num :=Functions.processingFile(fComponent)+pLLeft.nodeReference; Functions.frame(fileName= fileName,name= "node"+String(num), xPosition= xPosition, yPosition= yPosition, title= title,size= size, LayoutPolicy= LayoutPolicyL); equation end MainFrame;
This class, like MainFrame, creates a window where containers and interactive controls can be placed. This class has only two differences with MainFrame class: simulation run doesn't stop by closing this window and there can be more than one Dialog object. This class inherits from Window class.
Type | Name | Default | Description |
---|---|---|---|
LayoutPolicy | LayoutPolicy | "BorderLayout()" | Layout policy |
String | title | "MainFrame" | Text display as title |
Integer | xPosition | 0 | X coordinate of the window upper left corner in pixels |
Integer | yPosition | 0 | Y coordinate of the window upper left corner in pixels |
Integer | Width | 400 | Window width in pixels |
Integer | Height | 400 | Window height in pixels |
Integer | nRows | 1 | Number of rows when GridLayout policy is selected |
Integer | nColumns | 1 | Number of columns when GridLayout policy is selected |
String | varName | "" | String variable that can be linked to the corresponding variable of a check-box in order to show and hide the window by clicking on the check-box |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLRight | Connector of non drawable components - Child information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
model Dialog "Dialog window" extends Window(title = "Dialog"); import Modelica.Utilities.*; parameter String varName = "" "String variable that can be linked to the corresponding variable of a check-box in order to show and hide the window by clicking on the check-box"; initial algorithm num :=Functions.processingFile(fComponent)+pLLeft.nodeReference; Functions.dialog(fileName= fileName,name= "node"+String(num), xPosition= xPosition, yPosition= yPosition, title= title,size= size, varName= varName, LayoutPolicy= LayoutPolicyL); equation end Dialog;
Panel model creates a panel where containers, basic elements and interactive controls can be placed.
This class inherits from Panel class.
Type | Name | Default | Description |
---|---|---|---|
LayoutPolicy | LayoutPolicy | "BorderLayout()" | Layout policy |
positioninLayout | position | "SOUTH" | If the element hosting the panel has BorderLayout policy, this parameter sets the panel location respect to its container (i.e., north, south, west or east) |
Integer | nRows | 1 | Number of rows if GridLayout policy is selected |
Integer | nColumns | 1 | Number of columns if GridLayout policy is selected |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLRight | Connector of non drawable components - Child information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
model Panel "Panel" extends Container; import Modelica.Utilities.*; parameter TypesDef.positioninLayout position = "SOUTH" "If the element hosting the panel has BorderLayout policy, this parameter sets the panel location respect to its container (i.e., north, south, west or east)"; parameter Integer nRows = 1 "Number of rows if GridLayout policy is selected"; parameter Integer nColumns = 1 "Number of columns if GridLayout policy is selected"; protected parameter String tempLayout = LayoutPolicy +"("+String(nRows)+","+String(nColumns)+")"; String LayoutPolicyL = if (Strings.compare(LayoutPolicy,"GridLayout") == Types.Compare.Equal) then tempLayout else LayoutPolicy; parameter String positionL = "BorderLayout."+position; initial algorithm num :=Functions.processingFile(fComponent); Functions.panel(fileName, "node"+String(pLLeft.nodeReference), "node"+String(num), positionSelection, positionL, LayoutPolicyL); equation end Panel;
DrawingPanel model creates a two-dimensional container that only can contain drawable objects. It represents a rectangular region of the plane which is defined by means of two points: (XMin, YMin) and (Xmax, YMax). The coordinates of these two points (i.e., the value of (XMin, YMin) and (Xmax, YMax) ) are parameters of the class whose value can be set by the user. This class inherits from ContainerDrawables class.
Type | Name | Default | Description |
---|---|---|---|
positioninLayout | position | "CENTER" | Position inside its container when this container has the BorderLayout layout policy |
Real | XMin | -1 | Minimum X |
Real | XMax | 1 | Maximum X |
Real | YMin | -1 | Minimum Y |
Real | YMax | 1 | Maximum Y |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
Child | cRight | Connector of drawable components - Child information |
model DrawingPanel "Drawing panel" extends ContainerDrawables; import Modelica.Utilities.*; parameter Real XMin = -1 "Minimum X"; parameter Real XMax = 1 "Maximum X"; parameter Real YMin = -1 "Minimum Y"; parameter Real YMax = 1 "Maximum Y"; protected parameter Real size[4] = {XMin, XMax, YMin, YMax}; initial algorithm num :=Functions.processingFile(fComponent); Functions.drawingPanel(fileName= fileName, parent= "node"+String(pLLeft.nodeReference), name= "node"+String(num), size=size, positionSelection= positionSelection, position=positionL); end DrawingPanel;
PlottingPanel model creates a two-dimensional container with coordinate axes that only can contain drawable objects. This class inherits from ContainerDrawables class.
Type | Name | Default | Description |
---|---|---|---|
positioninLayout | position | "CENTER" | Position inside its container when this container has the BorderLayout layout policy |
String | title | "" | Title to display at the top |
fontType | font_name | "Dialog" | Title font |
Integer | font_size | 14 | Size of the title font |
fontStyle | font_style | "BOLD" | Style of the title font |
axesType | axesType | "cartesian2" | The type of axis to be displayed |
String | titleX | "" | Label of the x axis |
xyaxesType | xAxisType | "linear" | The type (linear or log) for cartesian X axis |
booleanValue | gridX | "true" | Whether to display the grid for the x axis |
String | titleY | "" | Label of the y axis |
xyaxesType | yAxisType | "linear" | The type (linear or log) for cartesian y axis |
booleanValue | gridY | "true" | Whether to display the grid for the y axis |
Real | deltaR | 2 | The separation in R for the polar axis |
Real | deltaTheta | 3.14159/8 | The separation in Theta for polar axis |
booleanValue | autoScaleX | "true" | Whether to automatically adjust X scale |
Real | marginX | 0 | Margin to be left in the X scale |
booleanValue | autoScaleY | "true" | Whether to automatically adjust Y scale |
Real | marginY | 0 | Margin to be left in the Y scale |
Real | minX | 0 | The minimum x value that can be displayed |
Real | maxX | 1 | The maximum x value that can be displayed |
Real | minY | 0 | The minimum y value that can be displayed |
Real | maxY | 1 | The maximum y valued taht can be displayed |
booleanValue | coordinates | "true" | Whether to display coordinates when the mouse is pressed |
booleanValue | showGrid | "true" | Whether to show or not the grid |
Type | Name | Description |
---|---|---|
ParentL | pLLeft | Connector of non drawable components - Parent information |
ChildL | cLLeft | Connector of non drawable components - Parent information |
Child | cRight | Connector of drawable components - Child information |
model PlottingPanel "Plotting panel" extends ContainerDrawables; import Modelica.Utilities.*; import VirtualLabBuilder.src.TypesDef; parameter String title = "" "Title to display at the top"; parameter TypesDef.fontType font_name = "Dialog" "Title font"; parameter Integer font_size( min = 5, max = 45) = 14 "Size of the title font"; parameter TypesDef.fontStyle font_style = "BOLD" "Style of the title font"; parameter TypesDef.axesType axesType = "cartesian2" "The type of axis to be displayed"; parameter String titleX = "" "Label of the x axis"; parameter TypesDef.xyaxesType xAxisType = "linear" "The type (linear or log) for cartesian X axis"; parameter TypesDef.booleanValue gridX = "true" "Whether to display the grid for the x axis"; parameter String titleY = "" "Label of the y axis"; parameter TypesDef.xyaxesType yAxisType = "linear" "The type (linear or log) for cartesian y axis"; parameter TypesDef.booleanValue gridY = "true" "Whether to display the grid for the y axis"; parameter Real deltaR = 2 "The separation in R for the polar axis"; parameter Real deltaTheta = 3.14159/8 "The separation in Theta for polar axis"; parameter TypesDef.booleanValue autoScaleX = "true" "Whether to automatically adjust X scale"; parameter Real marginX = 0 "Margin to be left in the X scale"; parameter TypesDef.booleanValue autoScaleY = "true" "Whether to automatically adjust Y scale"; parameter Real marginY = 0 "Margin to be left in the Y scale"; parameter Real minX = 0 "The minimum x value that can be displayed"; parameter Real maxX = 1 "The maximum x value that can be displayed"; parameter Real minY = 0 "The minimum y value that can be displayed"; parameter Real maxY = 1 "The maximum y valued taht can be displayed"; parameter TypesDef.booleanValue coordinates = "true" "Whether to display coordinates when the mouse is pressed"; parameter TypesDef.booleanValue showGrid = "true" "Whether to show or not the grid"; initial algorithm num :=Functions.processingFile(fComponent); Functions.plottingPanel(fileName= fileName, parent= "node"+String(pLLeft.nodeReference), name= "node"+String(num), title= title, font_name= font_name, font_size= font_size, font_style= font_style, axesType= axesType, titleX= titleX, xAxisType= xAxisType, gridX= gridX, titleY= titleY, yAxisType= yAxisType, gridY= gridY, deltaR= deltaR, deltaTheta= deltaTheta, autoScaleX= autoScaleX, marginX= marginX, autoScaleY= autoScaleY, marginY= marginY, minX= minX, maxX= maxX, minY= minY, maxY= maxY, coordinates= coordinates, showGrid= showGrid, positionSelection= positionSelection, position=positionL); end PlottingPanel;