com.ibm.productivity.tools.ui.views.operations
Interface LoadOperation

All Superinterfaces:
Operation

public interface LoadOperation
extends Operation

Defines the operation to load a document into the view. When a document is ready to be loaded into a RichDocumentView, the view closes the current document first.

If a file name that is not valid is provided, UnsupportedOperationException is thrown when starting the operation on a RichDocumentView.

The following code demonstrates how to load a document:

  public class WriterView extends DefaultRichDocumentView {

         public WriterView() {
                super();
         }

         public void createPartControl(Composite parent) {
                super.createPartControl(parent);
                loadDocument();
         }
         private void loadDocument() {
                LoadOperation operation = OperationFactory.createLoadOperation("c:\\text.odt", false);
                this.executeOperation( operation );
         }
 }
 

Since:
8.0.1

Method Summary
 boolean getAsTemplate()
          Gets whether the document is loaded as a template.
 java.lang.String getFileName()
          Gets the absolute path for the file to be loaded.
 java.lang.Object getUNOModel()
          Returns the com.sun.star.frame.XModel object when the operation is started.
 void setAsTemplate(boolean asTemplate)
          Sets whether the document is loaded as a template.
 void setFileName(java.lang.String fileName)
          Sets the absolute path for the file to be loaded.
 

Method Detail

getFileName

java.lang.String getFileName()
Gets the absolute path for the file to be loaded. For example, c:\\test.odt on Windows® operating systems, and /home/test.odt on Linux® operating systems.


Returns:
an absolute file path

setFileName

void setFileName(java.lang.String fileName)
Sets the absolute path for the file to be loaded. For example, c:\\test.odt on Windows® operating systems, and /home/test.odt on Linux® operating systems.


The user can set the value before the operation is started.


Parameters:
fileName - the absolute path for the file to be loaded

getAsTemplate

boolean getAsTemplate()
Gets whether the document is loaded as a template. If the flag is set to true, then a new document is created based on the template. If the flag is set to false, then the document is opened directly. The default value is false.

Returns:
true when the document should be loaded as a template, false otherwise

setAsTemplate

void setAsTemplate(boolean asTemplate)
Sets whether the document is loaded as a template. If the flag is set to true, then a new document is created based on the template. If the flag is set to false, then the document is opened directly. The default value is false.


The user can set the flag before the operation is started.


Parameters:
asTemplate - true when the document should be loaded as a template, false otherwise

getUNOModel

java.lang.Object getUNOModel()
Returns the com.sun.star.frame.XModel object when the operation is started. The object is available after the operation is started successfully. It is used to access the UNO APIs provided by the UNO service.

Returns:
a com.sun.star.frame.XModel object for the loaded document