Set the frame's title based on the current character and source/game mode.
()
| 1250 | * Set the frame's title based on the current character and source/game mode. |
| 1251 | */ |
| 1252 | private void updateTitle() |
| 1253 | { |
| 1254 | StringBuilder title = new StringBuilder(100); |
| 1255 | File characterFile; |
| 1256 | String characterFileName = null; |
| 1257 | String sourceName = null; |
| 1258 | if (currentCharacterRef != null && currentCharacterRef.get() != null) |
| 1259 | { |
| 1260 | // characterFileName The file name (without path) of the active character |
| 1261 | // sourceName The name of the source selection. |
| 1262 | |
| 1263 | characterFile = currentCharacterRef.get().getFileRef().get(); |
| 1264 | if (characterFile == null || StringUtils.isEmpty(characterFile.getName())) |
| 1265 | { |
| 1266 | characterFileName = LanguageBundle.getString("in_unsaved_char"); //$NON-NLS-1$ |
| 1267 | } |
| 1268 | else |
| 1269 | { |
| 1270 | characterFileName = characterFile.getName(); |
| 1271 | } |
| 1272 | } |
| 1273 | if (currentSourceSelection.get() != null) |
| 1274 | { |
| 1275 | sourceName = currentSourceSelection.get().toString(); |
| 1276 | } |
| 1277 | |
| 1278 | if (characterFileName != null && !characterFileName.isEmpty()) |
| 1279 | { |
| 1280 | title.append(characterFileName); |
| 1281 | title.append(" - "); |
| 1282 | } |
| 1283 | if (sourceName != null && !sourceName.isEmpty()) |
| 1284 | { |
| 1285 | title.append(sourceName); |
| 1286 | title.append(" - "); |
| 1287 | } |
| 1288 | title.append("PCGen v"); |
| 1289 | title.append(PCGenPropBundle.getVersionNumber()); |
| 1290 | setTitle(title.toString()); |
| 1291 | } |
| 1292 | |
| 1293 | /** |
| 1294 | * display the tips of the day dialog to the user |
no test coverage detected