<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ToolTwist]]></title>
	<link rel="self" href="http://www.tooltwist.com/forums/extern.php?action=feed&amp;type=atom"/>
	<updated>2011-11-29T03:13:25Z</updated>
	<generator>PunBB</generator>
	<id>http://www.tooltwist.com/forums/index.php</id>
		<entry>
			<title type="html"><![CDATA[Saving chinese characters to DB]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=115&amp;action=new"/>
			<summary type="html"><![CDATA[<p>How do I fix the issue saving data with chinese characters to a database via xpc? As of now saving it would turn the data into ????.</p>]]></summary>
			<author>
				<name><![CDATA[leo.aguimatang]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=27</uri>
			</author>
			<updated>2011-11-29T03:13:25Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=115&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Error in fip server: Pre-commit command failed]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=113&amp;action=new"/>
			<summary type="html"><![CDATA[<p>Problem:</p><p>Error installing batch: tooltwist.fip.FipException: Pre-commit command failed: protected/pre_commit.sh</p><p>Solution:</p><p>Never stop the server. Keep the server running while deploying new build.</p>]]></summary>
			<author>
				<name><![CDATA[dexter.cato]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=271</uri>
			</author>
			<updated>2011-04-13T05:05:07Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=113&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Missing property: tooltwistConfig]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=112&amp;action=new"/>
			<summary type="html"><![CDATA[<p>I got an error in the Tomcat logs (localhost.2010-10-11.log) with the following error.</p><div class="quotebox"><blockquote><p>Oct 11, 2010 7:45:30 PM org.apache.catalina.core.ApplicationContext log<br />SEVERE: StandardWrapper.Throwablecom.dinaa.xpc.XpcException: Error finding XPC config: tooltwist.repository.RepositoryException: Missing property: tooltwistConfig&nbsp; &nbsp; &nbsp; &nbsp; at com.dinaa.xpc.backend.XpcConfigInternal.checkConfigIsLoaded(XpcConfigInternal.java:67)<br />&nbsp; &nbsp; &nbsp; &nbsp; at com.dinaa.xpc.backend.XpcConfigInternal.getUserType(XpcConfigInternal.java:182)<br />&nbsp; &nbsp; &nbsp; &nbsp; at com.dinaa.xpc.backend.SecurityInternal.login(SecurityInternal.java:324)</p></blockquote></div><p>I&#039;ve checked tomcat/webapps/ttsvr/WEB-INF/web.xml, and it does define tooltwistConfig at the bottom of the file.</p><div class="quotebox"><blockquote><p>&lt;env-entry&gt;<br />&nbsp; &nbsp; &lt;env-entry-name&gt;tooltwistConfig&lt;/env-entry-name&gt;<br />&nbsp; &nbsp; &lt;env-entry-type&gt;java.lang.String&lt;/env-entry-type&gt;<br />&nbsp; &nbsp; &lt;env-entry-value&gt;/home/conlgen_ci/server/tooltwist.conf&lt;/env-entry-value&gt;<br />&lt;/env-entry&gt;</p></blockquote></div><p>What is causing this error?</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-10-11T12:14:00Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=112&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How many FIP Servers is needed per physical server?]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=111&amp;action=new"/>
			<summary type="html"><![CDATA[<p>During deployment, if the install method is &#039;fip&#039; (File Installation Protocol), a fipserver will have to be installed and run on the remote server where the project is going to be deployed. </p><p>QUESTION:<br />If there are multiple projects that will be deployed to the same remote server, how many FIP servers will be installed on the remote server?</p><p>ANSWER:<br />It&#039;s easiest to install one fip server for each project account on the remote server using different ports for each since will use very little memory and cpu resource. This allows the files for each server to be owned by a different user Id.</p><p>If this is the case however, fip will need to run on different ports for each, which is defined:</p><p>a) in the command when fipserver is started, and<br />b) in the /Controller/config-files/serverSlot.*.xml file for the server.</p>]]></summary>
			<author>
				<name><![CDATA[dexter.cato]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=4</uri>
			</author>
			<updated>2010-10-06T09:16:58Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=111&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Build Error during deployment due to wrong PAYLOAD_TYPE]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=110&amp;action=new"/>
			<summary type="html"><![CDATA[<p>PROBLEM:&nbsp; An error was encountered while deploying one project to the server</p><div class="quotebox"><blockquote><p>[javac] /Controller/launchpads/project/tmp/project_t-20101004/src/project/productionHelpers/ThisIsAProductionHelper.java:5: package tooltwist.misc does not exist<br />[javac] import tooltwist.misc.JspHelper;</p></blockquote></div><p>SOLUTION:<br />The project-createPayload.xml ant script should use PAYLOAD_TYPE=&#039;parc&#039; instead of tooltwist.&nbsp; A &#039;tooltwist&#039; type of payload will only be used for the tooltwist project.&nbsp; All the other projects should use &#039;parc&#039;.</p>]]></summary>
			<author>
				<name><![CDATA[dexter.cato]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=4</uri>
			</author>
			<updated>2010-10-04T10:19:41Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=110&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Error checking in to SVN]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=109&amp;action=new"/>
			<summary type="html"><![CDATA[<p>I sometimes get an error while checking in code changes, using Eclipse on OSX.</p><p>The error message takes different forms:</p><div class="codebox"><pre><code>Some resources were not reverted.
svn: Cannot rename file &#039;/tooltwist/tooltwist_osx_6.0/devel/.../.svn/tmp/entries&#039; to &#039;/tooltwist/tooltwist_osx_6.0/devel/../.svn/entries&#039;</code></pre></div><p>or</p><div class="codebox"><pre><code>svn: Working copy &#039;/tooltwist/tooltwist_osx_6.0/devel/...&#039; locked; try performing &#039;cleanup&#039;</code></pre></div><p>These problems appear to be caused by importing files into Eclipse. Despite what the error message says, cannot be cleared with either a cleanup or unlock operation, either from within Eclipse or by using svn on the command line.</p><p>The cause is a locked file. The -O flag for ls can be used to find the lock (on the &#039;entries&#039; file in this case):</p><div class="codebox"><pre><code># cd .svn
# ls -lO
total 8
-r--r--r--  1 philipcallender  staff  uchg 1824  8 Sep 18:01 entries
-rw-r--r--  1 philipcallender  staff  -       0 12 Sep 02:46 lock
-rw-r--r--  1 philipcallender  staff  -       0 12 Sep 02:46 log
drwxr-xr-x  3 philipcallender  staff  -     102 12 Sep 02:46 tmp</code></pre></div><p>The lock can be removed using <strong>Get Info</strong> in Finder and unchecking the lock checkbox. It can also be removed using the chflags command:<br /></p><div class="codebox"><pre><code># chflags nouchg entries
# ls -lO
total 8
-r--r--r--  1 philipcallender  staff  - 1824  8 Sep 18:01 entries
-rw-r--r--  1 philipcallender  staff  -    0 12 Sep 02:46 lock
-rw-r--r--  1 philipcallender  staff  -    0 12 Sep 02:46 log
drwxr-xr-x  3 philipcallender  staff  -  102 12 Sep 02:46 tmp</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-09-11T18:56:16Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=109&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA["package does not exist" error]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=108&amp;action=new"/>
			<summary type="html"><![CDATA[<p>In the construction phase of deploying to a server, an error like this occurred:</p><div class="codebox"><pre><code>acme_t.jar:
     [echo] Creating acme_t.jar
...
    [javac] Compiling 44 source files to /Controller/launchpads/rpconlgen/tmp/rpconlgen_t-20100824.1/build
    [javac] Compiling 163 source files to /Controller/launchpads/cbapg/tmp/rp-bsg-20100831/build
    [javac] /Controller/launchpads/pad1/tmp/acme-20100831/src/com/acme/JsonRequest.java:3: package com.google.gson does not exist
    [javac] import com.google.gson.JsonArray;
    [javac]                       ^</code></pre></div><p>The Java class compiled correctly in the ToolTwist workbench (Eclipse) but got this error when building in the Controller.</p><p>The most common cause for this type of error is a missing JAR file. To ensure that a JAR file is included when the payload is built by the Controller, it must be placed in the <em>WebContent/WEB-INF/lib</em> folder for the project.</p><p>In this case, the error above was corrected by installing <em>WebContent/WEB-INF/lib/gson-1.5.jar</em> in the acme_t project in Eclipse, and then submitting a new acme_t payload to the Controller. Using the new version of the acme_t payload, the build completed.</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-08-31T13:55:24Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=108&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Editing the Navpoint File from Eclipse]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=107&amp;action=new"/>
			<summary type="html"><![CDATA[<p>Note: In normal situations, there is no need to edit the navpoint definition files - the navpoint screen in the Designer should be used. If for some reason it does need to be edited, make sure you restart the server immediately after making the changes of they may be overwritten.</p><p>If the navpoints file is edited directly from within Eclipse, the navpoint hierarchy might disappear when the server is restarted.</p><p>If this occurs, the most common reason is that the encoding for the file is incorrect. To check this, right click on the file in the designer (e.g. webdesign/config/wbd/navpoints/acme/navpoints.conf) and select properties. On the Resource tab, you&#039;ll see a section titled &quot;Text file encoding&quot;. The correct value for this is UTF-16.</p><p>If it&#039;s incorrect, change it then save the file again, then restart the server.</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-08-28T10:52:28Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=107&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[NotSerializableException while restarting]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=106&amp;action=new"/>
			<summary type="html"><![CDATA[<p>From Leo Aguimatang:</p><p>I always encounter this error in eclipse console when I update a widget and restart the tomcat server:<br /></p><div class="codebox"><pre><code>SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.dinaa.ui.UimDataStoredInSession
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.dinaa.ui.UimDataStoredInSession
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    at java.util.Hashtable.readObject(Hashtable.java:859)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    ...</code></pre></div><p>Afterwards the wbd IDE would not open. Its not that critical nor urgent because there&#039;s a workaround by restarting the tomcat server.</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-08-27T05:46:49Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=106&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Tomcat Connection Pooling in Tooltwist]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=105&amp;action=new"/>
			<summary type="html"><![CDATA[<p>Applications are penalized when they try to create new connections to a database.&nbsp; But if an application keeps a connection as long as it can use it, the database may soon run out of connections.&nbsp; A workaround is to keep a pool of open connections.&nbsp; When the application needs to connect to the database, it checks the pool for a connection.&nbsp; When the application is finished with the connection it returns the connection to the pool.&nbsp; The connection pooling library has many responsibilities.&nbsp; It should determine the number of active connections to keep, it should know when to create and destroy connections, etc.&nbsp; Writing one for an application will take considerable effort.&nbsp; Luckily, tomcat provides a built-in connection pooling library.&nbsp; Here are the steps to use it.</p><p>1. Create a file named context.xml under WebContent/META-INF.&nbsp; This file should contain the connection settings to the database.&nbsp; An example is given below:<br /></p><div class="codebox"><pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;Context path=&quot;/ttsvr&quot; docBase=&quot;ttsvr&quot; crossContext=&quot;true&quot; reloadable=&quot;true&quot; debug=&quot;1&quot;&gt;

    &lt;Resource name=&quot;jdbc/postgres&quot;
            auth=&quot;Container&quot;
            type=&quot;javax.sql.DataSource&quot;
            driverClassName=&quot;org.postgresql.Driver&quot;
            url=&quot;jdbc:postgresql://10.1.1.153:5432/qvas_coc&quot;
            username=&quot;postgres&quot;
            password=&quot;vsc&quot;
            maxActive=&quot;10&quot;
            maxIdle=&quot;5&quot;
            maxWait=&quot;-1&quot;
            removeAbandoned=&quot;true&quot;
            removeAbandonedTimeout=&quot;60&quot;
            logAbandoned=&quot;true&quot;
            /&gt;

&lt;/Context&gt;</code></pre></div><p>2. Get a datasource from the connection pool.&nbsp; The example below shows how to get a datasource for a jndi resource named: jdbc/postgres.<br /></p><div class="codebox"><pre><code>    InitialContext initialContext = new InitialContext();
    if (initialContext == null) {
        String message = &quot;InitialContext was not setup properly.&quot;;
        logger.error(message);
        throw new SQLException(message);
    }
    // actual jndi name is &quot;jdbc/postgres&quot;
    DataSource datasource = (DataSource) initialContext.lookup( &quot;java:/comp/env/jdbc/postgres&quot; );
    if ( datasource == null ) {
        String message = &quot;WebApp resource was not setup properly.&quot;;
        logger.error(message);
        throw new SQLException(message);
    }</code></pre></div><p>3. Get a connection from the datasource<br /></p><div class="codebox"><pre><code>    Connection con = datasource.getConnection();</code></pre></div><p>For the QVAS project a utility class named JdbcUtil was created.&nbsp; This class is used in XPC&#039;s to get a connection from the pool.<br /></p><div class="codebox"><pre><code>public class JdbcUtil {
    private static DataSource datasource = null;
    private static Logger logger = Logger.getLogger(JdbcUtil.class);

    private synchronized static DataSource getDataSource() throws NamingException, SQLException {
        if (datasource == null) {
            InitialContext initialContext = new InitialContext();
            if (initialContext == null) {
                String message = &quot;InitialContext was not setup properly.&quot;;
                logger.error(message);
                throw new SQLException(message);
            }
            // actual jndi name is &quot;jdbc/postgres&quot;
            datasource = (DataSource) initialContext.lookup( &quot;java:/comp/env/jdbc/postgres&quot; );
            if ( datasource == null ) {
                String message = &quot;WebApp resource was not setup properly.&quot;;
                logger.error(message);
                throw new SQLException(message);
            }
        }
        return datasource;
    }
    
    public synchronized static Connection getConnection() throws SQLException, NamingException {
        return getDataSource().getConnection();
    }

    public static synchronized void freeConnection(Connection connection) throws SQLException {
        connection.close();
    }
}</code></pre></div><p>Usage:<br /></p><div class="codebox"><pre><code>    Connection con = JdbcUtil.getConnection();
    Statement stm = con.createStatement();
    ResultSet rst = stm.executeQuery(sql);</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[theo.reyes]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=123</uri>
			</author>
			<updated>2010-07-16T03:56:47Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=105&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Widget Events]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=104&amp;action=new"/>
			<summary type="html"><![CDATA[<p>From Rezvie F. Navallo:</p><p>I have found that when you put document.observe(&#039;dom:loaded&#039;, function() {}) such as autocompleter from the widget, on tooltwist designer you can&#039;t move that widget out of the page into the basket.</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-07-08T04:44:49Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=104&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Using FindBugs in Tooltwist]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=103&amp;action=new"/>
			<summary type="html"><![CDATA[<p>FindBugs is an eclipse plugin that reviews code and checks for common java coding errors.&nbsp; The errors range from un-removed &quot;TODO&quot; comments; to inefficiency in the code; to possible masking of potential bugs.</p><h5>To install FindBugs:</h5><p>1. Click on Help &gt; Install New Software...<br />2. Click on Add...<br />3. Fill in the following:<br />&nbsp; &nbsp; - Name: FindBugs<br />&nbsp; &nbsp; - Location: <a href="http://findbugs.cs.umd.edu/eclipse/">http://findbugs.cs.umd.edu/eclipse/</a><br />4. Check FindBugs and the packages underneath it<br />5. Continue the installation process by clicking on Next, I Agree, etc..</p><h5>To use FindBugs</h5><p>1. Right-Click on the project<br />2. Select Find Bugs &gt; Find Bugs<br />3. The Find Bugs perspective gives a list of possible bugs with suggestions</p><h5>Here&#039;s a list of common bugs found by Find Bugs on the Tutuki project and suggested actions:</h5><p>1. When concatinating strings, especially within a loop, use StringBuffer instead of String<br />&nbsp; &nbsp; wrong way:<br /></p><div class="codebox"><pre><code>        String s = &quot;----\n&quot;;
        for (int i = 0; i &lt; 10; i++) {
            s += &quot;hello\n&quot;;
        }
        System.out.println(s);</code></pre></div><p>&nbsp; &nbsp; correct way:<br /></p><div class="codebox"><pre><code>        StringBuffer s = new StringBuffer(&quot;----\n&quot;);
        for (int i = 0; i &lt; 10; i++) {
            s.append(&quot;hello\n&quot;);
        }
        System.out.println(s.toString());</code></pre></div><p>&nbsp; &nbsp; note: StringBuffer does not override the equals(Object) method.&nbsp; Use the equals method of String by:<br /></p><div class="codebox"><pre><code>        StringBuffer sb = new StringBuffer(&quot;hello&quot;);
        if (&quot;hello&quot;.equals(sb.toString())) ...</code></pre></div><p>&nbsp; &nbsp; or:<br /></p><div class="codebox"><pre><code>        if (sb.toString().equals(&quot;hello&quot;)) ...</code></pre></div><p>2. Avoid empty catch blocks<br />&nbsp; &nbsp; wrong way:<br /></p><div class="codebox"><pre><code>        catch (Exception ex) {}</code></pre></div><p>&nbsp; &nbsp; note: at the very least, do an ex.printStackTrace();&nbsp; This is still not recommended though.&nbsp; Best is to re-raise an exception.&nbsp; Let tooltwist/tomcat/java handle that for you.<br />&nbsp; &nbsp; best way:<br /></p><div class="codebox"><pre><code>        catch (Exception ex) {
            // few handling/logging statements
            throw new CustomException(ex);
        }</code></pre></div><p>3. Handle specific exceptions explicitly.<br />&nbsp; &nbsp; wrong way:<br /></p><div class="codebox"><pre><code>        catch (Exception ex)</code></pre></div><p>&nbsp; &nbsp; right way:<br /></p><div class="codebox"><pre><code>        catch (ExType1 ex) {
            ...
        }
        catch (ExType2 ex) {
            ...
        }</code></pre></div><p>&nbsp; &nbsp; According to FindBugs: &quot;this construct also accidentally catches RuntimeException as well, masking potential bugs.&quot;</p><p>4. When a variable is not in use, delete it.&nbsp; If you think the code will use this later, just comment it out.&nbsp; The bulk of the errors/warnings was because of advance code.&nbsp; One particular sample is the log4j logger.</p><p>5. Misc:<br />&nbsp; &nbsp; - Always remove autogenerated comments.&nbsp; These are comments marked with the text &#039;TODO Auto-generated&#039;.<br />&nbsp; &nbsp; - Always remove unused imports.&nbsp; An eclipse shortcut is to press Command-Shift-&#039;O&#039; to organize imports.</p>]]></summary>
			<author>
				<name><![CDATA[theo.reyes]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=123</uri>
			</author>
			<updated>2010-06-17T07:40:51Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=103&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Using Page Data]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=102&amp;action=new"/>
			<summary type="html"><![CDATA[<p>Page Data is data related to a navpoint, that effects the way a widget is displayed.</p><p><strong>Background</strong><br />Quite commonly, multiple navpoints will refer to a single page layout. That doesn&#039;t make much sense if every page was rendered the same, so there are several mechanisms widgets can use to change their appearance, based upon the navpoint being rendered.</p><p>The first, is that the widget looks at one or more of the properties of the navpoint currently being rendered. For example, the navpoint ID, it&#039;s categories, it&#039;s title, or it&#039;s SEO related fields.</p><p>The second, more common way for a widget to change it&#039;s appearance - based upon the navpoint of the page - is to use <em>page data</em>.</p><p>Page data is XML data related to a specific widget, for a specific navpoint. If a widget defines that it wants to use page data, then any navpoint that refers to a page containing that widget will have the &quot;Edit Page Data&quot; button enabled. By clicking on that button, a user can then enter XML that will be used by the widget when it is rendering on that navpoint.</p><p>Note: In a future version, specific page data editors will be available. For now however, page data is all edited as XML.</p><p><strong>Using Page Data in a Widget</strong><br />To use page data, a widget controller must first implement the <em>UsesPageData</em> interface.</p><div class="codebox"><pre><code>public class BillboardWidget extends WbdWidgetController implements UsesPageData
{

    @Override
    protected void init(WbdWidget instance) throws WbdException
    {
        instance.defineProperty(new WbdStringProperty(&quot;pageDataSection&quot;, null, &quot;PageDataSection&quot;, &quot;billboard&quot;));
        ...
    }

    ...
    
    public XData getInitialPageData(WbdWidget instance)
    {
        StringBuffer xml = new StringBuffer();
        xml.append(&quot;&lt;pageData&gt;\n&quot;);
        xml.append(&quot;    &lt;billboard&gt;\n&quot;);
        xml.append(&quot;        &lt;cropImage&gt;cropImageName&lt;/cropImage&gt;\n&quot;);
        xml.append(&quot;        &lt;imageSrc&gt;imageUrl&lt;/imageSrc&gt;\n&quot;);
        xml.append(&quot;        &lt;alt&gt;Alternate text&lt;/alt&gt;\n&quot;);
        xml.append(&quot;        &lt;navPointId&gt;[navPointId]&lt;/navPointId&gt;\n&quot;);
        xml.append(&quot;        &lt;url&gt;[url]&lt;/url&gt;\n&quot;);
        xml.append(&quot;    &lt;/billboard&gt;\n&quot;);
        xml.append(&quot;&lt;/pageData&gt;&quot;);     
        return new XData(xml);
    }

}</code></pre></div><br /><p>This will enable the &quot;Edit Page Data&quot; button for navpoints where this widget is used, and will provide default XML page data. The &quot;PageDataSection&quot; property is used by the page data editor to allow a unique block of XML to be edited for this widget.</p><p>The final step is to have the widget use the page data as it is rendering production pages.</p><div class="codebox"><pre><code>    @Override
    public void renderForJSP(WbdGenerator generator, WbdWidget instance, UimHelper ud, WbdRenderHelper buf) throws Exception
    {
        String navpointId = WbdSession.getNavpointId(ud.getCredentials());
        String pageDataSection = instance.getProperty(generator, &quot;pageDataSection&quot;);

        // Get the page data
        Xpc xpc = ud.getXpc();
        xpc.start(&quot;tooltwist.wbd.getPagedata&quot;, &quot;select&quot;);
        xpc.attrib(&quot;pageDataNavPoint&quot;, navpointId);
        xpc.attrib(&quot;pageDataSection&quot;, pageDataSection);
        XData pagedata = xpc.run();

        // Render the widget, using the page data
        String imageSrc = pagedata.getText(&quot;/*/*/imageSrc&quot;);
        ...
    }</code></pre></div><p>-oOo-</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-06-09T08:01:43Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=102&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Generic Widget Controller]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=101&amp;action=new"/>
			<summary type="html"><![CDATA[<p>There is now a Generic Widget controller, that can be used in many cases where simple widget functionality is required:</p><p>1. Output from a snippet.<br />2. Zero or more basic parameters, that may be substituted into the output from the snippet.<br />3. No logic.</p><p>Many user controls just require specific HTML or JSP output without any intelligence, except perhaps basic parameter replacement.</p><p>The following steps can be used to crete a new widget without any Java coding. In this example, we&#039;ll just create a page heading surrounded by <strong>h1</strong> tags.</p><p><strong>Step 1: Create a new widget directory</strong><br />Create a new folder for a scratch version of the widget, for the your usual user id.</p><div class="codebox"><pre><code>e.g.
mkdir ...../webdesign/config/wbd/libraries/myProject_widgets/headingWidget/scratch_myUserId</code></pre></div><p><strong>Step 2: Create the configuration file</strong></p><p>In the folder just created, create a new configuration file for the widget (conf.xml).<br /></p><div class="codebox"><pre><code>&lt;widget&gt;
  &lt;widgetClass&gt;tooltwist.wbd.widgets.GenericWidgetController&lt;/widgetClass&gt;
  &lt;idWithinRootWidget&gt;0&lt;/idWithinRootWidget&gt;
  &lt;label&gt;Heading Widget&lt;/label&gt;
  &lt;icon&gt;/tooltwist/wbd/toolbox_icons/youtube_icon.png&lt;/icon&gt;
  &lt;isStatic&gt;Y&lt;/isStatic&gt;
  &lt;description&gt;A heading surrounded by h1 tags&lt;/description&gt;
  &lt;property&gt;
    &lt;name&gt;heading&lt;/name&gt;
    &lt;label&gt;Heading&lt;/label&gt;
    &lt;type&gt;string&lt;/type&gt;
  &lt;/property&gt;
&lt;/widget&gt;</code></pre></div><p>The property tag defines a property that can be edited in the normal manner within the ToolTwist designer.</p><p><strong>Step 3: Create the snippet files</strong><br />Create files named <em>snippet_design.html</em>, <em>snippet_preview.html</em> and <em>snippet_production.jsp</em>. These may be edited with a regular HTML or JSP editor. The parameters defined in the conf.xml will all be available as normal snippet variables.</p><div class="codebox"><pre><code>&lt;html&gt;
&lt;body&gt;
&lt;!--START--&gt;
&lt;h1&gt;%%label%%&lt;/h1&gt;
&lt;!--END--&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div><br /><p><strong>Step 4: Restart the server</strong><br />After restarting, the widget should be available to be dropped on a page.</p>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-06-08T16:01:01Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=101&amp;action=new</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Excessive log entries from httpclient]]></title>
			<link rel="alternate" href="http://www.tooltwist.com/forums/viewtopic.php?id=100&amp;action=new"/>
			<summary type="html"><![CDATA[<p>By default, the httpclient package writes large amounts of information to the log file. To prevent this, the following lines can be added to log4j.conf.</p><div class="codebox"><pre><code># Print only messages of level INFO or above in the package org.apache.
log4j.logger.org.apache=INFO
log4j.logger.org.apache.commons.httpclient=INFO
log4j.logger.httpclient.wire=INFO</code></pre></div>]]></summary>
			<author>
				<name><![CDATA[philcal]]></name>
				<uri>http://www.tooltwist.com/forums/profile.php?id=2</uri>
			</author>
			<updated>2010-04-14T15:00:07Z</updated>
			<id>http://www.tooltwist.com/forums/viewtopic.php?id=100&amp;action=new</id>
		</entry>
</feed>

