org.estouro.ui
Interface EditionContext

All Known Implementing Classes:
EditionToolAdapter

public interface EditionContext

information about the theme in edition, the user input, etc, ...

Author:
Fernando González Cortés

Method Summary
 void addEditionContextListener(EditionContextListener listener)
          Removes a listener of the edition context events
 boolean canRedoExtent()
           
 boolean canUndoExtent()
           
 void closeActiveTheme()
          Closes the currently opened theme
 void closeAll()
          Closes all the themes
 void closeTheme(int index)
          Closes the specified theme
 void dataChanged()
          Invoked in order to the adapter to redraw the spatial data
 Theme getActiveTheme()
          Gets the active theme.
 int getActiveThemeIndex()
          Gets the active theme index
 java.util.ArrayList<Handler> getCurrentHandlers()
          Gets the currently shown handlers
 com.hardcode.gdbms.engine.data.SpatialDataSource getDrawingDataSource()
          Gets a DataSource used to draw over the image.
 java.awt.Image getDrawnImage()
          Gets the last drawn image
 Automaton getEditionTool()
          Gets the current edition tool
 java.awt.geom.Rectangle2D getExtent()
          Gets the extent where the edition takes place in
 int getLastMouseX()
          Gets the last position of the mouse
 int getLastMouseY()
          Gets the las position of the mouse
 java.awt.geom.Point2D getLastRealMousePosition()
          Gets the last position of the mouse in real world coordinates.
 int getMouseModifiers()
          Gets the mouse modifiers of a transition performed by the used
 Theme getTheme(int index)
          Gets the index-th Theme
 int getThemeCount()
          Gets the number of themes in the edition context
 double getTolerance()
          Gets the mouse tolerance in realworld units
 int getUITolerance()
          Gets the tolerance in image units
 double[] getValues()
          Gets the input of the user.
 boolean isSnapping()
          Gets the activation status of the snapping feature of the edition context
 void moveThemeTo(int from, int to)
          Moves the theme in the 'from' position to the 'to' position shifting all the themes which position is greater or equal to 'to'
 void newTheme(com.hardcode.gdbms.engine.data.db.DBSpatialSource dbSource, java.lang.String driverName, com.hardcode.gdbms.engine.data.metadata.SpatialDriverMetadata sm)
          Creates a new database table for edition and adds it to the list of themes
 void newTheme(java.io.File file, java.lang.String driverName, com.hardcode.gdbms.engine.data.metadata.SpatialDriverMetadata sm)
          Creates a new File for edition and adds it to the list of themes
 void openTheme(com.hardcode.gdbms.engine.data.db.DBSpatialSource dbDef, java.lang.String driverName)
          Opens a database table for edition and adds it to the list of themes
 void openTheme(java.io.File file, java.lang.String driverName)
          Opens a file for edition and adds it to the list of themes
 void redoExtent()
          Redoes the last undone extent change
 void remark(int index)
          Remarks visually a selected record
 void removeEditionContextListener(EditionContextListener listener)
          Removes a listener of the edition context events
 void removeSelected()
          Removes the selected geometries
 void saveActiveTheme()
          Saves the contents of the theme currently in edition
 void saveTheme(int index)
          Saves the contents of the specified theme
 void saveThemeAs(com.hardcode.gdbms.engine.data.db.DBSpatialSource dbss, java.lang.String driverName)
          Saves the contents of the active theme in the specified database table.
 void saveThemeAs(java.io.File file, java.lang.String driverName)
          Saves the contents of the active theme in the specified file with the specified driver.
 void setActiveTheme(int index)
          Sets the active theme
 void setEditionTool(Automaton tool)
          Sets the current edition tool
 void setExtent(java.awt.geom.Rectangle2D newExtent)
          Sets the extent where the edition takes place in
 void setMouseModifiers(int modifiers)
          Sets the mouse modifiers of the next transition
 void setSnapping(boolean snapping)
          activates/deactivates the snapping feature of the edition context
 void setUITolerance(int tolerance)
          Sets the mouse tolerance in image units
 void setValues(double[] values)
          Sets the user input data
 java.awt.Point toImagePoint(double x, double y)
          Transforms a real world point into a image one
 java.awt.geom.Point2D toRealPoint(int x, int y)
          Transforms a image point into a real word one
 void transition(java.lang.String code)
          Makes a transition on the currently selected tool
 void undoExtent()
          Undoes the last extent change
 

Method Detail

getTheme

Theme getTheme(int index)
Gets the index-th Theme

Returns:

getThemeCount

int getThemeCount()
Gets the number of themes in the edition context

Returns:

getActiveThemeIndex

int getActiveThemeIndex()
Gets the active theme index

Returns:

getActiveTheme

Theme getActiveTheme()
Gets the active theme. The same as getTheme(getActiveThemeIndex)

Returns:

getValues

double[] getValues()
Gets the input of the user. If the user input data is a number will return an array of one element. If the user input data is a point the array will have two elements.

Returns:

setValues

void setValues(double[] values)
Sets the user input data

Parameters:
values -

getTolerance

double getTolerance()
Gets the mouse tolerance in realworld units

Returns:

setUITolerance

void setUITolerance(int tolerance)
Sets the mouse tolerance in image units

Parameters:
tolerance -

transition

void transition(java.lang.String code)
                throws NoSuchTransitionException,
                       TransitionException
Makes a transition on the currently selected tool

Parameters:
code - transition code
Throws:
NoSuchTransitionException - If such transition doesn't exists
TransitionException - If the transition execution failed

setEditionTool

void setEditionTool(Automaton tool)
                    throws TransitionException
Sets the current edition tool

Parameters:
tool -
Throws:
TransitionException - If the initializarion of the tool fails

getEditionTool

Automaton getEditionTool()
Gets the current edition tool

Returns:

setExtent

void setExtent(java.awt.geom.Rectangle2D newExtent)
Sets the extent where the edition takes place in

Parameters:
newExtent -

getExtent

java.awt.geom.Rectangle2D getExtent()
Gets the extent where the edition takes place in

Returns:

canUndoExtent

boolean canUndoExtent()
Returns:
True if there is a extent change to undo false otherwise

canRedoExtent

boolean canRedoExtent()
Returns:
True if there is a extent change to redo false otherwise

undoExtent

void undoExtent()
Undoes the last extent change


redoExtent

void redoExtent()
Redoes the last undone extent change


getDrawnImage

java.awt.Image getDrawnImage()
Gets the last drawn image

Returns:

toImagePoint

java.awt.Point toImagePoint(double x,
                            double y)
Transforms a real world point into a image one

Parameters:
x -
y -
Returns:

toRealPoint

java.awt.geom.Point2D toRealPoint(int x,
                                  int y)
Transforms a image point into a real word one

Parameters:
x -
y -
Returns:

getLastMouseX

int getLastMouseX()
Gets the last position of the mouse

Returns:

getLastMouseY

int getLastMouseY()
Gets the las position of the mouse

Returns:

getLastRealMousePosition

java.awt.geom.Point2D getLastRealMousePosition()
Gets the last position of the mouse in real world coordinates. When the mouse is adjusted to a snap point or handler a call to EditionContext.toRealPoint( EditionContext.getLastMouseX(), EditionContext.getLastMouseY()) won't be as precise as this call

Returns:

getUITolerance

int getUITolerance()
Gets the tolerance in image units

Returns:

getCurrentHandlers

java.util.ArrayList<Handler> getCurrentHandlers()
Gets the currently shown handlers

Returns:

getDrawingDataSource

com.hardcode.gdbms.engine.data.SpatialDataSource getDrawingDataSource()
Gets a DataSource used to draw over the image. The return value is an empty DataSource where the tool has to add the geometries to be drawn over the spatial editing data.

Returns:

dataChanged

void dataChanged()
Invoked in order to the adapter to redraw the spatial data


newTheme

void newTheme(com.hardcode.gdbms.engine.data.db.DBSpatialSource dbSource,
              java.lang.String driverName,
              com.hardcode.gdbms.engine.data.metadata.SpatialDriverMetadata sm)
              throws com.hardcode.gdbms.engine.data.driver.DriverException,
                     ThemeCreationException
Creates a new database table for edition and adds it to the list of themes

Parameters:
dbSource - information about the table to create
driverName - Name of the driver used to create the table
sm - metadata of the table
Throws:
DriverExceptionT
ThemeCreationException - hemeCreationException
com.hardcode.gdbms.engine.data.driver.DriverException

newTheme

void newTheme(java.io.File file,
              java.lang.String driverName,
              com.hardcode.gdbms.engine.data.metadata.SpatialDriverMetadata sm)
              throws ThemeCreationException,
                     com.hardcode.gdbms.engine.data.driver.DriverException
Creates a new File for edition and adds it to the list of themes

Parameters:
file - new file to edit
driverName - Name of the driver used to read file contents
Throws:
ThemeCreationException - If cannot create the theme
com.hardcode.gdbms.engine.data.driver.DriverException - If cannot put the theme on editable mode

openTheme

void openTheme(java.io.File file,
               java.lang.String driverName)
               throws ThemeCreationException,
                      com.hardcode.gdbms.engine.data.driver.DriverException
Opens a file for edition and adds it to the list of themes

Parameters:
file - file to open
driver - Name of the driver used to read file contents
Throws:
ThemeCreationException - If cannot create the theme
com.hardcode.gdbms.engine.data.driver.DriverException - If cannot put the theme on editable mode

openTheme

void openTheme(com.hardcode.gdbms.engine.data.db.DBSpatialSource dbDef,
               java.lang.String driverName)
               throws ThemeCreationException,
                      com.hardcode.gdbms.engine.data.driver.DriverException
Opens a database table for edition and adds it to the list of themes

Parameters:
dbDef - data structure with th information to access the database
driverName - Name of the driver used to read file contents
Throws:
ThemeCreationException - If cannot create the theme
com.hardcode.gdbms.engine.data.driver.DriverException - If cannot put the theme on editable mode

saveActiveTheme

void saveActiveTheme()
                     throws com.hardcode.gdbms.engine.data.driver.DriverException,
                            com.hardcode.gdbms.engine.data.FreeingResourcesException
Saves the contents of the theme currently in edition

Throws:
com.hardcode.gdbms.engine.data.driver.DriverException - if the operation fails
com.hardcode.gdbms.engine.data.FreeingResourcesException - If the operations succeeds but resources cannot be freed

saveTheme

void saveTheme(int index)
               throws com.hardcode.gdbms.engine.data.driver.DriverException,
                      com.hardcode.gdbms.engine.data.FreeingResourcesException
Saves the contents of the specified theme

Throws:
com.hardcode.gdbms.engine.data.driver.DriverException - if the operation fails
com.hardcode.gdbms.engine.data.FreeingResourcesException - If the operations succeeds but resources cannot be freed

saveThemeAs

void saveThemeAs(java.io.File file,
                 java.lang.String driverName)
                 throws com.hardcode.gdbms.engine.data.driver.DriverException,
                        com.hardcode.gdbms.engine.data.DataSourceCreationException,
                        ThemeCreationException
Saves the contents of the active theme in the specified file with the specified driver. The theme in edition becomes the one which accesses the saved file

Parameters:
file - file to save the contents
driver - Name of the driver used to access the data
Throws:
com.hardcode.gdbms.engine.data.driver.DriverException - If the operation fails
ThemeCreationException - If cannot create a new theme
TransitionException - If the tool reinitialization fails
com.hardcode.gdbms.engine.data.DataSourceCreationException

saveThemeAs

void saveThemeAs(com.hardcode.gdbms.engine.data.db.DBSpatialSource dbss,
                 java.lang.String driverName)
                 throws com.hardcode.gdbms.engine.data.driver.DriverException,
                        com.hardcode.gdbms.engine.data.DataSourceCreationException,
                        ThemeCreationException
Saves the contents of the active theme in the specified database table. The theme in edition becomes the one which accesses the saved file

Parameters:
dbss - Table where to save the contents
driverName - Name of the driver used to access the data
Throws:
com.hardcode.gdbms.engine.data.driver.DriverException - If the operation fails
ThemeCreationException - If cannot create a new theme
TransitionException - If the tool reinitialization fails
com.hardcode.gdbms.engine.data.DataSourceCreationException

closeTheme

void closeTheme(int index)
                throws com.hardcode.gdbms.engine.data.driver.DriverException
Closes the specified theme

Parameters:
index -
Throws:
com.hardcode.gdbms.engine.data.driver.DriverException

closeAll

void closeAll()
              throws com.hardcode.gdbms.engine.data.driver.DriverException
Closes all the themes

Throws:
com.hardcode.gdbms.engine.data.driver.DriverException

closeActiveTheme

void closeActiveTheme()
                      throws com.hardcode.gdbms.engine.data.driver.DriverException
Closes the currently opened theme

Throws:
com.hardcode.gdbms.engine.data.driver.DriverException - If the rollBack operation in the current theme fails

removeSelected

void removeSelected()
                    throws com.hardcode.gdbms.engine.data.driver.DriverException
Removes the selected geometries

Throws:
com.hardcode.gdbms.engine.data.driver.DriverException - If the operation fails

getMouseModifiers

int getMouseModifiers()
Gets the mouse modifiers of a transition performed by the used

Returns:

setMouseModifiers

void setMouseModifiers(int modifiers)
Sets the mouse modifiers of the next transition


addEditionContextListener

void addEditionContextListener(EditionContextListener listener)
Removes a listener of the edition context events

Parameters:
listener -

removeEditionContextListener

void removeEditionContextListener(EditionContextListener listener)
Removes a listener of the edition context events

Parameters:
listener -

remark

void remark(int index)
Remarks visually a selected record

Parameters:
index - index in the getSelection array

isSnapping

boolean isSnapping()
Gets the activation status of the snapping feature of the edition context

Returns:

setSnapping

void setSnapping(boolean snapping)
activates/deactivates the snapping feature of the edition context

Parameters:
snapping -

setActiveTheme

void setActiveTheme(int index)
                    throws com.hardcode.gdbms.engine.data.driver.DriverException
Sets the active theme

Parameters:
index -
Throws:
com.hardcode.gdbms.engine.data.driver.DriverException

moveThemeTo

void moveThemeTo(int from,
                 int to)
Moves the theme in the 'from' position to the 'to' position shifting all the themes which position is greater or equal to 'to'

Parameters:
from -
to -


Copyright © 2005-2006 Fernando González Cortés. All Rights Reserved.