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);
}
}
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);
}
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);
}
}
}
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;
}
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;
}
Aggregations