use of org.csstudio.opibuilder.widgets.model.ArrayModel in project yamcs-studio by yamcs.
the class ArrayFeedbackFactory method showChangeBoundsFeedback.
@Override
public void showChangeBoundsFeedback(AbstractWidgetModel widgetModel, PrecisionRectangle bounds, IFigure feedbackFigure, ChangeBoundsRequest request) {
ArrayModel arrayModel = (ArrayModel) widgetModel;
if (arrayModel.getChildren().isEmpty()) {
super.showChangeBoundsFeedback(widgetModel, bounds, feedbackFigure, request);
return;
}
Dimension sizeDelta = request.getSizeDelta();
if (arrayModel.isHorizontal()) {
int eWidth = arrayModel.getChildren().get(0).getWidth();
bounds.width -= sizeDelta.width;
sizeDelta.width = Math.round((float) sizeDelta.width / eWidth) * eWidth;
bounds.width += sizeDelta.width;
} else {
int eHeight = arrayModel.getChildren().get(0).getHeight();
bounds.height -= sizeDelta.height;
sizeDelta.height = Math.round((float) sizeDelta.height / eHeight) * eHeight;
bounds.height += sizeDelta.height;
}
super.showChangeBoundsFeedback(widgetModel, bounds, feedbackFigure, request);
}
use of org.csstudio.opibuilder.widgets.model.ArrayModel in project yamcs-studio by yamcs.
the class ArrayEditPart method registerLoadPVDataTypeListener.
private void registerLoadPVDataTypeListener() {
if (getExecutionMode() == ExecutionMode.RUN_MODE) {
final ArrayModel model = getWidgetModel();
IPV pv = getPV();
if (pv != null) {
if (pvDataTypeListener == null)
pvDataTypeListener = new IPVListener.Stub() {
@Override
public void valueChanged(IPV pv) {
VType value = pv.getValue();
if (value != null) {
model.setArrayLength(VTypeHelper.getSize(value));
BasicDataType dataType = VTypeHelper.getBasicDataType(value);
model.setPropertyValue(ArrayModel.PROP_DATA_TYPE, mapBasicDataTypeToArrayType(dataType));
}
}
};
pv.addListener(pvDataTypeListener);
}
}
}
use of org.csstudio.opibuilder.widgets.model.ArrayModel in project yamcs-studio by yamcs.
the class ArrayEditPart method doCreateFigure.
@Override
protected IFigure doCreateFigure() {
ArrayFigure figure = new ArrayFigure();
ArrayModel model = getWidgetModel();
figure.setArrayLength(model.getArrayLength());
figure.setHorizontal(model.isHorizontal());
figure.setSpinnerWidth(model.getSpinnerWidth());
figure.setShowSpinner(model.isShowSpinner());
figure.setShowScrollbar(model.isShowScrollbar());
figure.setIndex(0);
figure.addIndexChangeListener(new IManualValueChangeListener() {
@Override
public void manualValueChanged(double newValue) {
setValue(getValue());
}
});
updatePropSheet();
return figure;
}
Aggregations