Search this API

y.module.io
Class IOHandlerModule

java.lang.Object
  extended by y.module.YModule
      extended by y.module.io.IOHandlerModule
Direct Known Subclasses:
GMLInput, GMLOutput, GraphMLInput, GraphMLOutput, ImageOutputModule, TGFInput, TGFOutput, XGMLInput, XGMLOutput, YGFInput, YGFOutput, ZipGraphMLInput, ZipGraphMLOutput

public abstract class IOHandlerModule
extends YModule

Base class of all modules that provide file based I/O services for diagrams.

 

Field Summary
static byte INPUT_MODE
          I/O mode specifier constant.
protected static java.lang.String OPTION_CLIP_GRAPH
           
protected static java.lang.String OPTION_CLIP_TYPE
           
protected static java.lang.String OPTION_CLIP_VIEW
           
protected static java.lang.String OPTION_CUSTOM_HEIGHT
           
protected static java.lang.String OPTION_CUSTOM_WIDTH
           
protected static java.lang.String OPTION_GENERATE_HTML_TABLE
           
protected static java.lang.String OPTION_MARGIN
           
protected static java.lang.String OPTION_SCALING_FACTOR
           
protected static java.lang.String OPTION_SIZE_TYPE
           
protected static java.lang.String OPTION_SIZE_USE_CUSTOM_HEIGHT
           
protected static java.lang.String OPTION_SIZE_USE_CUSTOM_WIDTH
           
protected static java.lang.String OPTION_SIZE_USE_ORIGINAL
           
protected static java.lang.String OPTION_TILE_COLUMN_COUNT
           
protected static java.lang.String OPTION_TILE_ROW_COUNT
           
protected static java.lang.String OPTION_TILING_ACTIVE
           
static byte OUTPUT_MODE
          I/O mode specifier constant.
protected static java.lang.String TAB_TILING
           
protected static java.lang.String TAB_VIEWPORT
           
protected  ViewPortConfigurator vpc
           
 
Fields inherited from class y.module.YModule
FAILED, moduleListenerSupport, PRECONDITION_VIOLATED, SUCCESS
 
Constructor Summary
protected IOHandlerModule(java.lang.String name)
          Creates a new instance of IOHandlerModule.
protected IOHandlerModule(java.lang.String name, java.lang.String author, java.lang.String description)
          Deprecated. Use IOHandlerModule(String) instead. Proper module description should take place in the API documentation.
 
Method Summary
protected  void addTilingOptions(OptionHandler options)
          Adds image-tiling specific options to the given option handler instance.
protected  void addViewPortOptions(OptionHandler options)
          Adds viewport specific options to the given option handler instance.
protected  void adoptRenderingHints(Graph2DView viewPort, Graph2DView originalView)
          Configures global rendering hints for export.
protected  void adoptViewPortOptions()
           
protected  void configureViewPort(Graph2DView viewPort, Graph2DView originalView)
          Configures the given view port.
protected abstract  IOHandler createIOHandler()
          Creates an IOHandler instance responsible for the actual I/O to be performed.
 IOHandler getIOHandler()
          Returns the IOHandler used by this module.
 byte getIOMode()
          Returns the I/O mode the module is working in.
 java.net.URL getURL()
          Returns the location of the file to which the module either will export or import the diagram.
protected  void mainrun()
          Reads or writes a diagram in a specific format to a file.
protected  void setIOHandler(IOHandler ioh)
          Sets a specific IOHandler to be used by this module.
protected  void setIOMode(byte ioMode)
          Sets the I/O mode the module is working in.
 void setURL(java.net.URL url)
          Sets the location of the file to which the module either will export or import the diagram.
 
Methods inherited from class y.module.YModule
addModuleListener, createOptionHandler, createThread, dispose, exceptionHappened, fitGraph2DView, getAuthor, getDescription, getExitStatus, getGraph2D, getGraph2DView, getModuleListeners, getModuleName, getOptionHandler, getTimer, getView, init, initGuiFactory, isAbortable, isBackupRealizersEnabled, removeModuleListener, run, setBackupRealizersEnabled, setExitStatus, setGraph2D, setModuleName, setOptionHandler, start, startAsThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vpc

protected ViewPortConfigurator vpc

OUTPUT_MODE

public static final byte OUTPUT_MODE
I/O mode specifier constant. Specifies that the module is responsible for writing a diagram to a file.

See Also:
Constant Field Values

INPUT_MODE

public static final byte INPUT_MODE
I/O mode specifier constant. Specifies that the module is responsible for reading a diagram from a file.

See Also:
Constant Field Values

TAB_VIEWPORT

protected static final java.lang.String TAB_VIEWPORT
See Also:
Constant Field Values

OPTION_SIZE_TYPE

protected static final java.lang.String OPTION_SIZE_TYPE
See Also:
Constant Field Values

OPTION_SIZE_USE_ORIGINAL

protected static final java.lang.String OPTION_SIZE_USE_ORIGINAL
See Also:
Constant Field Values

OPTION_SIZE_USE_CUSTOM_WIDTH

protected static final java.lang.String OPTION_SIZE_USE_CUSTOM_WIDTH
See Also:
Constant Field Values

OPTION_SIZE_USE_CUSTOM_HEIGHT

protected static final java.lang.String OPTION_SIZE_USE_CUSTOM_HEIGHT
See Also:
Constant Field Values

OPTION_CUSTOM_WIDTH

protected static final java.lang.String OPTION_CUSTOM_WIDTH
See Also:
Constant Field Values

OPTION_CUSTOM_HEIGHT

protected static final java.lang.String OPTION_CUSTOM_HEIGHT
See Also:
Constant Field Values

OPTION_MARGIN

protected static final java.lang.String OPTION_MARGIN
See Also:
Constant Field Values

OPTION_SCALING_FACTOR

protected static final java.lang.String OPTION_SCALING_FACTOR
See Also:
Constant Field Values

OPTION_CLIP_TYPE

protected static final java.lang.String OPTION_CLIP_TYPE
See Also:
Constant Field Values

OPTION_CLIP_VIEW

protected static final java.lang.String OPTION_CLIP_VIEW
See Also:
Constant Field Values

OPTION_CLIP_GRAPH

protected static final java.lang.String OPTION_CLIP_GRAPH
See Also:
Constant Field Values

TAB_TILING

protected static final java.lang.String TAB_TILING
See Also:
Constant Field Values

OPTION_TILING_ACTIVE

protected static final java.lang.String OPTION_TILING_ACTIVE
See Also:
Constant Field Values

OPTION_TILE_COLUMN_COUNT

protected static final java.lang.String OPTION_TILE_COLUMN_COUNT
See Also:
Constant Field Values

OPTION_TILE_ROW_COUNT

protected static final java.lang.String OPTION_TILE_ROW_COUNT
See Also:
Constant Field Values

OPTION_GENERATE_HTML_TABLE

protected static final java.lang.String OPTION_GENERATE_HTML_TABLE
See Also:
Constant Field Values
Constructor Detail

IOHandlerModule

protected IOHandlerModule(java.lang.String name,
                          java.lang.String author,
                          java.lang.String description)
Deprecated. Use IOHandlerModule(String) instead. Proper module description should take place in the API documentation.

Creates a new instance of IOHandlerModule.

Parameters:
name - the module's name
author - the module's author
description - a short description of the module's functionality

IOHandlerModule

protected IOHandlerModule(java.lang.String name)
Creates a new instance of IOHandlerModule.

Parameters:
name - the module's name
Method Detail

setIOMode

protected void setIOMode(byte ioMode)
Sets the I/O mode the module is working in. Subclasses should set the mode according to the service they are providing. By default OUTPUT_MODE is set.

Parameters:
ioMode - one of OUTPUT_MODE or INPUT_MODE.

configureViewPort

protected void configureViewPort(Graph2DView viewPort,
                                 Graph2DView originalView)
Configures the given view port. Uses the original view and its associated graph as reference objects. Calls adoptViewPortOptions() and adoptRenderingHints(y.view.Graph2DView, y.view.Graph2DView).

Parameters:
viewPort - the Graph2DView used for exporting.
originalView - the exported graph's current view.

addViewPortOptions

protected void addViewPortOptions(OptionHandler options)
Adds viewport specific options to the given option handler instance.


addTilingOptions

protected void addTilingOptions(OptionHandler options)
Adds image-tiling specific options to the given option handler instance.


adoptViewPortOptions

protected void adoptViewPortOptions()

adoptRenderingHints

protected void adoptRenderingHints(Graph2DView viewPort,
                                   Graph2DView originalView)
Configures global rendering hints for export. The default implementation adopts the RenderingHints.KEY_FRACTIONALMETRICS hint from the original view if that hint is not already set for the export view.

Parameters:
viewPort - the Graph2DView used for exporting.
originalView - the exported graph's current view.
See Also:
Graph2DView.getRenderingHints()

getIOMode

public byte getIOMode()
Returns the I/O mode the module is working in.


setURL

public void setURL(java.net.URL url)
Sets the location of the file to which the module either will export or import the diagram.


getURL

public java.net.URL getURL()
Returns the location of the file to which the module either will export or import the diagram.


createIOHandler

protected abstract IOHandler createIOHandler()
Creates an IOHandler instance responsible for the actual I/O to be performed. Subclasses must implement this factory method.


getIOHandler

public IOHandler getIOHandler()
Returns the IOHandler used by this module.


setIOHandler

protected void setIOHandler(IOHandler ioh)
Sets a specific IOHandler to be used by this module.


mainrun

protected void mainrun()
Reads or writes a diagram in a specific format to a file.

Specified by:
mainrun in class YModule

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.