Sunday, October 14, 2012

How to turn a Notes View into a Widget: It's easy, but not always as easy as you may think.

The other day IBM Tech Support showed me a cool, maybe undocumented feature of Notes 8.5.x. The following day I discovered a useful application of the feature. For my reader who doesn't have time to read my witty and snappily written (but, okay, long-winded) prose below, the short (two-sentence) version of this post is (so as not to spoil it for my other reader) at the very end of this post.

You may know that the personal productivity Notes apps (mail, calendar, to-do, contacts, notebook) are composite apps. That means the pieces of them that appear on screen (navigation pane, views, forms) are written as "components" that  can be rearranged on screen and wired up to work with each other in custom ways using the Composite Application Editor. The Composite App Editor is available (if installed) when a composite app is open on screen. Get to it in the Actions menu by clicking Edit Application. One of the nice aspects of composite apps is that they aren't confined to running in Notes. Each component can potentially be combined with any other component (whether originally intended ro work together or not) and can be run in other Eclipse-based containers or in WebSphere Portal.

All this only works in Notes when it is running in Standard Mode. In Basic Mode, these apps are plain old Notes apps, like any other. That means, of course, that much of the code underlying the new functionality is written in Java. And when something goes wrong in Notes these days, it's almost always a Java-driven piece of the product that goes haywire. (The C++ code, having been around and debugged since the beginning of time, is pretty rock solid in Notes. The Java code, into which Notes was cradled starting in version 8.0, has a way to go before the significant bugs get worked out of it.)

Anyway, I was on the phone with IBM Tech Support (a great, extremely helpful bunch of people, by the way) and we needed to know if a problem we were troubleshooting was in the Java or C++ portion of the product. To find out, we had to go to Basic Mode. If the problem continued to rear its ugly head, we would know to look for it not in the Java code but on the C++ side. Normally, you get into Basic Mode by restarting Notes, appending either the -sa or -basic command line argument. (I guess nobody (including me) could remember "-sa" (because, like, who knows what "sa" stands for?), so later they added "-basic". Thank you, IBM, very much.)

Restart Notes, kind of a hassle. But the Tech Support guy clued me in to a neat trick. Instead of restarting all of Notes, you can leave Notes running in Standard Mode and just start an individual application in Basic Mode by holding down Ctrl+Alt while clicking the app in the Start List. Whoa! Too Cool! (I'm pretty geeky. This made my day.)

So, we did that and, of course, the problem disappeared. Like I said, Notes problems these days occur in the Java code, not the rock solid C++ code. End of that story.

The following day I discovered how this trick could come in handy with respect to Widgets, yet another nice, Java-based feature that appeared in Notes in, er, Notes 8.0.1, I think. The Widget app is a Notes Sidebar app. Non-running widgets appear there as tiles or in a list. When you run a widget, it opens in one of several places: in the Sidebar, in a tab on the main portion of the Notes app, or in its own window. Nice versatility, that. One of the sweet, stupidly easy things you can do with Widgets is turn any Notes view into a widget. (Well, almost any view - keep reading)

I had been having a dialog with my friend Dan about some Notes limitations that he had been experiencing. He had been getting pretty fed up by Notes and was saying things like "Notes has a really crappy search tool" and "Notes isn't very customizable", to which, to his surprise, I answered "Are you kidding? Notes has great search functionality" and "Are you kidding? Note is fabulously customizable."

One of the things Dan complained about was that the scrolling was way too slow when he wanted to file an email. It turns out I couldn't help him speed up the scrolling. It's a known issue when a Notes Mail database (running in Standard Mode) has more than, say, 200-250 folders, that scrolling slo-o-ws down. So, as a workaround, Dan wanted to close the mini-view window in the lower left of his Notes screen, so that he could maximize his folder pane to reveal more of his (insanely huge number of) folders. But he also uses the Follow Up mini view to keep track of things he needs to get done. So I pointed out that he could use the regular follow-up view. To which he replied that he needs it visible all the time, not hidden amongst the tabbed views.

That's when it occurred to me that he could turn the Follow Up view (the big one, not the mini-view) into a widget. And that's when I discovered that NOT all views can become widgets with stupid ease. Views configured as Components cannot be easily turned into standalone widgets. And that's when I realized that the Ctrl+Alt trick might come in handy.

Okay, so I wanted to turn Dan's Follow Up view into a widget that could appear in his right sidebar OR in a little window anywhere on his screen that suited Dan. When I say "stupidly easy", here's what I mean: To turn a Notes view into a widget, you open the view, click the "Configure a widget from Current Context" icon in the Toolbar (or use the menu), select "Open this view", and click OK.

(Life will never get easier than that. When it does, it will be because I, Robot, am running things now and you humans can just sit back and suck your thumbs.)

But when I tried to make a widget out of the Follow Up view, the dialog box didn't offer to "Open this view". Instead, I could "Just configure a widget for now" or "Wire as an action". Neither option actually caused the view to appear in a widget window. Arrgh! I had to scratch my head for awhile before I realized why. Luckily, the cause and solution dawned on me before the headscratching drew blood from my thinning scalp.

In a Composite App such as Notes Mail, views are not really views like they are in regular Notes apps. They are Components. Because I was trying to turn a Component into a widget, I was getting a whole other, not very useful set of choices than I expected.

But, wait! What if I open Notes Mail in Basic Mode? Would I be able to turn the Follow Up view into a widget then? The answer, to make this long story less long, is YES. Worked like a charm.

So, to recap:

  1. You can open a composite app like Notes Mail in Basic Mode when Notes is still running in Standard Mode by pressing Ctrl+Alt while clicking the app's link in the Open List.
  2. You can turn a view in a composite app like Notes Mail into a widget by first opening the app in Basic Mode as in #1, then clicking the "Configure a Widget from Current Context" icon in the Toolbar, selecting "Open this view", and clicking OK.

Pretty cool, nay?