package org.csstudio.utility.adlparser.fileParser.widgets;

import org.csstudio.utility.adlparser.fileParser.ADLWidget;
import org.csstudio.utility.adlparser.fileParser.FileLine;
import org.csstudio.utility.adlparser.fileParser.WrongADLFormatException;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLBasicAttribute;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLDynamicAttribute;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLObject;
import org.csstudio.utility.adlparser.internationalization.Messages;

public class Arc extends ADLAbstractWidget {

	public Arc(ADLWidget adlWidget) {
		super(adlWidget);
		try {
			for (ADLWidget childWidget : adlWidget.getObjects()) {
	        	if (childWidget.getType().equals("basic attribute")){
	        		_adlBasicAttribute = new ADLBasicAttribute(childWidget);
	        		System.out.println("TextWidget Color " + _adlBasicAttribute.getClr());
	        		if (_adlBasicAttribute != null){
	        			_hasBasicAttribute = true;
	        		}
	        	}
	        	else if (childWidget.getType().equals("object")){
	        		_adlObject = new ADLObject(childWidget);
	        		if (_adlObject != null){
	        			_hasObject = true;
	        		}
	        		
	        	}
	        	else if (childWidget.getType().equals("dynamic attribute")){
	        		_adlDynamicAttribute = new ADLDynamicAttribute(childWidget);
	        		if (_adlDynamicAttribute != null){
	        			_hasDynamicAttribute = true;
	        		}
	        	}
	        }
			//TODO Add Begin angle and path angle
		}
		catch (WrongADLFormatException ex) {
			
		}
	}

}

@@ -594,16 +594,97 @@
 Widget %7B
+%0A%09private int _begin = 0;%0A%09private int _path = 5760;         //default 90 degrees
 %0A%0A%09publi
@@ -1602,16 +1602,980 @@
       %7D%0A
+%09        for (FileLine fileLine : adlWidget.getBody()) %7B%0A%09            String parameter = fileLine.getLine();%0A%09            if(parameter.trim().startsWith(%22//%22))%7B //$NON-NLS-1$%0A%09                continue;%0A%09            %7D%0A%09            String%5B%5D row = parameter.split(%22=%22); //$NON-NLS-1$%0A%09            if(row.length!=2)%7B%0A%09                throw new WrongADLFormatException(Messages.ADLMonitor_WrongADLFormatException_Begin+parameter+Messages.ADLMonitor_WrongADLFormatException_End);%0A%09            %7D%0A%09            if(FileLine.argEquals(row%5B0%5D, %22begin%22))%7B //$NON-NLS-1$%0A%09            %09set_begin(FileLine.getIntValue(row%5B1%5D));%0A%09            %7Delse if(FileLine.argEquals(row%5B0%5D, %22path%22))%7B //$NON-NLS-1$%0A%09            %09set_path(FileLine.getIntValue(row%5B1%5D));%0A%09            %7Delse %7B%0A%09                throw new WrongADLFormatException(Messages.ADLMonitor_WrongADLFormatException_Parameter_Begin+row%5B0%5D+Messages.ADLMonitor_WrongADLFormatException_Parameter_End+parameter);%0A%09            %7D%0A%0A
 %09%09%09//TOD
@@ -2607,16 +2607,27 @@
 h angle%0A
+%09        %7D%0A
 %09%09%7D%0A%09%09ca
@@ -2669,14 +2669,14 @@
 %09%09%09%0A
-
 %09%09%7D%0A%09%7D%0A%0A
 %7D%0A
@@ -2673,10 +2673,385 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09/**%0A%09 * @param _begin the _begin to set%0A%09 */%0A%09private void set_begin(int _begin) %7B%0A%09%09this._begin = _begin;%0A%09%7D%0A%0A%09/**%0A%09 * @return the _begin%0A%09 */%0A%09public int get_begin() %7B%0A%09%09return _begin;%0A%09%7D%0A%0A%09/**%0A%09 * @param _path the _path to set%0A%09 */%0A%09private void set_path(int _path) %7B%0A%09%09this._path = _path;%0A%09%7D%0A%0A%09/**%0A%09 * @return the _path%0A%09 */%0A%09public int get_path() %7B%0A%09%09return _path;%0A%09%7D%0A%0A
 %7D%0A

Add Begin and end path