|
JIU 0.14.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.apps.EditorState
public class EditorState
Represents the state of the editor, including image(s), modified flag, current file name and directories and more. This class must not know GUI-specific information like Frame or JFrame objects. These GUI classes (more precisely, the JIU classes that extend them) will have to know EditorState and update according to the information they retrieve from an EditorState object associated with them. EditorState is a pure data container.
Field Summary | |
---|---|
static int |
DEFAULT_INTERPOLATION
The default interpolation type, one of the three INTERPOLATION_xyz constants. |
static int |
DEFAULT_MAX_REDO_IMAGES
The default number of redo steps possible. |
static int |
DEFAULT_MAX_UNDO_IMAGES
The default number of undo steps possible. |
static int |
INTERPOLATION_BICUBIC
Integer constant for bicubic interpolation. |
static int |
INTERPOLATION_BILINEAR
Integer constant for bilinear neighbor interpolation. |
static int |
INTERPOLATION_NEAREST_NEIGHBOR
Integer constant for nearest neighbor interpolation. |
static int |
ORIGINAL_SIZE_ZOOM_INDEX
The index into the ZOOM_LEVELS array that holds the original size zoom level (100 percent). |
static int[] |
ZOOM_LEVELS
All allowed zoom levels, as percentage values in ascending order. |
Constructor Summary | |
---|---|
EditorState()
Create new EditorState object and initialize its private fields to default values. |
Method Summary | |
---|---|
void |
addProgressListener(ProgressListener pl)
Adds the argument progress listener to the internal list of progress listeners to be notified by progress updates. |
boolean |
canRedo()
Returns if a redo operation is possible right now. |
boolean |
canUndo()
Returns if an undo operation is possible right now. |
void |
clearRedo()
|
void |
clearUndo()
|
void |
ensureStringsAvailable()
|
String |
getCurrentDirectory()
Returns the current directory. |
String |
getFileName()
Returns the name of the file from which the current image was loaded. |
PixelImage |
getImage()
Returns the image object currently loaded. |
int |
getInterpolation()
Returns the current interpolation type, one of the INTERPOLATION_xyz constants. |
Locale |
getLocale()
Returns the Locale object currently used. |
boolean |
getModified()
Returns the current modified state (true if image was modified and not saved after modification, false otherwise). |
Vector |
getProgressListeners()
Returns the internal list of progress listeners. |
String |
getStartupImageName()
|
Strings |
getStrings()
Returns the Strings object currently in use. |
double |
getZoomFactorX()
Returns the current zoom factor in horizontal direction. |
double |
getZoomFactorY()
Returns the current zoom factor in vertical direction. |
boolean |
getZoomToFit()
Returns if image display is currently set to "zoom to fit" Zoom to fit means that the image is always zoomed to fit exactly into the window. |
boolean |
hasImage()
Returns if this state encapsulates an image object. |
void |
installProgressListeners(Operation op)
Adds all ProgressListener objects from the internal list of listeners to the argument operation. |
boolean |
isMaximumZoom()
Returns if the image is displayed at maximum zoom level. |
boolean |
isMinimumZoom()
Returns if the image is displayed at minimum zoom level. |
boolean |
isZoomOriginalSize()
Returns if the current zoom level is set to original size (each image pixel is displayed as one pixel). |
void |
redo()
Perform a redo operation, restore the state before the last undo operation. |
void |
resetZoomFactors()
|
void |
setCurrentDirectory(String newCurrentDirectory)
Sets a new current directory. |
void |
setFileName(String newFileName)
Sets a new file name. |
void |
setImage(PixelImage image,
boolean newModifiedState)
Sets image and modified state to argument values. |
void |
setInterpolation(int newInterpolation)
Sets a new interpolation type to be used for display. |
void |
setLocale(Locale newLocale)
Defines a new Locale to be used. |
void |
setStartupImageName(String name)
|
void |
setStrings(String iso639Code)
Set new Strings resource. |
void |
setZoomFactors(double zoomX,
double zoomY)
Sets the zoom factors to the argument values. |
void |
undo()
Perform an undo step - the previous state will be set, the current state will be saved for a redo operation |
void |
zoomIn()
Increase the zoom level by one. |
void |
zoomOut()
Decrease the zoom level by one. |
void |
zoomSetOriginalSize()
Set the zoom level to 100 percent (1:1). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_UNDO_IMAGES
public static final int DEFAULT_MAX_REDO_IMAGES
public static final int[] ZOOM_LEVELS
public static final int ORIGINAL_SIZE_ZOOM_INDEX
ZOOM_LEVELS
array that holds the original size zoom level (100 percent).
So, ZOOM_LEVELS[ORIGINAL_SIZE_ZOOM_INDEX] must be equal to 100.
public static final int INTERPOLATION_NEAREST_NEIGHBOR
public static final int INTERPOLATION_BILINEAR
public static final int INTERPOLATION_BICUBIC
public static final int DEFAULT_INTERPOLATION
Constructor Detail |
---|
public EditorState()
Method Detail |
---|
public void addProgressListener(ProgressListener pl)
pl
- object implementing ProgressListener to be addedpublic boolean canRedo()
public boolean canUndo()
public void clearRedo()
public void clearUndo()
public void ensureStringsAvailable()
public String getCurrentDirectory()
public String getFileName()
public PixelImage getImage()
public int getInterpolation()
public Locale getLocale()
public boolean getModified()
public Vector getProgressListeners()
public String getStartupImageName()
public Strings getStrings()
public double getZoomFactorX()
getZoomFactorY()
public double getZoomFactorY()
getZoomFactorX()
public boolean getZoomToFit()
public boolean hasImage()
public void installProgressListeners(Operation op)
public boolean isMaximumZoom()
public boolean isMinimumZoom()
public boolean isZoomOriginalSize()
public void redo()
public void resetZoomFactors()
public void setCurrentDirectory(String newCurrentDirectory)
newCurrentDirectory
- the directory to be used as current directory from now onpublic void setFileName(String newFileName)
newFileName
- new name of the current filepublic void setImage(PixelImage image, boolean newModifiedState)
image
- new current imagenewModifiedState
- new state of modified flagpublic void setStartupImageName(String name)
public void setInterpolation(int newInterpolation)
newInterpolation
- an int for the interpolation type, must be one of the INTERPOLATION_xyz constantspublic void setLocale(Locale newLocale)
newLocale
- Locale object used from now onsetStrings(java.lang.String)
public void setStrings(String iso639Code)
iso639Code
- language of the new Strings resourcepublic void setZoomFactors(double zoomX, double zoomY)
public void undo()
redo()
public void zoomIn()
zoomOut()
,
zoomSetOriginalSize()
public void zoomOut()
zoomIn()
,
zoomSetOriginalSize()
public void zoomSetOriginalSize()
zoomIn()
,
zoomOut()
|
JIU 0.14.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |