Search in sources :

Example 1 with AbstractWidgetProperty

use of org.csstudio.opibuilder.properties.AbstractWidgetProperty in project yamcs-studio by yamcs.

the class WidgetTreeEditpart method activate.

@Override
public void activate() {
    super.activate();
    PropertyChangeListener visualListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            refreshVisuals();
        }
    };
    AbstractWidgetProperty nameProperty = getWidgetModel().getProperty(AbstractWidgetModel.PROP_NAME);
    if (nameProperty != null) {
        nameProperty.addPropertyChangeListener(visualListener);
    }
    AbstractWidgetProperty pvNameProperty = getWidgetModel().getProperty(AbstractPVWidgetModel.PROP_PVNAME);
    if (pvNameProperty != null) {
        pvNameProperty.addPropertyChangeListener(visualListener);
    }
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) AbstractWidgetProperty(org.csstudio.opibuilder.properties.AbstractWidgetProperty)

Example 2 with AbstractWidgetProperty

use of org.csstudio.opibuilder.properties.AbstractWidgetProperty in project yamcs-studio by yamcs.

the class ReloadOPIAction method run.

@Override
public void run(IAction action) {
    AbstractWidgetProperty property = getSelectedContianerWidget().getWidgetModel().getProperty(LinkingContainerModel.PROP_OPI_FILE);
    property.setPropertyValue(property.getPropertyValue(), true);
}
Also used : AbstractWidgetProperty(org.csstudio.opibuilder.properties.AbstractWidgetProperty)

Example 3 with AbstractWidgetProperty

use of org.csstudio.opibuilder.properties.AbstractWidgetProperty in project yamcs-studio by yamcs.

the class IntensityGraphEditPart method registerROIAmountChangeHandler.

private void registerROIAmountChangeHandler() {
    PropertyChangeListener listener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            int currentCount = (Integer) evt.getOldValue();
            int newCount = (Integer) evt.getNewValue();
            if (newCount > currentCount) {
                for (int i = currentCount; i < newCount; i++) {
                    for (ROIProperty roiProperty : ROIProperty.values()) {
                        if (roiProperty != ROIProperty.XPV_VALUE && roiProperty != ROIProperty.YPV_VALUE && roiProperty != ROIProperty.WPV_VALUE && roiProperty != ROIProperty.HPV_VALUE) {
                            String propID = IntensityGraphModel.makeROIPropID(roiProperty.propIDPre, i);
                            getWidgetModel().setPropertyVisible(propID, true);
                        }
                    }
                    final int roiIndex = i;
                    graph.addROI(getROIName(roiIndex), new IntensityGraphFigure.IROIListener() {

                        @Override
                        public void roiUpdated(int xIndex, int yIndex, int width, int height) {
                            String propID = IntensityGraphModel.makeROIPropID(ROIProperty.XPV.propIDPre, roiIndex);
                            setPVValue(propID, xIndex);
                            propID = IntensityGraphModel.makeROIPropID(ROIProperty.YPV.propIDPre, roiIndex);
                            setPVValue(propID, yIndex);
                            propID = IntensityGraphModel.makeROIPropID(ROIProperty.WPV.propIDPre, roiIndex);
                            setPVValue(propID, width);
                            propID = IntensityGraphModel.makeROIPropID(ROIProperty.HPV.propIDPre, roiIndex);
                            setPVValue(propID, height);
                        }
                    }, new IntensityGraphFigure.IROIInfoProvider() {

                        @Override
                        public String getROIInfo(int xIndex, int yIndex, int width, int height) {
                            String propID = IntensityGraphModel.makeROIPropID(ROIProperty.TITLE.propIDPre, roiIndex);
                            return (String) getPropertyValue(propID);
                        }
                    });
                }
            } else if (newCount < currentCount) {
                for (int i = currentCount - 1; i >= newCount; i--) {
                    graph.removeROI(getROIName(i));
                    for (ROIProperty roiProperty : ROIProperty.values()) {
                        String propID = IntensityGraphModel.makeROIPropID(roiProperty.propIDPre, i);
                        getWidgetModel().setPropertyVisible(propID, false);
                    }
                }
            }
        }
    };
    AbstractWidgetProperty countProperty = getWidgetModel().getProperty(IntensityGraphModel.PROP_ROI_COUNT);
    countProperty.addPropertyChangeListener(listener);
    // init
    int currentCount = (Integer) getPropertyValue(IntensityGraphModel.PROP_ROI_COUNT);
    listener.propertyChange(new PropertyChangeEvent(countProperty, IntensityGraphModel.PROP_ROI_COUNT, 0, currentCount));
    for (int i = 0; i < currentCount; i++) {
        for (final ROIProperty roiProperty : ROIProperty.values()) {
            String propID = IntensityGraphModel.makeROIPropID(roiProperty.propIDPre, i);
            Object propertyValue = getPropertyValue(propID);
            if (propertyValue != null)
                setROIProperty(getROIName(i), roiProperty, propertyValue);
        }
    }
}
Also used : IntensityGraphFigure(org.csstudio.swt.widgets.figures.IntensityGraphFigure) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) ROIProperty(org.csstudio.opibuilder.widgets.model.IntensityGraphModel.ROIProperty) AbstractWidgetProperty(org.csstudio.opibuilder.properties.AbstractWidgetProperty)

Example 4 with AbstractWidgetProperty

use of org.csstudio.opibuilder.properties.AbstractWidgetProperty in project yamcs-studio by yamcs.

the class AbstractComplexData method getAllProperties.

public AbstractWidgetProperty[] getAllProperties() {
    AbstractWidgetProperty[] propArray = new AbstractWidgetProperty[propertyMap.size()];
    int i = 0;
    for (AbstractWidgetProperty p : propertyMap.values()) propArray[i++] = p;
    return propArray;
}
Also used : AbstractWidgetProperty(org.csstudio.opibuilder.properties.AbstractWidgetProperty)

Example 5 with AbstractWidgetProperty

use of org.csstudio.opibuilder.properties.AbstractWidgetProperty in project yamcs-studio by yamcs.

the class AbstractComplexData method hashCode.

@Override
public int hashCode() {
    AbstractWidgetProperty[] properties = getAllProperties();
    int result = getClass().hashCode();
    for (AbstractWidgetProperty p : properties) {
        result = 31 * result + p.getPropertyID().hashCode();
        result = 31 * result + (p.getPropertyValue() == null ? 0 : p.getPropertyValue().hashCode());
    }
    return result;
}
Also used : AbstractWidgetProperty(org.csstudio.opibuilder.properties.AbstractWidgetProperty)

Aggregations

AbstractWidgetProperty (org.csstudio.opibuilder.properties.AbstractWidgetProperty)14 PropertyChangeListener (java.beans.PropertyChangeListener)4 PropertyChangeEvent (java.beans.PropertyChangeEvent)3 List (java.util.List)1 BooleanProperty (org.csstudio.opibuilder.properties.BooleanProperty)1 ColorProperty (org.csstudio.opibuilder.properties.ColorProperty)1 ComboProperty (org.csstudio.opibuilder.properties.ComboProperty)1 IntegerProperty (org.csstudio.opibuilder.properties.IntegerProperty)1 PointListProperty (org.csstudio.opibuilder.properties.PointListProperty)1 StringProperty (org.csstudio.opibuilder.properties.StringProperty)1 WidgetPropertyChangeListener (org.csstudio.opibuilder.properties.WidgetPropertyChangeListener)1 PVTuple (org.csstudio.opibuilder.script.PVTuple)1 RuleData (org.csstudio.opibuilder.script.RuleData)1 ScriptData (org.csstudio.opibuilder.script.ScriptData)1 ScriptsInput (org.csstudio.opibuilder.script.ScriptsInput)1 OPITimer (org.csstudio.opibuilder.util.OPITimer)1 ROIProperty (org.csstudio.opibuilder.widgets.model.IntensityGraphModel.ROIProperty)1 IPV (org.csstudio.simplepv.IPV)1 IntensityGraphFigure (org.csstudio.swt.widgets.figures.IntensityGraphFigure)1 Point (org.eclipse.draw2d.geometry.Point)1