Using XControls for developing cards-based UI for mobile and desktop applications

Introduction

For a project I reviewed several frameworks to deliver a web interface. Among them was XControls which is a project on OpenNTF. XControls promises to deliver:

  • Faster design and assembly of modern user interfaces, using Card & List objects.
  • Easy the auto-optimization for smartphones, tablets and PCs.

bc-ipad-contacts-framed

XControls is built with Bootstrap and the Bootcards project.

Bootcards

Bootcards is a cards-based UI and it is built on top of Bootstrap. Unlike most other UI frameworks, it includes a dual-pane interface for tablet users.

The documentation describes well the structure and options for the two main objects, card and list (analagous to Forms and Views in traditional Notes development).

Basically you have 2 types of list:

  • Normal.
  • Detailed.

Below is an example of the Detailed list:

bc-list-detailed

And 8 types of cards:

  • Base.
  • Form.
  • Table.
  • Chart.
  • Summary.
  • Media.
  • File.
  • Rich text.

Below is an example of the Media card:

card-media-ios

Bootstrap

Bootstrap claims to be the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web. We will not introduce this framework further.

Getting started with XControls

Part of the documentation for XControls is the Getting started page which will walk you through creating a new application using XControls. I suggest to read this first and keep the primer documentation side by side.

Download the files

The required files can be either downloaded from OpenNTF or Github. Unfortunately XControls is not available as a plugin for your XPages development so you need to copy the required files manually in your existing project/NSF or you can use the provided NTF as a starter-kit for a new project.  The files are:

  • All custom controls starting with UnpBoot naming.
  • All Xpages starting with Unp naming.
  • All Resources\Files.
  • The”blank” theme (set this as application theme in XSP Properties file).

After that you are ready to develop the UI for your application! A recommended tip is to install the sampler application provided with the OpenNTF download and open that one in a browser and Domino Designer.

Test: Notebook/Journal

For my review I decided to apply the XControls methodology on a simple existing Notes application: the Notebook. This application allows you store simple documents which can combine rich text and file attachments. You are also able to ‘tag’ these documents by applying categories.

I will describe the steps taken to apply the XControls cards-based UI to this application.

Step: Copy the required files

The documentation does not describe to copy the unpCommon server-side javascript library.

Step: Create XPage unpMain

When creating an application, if it is going to be used on Teamstudio Unplugged mobile devices then we recommend that the home XPage is called UnpMain. Otherwise you are free to name your XPage.

Step: Add UnpBootResources

Every XPage that will be opened by the end-user needs the UnpBootResources custom control added. This adds CSS, JavaScript and Server Side JavaScript to your application.

<unp:UnpBootResources></unp:UnpBootResources>

Step: Create a common application layout

To provide a common application layout the Common Header and Common Footer custom controls should be included in the XPages that are accessible by the end-user.

Common Header

In case you want the app to develop for Mobile and Desktop then add a UnpBootNavigator and UnpBootHeader.

  • UnpBootNavigator: for mobile (the so-called ‘hamburger’ menu).
  • UnpBootHeader for desktop.

Also define the navitems in UnpBootHeader.

<unp:UnpBootHeader title=”${javascript:return @DbTitle()}”>
<unp:this.navitems><![CDATA[#{javascript:[
{label: “All Entries”, hasSubMenu: false, page: “/UnpMain.xsp”, icon: “fa-database”},
{label: “By Category”, hasSubMenu: false, page: “/vwCategory.xsp”, icon: “fa-list”},
{label: “By Entry Date”, hasSubMenu: false, page: “/vwEntryDate.xsp”, icon: “fa-calendar”},
{label: “Trash”, hasSubMenu: false, page: “/vwTrash.xsp”, icon: “fa-trash-o”}
]}]]></unp:this.navitems>
</unp:UnpBootHeader>

unpl_header

<unp:UnpBootNavigator>
<unp:this.menuitems><![CDATA[#{javascript:[
{label: “All Entries”, hasSubMenu: false, page: “/UnpMain.xsp”, icon: “fa-database”},
{label: “By Category”, hasSubMenu: false, page: “/vwCategory.xsp”, icon: “fa-list”},
{label: “By Entry Date”, hasSubMenu: false, page: “/vwEntryDate.xsp”, icon: “fa-calendar”},
{label: “Trash”, hasSubMenu: false, page: “/vwTrash.xsp”, icon: “fa-trash-o”}
]}]]></unp:this.menuitems>
</unp:UnpBootNavigator>

unpl_navigator

Font Awesome

Font Awesome gives you scalable vector icons that can instantly be customized – size, color, drop shadow, and anything that can be done with the power of CSS. XControls supports Font Awesome icons everywhere.

As you can see in the code above Font Awesome is for example used in the common header.

Common Footer

In case you want to include synch (for when running on Unplugged) add the UnpBootFooter as the common footer. You can also apply tabs in the footer if desired.

<unp:UnpBootFooter synctype=”none”>
<unp:this.tabs><![CDATA[#{javascript:[
{label: “Google”, hasSubMenu: false, page: “http://www.google.com&#8221;, icon: “fa-google”},
{label: “Like us”, hasSubMenu: false, page: “http://www.facebook.com/infowaresweden&#8221;, icon: “fa-facebook”}
]}]]></unp:this.tabs>
</unp:UnpBootFooter>

unpl_footer

 

Best practice tip

Since you will place the application layout just created across multiple XPages it is wise to store them in re-usable custom controls e.g. commonheader and commonfooter.

Step: Create the first content list

In the navigation we have declared that the initial XPage shall contain the All Entries overview. This overview simply lists the documents in a flat structure. You can use the UnpBootFlatView custom control for this.

Apply wrappers

To layout the content according to the bootcards definition apply a wrapper for the content:

<div id=”main” class=”container bootcards-container”>
<div class=”row fullheightrow”>
<!– add your list –>
<div id=”doccontent” class=”col-sm-7 bootcards-cards hidden-xs”>
<!– add your initial content e.g. a card–>
</div>
</div>

In the dual pane UI the target for dropping card content will be the div with ID doccontent.

Apply a list

<unp:UnpBootFlatView viewname=”($All)” summarycolumn=”$52″
numberofrows=”20″ newlink=”entry.xsp” xpagedoc=”UnpMain.xsp”
title=”All Entries” ajaxload=”Yes”>
</unp:UnpBootFlatView>

A description for all the available properties for the UnpBootFlatview can be read here: link. Property xpagedoc defines the xpage to load documents with, by default this would be the same as the current XPage.

Below is the result (only 2 documents in the database at the moment):

unpl_list

 

Below is the result when clicking on the Add link:

unpl_newentry

The XPage entry.xsp will be opened in a dialog. For now entry.xsp contains an unconfigured Form Editor custom control only. As you can see this requires more work.

 

 

Apply a Form Viewer

A Form Viewer is a wrapper that allows you to display document data inside a card. I created a custom control named docviewer and placed a UnpBootFormViewer inside it and configured it as followed:

<unp:UnpBootFormViewer editxpagewithajax=”yes”
formname=”JournalEntry” title=”Notebook Entry”
titleiconfield=”thumbnail” showbuttons=”true”
editxpagename=”entry.xsp”>
<unp:this.footertext><![CDATA[#{javascript:var id = context.getUrlParameter(“documentId”);
if (id != “”){
var doc:NotesDocument = database.getDocumentByUNID(id);
if (doc !=null){
var date = doc.getLastModified();
return “Last modified: ” + date
}
}}]]></unp:this.footertext>
<xp:this.rendered><![CDATA[#{javascript:context.getUrlParameter(“documentId”) != “”}]]></xp:this.rendered>
<xp:this.facets>
<xp:panel id=”list-group” xp:key=”facet_1″ styleClass=”panel”>
<div class=”list-group”>
<div class=”list-group-item”>
<label>Subject</label>
<xp:text id=”subject” tagName=”h4″ styleClass=”list-group-item-heading”>
<xp:this.value><![CDATA[#{javascript:docview.getItemValueString(“Subject”)}]]></xp:this.value>
</xp:text>
</div>
<div class=”list-group-item”>
<xp:label value=”Category” id=”lblCategory” for=”category”></xp:label>
<xp:text tagName=”h4″ id=”category” value=”#{docview.Categories}” styleClass=”list-group-item-heading”></xp:text>
</div>
<div class=”list-group-item”>
<xp:label value=”Date” id=”lblDate” for=”date”></xp:label>
<xp:text tagName=”h4″ id=”date” value=”#{docview.DiaryDate}” styleClass=”list-group-item-heading”></xp:text>
</div>
<div class=”list-group-item”>
<xp:label value=”Content” id=”lblCnt” for=”content”></xp:label>
<xp:text tagName=”h4″ id=”content” value=”#{docview.Body}” styleClass=”list-group-item-heading” escape=”false”></xp:text>
</div>
</div>
</xp:panel>
</xp:this.facets>
</unp:UnpBootFormViewer>

Again the entry.xsp is set to offer the document in edit mode (in a dialog). It appears that docview is the representation of the document. If you want to use data from the document outside the facet e.g. in the card footer you seem not to be able to refer to docview.

Below is an example of a selected document from the list:

list_docview

If you select Edit the document is presented in a dialog via XPage entry.xsp which is still empty. Let’s work on that one right now!

Apply a Form Editor

A Form Editor is a wrapper into which you can insert form fields for creating and editing documents. Fields can include auto clearing, type ahead, date pickers, numbers and rich text.

Below is the code that I included in the Xpage entry.xsp which is shown in dialog boxes when editing or creating a new document:

<unp:UnpBootFormEditor showbuttons=”true”
viewxpagename=”UnpMain.xsp” title=”Entry” formname=”JournalEntry”
footertext=”You can use your Notebook as a diary, to store meeting minutes or status reports, or simply as a place to create and store draft documents until they are ready for publication.”>
<xp:this.facets>
<xp:panel xp:key=”facet_1″ id=”list-group”>
<div class=”form-group”>
<xp:label styleClass=”col-xs-4 control-label” for=”subject” value=”Subject”></xp:label>
<div class=”col-xs-8″>
<xp:inputText id=”subject” value=”#{docedit.subject}” styleClass=”form-control required”>
<xp:this.attrs>
<xp:attr name=”placeholder” value=”Subject”></xp:attr>
</xp:this.attrs>
</xp:inputText>
<a href=”” class=”bootcards-clearinput”>
<i class=”fa fa-lg fa-times-circle”></i>
</a>
</div>
</div>
<div class=”form-group”>
<xp:label value=”Date” id=”datetime_dairydatelabel” for=”dairydate”
styleClass=”col-xs-4 control-label”>
</xp:label>
<div class=”col-xs-8″>
<xp:inputText id=”dairydate”
styleClass=”form-control”>
<xp:this.attrs>
<xp:attr name=”datevalue”>
<xp:this.value><![CDATA[#{javascript:try{
var date:lotus.domino.local.DateTime = docedit.getItemValueDateTime(‘DiaryDate’);
return date.toJavaDate().getTime();
}catch(e){
return new Date().getTime();
}}]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
<xp:this.converter>
<xp:convertDateTime type=”date”
dateStyle=”short”>
</xp:convertDateTime>
</xp:this.converter>
</xp:inputText>

</div>
</div>
<div class=”form-group”>
<xp:label styleClass=”col-xs-4 control-label” for=”Categories” value=”Category”></xp:label>
<div class=”col-xs-8″>
<xp:inputText id=”Categories” value=”#{docedit.Categories}” styleClass=”form-control required”>
<xp:this.attrs>
<xp:attr name=”placeholder” value=”Category”></xp:attr>
</xp:this.attrs>
</xp:inputText>
<a href=”” class=”bootcards-clearinput”>
<i class=”fa fa-lg fa-times-circle”></i>
</a>
</div>
</div>
<div class=”form-group”>
<xp:label value=”Content” id=”biolabel” for=”content” styleClass=”col-xs-4 control-label”>
</xp:label>
<div class=”col-xs-8″>
<unp:UnpBootRichTextEditor fieldname=”Body”></unp:UnpBootRichTextEditor>
</div>
</div>
</xp:panel>
</xp:this.facets>
</unp:UnpBootFormEditor>

Notes:

  • For the viewxpagename property I have chosen the UnpMain.xsp Xpage, this is the XPage to open after saving the document. Normally this would be the same as the current XPage.
  • The date field is bound to a date-picker.
  • For the rich text field I included a UnpBootRichTextEditor custom control. This will give the field some edit options.

Below is an example of the result. As you can see I did not at so many bells & whistles to the form editor (yet) to improve usability:

unpl_newentrydate

Step: Create the categorized content list

Can you imagine a Notes application without a categorized view? Probably not. In XControls you seem to have 2 options:

  • A flat list.
  • An accordion list.

A flat list for categorization, really? If you bind the UnpBootFlatView custom control to a categorized view as in the example below, the categorized view will be displayed as a flat list, but with documents/entries grouped in the provided categories:

<unp:UnpBootFlatView title=”Entries By Category”
summarycolumn=”$52″ viewname=”By Category” numberofrows=”20″
ajaxload=”Yes” detailcolumn=”$44″ xpagedoc=”vwCategory.xsp”
newlink=”entry.xsp” footertext=”A Flat List but with Categories :-?”>
</unp:UnpBootFlatView>

Below is an example of the result:

unplflatlistcategorized

Accordion list

However, if you want to apply a collapsible Notes-a-like feature, you can choose the UnpBootAccordion custom control to provide an Accordion list.

<unp:UnpBootAccordionView title=”Dates” summarycolumn=”$39″
viewname=”By Diary Date” expandfirstcategory=”no” ajaxload=”Yes”
loaddocumenttarget=”doccontent” detailcolumn=”$44″
xpagedoc=”vwEntryDate.xsp” newdatatarget=”#editModal”
newlink=”entry.xsp”>
<unp:this.footertext><![CDATA[#{javascript:var date = @Date(@Today());
return “Today is: ” + date.toDateString()}]]></unp:this.footertext>
</unp:UnpBootAccordionView>

Below is an example of the result:

unplaccordion

The ‘categories’ are collapsible. Note that I had to modify the column value for the date: @Text(DiaryDate).

unplaccordioncollapsed

Summary

So far my initial review took. It seems fair enough to say that XControls enables you to deliver a dual pane cards-based UI for your Notes application without too much amount of development time.

I did explore many other features the framework offers (calendaring, carousels, charts) but it is definitely an OpenNTF project to keep an eye on. Especially if you are not capable of running a full blown solution like Worklight or you want to test early feedback for delivering existing Notes applications to mobile devices.

Developing social applications with the Social Business Toolkit SDK

Intro

The Social Business Toolkit SDK (SBT SDK) is a set of libraries and code samples that you use for connecting to the IBM Social Platform. As a developer you can choose which web development skills fits you best: Java, (client side) JavaScript or XPages. Your social platform may reside in the cloud or on premise.

In this post I will give you guidelines and practical examples to get you started. I choose XPages as development environment.

Terminology

In the document terms are thoroughly used:

Term Description
SBT Social Business Toolkit
SDK Software Development Kit
DDE Domino Designer on Eclipse
XPages XPages is a rapid web and mobile application development technology
OpenNTF Open Source Community for (IBM) Collaboration Solutions
OAuth Open standard for authorization
Managed Bean Java Beans representing system objects and resources
Endpoint Encapsulates the access to a service provider, like Connections or Sametime

Installation of the SDK

Prerequisites

Before you can start with development in Domino Designer on Eclipse you need to install the SBT SDK. It can be downloaded from the following address: http://ibmsbt.openntf.org/. The files you need to work with the SBT SDK and Domino are located in folder ‘redist\domino’ in the downloaded ZIP file.

Extension Library

Another condition to be able to run the Social SDK within your XPages you need to have installed the Extension Library, available on OpenNTF: http://extlib.openntf.org/. You need to have the library installed on both Domino server and DDE.

Installation for Domino Server

You can find a set of instructions how to install the SBT SDK on an IBM Domino server on the address:
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Social+Business+Toolkit+SDK+documentation#action=openDocument&res_title=Installing_on_Domino_Server_SDK1.0&content=pdcontent. I recommend the installation via an Eclipse Update site. As a result your Update site should display the following plugins:

Screenshot_4

 

Installation for DDE

The Domino Designer deployment of the IBM Social SDK can use the same imported update site from the Update Site NSF. On Domino Designer verify that the checkbox for “Enable Eclipse plugin install” is checked in the Domino Designer preferences. You can find a set of instructions how to install the SBT SDK on DDE on the same address:
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Social+Business+Toolkit+SDK+documentation#action=openDocument&res_title=Installing_on_Domino_Server_SDK1.0&content=pdcontent.

Setting up a Notes application

Create a new Notes application from scratch. I called mine ‘bornsocial.nsf’. Open the Xsp Properties file in DDE. Include the following libraries:

  • com.ibm.xsp.extlib.library
  • com.ibm.xsp.sbtsdk.library

Screenshot_5

 

Authentication

The Social Business Toolkit leverages a credential store for single sign on. For OAuth for example the user tokens are stored in this repository so that users don’t have to authenticate and grant access to services like IBM Connections for every session. The OAuth application tokens are also stored in this repository so that all tokens can be managed in one central place. You can read more on the credential store here: http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Social+Business+Toolkit+SDK+documentation#action=openDocument&res_title=Configuring_token_stores_SDK1.0&content=pdcontent&sa=true. And it is also explained in the following video: http://www.youtube.com/watch?v=2CWD70XarX8#t=100.

In basic: the implementation of the credential store is performed by the use of a managed bean. The usage of this credential store is then defined in an endpoint. An endpoint encapsulates the access to a service provider, like Connections or SameTime.

In the Package Explorer open the faces-config.xml file:

Screenshot_6

 

Add the following lines:

<!– Token Store memory implementation –>
<managed-bean>
<managed-bean-name>CredStore</managed-bean-name>
<managed-bean-class>com.ibm.sbt.security.credential.store.MemoryStore</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

<!– Password Store memory implementation –>
<managed-bean>
<managed-bean-name>PasswordStore</managed-bean-name>
<managed-bean-class>com.ibm.sbt.security.credential.store.MemoryStore</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

Endpoint

In the first example(s) we are only going to demonstrate to connect to IBM Connections. Add the following lines:

<managed-bean>
<managed-bean-name>connections</managed-bean-name>
<managed-bean-class>com.ibm.sbt.services.endpoints.ConnectionsBasicEndpoint</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>url</property-name>
<value>https://your-connections-url.com</value&gt;
</managed-property>
<managed-property>
<property-name>authenticationService</property-name>
<value>communities/service/atom/communities/all</value>
</managed-property>
<managed-property>
<property-name>authenticationPage</property-name>
<value>/bornsocial.nsf/_BasicLogin.xsp?endpoint=connections</value>
</managed-property>
</managed-bean>

For value of managed property ‘url’ you must enter the address of your connections installation or in case you are using IBM Greenhouse for demonstration purposes you can choose ‘https://greenhouse.lotus.com’.

Login page

A custom login page will presented when a user initially tries to connect to IBM Connections:

Screenshot_7

 

The elements for the login page are in the XPagesSBT.nsf application which comes with the SBT SDK. The nsf is located in folder redist\domino. The login page consists of the following design elements:

Name Type
_BasicLogin.xsp XPage
sbtLoginPage Custom Control
sbtLoginPanel Custom Control

You can simply copy the design elements from the sample application in your application and modify them e.g. for branding.

Connecting to Connections

Your application is now ready to connect to Connections. Where you place the code to connect to Connections is up to you. A recommended approach could be to establish connections via Managed Beans.A managed bean is nothing more fancy than a registered a JAVA object.

Managed Bean

In our first example we are going to read the content under My Files in Connections. These are the files that you have uploaded and shared.

  1. Create a new Java design element (Java Class).
  2. Enter the following code:

package com.quintessens.bornsocial.sbt;
import java.io.Serializable;
import com.ibm.sbt.services.client.connections.files.FileService;
import com.ibm.sbt.services.client.connections.files.FileServiceException;
import com.ibm.sbt.services.client.connections.files.FileList;

public class ServiceBean implements Serializable{
private static final long serialVersionUID = 1L;

public FileList getMyFiles() {
FileService service = new FileService();
try {
return service.getMyFiles();
} catch (FileServiceException e){
return null;
}
}
}

Code explanation

The function getMyFiles gets handle to the FileService object. Then the getMyFiles function is called to get all the files (both private and shared) the user has uploaded in Connections. Then a FileList object is returned to the caller.

The FileList object can then be used in a suitable XPage control e.g. the DataTable or the DataView control.

Registration

In order to access the Managed Bean you have to register it. This is done in the faces-config.xml file. Open the file and add the following lines:

 <managed-bean>
<managed-bean-name>ServiceBean</managed-bean-name>
<managed-bean-class>com.quintessens.bornsocial.sbt.ServiceBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

You will access the bean via its name ServiceBean.

XPages

Finally we have come to a point where we can display the files that the managed bean returns from IBM Connections. I have choosen the XPages environment to do so.

Custom Controls

A best practice in XPages development is to divide functionality in individual blocks known as Custom Controls. This make it easier to re-use the functionality across your application.

Custom Control for a ‘My Files’ overview

  • Create a new Custom Control design element.
  • Add the following code to the control:

<xe:widgetContainer id=”widgetContainer1″ itleBarText=”#{javascript:return compositeData.widgetTitle;}”>
<xp:panel>
<xe:dataView id=”dataView1″ var=”file” rows=”5″ columnTitles=”true” styleClass=”filesDataView”>
<xe:this.extraColumns>
<xe:viewExtraColumn columnTitle=”Filetype”></xe:viewExtraColumn>
<xe:viewExtraColumn columnTitle=”Created”></xe:viewExtraColumn>
<xe:viewExtraColumn columnTitle=”Size”></xe:viewExtraColumn>
</xe:this.extraColumns>

<xe:this.summaryColumn>
<xe:viewSummaryColumn columnTitle=”Filename”></xe:viewSummaryColumn>
</xe:this.summaryColumn>
<xp:this.value>
<![CDATA[#{javascript:ServiceBean.getMyFiles();}]]>
</xp:this.value>
<xp:this.facets>
<xp:panel xp:key=”noRows” id=”topicsPanel2″>
<xp:div styleClass=”lotusWidgetBody”>
<xp:text>
<xp:this.value>
<![CDATA[#{javascript:return (viewScope.myFilesAvailable ? “No files found.” : “My Files unavailable.”);}]]>
</xp:this.value>
</xp:text>
</xp:div>
</xp:panel>
<xp:panel id=”summaryPanel” xp:key=”summary” style=”width:50%;white-space:nowrap;”>
<h4><xp:link styleClass=”dataViewLink” escape=”true” id=”link7″ target=”_blank” text=”#{javascript:return file.getTitle();}”>
<xp:this.value><![CDATA[#{javascript:return file.getContentUrl();}]]></xp:this.value>
</xp:link></h4>
</xp:panel>
<xp:panel id=”typePanel” xp:key=”extra0″ style=”width: 20%;white-space:nowrap;”>
<xp:text>
<xp:this.value>
<![CDATA[#{javascript:return file.getType();}]]>
</xp:this.value>
</xp:text>
</xp:panel>
<xp:panel id=”sizePanel” xp:key=”extra2″ style=”width: 15%;white-space:nowrap;”>
<xp:text>
<xp:this.value>
<![CDATA[#{javascript:var size = file.getSize();
var kilobyte = 1024;
var megabyte = kilobyte *1024;
if(size < kilobyte) {
return (size + ” B”);
}else if(size < megabyte) {
return (Math.round(size/kilobyte) + ” KB”);
}else {
return (Math.round(size/megabyte) + ” MB”);
}}]]>
</xp:this.value>
</xp:text>
</xp:panel>
<xp:panel id=”panel1″ xp:key=”extra1″ style=”width: 15%;white-space:nowrap;”>
<xp:text escape=”true” id=”computedField3″ value=”#{javascript:file.getCreated()}”></xp:text>
</xp:panel>
</xp:this.facets>
</xe:dataView>
</xp:panel>
</xe:widgetContainer>

As a result the files in IBM Connections for the authenticated user will be listed e.g.:

Screenshot_8

 

Code explanation

The DataView control is using the getMyFiles function from Managed Bean ServiceBean for data binding:

Screenshot_9

<xe:dataView id=”dataView1″ var=”file” rows=”5″ columnTitles=”true” styleClass=”filesDataView”>
<xp:this.value><![CDATA[#{javascript:ServiceBean.getMyFiles();
}]]></xp:this.value>

</xe:dataView>

It iterates through the returned FileList object and for each column values from each entry in the ‘file’ collection the value is computed e.g.:

<xp:panel id=”summaryPanel” xp:key=”summary” style=”width:50%;white-space:nowrap;”>
<h4><xp:link styleClass=”dataViewLink” escape=”true” id=”link7″ target=”_blank” text=”#{javascript:return file.getTitle();}”>
<xp:this.value><![CDATA[#{javascript:return file.getContentUrl();}]]></xp:this.value>
</xp:link></h4>
</xp:panel>

API Explorer

Use the SBT API Explorer which method each object provides:

Screenshot_10

Link: http://greenhouse.lotus.com/llapiexplorer/.

Summary

As you have seen getting started with the Social Business Toolkit is not that difficult for XPages developers. As alternative you could also choose JavaScript or JAVA if those skills fit you better. The SDK will help you understanding Connections piece by piece from a developer perspective.

In the example information is read from Connections but you can also post data. The SDK allows you to create great ‘social enabled’ applications. This can be applications that solely work with Connections or integrate with other platforms e.g. IBM Notes.

I hope to write more on the Social Business Toolkit in another post. Thank you for reading.

Patrick Kwinten

 

Internationalization of the Pager controls

While translating an app for internationalization I noticed that Pager controls (e.g Pager Expand/Collapse, Pager Show/Hide Details)) were still default in English. So I wondered how you could translate them since they did not adapt to the selected language in my browser?

It turns out that a workable way is to set the text explicit in the controls first to your default application language:

Screenshot_1

 

Now they have become available for translation:

Screenshot_2

If you open the properties file for the XPage/Custom Control you can allocate the strings to translate:

Screenshot_3

 

The downsize to this approach is that you have to translate them for every design element you have the controls on. I assume this should not be the intention, so if you know the proper way, please let me know.

Update

pagerSizes

Paul Withers replied to my post how to set the pages in the pagerSizes control.

Screenshot_4

Here is a demo code:

<xe:pagerSizes id=”pagerSizes1″ for=”dataView1″ text=”Page {0}” />

In the properties file translate it accordingly e.g.

pagerSizes1/@text=Sida {0}

I am not sure how to set the ‘All’ text.

pager

The pager control you can also translate. A description you can find in the XPages Wiki maintained by Julian Buss.

 

Here is an example code:

<xp:pager partialRefresh=”true” id=”pager1″ for=”dataView1″ style=”padding-right:20px;”>
<xp:pagerControl type=”Previous” id=”pagerControl1″ value=”Previous”></xp:pagerControl>
<xp:pagerControl type=”Group” id=”pagerControl3″></xp:pagerControl>

<xp:pagerControl type=”Next” id=”pagerControl2″ value=”Next”></xp:pagerControl>
</xp:pager>

Again, translate the labels in the properties file accordingly.

Below is the result of the translation:

Screenshot_5

 

Tip of the day: isDocument() for nested data in the Data View control

You can show nested data in the details section of the Data View control. Read about it here: Data Views – Part 10: Nested Repeat in the Detail Section.

In case you have a ‘flat’ Data View (one without collapisble categories) you do not need to detect if your ‘var’ property is a document. But when you have a categorized Data View you better check it otherwise opening/closing categories will give an error…

Presentations from EntwicklerCamp 2014 – Track 2

Track Session Subject Download Presentation
Track2 Session1 IBM Connections http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/e76eba65a7777a5fc1257be200295cc3/$FILE/T2S1-IBM%20Connections.pdf
Track2 Session2 XPages und Connections http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/3ce43336a0c21017c1257be200295cb1/$FILE/T2S2-Xpages%20und%20Connections.pdf
Track2 Session3 iNotes deep dive http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/5aa8d31062adfd72c1257be200295ca9/$FILE/T2S3-iNotesDevPres.pdf
Track2 Session4 Notes Database Security – Analyse, Konzept und Techniken http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/fd4c7bc91a89f2c2c1257be200295c97/$FILE/T2S4%20Notes%20Database%20Security.pdf
Track2 Session5 XPages und Java http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/eaa095462aa6e95cc1257be200295cb9/$FILE/T2S5-XPages_und_Java_2014.pdf
Track2 Session6 Einsatz von Resource-Bundles am Beispiel der Realisierung von Mehrsprachigkeit und flexibler Menüstrukturen der XPage-Applikation. Managed Beans http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/ee334362683c38f4c1257be200295cb8/$FILE/T2S6-ResourceBundles.pdf
Track2 Session7 iNotes http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/ba851a9f69b08b99c1257be200295cbb/$FILE/T2S7-iNotesXPagesDevPres.pdf
Track2 Session8 WebServices und REST http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/4dd3a39f66807004c1257be200295cbd/$FILE/T2S8-XPages_WebServices_und_REST.pdf

Presentations from EntwicklerCamp 2014 – Track 1

Track Session Subject Download Presentation
Track1 Session1 XPages – 1 – Notes-Daten auf das Smartphone oder Tablet – Datenaustausch zwischen nativen mobilen Anwendungen und Domino mit Hilfe von XPage http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/8138c341016c7bd7c1257be200295caa/$FILE/T1S1-Notes-Daten-1.pdf
Track1 Session2 XPages – 1 – Notes-Daten auf das Smartphone oder Tablet – Datenaustausch zwischen nativen mobilen Anwendungen und Domino mit Hilfe von XPage http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/79e482848e630069c1257be200295cc2/$FILE/T1S2-Fehlerbehandlung%20in%20Notes.pdf
Track1 Session3 XPages – 3 – Schick mit Grid – DataGrids in XPages http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/2c36b5afac8bdf4dc1257be200295cbc/$FILE/T1S3-SchickMitGrid.pdf
Track1 Session4 Notes-Daten auf das Smartphone oder Tablet – konkrete Code-Beispiele und Erfahrungen aus echten Projekten http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/d42e0cf2eb36d7f2c1257be200295cae/$FILE/T1S4-Notes-Daten-2.pdf
Track1 Session5 Domino Designer – Tips, Tricks and Enhancements for Maximum Productivity! http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/ac0e74d455d9a323c1257be200295cb0/$FILE/T1S5-Designer%20EntwicklerCamp%202014.pdf
Track1 Session6 Composit apps – Fange ich noch an? http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/6ca59f95e7f3d483c1257be200295cbe/$FILE/T1S6-CompositApps-fange-ich-noch-an-Anleitung.pdf
http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/6ca59f95e7f3d483c1257be200295cbe/$FILE/T1S6-CompositApps-fange-ich-noch-an.pdf
http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/6ca59f95e7f3d483c1257be200295cbe/$FILE/T1S6-CompositApps-fange-ich-noch-an-Beispiel2.pdf
http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/6ca59f95e7f3d483c1257be200295cbe/$FILE/T1S6-CompositApps-fange-ich-noch-an-Beispiel1.pdf
Track1 Session7 Sicherheit in Notes (Anwendungen) http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/7993118a31677646c1257be200295caf/$FILE/T1S7-Sicherheit%20in%20der%20Notes%20Entwicklung.pdf
Track1 Session8 dynamisches Maskendesign http://www.entwicklercamp.de/konferenz/ent2014.nsf/bc36cf8d512621e0c1256f870073e627/2bd25c7c9c26a652c1257be200295cc4/$FILE/T1S8-DynamischesMaskendesign-V2.pdf

Demo of the Single Page Application Wizard control

You can bring a IBM Notes application without much work to the web browser via the Notes Browser plugin. But since Mobile is the standard nowadays that plugin seems to be obsolete almost. So what other options do you have for your enterprise apps?

  • You can introduce a mobile application platform, if you have the time and the money.
  • You can migrate your whole collaboration platform in exchange for something less, similar or not similar at all. And prey for mobile tools on that platform.
  • You can rewrite your apps and deliver them with the help of frameworks as mobile web application or in between solution.

Or… you save yourself the time & bucks and install the Extension Library version that contains the Single Page Application wizard from OpenNTF.

I have made a video in which I demonstrate how to mobilize the fakenames application in a couple of minutes. First I will describe the wizard and how the process for mobilizing an app looks like. Then I demonstrate the actual development which will take about 8 1/2 minutes.

Update – watch on Vimeo

Video on Vimeo: http://vimeo.com/99537780 in case you experience the message ‘This video is not available in your country’.

Youtube

Enjoy the video!

In case you want to contact me on mobilizing your Notes app, just send me an email.