/******************************************************************/
/* SDM engine configuration part */
/******************************************************************/

////////////////////////////////////////////////////////////////////////////////
//  SDM

StyleSheet {
  functionList : "ilog.rules.builder.editor.IlrBrGraphEditor$ResourceFinder";
}


SDM {
  LinkLayout     : "true" ;
	LabelLayout    : "true" ;
	Decoration     : "true" ;
	GraphLayout    : "Hierarchical" ;
	SubGraph       : "true";
	TreeView       : "true";
}

LinkLayout {
  hierarchical : true;
	linkOffset : 5 ;
	interGraphLinksMode : "true";
	combinedInterGraphLinksMode : "true";
	//layoutMode: SHORT_LINKS;
  //linkOverlapNodesForbidden : "true"; 
}

LabelLayout {
	enabled : "true";
}

GraphLayout {
	enabled         : "false";
	globalLinkStyle : "ORTHOGONAL_STYLE";
  flowDirection   : "Bottom"; //"Right";
	intergraphConnectivityMode : "true";
	position        : "30,30";
	connectingLinksToShape : "true";
}


//////////////////////////////////////////////////////////////////////
// node - general settings
//////////////////////////////////////////////////////////////////////

node {
  FrameGraphic : "default";
  FrameMargin : "10,25,10,10";
  class : ilog.views.sdm.graphic.IlvGeneralNode;
  toolTipText      : @tooltip;
}

node:expanded {
  foreground : #F5DEB3;
  background : #88F5DEB3;
  font : "sansserif-BOLD-ITALIC-12";
  showingTitle : "true";
  titleJustification : "Right";
  opaque : "true";
  titleColor : #000000;
}

node:expanded:selected:selected {
  foreground : #A3A3CC;
  background : #88CCCCFF;
}

//////////////////////////////////////////////////////////////////////
// CompositeState
//////////////////////////////////////////////////////////////////////

node.compositeState {
  Expandable : true;
  title: @name;
}

//////////////////////////////////////////////////////////////////////
// RuleFlow State / Composite State
//////////////////////////////////////////////////////////////////////

node.compositeState:collapsed {
  label: @name;
}

node.ruleFlowState,
node.pseudoState[kind="choice"],
node.compositeState:collapsed {
  fillColor1 : #FFFFF0;         // cream
  fillColor2 : #FFFFF0;
  fillStyle : SOLID_COLOR;
  foreground : #606060;
}

node.ruleFlowState,
node.compositeState {
  class : ilog.views.sdm.graphic.IlvGeneralNode;
  Anchor 		     : TopLeft;
  iconPosition   	     : Top;
  label          	     : @taskName;
  labelAlignment 	     : Center ;
  labelColor     	     : black ;
  labelPosition  	     : Center;
  labelSpacing   	     : 2 ;
  labelZoomable  	     : true ;
  lineSpacing    	     : 0 ;
  maxLabelZoom   	     : 15 ;
  minLabelZoom   	     : .5 ;
  shapeType            	     : RoundRectangle ;
  shapeWidth  	             : 80 ;
  shapeHeight                : 35 ;
  horizontalAutoResizeMode   : EXPAND_ONLY;
  horizontalAutoResizeMargin : 5;
  verticalAutoResizeMode     : EXPAND_ONLY;
  verticalAutoResizeMargin   : 5;
  labelFont                  : "sansserif-BOLD-12";
  wordWrapMode 	             : true;
  wordWrapChars              : " \t-,;";
}

node.ruleFlowState {
  icon: '@|getPluginResource("ruleflow", "/images/question.gif")';
}

node.ruleFlowState[taskType="RuleFlow.RuleTask"] {
  icon: '@|getPluginResource("ruleflow", "/images/ruletask.gif")';
}

node.ruleFlowState[taskType="RuleFlow.FunctionTask"] {
  icon: '@|getPluginResource("ruleflow", "/images/functiontask.gif")';
}

node.ruleFlowState[taskType="RuleFlow.FlowTask"] {
  icon: '@|getPluginResource("ruleflow", "/images/flowtask.gif")';
}

node.ruleFlowState[taskType="RuleFlow.RuleFlow"] {
  icon: '@|getPluginResource("ruleflow", "/images/flow.gif")';
}

node.ruleFlowState[taskType="RuleFlow.ExecutionRuleTask"] {
  icon: '@|getPluginResource("ruleflow", "/images/ruletask.gif")';
}

node.ruleFlowState[taskType="RuleFlow.ExecutionFunctionTask"] {
  icon: '@|getPluginResource("ruleflow", "/images/functiontask.gif")';
}

node.ruleFlowState[taskType="RuleFlow.ExecutionFlowTask"] {
  icon: '@|getPluginResource("ruleflow", "/images/flowtask.gif")';
}

node.ruleFlowState[taskType="RuleFlow.ExecutionRuleFlow"] {
  icon: '@|getPluginResource("ruleflow", "/images/flow.gif")';
}


node.compositeState {
  icon: '@|getPluginResource("ruleflow", "/images/flow.gif")';
}

//////////////////////////////////////////////////////////////////////
// PseudoState
//////////////////////////////////////////////////////////////////////

node.pseudoState {
  label: "";
}

node.pseudoState[kind=initial] {
  class : url("uml/Omg_uml.ivl#UML_start");
  background : black;
}

node.pseudoState[kind="fork"],
node.pseudoState[kind="join"] {
  shapeType: Rectangle;
  shapeWidth: 50;
  shapeHeight: 5;
  background : #CC0000;
}

node.pseudoState[kind="fork"][direction="vertical"],
node.pseudoState[kind="join"][direction="vertical"] {
  shapeWidth: 5;
  shapeHeight: 50;
}


node.pseudoState[kind="choice"] {
  shapeType      	: Diamond;
  shapeWidth      	: 25;
  shapeHeight      	: 25;
}

//////////////////////////////////////////////////////////////////////
// FinalState
//////////////////////////////////////////////////////////////////////

node.finalState {
  class : url("uml/Omg_uml.ivl#UML_end");
  background: black;
}

link {
  class            : ilog.views.sdm.graphic.IlvGeneralLink ;
  arrowColor       : 63,127,191;
  endCap           : CAP_ROUND ;
  foreground       : 95,191,255;  //  pale blue
  //label            : @condition ;
  lineJoin         : JOIN_ROUND ;
  lineWidth        : 2 ;
  mode             : MODE_GRADIENT ;
  arrowMode        : ARROW_FILL;
  oriented         : true ;
  ToolTipText      : @tooltip;
  maximumLineWidth : 16 ;
  minimumLineWidth : 2 ;
  arrowRatio       : 2 ;
}

link.transition {
  label: @label;
}


//////////////////////////////////////////////////////////////////////
// Error style
//////////////////////////////////////////////////////////////////////

node.compositeState:collapsed[builderStyle=error],
node.pseudoState[kind="choice"][builderStyle=error],
node.ruleFlowState[builderStyle=error]
{
  strokeColor : #FF0000;
  strokeWidth : 1;
  fillColor1 : red;
  fillColor2 : red;
}

node.pseudoState[kind="fork"][builderStyle=error],
node.pseudoState[kind="join"][builderStyle=error],
node.pseudoState[kind=initial][builderStyle=error],
node.finalState[builderStyle=error] {
	background : red;
}

link[builderStyle=error] {
  arrowColor : #FF5555;
  foreground : #FF0000;
//  arrowColor : red;
//  foreground : red;
}

//////////////////////////////////////////////////////////////////////
// Breakpoint style
//////////////////////////////////////////////////////////////////////

node.compositeState:collapsed[hasBreakpoint=true],
node.pseudoState[kind="choice"][hasBreakpoint=breakpoint],
node.ruleFlowState[hasBreakpoint=true]
{
  strokeColor : #FF0000;
  strokeWidth : 1;
  fillColor1 : #FFAAAA;
  fillColor2 : #FFFFFF;
}

node.pseudoState[kind="fork"][hasBreakpoint=true],
node.pseudoState[kind="join"][hasBreakpoint=true],
node.pseudoState[kind=initial][hasBreakpoint=true],
node.finalState[hasBreakpoint=true] {
	background : #FFAAAA;
}

link[hasBreakpoint=true] {
  arrowColor : #FF5555;
  foreground : #FF0000;
}

node.ruleFlowState,
node.pseudoState[kind="fork"]
{
  decorations[0] : "";
}

node.ruleFlowState[hasBreakpoint=true],
node.pseudoState[kind="fork"][hasBreakpoint=true]
{
  decorations[0] : "@#breakpointDecoration";
}

//////////////////////////////////////////////////////////////////////
// Stepping style
//////////////////////////////////////////////////////////////////////

node.compositeState:collapsed[builderStyle=stepping],
node.pseudoState[kind="choice"][builderStyle=stepping],
node.ruleFlowState[builderStyle=stepping]
{
  strokeColor : black;
  strokeWidth : 1;
  fillColor1 : blue;
  fillColor2 : blue;
	labelColor : white;
}

node.pseudoState[kind="fork"][builderStyle=stepping],
node.pseudoState[kind="join"][builderStyle=stepping],
node.pseudoState[kind=initial][builderStyle=stepping],
node.finalState[builderStyle=stepping] {
	background : blue;
}

link[builderStyle=stepping] {
  arrowColor: blue;
  foreground : blue;
}


/*
link.transition {
  decorations[0] : "";
  label: @label;
}

link.transition[builderStyle=stepping] {
  decorations[0] : @#extendedLabel;
}
*/

node.ruleFlowState
{
  decorations[0] : "";
}

node.ruleFlowState[builderStyle=stepping]
{
  decorations[0] : "@#steppingDecoration";
}

//NodeSideForOrigin      : Bottom;
//NodeSideForDestination : Top;
//ToPortSide: NORTH;
//FromPortSide: SOUTH;

// --- flowDirection: Bottom ---
// for hierarchical = true; layoutMode: SHORT_LINKS / LONG_LINKS;

link[connectionKind="fromHSynch"] {
  FromPortSide: SOUTH;
}

link[connectionKind="toHSynch"] {
  ToPortSide: NORTH;
}

link[connectionKind="fromVSynch"] {
  FromPortSide: EAST;
}

link[connectionKind="toVSynch"] {
  ToPortSide: WEST;
}


// --- flowDirection: Right ---
// for hierarchical = true; layoutMode: SHORT_LINKS / LONG_LINKS;

/*
link[connectionKind="fromHSynch"] {
  FromPortSide: WEST;
}

link[connectionKind="toHSynch"] {
  ToPortSide: EAST;
}

link[connectionKind="fromVSynch"] {
  FromPortSide: SOUTH;
}

link[connectionKind="toVSynch"] {
  ToPortSide: NORTH;
}
*/


// --- flowDirection: Right ---
// for hierarchical = false; layoutMode: SHORT_LINKS / LONG_LINKS;

link:linkLayoutRenderer[connectionKind="fromHSynch"] {
	NodeSideForOrigin      : Bottom;
}

link:linkLayoutRenderer[connectionKind="toHSynch"] {
	NodeSideForDestination : Top;
}

link:linkLayoutRenderer[connectionKind="fromVSynch"] {
  NodeSideForOrigin: Right;
}

link:linkLayoutRenderer[connectionKind="toVSynch"] {
  NodeSideForDestination: Left;
}

// --- Extended label ---

// link label, with colored border and white bg.
#extendedLabel {
  class : 'ilog.views.sdm.graphic.IlvGraphicFactories$ZoomableLabel' ;
  label           : @label;
	antialiasing    : true;
  leftMargin      : 2.5;
  rightMargin     : 2.5;
	topMargin       : 2.5;
  bottomMargin    : 2.5;
  foreground      : black;
	stroke          : @=stroke;
  strokePaint     : @#borderPaint;         
	borderOn        : true;
	backgroundPaint : @=whitePaint;
	backgroundOn    : true;
	fillPaint       : @=blackPaint;
}

#blackPaint {
  class : ilog.views.sdm.graphic.IlvPaint;
  color : black;
}

#whitePaint {
  class : ilog.views.sdm.graphic.IlvPaint;
  color : white;
}

#stroke {
  class     : ilog.views.sdm.graphic.IlvBasicStroke;
  lineWidth : 1;
}

#borderPaint {
  class : ilog.views.sdm.graphic.IlvPaint;
	color : blue;
}

// --- Stepping decoration ---

#steppingDecoration {
  class      : "ilog.views.sdm.graphic.IlvGraphicFactories$Icon";
  IlvRect    : "0,0,15,15";
  imageLocation: url("images/stopat.gif");
}

// --- Breakpoint decoration ---

#breakpointDecoration {
  class      : "ilog.views.sdm.graphic.IlvGraphicFactories$Icon";
  IlvRect    : "0,0,15,15";
  imageLocation: url("images/togglebp.gif");
}
