uk.ac.essex.common.gui.panel
Class ResizePolicy

java.lang.Object
  extended by uk.ac.essex.common.gui.panel.ResizePolicy

public class ResizePolicy
extends java.lang.Object

The class to define the resizing policy of an uk.ac.essex.common.gui.pane.ImagePane. When the size of an uk.ac.essex.common.gui.pane.ImagePane is changed, the position of the image needs to be adjusted adequately. A policy is defined to indicate how to allign the image region displayed in the uk.ac.essex.common.gui.pane.ImagePane with the pane: for example, keep a fixed pixel at the center of the uk.ac.essex.common.gui.pane.ImagePane. The supported policies are: center-fixed, leftup-corner fixed, rightup-corner fixed, leftbottom-fixed and rightbottom-fixed.


Field Summary
static int POLICY_CENTER
          The defined resizing policies
static int POLICY_LEFTBOTTOM
           
static int POLICY_LEFTUP
           
static int POLICY_RIGHTBOTTOM
           
static int POLICY_RIGHTUP
           
 
Constructor Summary
ResizePolicy(int policy)
          The constructor.
 
Method Summary
 java.awt.Point computeOrigin(int referenceX, int referenceY, int w, int h)
          Compute the origin from the reference point and the size of the image display pane.
 java.awt.Point computeReference(int imageWidth, int imageHeight, int w, int h)
          Compute the reference based on the image size and the image display pane size.
 int getPolicy()
          Return the policy.
 java.awt.Point shiftReference(int dx, int dy)
          Return the shift based on the delta values.
 java.awt.Point shiftReference(int minx, int miny, int maxx, int maxy, int width, int height)
          Move the reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLICY_CENTER

public static int POLICY_CENTER
The defined resizing policies


POLICY_LEFTUP

public static int POLICY_LEFTUP

POLICY_RIGHTUP

public static int POLICY_RIGHTUP

POLICY_LEFTBOTTOM

public static int POLICY_LEFTBOTTOM

POLICY_RIGHTBOTTOM

public static int POLICY_RIGHTBOTTOM
Constructor Detail

ResizePolicy

public ResizePolicy(int policy)
The constructor.

Method Detail

getPolicy

public int getPolicy()
Return the policy.


computeOrigin

public java.awt.Point computeOrigin(int referenceX,
                                    int referenceY,
                                    int w,
                                    int h)
Compute the origin from the reference point and the size of the image display pane.


computeReference

public java.awt.Point computeReference(int imageWidth,
                                       int imageHeight,
                                       int w,
                                       int h)
Compute the reference based on the image size and the image display pane size.


shiftReference

public java.awt.Point shiftReference(int dx,
                                     int dy)
Return the shift based on the delta values.


shiftReference

public java.awt.Point shiftReference(int minx,
                                     int miny,
                                     int maxx,
                                     int maxy,
                                     int width,
                                     int height)
Move the reference.