[cvs] eforum commit by ppilgrim: Register in CVS
JCorporate Ltd
jcorp at jcorporate.com
Wed Dec 29 11:27:13 UTC 2004
Log Message:
-----------
Register in CVS
Added Files:
-----------
eforum/src/WEB-INF/src/com/jcorporate/eforum/dbobj:
ForumTextDef.java
Revision Data
-------------
--- /dev/null
+++ src/WEB-INF/src/com/jcorporate/eforum/dbobj/ForumTextDef.java
@@ -0,0 +1,127 @@
+package com.jcorporate.eforum.dbobj;
+
+import com.jcorporate.expresso.core.db.DBException;
+import com.jcorporate.expresso.core.dbobj.RequestContext;
+import com.jcorporate.expresso.core.dbobj.SecuredDBObject;
+
+import java.util.Vector;
+
+/**
+ * This is a data object stores a static list of combined CSS text
+ * styles, both monospaced and proportional font sizes.
+ * This class is used in the <em>personalisation</em> feature
+ * of eForum.
+ *
+ * @author Peter Pilgrim, Tue Mar 16 22:40:50 GMT 2004
+ * @version $Id: ForumTextDef.java,v 1.1 2004/12/29 11:27:12 ppilgrim Exp $
+ */
+public class ForumTextDef extends SecuredDBObject
+{
+
+ // 01234567890123456789
+
+ /** Data field name constant */
+ public static final String FLD_TEXT_FONT_ID = "Text_Font_Id";
+ /** Data field name constant */
+ public static final String FLD_TEXT_FONT_CSSNAME = "Text_Font_Css";
+ /** Data field name constant */
+ public static final String FLD_TEXT_FONT_DESC = "Text_Font_Desc";
+
+ /**
+ * Default constructor
+ * @see com.jcorporate.expresso.core.dbobj.SecuredDBObject#SecuredDBObject
+ * @throws DBException upon error
+ */
+ public ForumTextDef() throws DBException {
+ super();
+ } /* ForumTextDef() */
+
+ /**
+ * Standard constructor
+ * Preferred method of initialization.
+ * @see com.jcorporate.expresso.core.dbobj.SecuredDBObject
+ * @param uid the UID of the user
+ * @throws DBException upon error
+ */
+ public ForumTextDef(int uid) throws DBException {
+ super(uid);
+ }
+
+ /**
+ * Standard constructor
+ * for using DBObjects within Controllers. Initializes based upon the current
+ * user and the requested db.
+ *
+ * @param request - The request context handed to you by the framework.
+ * @throws DBException upon error
+ */
+ public ForumTextDef(RequestContext request) throws DBException {
+ super(request);
+ }
+
+ /**
+ * Return valid values for automatic lookup client data objects
+ *
+ * @throws DBException on database failure
+ *
+ * @see com.jcorporate.eforum.dbobj.ForumOptions
+ */
+ public Vector getValues()
+ throws DBException
+ {
+ Vector myValues = this.getValuesDefault(
+ FLD_TEXT_FONT_ID, FLD_TEXT_FONT_DESC );
+ return myValues;
+ }
+
+ /**
+ * @see com.jcorporate.expresso.core.dbobj.SecuredDBObject#setupFields
+ * @throws DBException if database fails
+ */
+ protected synchronized void setupFields() throws DBException
+ {
+ setTargetTable("FORUMTEXTDEF");
+ setName("Forum Text Css Definitions");
+ setDescription("TN_FORUMTEXTDEF");
+
+ addField(FLD_TEXT_FONT_ID, "int", 0, false, "FN_TextFontId");
+ addField(FLD_TEXT_FONT_CSSNAME, "varchar", 128, false, "FN_TextFontCssname");
+ addField(FLD_TEXT_FONT_DESC, "varchar", 250, false, "FN_TextFontDescription");
+
+ // Define the primary key fields
+ addKey(FLD_TEXT_FONT_ID);
+ } /* setupFields() */
+
+ /**
+ * Populates a set of Default Values for the forums.
+ * @throws DBException if database error occurs
+ */
+ public synchronized void populateDefaultValues() throws DBException
+ {
+ String fontSizeList[] = { "8", "10", "12", "14", "16", "18", "24", "36" };
+
+ ForumTextDef textFont;
+
+ for ( int j=0; j<2; ++j ) {
+ for ( int k=0; k<fontSizeList.length; ++k ) {
+ textFont = new ForumTextDef();
+ textFont.setDataContext(getDataContext());
+ textFont.setField( FLD_TEXT_FONT_ID, (100*j+k+1) );
+ if ( j % 2 == 0 ) {
+ textFont.setField( FLD_TEXT_FONT_CSSNAME, "eforum-message-variable"+fontSizeList[k] );
+ textFont.setField( FLD_TEXT_FONT_DESC, "proportionally spaced text at "+fontSizeList[k]+"pt" );
+ }
+ else {
+ textFont.setField( FLD_TEXT_FONT_CSSNAME, "eforum-message-monotype"+fontSizeList[k] );
+ textFont.setField( FLD_TEXT_FONT_DESC, "monospaced text at "+fontSizeList[k]+"pt" );
+ }
+ textFont.addIfNeeded();
+ }
+ }
+
+ }
+
+}
+
+// End
+
More information about the cvs
mailing list