Hi again,
Thanks for your answer, we have checked the installation very carefully. This problem does not seem related to the installation. Just as background information, the SmartGWT jar files are imported in our project like normal jar files and work very well as such, apart from the above mentioned problem. But anyway we have tested the version and the result is we use SmartGWT 3.1p, build date Wed Jul 17 09:45:00 GMT+200 2013, as expected.
We have taken the time to create a small example for you to test, which does not work in our version and returns the error message mentioned before.
Thank you for looking into this.
/**
* @author trainot
*
* Main class for Admin Actions (Entry Point)
*
*
*/
package gwtree.client;
import gwtree.client.datamodel.ActionLinks;
import java.util.ArrayList;
import java.util.List;
import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.Version;
import com.smartgwt.client.core.KeyIdentifier;
import com.smartgwt.client.types.TreeModelType;
import com.smartgwt.client.util.KeyCallback;
import com.smartgwt.client.util.Page;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
public class TreeGWT implements EntryPoint {
/******************************* PRIVATE MEMBERS **********************************/
/* data obtained via JSNI call */
/* data coming from the backend */
private List<TreeNode> actionsData = new ArrayList<TreeNode>();
/* Remote Procedure Call interface */
private DesignElements designElementsInstance;
/******************************* GETTERS **********************************/
/******************************** CONSTRUCTOR ********************************/
public TreeGWT() {
} // end public class constructor
/******************************* ENTRY POINT **********************************/
public final void onModuleLoad() {
/* set CTRL-D as shortcut key for Developer Console */
setShortcutForDeveloperConsole();
//SC.say(Version.getBuildDate().toString());
designElementsInstance = new DesignElements();
fillTreeWithData();
} // end function onModuleLoad
/******************************* RPC HANDLERS *********************************/
/************************** PRIVATE MEMBER FUNCTIONS ***************************/
private void setShortcutForDeveloperConsole() {
KeyIdentifier debugKey = new KeyIdentifier();
debugKey.setCtrlKey(true);
debugKey.setKeyName("Q");
Page.registerKey(debugKey, new KeyCallback() {
public final void execute(final String keyName) {
SC.showConsole();
}
});
} // end function setShortcutForDeveloperConsole
public void fillTreeWithData() {
List<ActionLinks> attachments = new ArrayList<ActionLinks>();
ActionLinks obj1 = new ActionLinks("link1", "linkName1", "11111");
ActionLinks obj2 = new ActionLinks("link2", "linkName2", "22222");
attachments.add(obj1);
attachments.add(obj2);
try {
actionsData.add(new ActionsTreeNode("1", "2", "Test", "3", "Log",
attachments, true));
} catch (Exception e) {
SC.say(e.getMessage());
}
designElementsInstance.getActionsTree().setData(
actionsData.toArray(new TreeNode[]{}));
designElementsInstance.getActionsTreeGrid().setData(
designElementsInstance.getActionsTree());
designElementsInstance.getActionsTreeGrid().redraw();
}
/************************** INNER CLASSES ***************************/
/**
* Class containing the tree data Definition depends on the business object
* defined in datamodel.ActionsInfoBO
*
* @author trainot
*
*/
private class ActionsTreeNode extends TreeNode {
public ActionsTreeNode(final String actionId, final String actionType,
final String actionLogsLink, final String rootAction,
final String mainLog, final List<ActionLinks> attachments,
final boolean isOpen) {
setAttribute("actionId", actionId);
setAttribute("actionType", actionType);
setAttribute("actionLogsLink", actionLogsLink);
setAttribute("rootAction", rootAction);
setAttribute("mainLog", mainLog);
setAttribute("attachments", attachments);
setAttribute("isOpen", isOpen);
}
}
private class DesignElements {
private Tree actionsTree;
private TreeGrid actionsTreeGrid;
public Tree getActionsTree() {
return actionsTree;
}
public TreeGrid getActionsTreeGrid() {
return actionsTreeGrid;
}
/**
* Inner class definition for the design. The coupling between the
* parent class and the inner class (DesignElements) is relative high
*
*/
public DesignElements() {
actionsTree = new Tree();
actionsTree.setNameProperty("actionType");
actionsTree.setIdField("actionId");
actionsTree.setParentIdField("rootAction");
actionsTree.setOpenProperty("isOpen");
actionsTree.setModelType(TreeModelType.PARENT);
TreeGridField typeField = new TreeGridField("actionType");
typeField.setTitle("Action");
TreeGridField attachmentsField = new TreeGridField("attachments");
attachmentsField.setTitle("Attachments");
TreeGridField mainLogField = new TreeGridField("mainLog");
mainLogField.setTitle("Main Log");
mainLogField.setCellFormatter(new CellFormatter() {
@Override
public String format(final Object value,
final ListGridRecord record, final int rowNum,
final int colNum) {
return
"<a href = " + "returnMainLog.do?mainLogFile="
+ value.toString()
+ "&htmlparse='yes' target='_blank'>" + "HTML"
+ "</a>" +
" <a href = "
+ "returnMainLog.do?mainLogFile="
+ value.toString() + ">" + "Main" + "</a>";
}
});
typeField.setCellFormatter(new CellFormatter() {
@Override
public String format(final Object value,
final ListGridRecord record, final int rowNum,
final int colNum) {
return record.getAttribute("actionLogsLink");
}
});
attachmentsField.setCellFormatter(new CellFormatter() {
@Override
public String format(final Object value,
final ListGridRecord record, final int rowNum,
final int colNum) {
@SuppressWarnings("unchecked")
List<ActionLinks> attachments = (List<ActionLinks>) record
.getAttributeAsObject("attachments");
StringBuffer returnValue = new StringBuffer("");
for (ActionLinks attBO : attachments) {
if (attBO.getHasHtmlLink()) {
returnValue.append("<a href = "
+ "returnLog.do?processInfoId="
+ attBO.getProcessInfoId()
+ "&htmlparse='yes'" + " target='_blank'>"
+ "HTML" + "</a>");
}
returnValue
.append(" <a href = returnLog.do?processInfoId="
+ attBO.getProcessInfoId()
+ ">"
+ attBO.getLinkName() + "</a>");
returnValue.append("<br>");
}
return returnValue.toString();
}
});
actionsTreeGrid = new TreeGrid() {
protected String getCellCSSText(final ListGridRecord record,
final int rowNum, final int colNum) {
return "vertical-align:top;";
}
};
actionsTreeGrid
.setFields(typeField, mainLogField, attachmentsField);
actionsTreeGrid.setWidth100();
actionsTreeGrid.setHeight100();
actionsTreeGrid.show();
}
} // end sub-class DesignElements
}
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='treegwt'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Other module inherits -->
<inherits name="com.smartgwt.SmartGwtNoScript" />
<inherits name="com.smartgwt.SmartGwtNoTheme" />
<!--
<inherits name="com.smartclient.theme.graphite.Graphite"/>
<inherits name="com.smartclient.theme.graphite.GraphiteResources"/>
<inherits name="com.smartclient.theme.simplicity.Simplicity"/>
<inherits name="com.smartclient.theme.simplicity.SimplicityResources"/>
<inherits name="com.smartclient.theme.enterprisegray.EnterpriseGray" />
<inherits name="com.smartclient.theme.enterprisegray.EnterpriseGrayResources" />
-->
<inherits name="com.smartclient.theme.enterprise.Enterprise" />
<inherits name="com.smartclient.theme.enterprise.EnterpriseResources" />
<!-- for debugging with CTRL-D -->
<inherits name="com.smartgwt.tools.SmartGwtTools"></inherits>
<!-- Specify the app entry point class. -->
<entry-point class='gwtree.client.TreeGWT' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!--
servlet context - path is arbritray, but must match up with the rpc
init inside java class
<set-property name="user.agent" value="gecko1_8"/>
Tomcat will listen for this from the server and waits for rpc request
in this context
-->
<extend-configuration-property name="rpc.blacklist"
value="com.google.gwt.user.client.ui.*Collection" />
</module>
package gwtree.client.datamodel;
import java.io.Serializable;
public class ActionLinks implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6929885226260327974L;
private String value;
private String linkName;
private Boolean hasHtmlLink;
private String processInfoId;
public ActionLinks(final String value, final String linkName, final String processInfoId) {
this.value = value;
this.linkName = linkName;
this.processInfoId = processInfoId;
this.hasHtmlLink = this.value.endsWith(".html") ||
this.value.endsWith(".htm") ||
this.value.endsWith(".log")
|| this.value.endsWith(".txt")
|| this.value.endsWith(".ges")
|| ((this.value.endsWith(".gz")) && (this.linkName
.endsWith("GESMES")));
}
public ActionLinks() {
}
public final String getValue() {
return value;
}
public final String getLinkName() {
return linkName;
}
public final void setValue(final String value) {
this.value = value;
}
public final void setLinkName(final String linkName) {
this.linkName = linkName;
}
public final Boolean getHasHtmlLink() {
return hasHtmlLink;
}
public final String getProcessInfoId() {
return processInfoId;
}
public final void setProcessInfoId(final String processInfoId) {
this.processInfoId = processInfoId;
}
}