Package jaxe

Class JaxeDocument

All Implemented Interfaces:
Serializable, Document, StyledDocument

public class JaxeDocument extends DefaultStyledDocument
Classe représentant un document XML
See Also:
  • Field Details

  • Constructor Details

    • JaxeDocument

      public JaxeDocument()
    • JaxeDocument

      public JaxeDocument(String nomFichierCfg)
    • JaxeDocument

      public JaxeDocument(Config newconfig)
    • JaxeDocument

      public JaxeDocument(JaxeTextPane textPane, String nomFichierCfg)
  • Method Details

    • setGestionErreurs

      public void setGestionErreurs(InterfaceGestionErreurs gestionErreurs)
      Définie le gestionnaire d'erreurs pour le document
    • getGestionErreurs

      public InterfaceGestionErreurs getGestionErreurs()
      Renvoit le gestionnaire d'erreurs du document
    • setTextPane

      public void setTextPane(JaxeTextPane textPane)
    • 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

      public boolean lire(URL url)
      Initialise un document lu à partir d'une URL
    • lire

      public boolean lire(URL url, String cheminFichierCfg)
      Initialise un document lu à partir d'une URL, en utilisant un fichier de config donné par nom de fichier
    • lire

      public boolean lire(URL url, URL urlFichierCfg)
      Initialise un document lu à partir d'une URL, en utilisant un fichier de config donné par URL
    • setDOMDoc

      public boolean setDOMDoc(Document ddoc)
      Spécifie le document DOM de ce document Jaxe
    • setDOMDoc

      public boolean setDOMDoc(Document ddoc, String cheminFichierCfg)
      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

      public boolean setDOMDoc(Document ddoc, URL urlFichierCfg)
      Spécifie le document DOM de ce document Jaxe, en utilisant un fichier de config donné par URL
    • setRootElement

      public boolean setRootElement(Element node)
      Sets the RootNode of the Document
      Parameters:
      node - the Node
      Returns:
      boolean successfull ?
    • setRootElement

      public boolean setRootElement(Element node, Element configNode)
      Sets the RootNode of the Document with a Node that is used to search the Config-File
      Parameters:
      node - the Node
      configNode - the Node wich will be used as Config-File
      Returns:
      boolean successfull ?
    • getRootElement

      public Node getRootElement()
    • chercherConfig

      protected String chercherConfig(Element rootel)
    • virerEspaces

      public void virerEspaces(Element el)
    • sendToWriter

      public void sendToWriter(Writer destination)
    • sendToWriter

      public void sendToWriter(Writer destination, boolean indenter)
    • getReader

      public Reader getReader() throws IOException
      Throws:
      IOException
    • getReader

      public Reader getReader(boolean indenter) throws IOException
      Throws:
      IOException
    • ecrire

      public void ecrire(File f) throws IOException
      Throws:
      IOException
    • ajouterIndentations

      public void ajouterIndentations(Document doc, int nbEspaces)
      Ajoute des indentations au document passé en paramètre, avec le nombre d'espaces indiqué pour chaque indentation.
    • getPathAsString

      public String getPathAsString(int p)
    • mettreAJourDOM

      public void mettreAJourDOM()
    • elementA

      public JaxeElement elementA(int pos)
    • elementsDans

      public ArrayList<JaxeElement> elementsDans(int dpos, int fpos)
      Renvoit les éléments se trouvant dans la zone du texte indiquée (de dpos à fpos inclu)
    • copier

      public DocumentFragment copier(int debut, int fin)
    • removeProcessingInstructions

      @Deprecated protected Node removeProcessingInstructions(Node n)
      Deprecated.
    • testerInsertionFragment

      public 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. Si elle n'est pas autorisée, affiche un message d'erreur et renvoit false. Sinon renvoit true.
    • coller

      public boolean coller(Object pp, Position pos)
      pour coller du XML
    • coller

      public boolean coller(DocumentFragment frag, Position pos, boolean event)
      Colle un fragment XML dans le document à la position pos
      Parameters:
      frag -
      pos -
    • coller

      @Deprecated public void coller(JTextComponent target)
      Deprecated.
    • pp2string

      @Deprecated public String pp2string(Object pp)
      Deprecated.
    • DOMVersXML

      public static String DOMVersXML(Node xmldoc)
    • removeText

      protected void removeText(int offs, int len, boolean event) throws BadLocationException
      Throws:
      BadLocationException
    • remove

      public void remove(int offs, int len) throws BadLocationException
      Specified by:
      remove in interface Document
      Overrides:
      remove in class AbstractDocument
      Throws:
      BadLocationException
    • remove

      public void remove(int offs, int len, boolean event) throws BadLocationException
      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

      public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
      Specified by:
      insertString in interface Document
      Overrides:
      insertString in class AbstractDocument
      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

      public JaxeDocument.SwingElementSpec prepareSpec(String baliseSpec)
    • prepareSpec

      public JaxeDocument.SwingElementSpec prepareSpec(String baliseSpec, SimpleAttributeSet att)
    • prepareSpec

      public JaxeDocument.SwingElementSpec prepareSpec(String baliseSpec, int offset, String texte)
    • sousSpec

      public void sousSpec(JaxeDocument.SwingElementSpec parentspec, JaxeDocument.SwingElementSpec enfantspec)
    • insereSpec

      public Element insereSpec(JaxeDocument.SwingElementSpec jspec, int offset)
    • elementTexteA

      public Element elementTexteA(String nom, int offset)
    • createEditorKit

      public EditorKit createEditorKit()
    • styleChanged

      public void styleChanged()
    • imageChanged

      public void imageChanged(JComponent comp)
    • getElementForNode

      public JaxeElement getElementForNode(Node node)
      Returns the JaxeElement that represents the Node
      Parameters:
      node - get the JaxeElement for this Node
      Returns:
      The representation for the given Node
    • addEditListener

      public void addEditListener(JaxeEditListenerIf edit)
      Adds a listener for editevents
      Parameters:
      edit - Listener to add
    • removeEditListener

      public void removeEditListener(JaxeEditListenerIf edit)
      Removes a listener for editevents
      Parameters:
      edit - Listener to remove
    • fireTextRemovedEvent

      public void fireTextRemovedEvent(JaxeEditEvent event)
      Fires an event for removing text to all listeners
      Parameters:
      event - Event to send
    • fireElementRemovedEvent

      public void fireElementRemovedEvent(JaxeEditEvent event)
      Fires an event for removing JaxeElements to all listeners
      Parameters:
      event - Event to send
    • fireTextAddedEvent

      public void fireTextAddedEvent(JaxeEditEvent event)
      Fires an event for adding text to all listeners
      Parameters:
      event - Event to send
    • fireElementAddedEvent

      public Position fireElementAddedEvent(JaxeEditEvent event, Position pos)
      Fires an event for adding JaxeElements to all listeners an returns a possible new insert position
      Parameters:
      event - Event to send
      pos - Position element will be added
      Returns:
      New position of insert
    • firePrepareElementAddEvent

      public Position firePrepareElementAddEvent(Position pos)
      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