use of org.csstudio.swt.widgets.symbol.util.IImageListener in project yamcs-studio by yamcs.
the class ImageBoolIndicatorEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
ImageBoolIndicatorModel model = getWidgetModel();
// create AND initialize the view properly
final ImageBoolButtonFigure figure = new ImageBoolButtonFigure(true);
initializeCommonFigureProperties(figure, model);
SymbolImageProperties sip = new SymbolImageProperties();
sip.setStretch(model.isStretch());
sip.setAutoSize(model.isAutoSize());
sip.setAnimationDisabled(model.isStopAnimation());
sip.setAlignedToNearestSecond(model.isAlignedToNearestSecond());
sip.setBackgroundColor(new Color(Display.getDefault(), model.getBackgroundColor()));
figure.setSymbolProperties(sip, model);
figure.setImageLoadedListener(new IImageListener() {
@Override
public void imageResized(IFigure figure) {
ImageBoolButtonFigure symbolFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(symbolFigure);
}
});
figure.setOnImagePath(model.getOnImagePath());
figure.setOffImagePath(model.getOffImagePath());
return figure;
}
use of org.csstudio.swt.widgets.symbol.util.IImageListener in project yamcs-studio by yamcs.
the class ImageEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
ImageModel model = getWidgetModel();
// create AND initialize the view properly
final ImageFigure figure = new ImageFigure();
// Resize when new image is loaded
figure.setImageLoadedListener(new IImageListener() {
@Override
public void imageResized(IFigure figure) {
ImageFigure imageFigure = (ImageFigure) figure;
autoSizeWidget(imageFigure);
}
});
// Image default parameters
SymbolImageProperties sip = new SymbolImageProperties();
sip.setTopCrop(model.getTopCrop());
sip.setBottomCrop(model.getBottomCrop());
sip.setLeftCrop(model.getLeftCrop());
sip.setRightCrop(model.getRightCrop());
sip.setStretch(model.getStretch());
sip.setAutoSize(model.isAutoSize());
sip.setMatrix(model.getPermutationMatrix());
sip.setAlignedToNearestSecond(model.isAlignedToNearestSecond());
sip.setBackgroundColor(new Color(Display.getDefault(), model.getBackgroundColor()));
sip.setAnimationDisabled(model.isStopAnimation());
figure.setSymbolProperties(sip, model);
figure.setFilePath(model.getFilename());
return figure;
}
use of org.csstudio.swt.widgets.symbol.util.IImageListener in project yamcs-studio by yamcs.
the class ImageBoolButtonEditPart method doCreateFigure.
/**
* {@inheritDoc}
*/
@Override
protected IFigure doCreateFigure() {
ImageBoolButtonModel model = getWidgetModel();
// create AND initialize the view properly
final ImageBoolButtonFigure figure = new ImageBoolButtonFigure();
initializeCommonFigureProperties(figure, model);
SymbolImageProperties sip = new SymbolImageProperties();
sip.setStretch(model.isStretch());
sip.setAutoSize(model.isAutoSize());
sip.setAnimationDisabled(model.isStopAnimation());
sip.setAlignedToNearestSecond(model.isAlignedToNearestSecond());
sip.setBackgroundColor(new Color(Display.getDefault(), model.getBackgroundColor()));
figure.setSymbolProperties(sip, model);
figure.setImageLoadedListener(new IImageListener() {
@Override
public void imageResized(IFigure figure) {
ImageBoolButtonFigure symbolFigure = (ImageBoolButtonFigure) figure;
autoSizeWidget(symbolFigure);
}
});
figure.addManualValueChangeListener(new IManualValueChangeListener() {
@Override
public void manualValueChanged(double newValue) {
if (getExecutionMode() == ExecutionMode.RUN_MODE)
autoSizeWidget(figure);
}
});
figure.setOnImagePath(model.getOnImagePath());
figure.setOffImagePath(model.getOffImagePath());
return figure;
}
Aggregations