Monday, February 27, 2012

Animation in Xages - Blink the Name and Animate an Element

Animation is not a complex thing in Xpage,

We can change the style of an element continuously.

But seeking in Javascript Tween is not working on Xpages,

So we have an ideal thought of changing the style of an element is one of the nice way...

copy and paste the below code on your Xpage's source...


<xp:view id="page" xmlns:xp="http://www.ibm.com/xsp/core"
createForm="false" style="color:rgb(0,0,160)">


<xp:this.afterPageLoad><![CDATA[#{javascript:sessionScope.val=1}]]></xp:this.afterPageLoad>
<xp:label value="Ramkumar" id="label1"
style="font-weight:bold;font-size:20pt">
</xp:label>

<xp:eventHandler event="onClientLoad" submit="false">
<xp:this.script><![CDATA[var t = 1;
var flag;

function doMove() {

t = t + 1;
if ((t % 2) == 0) {
document.getElementById("#{id:label1}").style.color = "blue";
document.getElementById("#{id:label1}").style.postion = "absolute";
document.getElementById("#{id:label1}").style.left = "50px";
flag = setTimeout(doMove, 1000);

}

else {
document.getElementById("#{id:label1}").style.color = "red";
document.getElementById("#{id:label1}").style.postion = "absolute";
document.getElementById("#{id:label1}").style.left = "100px";
flag = setTimeout(doMove, 1000);
}

}


doMove();





]]></xp:this.script>
</xp:eventHandler>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:span
style="font-weight:bold;color:rgb(255,0,0);font-size:20pt">
</xp:span>
<xp:span
style="font-weight:bold;color:rgb(255,0,0);font-size:20pt;position:absolute;left:20px;top:250px">
</xp:span><xp:span style="font-weight:bold;color:rgb(249,23,215);font-size:20pt;position:absolute;left:20px;top:250px">SAMPLE ANIMATION IN XPAGE, Thing is changing the style
contiuously...
</xp:span>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>

<xp:br></xp:br>
<xp:br></xp:br>
</xp:view>

Get the Run time Input from Server side script in Xpages

Yes We are able to get the run time input box from server side script...

With the use of Java class, It is very very simple...

The following code is used to make the message box in server side javascript in Xpage...

var msg:javax.swing.JOptionPane=new javax.swing.JOptionPane();
var GetMessage=msg.showInputDialog("Server Side InptBox...");
msg.showMessageDialog(null,GetMessage);

Friday, February 17, 2012

$Readers Field

It is one of the Nice functionality in Lotus notes...

Simple Readers and $Readers field's functionality is same.

But the Behavior is making me excited...

For a single field which is changed the all of our document's items.

Create a form.,

Without putting "$Readers" field, Run and save for some times :) ( for some documents we have to get)

Put a field on your form as "$Readers"

Enter @UserName as default value for that field...

Save the document and goto your view, and open the all documents and see you will get amazed... (:))

Before opening the document please refresh all the documents using "@Command([ToolsRefreshAllDocs])"

Wednesday, February 15, 2012

message box in server side javascript

Actually at the starting of our Xpage, Every faced this problem...

How can we get the message box in server side?

Yes there is a lot of solutions for that...

1. We can create a panel as message box and use Hide when formula (css - z-index)...

2. Use Dojo dialog.

3. I tried to make a unique and nice way, Finally I have one great idea.

That is we can create a Jpane for message box single line code,


JOptionPane.showMessageDialog(null,"Message");

We can use documentcontext for calling this agent and we can use this code for validation too...

I think this is one of the nice idea for validating our current document.,

Monday, February 13, 2012

Delay (Sleep) in Xpages

We can make some delay for our execution on our client.

But in web, we don't have sleep function for making our process delayed.,

But we can overcome this issue with the calculation of starting time with our delaying time.,

Here is the code for delaying our execution (Millisecond is a delaying duration)

Which will work in CSJS and SSJS

function delay(millisecond)
{
var startTime = new Date().getTime(); // get the current time
while (new Date().getTime() < startTime + millisecond)
{
}
}