Homepage & Status Panel Examples

I'd like to create a homepage and status panel for my module and could use guidance. I noticed that the Programmer's Guide mentions example projects ...

... but I can't seem to locate any examples in the SDK example projects. Looking through Wicket's page, I'm a bit overwhelmed as to where to begin, what specifically to be looking for, etc. Could someone direct me to a good example, be it in the SDK example projects or elsewhere?

Thanks!

Welp, I took a stab at it .. didn't have any success though ..

I created ModuleWebPanel which extends Panel ...

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;

public class ModuleWebPanel extends Panel {

	private static final long serialVersionUID = 1L;

	public ModuleWebPanel(String id) {
		super(id);
		add(new Label("message", "Hello World!"));
	}
}

I created ModuleWebPanel.html ...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.sourceforge.net/">
	<body>
		<wicket:panel>
			<div class='homepage-item'>
				<span wicket:id="message">Messages goes here</span>
			</div>
		</wicket:panel>
	</body>
</html>

I created ModuleHomepagePanelDescriptor which extends AbstractHomepagePanelDescriptor ...

import org.apache.wicket.markup.html.panel.Panel;
import com.inductiveautomation.ignition.gateway.model.AbstractHomepagePanelDescriptor;

public class ModuleHomepagePanelDescriptor extends AbstractHomepagePanelDescriptor {

	public ModuleHomepagePanelDescriptor() {
		super(ModuleWebPanel.class.getSimpleName(), 
		      ModuleWebPanel.class.getSimpleName(), 
		      1);
	}
	
	public Panel newPanel(String id) {
		return new ModuleWebPanel(id);
	}
}

I've got the following in my class that extends AbstractGatewayModuleHook ...

@Override
public List<? extends IHomepagePanelDescriptor> getHomepagePanels()
    {
	    return Arrays.asList(new ModuleHomepagePanelDescriptor());
    }

When I build and deploy, I get the following error logged ...

I've confirmed that the ModuleWebPanel.html resides next to ModuleWebPanel.class within the .jar within the .modl.

.. that's about as far as my Google-fu can take me tonight :slight_smile:

Well, first of all, nice job - you got it all 100% right. (Wicket has a bit of a learning curve, it’s true)

I copied and pasted your code into mine and guess what - everything worked great! Triple check for type-o’s in the names of your *.java and *.html files. Not sure how far along you are on other stuff, but you could zip up your whole eclipse project folder and send it to us if you’d like.

Definitely, I barely understand some of the code I wrote above :slight_smile:

I've sent an email titled "RE: Module Developers Forum Post #7630" to the support email with my project attached .. chopped out some stuff so the attachment wasn't monstrous, (I've detailed what within the email). We haven't done much at all with the project so it shouldn't be hard to find where everything is.

Appreciate the help, thanks!

Success! Looks like it was developer error, had my line within getHomepagePanels() commented out!

So, my next question … what’s with the text? :slight_smile: I’ve actually noticed this on the Configure page when I had the OEE module installed, (the heading within the left pane). I’m using Google Chrome to access these pages.

That’s what happens when the system is looking for a localization bundle key that doesn’t exist.

The constructor of AbstractHomepagePanelDescriptor expects you to give it a bundle key for the title. You’re passing it “ModuleWebPanel.class.getSimpleName()” for both the panel id and the title. When it can’t find the key, it returns the passed in value with question marks around it (which doesn’t always render very attractively).

The solution is to set up a localization bundle for your project. Check out “Localization” under Getting Started>Key Concepts in the programmer’s guide, and let me know if you still have questions after that.

Regards,

The Programmer’s Guide says “To aid with the translation process, Inductive Automation is developing a translation toolkit and localization portal that will be available to module developers by the 3rd quarter of 2011.” Is this available? I looked around on the Inductive site, but couldn’t find anything more on it.

Did we say that? When will I learn not to put timeframes on things… :laughing:

So, it’s halfway there. The “toolkit” consists of: python scripts to manage property files, a web interface/web service for loading them to the tool, and then the translation tool itself. Of these, the scripts and the tool do exist, but only for Ignition itself right now. We’ll have to do some work before they’re available to module authors, though I would like to get to this soon.

In the mean time, I’ve added you to the Localization group, so you can see what the tool looks like (you should now be able to see the localization forum, which has info on how to get to it).

Regards,

I’m glad I’m not the only one who gets caught up with timeframes :slight_smile: I’ll take a look around the Localization stuff and am sure I’ll have more questions. Thanks!

So how would I access / view this page? It doesn’t seem to show up at anywhere automatically do I have to somehow add a menu?
Sorry for the old bump