package org.csstudio.opibuilder.adl2boy.translator;

import org.csstudio.opibuilder.model.AbstractContainerModel;
import org.csstudio.opibuilder.model.AbstractWidgetModel;
import org.csstudio.opibuilder.widgets.model.ActionButtonModel;
import org.csstudio.opibuilder.widgets.model.XMeterModel;
import org.csstudio.utility.adlparser.fileParser.ADLWidget;
import org.csstudio.utility.adlparser.fileParser.widgets.Meter;
import org.eclipse.swt.graphics.RGB;

public class Meter2Model extends AbstractADL2Model {
	XMeterModel meterModel = new XMeterModel();

	public Meter2Model(ADLWidget adlWidget, RGB[] colorMap, AbstractContainerModel parentModel) {
		super(adlWidget, colorMap, parentModel);
		parentModel.addChild(meterModel, true);
		Meter meterWidget = new Meter(adlWidget);
		if (meterWidget != null) {
			setADLObjectProps(meterWidget, meterModel);
			setADLMonitorProps(meterWidget, meterModel);
		}

		//set color mode
		String color_mode = meterWidget.getColor_mode();
		System.out.println("Meter Color mode " + color_mode);
		if ( color_mode.equals("static") ){
			meterModel.setPropertyValue(XMeterModel.PROP_FORECOLOR_ALARMSENSITIVE, false);
		}
		else if (color_mode.equals("alarm") ){
			meterModel.setPropertyValue(XMeterModel.PROP_FORECOLOR_ALARMSENSITIVE, true);
		}
		else if (color_mode.equals("discrete") ){
			meterModel.setPropertyValue(XMeterModel.PROP_FORECOLOR_ALARMSENSITIVE, false);
			//TODO Meter2Model Figure out what to do if colorMode is discrete
		}
		
		//TODO Add PV Limits to Meter2Model
		//TODO Add Label to Meter2Model
	}

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

}

@@ -161,24 +161,96 @@
 idgetModel;%0A
+import org.csstudio.opibuilder.widgets.model.AbstractMarkedWidgetModel;%0A
 import org.c
@@ -1597,37 +1597,1230 @@
 %09%09//
-TODO Add Label to Meter2Model
+ Decorate the meter Model%0A%09%09//TODO Meter2Model cannot show value or channel at this time. can this be added to the widget or do we need to make a grouping container.%0A%09%09String label = meterWidget.getLabel();%0A%09%09if ( label.equals(%22none%22))%7B%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_MARKERS, false);%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_SCALE, false);%0A%09%09%7D%0A%09%09if ( label.equals(%22no decorations%22))%7B%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_MARKERS, false);%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_SCALE, false);%0A%09%09%7D%0A%09%09if ( label.equals(%22outline%22))%7B%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_MARKERS, false);%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_SCALE, true);%0A%09%09%7D%0A%09%09if ( label.equals(%22limits%22))%7B%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_MARKERS, false);%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_SCALE, true);%0A%09%09%7D%0A%09%09if ( label.equals(%22channel%22))%7B%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_MARKERS, false);%0A%09%09%09meterModel.setPropertyValue(AbstractMarkedWidgetModel.PROP_SHOW_SCALE, true);%0A%09%09%7D%0A
 %0A%09%7D%0A

Add more parameters