WDK Customisation
Hi all,
I have written Small piece of Code for one of the WDK Component:
IIt is helloWorld Component: Onlick o it Fires below JSP and JAVA file:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<config version='1.0'>
<scope>
<!-- the following tag defines the id of the component -->
<component id="hello_world_component">
<pages>
<start>/custom/hello_world/DataGrid.jsp</start>
</pages>
<class>com.documentum.webtop.webcomponent.about.DummyComponent</class>
</component>
</scope>
</config>
::::::::::::::::::::::::::::::::::::::::DATAGRID.JSP::::::::::::::::::::::::::::::::::::::::
<%@page contentType="text/html"%>
<%@ page errorPage="/wdk/errorhandler.jsp" %>
<%@ taglib uri="/WEB-INF/tlds/dmform_1_0.tld" prefix="dmf" %>
<%@ taglib uri="/WEB-INF/tlds/dmformext_1_0.tld" prefix="dmfx" %>
<html>
<head>
<dmf:webform />
</head>
<body>
<b>
<font color="orange" size="+1">
List of all users and their privileges.
</font>
</b>
<script>registerClientEventHandler(null, "AlertBhejo", AlertBhejo);</script>
<script type="text/javascript">
function AlertBhejo()
{
alert("Agaya Alert")
}
</script>
<dmf:form>
<dmf:datagrid name="mygrid" paged="true" pagesize="10">
<tr>
<th><b>User Name</b></th>
<th><b>User OS Name</b></th>
<th><b>Group Name</b></th>
<th><b>Def Permits</b></th>
<th><b>Privileges</b></th>
</tr>
<dmf:datagridRow>
<td>
<dmf:text name="quantity" datafield="r_object_id" size="15"/>
<dmf:rangevalidator
name="val_range_quantity"
controltovalidate="quantity"
errormessage="Please enter a quantity from 1-5."
minvalue="1"
maxvalue="5"/>
</td>
<td><dmf:label datafield="object_name"/></td>
</dmf:datagridRow>
</dmf:datagrid>
<td>
</td>
<td><dmf:button name = "Gaddi" label ="Change karo sala" onclick="change_karo"></dmf:button></td>
</dmf:form>
</body>
</html>
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DummyComponent.java
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
package com.documentum.webtop.webcomponent.about;
import com.documentum.web.common.ArgumentList;
import com.documentum.web.formext.component.Component;
import com.documentum.web.formext.session.SessionManagerHttpBinding;
import com.documentum.web.form.Control;
import com.documentum.web.form.control.Label;
import com.documentum.web.form.control.databound.Datagrid;
import com.documentum.fc.client.DfAuthenticationException;
import com.documentum.fc.client.DfIdentityException;
import com.documentum.fc.client.DfPrincipalException;
import com.documentum.fc.client.DfServiceException;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.documentum.fc.common.DfException;
public class DummyComponent extends Component
{
Datagrid datagrid = (Datagrid) getControl("mygrid",Datagrid.class);
public void onInit(ArgumentList arg)
{
super.onInit(arg);
}
public void onRender()
{
super.onRender();
Label staticText = (Label) getControl("STATIC_TEXT", Label.class);
staticText.setLabel("My WDK Static Text Value");
Label currentUser = (Label) getControl("CURRENT_DOCBASE", Label.class);
currentUser.setLabel(getCurrentDocbaseName());
try{
datagrid = (Datagrid) getControl("mygrid",Datagrid.class);
}catch(Exception ex){
System.out.println("Creating a new Datagrid Control");
if(datagrid == null)
datagrid = (Datagrid)createControl("mygrid",Datagrid.class);
}
datagrid.getDataProvider().setDfSession(getDocbaseSession());
try {
datagrid.getDataProvider().setQuery("select object_name,r_object_id "+
" from dm_document where "+
"owner_name = "+"'"+getDocbaseSession().getLoginUserName()+"'");
} catch (DfException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
datagrid.getDataProvider().refresh();
}
public void change_karo( Control control, ArgumentList argument)
{
setClientEvent("AlertBhejo", null);
}
private IDfSession getDocbaseSession() {
IDfSessionManager sessionManager = null;
SessionManagerHttpBinding httpBinding = null;
IDfSession dfSession = null;
try {
sessionManager = SessionManagerHttpBinding.getSessionManager();
String docbase = SessionManagerHttpBinding.getCurrentDocbase();
dfSession = sessionManager.getSession(docbase);
}catch(DfIdentityException dfe){
System.out.println("Error while obtaining .." + dfe.getMessage());
}catch(DfAuthenticationException ae){
System.out.println("Authentication except .." + ae.getMessage());
}catch(DfPrincipalException pe){
System.out.println("Principal exception " + pe.getMessage());
}catch(DfServiceException se){
System.out.println("Service exception " + se.getMessage());
}return (dfSession);
}
private String getCurrentDocbaseName()
{
String docbaseName = null;
IDfSession dfSession = getDfSession();
try
{
docbaseName = dfSession.getDocbaseName();
}
catch (DfException e)
{
e.printStackTrace();
}
return docbaseName;
}
}
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
What I wanted to DO is to display results of
select object_name,r_object_id "+
" from dm_document where "+
"owner_name = "+"'"+getDocbaseSession().getLoginUserName()
in DATA GRID and once displayed There is Button is JSP called GADDI onlCLick of this Button I want to navigate to Server Side JAVA class and from there a Clinet side even I want To call Which is a simple Alert, But I am Not able to Do that :::::::::
Actually my final Work is, watever is Displayed in DATAGRID I want to EDIt it in CLinet Side JSP, and then Update the Records fetched using THe JAVA CLass......
Any Help How to implement that
Comments
-
rajesh.ghosh wrote: But I am Not able to Do that :::::::::
Please be more specific.
Is there an error occurs? If yes, please post.
Does your change_karo() method ever get called when the onclick event happens on your button?
Let's target one problem at a time.
0 -
Yeah Vadim,
Sorry to mess it Up...........
My issue is actually chnage_karo() method is not getting called, I want to call it through JSP
0 -
What I wanted to DO is to display results of select object_name,r_object_id "+ " from dm_document where "+ "owner_name = "+"'"+getDocbaseSession().getLoginUserName()in DATA GRID and once displayed There is Button is JSP called GADDI onlCLick of this Button I want to navigate to Server Side JAVA class and from there a Clinet side even I want To call Which is a simple Alert, But I am Not able to Do that :::::::::
Firstly, use DQL query tool in WebTop and DA as a reference example for datagrids. It dynamic but it is still very simple. See wdk.war for the source
Once you have that figured out then start playing with more advanced grids, which give fancy full row selects, and column resizing
Actually my final Work is, watever is Displayed in DATAGRID I want to EDIt it in CLinet Side JSP, and then Update the Records fetched using THe JAVA CLass......
Not possible!!! with out of the box WDK data grids.
Time to start investigate an AJAX framework (dojo, scriptalicous, Ext-JS ...)
0 -
Brian Dinneen wrote:What I wanted to DO is to display results of select object_name,r_object_id "+ " from dm_document where "+ "owner_name = "+"'"+getDocbaseSession().getLoginUserName()in DATA GRID and once displayed There is Button is JSP called GADDI onlCLick of this Button I want to navigate to Server Side JAVA class and from there a Clinet side even I want To call Which is a simple Alert, But I am Not able to Do that :::::::::Firstly, use DQL query tool in WebTop and DA as a reference example for datagrids. It dynamic but it is still very simple. See wdk.war for the source
YES I have DONE THAT , I am Able to See the Clent side EVENt where the JSP is getting Populated with this QUERY, buit LAter Part of my JOB is To EDIT those attribute Value,,,,,, and Then UPDATE The same in REPOSITORY,......... Please suggest the Best way To Do it.......
In that CONTEXT the LINK That you sent Will that be helpful?0 -
Let's try
JSP:
<dmf:button runatclient="false" onclick="customMethod"Component class
public void customMethod(Button button, ArgumentList argumentList) {....
0 -
Yes Now what I need is To Process the Info That I changed in The First JSP and Populate it back to Content Serevr And Assure the CLinet That it has been Chnaged (May be with Alert)
0 -
Were you able to get the chnage_karo() method called?
rajesh.ghosh wrote: Assure the CLinet That it has been Chnaged (May be with Alert)
Please re-state your question in the less confusing way. What exactly seems to be the problem?
Thank you
0 -
Yes that Method is being Called .... But Now the requirement is I want to get the Attribute Value(Existing Value from The JSP) into the JAVA Class and Update the Value into Docbase, then I want to confirm The user that Update has been Done inside Docbase... with an Alert on Client side....Hope I made myself Clear .this time.
0 -
Yes, rajesh, now I understand the requirement.
But where exactly do you need help?
-Getting the value from the JSP?
-Updating value in the docbase?
-Notifying/Confirming the user?
With respect to the notifying/Confirming the user, the more "common/traditional" way would probably be to use the WDK Message Service. It will display the message in the standard message bar.
That is unless you absolutely have to use alert();
Example
MessageService.addMessage(this, "NLS_ID_OF_YOUR_CUSTOM_MESSAGE");
Where "this" is the reference to the Component Class
NLS_ID_OF_YOUR_CUSTOM_MESSAGE - is the nls bundle property name defined in one of the .properties file in your customization
What WDK client is it btw? Taskspace? Webtop?
0
Categories
- All Categories
- 117 Developer Announcements
- 52 Articles
- 145 General Questions
- 133 Services
- 56 OpenText Hackathon
- 35 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 912 Cloud Fax and Notifications
- 81 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 167 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 4 XM Fax