Learning XPages Part 14 : Applying OneUI To The Locations List

In the last part of the series me managed
to get the data from a view to appear in our sidebar menu by using a repeat.
It didn’t look great so we now need to style it with the OneUI css to make
it look nice for the end user.

After reviewing the OneUI CSS I found
that there were a couple of different ways that I could do this.  I
could create my menu as an unordered list by adding in the <ul> and
<li> tags in the correct places in the XPages source like this

A picture named M2

Notice how the <UL> tags are outside
the repeat and the <li> tags are inside the repeat. This is a great
example of how you can use a repeat with multiple components or controls
inside of it. While the unordered list format might be ideal I decided
to go with a different OneUI look that I found in the defaulttheme.css
file. and that is the <h3> tag. This produces a nice large menu option
that the user can select. So in the code above, remove those <ul>
tags and change the <li> tags to <h3> and save and refresh.

A picture named M3

Looks much nicer now.

We are going to leave the sidebar menu
for the moment and come back to it in a later part once we have created
something for it to link to. In the next part we are going to add some
data to the main contents area.

Tagged with: , , ,
Posted in None

Learning XPages Part 13 : Listing The Locations In The Sidebar

So our new custom control is ready and
is embedded in the layout, now comes the fun part, making it display some
real data from the backend domino database. This list of locations is like
the main menu in our application so I’m going to style it using OneUI and
then show you how to use a repeat control to display the list of locations.

Lets start by opening our sb_LocationsList
custom control again. Get rid of the placeholder text and drag over THREE,
yes 3, nested panels, you’ll need to give each of these panels a styleclass
in the following order : lotusMenu, lotusBottomCorner, and lotusInner.
Your current XPages code should look something like this :

A picture named M2

and if you save and refresh your page
you should now see the basic menu layout appearing in your sidebar.

A picture named M3

Lets add some content using one of the
most powerful features of XPages. The Repeat Control. The repeat control,
as it’s name implies, allows you to repeat whatever is inside the repeat
control any number of times. You can have a single control inside the repeat
control, you can have multiple controls inside a repeat control, you can
have custom controls inside and repeat control and you can even have repeat
controls inside repeat controls. Once you start working with repeat controls
you will NEVER go back to traditional Domino web application design, in
just minutes to you build part of your web application when it would have
taken days worth of view design, LotusScript and debugging the old way.

We are going to be repeating information
from one of the views that I created in the database so we need to tell
the XPage where to find the data. To do this we first need to define a
data source. If you look at the outline for the XPage on the left side
of your screen you will see one of the outline entries called ‘Custom Control’,
if we were dealing with an actual XPage then this would say ‘XPage’. They
are both the same. Select it and you’ll see the properties for the XPage/Control.

A picture named M4

A picture named M5

We are going to add a new data source
based on a domino view. Select the ADD button and select Domino View to
get started. A new section will appear to the right of the datasources
properties box where you can select the view that you want to use.

A picture named M6

I have select the Locations lookup view
that I created and I have called my data source DominoView.

Now drag in a repeat control from the
control pane on the right of the screen into the panels that we created
earlier and then drag a computed field control into the repeat control.
We’ll just use the computed field control to explain how to use the repeat,
in the next part we’ll replace it with something a bit nicer that fits
in with the menu style.

Go back to the repeat control so you
can see it’s properties, it may already have the binding source listed,
we then need to add in some extra options so we can get to the data source.

A picture named M7

The collection name is the variable
that we can use to get to the documents and the index name is a count of
the current entry. We are just going to be using rowData for this example
of the repeat control.

Now click on the computed field and
look at it’s value properties. we are going to bind the data using JavaScript
so click the JavaScript radio button and then click on the button to bring
up the editor. Here’s the JavaScript we are going to use :

rowData.getColumnValue("Location")

rowData is the collection name we defined
in the repeat control’s properties and getColumnValue is exactly like the
lotusScript method that you can use on a NotesViewEntry.

Save and refresh the page and you should
see something similar to this depending on what data you have in your database.

A picture named M8

As you can see it does not look great
yet so in the next part we will tidy it up and make if look more useful
even though it does not link to anything yet.

Tagged with: , , , , ,
Posted in None

Learning XPages Part 12 : Preparing Our First Sidebar Widget

Now that we have the main look and feel
of our XPages Phonebook application done it is time to start showing some
actual data on the XPage. From my own experience I have found that it is
easier to get the data displaying on the XPage before linking it to other
XPages so right now we are going work on adding our first component to
the sidebar on the left of the screen.

We will start by going to the custom
controls view in the Domino Designer and creating a NEW custom control.
While we could write our code directly into the layout_LeftSidebar control
the choice to use a new Custom Control means that we have more control
over when it appears in the sidebar and by breaking the application down
into smaller parts you can easily reuse parts in other applications. I
have called my new custom control sb_LocationsList, This naming convention
tells me that it is something that goes in a sidebar.

Once you have created the new custom
control just add some placeholder text save it and then open up the layout_LeftSideBar
custom control so we can embed our new custom control inside of it. To
put the custom control into the sidebar you just drag it from the custom
controls pane on the right side of your screen to where you want it in
the sidebar. You will need to pop into the source view to make sure it
is between the div’s that we created earlier. Here’s what my final layout_LeftSidebar
looks like :

A picture named M2

Now when we save and preview our site
we’ll see the placeholder text from inside the sb_LocationsList appearing
instead of the original placeholder text from the layout_LeftSideBar.

A picture named M3

In the next part we will replace the
placeholder text with a real list of locations

Tagged with: , , , , ,
Posted in None

Learning XPages Part 10 : Finalizing The Footer

Before we move onto to real content for
the phonebook application I am going to jump down to the footer section
and finish that off quickly. The footer, according to the OneUI guidelines,
is a place for links to online support and contact information however
my personal preference that that it should be kept as simple as possible.
Because this application will eventually be released on OpenNTF I’m going
to just put in a small piece of text that reads ‘An OpenNTF project by
Declan Lynch’. and I’ll link the word OpenNTF to their website.

Lets start by opening the layout_Footer
custom control that we built earlier and drag in a few panels, as usual
the first panel will have a styleclass of ‘lotusRightCorner’ and the second
panel will be nested inside the first panel and will have a styleclass
of ‘lotusInner’. Then we can just type our text directly into the inner
panel, Save and Preview.

A picture named M2

Looks ok so far but I’d much prefer
it on the right side of the footer so lets add a styleclass to the text.
The styleclass I’m going to use is called ‘lotusRight’ and it is setup
in the CSS to float anything with this style over to the right of the screen.
Select the text in your XPage and look at the all properties view and just
add the styleclass. If you look at the XPage source now you’ll see that
the text has been moved into a <span> tag and the selected class
is showing.

A picture named M3

If you save and preview your XPage now
you’ll see the text jump over to the far side of the screen.

A picture named M4

The last thing to do is convert the
word OpenNTF into a link. We start by dragging in link control from the
controls pane to where we want the link to appear and then delete the original
OpenNTF text. If we click on the link to get to the properties we can fill
in the label as OpenNTF and the URL as http://www.openntf.org. It’s a simple
link so we don’t need to compute anything. if we save and close right now
things will look a little weird in the browser, the ‘link’ will be back
over on the left side of the screen because we didn’t give it a styleclass
of lotusRight

A picture named M5

The reason for this is beacuse the SPAN
has been broken into two seperate parts, one before the link and one after
the link and also because the link does not have any styleclass. A quick
way to fix this would be to go into the XPage source view and remove the
extra span tags that XPages designer has added in for you that I have highlighted
below. You’ll also need to add in some spacing around the link’s title.

A picture named M6

Once that’s done you can save and preview
your XPage and you’ll see our nice new footer :

A picture named M7

In the next part we will start working
on some domino forms so we can enter in some details to display in the
xpage.

Tagged with: , , , ,
Posted in None
Archives