Package jaxe
Class JaxeDocument
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.DefaultStyledDocument
jaxe.JaxeDocument
- All Implemented Interfaces:
Serializable
,Document
,StyledDocument
Classe représentant un document XML
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.text.DefaultStyledDocument
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec, DefaultStyledDocument.SectionElement
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
-
Constructor Summary
ConstructorsConstructorDescriptionJaxeDocument
(String nomFichierCfg) JaxeDocument
(Config newconfig) JaxeDocument
(JaxeTextPane textPane, String nomFichierCfg) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener for editeventsvoid
ajouterIndentations
(Document doc, int nbEspaces) Ajoute des indentations au document passé en paramètre, avec le nombre d'espaces indiqué pour chaque indentation.protected String
chercherConfig
(Element rootel) boolean
pour coller du XMLvoid
coller
(JTextComponent target) Deprecated.boolean
coller
(DocumentFragment frag, Position pos, boolean event) Colle un fragment XML dans le document à la position poscopier
(int debut, int fin) static String
DOMVersXML
(Node xmldoc) void
elementA
(int pos) elementsDans
(int dpos, int fpos) Renvoit les éléments se trouvant dans la zone du texte indiquée (de dpos à fpos inclu)elementTexteA
(String nom, int offset) void
Ignorer l'interdiction d'effacer des éléments.fireElementAddedEvent
(JaxeEditEvent event, Position pos) Fires an event for adding JaxeElements to all listeners an returns a possible new insert positionvoid
Fires an event for removing JaxeElements to all listenersFires an event to prepare the position a JaxeElement will be added and returns a possible new instert positionvoid
fireTextAddedEvent
(JaxeEditEvent event) Fires an event for adding text to all listenersvoid
Fires an event for removing text to all listenersgetElementForNode
(Node node) Returns the JaxeElement that represents the NodeRenvoit le gestionnaire d'erreurs du documentboolean
getModif()
Indique si le document a été modifié depuis la dernière sauvegarde ou pas.getPathAsString
(int p) getReader
(boolean indenter) void
imageChanged
(JComponent comp) insereSpec
(JaxeDocument.SwingElementSpec jspec, int offset) void
insertString
(int offset, String str, AttributeSet a) void
insertString
(int offset, String str, AttributeSet a, boolean event) boolean
Initialise un document lu à partir d'une URLboolean
Initialise un document lu à partir d'une URL, en utilisant un fichier de config donné par nom de fichierboolean
Initialise un document lu à partir d'une URL, en utilisant un fichier de config donné par URLprotected void
majIndentAjout
(int offset) Mise à jour des indentations après un ajout de \n (appelé par JaxeUndoableEdit)protected void
majIndentSupp
(int offset) Mise à jour des indentations après une suppression de \n (appelé par JaxeUndoableEdit)void
void
nouveau()
Initialise un document videDeprecated.prepareSpec
(String baliseSpec) prepareSpec
(String baliseSpec, int offset, String texte) prepareSpec
(String baliseSpec, SimpleAttributeSet att) void
remove
(int offs, int len) void
remove
(int offs, int len, boolean event) void
remove2
(int offs, int len, boolean event) void
Removes a listener for editeventsprotected Node
Deprecated.protected void
removeText
(int offs, int len, boolean event) void
sendToWriter
(Writer destination) void
sendToWriter
(Writer destination, boolean indenter) boolean
Spécifie le document DOM de ce document Jaxeboolean
Spécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par nom de fichier.boolean
Spécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par URLvoid
setGestionErreurs
(InterfaceGestionErreurs gestionErreurs) Définie le gestionnaire d'erreurs pour le documentvoid
setModif
(boolean modif) Spécifie si le document a été modifié depuis la dernière sauvegarde ou pas.boolean
setRootElement
(Element node) Sets the RootNode of the Documentboolean
setRootElement
(Element node, Element configNode) Sets the RootNode of the Document with a Node that is used to search the Config-Filevoid
setTextPane
(JaxeTextPane textPane) void
sousSpec
(JaxeDocument.SwingElementSpec parentspec, JaxeDocument.SwingElementSpec enfantspec) void
boolean
testerInsertionFragment
(DocumentFragment frag, JaxeElement parent, Position pos) Teste si l'insertion d'un fragment est autorisée sous un certain élément parent à la position pos.void
virerEspaces
(Element el) Methods inherited from class javax.swing.text.DefaultStyledDocument
addDocumentListener, addStyle, create, createDefaultRoot, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, insert, insertUpdate, removeDocumentListener, removeElement, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, setParagraphAttributes, styleChanged
Methods inherited from class javax.swing.text.AbstractDocument
addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.swing.text.Document
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, putProperty, removeUndoableEditListener, render
-
Field Details
-
DOMdoc
-
dom2JaxeElement
-
rootJE
-
textPane
-
fsave
-
furl
-
encodage
-
modif
public boolean modif -
cfg
-
jframe
-
nomFichierCfg
-
-
Constructor Details
-
JaxeDocument
public JaxeDocument() -
JaxeDocument
-
JaxeDocument
-
JaxeDocument
-
-
Method Details
-
setGestionErreurs
Définie le gestionnaire d'erreurs pour le document -
getGestionErreurs
Renvoit le gestionnaire d'erreurs du document -
setTextPane
-
getModif
public boolean getModif()Indique si le document a été modifié depuis la dernière sauvegarde ou pas. -
setModif
public void setModif(boolean modif) Spécifie si le document a été modifié depuis la dernière sauvegarde ou pas. -
nouveau
public void nouveau()Initialise un document vide -
lire
Initialise un document lu à partir d'une URL -
lire
Initialise un document lu à partir d'une URL, en utilisant un fichier de config donné par nom de fichier -
lire
Initialise un document lu à partir d'une URL, en utilisant un fichier de config donné par URL -
setDOMDoc
Spécifie le document DOM de ce document Jaxe -
setDOMDoc
Spécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par nom de fichier. Si cheminFichierCfg est null, une config est cherchée en fonction de la racine du document. -
setDOMDoc
Spécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par URL -
setRootElement
Sets the RootNode of the Document- Parameters:
node
- the Node- Returns:
- boolean successfull ?
-
setRootElement
Sets the RootNode of the Document with a Node that is used to search the Config-File- Parameters:
node
- the NodeconfigNode
- the Node wich will be used as Config-File- Returns:
- boolean successfull ?
-
getRootElement
-
chercherConfig
-
virerEspaces
-
sendToWriter
-
sendToWriter
-
getReader
- Throws:
IOException
-
getReader
- Throws:
IOException
-
ecrire
- Throws:
IOException
-
ajouterIndentations
Ajoute des indentations au document passé en paramètre, avec le nombre d'espaces indiqué pour chaque indentation. -
getPathAsString
-
mettreAJourDOM
public void mettreAJourDOM() -
elementA
-
elementsDans
Renvoit les éléments se trouvant dans la zone du texte indiquée (de dpos à fpos inclu) -
copier
-
removeProcessingInstructions
Deprecated. -
testerInsertionFragment
Teste si l'insertion d'un fragment est autorisée sous un certain élément parent à la position pos. Si elle n'est pas autorisée, affiche un message d'erreur et renvoit false. Sinon renvoit true. -
coller
pour coller du XML -
coller
Colle un fragment XML dans le document à la position pos- Parameters:
pos
-frag
-
-
coller
Deprecated. -
pp2string
Deprecated. -
DOMVersXML
-
removeText
- Throws:
BadLocationException
-
remove
- Specified by:
remove
in interfaceDocument
- Overrides:
remove
in classAbstractDocument
- Throws:
BadLocationException
-
remove
- Parameters:
offs
-len
-event
-- Throws:
BadLocationException
-
remove2
public void remove2(int offs, int len, boolean event) -
enableIgnore
public void enableIgnore()Ignorer l'interdiction d'effacer des éléments. Utilisé par ActionInsertionBalise quand l'utilisateur annule une insertion. -
insertString
- Specified by:
insertString
in interfaceDocument
- Overrides:
insertString
in classAbstractDocument
- Throws:
BadLocationException
-
insertString
public void insertString(int offset, String str, AttributeSet a, boolean event) throws BadLocationException - Throws:
BadLocationException
-
majIndentSupp
protected void majIndentSupp(int offset) Mise à jour des indentations après une suppression de \n (appelé par JaxeUndoableEdit) -
majIndentAjout
protected void majIndentAjout(int offset) Mise à jour des indentations après un ajout de \n (appelé par JaxeUndoableEdit) -
prepareSpec
-
prepareSpec
-
prepareSpec
-
sousSpec
public void sousSpec(JaxeDocument.SwingElementSpec parentspec, JaxeDocument.SwingElementSpec enfantspec) -
insereSpec
-
elementTexteA
-
createEditorKit
-
styleChanged
public void styleChanged() -
imageChanged
-
getElementForNode
Returns the JaxeElement that represents the Node- Parameters:
node
- get the JaxeElement for this Node- Returns:
- The representation for the given Node
-
addEditListener
Adds a listener for editevents- Parameters:
edit
- Listener to add
-
removeEditListener
Removes a listener for editevents- Parameters:
edit
- Listener to remove
-
fireTextRemovedEvent
Fires an event for removing text to all listeners- Parameters:
event
- Event to send
-
fireElementRemovedEvent
Fires an event for removing JaxeElements to all listeners- Parameters:
event
- Event to send
-
fireTextAddedEvent
Fires an event for adding text to all listeners- Parameters:
event
- Event to send
-
fireElementAddedEvent
Fires an event for adding JaxeElements to all listeners an returns a possible new insert position- Parameters:
event
- Event to sendpos
- Position element will be added- Returns:
- New position of insert
-
firePrepareElementAddEvent
Fires an event to prepare the position a JaxeElement will be added and returns a possible new instert position- Parameters:
pos
- Position to prepare- Returns:
- New position of insert
-