View Javadoc

1   /***
2    * 
3    */
4   package org.telscenter.pas.authortool.cards.help;
5   
6   import java.awt.BorderLayout;
7   import java.net.MalformedURLException;
8   import java.net.URL;
9   
10  import javax.swing.BorderFactory;
11  import javax.swing.JComponent;
12  import javax.swing.JMenu;
13  import javax.swing.JPanel;
14  
15  import org.telscenter.pas.authortool.cards.AbstractCurnitAuthoringCard;
16  import org.telscenter.pas.authortool.common.colors.PasColors;
17  import org.telscenter.pas.authortool.context.CurnitAuthoringContext;
18  import org.telscenter.pas.ui.browser.BrowserFactory;
19  import org.telscenter.pas.ui.browser.BrowserFactoryRegistry;
20  import org.telscenter.pas.ui.browser.IBrowser;
21  
22  /***
23   * @author aperritano
24   *
25   */
26  public class HelpCard extends AbstractCurnitAuthoringCard {
27  
28  	public HelpCard(
29  			final CurnitAuthoringContext curnitAuthoringContext) {
30  		super(curnitAuthoringContext);
31  	}
32  	
33  	/* (non-Javadoc)
34  	 * @see org.telscenter.pas.authortool.cards.AbstractCurnitAuthoringCard#createContentArea()
35  	 */
36  	@Override
37  	protected JComponent createContentArea() {
38  		return createMainLayout();
39  	}
40  
41  
42  	
43  	protected JComponent createMainLayout() {
44  		final JPanel pane = new JPanel();
45  
46  		final JPanel mainPanel = new JPanel(new BorderLayout(0, 0));
47  		mainPanel.setBorder(BorderFactory.createLineBorder(
48  				PasColors.pasCardMainPanelBorderColor, 2));
49  
50  		String docUrlStr = "http://www.telscenter.org/confluence/display/PAS/Pas+Authoring+Basics";
51  
52  		BrowserFactory browserFactory = BrowserFactoryRegistry
53  				.getBestFactory();
54  		IBrowser browser = browserFactory.getBrowser();
55  
56  		try {
57  			browser.setUrl(new URL(docUrlStr));
58  		} catch (MalformedURLException e) {
59  			// TODO Auto-generated catch block
60  			e.printStackTrace();
61  		}
62  
63  		mainPanel.add(browser.getComponent(), BorderLayout.CENTER);
64  		mainPanel.setBackground(PasColors.pasCardMainPanelBackgroundColor);
65  
66  		final JPanel t = new JPanel(new BorderLayout(0, 0));
67  		t.add(mainPanel, BorderLayout.CENTER);
68  		t.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
69  		t.setOpaque(false);
70  		return t;
71  	}
72  
73  	/* (non-Javadoc)
74  	 * @see org.telscenter.pas.authortool.cards.AbstractCurnitAuthoringCard#getTitle()
75  	 */
76  	@Override
77  	protected String getTitle() {
78  		return "Live Help System";
79  	}
80  
81  	@Override
82  	public JMenu getMenu() {
83  		return null;
84  	}
85  
86  }