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 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 package org.opensolaris.os.vp.panel.common; 28 29 import java.util.logging.Logger; 30 import javax.help.HelpBroker; 31 import org.opensolaris.os.vp.panel.common.action.ActionAbortedException; 32 import org.opensolaris.os.vp.panel.common.control.*; 33 import org.opensolaris.os.vp.panel.common.view.BusyIndicator; 34 import org.opensolaris.os.vp.util.misc.DialogMessage; 35 36 public interface ClientContext { 37 /** 38 * Adds a {@link ConnectionListener} to be notified of any {@link 39 * ConnectionEvent}s on the client. 40 */ 41 void addConnectionListener(ConnectionListener listener); 42 43 /** 44 * Closes this instance of the client, subject to arbitrary conditions. 45 * Note that this may not necessarily close all instances, or stop the JVM. 46 * 47 * @param isCancel 48 * {@code true} if this instance is being stopped as part 49 * of a {@code cancel} operation, {@code false} otherwise 50 * 51 * @exception ActionAbortedException 52 * if the close operation could not or should not complete 53 */ 54 void closeInstance(boolean isCancel) throws ActionAbortedException; 55 56 /** 57 * Gets the busy indicator of the client. 58 */ 59 BusyIndicator getBusyIndicator(); 60 61 /** 62 * Gets the {@link ConnectionInfo} for the client. 63 */ 64 ConnectionInfo getConnectionInfo(); 65 66 /** 67 * Gets a handle to the help subsystem used by the client. 68 */ 69 HelpBroker getHelpBroker(); 70 71 /** 72 * Gets the {@code Logger} for the client. 73 */ 74 Logger getLog(); 75 76 /** 77 * Gets the navigator for this instance. 78 */ 79 Navigator getNavigator(); 80 81 /** 82 * Gets the title set in the client. 83 */ 84 String getTitle(); 85 86 /** 87 * Creates a new instance of the client (using the same {@link 88 * #getConnectionInfo connection}), and navigates to the given path. 89 * 90 * @param path 91 * the absolute path to navigate to 92 * 93 * @return the {@link ClientContext} for the new instance 94 * 95 * @exception NavigationAbortedException 96 * see {@link Navigator#goTo(boolean,Control,Navigable...)} 97 * 98 * @exception InvalidAddressException 99 * see {@link Navigator#goTo(boolean,Control,Navigable...)} 100 * 101 * @exception MissingParameterException 102 * see {@link Navigator#goTo(boolean,Control,Navigable...)} 103 * 104 * @exception InvalidParameterException 105 * see {@link Navigator#goTo(boolean,Control,Navigable...)} 106 * 107 * @exception EmptyNavigationStackException 108 * see {@link Navigator#goTo(boolean,Control,Navigable...)} 109 * 110 * @exception RootNavigableNotControlException 111 * see {@link Navigator#goTo(boolean,Control,Navigable...)} 112 */ 113 ClientContext newInstance(Navigable... path) 114 throws NavigationAbortedException, InvalidAddressException, 115 MissingParameterException, InvalidParameterException, 116 EmptyNavigationStackException, RootNavigableNotControlException; 117 118 /** 119 * Removes a {@link ConnectionListener} from notification. 120 */ 121 boolean removeConnectionListener(ConnectionListener listener); 122 123 /** 124 * Request that the client retrieve/create an existing/new connection. The 125 * client may choose to prompt the user to confirm, regardless of whether 126 * there is an open connection matching the given criteria. 127 * 128 * @param user 129 * the user, or {@code null} to use the user from the current 130 * connection, if any 131 * 132 * @param role 133 * the role, or {@code null} to use the role from the current 134 * connection, if any 135 * 136 * @param message 137 * a message indicating the reason for this request, or {@code 138 * null} to display a default message 139 * 140 * @exception ActionAbortedException 141 * if the operation is cancelled 142 */ 143 void requestConnection(String user, String role, DialogMessage message) 144 throws ActionAbortedException; 145 146 /** 147 * Sets a visible title in the client. 148 */ 149 void setTitle(String title); 150 151 /** 152 * Displays the {@link #getHelpBroker HelpBroker}'s help. 153 */ 154 void showHelp(); 155 } 156