sk.uniba.euromath.editor
Interface IEditor

All Superinterfaces:
IDOMSelectionChangedListener
All Known Implementing Classes:
TextEditor, XMLEditor

public interface IEditor
extends IDOMSelectionChangedListener

Interface that each EuroMath2 editor must implement. Editor is a MVC controller, that uses renderer output (the view) to edit source document. One instance of editor edits one nameroot. Each editor receives its own instance of IRenderer. Editor is always associated with exactly one target namespace.

The method call order is as follows: first the init(Source,IRenderer,Composite,XMLAccess,EditorSite) method is called to initialize the editor. * After the initialization the editor must be able to display renderer's IFigures, process keyboard and mouse events. reinit(Source, IChangeCollector) may be called at any time to inform renderer of partial data change.

Editor can support only two kinds of sources: the DOMSource and ObjectSource, because they can be easily accessed multiple times.

Instance of editor is always used by a single thread - it should not be synchronized, resulting in faster execution.

Author:
Tomas Studva, Martin Vysny
See Also:
IRenderer, EditInstanceProvider

Method Summary
 void addFocusListener(IFocusListener listener)
          Adds listener for focus events.
 void dispose()
          Prepares for end of work.
 IActionContributor getActionContributor()
          Returns action contributor, which can make bars special for this IEditor.
 Composite getClientComposite()
          Returns Composite where clients - children IEditors will(should) be created.
 Composite getHostingComposite()
          Returns composite which host this editor - composite received in init.
 IRenderer getRenderer()
          Returns IRenderer for this IEditor from init.
 Set<String> getVisualizedIds()
          Returns ids of nodes which are graphically rendered(represented) by this editor.
 void init(Source transformedDoc, IRenderer renderer, Composite parent, XMLAccess xmlAccess, EditorSite editorSite)
           Initializes the editor.
 void performPaintUpdate()
          Paints all figures needed to repaint.
 void reinit(Source transformedDoc, IChangeCollector changes)
           Reinitialize the editor when a partial change of the transformed document occurs.
 void removeFocusListener(IFocusListener listener)
          Removes listener for focus events.
 void setFocus()
          Ask this editor to set focus.
 void sortIds(List<String> ids)
          Sorts ids in manner as they are graphicaly displayed.
 
Methods inherited from interface sk.uniba.euromath.editor.selections.IDOMSelectionChangedListener
selectionChanged
 

Method Detail

init

void init(Source transformedDoc,
          IRenderer renderer,
          Composite parent,
          XMLAccess xmlAccess,
          EditorSite editorSite)
          throws EditorException

Initializes the editor. The editor should retrieve all figures from the renderer and display them on given composite. It must NOT resize nor move the composite or its children - this is handled by the EditorSite itself.

The editor works with two 'kinds' of document:

Parameters:
transformedDoc - the transformed document, rendered by the renderer. May be instance of DOMSource or ObjectSource only. Editor is encouraged to throw any exception including ClassCastException if it encounters illegal objects, to detect invalid objects quickly and cleanly.
renderer - instance of the renderer, rendering the transformed document. The renderer instance is used only in this instance of editor.
parent - Composite where to install IFigures.
xmlAccess - the source document accessor.
editorSite - host for this class.
Throws:
EditorException - if the editor cannot be initialized. In such case the common text editor/generic editor/read-only editor shall be used.

reinit

void reinit(Source transformedDoc,
            IChangeCollector changes)

Reinitialize the editor when a partial change of the transformed document occurs. The reinitialization of renderer is already finished - editor should query for new figures for each changed element.

Parameters:
transformedDoc - source with all changes already applied.
changes - defines changed elements. Has appropriate type for transformedDoc parameter, i.e. DOMChangeCollector for DOMSource etc.

getClientComposite

Composite getClientComposite()
Returns Composite where clients - children IEditors will(should) be created.

Returns:
composite for children editors placement

getHostingComposite

Composite getHostingComposite()
Returns composite which host this editor - composite received in init.

Returns:
composite where this editor is placed

getRenderer

IRenderer getRenderer()
Returns IRenderer for this IEditor from init.

Returns:
renderer associated with this editor

setFocus

void setFocus()
Ask this editor to set focus.


dispose

void dispose()
Prepares for end of work. Must remove this as listeners, ... .


performPaintUpdate

void performPaintUpdate()
Paints all figures needed to repaint.


getActionContributor

IActionContributor getActionContributor()
Returns action contributor, which can make bars special for this IEditor.

Returns:
action contributor to bars and menus

addFocusListener

void addFocusListener(IFocusListener listener)
Adds listener for focus events.

Parameters:
listener -

removeFocusListener

void removeFocusListener(IFocusListener listener)
Removes listener for focus events.

Parameters:
listener -

getVisualizedIds

Set<String> getVisualizedIds()
Returns ids of nodes which are graphically rendered(represented) by this editor. Id's are without :N suffix.

Returns:
new instance, list of ids which are visualized

sortIds

void sortIds(List<String> ids)
Sorts ids in manner as they are graphicaly displayed. X and also Y coordinates of graphics for id is considered. Use full ids, include with their :N component.

Parameters:
ids - list of ids to sort


Copyright © 2003-2006 null. All Rights Reserved.