Pages

Showing posts with label XPages. Show all posts
Showing posts with label XPages. Show all posts

Tuesday, December 10, 2013

"Command Not Handled Exception" after removing "XPageDebugToolbar_v3.0.1" custom control from XPages

It would have happened to me again. I mean the long trial and error and the wage wait process to find errors in XPages. For some reason, my XPage would not open up if I remove the XPageDebugToolbar_v3.0.1 custom control from my XPage. And again it worked if I added it back again.

I was like 0.o why would this happen. Has the Debug toolbar author found a way to mess up XPages if they dont need them anymore :P. 

Fortunately I remember that one of my dynamic view controls used a managed bean in which I had declared an object reference to the debug tool bar

private static final DebugToolbar dBar = DebugToolbar.get();

to the answer was to put "//" before the line of code and make it

//private static final DebugToolbar dBar = DebugToolbar.get();

Yeah. Comment-ing the code fixed the issue. Wierd. Guess it would have been better it does not error out and surprice like this. 


Tuesday, December 3, 2013

Getting current column name from dynamic view control in managed bean

I followed the standard example provided in the documents as well as visuals by NotesIn9.com

Hence I was trying to obtain my view name from one of the values in the "svals" variable. For some reason all my attempts kept failing and I even got worked up. I was tired and XPageDebugToolbar came to my rescue after a couple of days of headache.

"svals" seemed to hold references of all stuffs present in the page and that was a sheer nonsense in terms of what I was expecting

I got it through the following code fragment

for (Map.Entry entry: svals.entrySet()) {
dBar.info("Key = " + entry.getKey().toString() + ", Value = " + entry.getValue().toString());
}

So I tried using the ColumnDef object to determine the column name and that worked -

 if (colDef.getName().equals("C1")) {
dynamicColumn.setRendered(false);
}

Hurray I got my work complete now :). Hope this helps some one else as well :)

Debugging managed beans in xpages

I copied all design elements from the XPageDebugToolbar v3.0.1 to my database and followed the procedures to debug my code. Some irritating stuff kept throwing "Command Not Handled" exception.

The error page was set to the error page mentioned by the XPageDebugToolbar v3.0.1 as per the documentation and hence I changed it back to default settings. Now I was able to see some clear meaningless errors. rolf.
It displayed something like the dbar.warn or dbar.error pointed to undefined values and hence no such methods existed.

So I made an attempt to check the "eu/linqed/debugtoolbar/DebugToolbar" file. That is where I found a clear error which upon fixing fixed the issue. The class (java design element) did not open up and instead it spoke of some refresh error and asked me to hit F9. How wonderful.

Now I have a managed bean with following lines of codes in different parts of the class which enabled me debug and fix the issue.

private static final DebugToolbar dBar = DebugToolbar.get();

dBar.info(colDef.getName()+"==C1 is " + (colDef.getName().equals("C1")));

for (Map.Entry entry: svals.entrySet()) {
dBar.info("Key = " + entry.getKey().toString() + ", Value = " + entry.getValue().toString());
}

My code is now fixed and I am one happy me now. :)

Dont forget to download and use the XPageDebugToolbar. It is really a great work and made my life easier with XPages.

I used to use a custom built logger tool which I built a couple of years ago. I used the same to create log documents and dump all my debugging statements. This helped me watch my code all these years.Now that I had to use Dynamic View Control from Extension Library, I had to use managed beans to manipulate so me column values and hurray my xLog failed. It simply did not create any log documents. Some posts kept telling me to recycle objects after they are used. It did not help either.

Hope this helps some one. :)

Thursday, November 28, 2013

Roles in XPages - Part ||

I have tried obtaining user roles using different methods before. I think the following way is pretty simple to obtian an array or user roles and a comma separated string of user roles

var userRolesArray=database.getACL().getRoles().toArray()

var userRolesString="";

for (itr=0;itr
{ userRolesString+=userRolesArray[itr]+",";
}

userRolesString;

My previous post on this topic can be navigated to by clicking on the following link

Monday, November 25, 2013

Could not open the editor: An unexpected exception was thrown - xpages

I was working with editable area controls and custom controls and for the first time, I used them together to find a time saver. Life(may be God) has its own way of playing with you. Rather I would call it insanely teasing you.

When I opened my XPage in the designer, I encountered the following error message



I felt like I was doomed. All my hard work for the day has went in vain as I did not take any backups :(

Eventually I started preparing my curse list starting with *hi**p Ri**d. No offense, just kidding. I closed down my Lotus Notes and opened it back again and the error vanished phew.... That was a silly damn thing to do. Saved me lot of hits against the wall with my head.

Also I found a post in the stackoverflow forum which gave me more ideas about why and how to handle this issue :)

Friday, November 22, 2013

Installing and running XPages Extension Library in your local machine

Shamelessly copy pasted from Naveegator

I had been hearing a lot about XPages Extension Library and finally got to try it out in XPages code-a-thon held at Mumbai. So I decided to try it on my local machine along with little help from experts on StackOverflow. Its a simple two-step procedure - install extension library and run extension library.

Install XPages Extension Library

First of all get the latest release of extension library from OpenNTF. Unzip the file and find "updateSiteOpenNTF-designer.zip". Unzip it and you will get two folders of "features" & "plugins" and a file "site.xml". In Lotus Notes sidebar, go to My Widgets and select "Options > Configure a Widget from... > Features and Plugin on an Update Site". If you are unable to see My Widgets in your sidebar then click here.


Now enter the URL for the update site as: file:///C:\updateSiteOpenNTF-designer.zip>\site.xml. Click on load button and you will get all the features in the extension library. Select all of them and click on Next and follow the instructions.

After you are done installing restart the Notes client. Then you would be able to see the extension library components in your Controls tab in Domino Designer.


Running XPages using Extension Library components

If you try to preview any XPage which uses extension library components then you would get an error as Cannot find the library com.ibm.xsp.extlib.library, required by the application . This is because the above procedure only installs the extension library only in Domino Designer, not in the local preview engine.

For that go to /domino/workspace/applications/eclipse and copy-paste the files from features and plugins extracted from updateSiteOpenNTF-designer.zip into their respective locations. Give Notes client a restart and you are ready to run XPages Extension Library.

onClick event not working in XPage Link Control - A work around


I have had issues with XPage Link Controls in the past, especially with the onClick events of the links. I was under an impression that I had a work around to solve it. Unfortunately I rediscovered that I still have issues with the same and my work around from the past failed.

It was because, I had a link with my known work around inside a table cell whose onClick event was coded.
My previous solution was for 8.5 version and with all of the new nice features in 8.5.3 I thought its time for me to go for a more stabler solution. And ended up with a better work around lol, may not be a perfect solution

In respect to my analysis, following is a possible list of reasons that your onClick event of XPage Link Controls would fail in 8.5.3

1. The onClick event of your Link Control might fail if you had associated a url to your link. Refer to the following image


2. When both URL and onClick events are provided on the XPage Link Controls, Page gets redirected to the linked url before its onClick event gets executed properly. Its a wild guess. Please check for its authenticity your self

3. The onClick event might fail on the wonderful IE browser if a parent container like a div or a table cell which contains the Link Control has code on its onClick event or other events like onMouseover etc

In order to over come all still be able to use both "link" and onclick event, remove the url mapping to the link control and use call a button controls onclick event on the client side onclick event of the link. And code all you want in the button both client and server side. This seems to remove alot of problems and has worked for me. I know that I am complicating stuffs with my words here, so take a look at the following image. Probably you would understand stuffs better.


And dont even think about screaming something like "HEY, THATS CHEATING. ITS NOT A FAIR SOLUTION". As I said earlier, this is a possible work around that has worked for me. I dont mean this to be a final solution :P

Friday, November 8, 2013

"last" link in Xpage pager control not working

I recently had to work with pager controls in Xpages.  I used to work with the default “Sample 1″ style for “Pager style” and this time I had to go for other styles that displays the "last" link in the pager. For some reason it did not render and instead I had to see a few dots instead of the "last" link.
It was as if some thing like "to be continued...." . Damn IBM walas... that was very good way to mock me :P
Eventually got my heart in mouth lol as I was under a lot of pressure to get it to work. With some research I found a post somewhere in the ibm developer works were a like minded person (may be) was enjoying this funny joke by IBM. One of the replies to that post suggested a work around hack to calculate total view entries count, divide it by number of documents being displayed and associate it with view control display etc...
I short I wanted my pager to look something like the following :
|< >| 
But it was looking something like the following
|< ..
I tried inspecting the pager and to my astonishment, it was never there. It was really something like "to be continued..." , I mean it was never calculated by the XPage
After some poking around and some more google searches, I found “alwaysCalculateLast” in the All Properties tab for the pager control. I set it to true and it works like charm :)

Thursday, November 7, 2013

Get label of link in XPages

In order to get value from a component like Edit box control etc in an XPage I use

getComponent("ControlName").getValue()

When it comes to a link it will give you the URL Value that the XPage link control has been mapped. In order to obtain the Label or the Name of the link (and not url) you got to use the getText() method.

Following is a brief illustration of what I am talking about


Following is the result obtained on the browser


Get class name of Components in XPage

Its very easy to obtain the class name of components in Xpages. The only issue is that, its difficult if you dont know how :P

Well for starters (like me) drag and drop a control on to an XPage. Give it a name say "MyControl"

Now add a label to the XPage where you performed the above mentioned difficult steps and use the following code to compute its label

getComponent("MyControl").getClass().getName()

In my case I tried it with a link object and got the following stuffs on my screen




If you feel curious about understanding (most likely about simply knowing) controls better you can refer to the control documentation. Following post speaks about its where abouts.

http://xcellerant.net/2013/09/17/tip-finding-all-properties-and-methods-available-for-xpages-components/

Thursday, October 31, 2013

JSON Issues in XPages - Unknown literal of class com.ibm.jscript.types.FBSUndefined

This post does not speak about any fixes for this error message, however, contains a tip that will help avoid the issue.

I encountered this error when I tried to apply toJson method on a json construct.

I had the following json construct. Let me say this as "x"


{"menuItems": [
{
"serialNumber": 1,
"Label": "Label_1",
"Link":"Link_1",
"subMenuItems": [
{
"serialNumber": 1,
"Label": "Label_1",
"Link":"Link_1",
"subMenuItems": [
,
]
},

]
},
]}

When i attempted some thing like toJson(x), I got the FBSUndefined error. How ever, when I attempted, fromJson(x) I got sort of I got the following error

Error when parsing JSON string
Encountered " "object "" at line 1, column 2. Was expecting one of: "false" ... "null" ... "true" ...blah blah blah

When I just put my json construct on to a field's default value and tried to parse the field's value using the following code
x=getComponent("toJsonTest").getValue();

y=fromJson(x);

getComponent("result").setValue(y.menuItems.length)//-> result was 2.0 (i guess)
it worked like charm. Voila

I understand that this must be sort of, a beginner level stuff for Json in XPages.
If you would like to be saddened further by coding a lot to obtain perfection, may be you can explore "com.ibm.commons.util.io.json" and use them in your SSJS :P

Issues working with XPage Tabbed Panel Controls - Aligning Tab Headers with Margin

This was something that I was thinking to do for a long time but never had to do it before. Thanks to my most demanding customer who literally takes a scale and measures micrometer differences on the screen, I am now finding time for working with this finer details on the screen.

The goal is to get the tab headers of a Tabbed Control in XPages to align itself with the margin. I know we always play around with options available in the control's property tab to do it. Atleast I always do it that way :P. I did play around with margins and found some frustrating issues that resulted in some sort of "so-close" answers all the time.

Thanks to chrome and firefox and their developer modes, I was able to do something that pleases me.

Jumping straight to the point, my XPage Tabbed Control looked some what like one in the following screen shot



Hmm looking at this part of screen alone make me realize why my customer was like "WHAT THE HELL!!! WHY IS THE PASSENGER DATA OUT OF LINE!!!". That was scary :P

At last (so at least now) I was able to modify that to look like the following

  Looks pretty nice tight. My customer is really something. Wonder about the eagle eyes my customer has got :)

The trick that helped me do this is very simple. Just add the following to your style sheet

ul.xspTabbedPanelTabs {
left: 0px;
}

and by the way if you are interested, its 10px by default. Thank you wasting some of your time reading my story and not scolding me :)

Monday, October 28, 2013

Working with Design Definition in Custom Controls - XPages

I see design definitions in Custom controls as the name states are for providing a design description.

I see this more like a beautification part to your design. Cos I think , simple multiline comments also would serve the same purpose. The top side is , I looks good when included on the XPages.

The down side is, I feel little irrated to work with the xml mark up I have to provide in the Design Definitions tab.

Coming to the point, the simplest syntax that I learn is, you got to provide xml markup inside the Design Definitions text area as you would do in a normal XPage. Take a look at the following screen shot on how/where to provide the markup value



If you do this, you custom control when included on an XPage, would look  something like the following on the designer


Looks pretty design to me :), at least better when compared to the native appearence

Working with Property Definition in Custom Controls - Xpages

I found a nice lesson about this in Xpages 101. Hola, my innernet connection was awesome, that I was not able to view the video through the vimeo player. With a bit of research, I was able to figure it out and thus this fine article :P

I dont remember using this or seeing this in 8.5 or 8.5.1. And now I see that this is very useful and can be used in a lot of ways. To me this feature really does make more sense to the existence or employment of custom controls in designs. As a matter of fact, I think I should start sticking with Custom controls and use Xpages only to resuse my custom control. Dont O.o me if you think other wise. May be I am just curious

Jumping right on to the topic, try the following and you may understand how it works.

1. As always, You must start with creating or using an existing custom control. Open it and go to the properties pane.

2. Now add a property to the custom control as illustrated in the following screen shot. In addition you can go to the validation and visible tabs and code your way as per your necessity





3. Now include this custom control in some XPage and click on the custom control. You will find a tab called as "Custom Properties" when you select the included custom control. You can infer what I see in my case. I see the property that I created and I am able to assign a value to it

4. The little diamond symbol beside the custom property value says I can do stuffs like link it with a scoped variable or some thing :). Think you get the idea

5. Now to see how to provide and retrieve the value for/from the custom property, create a computed field in your custom control and look for compositeData. You can find your property name and use it as per your requirement.


There you go. Hope this helps :)

Monday, May 27, 2013

Trigger Select All Checkbox Click in XPage view panels in XPages


This post shows the method through which the select all button that you would enable on a Xpage view panel can be programatically clicked.

I found need for a scenario in which I would require the document ids of all documents that are being displayed on a Xpage view in a browser. Eventually the simplest userfrinedly/user interactive mechanism that I was able to think about was the native select all feature available with the XPage view controls in Lotus Notes.

It took me quite a while to understand the usage though, It was quite tricky and tough but not any more :)
Following is the code fragment that allowed me to do this silly stuff

var viewPanelContainer=document.getElementById("ViewPanelContainer");

//-- Following line of code has been commented and the forth comming lines, second and third respectively
//have been introduced to bypass a IE bug related to the HTMLNode.getElementsByClassName command in javascript
//var selectAllCheckBox=viewPanelContainer.getElementsByClassName("xspCheckBoxViewColumnHeader")[0];
var selectAllCheckBoxes=getElementsByClassName(viewPanelContainer, "xspCheckBoxViewColumnHeader");
var selectAllCheckBox=selectAllCheckBoxes[0];
//-- End of block highlighting the work around for an IE bug


selectAllCheckBox.click(); //dispatchEvent("click");

Here I am using a function named as getElementsByClassName. The function is available in the blog, you can simply search for the same using the name itself or use any other method that you have. This is essential for the code to work in the tremendously awesome Internet explorer crap.

For all other poor browsers out there, they are in capable of making my life difficult and hence a simple object.getElementsByClassName will work on them

Hope this helps :)

Dojo Toolbar related tips and tricks in XPages

A while ago I was working on creating a tool bar for one of my Xpages. I was able to find a lot of reliable resources on the internet. It did take me a lot of time to understand and build my own toolbar though.

In summary my understanding is you may have to use all or few of the following dojo.require attributes in your page


dojo.require("dojo.parser");
dojo.require("dijit.form.Button");
dojo.require("dijit.Toolbar");
dojo.require("dijit.Tooltip");
dojo.require("dijit.ToolbarSeparator");

I also found that I was using the code line "var djConfig = { baseScriptUri : "js/dojo/",parseOnLoad : true };"
I am not sure if I had used the djConfig variable any where in my program to construct the tool. I guess it automatically loads with Xpages. If not - what stops you from a copy & paste :)

! guess I copy codes blindly at times lol.

Again I wanted this to be visible to the entire XPage and hence I used a "xp:scriptBlock" tag to define them

Later I copied code from the standard examples about dojo toolbar available on the web and modified it to suit my requirements
This sure is a lot of code. Just skip or delete the code fragments that might not be of interest to you.

Now I have acquired a decent tool bar when I preview the page on the browser. Which looks like the following.

<div id="toolbar" style='display:none;position:fixed;_position:absolute;
top:0;_top:expression(eval(document.body.scrollTop));
left:0;_left:expression(eval(document.body.scrollLeft));'>
<div id="toolbar1" dojoType="dijit.Toolbar">
<div dojoType="dijit.form.Button" id="toolbar1_Home"
iconClass="iconHome" showLabel="false">
Home
</div>
<span id="span6" dojoType="dijit.Tooltip" connectId="toolbar1_Home">
Home
</span>
<span data-dojo-type="dijit.ToolbarSeparator"></span>
<div dojoType="dijit.form.Button" id="toolbar1_ExportAll"
iconClass="iconExportAll" showLabel="true">
Export All
</div>
<span id="slides_tip" dojoType="dijit.Tooltip" connectId="toolbar1_ExportAll">
Export all data to Excel Sheet
</span>
<span data-dojo-type="dijit.ToolbarSeparator"></span>

<!-- div dojoType="dijit.form.Button" id="toolbar1_ExportSelected"
iconClass="iconExportSelected" showLabel="true">
Export Selected
</div>
<span id="fs_tip" dojoType="dijit.Tooltip" connectId="toolbar1_ExportSelected">
Export
selected documents to Excel Sheet
</span>

<span data-dojo-type="dijit.ToolbarSeparator"></span-->


<div dojoType="dijit.form.Button" id="toolbar1_PrintPage"
iconClass="iconPrintPage" showLabel="true">
Print
</div>

<span id="thumb_tip" dojoType="dijit.Tooltip" connectId="toolbar1_PrintPage">
Print the page as you see it
</span>
<span data-dojo-type="dijit.ToolbarSeparator"></span>

<div dojoType="dijit.form.Button" id="toolbar1_PrintAll"
iconClass="iconPrintAll" showLabel="true">
Preview All
</div>

<span id="span2" dojoType="dijit.Tooltip" connectId="toolbar1_PrintAll">
Preview all documents
</span>
<span data-dojo-type="dijit.ToolbarSeparator"></span>

<div dojoType="dijit.form.Button" id="toolbar1_PrintSelected"
iconClass="iconPrintSelected" showLabel="true">
Preview Selected
</div>

<span id="span1" dojoType="dijit.Tooltip" connectId="toolbar1_PrintSelected">
Preview selected documents
</span>

<span data-dojo-type="dijit.ToolbarSeparator"></span>

<div dojoType="dijit.form.Button" id="toolbar1_SearchField"
iconClass="" showLabel="true">
<xp:inputText style="width:222.0px" id="SearchContent">
</xp:inputText>
</div>
<div dojoType="dijit.form.Button" id="toolbar1_SearchButton"
iconClass="iconSearchButton" showLabel="false">
Search Image
</div>

<span id="span4" dojoType="dijit.Tooltip" connectId="toolbar1_SearchButton">
Search
</span>

<div dojoType="dijit.form.Button" id="toolbar1_HighlightButton"
iconClass="iconHighlightButton" showLabel="false">
Highlight Matches
</div>

<span id="span3" dojoType="dijit.Tooltip" connectId="toolbar1_HighlightButton">
Highlight
matches without searching
</span>

<div dojoType="dijit.form.Button" id="toolbar1_AdvSearchButton"
iconClass="iconAdvancedSearch" showLabel="false">
Advanced Search
</div>

<span id="span5" dojoType="dijit.Tooltip" connectId="toolbar1_AdvSearchButton">
Advanced
Searching Options
</span>

<span data-dojo-type="dijit.ToolbarSeparator"></span>
<div dojoType="dijit.form.Button" id="div1" iconClass=""
showLabel="true">
<xp:label value="Show " id="label3"></xp:label>
<xp:comboBox style="width:80.0px" defaultValue="30"
id="docsToDisplay">
<xp:selectItem itemLabel="30 Docs" itemValue="30">
</xp:selectItem>
<xp:selectItem itemLabel="50 Docs" itemValue="50">
</xp:selectItem>
<xp:selectItem itemLabel="100 Docs" itemValue="100">
</xp:selectItem>
<xp:selectItem itemLabel="200 Docs" itemValue="200">
</xp:selectItem>
<xp:selectItem itemLabel="1000 Docs" itemValue="1000">
</xp:selectItem>
<xp:eventHandler event="onchange" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var searchViewGrid:com.ibm.xsp.component.xp.XspViewPanel=getComponent("searchViewPanel");
var docsToDisplay=getComponent("docsToDisplay").getValue();
var docToDispInt=java.lang.Integer.parseInt(docsToDisplay)
searchViewGrid.setRows(docToDispInt)}]]></xp:this.action>
</xp:eventHandler>
</xp:comboBox>
</div>
</div>
</div>

Its a lot of code. Atleast I got a nice looking tool bar like the following on my screen now.



Now take a closer look at the parent tag that I have defined for the tool bar. The style that is being computed/defined here helps the tool bar stay on top of the page irrespective of the page scroll

I dont know whether this method is recommended or not but, it servers the purpose. So if you find/know of a better way to do this please do let me know of the same.

Here the various icon classes that I have used here are responsible for the nice icons that are being displayed on the tool bar. So mark sure that you define your styles properly. Following is one such example of the associated style sheet

Our net stop is to see how to define an onclick event for our nice tool bar buttons here. Hi hi what did you expect. On click event related activites needs to be explicity defined through code and its not a simple onclick event definition. Following is the way to do it.

It would seem a little complicated, but its easy to understand. Following screen shot shows how I defined onclick events for the toolbar buttons along with how I defined the functions that were associated with the onclick events

Hope this helps :)


Thursday, April 25, 2013

Search issues in XPages #1 - Dont forget to Create FTIndex in replicas manually

I have been working with XPages searches for a long time. It has been a while since I have worked with XPages and I was almost happy to get my hands on it again. I had to create a search feature that would help my clients perform a decent search.

Since they were ok with performing an FTIndex on the application, XPage searches was a nice option that occured to me.

To my frustration, proving that I got a little rusty with XPages, it took me 4 hours to get this search feature complete. I was bombarded with errors and for some reason, my search was not working the way I expected it to work.

Following are the summary of the issues that took me time to identify and fix

#1. Enable "Display Xpage runtime error page" in the XPages tab in "Application Properties". Else you would end up debugging for a long time

#2. My XPage's view control lost its data source referance and was showing a 'red X' in the application navigator which I missed to notice oweing to large number of design elements.

#3. Check source code pane, now and then to find if there are any errors being displayed. It will exist there with out any warning and you would not notice it on the design pane of the XPage

#4. Enable FTIndex inorder to work with the native search feature available with XPages

#5. Be warned, in case of clustered server, were replicas of databases from multiple servers are used to render a webpage. Because, FTIndex dont ret replicated. They need to be enabled and updated across replicas separately.

My search worked like charm after I rediscovered all of these items again :(

Friday, May 11, 2012

Forcing browser compatibility in IE

I happened to stumble upon this concept long back and due to some reason which I don't remember, I lost interest in it. After a long time when I checked my archives, I came across this concept again and thought its time I put it to good use. I as most developers do, believe, IE is the browser that is a gift for the developers. Its so buggy that you can forget why your wife threw a stick at you the same morning :).

And to add to the recipe we have different versions of IE which again are different from each other in behavior. Or at least that what I believe as far as I have worked with it. Stories apart, I will come to the point,

I just found some one talking about how to force IE8 to work like IE7 when working with XPages.That article was exhaustive, and I have lost track of it. But I do have parts of it documented there and there for my understanding.

All you got to do is put the following code in beforeRenderResponse event: 
// first option uses compatibility mode, second option too but stronger
// X-UA-Compatible: IE=7
// X-UA-Compatible: IE=EmulateIE7
if (context.getUserAgent().isIE(8, 8)) {
  var exCon = facesContext.getExternalContext();
  var response = exCon.getResponse();
  response.setHeader("X-UA-Compatible", "IE=EmulateIE7");
}

Understanding Compatibility View

Before displaying a standards-mode Web page, Internet Explorer 8 checks to see if the domain name of the Web site appears in the Compatibility View List. If so, the site is displayed using Compatibility View. If not, and the page contains no other direction, Internet Explorer 8 displays the page in Internet Explorer 8 Standards mode.
When a standards-based Web page is displayed in Compatibility View, the following changes occur.
Pages are displayed in IE7 mode rather than IE8 mode.
In the user-agent string, the browser identifies itself as MSIE 7.0 instead of MSIE 8.0.
Conditional comments and version vectors recognize the browser as Internet Explorer 7, rather than Internet Explorer 8.
These changes help ensure that users can still use Web sites that do not fully support the features of Internet Explorer 8.
Please note that the X-UA-COMPATIBLE header has greater precedence than Compatibility View. If a Web site is on the Compatibility View List and a page on that site includes an X-UA-COMPATIBLE header telling Internet Explorer 8 to display a page in IE8 mode, the page is displayed in Internet Explorer 8 Standards mode. This allows Web developers to support Internet Explorer 8 Standards mode on an incremental basis

Javascript to identify the compatibility mode


engine = null;
if (window.navigator.appName == "Microsoft Internet Explorer")
{
   // This is an IE browser. What mode is the engine in?
   if (document.documentMode) // IE8
      engine = document.documentMode;
   else // IE 5-7
   {
      engine = 5; // Assume quirks mode unless proven otherwise.
      if (document.compatMode)
      {
         if (document.compatMode == "CSS1Compat")
            engine = 7; // standards mode
      }
   }
   // The engine variable now contains the document compatibility mode.
}


To specify a document mode for your Web pages, use the META element to include an X-UA-Compatible http-eqiv
header in your Web page. The following example specifies EmulateIE7 mode compatibility.
    
   
      My Web Page</< span>title></div><div>      <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /></div><div>   </< span>head></div><div>   <body></div><div>      <p>Content goes here.</< span>p></div><div>   </< span>body></div><div></< span>html></div><div><br></div><div>    </div><div><br></div><div>The content attribute specifies the mode for the page; for example, to mimic Internet Explorer 7 beha vior, specify IE=EmulateIE7.</div><div>Likewise, specify IE=5, IE=7, or IE=8 to select one of those compatibility modes. You can also specify IE=edge to tell Internet Explorer 8 to use the</div><div>highest mode available. </div><div><br></div></div>

Tuesday, August 16, 2011

Working with In Memory Documents in XPages

Following is a simple demonstration of how documents in memory can be used to communicate between XPages and Agents.The beauty in the following description is that the document in memory is never being saved. That is an awesome stuff that I feel is really helpful for developers in many occations

Create an XPage with a couple of input fields named "boxA" and "boxB" as shown in the following image
Now add a button and label it as you desire and add the following code to it

The code displayed in the above mentioned image does the following,
  1. it simply creates a document on the fly named "inMemoryDoc"
  2. Handle to an agent present in the backend is obtained
  3. The agent is asked to be executed with the inMemoryDoc created in the first step as documentcontext
  4. The inMemory document gets updated (not saved) in the backend and the updated values are asked to be displayed on the UI using the getComponent("").setValue() methods.

The code fragment in the agent that resides on the backend is as follows

So as a result when you preview the XPage on the browser and hit the button the out put will be as follows

If you get any errors ensure that the credentials mentioned in the following post are met,
http://ozinisle.blogspot.com/2011/02/agentrunwithdocumentcontextnotesdocumen.html

Hope this helps :)

Saturday, July 30, 2011

XPages Domino Object Map 8.5.2

I recently happened to come across a page where I was able to find this
XPages Domino Object Map 8.5.2. It reminds me of old times when I used to work with version 7. And I really missed the hirerachy map in later versions though I had them byhearted. This one seems to be pretty similar and is a good one. You get to click on the map to see the details associated with them.

I know many would have known it already, but still there must be people who would seek this. So this is my turn to share my discovery :)

Hope this helps :)