Ignore:
Timestamp:
11/02/20 15:47:20 (4 years ago)
Author:
bnemhaus
Message:

Removed reliance of System.getProperty("user.name") by introducing some functions and a variable to Browser to be used instead. All previous occurrences of System.getProperty("user.name") now use these functions.

At the time, introduced new piping into various functions related to the creation and management of profile frames that distinguished between a profile name and a user name. This allows functions to be more specific about what is being used. For example, when modifying the users profile frames (in the profiles directory) that users profile name can be used instead of naming the variable 'username'. This distinction is important because while username's can end with numbers, profile names cannot and therefore get an 'A' on the end.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/management/ProfileManager.java

    r1532 r1540  
    3131        private static final String[] startPages = { "exploratorysearch", "webbrowser" };
    3232        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,
    3536                        Map<String, Consumer<Frame>> notifyWhenGenerated) {
    3637                ensureDefaultProfile();
    3738                Frame profileOne = null;
    38                 profileFor = FrameIO.ConvertToValidFramesetName(profileFor);
     39                //String profileName = FrameIO.ConvertToValidFramesetName(username); // TODO: Delete this line before SVN commit
    3940               
    4041                try {
    41                         Frame profile = FrameIO.CreateFrameset(profileFor, FrameIO.PROFILE_PATH, true, null);
     42                        Frame profile = FrameIO.CreateFrameset(profileName, FrameIO.PROFILE_PATH, true, null);
    4243                        profileOne = profile;
    43                         profile.setTitle(profileFor + "'s Profile");
     44                        profile.setTitle(username + "'s Profile");
    4445                        Frame defaultFrame = FrameIO.LoadFrame(DEFAULT + "1");
    4546                        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);
    4849                       
    4950                        int lastNumber = FrameIO.getLastNumber(defaultFrame.getFramesetName());
     
    8384                                        if (item instanceof Text) {
    8485                                                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);
    8689                                        }
    8790                                }
Note: See TracChangeset for help on using the changeset viewer.