Changeset 1215 for trunk


Ignore:
Timestamp:
01/30/19 13:00:59 (5 years ago)
Author:
bln4
Message:

Browser.java -> Temporary change to Browser.java to allow for starting in authenticated mode. Once startup of Expeditee has been decided upon this will be merged in perm.

File:
1 edited

Legend:

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

    r1182 r1215  
    2020
    2121import java.io.File;
     22import java.io.IOException;
    2223import java.net.Authenticator;
     24import java.security.KeyStoreException;
     25import java.security.NoSuchAlgorithmException;
     26import java.security.cert.CertificateException;
     27import java.sql.SQLException;
    2328import java.util.ArrayList;
    2429import java.util.Collection;
     
    5156import org.expeditee.taskmanagement.SaveStateChangedEvent;
    5257import org.expeditee.taskmanagement.SaveStateChangedEventListener;
     58import org.ngikm.NGIKMSystem;
     59import org.ngikm.actions.DebugActions;
     60import org.ngikm.actions.EntityActions;
    5361
    5462/**
     
    148156        protected static boolean _initComplete = false;
    149157       
    150         protected static String _startFrame = null;
     158        private static String _startFrame = null;
    151159
    152160        /**
     
    159167                // Parse the starting frame command-line argument
    160168                if(args.length > 0) {
    161                         _startFrame = args[0];
    162                         if(!Character.isDigit(_startFrame.charAt(_startFrame.length() - 1))) {
    163                                 _startFrame = _startFrame + "1";
     169                        setStartFrame(args[0]);
     170                        if(!Character.isDigit(getStartFrame().charAt(getStartFrame().length() - 1))) {
     171                                setStartFrame(getStartFrame() + "1");
    164172                        }
    165173                } else {
    166                     _startFrame = "home1";
     174                    setStartFrame("home1");
    167175                }
    168176
     
    188196        }
    189197       
    190         public static void init()
    191         {
     198        public static void init() {
     199                if (Boolean.getBoolean("auth")) {
     200                        try {
     201                                org.expeditee.auth.Authenticator.getInstance();
     202                                _initComplete = true;
     203                                return;
     204                        } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException | ClassNotFoundException | SQLException e) {
     205                                e.printStackTrace();
     206                        }
     207                } else if (Boolean.getBoolean("ngikmspike")) {
     208                        System.out.println("Running NGIKM Demo");
     209                        Actions.LoadMethods(EntityActions.class);
     210                        Actions.LoadMethods(DebugActions.class);
     211                }
    192212                _theBrowser = new Browser();
    193213
     
    202222         * @return
    203223         *
    204          * True if the application is about to exit. False if not. Not that this is
     224         * True if the application is about to exit. False if not. Note that this is
    205225         * only set once the window is in its closed state (not closing) or if the
    206          * application has explicity being requested to exit.
     226         * application has explicitly being requested to exit.
    207227         *
    208228         * @see Browser#exit()
     
    217237        }
    218238
    219         protected Browser()
    220         {
     239        protected Browser() {
    221240                // center the frame on the screen
    222241                GraphicsManager g = EcosystemManager.getGraphicsManager();
     
    227246
    228247                DisplayController.Init();
    229                
     248
    230249                DisplayController.addDisplayObserver(WidgetCacheManager.getInstance());
    231250                if (ECOSYSTEM_TYPE == Ecosystem.Swing) {
     
    234253
    235254                setInputManagerWindowRoutines();
    236                
     255
    237256                // Reset windows to user specified size
    238257                Dimension initialWindowSize = new Dimension(UserSettings.InitialWidth.get(), UserSettings.InitialHeight.get());
    239258                g.setWindowSize(initialWindowSize);
    240                
     259
    241260                // Load documentation and start pages
    242261                FrameUtils.extractResources(false);
    243                
    244                 // Load fonts before loading any frames so the items on the frames will be able to access their fonts
     262
     263                // Load fonts before loading any frames so the items on the frames will be able
     264                // to access their fonts
    245265                Text.InitFonts();
    246                
     266
    247267                Settings.Init();
    248268                Frame userProfile = loadProfiles();
     
    250270                // Listen for save status to display during and after runtime
    251271                EntitySaveManager.getInstance().addSaveStateChangedEventListener(this);
    252                
     272
    253273                try {
    254274                        MessageBay.warningMessages(Actions.Init());
     
    256276                        // Go to the start frame if specified, otherwise go to the profile frame
    257277                        Frame start = null;
    258                         if(_startFrame == null) {
    259                                 _startFrame = UserSettings.StartFrame.get();
    260                                 if(_startFrame != null && !Character.isDigit(_startFrame.charAt(_startFrame.length() - 1))) {
    261                                         _startFrame = _startFrame + "1";
    262                                 }
    263                         }
    264                        
    265                 if((start = FrameIO.LoadFrame(_startFrame)) != null) {
    266                         // Make sure HomeFrame gets set
    267                         UserSettings.HomeFrame.set(start.getName());
    268                        
    269                         // Go to the start frame
    270                         DisplayController.setCurrentFrame(start, true);
    271                 } else {
    272                         // If an invalid start frame was specified, show a warning
    273                         if(_startFrame != null) {
    274                                         MessageBay.warningMessage("Unknown frame: " + _startFrame);
    275                                 }
    276                        
    277                         // Go to the profile frame
    278                         FrameUtils.loadFirstFrame(userProfile);
    279                 }
    280                
     278                        if (getStartFrame() == null) {
     279                                setStartFrame(UserSettings.StartFrame.get());
     280                                if (getStartFrame() != null && !Character.isDigit(getStartFrame().charAt(getStartFrame().length() - 1))) {
     281                                        setStartFrame(getStartFrame() + "1");
     282                                }
     283                        }
     284
     285                        if ((start = FrameIO.LoadFrame(getStartFrame())) != null) {
     286                                // Make sure HomeFrame gets set
     287                                UserSettings.HomeFrame.set(start.getName());
     288
     289                                // Go to the start frame
     290                                DisplayController.setCurrentFrame(start, true);
     291                        } else {
     292                                // If an invalid start frame was specified, show a warning
     293                                if (getStartFrame() != null) {
     294                                        MessageBay.warningMessage("Unknown frame: " + getStartFrame());
     295                                }
     296
     297                                // Go to the profile frame
     298                                FrameUtils.loadFirstFrame(userProfile);
     299                        }
     300
    281301                        DisplayController.updateTitle();
    282302
     
    284304                        if (!DisplayController.getCurrentFrame().equals(userProfile)) {
    285305                                StandardGestureActions.Refresh();
    286                         // If it's the profile frame just reparse it in order to display images/circles/widgets correctly
     306                                // If it's the profile frame just reparse it in order to display
     307                                // images/circles/widgets correctly
    287308                        } else {
    288309                                FrameUtils.Parse(userProfile);
     
    434455        }
    435456       
    436         private static void setInputManagerWindowRoutines()
    437         {
     457        private static void setInputManagerWindowRoutines()     {
    438458                InputManager manager = EcosystemManager.getInputManager();
    439459               
     
    497517         * @return The user's profile frame.
    498518         */
    499         private static Frame loadProfiles()
     519        public static Frame loadProfiles()
    500520        {
    501521                String defaultProfileName = UserSettings.DEFAULT_PROFILE_NAME;
     
    539559                return profile;
    540560        }
     561
     562        public static String getStartFrame() {
     563                return _startFrame;
     564        }
     565
     566        public static void setStartFrame(String _startFrame) {
     567                Browser._startFrame = _startFrame;
     568        }
    541569}
Note: See TracChangeset for help on using the changeset viewer.