#*************************** bolero view maps add-on ********************************

##################################
##################################
##################################
##################################### AT FIRST DISABLE ALL STANDARD VIEW MAPS FOR BOLERO CLASSES
view.map.*.Class.isTopLevel() =

view.map.*.Class.(!hasProperty ("Bolero") && isTopLevel ()) =
\
\  if( ( %diagram%->hasPropertyValue( "$shapeType", "ComponentDiagram" ) ||
\        %diagram%->hasPropertyValue( "$shapeType", "DeploymentDiagram" ) ||
\        hasViewProperty("showCircle") ) &&
\        hasProperty( "$interface" ),
\      setGraphicObject( "RectangleInvisible" );
\      shape = addCompartment( "Circle", "shape" );
\      shape->setShadow( 3, RGB(0,0,128) );
\      shape->setLayoutConstraints( minWidth(30), maxWidth(30), minHeight(30), maxHeight(30) )
\    ,
\      if( hasProperty("$EJBComponent"),
\          setGraphicObject("BeanComponent");
\          icons = addCompartment("RectangleInvisible", "$icons");
\          icons->setLayout("Move");
\          ejbMark = icons->addCompartment("EJBMark", "ejbMark");
\          ejbMark->setLayoutConstraints( minWidth(6),maxWidth(6), minHeight(6),maxHeight(6),
\                                         verticalAlign("center"),horizontalAlign("center")),
\          setGraphicObject("RectangleObject")
\        )
\    );
\  setShadow(3, RGB(0,0,128));
\  names = addCompartment( "RectangleInvisible", "Names" );
\  names->setLayoutConstraints( minHeight(20), preferredWidth(170), fixedHeight(true) );
\  if(!hasViewProperty("hideAll"),
\    if(!hasViewProperty("hideAttributes"),
\      (
\      attributes = addCompartment("$ScrolledRectangle","Attributes");
\      attributes->setHorizontalMargin(5);
\      attributes->setLayoutConstraints(preferredWidth(170),preferredHeight(10))
\      )
\    );
\    if(!hasViewProperty("hideOperations"),
\      (
\      operations = addCompartment("$ScrolledRectangle","Operations");
\      operations->setHorizontalMargin(5);
\      operations->setLayoutConstraints(minHeight(16),preferredWidth(170))
\      )
\    );
\    if(!hasViewProperty("hideClasses"),
\      (
\      classes = addCompartment("$ScrolledRectangle","Classes");
\      classes->setLayoutConstraints(preferredWidth(170),preferredHeight(10));
\      classes->setHorizontalMargin(5);
\      classes->setVisible(false)
\      )
\    );
\    if(!hasViewProperty("hideProperties"),
\      (
\      beanProperties = addCompartment("$ScrolledRectangle","BeanProperties");
\      beanProperties->setLayoutConstraints(preferredWidth(170),preferredHeight(10));
\      beanProperties->setHorizontalMargin(5);
\      beanProperties->setVisible(false)
\      )
\    );
\    if(!hasViewProperty("hideEvents"),
\      (
\      beanEvents = addCompartment("$ScrolledRectangle","BeanEvents");
\      beanEvents->setLayoutConstraints(preferredWidth(170),preferredHeight(10));
\      beanEvents->setHorizontalMargin(5);
\      beanEvents->setVisible(false)
\      )
\    )
\  );
\  markersCompartment = addCompartment( "RectangleInvisible", "MarkersCompartment" );
\  markersCompartment->setLayoutConstraints( minHeight(10), fixedHeight(true));
\  markers = markersCompartment->addCompartment( "RectangleInvisible", "Markers" );
\  markers->setLayoutConstraints( widthAlign("parentDefined"), heightAlign("parentDefined"), toDecreaseWidth(true) );
\  markers->setLayout( "Move" );
\  if( hasProperty("$readOnly") && !hasProperty("$compiled"),
\      readonlyMark=markers->addCompartment( "LockMark", "lockMark" );
\      readonlyMark->setLayoutConstraints( minWidth(10), minHeight(10), horizontalAlign("right") )
\    );
\  if( hasViewProperty("$imported") &&
\      ( !%diagram%->hasPropertyValue( "$shapeType", "ClassDiagram" ) || %diagram%->hasProperty( "$physicalPackage" ) ),
\      importedMark=markers->addCompartment( "ShortcutMark", "shortcutMark" );
\      importedMark->setLayoutConstraints( minWidth(12), minHeight(10), horizontalAlign("left") )
\    );
\  if( hasProperty("$compiled"),
\      exclamationMark=markers->addCompartment( "ExclamationMark", "exclamationMark" );
\      exclamationMark->setLayoutConstraints( minWidth(10), minHeight(10), horizontalAlign("right") )
\    );
\
\  if(hasProperty("stereotype"),
\    (
\    stereoLabel = addToCompartment(label("<<"+getProperty("stereotype")+">>"), "Names");
\    stereoLabel->setInplaceEditor({property:="stereotype"});
\    stereoLabel->setFont("Courier", "Plain", 12);
\    stereoLabel->setAlignment("Center");
\    stereoLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\    )
\  );
\  if(hasProperty("$interface"),
\    (
\    interfaceLabel = addToCompartment(label("interface"), "Names");
\    interfaceLabel->setFont("Courier", "Plain", 12);
\    interfaceLabel->setAlignment("Center");
\    interfaceLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\    )
\  );
\  name = getProperty("alias");
\  if(name == null,
\    if(hasProperty ("OutOfTheProject"), name = getProperty ("FullQualifiedName"),
\      if(isInTheSamePackage(), name = getProperty("$name"), name = getProperty("$fullName")));
\    name = name->replace("_", " ")
\    );
\  nameLabel = addToCompartment(label(name),"Names");
\  if (!hasProperty("alias"),
\    nameLabel->setInplaceEditor({inProperty:="$name", outProperty:="$classInplaceEditing", default:=true}),
\    nameLabel->setInplaceEditor({property:="alias", default:=true})
\  );
\  nameLabel->setAlignment("Center");
\  nameLabel->setWholeWordsOnly();
\  if(hasProperty("$abstract"),
\    nameLabel->setFont("Courier", "BoldItalic", 12),
\    nameLabel->setFont("Courier", "Bold", 12));
\  if(hasProperty("$hyperLink") || hasProperty("url"), nameLabel->setForeground(RGB(0,0,255)));
\  maxWidth = getIntegerOption("initialwidth");
\  setLayoutConstraints(minWidth(16),minHeight(16),preferredWidth(190),maxWidth(maxWidth));
\  setHorizontalMargin(5);
\  setCanHaveLinks()

#########################################
#########################################
#########################################

view.map.*.Class.(hasProperty ("Bolero") && isTopLevel ()) =
\  setGraphicObject("RectangleObject");
\  setShadow(3, RGB(0,0,128));
\  names = addCompartment( "RectangleInvisible", "Names" );
\  names->setLayoutConstraints( minHeight(20), preferredWidth(170), fixedHeight(true) );
\  constructors = addCompartment ("$ScrolledRectangle","BoleroConstructors");
\  constructors->setHorizontalMargin(5);
\  constructors->setLayoutConstraints(preferredWidth(170),preferredHeight(10));
\  attributes = addCompartment("$ScrolledRectangle","BoleroAttributes");
\  attributes->setHorizontalMargin(5);
\  attributes->setLayoutConstraints(preferredWidth(170),preferredHeight(10));
\  operations = addCompartment("$ScrolledRectangle","BoleroOperations");
\  operations->setHorizontalMargin(5);
\  operations->setLayoutConstraints(minHeight(16),preferredWidth(170));
\
\  markersCompartment = addCompartment( "RectangleInvisible", "MarkersCompartment" );
\  markersCompartment->setLayoutConstraints( minHeight(10), fixedHeight(true));
\  markers = markersCompartment->addCompartment( "RectangleInvisible", "Markers" );
\  markers->setLayoutConstraints( widthAlign("parentDefined"), heightAlign("parentDefined"), toDecreaseWidth(true) );
\  markers->setLayout( "Move" );
\  if( hasProperty("$readOnly") && !hasProperty("$compiled"),
\      readonlyMark=markers->addCompartment( "LockMark", "lockMark" );
\      readonlyMark->setLayoutConstraints( minWidth(10), minHeight(10), horizontalAlign("right") )
\    );
\  if( hasViewProperty("$imported") &&
\      ( !%diagram%->hasPropertyValue( "$shapeType", "ClassDiagram" ) || %diagram%->hasProperty( "$physicalPackage" ) ),
\      importedMark=markers->addCompartment( "ShortcutMark", "shortcutMark" );
\      importedMark->setLayoutConstraints( minWidth(12), minHeight(10), horizontalAlign("left") )
\    );
\  if( hasProperty("$compiled"),
\      exclamationMark=markers->addCompartment( "ExclamationMark", "exclamationMark" );
\      exclamationMark->setLayoutConstraints( minWidth(10), minHeight(10), horizontalAlign("right") )
\    );
\
\  if(hasPropertyValue ("Class", "com.softwareag.repository.infomodel.bolero.BoleroClassAdapter"),
\    (
\    stereoLabel = addToCompartment(label("<<ClassAdapter>>"), "Names");
\    stereoLabel->setFont("Courier", "Plain", 12);
\    stereoLabel->setAlignment("Center");
\    stereoLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\    )
\  );
\  if(hasPropertyValue ("Class", "com.softwareag.repository.infomodel.bolero.BoleroInterfaceAdapter"),
\    (
\    stereoLabel = addToCompartment(label("<<InterfaceAdapter>>"), "Names");
\    stereoLabel->setFont("Courier", "Plain", 12);
\    stereoLabel->setAlignment("Center");
\    stereoLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\    )
\  );
\  if(hasProperty("$interface") && !hasPropertyValue ("Class", "com.softwareag.repository.infomodel.bolero.BoleroInterfaceAdapter"),
\    (
\    interfaceLabel = addToCompartment(label("interface"), "Names");
\    interfaceLabel->setFont("Courier", "Plain", 12);
\    interfaceLabel->setAlignment("Center");
\    interfaceLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\    )
\  );
\  name = getProperty("alias");
\  if(name == null,
\    if(isInTheSamePackage(), name = getProperty("$name"), name = getProperty("$fullName"));
\    name = name->replace("_", " ")
\    );
\  nameLabel = addToCompartment(label(name),"Names");
\  if (!hasProperty("alias"),
\    nameLabel->setInplaceEditor({inProperty:="$name", outProperty:="$classInplaceEditing", default:=true}),
\    nameLabel->setInplaceEditor({property:="alias", default:=true})
\  );
\  nameLabel->setAlignment("Center");
\  nameLabel->setWholeWordsOnly();
\  if(hasPropertyValue("kind", "2"),
\    nameLabel->setFont("Courier", "BoldItalic", 12),
\    nameLabel->setFont("Courier", "Bold", 12));
\  if(hasProperty("typeParameter"),
\    (
\    stereoLabel = addToCompartment(label(" <"+getProperty("typeParameter")+"...>"), "Names");
\    stereoLabel->setFont("Courier", "Plain", 10);
\    interfaceLabel->setAlignment("Right");
\    stereoLabel->setLayoutConstraints(horizontalAlign("right"), verticalAlign("top"), widthAlign("parentDefined"), heightAlign("parentDefined"))
\    )
\  );
\  if(hasProperty("$hyperLink") || hasProperty("url"), nameLabel->setForeground(RGB(0,0,255)));
\  maxWidth = getIntegerOption("initialwidth");
\  setLayoutConstraints(minWidth(16),minHeight(16),preferredWidth(190),maxWidth(maxWidth));
\  setHorizontalMargin(5);
\  setCanHaveLinks()

view.map.*.Class.!isTopLevel() =
\  prefix = (if (hasProperty ("Bolero"),
\                 (if (hasProperty ("public"), "+", " ")),
\               (if (hasProperty("$public"), "+",
\                     (if (hasProperty("$private"), "-", " "))
\                   )
\                 )
\               )
\            );
\  name = getProperty("alias");
\  if(name == null,
\    if(isInTheSamePackage(), name = getProperty("$name"), name = getProperty("$fullName"));
\    name = name->replace("_", " ")
\    );
\  setGraphicObject(label(prefix + name));
\  if(hasProperty("$abstract"),
\    setFont(%defaultFontName%, "Italic", 12),
\    setFont(%defaultFontName%, "Plain", 12));
\  if (!hasProperty("alias"),
\    setInplaceEditor({inProperty:="$name", outProperty:="$classInplaceEditing", default:=true}),
\    setInplaceEditor({property:="alias", default:=true})
\  );
\  if(setCompartment("Classes") == null, hideElement());
\  setLayoutConstraints(preferredHeight(16),fixedHeight(true))

####################
### Attribute
####################
view.map.*.Attribute.true =
\  if (!getContainingNode ()->hasProperty ("Bolero"),
\    if(hasProperty("stereotype"),
\      (
\      stereoLabel = %parent%->addToCompartment(label("<<"+getProperty("stereotype")+">>"), "Attributes");
\      stereoLabel->setFont("Courier", "Plain", 12);
\      stereoLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\      )
\    );
\    label = label(getProperty("$name"));
\    if(hasProperty("$static"), label->setUnderlined());
\    setGraphicObject(label);
\    setInplaceEditor({outProperty:="$attributeInplaceEditing", default:=true});
\    if(setCompartment("Attributes") == null, hideElement());
\    setLayoutConstraints(preferredHeight(16),fixedHeight(true));
\    if(hasProperty("$hyperLink") || hasProperty("url"), setForeground(RGB(0,0,255)));
\    if(!hasOptionValue("option.detail", "Analysis") && !hasOptionValue("option.formatting", "Java"),
\      append(":"+getProperty("$type"))
\    );
\    if(!hasOptionValue("option.detail", "Analysis") && hasOptionValue("option.formatting", "Java"),
\      prepend(getProperty("$type") + " ")
\    );
\    if(hasOptionValue("option.detail", "Implementation") && hasProperty("$initialValue"),
\      append("=" + getProperty("$initialValue"))
\    );
\    if(!hasOptionValue("option.detail", "Analysis"),
\      if(hasProperty("$public"),prepend("+"));
\      if(hasProperty("$private"),prepend("-"));
\      if(hasProperty("$protected"),prepend("#"));
\      if(hasProperty("$package"),prepend(" "))
\    );
\    if(hasOptionValue("option.associationLinks.showAttribute", "Automatic") &&
\       hasProperty("$linkPrefix"),
\          hideElement()
\    ),
\
\    label = label(getProperty("$name"));
\    if(hasPropertyValue("classFeature", "true"), label->setUnderlined());
\    setGraphicObject(label);
\    if(setCompartment("BoleroAttributes") == null, hideElement());
\    setLayoutConstraints(preferredHeight(16),fixedHeight(true));
\    if(hasProperty("$hyperLink") || hasProperty("url"), setForeground(RGB(0,0,255)));
\    if(!hasOptionValue("option.detail", "Analysis") && !hasOptionValue("option.formatting", "Java"),
\      if (hasProperty ("typeName_0") && getProperty ("typeName_0") != "",
\        append(":"+getProperty("$type") + " "+getProperty("typeName_0")),
\        append(":"+getProperty("$type"))
\      )
\    );
\    if(!hasOptionValue("option.detail", "Analysis") && hasOptionValue("option.formatting", "Java"),
\      if (hasProperty ("typeName_0") && getProperty ("typeName_0") != "",
\        prepend(getProperty("$type") + " " + getProperty("typeName_0") + " "),
\        prepend(getProperty("$type") + " ")
\      )
\    );
\    if(hasOptionValue("option.detail", "Implementation") && hasProperty("initialValue_0") && getProperty("initialValue_0") != "",
\      append("=" + getProperty("initialValue_0"))
\    );
\    if(!hasOptionValue("option.detail", "Analysis"),
\       if(hasProperty("$public"),prepend("+"));
\       if(hasProperty("$private"),prepend("-"));
\       if(hasProperty("$protected"),prepend("#"));
\       if(hasProperty("$package"),prepend(" "))
\    )
\  )

####################
### Operation
####################
view.map.*.Operation.true =
\  if (!getContainingNode ()->hasProperty ("Bolero"),
\     if(hasProperty("stereotype"),
\       stereoLabel = %parent%->addToCompartment(label("<<"+getProperty("stereotype")+">>"), "Operations");
\       stereoLabel->setFont("Courier", "Plain", 12);
\       stereoLabel->setLayoutConstraints(preferredHeight(16),fixedHeight(true))
\     );
\     label = label(getProperty("$name"));
\     if(hasProperty("$static"), label->setUnderlined());
\     setGraphicObject(label);
\     if(hasProperty("$abstract"),
\       setFont("Courier", "Italic", 12),
\       setFont("Courier", "Plain", 12)
\     );
\     setInplaceEditor({outProperty:="$operationInplaceEditing", default:=true});
\     if(setCompartment("Operations") == null, hideElement());
\     setLayoutConstraints(preferredHeight(16),fixedHeight(true));
\     if(hasProperty("$hyperLink") || hasProperty("url"), setForeground(RGB(0,0,255)));
\     if(!hasOptionValue("option.detail", "Analysis") && hasOptionValue("option.formatting", "Java"),
\       prepend(getProperty("$returnType") + " ")
\     );
\     if(hasOptionValue("option.detail", "Implementation"),
\       if(hasOptionValue("option.formatting", "Java"),
\          append("(" + getProperty("$parametersText") + ")"),
\          append("(" + getProperty("$umlParametersText") + ")")
\       )
\     );
\     if(!hasOptionValue("option.detail", "Analysis") && hasOptionValue("option.formatting", "UML"),
\       if(hasProperty("$returnType"), append(":" + getProperty("$returnType")))
\     );
\     if(!hasOptionValue("option.detail", "Analysis"),
\       if(hasProperty("$public"),prepend("+"));
\       if(hasProperty("$private"),prepend("-"));
\       if(hasProperty("$protected"),prepend("#"));
\       if(hasProperty("$package"),prepend(" "))
\     ),
\
\     label = label(getProperty("Name"));
\     if(hasPropertyValue("classFeature", "true"), label->setUnderlined());
\     setGraphicObject(label);
\     if(hasPropertyValue("featureKind", "2"),
\       setFont("Courier", "Italic", 12),
\       setFont("Courier", "Plain", 12)
\     );
\     if (hasPropertyValue ("Name", "Constructor"),
\        if(setCompartment("BoleroConstructors") == null, hideElement()),
\        if(setCompartment("BoleroOperations") == null, hideElement())
\     );
\     setLayoutConstraints(preferredHeight(16),fixedHeight(true));
\     if(hasProperty("$hyperLink") || hasProperty("url"), setForeground(RGB(0,0,255)));
\     if(!hasOptionValue("option.detail", "Analysis") && hasOptionValue("option.formatting", "Java"),
\       prepend(getProperty("$type") + " "+getProperty("typeName_0") + " ")
\     );
\     if(hasOptionValue("option.detail", "Implementation"),
\       if(hasOptionValue("option.formatting", "Java"),
\          append("(" + getProperty("explicitParameter"));
\          if (hasProperty ("explicitParameter"), append ("..."));
\          append (")");
\          if (hasProperty ("implicitParameter"),
\              append ("[" + getProperty("implicitParameter") + "...]"))
\       )
\     );
\     if(!hasOptionValue("option.detail", "Analysis") && hasOptionValue("option.formatting", "UML"),
\       if(!hasPropertyValue ("Name", "Constructor") && hasProperty("typeName_0"),
\          append(":" + getProperty("$type") + " "+ getProperty("typeName_0")),
\          append(":" + getProperty("$type"))
\       )
\     );
\     if(!hasOptionValue("option.detail", "Analysis"),
\       if(hasProperty("$public"),prepend("+"));
\       if(hasProperty("$private"),prepend("-"));
\       if(hasProperty("$protected"),prepend("#"));
\       if(hasProperty("$package"),prepend(" "))
\     )
\  )

###############################
### Links
###############################
view.map.*.GeneralizationLink.true =
\   setForeground(RGB(0,64,64));
\   setBackground(RGB(255,255,255));
\   setLayoutDirection("direct");
\   setMerged();
\   addIcon("FilledTriangle","OnDestination");
\   if( getSource ()->hasProperty( "paramOfSuperClass_0"),
\     sc = getSource ()->getProperty( "paramOfSuperClass_0");
\     if (sc != null && sc != "",
\       icon = addLabelIcon( "<hasTypeParameters>", "OnSource" )
\     )
\   );
\   if( getSource ()->hasProperty( "paramsOfSuperInterfaces_0"),
\     sc = getSource ()->getProperty( "paramsOfSuperInterfaces_0");
\     if (sc != null && sc != "",
\       icon = addLabelIcon( "<hasTypeParameters>", "OnSource" )
\     )
\   );
\   if(hasOption("option.dependencyLinks.showBetweenClasses"),
\     hideElement(findAutodependencyLink())
\   )

view.map.*.ImplementationLink.true =
\   setForeground(RGB(0,128,128));
\   setBackground(RGB(255,255,255));
\   setLineStyle("dashed");
\   setLayoutDirection("direct");
\   setMerged();
\   addIcon("FilledTriangle","OnDestination");
\   if( getSource ()->hasProperty( "paramsOfImplementedInterfaces_0"),
\     sc = getSource ()->getProperty( "paramsOfImplementedInterfaces_0");
\     if (sc != null && sc != "",
\       icon = addLabelIcon( "<hasTypeParameters>", "OnSource" )
\     )
\   );
\   if(hasOption("option.dependencyLinks.showBetweenClasses"),
\     hideElement(findAutodependencyLink())
\     )

#view.map.*.DependencyLink.true =
#\   setForeground(RGB(0,128,128));
#\   setBackground(RGB(255,255,255));
#\   setLineStyle("dashed");
#\   setLayoutDirection("direct");
#\   setMerged();
#\   addIcon("FilledTriangle","OnDestination");
#\   icon = addLabelIcon(getProperty("label"),"UnderCenter");
#\   icon->setInplaceEditor({property:="label", default:=true});
#\   if( hasProperty( "BoleroParamOfSuperClass" ),
#\      icon = addLabelIcon( "<<"+getProperty( "BoleroParamOfSuperClass" )+">>", "AboveCenter" );
#\      icon->setInplaceEditor( { property := "BoleroParamOfSuperClass" } )
#\      );
#\   if( hasProperty( "BoleroParamsOfImplementedInterfaces" ),
#\      icon = addLabelIcon( "<<"+getProperty( "BoleroParamsOfImplementedInterfaces" )+">>", "AboveCenter" );
#\      icon->setInplaceEditor( { property := "BoleroParamsOfImplementedInterfaces" } )
#\      )


####################################
# View maps for coloring of elements
####################################

view.map.*.Class.hasProperty("Bolero") = setBackground(RGB(181,207,214))
view.map.*.Class.hasProperty("OutOfTheProject") = setBackground(RGB(181,231,181))
view.map.*.Class.hasPropertyValue("readOnly", "true") = setBackground (RGB (231, 211, 231))
