Comment


Acts as the token type for HTML comments.

Class of

netscape.plugin.composer.io package

Superclass

java.lang.Object

Description

In the Composer Plug-in API, HTML comments have this form:

'<!' + commentText + '>'

This table summarizes Comment class methods:

Constructor Description
Comment(String) Creates an instance of the Comment class from a string
Comment(StringBuffer) Creates an instance of the Comment class from a string buffer
Methods Description
createSelectionEnd() Creates a selection end comment
createSelectionEnd(
boolean)
Creates a selection end comment
createSelectionStart() Creates a selection start comment
createSelectionStart(
boolean)
Creates a selection start comment
equals(Object) Performs equality test
getText() Gets the text of the comment
hashCode() Computes the hash code for the comment
isSelection() Checks whether this comment is a selection comment
isSelectionEnd() Checks whether this comment is a selection end comment
isSelectionStart() Checks whether this comment is a selection start comment
isSelectionStickyAfter() Checks whether this comment is a sticky-after selection comment
toString() Returns the full HTML representation of the comment, including the opening "<!" and closing ">"


See Also

Entity, JavaScriptEntity, LexicalStream, SelectedHTMLReader, Tag, Text, Token, Reader

[Top] [IO Package Classes] [Composer Plug-in API Reference


Constructors


Comment

Creates an instance of the Comment class from a string buffer.

Method of

Comment class

Syntax

public Comment(StringBuffer buf)

Parameters

buf
Text of the comment. Does not include the '!' at the start of the comment.

Description

The buf parameter represents text that can be changed during processing.

[Top] [IO Package Classes] [Composer Plug-in API Reference


Comment

Creates an instance of the Comment class from a string.

Method of

Comment class

Syntax

public Comment(String text)

Parameters

text
The text of the comment. Does not include the '!' at the start of the comment.

Description

The text parameter represents static text that does not change during processing.

[Top] [IO Package Classes] [Composer Plug-in API Reference


Methods


createSelectionEnd

Creates a selection end comment.

Method of

Comment class

Syntax

public static Comment createSelectionEnd()

Description

This function places the end comment after the last piece of text you to select. It is equivalent to:

Returns

Canonical selection end comment.

[Top] [IO Package Classes] [Composer Plug-in API Reference


createSelectionEnd

Creates a selection end comment.

Method of

Comment class

Syntax

public static Comment createSelectionEnd(boolean stickyAfter);

Parameters

stickyAfter
Whether the selection end sticks to the next token.
  • true: The selection end sticks; the cursor should be at the start of the second line.
  • false: The selection end does not stick; the cursor should be at the end of the first line.

Description

This function places the end comment before the first piece of text you to select. It is equivalent to:

For more information, see isSelectionStickyAfter.

Returns

Selection end comment.

[Top] [IO Package Classes] [Composer Plug-in API Reference


createSelectionStart

Creates a selection start comment.

Method of

Comment class

Syntax

public static Comment createSelectionStart()

Description

This function inserts a selection start comment before the first piece of text to select. It is equivalent to:

Returns

Canonical selection start comment.

[Top] [IO Package Classes] [Composer Plug-in API Reference


createSelectionStart

Creates a selection start comment.

Method of

Comment class

Syntax

public static Comment createSelectionStart(boolean stickyAfter)

Parameters

stickyAfter
Whether the selection start sticks to the next token.
  • true: The selection end sticks; the cursor should be at the start of the second line.
  • false: The selection end does not stick; the cursor should be at the end of the first line.

Description

For more information, see isSelectionStickyAfter.

Returns

Selection start comment.

[Top] [IO Package Classes] [Composer Plug-in API Reference


equals

Performs an equality test.

Method of

Comment class

Syntax

public boolean equals(Object other)

Parameters

other
The text to compare with this text for equality

Returns

Overrides

This function overrides the equals function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


getText

Copies the comment to the document.

Method of

Comment class

Syntax

public String getText()

Description

This function copies the comment to the document. The returned text does not include the '!' at the start of the comment.

[Top] [IO Package Classes] [Composer Plug-in API Reference


hashCode

Computes the hash code for the comment.

Method of

Comment class

Syntax

public int hashCode()

Returns

The hash code of the comment. For more information, see JavaScriptEntity.hashCode.

Overrides

This function overrides the hashCode function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


isSelection

Checks whether this comment is a selection comment.

Method of

Comment class

Syntax

public boolean isSelection()

Returns

[Top] [IO Package Classes] [Composer Plug-in API Reference


isSelectionEnd

Checks whether this comment is a selection end comment.

Method of

Comment class

Syntax

public boolean isSelectionEnd()

Returns

[Top] [IO Package Classes] [Composer Plug-in API Reference


isSelectionStart

Checks whether this comment is a selection start comment.

Method of

Comment class

Syntax

public boolean isSelectionStart()

Returns

[Top] [IO Package Classes] [Composer Plug-in API Reference


isSelectionStickyAfter

Checks whether this comment has the sticky-after property.

Method of

Comment class

Syntax

public boolean isSelectionStickyAfter()

Description

The stickyAfter property is used in undo operations to make sure that the document returns to its exact previous state after an undo. You almost never need to set this value. When included, it tells where the cursor should land in relationship to the line break after an undo when text is broken across two lines.

Returns

[Top] [IO Package Classes] [Composer Plug-in API Reference


toString

Returns the full HTML representation of the comment, including the opening "<!" and the closing ">".

Method of

Comment class

Syntax

public String toString()

Overrides

This function overrides the toString function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


Entity


Represents an entity, a multicharacter combination that starts with '&' and ends with ';'.

Class of

netscape.plugin.composer.io package

Superclass

netscape.plugin.composer.io.Token

Description

Entities serve two purposes:

This table summarizes Entity class methods:

Constructor Description
Entity(String, char) Creates an instance of the Entity class from a string and a value
Entity(StringBuffer) Creates an instance of the Entity class from a string buffer
Method Description
entities() Enumerates the known entities
equals(Object) Performs an equality test
evaluate() Internal function that evaluates the entity
getValue() Gets the value of the entity
hashCode() Gets the hash code representation of the entity
toString() Gets the HTML representation of the entity


See Also

Comment, JavaScriptEntity, Token

[Top] [IO Package Classes] [Composer Plug-in API Reference


Constructors


Entity

Creates an instance of the Entity class from a string and a value.

Method of

Entity class

Syntax

public Entity(String s, char c)

Parameters

s
String from which to create an entity
c Value from which to create an entity

Description

You use this function to build up an internal list of legal entities.

[Top] [IO Package Classes] [Composer Plug-in API Reference


Entity

Creates an instance of the Entity class from a string buffer.

Method of

Entity class

Syntax

public Entity(StringBuffer s)

Parameters

s
String buffer from which to create an entity

Description

Entity instances have a value of -1 while the plug-in is running. The s parameter represents text that can be changed during processing.

[Top] [IO Package Classes] [Composer Plug-in API Reference


Methods


entities

Enumerates the known entities.

Method of

Entity class

Syntax

public static Enumeration entities()

Description

Several entities with the same value may exist.

Returns

An enumeration of the known standard entities.

[Top] [IO Package Classes] [Composer Plug-in API Reference


equals

Performs an equality test.

Method of

Entity class

Syntax

public boolean equals(Object other)

Parameters

other
String to test for equality with this entity

Returns

Overrides

This function overrides the equals function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


evaluate

Evaluates the entity.

Method of

Entity class

Syntax

protected int evaluate()

Description

This internal function actually evaluates the entity. About 57 possible entities exist, for example:

The function returns -1 if the entity is unknown.

Returns

[Top] [IO Package Classes] [Composer Plug-in API Reference


getValue

Gets the value for the entity.

Method of

Entity class

Syntax

public int getValue()

Returns

The unicode value of the entity or -1 if the entity is unknown.

[Top] [IO Package Classes] [Composer Plug-in API Reference


hashCode

Computes the hash code for the entity.

Method of

Entity class

Syntax

public int hashCode()

Returns

The hash code for the entity. For more information, see JavaScriptEntity.hashCode.

Overrides

This function overrides the hashCode function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


toString

Gets the HTML string representation of the entity.

Method of

Entity class

Syntax

public String toString()

Returns

The HTML string representation of the entity.

Overrides

This function overrides the toString function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


JavaScriptEntity


Represents runtime scriptable tag parameters.

Class of

netscape.plugin.composer.io package

Superclass

netscape.plugin.composer.io.Token

Description

A JavaScript entity is an HTML expression of the form:

"&{" javascriptEntity "};"

A JavaScript entity is used to provide runtime evaluation of the value of parameters. The value of the JavaScript entity cannot be known during plug-in design (in the editor).

This table summarizes JavaScriptEntity class methods:

Constructor Description
JavaScriptEntity
(StringBuffer)
Creates an instance of the JavaScriptEntity class
Method Description
equals(Object) Performs an equality test
getScript() Gets the JavaScript associated with the entity
hashCode() Gets the hash code representation of the JavaScript entity
toString() Gets the HTML string representation of the JavaScript entity


See Also

Comment, Entity, LexicalStream, SelectedHTMLReader, Tag, Text, Token

[Top] [IO Package Classes] [Composer Plug-in API Reference


Constructors


JavaScriptEntity

Creates an instance of the JavaScriptEntity class.

Method of

JavaScriptEntity class

Syntax

public JavaScriptEntity(StringBuffer buf)

Parameters

buf
Text of the comment. Does not include the '!' at the start of the comment.

Description

The JavaScriptEntity class represents runtime scriptable tag parameters. The buf parameter represents text that can be changed during processing.

[Top] [IO Package Classes] [Composer Plug-in API Reference


Methods


equals

Performs an equality test

Method of

JavaScriptEntity class

Syntax

public boolean equals(Object other)

Parameters

other
Object to test for equality

Description

Equality means that the expression strings are identical, but does not mean that the result of the expressions is equal. The JavaScriptEntity class includes both the hashCode and equals methods in order to take advantage of Java hashtable functionality. For information about the way that Java uses hashtables, see your Java documentation.

Overrides

This function overrides the equals function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


getScript

Gets the JavaScript associated with the entity.

Method of

JavaScriptEntity class

Syntax

public String getScript()

[Top] [IO Package Classes] [Composer Plug-in API Reference


hashCode

Gets the hash code representation of the JavaScript entity

Method of

JavaScriptEntity class

Syntax

public int hashCode()

Description

This method returns a hash code representation of the JavaScript entity, which can be used in Java hashtables. A hashtable maps the keys of records to hash code values, and is used as a data access device. To take advantage of hashtable functionality, an object must implement both the hashCode and equals methods. For information about the way that Java uses hashtables, see your Java documentation.

Returns

The hash code representation of the JavaScript entity.

Overrides

This function overrides the hashCode function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


toString

Gets the HTML string representation of the JavaScript entity

Method of

JavaScriptEntity class

Syntax

public String toString()

Returns

The HTML string representation of the JavaScript entity.

Overrides

This function overrides the toString function in the Object class.

[Top] [IO Package Classes] [Composer Plug-in API Reference


LexicalStream


Represents an HTML lexical stream.

Class of

netscape.plugin.composer.io package

Superclass

java.lang.Object

Description

This class breaks a Reader object into lexical tokens.

This table summarizes LexicalStream class methods:

Constructor Description
LexicalStream(Reader) Creates an instance of the LexicalStream class from a Reader object
LexicalStream(String) Creates an instance of the LexicalStream from a Unicode string
Method Description
next() Returns the next token in an HTML input stream


See Also

Comment, Entity, JavaScriptEntity, SelectedHTMLReader, Tag, Text, Token, Reader

[Top] [IO Package Classes] [Composer Plug-in API Reference


Constructors


LexicalStream

Creates an instance of the LexicalStream class from a Reader object.

Method of

LexicalStream class

Syntax

public LexicalStream(Reader in)

Parameters

in
Input stream

Description

The stream's close method is called automatically when next returns null, that is, when the iterator finishes delivering tokens.

[Top] [IO Package Classes] [Composer Plug-in API Reference


LexicalStream

Creates an instance of the LexicalStream class from a Unicode string.

Method of

LexicalStream class

Syntax

public LexicalStream(String in)

Parameters

in
Input string

[Top] [IO Package Classes] [Composer Plug-in API Reference


Methods


next

Returns the next token in an HTML input stream.

Method of

LexicalStream class

Syntax

public Token next() throws IOException

Description

Tokenizing is the process of repeatedly calling next to return tokens. Note that \r\n is considered a distinct token, even though the \r is dropped.

Returns

Returns the next token in the stream, or null if the input stream has run out of tokens.

Throws

IOException

The Composer Plug-in API uses standard Java exceptions and exception handling. For more information, see your Java documentation.

[Top] [IO Package Classes] [Composer Plug-in API Reference



Copyright © 1997 Netscape Communications Corporation