OOP FormGenerator Version 2.1

com.oopreserch.web
Interface FormValueBreaker

All Known Implementing Classes:
BreakForHtml, BreakForXml

public interface FormValueBreaker

The interface for replacing the line separator with the tag for line break.

On the instance of Form, you can insert the arbitrary String into the pre-defined code fragments. Then, the instance of Form can merge them all and return the concatenated String.

For example, the String selected from SQL table can be inserted into the HTML table. In this case, the HTML tags for the HTML table skeleton will be written as the pre-defined code fragments.

Please consider what will happen if the String to be inserted includes the line separators. As you know, most mark-up languages treat them as single space. As a result, the inserted String will be shown without any line breaks on the web browser.
To be shown with lines breaks, the line separators in the String must be replaced with the tags for lines break, such as <br>. And this is the responsibility of the implementation of this interface.

The implementation of this interface will be used by the instance of Form to replace the line separators. The list of the available implementations should be listed in:

where the value of each property is the fully qualified class name of the implementation of this interface. The key in this property resource file can be specified as the value of break.type attribute of d.value element in the XML. Then, the corresponding implementation will be used to replace the line separators.

The implementation of this interface must implement:
The tags for line break differ with the mark-up languages. In case of HTML and HDML, it is <br>. As for WML and XHTML, <br /> should be used instead.
To be ready for both of them, the 2 implementations are included in this package. They are: So, please feel free to use any of them. Or, if you like, you can define your own implementation which satisfies your requirement. In this case, please add the fully qualified class name of your implementation to: For details about this property resource file, please look into FormValueBreakerFactory.

Since:
2.0
Author:
Jun Inamori

See Also:



Method Summary
 java.lang.String getBreaked(java.lang.String str)
          This method will be used by Form to replace the line separators with the tags for line break.
 

Method Detail

getBreaked

public java.lang.String getBreaked(java.lang.String str)
This method will be used by Form to replace the line separators with the tags for line break.

The implementation of this method is responsible for replacing the line separators with the tags for line break. This method must be Thread Safe in all the implementations.
Parameters:
str - The original String.
Returns:
The String in which the line separators were replaced with the tags for line breaks.
Since:
2.0

OOP FormGenerator Version 2.1

ALL CONTENTS COPYRIGHT 2002, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori.