Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.content.bean
Class TextComponent  view TextComponent download TextComponent.java

java.lang.Object
  extended bycom.RuntimeCollective.content.bean.SimpleContent
      extended bycom.RuntimeCollective.content.bean.TextComponent
All Implemented Interfaces:
Content, com.RuntimeCollective.webapps.bean.Duplicable, com.RuntimeCollective.webapps.bean.EntityBean, java.io.Serializable

public class TextComponent
extends SimpleContent

This class is a basic Content holding a piece of text. It doesn't have a title nor a description: those are inferred from the text. TextComponent can be used as is to store eg news items. Alternatively, it can be composed by a more complex Content, such as a website's Page, or a nice Article.

Version:
$Id: TextComponent.java,v 1.33 2003/10/03 14:47:40 criss Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
protected  java.lang.String Format
          The Format
protected static int MAX_DESCRIPTION_LENGTH
          The max length of the description.
protected  java.lang.String Text
          The Text
protected  java.lang.String Title
          The Title This shouldn't really be there - TextComponent is only a bit of text.
 
Fields inherited from class com.RuntimeCollective.content.bean.SimpleContent
Author_id, CreationDate, id, LastModifiedDate, LastModifierUser_id
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
TextComponent()
          Construct a new blank textcomponent, giving it a new unique ID.
TextComponent(int id)
          Get a current textcomponent from the RuntimeDataSource, given an id.
 
Method Summary
 void delete()
          Delete this TextComponent from the database.
 java.lang.String getDescription()
          Get the description Returns the first 50 chars of the text, if any.
 java.lang.String getFormat()
          Get the Format
 java.lang.String getText()
          Get the Text
 java.lang.String getTitle()
          Get the title
 void save()
          Save this TextComponent to the database.
 void setDescription(java.lang.String description)
          Set the description.
 void setFormat(java.lang.String format)
          Set the Format
 void setText(java.lang.String text)
          Set the Text
 void setTextAsHtml(java.lang.String text, java.lang.String oldFormat)
          Upload some plain text, transform it to html, and set the content's type to html
 void setTitle(java.lang.String title)
          Set the Title
 java.lang.Object viewFormat(java.lang.String format)
          Get the content in a certain format.
 
Methods inherited from class com.RuntimeCollective.content.bean.SimpleContent
customiseDuplicate, getAuthor, getCreationDate, getId, getLastModifiedDate, getLastModifierUser, makeDuplicate, makeDuplicate, setAuthor, setCreationDate, setId, setLastModifiedDate, setLastModifierUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

MAX_DESCRIPTION_LENGTH

protected static int MAX_DESCRIPTION_LENGTH
The max length of the description.


Title

protected java.lang.String Title
The Title This shouldn't really be there - TextComponent is only a bit of text. But it's needed by the SE project for some boxes.


Format

protected java.lang.String Format
The Format


Text

protected java.lang.String Text
The Text

Constructor Detail

TextComponent

public TextComponent()
              throws java.sql.SQLException
Construct a new blank textcomponent, giving it a new unique ID.


TextComponent

public TextComponent(int id)
              throws java.sql.SQLException
Get a current textcomponent from the RuntimeDataSource, given an id.

Method Detail

save

public void save()
          throws java.sql.SQLException
Save this TextComponent to the database.

Specified by:
save in interface com.RuntimeCollective.webapps.bean.EntityBean
Overrides:
save in class SimpleContent

delete

public void delete()
            throws java.sql.SQLException
Delete this TextComponent from the database.

Specified by:
delete in interface com.RuntimeCollective.webapps.bean.EntityBean
Overrides:
delete in class SimpleContent

getTitle

public java.lang.String getTitle()
Get the title

Specified by:
getTitle in interface Content
Overrides:
getTitle in class SimpleContent

getDescription

public java.lang.String getDescription()
Get the description Returns the first 50 chars of the text, if any.

Specified by:
getDescription in interface Content
Overrides:
getDescription in class SimpleContent

setDescription

public void setDescription(java.lang.String description)
Set the description. NB: This does nothing.

Specified by:
setDescription in interface Content
Overrides:
setDescription in class SimpleContent

viewFormat

public java.lang.Object viewFormat(java.lang.String format)
Get the content in a certain format. "html", "htmlfull" and "plaintext" are supported for now.

If the desired format is "html", and if the init-param convertLinks is set to true, all links of the form http://... will be converted to hyperlinks.

Specified by:
viewFormat in interface Content
Overrides:
viewFormat in class SimpleContent

setTitle

public void setTitle(java.lang.String title)
Set the Title

Specified by:
setTitle in interface Content
Overrides:
setTitle in class SimpleContent

setFormat

public void setFormat(java.lang.String format)
Set the Format


getFormat

public java.lang.String getFormat()
Get the Format


setText

public void setText(java.lang.String text)
Set the Text


getText

public java.lang.String getText()
Get the Text


setTextAsHtml

public void setTextAsHtml(java.lang.String text,
                          java.lang.String oldFormat)
Upload some plain text, transform it to html, and set the content's type to html