01: package jimm.datavision.gui;
02:
03: import jimm.datavision.field.ImageField;
04: import jimm.datavision.layout.swing.SwingImageField;
05: import java.util.Observable;
06:
07: public class ImageFieldWidget extends FieldWidget {
08:
09: /**
10: * Constructor.
11: *
12: * @param sw section widget in which the field's new widget will reside
13: * @param image a report image field
14: */
15: public ImageFieldWidget(SectionWidget sw, ImageField image) {
16: super (sw, new SwingImageField(image));
17: }
18:
19: public void update(Observable obj, Object arg) {
20: swingField.format(); // Redo image
21: jimm.datavision.field.Rectangle b = getField().getBounds();
22: getComponent().setBounds((int) b.x, (int) b.y, (int) b.width,
23: (int) b.height);
24: }
25:
26: public boolean usesFormat() {
27: return false;
28: }
29:
30: /**
31: * Performs whatever is necessary to select or deselct self. Called by
32: * {@link Designer#select}.
33: *
34: * @param makeSelected new selection state
35: */
36: void doSelect(boolean makeSelected) {
37: if (selected != makeSelected) {
38: selected = makeSelected;
39: getComponent().repaint(); // Reflect border changes
40: }
41: }
42:
43: }
|