[Lilith-devel] SF.net SVN: lilith:[150] trunk/lilith/src/main/java/de/huxhorn/lilith
Brought to you by:
huxhorn
From: <hu...@us...> - 2009-01-29 06:58:26
|
Revision: 150 http://lilith.svn.sourceforge.net/lilith/?rev=150&view=rev Author: huxhorn Date: 2009-01-29 06:58:19 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Work in progress on making the splash screen optional.See ticket:25. Also enhanced the splash screen to make it more useful, i.e. more info on what's going on. Modified Paths: -------------- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-01-29 06:58:19 UTC (rev 150) @@ -89,7 +89,6 @@ private static Thread.UncaughtExceptionHandler uncaughtExceptionHandler; - private static boolean splashScreenDisabled; static { @@ -462,7 +461,7 @@ } } - splashScreenDisabled = applicationPreferences.isSplashScreenDisabled(); + boolean splashScreenDisabled = applicationPreferences.isSplashScreenDisabled(); try { SplashScreen splashScreen = null; @@ -532,7 +531,7 @@ } updateSplashStatus(splashScreen, "Creating main window..."); - CreateMainFrameRunnable createMain = new CreateMainFrameRunnable(applicationPreferences, appTitle, enableBonjour); + CreateMainFrameRunnable createMain = new CreateMainFrameRunnable(applicationPreferences, splashScreen, appTitle, enableBonjour); SwingUtilities.invokeAndWait(createMain); final MainFrame frame = createMain.getMainFrame(); if(logger.isDebugEnabled()) logger.debug("After show..."); @@ -587,13 +586,15 @@ static class CreateMainFrameRunnable implements Runnable { + private SplashScreen splashScreen; private MainFrame mainFrame; private ApplicationPreferences applicationPreferences; private String appTitle; private boolean enableBonjour; - public CreateMainFrameRunnable(ApplicationPreferences applicationPreferences, String appTitle, boolean enableBonjour) + public CreateMainFrameRunnable(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appTitle, boolean enableBonjour) { + this.splashScreen=splashScreen; this.enableBonjour = enableBonjour; this.appTitle = appTitle; this.applicationPreferences = applicationPreferences; @@ -601,7 +602,7 @@ public void run() { - mainFrame = new MainFrame(applicationPreferences, appTitle, enableBonjour); + mainFrame = new MainFrame(applicationPreferences, splashScreen, appTitle, enableBonjour); mainFrame.setSounds(new JLayerSounds()); mainFrame.setSize(1024, 768); Windows.showWindow(mainFrame, null, false); Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/ApplicationPreferences.java 2009-01-29 06:58:19 UTC (rev 150) @@ -1160,7 +1160,7 @@ public boolean isSplashScreenDisabled() { - return PREFERENCES.getBoolean(SPLASH_SCREEN_DISABLED_PROPERTY, true); + return PREFERENCES.getBoolean(SPLASH_SCREEN_DISABLED_PROPERTY, false); } public void setShowingFullCallstack(boolean showingFullCallstack) Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/MainFrame.java 2009-01-29 06:58:19 UTC (rev 150) @@ -163,6 +163,7 @@ private List<SavedCondition> activeConditions; private Map<LoggingEvent.Level, Colors> levelColors; private Map<HttpStatus.Type, Colors> statusColors; + private SplashScreen splashScreen; /* * Need to use ConcurrentMap because it's accessed by both the EventDispatchThread and the CleanupThread. */ @@ -194,9 +195,11 @@ return desktop; } - public MainFrame(ApplicationPreferences applicationPreferences, String appName, boolean enableBonjour) + public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName, boolean enableBonjour) { super(appName); + this.splashScreen=splashScreen; + setSplashStatusText("Creating main frame."); //colorsReferenceQueue=new ReferenceQueue<Colors>(); //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>(); application = new DefaultApplication(); @@ -240,10 +243,6 @@ rrdFileFilter = new RrdFileFilter(); - if(logger.isDebugEnabled()) logger.debug("Before creation of statistics-dialog..."); - statisticsDialog = new StatisticsDialog(this); - if(logger.isDebugEnabled()) logger.debug("After creation of statistics-dialog..."); - loggingEventViewManager = new LoggingEventViewManager(this); accessEventViewManager = new AccessEventViewManager(this); this.applicationPreferences = applicationPreferences; @@ -283,14 +282,26 @@ add(desktop, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); + setSplashStatusText("Creating statistics dialog."); + if(logger.isDebugEnabled()) logger.debug("Before creation of statistics-dialog..."); + statisticsDialog = new StatisticsDialog(this); + if(logger.isDebugEnabled()) logger.debug("After creation of statistics-dialog..."); + + setSplashStatusText("Creating about dialog."); aboutDialog = new AboutDialog(this, "About " + appName + "...", appName); + setSplashStatusText("Creating debug dialog."); + debugDialog = new DebugDialog(this, this); - debugDialog = new DebugDialog(this, this); + setSplashStatusText("Creating preferences dialog."); if(logger.isDebugEnabled()) logger.debug("Before creation of preferences-dialog..."); preferencesDialog = new PreferencesDialog(this); if(logger.isDebugEnabled()) logger.debug("After creation of preferences-dialog..."); + + setSplashStatusText("Creating \"Open inactive\" dialog."); openInactiveLogsDialog = new OpenPreviousDialog(MainFrame.this); + + setSplashStatusText("Creating help frame."); helpFrame = new HelpFrame(this); helpFrame.setTitle("Help Topics"); @@ -320,6 +331,14 @@ helpUrl = MainFrame.class.getResource("/help/index.xhtml"); } + private void setSplashStatusText(String text) + { + if(splashScreen!=null) + { + splashScreen.setStatusText(text); + } + } + public Application getApplication() { return application; @@ -423,6 +442,7 @@ //referenceCollection.setDaemon(true); //referenceCollection.start(); + setSplashStatusText("Executing autostart items."); // Autostart { File autostartDir = new File(startupApplicationPath, "autostart"); @@ -471,6 +491,7 @@ //gotoSource.start() started when needed... } + setSplashStatusText("Creating global views."); SourceIdentifier globalSourceIdentifier = new SourceIdentifier("global", null); File globalLoggingDataFile = loggingFileFactory.getDataFile(globalSourceIdentifier); File globalLoggingIndexFile = loggingFileFactory.getIndexFile(globalSourceIdentifier); @@ -488,6 +509,7 @@ EventSource<LoggingEvent> globalLoggingEventSource = new EventSourceImpl<LoggingEvent>(globalSourceIdentifier, loggingFileDump.getBuffer(), true); lsm.addSource(globalLoggingEventSource); + setSplashStatusText("Creating internal view."); // add internal lilith logging EventSource<LoggingEvent> lilithLoggingEventSource = new EventSourceImpl<LoggingEvent>(InternalLilithAppender.getSourceIdentifier(), InternalLilithAppender.getBuffer(), false); lsm.addSource(lilithLoggingEventSource); @@ -509,6 +531,7 @@ if(logger.isWarnEnabled()) logger.warn("Exception while creating event producer!", ex); } + setSplashStatusText("Starting event receivers."); try { SerializingMessageBasedServerSocketEventSourceProducer<LoggingEvent> producer @@ -615,6 +638,8 @@ viewActions = new ViewActions(this, null); viewActions.getPopupMenu(); // initialize popup once in main frame only. + setSplashStatusText("Setting up event consumers."); + RrdLoggingEventConsumer rrdDb = new RrdLoggingEventConsumer(); rrdDb.setBasePath(new File(startupApplicationPath, "statistics")); AlarmSoundLoggingEventConsumer loggingEventAlarmSound = new AlarmSoundLoggingEventConsumer(); @@ -677,6 +702,7 @@ checkForUpdate(false); } updateConditions(); // to initialize active conditions. + setSplashStatusText("Finished."); } public void goToSource(StackTraceElement ste) Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java =================================================================== --- trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java 2009-01-28 07:18:41 UTC (rev 149) +++ trunk/lilith/src/main/java/de/huxhorn/lilith/swing/SplashScreen.java 2009-01-29 06:58:19 UTC (rev 150) @@ -34,6 +34,7 @@ private final Logger logger = LoggerFactory.getLogger(SplashScreen.class); private JLabel statusLabel; + private JPanel contentPane; public SplashScreen(String applicationTitle) { @@ -44,7 +45,7 @@ private void initUI(String applicationTitle) { - Container contentPane = new JPanel(true); + contentPane = new JPanel(true); contentPane.setLayout(new BorderLayout()); URL url = SplashScreen.class.getResource("/splash/splash.jpg"); if(url != null) @@ -64,7 +65,17 @@ } } statusLabel = new JLabel(); + statusLabel.setOpaque(true); + statusLabel.setForeground(Color.BLACK); + statusLabel.setBackground(Color.WHITE); + statusLabel.setHorizontalAlignment(SwingConstants.CENTER); + JLabel titleLabel = new JLabel(applicationTitle); + titleLabel.setOpaque(true); + titleLabel.setForeground(Color.BLACK); + titleLabel.setBackground(Color.WHITE); + titleLabel.setHorizontalAlignment(SwingConstants.CENTER); + contentPane.add(titleLabel, BorderLayout.NORTH); contentPane.add(statusLabel, BorderLayout.SOUTH); statusLabel.setText("Initializing..."); @@ -80,7 +91,11 @@ setVisible(true); } toFront(); - repaint(); + Rectangle bounds = contentPane.getBounds(); + int height=statusLabel.getHeight(); + contentPane.paintImmediately(0,bounds.height-height,bounds.width, height); + //statusLabel.paintImmediately(statusLabel.getBounds()); + //repaint(); } private class ImagePanel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |