author | Stephen Talley <stephen.talley@oracle.com> |
Thu, 22 Jul 2010 10:10:18 -0400 | |
changeset 547 | e1d8b4ddb166 |
parent 493 | b722c21cb2c3 |
child 552 | 8782ebc01e1f |
permissions | -rw-r--r-- |
0 | 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 |
/* |
|
547
e1d8b4ddb166
16625 SwingSettingsControl does not follow naming conventions
Stephen Talley <stephen.talley@oracle.com>
parents:
493
diff
changeset
|
23 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 24 |
*/ |
25 |
||
26 |
package org.opensolaris.os.vp.panel.swing.smf; |
|
27 |
||
301
98464369f109
9311 MutableProperties should support PropertyChangeEvents
Stephen Talley <stephen.talley@sun.com>
parents:
292
diff
changeset
|
28 |
import java.util.List; |
0 | 29 |
import org.opensolaris.os.scf.common.ScfException; |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
30 |
import org.opensolaris.os.vp.panel.common.action.ActionFailedException; |
286
49d494dc998e
8622 DataWrapper classes should be split into MVC components
Stephen Talley <stephen.talley@sun.com>
parents:
282
diff
changeset
|
31 |
import org.opensolaris.os.vp.panel.common.smf.SmfMutableProperty; |
547
e1d8b4ddb166
16625 SwingSettingsControl does not follow naming conventions
Stephen Talley <stephen.talley@oracle.com>
parents:
493
diff
changeset
|
32 |
import org.opensolaris.os.vp.panel.swing.control.SettingsControl; |
282
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
33 |
import org.opensolaris.os.vp.util.misc.*; |
0 | 34 |
|
292
d3c921786c1d
8634 ServiceSettingsTab and ServiceStatusTab aren't tabs, necessarily
Stephen Talley <stephen.talley@sun.com>
parents:
286
diff
changeset
|
35 |
public class ServiceSettingsControl extends |
547
e1d8b4ddb166
16625 SwingSettingsControl does not follow naming conventions
Stephen Talley <stephen.talley@oracle.com>
parents:
493
diff
changeset
|
36 |
SettingsControl<ServiceSwingPanelDescriptor, ServiceSettingsPanel> { |
282
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
37 |
|
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
38 |
// |
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
39 |
// Static data |
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
40 |
// |
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
41 |
|
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
42 |
private static final String ID = "settings"; |
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
43 |
|
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
44 |
private static final String NAME = |
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
45 |
Finder.getString("service.settings.name"); |
0 | 46 |
|
47 |
// |
|
48 |
// Constructors |
|
49 |
// |
|
50 |
||
292
d3c921786c1d
8634 ServiceSettingsTab and ServiceStatusTab aren't tabs, necessarily
Stephen Talley <stephen.talley@sun.com>
parents:
286
diff
changeset
|
51 |
public ServiceSettingsControl(ServiceSwingPanelDescriptor descriptor, |
0 | 52 |
ServiceSettingsPanel panel) { |
53 |
||
282
fdae7ad420be
8192 SwingTabControl is unnecessary for most tab Controls
Stephen Talley <stephen.talley@sun.com>
parents:
244
diff
changeset
|
54 |
super(ID, NAME, descriptor); |
0 | 55 |
|
56 |
setComponent(panel); |
|
493
b722c21cb2c3
15803 SwingSettingsControl.addDefault*Action methods should only apply to that Control's SettingsPanel
Stephen Talley <stephen.talley@oracle.com>
parents:
310
diff
changeset
|
57 |
addDefaultResetAction(); |
b722c21cb2c3
15803 SwingSettingsControl.addDefault*Action methods should only apply to that Control's SettingsPanel
Stephen Talley <stephen.talley@oracle.com>
parents:
310
diff
changeset
|
58 |
addDefaultApplyAction(); |
0 | 59 |
} |
60 |
||
61 |
// |
|
62 |
// SwingControl methods |
|
63 |
// |
|
64 |
||
65 |
@Override |
|
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
0
diff
changeset
|
66 |
protected void save() throws ActionFailedException { |
301
98464369f109
9311 MutableProperties should support PropertyChangeEvents
Stephen Talley <stephen.talley@sun.com>
parents:
292
diff
changeset
|
67 |
List<Changeable> changeables = |
286
49d494dc998e
8622 DataWrapper classes should be split into MVC components
Stephen Talley <stephen.talley@sun.com>
parents:
282
diff
changeset
|
68 |
getComponent().getChangeableAggregator().getChangeables(); |
0 | 69 |
|
286
49d494dc998e
8622 DataWrapper classes should be split into MVC components
Stephen Talley <stephen.talley@sun.com>
parents:
282
diff
changeset
|
70 |
for (Changeable changeable : changeables) { |
301
98464369f109
9311 MutableProperties should support PropertyChangeEvents
Stephen Talley <stephen.talley@sun.com>
parents:
292
diff
changeset
|
71 |
if (changeable instanceof SmfMutableProperty && |
98464369f109
9311 MutableProperties should support PropertyChangeEvents
Stephen Talley <stephen.talley@sun.com>
parents:
292
diff
changeset
|
72 |
changeable.isChanged()) { |
98464369f109
9311 MutableProperties should support PropertyChangeEvents
Stephen Talley <stephen.talley@sun.com>
parents:
292
diff
changeset
|
73 |
|
0 | 74 |
try { |
301
98464369f109
9311 MutableProperties should support PropertyChangeEvents
Stephen Talley <stephen.talley@sun.com>
parents:
292
diff
changeset
|
75 |
((SmfMutableProperty)changeable).saveToRepo(); |
0 | 76 |
} catch (ScfException e) { |
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
0
diff
changeset
|
77 |
throw new ActionFailedException(e); |
0 | 78 |
} |
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
} |