Package jexer.backend
Class SwingSessionInfo
- java.lang.Object
-
- jexer.backend.SwingSessionInfo
-
- All Implemented Interfaces:
SessionInfo
public class SwingSessionInfo extends java.lang.Object implements SessionInfo
SwingSessionInfo provides a session implementation with a callback into Swing to support queryWindowSize(). The username is blank, language is "en_US", with a 80x25 text window.
-
-
Constructor Summary
Constructors Constructor Description SwingSessionInfo(SwingComponent swing, int textWidth, int textHeight)Public constructor.SwingSessionInfo(SwingComponent swing, int textWidth, int textHeight, int width, int height)Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIdleTime()Get the time this session was idle.java.lang.StringgetLanguage()Language getter.longgetStartTime()Get the time this session was started.SwingComponentgetSwingComponent()Getter for the underlying Swing component.java.lang.StringgetUsername()Username getter.intgetWindowHeight()Text window height getter.intgetWindowWidth()Text window width getter.voidqueryWindowSize()Re-query the text window size.voidsetIdleTime(int seconds)Set the time this session was idle.voidsetLanguage(java.lang.String language)Language setter.voidsetTextCellDimensions(int textWidth, int textHeight)Set the dimensions of a single text cell.voidsetUsername(java.lang.String username)Username setter.
-
-
-
Constructor Detail
-
SwingSessionInfo
public SwingSessionInfo(SwingComponent swing, int textWidth, int textHeight)
Public constructor.- Parameters:
swing- the Swing JFrame or JComponenttextWidth- the width of a cell in pixelstextHeight- the height of a cell in pixels
-
SwingSessionInfo
public SwingSessionInfo(SwingComponent swing, int textWidth, int textHeight, int width, int height)
Public constructor.- Parameters:
swing- the Swing JFrame or JComponenttextWidth- the width of a cell in pixelstextHeight- the height of a cell in pixelswidth- the number of columnsheight- the number of rows
-
-
Method Detail
-
getStartTime
public long getStartTime()
Get the time this session was started.- Specified by:
getStartTimein interfaceSessionInfo- Returns:
- the number of millis since midnight, January 1, 1970 UTC
-
getIdleTime
public int getIdleTime()
Get the time this session was idle.- Specified by:
getIdleTimein interfaceSessionInfo- Returns:
- the number of seconds since the last user input event from this session
-
setIdleTime
public void setIdleTime(int seconds)
Set the time this session was idle.- Specified by:
setIdleTimein interfaceSessionInfo- Parameters:
seconds- the number of seconds since the last user input event from this session
-
getUsername
public java.lang.String getUsername()
Username getter.- Specified by:
getUsernamein interfaceSessionInfo- Returns:
- the username
-
setUsername
public void setUsername(java.lang.String username)
Username setter.- Specified by:
setUsernamein interfaceSessionInfo- Parameters:
username- the value
-
getLanguage
public java.lang.String getLanguage()
Language getter.- Specified by:
getLanguagein interfaceSessionInfo- Returns:
- the language
-
setLanguage
public void setLanguage(java.lang.String language)
Language setter.- Specified by:
setLanguagein interfaceSessionInfo- Parameters:
language- the value
-
getWindowWidth
public int getWindowWidth()
Text window width getter.- Specified by:
getWindowWidthin interfaceSessionInfo- Returns:
- the window width
-
getWindowHeight
public int getWindowHeight()
Text window height getter.- Specified by:
getWindowHeightin interfaceSessionInfo- Returns:
- the window height
-
queryWindowSize
public void queryWindowSize()
Re-query the text window size.- Specified by:
queryWindowSizein interfaceSessionInfo
-
setTextCellDimensions
public void setTextCellDimensions(int textWidth, int textHeight)Set the dimensions of a single text cell.- Parameters:
textWidth- the width of a cell in pixelstextHeight- the height of a cell in pixels
-
getSwingComponent
public SwingComponent getSwingComponent()
Getter for the underlying Swing component.- Returns:
- the SwingComponent
-
-