|
1 /* |
|
2 * CDDL HEADER START |
|
3 * |
|
4 * The contents of this file are subject to the terms of the |
|
5 * Common Development and Distribution License (the "License"). |
|
6 * You may not use this file except in compliance with the License. |
|
7 * |
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 * or http://www.opensolaris.org/os/licensing. |
|
10 * See the License for the specific language governing permissions |
|
11 * and limitations under the License. |
|
12 * |
|
13 * When distributing Covered Code, include this CDDL HEADER in each |
|
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 * If applicable, add the following below this CDDL HEADER, with the |
|
16 * fields enclosed by brackets "[]" replaced with your own identifying |
|
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 * |
|
19 * CDDL HEADER END |
|
20 */ |
|
21 |
|
22 /* |
|
23 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
|
24 */ |
|
25 |
|
26 package com.oracle.solaris.vp.panels.browser.client.swing; |
|
27 |
|
28 import java.util.Map; |
|
29 import com.oracle.solaris.vp.panel.common.control.*; |
|
30 import com.oracle.solaris.vp.panel.swing.control.SwingControl; |
|
31 import com.oracle.solaris.vp.util.misc.finder.Finder; |
|
32 |
|
33 public class PanelControl |
|
34 extends SwingControl<BrowserPanelDescriptor, PanelPanel> { |
|
35 |
|
36 /* |
|
37 * Static data |
|
38 */ |
|
39 |
|
40 public static final String ID = "panel"; |
|
41 public static final String PARAM_PANEL = "panel"; |
|
42 private static final String NAME = Finder.getString("browser.panel.title"); |
|
43 |
|
44 /* |
|
45 * Instance data |
|
46 */ |
|
47 private PanelManagedObject panel_ = null; |
|
48 |
|
49 /* |
|
50 * Constructors |
|
51 */ |
|
52 |
|
53 public PanelControl(BrowserPanelDescriptor descriptor) |
|
54 { |
|
55 super(ID, NAME, descriptor); |
|
56 } |
|
57 |
|
58 // |
|
59 // Control methods |
|
60 // |
|
61 |
|
62 @Override |
|
63 public boolean isBrowsable() { |
|
64 // This Control requires init parameters |
|
65 return false; |
|
66 } |
|
67 |
|
68 @Override |
|
69 public void start(Navigator navigator, Map<String, String> parameters) |
|
70 throws NavigationAbortedException, InvalidParameterException, |
|
71 NavigationFailedException { |
|
72 |
|
73 String param = getParameter(parameters, PARAM_PANEL); |
|
74 |
|
75 PanelManagedObject panel = getPanelDescriptor().getPanel(param); |
|
76 if (panel == null) |
|
77 throw new InvalidParameterException(getId(), PARAM_PANEL, param); |
|
78 |
|
79 panel_ = panel; |
|
80 setName(panel.getName()); |
|
81 |
|
82 super.start(navigator, parameters); |
|
83 } |
|
84 |
|
85 @Override |
|
86 public void stop(boolean isCancel) throws NavigationAbortedException { |
|
87 super.stop(isCancel); |
|
88 |
|
89 panel_ = null; |
|
90 } |
|
91 |
|
92 /* |
|
93 * SwingControl methods |
|
94 */ |
|
95 |
|
96 @Override |
|
97 protected PanelPanel createComponent() |
|
98 { |
|
99 return (new PanelPanel()); |
|
100 } |
|
101 |
|
102 @Override |
|
103 protected void initComponent() |
|
104 { |
|
105 getComponent().init(panel_); |
|
106 } |
|
107 |
|
108 public PanelManagedObject getManagedObject() |
|
109 { |
|
110 return (panel_); |
|
111 } |
|
112 } |