This frame class embeds a SessionProvider and manages the connection
on behalf of the caller. To invoke a session provider from an external
application is a straight forward procedure. Assuming that the connection
has already been established [see SshClient] you can invoke a frame using
the following code:
// Create an SshClient connection
SshClient ssh = new SshClient();
// Connection code goes here - see SshClient for more details
SessionProviderFrame frame = new SessionProviderFrame(null,
new SshToolsConnectionProfile(),
ssh,
SessionProviderFactory.getInstance().getProvider("sshterm"));
frame.pack();
frame.show();
| Methods from java.awt.Component: |
|---|
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate |
| Method from com.sshtools.common.ui.SessionProviderFrame Detail: |
public void addEventHandler(SshEventAdapter eventHandler) {
ssh.addEventHandler(eventHandler);
}
Implementation of the SessionManager method, simply calls the SshClient
method addEventHandler. |
public void allowChannelOpen(String channelType,
ChannelFactory cf) throws IOException {
ssh.allowChannelOpen(channelType, cf);
}
Implemenation of the SessionManager method, simply calls the SshClient
method allowChannelOpen. |
public void applyProfileChanges(SshToolsConnectionProfile profile) {
}
Implementation of the SessionManager method, this does nothing. Overide this
method to provide additional functionality to save changes made by the session
to the profile. |
public boolean canExit() {
return panel.canClose();
}
Called by the application framework when testing exit state |
public void exit() {
panel.close();
dispose();
}
Called by the framework when exiting. Can also be called to close the session. |
public ForwardingClient getForwardingClient() {
return ssh.getForwardingClient();
}
Implementation of the SessionManager method, simply calls the SshClient
method getForwardingClient. |
public SshToolsConnectionProfile getProfile() {
return profile;
}
Gets the profile currently attached to the frame. |
public int getRemoteEOL() {
return ssh.getRemoteEOL();
}
Returns the guessed EOL setting of the remote computer |
public String getServerId() {
return ssh.getServerId();
}
Implemenation of the SessionManager method, simply calls the SshClient
method getServerId. |
public SshToolsApplicationSessionPanel getSessionPanel() {
return panel;
}
Get the attached session provider panel. |
public boolean initFrame(SshToolsApplication app) throws IOException, SshToolsApplicationException {
panel.setCurrentConnectionProfile(profile);
panel.init(app);
init(app, panel);
pack();
return panel.openSession(this, profile);
}
Initialize the frame and open the remote session |
public boolean isConnected() {
return ssh.isConnected();
}
Implementation of the SessionManager method, this simply calls the SshClient
method isConnected. |
public boolean openChannel(Channel channel) throws IOException {
return ssh.openChannel(channel);
}
Implementation of the SessionManager method, this simply calls the SshClient
method openChannel. |
public SessionChannelClient openSession() throws IOException {
return ssh.openSessionChannel();
}
Implementation of the SessionManager method, simply calls the SshClient
openSession method. |
public SftpClient openSftpClient() throws IOException {
return ssh.openSftpClient();
}
Implementation of the SessionManager method, this simply calls the SshClient
method openSftpClient. |
public boolean requestDisconnect() {
return disconnectOnClose;
}
Implementation of the SessionManager method, this simply returns false.
Overide to change this behaviour |
public byte[] sendGlobalRequest(String requestname,
boolean wantreply,
byte[] requestdata) throws IOException {
return ssh.sendGlobalRequest(requestname, wantreply, requestdata);
}
Implementation of the SessionManager method, simply calls the SshClient
method sendGlobalRequest. |
public void setDisconnectOnClose(boolean disconnectOnClose) {
this.disconnectOnClose = disconnectOnClose;
}
When the session closes, should the connection be disconnected? |