|
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) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
|
24 */ |
|
25 |
|
26 package com.oracle.solaris.vp.panel.swing.smf; |
|
27 |
|
28 import java.awt.EventQueue; |
|
29 import java.util.*; |
|
30 import com.oracle.solaris.vp.panel.common.api.smf_old.Dependency; |
|
31 import com.oracle.solaris.vp.panel.common.action.StructuredAction; |
|
32 import com.oracle.solaris.vp.panel.common.model.ManagedObject; |
|
33 import com.oracle.solaris.vp.panel.common.smf.*; |
|
34 import com.oracle.solaris.vp.panel.common.smf.depend.*; |
|
35 import com.oracle.solaris.vp.panel.swing.view.TreeTableObjectsPanel; |
|
36 import com.oracle.solaris.vp.util.common.propinfo.PropInfo; |
|
37 import com.oracle.solaris.vp.util.misc.finder.Finder; |
|
38 |
|
39 public class SmfDependenciesPanel extends TreeTableObjectsPanel { |
|
40 // |
|
41 // Instance data |
|
42 // |
|
43 |
|
44 @SuppressWarnings({"unchecked"}) |
|
45 private static final PropInfo<ManagedObject, ?>[] props = |
|
46 new PropInfo[] { |
|
47 new DepNamePropInfo(), |
|
48 new DepTypePropInfo(), |
|
49 new DepStatePropInfo() |
|
50 }; |
|
51 |
|
52 private DependenciesModel dModel; |
|
53 |
|
54 |
|
55 // |
|
56 // Constructors |
|
57 // |
|
58 |
|
59 public SmfDependenciesPanel(RepoManagedObject repo) { |
|
60 super(new DependenciesModel(repo), props, null, null, |
|
61 Finder.getString("service.dependencies.name"), null); |
|
62 |
|
63 dModel = (DependenciesModel)(ManagedObject) |
|
64 getFilterManagedObject().getManagedObject(); |
|
65 |
|
66 setHeaderVisible(false); |
|
67 setShowContentBorder(false); |
|
68 } |
|
69 |
|
70 // |
|
71 // SmfDependenciesPanel methods |
|
72 // |
|
73 |
|
74 public void init(SmfManagedObject object) { |
|
75 // Sanity check -- the UI should be updated only on the event thread |
|
76 assert EventQueue.isDispatchThread(); |
|
77 |
|
78 Collection<Dependency> deps; |
|
79 if (object == null) { |
|
80 deps = Collections.emptyList(); |
|
81 } else { |
|
82 deps = object.getDependencies(); |
|
83 } |
|
84 |
|
85 dModel.setDeps(deps); |
|
86 } |
|
87 } |