Search in sources :

Example 1 with IImageListener

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;
}
Also used : SymbolImageProperties(org.csstudio.swt.widgets.symbol.SymbolImageProperties) ImageBoolIndicatorModel(org.csstudio.opibuilder.widgets.model.ImageBoolIndicatorModel) Color(org.eclipse.swt.graphics.Color) ImageBoolButtonFigure(org.csstudio.opibuilder.widgets.figures.ImageBoolButtonFigure) IImageListener(org.csstudio.swt.widgets.symbol.util.IImageListener) IFigure(org.eclipse.draw2d.IFigure)

Example 2 with IImageListener

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;
}
Also used : SymbolImageProperties(org.csstudio.swt.widgets.symbol.SymbolImageProperties) Color(org.eclipse.swt.graphics.Color) ImageFigure(org.csstudio.opibuilder.widgets.figures.ImageFigure) ImageModel(org.csstudio.opibuilder.widgets.model.ImageModel) IImageListener(org.csstudio.swt.widgets.symbol.util.IImageListener) IFigure(org.eclipse.draw2d.IFigure)

Example 3 with IImageListener

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;
}
Also used : IManualValueChangeListener(org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener) SymbolImageProperties(org.csstudio.swt.widgets.symbol.SymbolImageProperties) ImageBoolButtonModel(org.csstudio.opibuilder.widgets.model.ImageBoolButtonModel) Color(org.eclipse.swt.graphics.Color) ImageBoolButtonFigure(org.csstudio.opibuilder.widgets.figures.ImageBoolButtonFigure) IImageListener(org.csstudio.swt.widgets.symbol.util.IImageListener) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

SymbolImageProperties (org.csstudio.swt.widgets.symbol.SymbolImageProperties)3 IImageListener (org.csstudio.swt.widgets.symbol.util.IImageListener)3 IFigure (org.eclipse.draw2d.IFigure)3 Color (org.eclipse.swt.graphics.Color)3 ImageBoolButtonFigure (org.csstudio.opibuilder.widgets.figures.ImageBoolButtonFigure)2 ImageFigure (org.csstudio.opibuilder.widgets.figures.ImageFigure)1 ImageBoolButtonModel (org.csstudio.opibuilder.widgets.model.ImageBoolButtonModel)1 ImageBoolIndicatorModel (org.csstudio.opibuilder.widgets.model.ImageBoolIndicatorModel)1 ImageModel (org.csstudio.opibuilder.widgets.model.ImageModel)1 IManualValueChangeListener (org.csstudio.swt.widgets.datadefinition.IManualValueChangeListener)1