Basic formatting styles

Warning - java2web is now obsolete. Please use its successor: code2web

back to index

Formatting of the source code is done through named CSS styles. For example, the default style name for block comments is "block-comment". This means that when a block comment appears, the software will format it as follows:

<div class="block-comment">
/* The block
* comment goes
* here
*/
</div>

Java2web will use either divs or spans, depending on the situation. If you are using the provided skins, they already use the default names. In general, you should not need to change the default names of the CSS styles, except in the following two situations:

 

Tab size

The tabSize property specifies how many spaces are generated for each tab found in the source code. The default value is 2.

HTMLConverter   int getTabSize()
void setTabSize( int size)
Java2Web   java2web ... --tabSize= xxxxx ...
<j2w:convert>   <j2w:convert ... tabSize="size" ... >

 

Source Code

All of the generated HTML conversion of the source code is enclosed in a top-level div tag. The sourceStyle property specifies the CSS class name applied to that div, and hence to all nested elements which do not override its settings. By default the style name is "source". .

Eclipse Netbeans Monochrome Citylights
source source source source

 

 

HTMLConverter   String getSourceStyle()
void setSourceStyle( String style )
Java2Web   java2web ... --sourceStyle = xxxxx ...
<j2w:convert>   <j2w:convert ... sourceStyle="style" ... >

 

Comments

The commentStyle property specifies the CSS class name applied to single-line comments ( // comment). The default value is "comment". The standard skins render it in the following way:

Eclipse Netbeans Monochrome Citylights
// comment // comment // comment
// comment

 

HTMLConverter   String getCommentStyle()
void setCommentStyle( String style )
Java2Web   java2web ... --commentStyle = xxxxx ...
<j2w:convert>   <j2w:convert ... commentStyle="style" ... >

 

Block comments ( /* ... */ ) use the style specified by the blockComment property. The default value is "block-comment"

Eclipse Netbeans Monochrome Citylights
/* block */ /* block */ /* block */ /* block */

 

 

HTMLConverter   String getBlockCommentStyle()
void setBlockCommentStyle( String style )
Java2Web   java2web ... --blockCommentStyle = xxxxx ...
<j2w:convert>   <j2w:convert ... blockCommentStyle="style" ... >

 

Finally, javadoc comments ( /** ... */ ) use the style specified by the javadocComment property. The default value is "javadoc-comment".

Eclipse Netbeans Monochrome Citylights
/** javadoc*/ /** javadoc */ /** javadoc */ /** javadoc */

 

HTMLConverter   String getJavadocCommentStyle()
void setJavadocCommentStyle( String style )
Java2Web   java2web ... --javadocCommentStyle = xxxxx ...
<j2w:convert>   <j2w:convert ... javadocCommentStyle="style" ... >

 

 

Identifiers

The identifierStyle property specifies the CSS class name applied to identifiers. The default value is "identifier". Remember that an identifier are basically all names - names of methods, of classes, of enumerations, of fields, etc.., whether they are defined by you (MySpectacularClass) or included in the standard library (String, Integer)

Eclipse Netbeans Monochrome Citylights
identifier identifier identifier identifier

 

 

HTMLConverter   String getIdentifierStyle()
void setIdentifierStyle( String style )
Java2Web   java2web ... --identifierStyle = xxxxx ...
<j2w:convert>   <j2w:convert ...identifierStyle="style" ... >

 

 

Keywords

The keywordStyle property specifies the CSS class name applied to keywords. The default value is "keyword".

Eclipse Netbeans Monochrome Citylights
class class class class

 

HTMLConverter   String getKeywordStyle()
void setKeywordStyle( String style )
Java2Web   java2web ... --keywordStyle = xxxxx ...
<j2w:convert>   <j2w:convert ...keywordStyle="style" ... >

 

 

Numbers

The numberStyle property specifies the CSS class name applied to numeric literals. The default value is "number".

Eclipse Netbeans Monochrome Citylights
3.141592 3.141592 3.141592 3.141592

 

HTMLConverter   String getNumberStyle()
void setNumberStyle( String style )
Java2Web   java2web ... --numberStyle = xxxxx ...
<j2w:convert>   <j2w:convert ...numberStyle="style" ... >

 

 

Strings

The stringStyle property specifies the CSS class name applied to string literals. The default value is "string"

Eclipse Netbeans Monochrome Citylights
"Hello" "Hello" "Hello" "Hello"

 

HTMLConverter   String getStringStyle()
void setStringStyle( String style )
Java2Web   java2web ... --stringStyle = xxxxx ...
<j2w:convert>   <j2w:convert ...stringStyle="style" ... >

 

 

Operators

The operatorStyle property specifies the CSS class name applied to operators. The default value is "operator"

Eclipse Netbeans Monochrome Citylights
++ -- >>= ++ -- >>= ++ -- >>= ++ -- >>=

 

HTMLConverter   String getOperatorStyle()
void setOperatorStyle( String style )
Java2Web   java2web ... --operatorStyle = xxxxx ...
<j2w:convert>   <j2w:convert ...operatrorStyle="style" ... >