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.SectionElementNested 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 TypeFieldDescriptionbooleanFields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULTFields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementNameFields 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 TypeMethodDescriptionvoidAdds a listener for editeventsvoidajouterIndentations(Document doc, int nbEspaces) Ajoute des indentations au document passé en paramètre, avec le nombre d'espaces indiqué pour chaque indentation.protected StringchercherConfig(Element rootel) booleanpour coller du XMLvoidcoller(JTextComponent target) Deprecated.booleancoller(DocumentFragment frag, Position pos, boolean event) Colle un fragment XML dans le document à la position poscopier(int debut, int fin) static StringDOMVersXML(Node xmldoc) voidelementA(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) voidIgnorer 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 positionvoidFires 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 positionvoidfireTextAddedEvent(JaxeEditEvent event) Fires an event for adding text to all listenersvoidFires an event for removing text to all listenersgetElementForNode(Node node) Returns the JaxeElement that represents the NodeRenvoit le gestionnaire d'erreurs du documentbooleangetModif()Indique si le document a été modifié depuis la dernière sauvegarde ou pas.getPathAsString(int p) getReader(boolean indenter) voidimageChanged(JComponent comp) insereSpec(JaxeDocument.SwingElementSpec jspec, int offset) voidinsertString(int offset, String str, AttributeSet a) voidinsertString(int offset, String str, AttributeSet a, boolean event) booleanInitialise un document lu à partir d'une URLbooleanInitialise un document lu à partir d'une URL, en utilisant un fichier de config donné par nom de fichierbooleanInitialise un document lu à partir d'une URL, en utilisant un fichier de config donné par URLprotected voidmajIndentAjout(int offset) Mise à jour des indentations après un ajout de \n (appelé par JaxeUndoableEdit)protected voidmajIndentSupp(int offset) Mise à jour des indentations après une suppression de \n (appelé par JaxeUndoableEdit)voidvoidnouveau()Initialise un document videDeprecated.prepareSpec(String baliseSpec) prepareSpec(String baliseSpec, int offset, String texte) prepareSpec(String baliseSpec, SimpleAttributeSet att) voidremove(int offs, int len) voidremove(int offs, int len, boolean event) voidremove2(int offs, int len, boolean event) voidRemoves a listener for editeventsprotected NodeDeprecated.protected voidremoveText(int offs, int len, boolean event) voidsendToWriter(Writer destination) voidsendToWriter(Writer destination, boolean indenter) booleanSpécifie le document DOM de ce document JaxebooleanSpécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par nom de fichier.booleanSpécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par URLvoidsetGestionErreurs(InterfaceGestionErreurs gestionErreurs) Définie le gestionnaire d'erreurs pour le documentvoidsetModif(boolean modif) Spécifie si le document a été modifié depuis la dernière sauvegarde ou pas.booleansetRootElement(Element node) Sets the RootNode of the DocumentbooleansetRootElement(Element node, Element configNode) Sets the RootNode of the Document with a Node that is used to search the Config-FilevoidsetTextPane(JaxeTextPane textPane) voidsousSpec(JaxeDocument.SwingElementSpec parentspec, JaxeDocument.SwingElementSpec enfantspec) voidbooleantesterInsertionFragment(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.voidvirerEspaces(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, styleChangedMethods 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, writeUnlockMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
removein interfaceDocument- Overrides:
removein 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:
insertStringin interfaceDocument- Overrides:
insertStringin 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
-