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.panels.coreadm.client.swing; |
|
27 |
|
28 import java.util.List; |
|
29 import javax.swing.*; |
|
30 import com.oracle.solaris.vp.panel.common.model.*; |
|
31 import com.oracle.solaris.vp.util.misc.IconUtil; |
|
32 import com.oracle.solaris.vp.util.misc.finder.Finder; |
|
33 import com.oracle.solaris.vp.util.swing.HasIcon; |
|
34 |
|
35 @SuppressWarnings({"serial"}) |
|
36 public class CoreManagedObject |
|
37 extends AbstractManagedObject<ManagedObject> |
|
38 implements HasIcon { |
|
39 |
|
40 // |
|
41 // Static data |
|
42 // |
|
43 |
|
44 protected static final List<ImageIcon> icons = Finder.getIcons( |
|
45 "images/core-24.png", |
|
46 "images/core-32.png", |
|
47 "images/core-36.png", |
|
48 "images/core-48.png", |
|
49 "images/core-72.png", |
|
50 "images/core-96.png"); |
|
51 |
|
52 // |
|
53 // Instance data |
|
54 // |
|
55 |
|
56 private CoreAdmPanelDescriptor descriptor; |
|
57 private String name; |
|
58 private long size; |
|
59 |
|
60 // |
|
61 // Constructors |
|
62 // |
|
63 |
|
64 public CoreManagedObject(CoreAdmPanelDescriptor descriptor, String name, |
|
65 long size) { |
|
66 |
|
67 this.descriptor = descriptor; |
|
68 this.name = name; |
|
69 this.size = size; |
|
70 } |
|
71 |
|
72 // |
|
73 // ManagedObject methods |
|
74 // |
|
75 |
|
76 @Override |
|
77 public String getId() { |
|
78 return getName(); |
|
79 } |
|
80 |
|
81 @Override |
|
82 public String getName() { |
|
83 return name; |
|
84 } |
|
85 |
|
86 // |
|
87 // HasIcon methods |
|
88 // |
|
89 |
|
90 @Override |
|
91 public Icon getIcon(int height) { |
|
92 return IconUtil.getClosestIcon(icons, height); |
|
93 } |
|
94 |
|
95 // |
|
96 // CoreManagedObject methods |
|
97 // |
|
98 |
|
99 public CoreAdmPanelDescriptor getPanelDescriptor() { |
|
100 return descriptor; |
|
101 } |
|
102 |
|
103 public long getSize() { |
|
104 return size; |
|
105 } |
|
106 |
|
107 protected void setSize(long size) { |
|
108 this.size = size; |
|
109 } |
|
110 } |
|