Merge branch 'upstream' into subtree
[nikiroo-utils.git] / backend / TSessionInfo.java
CommitLineData
daa4106c 1/*
df8de03f
KL
2 * Jexer - Java Text User Interface
3 *
e16dda65 4 * The MIT License (MIT)
df8de03f 5 *
a69ed767 6 * Copyright (C) 2019 Kevin Lamonte
df8de03f 7 *
e16dda65
KL
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
df8de03f 14 *
e16dda65
KL
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
df8de03f 17 *
e16dda65
KL
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
7b5261bc
KL
25 *
26 * @author Kevin Lamonte [kevin.lamonte@gmail.com]
27 * @version 1
df8de03f 28 */
42873e30 29package jexer.backend;
df8de03f
KL
30
31/**
32 * TSessionInfo provides a default session implementation. The username is
33 * blank, language is "en_US", with a 80x24 text window.
34 */
051e2913 35public class TSessionInfo implements SessionInfo {
df8de03f 36
d36057df
KL
37 // ------------------------------------------------------------------------
38 // Variables --------------------------------------------------------------
39 // ------------------------------------------------------------------------
40
df8de03f 41 /**
7b5261bc 42 * User name.
df8de03f
KL
43 */
44 private String username = "";
45
46 /**
7b5261bc 47 * Language.
df8de03f
KL
48 */
49 private String language = "en_US";
50
51 /**
7b5261bc 52 * Text window width.
df8de03f
KL
53 */
54 private int windowWidth = 80;
55
56 /**
7b5261bc 57 * Text window height.
df8de03f
KL
58 */
59 private int windowHeight = 24;
60
d36057df
KL
61 // ------------------------------------------------------------------------
62 // Constructors -----------------------------------------------------------
63 // ------------------------------------------------------------------------
64
65 /**
66 * Public constructor.
67 */
68 public TSessionInfo() {
69 this(80, 24);
70 }
71
72 /**
73 * Public constructor.
74 *
75 * @param width the number of columns
76 * @param height the number of rows
77 */
78 public TSessionInfo(final int width, final int height) {
79 this.windowWidth = width;
80 this.windowHeight = height;
81 }
82
83 // ------------------------------------------------------------------------
84 // SessionInfo ------------------------------------------------------------
85 // ------------------------------------------------------------------------
86
df8de03f 87 /**
7b5261bc 88 * Username getter.
df8de03f
KL
89 *
90 * @return the username
91 */
92 public String getUsername() {
7b5261bc 93 return this.username;
df8de03f
KL
94 }
95
96 /**
7b5261bc 97 * Username setter.
df8de03f
KL
98 *
99 * @param username the value
100 */
7b5261bc
KL
101 public void setUsername(final String username) {
102 this.username = username;
df8de03f
KL
103 }
104
105 /**
7b5261bc 106 * Language getter.
df8de03f
KL
107 *
108 * @return the language
109 */
110 public String getLanguage() {
7b5261bc 111 return this.language;
df8de03f
KL
112 }
113
114 /**
7b5261bc 115 * Language setter.
df8de03f
KL
116 *
117 * @param language the value
118 */
7b5261bc
KL
119 public void setLanguage(final String language) {
120 this.language = language;
df8de03f
KL
121 }
122
123 /**
7b5261bc 124 * Text window width getter.
c8496dac
KL
125 *
126 * @return the window width
df8de03f
KL
127 */
128 public int getWindowWidth() {
7b5261bc 129 return windowWidth;
df8de03f
KL
130 }
131
132 /**
7b5261bc 133 * Text window height getter.
c8496dac
KL
134 *
135 * @return the window height
df8de03f
KL
136 */
137 public int getWindowHeight() {
7b5261bc 138 return windowHeight;
df8de03f 139 }
c8496dac
KL
140
141 /**
7b5261bc 142 * Re-query the text window size.
c8496dac
KL
143 */
144 public void queryWindowSize() {
7b5261bc 145 // NOP
c8496dac
KL
146 }
147
df8de03f 148}