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

import org.csstudio.utility.adlparser.fileParser.ADLWidget;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLBasicAttribute;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLControl;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLDynamicAttribute;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLLimits;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLMonitor;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLObject;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLPlotcom;
import org.csstudio.utility.adlparser.fileParser.widgetParts.ADLPoints;
import org.csstudio.utility.adlparser.fileParser.widgetParts.RelatedDisplayItem;
import org.eclipse.jface.resource.ImageDescriptor;

/**
 * 
 * @author hammonds
 *
 */
public abstract class ADLAbstractWidget {
	protected ADLObject _adlObject= null;
	protected ADLBasicAttribute _adlBasicAttribute= null;
	protected ADLControl _adlControl= null;
	protected ADLMonitor _adlMonitor= null;
	protected ADLPoints _adlPoints= null;
	protected RelatedDisplayItem[] _relatedDisplayItem = null;
	protected ADLDynamicAttribute _adlDynamicAttribute = null;
	protected ADLLimits _adlLimits = null;
	protected ADLPlotcom _adlPlotcom = null;
	
	protected boolean _hasBasicAttribute = false;
	protected boolean _hasObject = false;
	protected boolean _hasControl = false;
	protected boolean _hasMonitor = false;
	protected boolean _hasPoints = false;
	protected boolean _hasRelatedDisplayItem = false;
	protected boolean _hasDynamicAttribute = false;
	protected boolean _hasLimits = false;
	protected boolean _hasPlotcom = false;
	
	protected ImageDescriptor descriptor = null;
	protected String name = new String();

	public ADLAbstractWidget(final ADLWidget adlWidget){
		
	}
	
	public final ImageDescriptor getImageDescriptor(){
		return descriptor;
	}
	public final String getName(){
		return name;
	}
    abstract public Object[] getChildren();
	
	public boolean hasADLObject(){
		return _hasObject;
	}
	
	public boolean hasADLBasicAttribute(){
		return _hasBasicAttribute;
	}

	public boolean hasADLControl(){
		return _hasControl;
	}
	
	public boolean hasADLMonitor(){
		return _hasMonitor;
	}
	
	public boolean hasADLPoints(){
		return _hasPoints;
	}
	
	public boolean hasRelatedDisplayItem(){
		return _hasRelatedDisplayItem;
	}
	
	public boolean hasADLDynamicAttribute(){
		return _hasDynamicAttribute;
	}
	
	public boolean hasADLLimits(){
		return _hasLimits;
	}
	
	public boolean hasADLPlotcom(){
		return _hasPlotcom;
	}
	

	/**
	 * @return ADLObject
	 */
	public ADLObject getAdlObject(){
		return _adlObject;
	}

	/**
	 * @return ADLBasicAttribute
	 */
	public ADLBasicAttribute getAdlBasicAttribute(){
		return _adlBasicAttribute;
	}

	/**
	 * @return ADLControl
	 */
	public ADLControl getAdlControl(){
		return _adlControl;
	}

	/**
	 * @return ADLMonitor
	 */
	public ADLMonitor getAdlMonitor(){
		return _adlMonitor;
	}

	/**
	 * @return ADLPoints
	 */
	public ADLPoints getAdlPoints(){
		return _adlPoints;
	}

	/**
	 * @return RelatedDisplayItem[]
	 */
	public RelatedDisplayItem[] getRelatedDisplayItem(){
		return _relatedDisplayItem;
	}

	/**
	 * @return ADLDynamicAttribute
	 */
	public ADLDynamicAttribute getAdlDynamicAttribute(){
		return _adlDynamicAttribute;
	}

	/**
	 * @return ADLLimits
	 */
	public ADLLimits getAdlLimits(){
		return _adlLimits;
	}

	/**
	 * @return ADLPlotcom
	 */
	public ADLPlotcom getAdlPlotcom(){
		return _adlPlotcom;
	}

}	

@@ -3573,11 +3573,272 @@
 om;%0A%09%7D%0A%0A
+%09public void setAdlBasicAttribute(ADLBasicAttribute basAttr)%7B%0A%09%09_adlBasicAttribute = basAttr;%0A%09%09_hasBasicAttribute = true;%0A%09%7D%0A%0A%09public void setAdlDynamicAttribute(ADLDynamicAttribute dynAttr)%7B%0A%09%09_adlDynamicAttribute = dynAttr;%0A%09%09_hasDynamicAttribute = true;%0A%09%7D%0A
 %7D%09%0A

Add set methods to set the basic and dynamic attributes. Some older files defined a default that is later added to the widget.