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();
}
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));
}
}
Aggregations