Search in sources :

Example 1 with IIconic

use of com.archimatetool.canvas.model.IIconic in project archi by archimatetool.

the class IconSection method refreshPreviewImage.

protected void refreshPreviewImage() {
    disposeImage();
    IIconic iconic = (IIconic) getFirstSelectedObject();
    if (iconic.getImagePath() != null) {
        IArchiveManager archiveManager = (IArchiveManager) iconic.getAdapter(IArchiveManager.class);
        Image image = null;
        try {
            image = archiveManager.createImage(iconic.getImagePath());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if (image != null) {
            // If the image is bigger than the maximum allowed image then create a scaled image
            if (image.getBounds().width > IIconic.MAX_IMAGE_SIZE || image.getBounds().height > IIconic.MAX_IMAGE_SIZE) {
                fImage = ImageFactory.getScaledImage(image, IIconic.MAX_IMAGE_SIZE);
                image.dispose();
            } else // Else use original
            {
                fImage = image;
            }
        }
    }
    fCanvas.redraw();
}
Also used : IIconic(com.archimatetool.canvas.model.IIconic) IArchiveManager(com.archimatetool.editor.model.IArchiveManager) Image(org.eclipse.swt.graphics.Image)

Example 2 with IIconic

use of com.archimatetool.canvas.model.IIconic in project archi by archimatetool.

the class IconSection method refreshButtons.

@Override
protected void refreshButtons() {
    super.refreshButtons();
    IIconic iconic = (IIconic) getFirstSelectedObject();
    int position = iconic.getImagePosition();
    if (position < IIconic.ICON_POSITION_TOP_LEFT || position > IIconic.ICON_POSITION_BOTTOM_RIGHT) {
        position = IIconic.ICON_POSITION_TOP_RIGHT;
    }
    if (!fIsExecutingCommand) {
        fComboPosition.select(position);
        fComboPosition.setEnabled(!isLocked(iconic));
    }
}
Also used : IIconic(com.archimatetool.canvas.model.IIconic)

Aggregations

IIconic (com.archimatetool.canvas.model.IIconic)2 IArchiveManager (com.archimatetool.editor.model.IArchiveManager)1 Image (org.eclipse.swt.graphics.Image)1