Blog Entry
I had a few questions over the past few weeks and figured it was time to do some scripting tips again. From time to time you need a little more advanced right-click scripts for the Novell Operations Console. One of my past blogs was about creating right-clicks that launched GUI’s (http://www.novell.com/communities/node/12429/novel...). This potentially adds upon that idea by allowing the right-click to launch other specific console windows (IE: alarms, properties, etc).
The first one we will discuss is the properties window. When you right-click on an element, one of the menu options is: Properties. A new window pops up and shows you specific details about the selected element. If you are running within a clientscript right-click operation, you can call the following code fragment below to cause this properties window to show up.
element.showProperties()
The next one is around the alarms. By using the fragment below, it is equivalent to right-clicking on an element and selecting New, Alarms Window.
element.showAlarms()
The last one is around Performance and like the alarms one, it is equivalent to right-clicking on an element and selecting New, Performance Window.
element.showPerformance()
The next topic in scripting I will cover is around making the console jumping from element to element and/or switch from view to view. In the past it has been referred to as a slide show. Think of the LCD hanging on the wall in a common area and you would like the console to switch through some different views.
The first function below is the way to cause the browser to jump from one element to another element. It requires a special element to be sent to it, not a standard element you would get from formula.Root.findElement().
function switchToElement(targetElement, boolVal)
{
Packages.javax.swing.SwingUtilities.invokeAndWait
(
new java.lang.Runnable()
{
run: function()
{
main.mainFrame.getCurrentContentView().fireElementOpened( targetElement, boolVal);
}
}
)
}
The next function is the way to have the view on the current element to switch, for example, from the Summary view to the Layout view, or alarm view.
function switchToView(targetViewName)
{
Packages.javax.swing.SwingUtilities.invokeAndWait
(
new java.lang.Runnable()
{
run: function()
{
main.mainFrame.getTopBrowser().switchToView(targetViewName)
}
}
)
}
The last block of code is the way to drive it. First thing we need to do is do the findElement based on a dname. You could set this up in a while loop with an array of dnames and have a sleep in between element jumps. It would be safer to put this in a try/catch block in case an element goes away for some reason.
fndElement = elementManager.findElement( "root=Elements" ); switchToElement( fndElement, true );
The other thing you might want to do for that hallway LCD slide show is to show a specific type of view per element view. So right after switching to an element, you may want specific views to be used for that particular view. In one case it might be the network view for element A, but for element B, you might want to show an alarms window. The code below is the way to do transition through the view. Of course you would probably only have one of these per element, but you could do more than one, it would just need a sleep in between switchToView().
switchToView( "Layout" ); switchToView( "Alarms" ); switchToView( "Performance" ); switchToView( "Network" ); switchToView( "Portal" ); switchToView( "Summary" );
That concludes the scripting tricks for this blog. Feel free to leave some comments on the usefulness of these blogs and/or requests for specific topics.
Tobin
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
- tisenberg's blog
- Be the first to comment! To leave a comment you need to Login or Register
- 2610 reads


0