org.malai.action.library
Class IOAction

java.lang.Object
  extended by org.malai.action.Action
      extended by org.malai.action.library.IOAction
Direct Known Subclasses:
Load, NewDrawing, Save

public abstract class IOAction
extends Action

This abstract action defines an model for loading and saving actions.
This file is part of Malai
Copyright (c) 2009-2012 Arnaud BLOUIN

Malai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

Malai is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Since:
0.2
Author:
Arnaud Blouin

Nested Class Summary
 
Nested classes/interfaces inherited from class org.malai.action.Action
Action.ActionStatus
 
Field Summary
protected  java.io.File file
          The current file loaded or saved.
protected  boolean ok
          Define if the drawing has been successfully loaded or saved.
protected  ISOpenSaver openSaveManager
          The object that saves and loads files for the IS.
protected  MProgressBar progressBar
          The progress bar used to show the progress of the saving.
protected  java.lang.Object statusWidget
          The widget that displays the status of the I/O operation.
protected  UI ui
          The user interface that contains abstract presentations and instruments.
 
Fields inherited from class org.malai.action.Action
status
 
Constructor Summary
IOAction()
          Creates a save action.
 
Method Summary
 boolean canDo()
           
 void flush()
          When an action is no more useful it can be flushes to release the used data.
 java.io.File getFile()
           
 boolean hadEffect()
           
 boolean isRegisterable()
          Specifies if the action must be saved in the action register.
 void setFile(java.io.File file)
           
 void setOpenSaveManager(ISOpenSaver openSaveManager)
           
 void setProgressBar(MProgressBar progressBar)
           
 void setStatusWidget(java.lang.Object statusWidget)
           
 void setUi(UI ui)
           
 
Methods inherited from class org.malai.action.Action
abort, cancelledBy, doActionBody, doIt, done, getStatus, isDone, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

file

protected java.io.File file
The current file loaded or saved.


ui

protected UI ui
The user interface that contains abstract presentations and instruments.


ok

protected boolean ok
Define if the drawing has been successfully loaded or saved.


openSaveManager

protected ISOpenSaver openSaveManager
The object that saves and loads files for the IS.


progressBar

protected MProgressBar progressBar
The progress bar used to show the progress of the saving.


statusWidget

protected java.lang.Object statusWidget
The widget that displays the status of the I/O operation.

Constructor Detail

IOAction

public IOAction()
Creates a save action.

Since:
0.2
Method Detail

flush

public void flush()
Description copied from class: Action
When an action is no more useful it can be flushes to release the used data. Should be overridden.

Overrides:
flush in class Action

isRegisterable

public boolean isRegisterable()
Description copied from class: Action
Specifies if the action must be saved in the action register. For instance, some actions, such as a scroll of the scroll bars, should not be saved nor put in the undo/redo manager. Thus, they must not be registrable.

Specified by:
isRegisterable in class Action
Returns:
True: the action is registrable.

canDo

public boolean canDo()
Specified by:
canDo in class Action
Returns:
True if the action can be executed.

hadEffect

public boolean hadEffect()
Overrides:
hadEffect in class Action
Returns:
True if the execution of the action had effects on the target. By default this function return the result of isDone. Should be overridden.

setFile

public void setFile(java.io.File file)
Parameters:
file - the file to set.
Since:
0.2

getFile

public java.io.File getFile()
Returns:
The targeted file.
Since:
0.2

setProgressBar

public void setProgressBar(MProgressBar progressBar)
Parameters:
progressBar - The progress bar used to show the progress of the saving.
Since:
0.2

setUi

public void setUi(UI ui)
Parameters:
ui - the ui to set.
Since:
0.2

setOpenSaveManager

public void setOpenSaveManager(ISOpenSaver openSaveManager)
Parameters:
openSaveManager - the openSaveManager to set.
Since:
0.2

setStatusWidget

public void setStatusWidget(java.lang.Object statusWidget)
Parameters:
statusWidget - the widget that will be used to display I/O messages.
Since:
0.2