VirtualLabBuilder.src.ViewElements.Containers

Container elements and base classes

Information


 

Containers package

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.


Figure 1.Classes included in the Containers package.

Package Content

NameDescription
VirtualLabBuilder.src.ViewElements.Containers.Window Window Base class of the classes describing windows
VirtualLabBuilder.src.ViewElements.Containers.Container Container Base class of the panels that doesn't host drawable elements
VirtualLabBuilder.src.ViewElements.Containers.ContainerDrawables ContainerDrawables Base class of the panels that host drawable elements
VirtualLabBuilder.src.ViewElements.Containers.MainFrame MainFrame Main window
VirtualLabBuilder.src.ViewElements.Containers.Dialog Dialog Dialog window
VirtualLabBuilder.src.ViewElements.Containers.Panel Panel Panel
VirtualLabBuilder.src.ViewElements.Containers.DrawingPanel DrawingPanel Drawing panel
VirtualLabBuilder.src.ViewElements.Containers.PlottingPanel PlottingPanel Plotting panel


VirtualLabBuilder.src.ViewElements.Containers.Window VirtualLabBuilder.src.ViewElements.Containers.Window

Base class of the classes describing windows

VirtualLabBuilder.src.ViewElements.Containers.Window

Information


                        

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.


Parameters

TypeNameDefaultDescription
LayoutPolicyLayoutPolicy"BorderLayout()"Layout policy
Stringtitle"MainFrame"Text display as title
IntegerxPosition0X coordinate of the window upper left corner in pixels
IntegeryPosition0Y coordinate of the window upper left corner in pixels
IntegerWidth400Window width in pixels
IntegerHeight400Window height in pixels
IntegernRows1Number of rows when GridLayout policy is selected
IntegernColumns1Number of columns when GridLayout policy is selected

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLRightConnector of non drawable components - Child information
ChildLcLLeftConnector of non drawable components - Parent information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.Container VirtualLabBuilder.src.ViewElements.Containers.Container

Base class of the panels that doesn't host drawable elements

VirtualLabBuilder.src.ViewElements.Containers.Container

Information


                        

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.


Parameters

TypeNameDefaultDescription
LayoutPolicyLayoutPolicy"BorderLayout()"Layout policy

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLRightConnector of non drawable components - Child information
ChildLcLLeftConnector of non drawable components - Parent information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.ContainerDrawables VirtualLabBuilder.src.ViewElements.Containers.ContainerDrawables

Base class of the panels that host drawable elements

VirtualLabBuilder.src.ViewElements.Containers.ContainerDrawables

Information


                        

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.


Parameters

TypeNameDefaultDescription
positioninLayoutposition"CENTER"Position inside its container when this container has the BorderLayout layout policy

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLLeftConnector of non drawable components - Parent information
ChildcRightConnector of drawable components - Child information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.MainFrame VirtualLabBuilder.src.ViewElements.Containers.MainFrame

Main window

VirtualLabBuilder.src.ViewElements.Containers.MainFrame

Information


                        

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.


Parameters

TypeNameDefaultDescription
LayoutPolicyLayoutPolicy"BorderLayout()"Layout policy
Stringtitle"MainFrame"Text display as title
IntegerxPosition0X coordinate of the window upper left corner in pixels
IntegeryPosition0Y coordinate of the window upper left corner in pixels
IntegerWidth400Window width in pixels
IntegerHeight400Window height in pixels
IntegernRows1Number of rows when GridLayout policy is selected
IntegernColumns1Number of columns when GridLayout policy is selected

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLRightConnector of non drawable components - Child information
ChildLcLLeftConnector of non drawable components - Parent information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.Dialog VirtualLabBuilder.src.ViewElements.Containers.Dialog

Dialog window

VirtualLabBuilder.src.ViewElements.Containers.Dialog

Information


                        

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.


Parameters

TypeNameDefaultDescription
LayoutPolicyLayoutPolicy"BorderLayout()"Layout policy
Stringtitle"MainFrame"Text display as title
IntegerxPosition0X coordinate of the window upper left corner in pixels
IntegeryPosition0Y coordinate of the window upper left corner in pixels
IntegerWidth400Window width in pixels
IntegerHeight400Window height in pixels
IntegernRows1Number of rows when GridLayout policy is selected
IntegernColumns1Number of columns when GridLayout policy is selected
StringvarName""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

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLRightConnector of non drawable components - Child information
ChildLcLLeftConnector of non drawable components - Parent information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.Panel VirtualLabBuilder.src.ViewElements.Containers.Panel

Panel

VirtualLabBuilder.src.ViewElements.Containers.Panel

Information


                        

Panel model creates a panel where containers, basic elements and interactive controls can be placed.
This class inherits from Panel class.


Parameters

TypeNameDefaultDescription
LayoutPolicyLayoutPolicy"BorderLayout()"Layout policy
positioninLayoutposition"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)
IntegernRows1Number of rows if GridLayout policy is selected
IntegernColumns1Number of columns if GridLayout policy is selected

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLRightConnector of non drawable components - Child information
ChildLcLLeftConnector of non drawable components - Parent information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.DrawingPanel VirtualLabBuilder.src.ViewElements.Containers.DrawingPanel

Drawing panel

VirtualLabBuilder.src.ViewElements.Containers.DrawingPanel

Information


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.


Parameters

TypeNameDefaultDescription
positioninLayoutposition"CENTER"Position inside its container when this container has the BorderLayout layout policy
RealXMin-1Minimum X
RealXMax1Maximum X
RealYMin-1Minimum Y
RealYMax1Maximum Y

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLLeftConnector of non drawable components - Parent information
ChildcRightConnector of drawable components - Child information

Modelica definition

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;

VirtualLabBuilder.src.ViewElements.Containers.PlottingPanel VirtualLabBuilder.src.ViewElements.Containers.PlottingPanel

Plotting panel

VirtualLabBuilder.src.ViewElements.Containers.PlottingPanel

Information


PlottingPanel model creates a two-dimensional container with coordinate axes that only can contain drawable objects. This class inherits from ContainerDrawables class.


Parameters

TypeNameDefaultDescription
positioninLayoutposition"CENTER"Position inside its container when this container has the BorderLayout layout policy
Stringtitle""Title to display at the top
fontTypefont_name"Dialog"Title font
Integerfont_size14Size of the title font
fontStylefont_style"BOLD"Style of the title font
axesTypeaxesType"cartesian2"The type of axis to be displayed
StringtitleX""Label of the x axis
xyaxesTypexAxisType"linear"The type (linear or log) for cartesian X axis
booleanValuegridX"true"Whether to display the grid for the x axis
StringtitleY""Label of the y axis
xyaxesTypeyAxisType"linear"The type (linear or log) for cartesian y axis
booleanValuegridY"true"Whether to display the grid for the y axis
RealdeltaR2The separation in R for the polar axis
RealdeltaTheta3.14159/8The separation in Theta for polar axis
booleanValueautoScaleX"true"Whether to automatically adjust X scale
RealmarginX0Margin to be left in the X scale
booleanValueautoScaleY"true"Whether to automatically adjust Y scale
RealmarginY0Margin to be left in the Y scale
RealminX0The minimum x value that can be displayed
RealmaxX1The maximum x value that can be displayed
RealminY0The minimum y value that can be displayed
RealmaxY1The maximum y valued taht can be displayed
booleanValuecoordinates"true"Whether to display coordinates when the mouse is pressed
booleanValueshowGrid"true"Whether to show or not the grid

Connectors

TypeNameDescription
ParentLpLLeftConnector of non drawable components - Parent information
ChildLcLLeftConnector of non drawable components - Parent information
ChildcRightConnector of drawable components - Child information

Modelica definition

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;

HTML-documentation generated by Dymola Tue Jul 24 18:58:13 2007.