|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.malai.instrument.Instrument
org.malai.instrument.WidgetInstrument
net.sf.latexdraw.instruments.FileLoaderSaver
public class FileLoaderSaver
This instrument saves and loads documents.
This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw 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 (at your option) any later version.
LaTeXDraw 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.
06/01/2010
Field Summary | |
---|---|
protected java.io.File |
currentFile
The current file loaded or saved. |
protected javax.swing.JFileChooser |
fileChooser
The fileChooser used to save drawings. |
static java.lang.String |
LABEL_OPEN
The label of the openMenu item |
static java.lang.String |
LABEL_SAVE
The label of the saveMenu item |
static java.lang.String |
LABEL_SAVE_AS
The label of the saveAsMenu item |
protected MButton |
loadButton
The button used to load documents. |
protected MMenuItem |
loadMenu
The menu used to load documents. |
protected MButton |
newButton
The button used to create a new document. |
protected MMenuItem |
newMenu
The menu used to create a new document. |
protected java.lang.String |
pathSave
The path where documents are saved. |
protected PreferencesSetter |
prefSetter
The instrument used to manage preferences. |
protected MProgressBar |
progressBar
The progress bar used to show the progress of loading and saving operations. |
protected MMenu |
recentFilesMenu
The menu that contains the menu item corresponding to the recent documents. |
protected MMenuItem |
saveAsMenu
The menu item used to save as a document. |
protected MButton |
saveButton
The button used to save documents. |
protected MMenuItem |
saveMenu
The menu used to save documents. |
protected javax.swing.JLabel |
statusBar
The field where messages are displayed. |
protected UI |
ui
The UI to save/open. |
Fields inherited from class org.malai.instrument.WidgetInstrument |
---|
composer |
Fields inherited from class org.malai.instrument.Instrument |
---|
activated, eventables, links, modified |
Constructor Summary | |
---|---|
FileLoaderSaver(UI ui,
javax.swing.JLabel statusBar,
PreferencesSetter prefSetter)
Creates the file loader/saver. |
Method Summary | |
---|---|
java.io.File |
getCurrentFile()
|
javax.swing.JFileChooser |
getDialog(boolean save)
|
MButton |
getLoadButton()
|
MMenuItem |
getLoadMenu()
|
MButton |
getNewButton()
|
MMenuItem |
getNewMenu()
|
java.lang.String |
getPathSave()
|
MProgressBar |
getProgressBar()
|
MMenu |
getRecentFilesMenu()
|
MMenuItem |
getSaveAsMenu()
|
MButton |
getSaveButton()
|
MMenuItem |
getSaveMenu()
|
protected void |
initialiseLinks()
Initialises the links of the instrument. |
protected void |
initialiseWidgets()
Initialises the widgets of the instrument. |
void |
onActionDone(Action action)
Notifies the handler when the given action is done. |
void |
onActionExecuted(Action action)
Notifies the handler when the given action is executed. |
void |
reinit()
Reinitialises the object. |
void |
save(boolean generalPreferences,
java.lang.String nsURI,
org.w3c.dom.Document document,
org.w3c.dom.Element root)
Saves the parameters of the instrument into an XML tag. |
void |
setActivated(boolean activated)
Activates or deactivates the instrument. |
void |
setActivated(boolean activated,
boolean hide)
Activates or deactivates the instrument. |
void |
setCurrentFile(java.io.File currentFile)
Sets the current file loaded or saved. |
void |
setPathSave(java.lang.String pathSave)
Sets the path where documents are saved. |
void |
updateRecentMenuItems(java.util.List<java.lang.String> recentDocs)
Updates the recent menu items. |
Methods inherited from class org.malai.instrument.WidgetInstrument |
---|
getComposer |
Methods inherited from class org.malai.instrument.Instrument |
---|
addEventable, addLink, clearEvents, getLinks, getSizeLinks, hasLinks, interimFeedback, isActivated, isModified, load, onActionAborted, onActionAdded, onActionCancelled, onUndoableAdded, onUndoableRedo, onUndoableUndo, removeLink, setModified |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LABEL_SAVE
public static final java.lang.String LABEL_SAVE_AS
public static final java.lang.String LABEL_OPEN
protected java.lang.String pathSave
protected java.io.File currentFile
protected MButton saveButton
protected MButton loadButton
protected MButton newButton
protected MMenuItem saveAsMenu
protected MMenuItem saveMenu
protected MMenuItem loadMenu
protected MMenuItem newMenu
protected MMenu recentFilesMenu
protected javax.swing.JFileChooser fileChooser
protected UI ui
protected javax.swing.JLabel statusBar
protected PreferencesSetter prefSetter
protected MProgressBar progressBar
Constructor Detail |
---|
public FileLoaderSaver(UI ui, javax.swing.JLabel statusBar, PreferencesSetter prefSetter)
ui
- The user interface that contains the presentations and the instruments to save/load.statusBar
- The status bar where messages are displayed.prefSetter
- The instrument used to manage preferences.
java.lang.IllegalArgumentException
- If one of the given parameters is null.
java.lang.NullPointerException
- If the given UI is null.Method Detail |
---|
public void reinit()
Reinitialisable
reinit
in interface Reinitialisable
reinit
in class Instrument
public void onActionDone(Action action)
ActionHandler
onActionDone
in interface ActionHandler
onActionDone
in class Instrument
action
- The action that ends.public void setActivated(boolean activated, boolean hide)
WidgetInstrument
Instrument.setActivated(boolean)
but
the difference is that is this opedeactivateration another parameter can be used to define is the widgets of the
instrument must be hidden: in some cases, deactivating the instrument just implies disabling its widgets
(but they are still visible); in some others cases, deactivating the instrument means hiding the widgets.
Should be overridden to define the process of hiding the widgets.
setActivated
in class WidgetInstrument
activated
- True = activation.hide
- If true the widgets will be hidden. Only while deactivating the instrument.public void setActivated(boolean activated)
Instrument
setActivated
in class Instrument
activated
- True = activation.protected void initialiseWidgets()
WidgetInstrument
initialiseWidgets
in class WidgetInstrument
protected void initialiseLinks()
Instrument
initialiseLinks
in class Instrument
public java.lang.String getPathSave()
public void setPathSave(java.lang.String pathSave)
pathSave
- The path where documents are saved.public java.io.File getCurrentFile()
public void setCurrentFile(java.io.File currentFile)
currentFile
- The current file loaded or saved.public MButton getSaveButton()
public MButton getLoadButton()
public MMenu getRecentFilesMenu()
public MProgressBar getProgressBar()
public void updateRecentMenuItems(java.util.List<java.lang.String> recentDocs)
recentDocs
- The list of recent documents.public javax.swing.JFileChooser getDialog(boolean save)
save
- True: the dialogue box will be configured for saving prupose. Otherwose, for opening purpose.
public void save(boolean generalPreferences, java.lang.String nsURI, org.w3c.dom.Document document, org.w3c.dom.Element root)
Preferenciable
save
in interface Preferenciable
save
in class Instrument
generalPreferences
- True: this operation is called to save the general preferences of the interactive system.
Otherwise, it is called to save a presentation in a document. This parameter is useful when different information
must be saved during a presentation backup or a general preferences backup.nsURI
- The namespace that must be added to tags corresponding to the instrument's parameters.document
- The XML document.root
- The root element that will contains the instrument's parameters.public void onActionExecuted(Action action)
ActionHandler
onActionExecuted
in interface ActionHandler
onActionExecuted
in class Instrument
action
- The executed action.public MMenuItem getSaveAsMenu()
public MMenuItem getSaveMenu()
public MMenuItem getLoadMenu()
public MButton getNewButton()
public MMenuItem getNewMenu()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |