de.unikiel.ipn.htmlform
Class Entry

java.lang.Object
  |
  +--de.unikiel.ipn.htmlform.Entry

class Entry
extends java.lang.Object

An Entry.
Example:
You have a html-file containing

 <html>
  <head>
   <title>
    Protocol
   </title>
  </head>
  <body>
   <!-- next log entry here -->
  </body>
 </html>
 

Now you want to insert logs into the body right before the comment. An Entry Object contains all information that is needed to place the new text in the correct position, including the text itself. The whole project file is mostly about how to create the Entry Objects. See project file documentation.


Constructor Summary
(package private) Entry(java.lang.String file)
          Creates a new Entry.
(package private) Entry(java.lang.String prefix, java.lang.String content, java.lang.String postfix, java.lang.String file, java.lang.String mark, java.lang.String alignment, java.lang.String append, java.lang.String isRegex, java.lang.String label)
          Creates a new Entry.
 
Method Summary
(package private)  void accept(TextVisitor v)
          Calls v.visit(this) on the argument.
(package private)  void changeContent(java.lang.String s)
          Replaces the content of this Entry.
(package private)  java.lang.String getAppend()
           
(package private)  java.lang.String getContent()
           
(package private)  javax.swing.text.Document getDocument()
          Returns the content of this Entry as a javax.swing.text.Document.
(package private)  java.io.File getFile()
           
(package private)  java.lang.String getLabel()
           
(package private)  int getLeftAlignment()
           
(package private)  java.lang.String getMark()
           
(package private)  java.lang.String getPostfix()
           
(package private)  java.lang.String getPrefix()
           
(package private)  int getRightAlignment()
           
(package private)  boolean isRegex()
           
(package private)  void setContent(java.lang.String s)
          Replaces the content of this Entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entry

Entry(java.lang.String file)
throws java.io.FileNotFoundException
Creates a new Entry.

Parameters:
file - name of the file to which the changed shall apply. new java.io.File(file).exists() must return true.
Throws:
java.io.FileNotFoundException - if file is not the name of an existing file
java.lang.NullPointerException - if file is null

Entry

Entry(java.lang.String prefix,
      java.lang.String content,
      java.lang.String postfix,
      java.lang.String file,
      java.lang.String mark,
      java.lang.String alignment,
      java.lang.String append,
      java.lang.String isRegex,
      java.lang.String label)
throws java.io.FileNotFoundException
Creates a new Entry.

Parameters:
prefix - first part of the text that is inserted. It can not be changed. May be null.
content - middle part of the text to be inserted. It can be changed in several ways (getDocument(), setContent(String), changeContent(String)). May be null.
postfix - third part of the text to be inserted. It can not be changed. May be null.
file - name of the file to which the changed shall apply. new java.io.File(file).exists() must return true.
mark - a string in the file that marks the position where the prefix, content and postfix shall be inserted.
alignment - the alignment for the content in the format leftAlignment,rightAlignment. The text of the content will have leftAlignment spaces in the beginning of each line and will break at the first space after rightAlignment. May be null for an unaligned String.
append - "-1" or null to insert the new text before the mark, "0" to replace the mark with the new text, "1" to insert the new text after the mark.
isRegex - "0" or null if mark is not a regular expression, "1" if mark is a regular expression.
label - a label with no important meaning. Used to label the EntryPanel.
Throws:
java.io.FileNotFoundException - if file is not the name of an existing file
java.lang.NullPointerException - if file is null
java.lang.NumberFormatException - if alignment string has a bad format
Method Detail

accept

void accept(TextVisitor v)
Calls v.visit(this) on the argument. If the TextVisitor has already visited this Entry, then it is rejected unless the text has been changed in the meantime by setContent(String).

Parameters:
v - the TextVisitor that shall visit this Entry.
See Also:
setContent(String), changeContent(String)

setContent

void setContent(java.lang.String s)
Replaces the content of this Entry. All TextVisitors that have visited this Entry before can visit it again after this method has been called.

See Also:
changeContent(String), accept(TextVisitor)

changeContent

final void changeContent(java.lang.String s)
Replaces the content of this Entry. All TextVisitors that have visited this Entry before are still blocked (can not visit it again).

See Also:
setContent(String), accept(TextVisitor)

getPrefix

java.lang.String getPrefix()

getPostfix

java.lang.String getPostfix()

getDocument

javax.swing.text.Document getDocument()
Returns the content of this Entry as a javax.swing.text.Document. Changes to the returned Document will also change this Entry's content and vice versa.

Returns:
a javax.swing.text.Document containing this Entry's content
See Also:
EntryPanel

getContent

java.lang.String getContent()

getMark

java.lang.String getMark()

getFile

java.io.File getFile()

getLeftAlignment

int getLeftAlignment()

getRightAlignment

int getRightAlignment()

getAppend

java.lang.String getAppend()

isRegex

boolean isRegex()

getLabel

java.lang.String getLabel()