org.bs.mdi
Interface View

All Superinterfaces:
ActionObservable, ActionObserver, ActionProcessor
All Known Subinterfaces:
RootView
All Known Implementing Classes:
SwingRootView, SwingView

public interface View
extends ActionObserver, ActionObservable, ActionProcessor

Displays a piece of the document's information.


Method Summary
 void addChild(View child)
          Adds a child element.
 Action copy()
          Perform a "copy to clipboard" operation.
 int countChildren()
          Counts all child elements.
 Action cut()
          Perform a "cut to clipboard" operation.
 void delete()
          Perform a delete operation.
 View getChild(int index)
          Gets the child element at the specified index.
 Data getData()
          Returns the Data object associated with this view.
 Document getDocument()
          Returns the document which this view is assigned to.
 View getParentView()
          Gets the parent View object, or null if there is no parent object (i.e. this is probably a RootView object).
 boolean isCopyPossible()
          Returns true if content can be copied to the clipboard.
 boolean isCutPossible()
          Returns true if content can be cutted to the clipboard.
 boolean isDeletePossible()
          Returns true if content can be deleted.
 boolean isPastePossible()
          Returns true if content can be pasted from the clipboard.
 void paste(Action action)
          Perform a "paste from clipboard" operation.
 void removeChild(View child)
          Removes a child element.
 void setCopyPossible(boolean possible)
          Enables or disables copying to the clipboard.
 void setCutPossible(boolean possible)
          Enables or disables cutting to the clipboard.
 void setData(Data data)
          Associates this View with the given Data object.
 void setDeletePossible(boolean possible)
          Enables or disables deleting operations.
 void setPastePossible(boolean possible)
          Enables or disables pasting from the clipboard.
 void syncWithData()
          Called from the Data object to indicate that the documents data has changed.
 
Methods inherited from interface org.bs.mdi.ActionObserver
actionPerformed, actionUndone
 
Methods inherited from interface org.bs.mdi.ActionObservable
addObserver, countObservers, isObserver, notifyObservers, removeObserver
 
Methods inherited from interface org.bs.mdi.ActionProcessor
applyAction, undoAction
 

Method Detail

getDocument

public Document getDocument()
Returns the document which this view is assigned to. This is just a convenience function which is roughly equivalent to getData().getDocument.

Returns:
the document

getData

public Data getData()
Returns the Data object associated with this view.

Returns:
the corresponding Data object

setData

public void setData(Data data)
Associates this View with the given Data object. This method also makes this view observe the data as well as the data observe the view.

Parameters:
data - the Data object

getParentView

public View getParentView()
Gets the parent View object, or null if there is no parent object (i.e. this is probably a RootView object).

Returns:
the parent object

addChild

public void addChild(View child)
Adds a child element.

Parameters:
child - the child element

removeChild

public void removeChild(View child)
Removes a child element.

Parameters:
child - the child element

countChildren

public int countChildren()
Counts all child elements.

Returns:
the number of child elements

getChild

public View getChild(int index)
Gets the child element at the specified index.

Parameters:
index - the index
Returns:
the child element at the specified position

copy

public Action copy()
Perform a "copy to clipboard" operation. Converts the currently selected information to an action object and returns it.

Returns:
the action object containing the copied information

cut

public Action cut()
Perform a "cut to clipboard" operation. Converts the currently selected information to an action object and returns it.

Returns:
the action object containing the cutted information

paste

public void paste(Action action)
Perform a "paste from clipboard" operation. The information to be pasted is delivered via the "action" parameter.

Parameters:
action - the action object containing the information to be pasted

delete

public void delete()
Perform a delete operation.


isCopyPossible

public boolean isCopyPossible()
Returns true if content can be copied to the clipboard.

Returns:
true if a copy operation is possible

setCopyPossible

public void setCopyPossible(boolean possible)
Enables or disables copying to the clipboard.

Parameters:
possible - true if copying is possible, false otherwise

isCutPossible

public boolean isCutPossible()
Returns true if content can be cutted to the clipboard.

Returns:
true if a cut operation is possible

setCutPossible

public void setCutPossible(boolean possible)
Enables or disables cutting to the clipboard.

Parameters:
possible - true if cutting is possible, false otherwise

isPastePossible

public boolean isPastePossible()
Returns true if content can be pasted from the clipboard.

Returns:
true if a paste operation is possible

setPastePossible

public void setPastePossible(boolean possible)
Enables or disables pasting from the clipboard.

Parameters:
possible - true if pasting is possible, false otherwise

isDeletePossible

public boolean isDeletePossible()
Returns true if content can be deleted.

Returns:
true if a delete operation is possible

setDeletePossible

public void setDeletePossible(boolean possible)
Enables or disables deleting operations.

Parameters:
possible - true if deleting is possible, false otherwise

syncWithData

public void syncWithData()
Called from the Data object to indicate that the documents data has changed.

The view update or redraw its contents the reflect that changes.