Commit 5bef7174 authored by Eric Tobias's avatar Eric Tobias

Changed the Image so that the actual contained image may be null.

+ Changed the constructor to no longer throw a BuildException if the image from the builder is null.
+ Changed the paint method to check for an update of the image from the informationProvider before the null check for the image field is made to give the image a fighting change to be loaded.
parent a9625ba8
......@@ -55,12 +55,7 @@ public class Image extends Corona implements ContextEventListener, InformationRe
*/
public Image(ImageBuilder builder) throws BuildException {
super(builder);
// TODO look if image can be null or not
if (builder.image != null) {
image = builder.image;
} else {
throw new BuildException("The image may not be null!"); //$NON-NLS-1$
}
image = builder.image;
informationProvider = builder.informationProvider;
}
......@@ -72,6 +67,10 @@ public class Image extends Corona implements ContextEventListener, InformationRe
*/
@Override
public void paint(Graphics2D canvas) {
if (image == null) {
image = informationProvider == null ? image : informationProvider.getInformation();
}
if (!active || image == null) {
return;
}
......@@ -96,8 +95,6 @@ public class Image extends Corona implements ContextEventListener, InformationRe
rotation.transform(new Point(), drawAt);
image = informationProvider == null ? image : informationProvider.getInformation();
if (Double.compare(initialRotation, 0d) != 0) {
AffineTransform transformation = new AffineTransform();
transformation.rotate(initialRotation, spinOnCoronaCentre ? drawAt.getX() + image.getWidth(null) / 2 : drawAt.getX(), spinOnCoronaCentre ? drawAt.getY() + image.getHeight(null) / 2 : drawAt.getY());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment