Changeset 1540 for trunk/src/org/expeditee/gui
- Timestamp:
- 11/02/20 15:47:20 (4 years ago)
- Location:
- trunk/src/org/expeditee/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/Browser.java
r1526 r1540 169 169 public static void main(String[] args) { 170 170 if (AuthenticatorBrowser.isAuthenticationRequired()) { 171 String starting_user_name = System.getProperty("user.name");171 String starting_user_name = getExpediteeUserName(); 172 172 System.setProperty("startinguser.name", starting_user_name); 173 System.setProperty("user.name",AuthenticatorBrowser.USER_NOBODY);173 setExpediteeUserName(AuthenticatorBrowser.USER_NOBODY); 174 174 } 175 175 … … 276 276 277 277 if (!AuthenticatorBrowser.isAuthenticationRequired() && UserSettings.PublicAndPrivateResources) { 278 String userName = System.getProperty("user.name"); //UserSettings.ProfileName.get();278 String userName = getExpediteeUserName(); //UserSettings.ProfileName.get(); 279 279 if (!FrameIO.personalResourcesExist(userName)) { 280 280 FrameIO.setupPersonalResources(userName); … … 537 537 }); 538 538 } 539 539 540 private static String expediteeUserName = System.getProperty("user.name"); 541 542 public static String getExpediteeUserName() { 543 // String expediteeUserNameLocal = FrameIO.ConvertToValidFramesetName(expediteeUserName); 544 // return expediteeUserNameLocal; 545 return expediteeUserName; 546 } 547 548 public static void setExpediteeUserName(String username) { 549 expediteeUserName = username; 550 } 551 552 public static String getExpediteeUserProfileName() { 553 String expediteeUserNameLocal = FrameIO.ConvertToValidFramesetName(expediteeUserName); 554 return expediteeUserNameLocal; 555 } 556 540 557 /** 541 558 * @return The user's profile frame. 542 559 */ 543 public static Frame loadInitialProfiles() 544 { 560 public static Frame loadInitialProfiles() { 545 561 String defaultProfileName = UserSettings.DEFAULT_PROFILE_NAME; 546 String userName = System.getProperty("user.name"); 547 548 Frame defaultProfile = loadProfile(defaultProfileName); 549 Frame userProfile = loadProfile(userName); 562 String userName = getExpediteeUserName(); 563 String userProfileName = getExpediteeUserProfileName(); 564 565 Frame defaultProfile = loadProfile(defaultProfileName, defaultProfileName); 566 Frame userProfile = loadProfile(userName, userProfileName); 550 567 551 568 MessageBay.warningMessages(FrameUtils.ParseProfile(defaultProfile)); … … 571 588 } 572 589 573 protected static Frame loadProfile(String user Name) {574 Frame profile = FrameIO.LoadProfile( userName);590 protected static Frame loadProfile(String username, String profileName) { 591 Frame profile = FrameIO.LoadProfile(profileName); 575 592 576 593 if (profile == null) { 577 594 try { 578 profile = FrameIO.CreateNewProfile(user Name, null, null);595 profile = FrameIO.CreateNewProfile(username, profileName, null, null); 579 596 } catch (Exception e) { 580 597 // TODO tell the user that there was a problem creating the -
trunk/src/org/expeditee/gui/FrameIO.java
r1532 r1540 1100 1100 1101 1101 if (toSave == null || !toSave.hasChanged() || toSave.isSaved()) { 1102 System.err.println("FrameIO::SaveFrame::Nothing to save, backing out."); 1102 1103 return ""; 1104 } 1105 1106 if (toSave.getName().toLowerCase().equals("abc146a1")) { 1107 System.out.println("here"); 1103 1108 } 1104 1109 … … 1200 1205 boolean fileModifyConflict = fileLastModify > frameLastModify && !isBayFrameset; 1201 1206 boolean versionConflict = savedVersion > toSave.getVersion() && !isBayFrameset; 1207 1208 System.err.println("FrameIO::SaveFrame::Checking for conflicts for frame:" + toSave.getName()); 1202 1209 1203 1210 if ((fileModifyConflict || versionConflict) && savedVersion > 0) { … … 1405 1412 } 1406 1413 1407 public static Frame LoadProfile(String userName)1414 public static Frame LoadProfile(String profileName) 1408 1415 { 1409 1416 final String profilesLoc = System.getProperty("profiles.loc"); 1410 1417 if (profilesLoc != null) { 1411 return LoadFrame( userName + "1", profilesLoc);1418 return LoadFrame(profileName + "1", profilesLoc); 1412 1419 } else { 1413 return LoadFrame( userName + "1");1414 } 1415 } 1416 1417 public static Frame CreateNewProfile(String user name, Map<String, Setting> initialSettings, Map<String, Consumer<Frame>> toNotifyOnSet) throws InvalidFramesetNameException, ExistingFramesetException {1420 return LoadFrame(profileName + "1"); 1421 } 1422 } 1423 1424 public static Frame CreateNewProfile(String userName, String profileName, Map<String, Setting> initialSettings, Map<String, Consumer<Frame>> toNotifyOnSet) throws InvalidFramesetNameException, ExistingFramesetException { //TODO: Investigate these throws, they never seem to be thrown up this far. 1418 1425 // Frame profile = CreateFrameset(username, PROFILE_PATH, true); 1419 1426 // if (profile != null) { … … 1425 1432 // } 1426 1433 // return profile; 1427 if ( username.equals(UserSettings.DEFAULT_PROFILE_NAME)) {1428 ProfileManager.ensureDefaultProfile();1429 return FrameIO.LoadFrame(UserSettings.DEFAULT_PROFILE_NAME + "1");1434 if (profileName.equals(UserSettings.DEFAULT_PROFILE_NAME)) { 1435 System.err.println("FrameIO::CreateNewProfile::DEPRECATED::CreateNewProfile should no longer be called to create a default profile. Use FrameIO::CreateNewDefaultProfile instead."); 1436 return CreateNewDefaultProfile(); 1430 1437 } else { 1431 return ProfileManager.createProfile(username, initialSettings, toNotifyOnSet); 1432 } 1438 return ProfileManager.createProfile(userName, profileName, initialSettings, toNotifyOnSet); 1439 } 1440 } 1441 1442 public static Frame CreateNewDefaultProfile() throws InvalidFramesetNameException, ExistingFramesetException { //TODO: Investigate these throws, they never seem to be thrown up this far. 1443 ProfileManager.ensureDefaultProfile(); 1444 return FrameIO.LoadFrame(UserSettings.DEFAULT_PROFILE_NAME + "1"); 1433 1445 } 1434 1446 -
trunk/src/org/expeditee/gui/MessageBay.java
r1510 r1540 481 481 } 482 482 483 _authorisedUser = new Text("Username: " + System.getProperty("user.name"));483 _authorisedUser = new Text("Username: " + Browser.getExpediteeUserName()); 484 484 _authorisedUser.setFont(new Font(Text.MONOSPACED_FONT)); 485 485 _authorisedUser.setY(95); -
trunk/src/org/expeditee/gui/management/ProfileManager.java
r1532 r1540 31 31 private static final String[] startPages = { "exploratorysearch", "webbrowser" }; 32 32 public static final String USER_NAME_FLAG = "${" + "USER.NAME" + "}"; 33 34 public static Frame createProfile(String profileFor, Map<String, Setting> specifiedSettings, 33 public static final String PROFILE_NAME_FLAG = "${" + "PROFILE.NAME" + "}"; 34 35 public static Frame createProfile(String username, String profileName, Map<String, Setting> specifiedSettings, 35 36 Map<String, Consumer<Frame>> notifyWhenGenerated) { 36 37 ensureDefaultProfile(); 37 38 Frame profileOne = null; 38 profileFor = FrameIO.ConvertToValidFramesetName(profileFor);39 //String profileName = FrameIO.ConvertToValidFramesetName(username); // TODO: Delete this line before SVN commit 39 40 40 41 try { 41 Frame profile = FrameIO.CreateFrameset(profile For, FrameIO.PROFILE_PATH, true, null);42 Frame profile = FrameIO.CreateFrameset(profileName, FrameIO.PROFILE_PATH, true, null); 42 43 profileOne = profile; 43 profile.setTitle( profileFor+ "'s Profile");44 profile.setTitle(username + "'s Profile"); 44 45 Frame defaultFrame = FrameIO.LoadFrame(DEFAULT + "1"); 45 46 MessageBay.suppressMessages(true); 46 UserSettings.UserName.set( profileFor);47 UserSettings.ProfileName.set( FrameIO.ConvertToValidFramesetName(profileFor));47 UserSettings.UserName.set(username); 48 UserSettings.ProfileName.set(profileName); 48 49 49 50 int lastNumber = FrameIO.getLastNumber(defaultFrame.getFramesetName()); … … 83 84 if (item instanceof Text) { 84 85 String content = item.getText(); 85 item.setText(ResourceUtil.substitute(content, ProfileManager.USER_NAME_FLAG, profileFor)); 86 String contentWithUserSub = ResourceUtil.substitute(content, ProfileManager.USER_NAME_FLAG, username); 87 String contentWithUserAndProfileSub = ResourceUtil.substitute(contentWithUserSub, ProfileManager.PROFILE_NAME_FLAG, FrameIO.ConvertToValidFramesetName(profileName)); 88 item.setText(contentWithUserAndProfileSub); 86 89 } 87 90 }
Note:
See TracChangeset
for help on using the changeset viewer.