usr/src/java/vpanels/panels/sharemgr/org/opensolaris/os/vp/panels/sharemgr/client/swing/SecurityModeControl.java
author Stephen Talley <stephen.talley@oracle.com>
Thu, 22 Jul 2010 10:10:18 -0400
changeset 547 e1d8b4ddb166
parent 493 b722c21cb2c3
child 657 9fdd9a66d201
permissions -rw-r--r--
16625 SwingSettingsControl does not follow naming conventions

/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 */

package org.opensolaris.os.vp.panels.sharemgr.client.swing;

import java.util.Map;
import org.opensolaris.os.vp.panel.common.control.*;
import org.opensolaris.os.vp.panel.swing.control.SettingsControl;
import org.opensolaris.os.vp.panels.sharemgr.client.common.
    SharemgrPanelDescriptor;
import org.opensolaris.os.vp.panels.sharemgr.common.SharemgrUtil;

public class SecurityModeControl
    extends SettingsControl<SharemgrPanelDescriptor, SecurityModePanel> {

    //
    // Instance data
    //

    private ProtocolControl parent;
    private SecurityModePropertySet sProps;

    //
    // Constructors
    //

    public SecurityModeControl(ProtocolControl parent,
	SecurityModePropertySet sProps) {

	super(sProps.getSecurityMode().getName(),
	    SharemgrUtil.getFriendlySecurityModeName(
	    parent.getProtocolPropertySet().getProtocol().getName(),
	    sProps.getSecurityMode().getName(), true),
	    parent.getPanelDescriptor());

	this.parent = parent;
	this.sProps = sProps;
    }

    //
    // Control methods
    //

    @Override
    public void start(Navigator navigator, Map<String, String> parameters)
	throws NavigationAbortedException, InvalidParameterException {

	setPropertyChangeSource(parent.getParent().getCommon());
	super.start(navigator, parameters);
    }

    //
    // SwingControl methods
    //

    @Override
    protected void configComponent(SecurityModePanel panel) {
	super.configComponent(panel);
	addDefaultCloseAction(false);
    }

    @Override
    protected SecurityModePanel createComponent() {
	return new SecurityModePanel(
	    parent.getProtocolPropertySet().getProtocol(), sProps);
    }

    //
    // SecurityModeControl methods
    //

    public ProtocolControl getParent() {
	return parent;
    }

    public SecurityModePropertySet getSecurityModePropertySet() {
	return sProps;
    }
}