use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.
the class Draw2DTextInputEditpartDelegate method registerPropertyChangeHandlers.
@Override
public void registerPropertyChangeHandlers() {
IWidgetPropertyChangeHandler selectorTypeHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((TextInputFigure) figure).setSelectorType(model.getSelectorType());
return false;
}
};
editpart.setPropertyChangeHandler(TextInputModel.PROP_SELECTOR_TYPE, selectorTypeHandler);
IWidgetPropertyChangeHandler dateTimeFormatHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((TextInputFigure) figure).setDateTimeFormat((String) newValue);
return false;
}
};
editpart.setPropertyChangeHandler(TextInputModel.PROP_DATETIME_FORMAT, dateTimeFormatHandler);
IWidgetPropertyChangeHandler fileSourceHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((TextInputFigure) figure).setFileSource(FileSource.values()[(Integer) newValue]);
return false;
}
};
editpart.setPropertyChangeHandler(TextInputModel.PROP_FILE_SOURCE, fileSourceHandler);
IWidgetPropertyChangeHandler fileReturnPartHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((TextInputFigure) figure).setFileReturnPart(FileReturnPart.values()[(Integer) newValue]);
return false;
}
};
editpart.setPropertyChangeHandler(TextInputModel.PROP_FILE_RETURN_PART, fileReturnPartHandler);
}
use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.
the class EllipseEditpart method registerPropertyChangeHandlers.
@Override
protected void registerPropertyChangeHandlers() {
super.registerPropertyChangeHandlers();
// fill
IWidgetPropertyChangeHandler fillHandler = new IWidgetPropertyChangeHandler() {
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
EllipseFigure ellipseFigure = (EllipseFigure) refreshableFigure;
ellipseFigure.setFill((Double) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_FILL_LEVEL, fillHandler);
// fill orientaion
IWidgetPropertyChangeHandler fillOrientHandler = new IWidgetPropertyChangeHandler() {
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
EllipseFigure ellipseFigure = (EllipseFigure) refreshableFigure;
ellipseFigure.setHorizontalFill((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_HORIZONTAL_FILL, fillOrientHandler);
// transparent
IWidgetPropertyChangeHandler transparentHandler = new IWidgetPropertyChangeHandler() {
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
EllipseFigure ellipseFigure = (EllipseFigure) refreshableFigure;
ellipseFigure.setTransparent((Boolean) newValue);
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_TRANSPARENT, transparentHandler);
// line color
IWidgetPropertyChangeHandler lineColorHandler = new IWidgetPropertyChangeHandler() {
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
((EllipseFigure) refreshableFigure).setLineColor(((OPIColor) newValue).getSWTColor());
return true;
}
};
setPropertyChangeHandler(AbstractShapeModel.PROP_LINE_COLOR, lineColorHandler);
IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((EllipseFigure) figure).setGradient((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(EllipseModel.PROP_GRADIENT, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((EllipseFigure) figure).setBackGradientStartColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(EllipseModel.PROP_BACKGROUND_GRADIENT_START_COLOR, handler);
handler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
((EllipseFigure) figure).setForeGradientStartColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(EllipseModel.PROP_FOREGROUND_GRADIENT_START_COLOR, handler);
}
use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.
the class GaugeEditPart method registerPropertyChangeHandlers.
/**
* {@inheritDoc}
*/
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
// needle Color
IWidgetPropertyChangeHandler needleColorColorHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
GaugeFigure gauge = (GaugeFigure) refreshableFigure;
gauge.setNeedleColor(((OPIColor) newValue).getSWTColor());
return false;
}
};
setPropertyChangeHandler(GaugeModel.PROP_NEEDLE_COLOR, needleColorColorHandler);
// effect 3D
IWidgetPropertyChangeHandler effect3DHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
GaugeFigure gauge = (GaugeFigure) refreshableFigure;
gauge.setEffect3D((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(GaugeModel.PROP_EFFECT3D, effect3DHandler);
// Ramp gradient
IWidgetPropertyChangeHandler gradientHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure refreshableFigure) {
GaugeFigure gauge = (GaugeFigure) refreshableFigure;
gauge.setGradient((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(GaugeModel.PROP_RAMP_GRADIENT, gradientHandler);
final IWidgetPropertyChangeHandler sizeHandler = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(Object oldValue, Object newValue, IFigure figure) {
if (((Integer) newValue) < GaugeModel.MINIMUM_SIZE)
newValue = GaugeModel.MINIMUM_SIZE;
getWidgetModel().setSize((Integer) newValue, (Integer) newValue);
return false;
}
};
PropertyChangeListener sizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
sizeHandler.handleChange(evt.getOldValue(), evt.getNewValue(), getFigure());
}
};
getWidgetModel().getProperty(AbstractWidgetModel.PROP_WIDTH).addPropertyChangeListener(sizeListener);
getWidgetModel().getProperty(AbstractWidgetModel.PROP_HEIGHT).addPropertyChangeListener(sizeListener);
}
use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.
the class ImageBoolButtonEditPart method registerPropertyChangeHandlers.
/**
* {@inheritDoc}
*/
@Override
protected void registerPropertyChangeHandlers() {
registerCommonPropertyChangeHandlers();
// Save CPU usage
// removeAllPropertyChangeHandlers(AbstractPVWidgetModel.PROP_PVVALUE);
// value
// IWidgetPropertyChangeHandler handler = new IWidgetPropertyChangeHandler() {
// public boolean handleChange(final Object oldValue,
// final Object newValue,
// final IFigure refreshableFigure) {
// if(newValue == null)
// return false;
// ImageBoolButtonFigure figure = (ImageBoolButtonFigure) refreshableFigure;
// //figure.setValue(ValueUtil.getDouble((IValue)newValue));
// autoSizeWidget(figure);
// return true;
// }
// };
// setPropertyChangeHandler(AbstractPVWidgetModel.PROP_PVVALUE, handler);
// changes to the on image property
IWidgetPropertyChangeHandler handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
IPath absolutePath = (IPath) newValue;
if (!absolutePath.isAbsolute())
absolutePath = ResourceUtil.buildAbsolutePath(getWidgetModel(), absolutePath);
imageFigure.setOnImagePath(absolutePath);
autoSizeWidget(imageFigure);
return true;
}
};
setPropertyChangeHandler(ImageBoolButtonModel.PROP_ON_IMAGE, handle);
// changes to the off image property
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
IPath absolutePath = (IPath) newValue;
if (!absolutePath.isAbsolute())
absolutePath = ResourceUtil.buildAbsolutePath(getWidgetModel(), absolutePath);
imageFigure.setOffImagePath(absolutePath);
autoSizeWidget(imageFigure);
return true;
}
};
setPropertyChangeHandler(ImageBoolButtonModel.PROP_OFF_IMAGE, handle);
// changes to the stretch property
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
imageFigure.setStretch((Boolean) newValue);
autoSizeWidget(imageFigure);
return true;
}
};
setPropertyChangeHandler(ImageBoolButtonModel.PROP_STRETCH, handle);
FigureTransparencyHelper.addHandler(this, figure);
// changes to the autosize property
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(imageFigure);
return true;
}
};
setPropertyChangeHandler(ImageBoolButtonModel.PROP_AUTOSIZE, handle);
// changes to the stop animation property
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
imageFigure.setAnimationDisabled((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(ImageBoolButtonModel.PROP_NO_ANIMATION, handle);
// changes to the align to nearest second property
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
imageFigure.setAlignedToNearestSecond((Boolean) newValue);
return false;
}
};
setPropertyChangeHandler(ImageBoolButtonModel.PROP_ALIGN_TO_NEAREST_SECOND, handle);
// changes to the border width property
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(imageFigure);
return true;
}
};
setPropertyChangeHandler(AbstractWidgetModel.PROP_BORDER_WIDTH, handle);
setPropertyChangeHandler(AbstractWidgetModel.PROP_BORDER_STYLE, handle);
// size change handlers - so we can stretch accordingly
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageBoolButtonFigure imageFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(imageFigure);
return true;
}
};
setPropertyChangeHandler(AbstractWidgetModel.PROP_HEIGHT, handle);
setPropertyChangeHandler(AbstractWidgetModel.PROP_WIDTH, handle);
}
use of org.csstudio.opibuilder.properties.IWidgetPropertyChangeHandler in project yamcs-studio by yamcs.
the class ImageEditPart method registerCropPropertyHandlers.
/**
* Register change handlers for the four crop properties.
*/
protected void registerCropPropertyHandlers() {
// top
IWidgetPropertyChangeHandler handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageFigure imageFigure = (ImageFigure) figure;
imageFigure.setTopCrop((Integer) newValue);
autoSizeWidget(imageFigure);
return false;
}
};
setPropertyChangeHandler(ImageModel.PROP_TOPCROP, handle);
// bottom
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageFigure imageFigure = (ImageFigure) figure;
imageFigure.setBottomCrop((Integer) newValue);
autoSizeWidget(imageFigure);
return false;
}
};
setPropertyChangeHandler(ImageModel.PROP_BOTTOMCROP, handle);
// left
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageFigure imageFigure = (ImageFigure) figure;
imageFigure.setLeftCrop((Integer) newValue);
autoSizeWidget(imageFigure);
return false;
}
};
setPropertyChangeHandler(ImageModel.PROP_LEFTCROP, handle);
// right
handle = new IWidgetPropertyChangeHandler() {
@Override
public boolean handleChange(final Object oldValue, final Object newValue, final IFigure figure) {
ImageFigure imageFigure = (ImageFigure) figure;
imageFigure.setRightCrop((Integer) newValue);
autoSizeWidget(imageFigure);
return false;
}
};
setPropertyChangeHandler(ImageModel.PROP_RIGHTCROP, handle);
}
Aggregations