package org.csstudio.opibuilder.adl2boy.translator;

import org.csstudio.opibuilder.model.AbstractContainerModel;
import org.csstudio.opibuilder.model.AbstractWidgetModel;
import org.csstudio.opibuilder.widgets.model.AbstractShapeModel;
import org.csstudio.opibuilder.widgets.model.GroupingContainerModel;
import org.csstudio.opibuilder.widgets.model.RectangleModel;
import org.csstudio.utility.adlparser.fileParser.ADLWidget;
import org.csstudio.utility.adlparser.fileParser.widgets.Rectangle;
import org.eclipse.swt.graphics.RGB;

public class Rectangle2Model extends AbstractADL2Model {
	RectangleModel rectangleModel = new RectangleModel();

	public Rectangle2Model(ADLWidget adlWidget, RGB[] colorMap, AbstractContainerModel parentModel) {
		super(adlWidget, colorMap, parentModel);
		parentModel.addChild(rectangleModel, true);
		Rectangle rectWidget = new Rectangle(adlWidget);
		if (rectWidget != null) {
			setADLObjectProps(rectWidget, rectangleModel);
			setADLBasicAttributeProps(rectWidget, rectangleModel, true);
		}
		//check fill parameters
		if ( rectWidget.hasADLBasicAttribute() ) {
			System.out.println("RECTANGLE has basic attributes");
			if (rectWidget.getAdlBasicAttribute().getFill().equals("solid") ) {
				System.out.println("RECTANGLE fill is solid");				
				rectangleModel.setPropertyValue(RectangleModel.PROP_TRANSPARENT, false);
				rectangleModel.setPropertyValue(RectangleModel.PROP_FILL_LEVEL, 100);
				rectangleModel.setPropertyValue(RectangleModel.PROP_HORIZONTAL_FILL, true);
				
			}
			else if (rectWidget.getAdlBasicAttribute().getFill().equals("outline")) {
				System.out.println("RECTANGLE has fill is outline");
				rectangleModel.setPropertyValue(RectangleModel.PROP_TRANSPARENT, true);
				RGB fColor = (RGB)rectangleModel.getPropertyValue(AbstractWidgetModel.PROP_COLOR_FOREGROUND);
				rectangleModel.setPropertyValue(AbstractShapeModel.PROP_LINE_COLOR, fColor);
				if ( rectWidget.getAdlBasicAttribute().getStyle().equals("solid") ) {
					rectangleModel.setPropertyValue(RectangleModel.PROP_LINE_STYLE, "Solid");
					
				}
			}
			else {
				
			}
		}
	}

	@Override
	public	AbstractWidgetModel getWidgetModel() {
		return rectangleModel;
	}

}

@@ -161,24 +161,70 @@
 idgetModel;%0A
+import org.csstudio.opibuilder.util.OPIColor;%0A
 import org.c
@@ -1779,19 +1779,24 @@
 e);%0A%09%09%09%09
-RGB
+OPIColor
  fColor 
@@ -1798,19 +1798,24 @@
 olor = (
-RGB
+OPIColor
 )rectang
@@ -2113,24 +2113,181 @@
 , %22Solid%22);%0A
+%09%09%09%09%7D%0A%09%09%09%09if ( rectWidget.getAdlBasicAttribute().getStyle().equals(%22dash%22) ) %7B%0A%09%09%09%09%09rectangleModel.setPropertyValue(RectangleModel.PROP_LINE_STYLE, %22Dash%22);%0A
 %09%09%09%09%09%0A%09%09%09%09%7D%0A

Fix problem with color and line style.