SourceForge: bina/bina_platform: changeset 18:4574dbce4963
New Help View
authorgerasch
Wed Nov 04 14:54:21 2009 +0100 (2 weeks ago)
changeset 184574dbce4963
parent 177c2afffc2f50
child 19324a0beffb2b
New Help View
src/org/bina/platform/Core.java
src/org/bina/platform/Session.java
src/org/bina/platform/environment/WelcomeDialog.java
src/org/bina/platform/environment/WelcomePage.java
src/org/bina/platform/extensions/PluginManager.java
src/org/bina/platform/gui/IActiveViewChangedListener.java
src/org/bina/platform/gui/MainWindow.java
src/org/bina/platform/gui/wizards/MultiWizardDialog.java
src/org/bina/platform/gui/wizards/WizardDialog.java
src/org/bina/platform/resources/files/about.html
src/org/bina/platform/resources/files/cacheproxy.html
src/org/bina/platform/resources/files/license.html
src/org/bina/platform/resources/files/style.css
src/org/bina/platform/resources/files/usercreation.html
src/org/bina/platform/resources/files/usermodeselection.html
src/org/bina/platform/resources/files/welcome.html
src/org/bina/platform/resources/help/PlatformHelp.java
src/org/bina/platform/resources/help/empty.html
src/org/bina/platform/resources/help/help.css
src/org/bina/platform/resources/help/views/outline.html
src/org/bina/platform/resources/help/views/start.html
src/org/bina/platform/resources/icons/platform/pastedpic_09252009_101503.png
src/org/bina/platform/resources/tango/actions/system-log-out.svg
src/org/bina/platform/utils/swing/ComponentUtilities.java
src/org/bina/platformx/PlatformExtensionPoints.java
src/org/bina/platformx/util/swing/AutoCompletion.java
src/org/bina/platformx/views/help/HelpManagement.java
src/org/bina/platformx/views/help/HelpProvider.java
src/org/bina/platformx/views/help/HelpResource.java
src/org/bina/platformx/views/help/HelpView.java
src/org/bina/platformx/views/help/IHelpProvider.java
src/org/bina/platformx/views/outline/OutlineView.java
src/org/bina/platformx/wizards/start/StartWizard.java
     1.1 --- a/src/org/bina/platform/Core.java	Mon Oct 26 15:32:32 2009 +0100
     1.2 +++ b/src/org/bina/platform/Core.java	Wed Nov 04 14:54:21 2009 +0100
     1.3 @@ -23,6 +23,8 @@
     1.4  package org.bina.platform;
     1.5  
     1.6  import java.awt.Dimension;
     1.7 +import java.awt.RenderingHints;
     1.8 +import java.awt.Toolkit;
     1.9  import java.awt.event.ActionEvent;
    1.10  import java.awt.event.ActionListener;
    1.11  import java.io.File;
    1.12 @@ -43,6 +45,8 @@
    1.13  import javax.swing.Timer;
    1.14  import javax.swing.ToolTipManager;
    1.15  import javax.swing.UIManager;
    1.16 +import javax.swing.text.html.HTMLEditorKit;
    1.17 +import javax.swing.text.html.StyleSheet;
    1.18  
    1.19  import org.bina.platform.Arguments.Argument;
    1.20  import org.bina.platform.environment.Environment;
    1.21 @@ -51,6 +55,7 @@
    1.22  import org.bina.platform.environment.User;
    1.23  import org.bina.platform.extensions.PluginManager;
    1.24  import org.bina.platform.extensions.Version;
    1.25 +import org.bina.platform.resources.Resources;
    1.26  import org.bina.platform.tasks.ProcessManager;
    1.27  import org.bina.platform.utils.download.DownloadManager;
    1.28  import org.bina.platform.utils.security.StringEncrypter;
    1.29 @@ -58,7 +63,6 @@
    1.30  import com.jgoodies.looks.Options;
    1.31  import com.jgoodies.looks.plastic.PlasticLookAndFeel;
    1.32  import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
    1.33 -import com.kitfox.svg.SVGLoader;
    1.34  
    1.35  /**
    1.36   * Central class. Contains main-method.
    1.37 @@ -78,8 +82,12 @@
    1.38  
    1.39  public class Core {
    1.40  	
    1.41 +	static { 
    1.42 +		System.setProperty("awt.useSystemAAFontSettings", "on");
    1.43 +	}
    1.44 +	
    1.45  	public static final String COPYRIGHT = "Copyright (C) 2006-2009 by Andreas Gerasch (GNU LGPL)";
    1.46 -	public static final Version VERSION = new Version(1, 3, 1, 7);
    1.47 +	public static final Version VERSION = new Version(1, 3, 1, 8);
    1.48  	public static final String UPDATE_URL = "http://fred.bioinf.uni-sb.de/BiNA/update";
    1.49  	
    1.50  	public static String SINGLE_USER_MODE_VALUE = "single_user_mode";
    1.51 @@ -146,13 +154,13 @@
    1.52  	
    1.53  				
    1.54  	}
    1.55 -		
    1.56 +	
    1.57  	/**
    1.58  	 * Configures the user interface; requests Swing settings and 
    1.59  	 * jGoodies Looks options from the launcher.
    1.60  	 */
    1.61  	static void configureUI(Arguments args) {
    1.62 -
    1.63 +		
    1.64  		// Global options
    1.65  		Options.setDefaultIconSize(new Dimension(18, 18));
    1.66  		Options.setPopupDropShadowEnabled(true);
    1.67 @@ -193,7 +201,11 @@
    1.68  
    1.69  		ToolTipManager.sharedInstance().setDismissDelay(100000);
    1.70  		
    1.71 -		System.setProperty("awt.useSystemAAFontSettings", "on");
    1.72 +////		System.setProperty("awt.useSystemAAFontSettings", "on");
    1.73 +//		RenderingHints renderingHints = (RenderingHints) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints");
    1.74 +//		renderingHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    1.75 +//		renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    1.76 +//		renderingHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    1.77  	}
    1.78  	
    1.79  	
    1.80 @@ -380,6 +392,13 @@
    1.81  		// Workaround for JNLP (Webstart) to grant all permissions
    1.82  		System.setSecurityManager(null);
    1.83  		
    1.84 +		// set global style sheet
    1.85 +		StyleSheet styleSheet = new StyleSheet();
    1.86 +		styleSheet.importStyleSheet(HTMLEditorKit.class.getResource(HTMLEditorKit.DEFAULT_CSS));
    1.87 +		styleSheet.importStyleSheet(Resources.class.getResource("files/style.css"));
    1.88 +		new HTMLEditorKit().setStyleSheet(styleSheet);
    1.89 +		
    1.90 +		
    1.91  		// get the current environment (standard, jnlp, etc.)
    1.92  		this.environment = Environment.getInstance();
    1.93  		
    1.94 @@ -401,9 +420,6 @@
    1.95  
    1.96  		log.setUseParentHandlers(arguments.hasFlag("CONSOLELOG"));
    1.97  		
    1.98 -		// Disable output of errors from SVG icons.
    1.99 -//		SVGLoader.err = null;
   1.100 -	
   1.101  		// replacing console logging by file logging, if possible
   1.102  		try {
   1.103  			File f = new File(this.environment.getBiNAHome(), ".log");
     2.1 --- a/src/org/bina/platform/Session.java	Mon Oct 26 15:32:32 2009 +0100
     2.2 +++ b/src/org/bina/platform/Session.java	Wed Nov 04 14:54:21 2009 +0100
     2.3 @@ -83,7 +83,7 @@
     2.4          }
     2.5          
     2.6          if (PlatformExtensionPoints.workspaceExtensionPoint.getExtensions().size() > 0) {
     2.7 -        	for (AbstractExtension ext : PlatformExtensionPoints.workspaceExtensionPoint.getExtensions()) {
     2.8 +        	for (AbstractExtension<?> ext : PlatformExtensionPoints.workspaceExtensionPoint.getExtensions()) {
     2.9          		if (WorkspaceExtension.class.isInstance(ext)) {
    2.10          			WorkspaceExtension ed = WorkspaceExtension.class.cast(ext);
    2.11  
     3.1 --- a/src/org/bina/platform/environment/WelcomeDialog.java	Mon Oct 26 15:32:32 2009 +0100
     3.2 +++ b/src/org/bina/platform/environment/WelcomeDialog.java	Wed Nov 04 14:54:21 2009 +0100
     3.3 @@ -35,6 +35,8 @@
     3.4  import org.bina.platform.gui.wizards.WizardPageExtension;
     3.5  import org.bina.platformx.PlatformExtensionPoints;
     3.6  
     3.7 +import com.lowagie.text.Font;
     3.8 +
     3.9  
    3.10  
    3.11  /**
    3.12 @@ -60,6 +62,8 @@
    3.13          cancel_button.setText("Quit");
    3.14          cancel_button.setBackground(new Color(255, 150, 150));
    3.15          
    3.16 +        finish_button.setText("Start");
    3.17 +        
    3.18  		LinkedList<AbstractExtension<?>> exts = PlatformExtensionPoints.welcomeWizardExtensionPoint.getExtensions();
    3.19          if (exts != null) {
    3.20          	for (AbstractExtension<?> ped : exts) {
    3.21 @@ -79,6 +83,20 @@
    3.22          }
    3.23      }
    3.24      
    3.25 +    @Override
    3.26 +    public void updateButtons() {
    3.27 +    	super.updateButtons();
    3.28 +    	
    3.29 +    	if (finish_button.isEnabled()) {
    3.30 +    		finish_button.setBackground(new Color(85, 212, 0));
    3.31 +    		finish_button.setFont(finish_button.getFont().deriveFont(Font.BOLD));
    3.32 +    	} else {
    3.33 +    		finish_button.setBackground(back_button.getBackground());
    3.34 +    		finish_button.setFont(finish_button.getFont().deriveFont(Font.NORMAL));
    3.35 +    	}
    3.36 +    		
    3.37 +    }
    3.38 +    
    3.39      public void addPreferencePage(WizardPage wizard) {
    3.40      	addFixedWizardPage(wizard);
    3.41      }
     4.1 --- a/src/org/bina/platform/environment/WelcomePage.java	Mon Oct 26 15:32:32 2009 +0100
     4.2 +++ b/src/org/bina/platform/environment/WelcomePage.java	Wed Nov 04 14:54:21 2009 +0100
     4.3 @@ -77,7 +77,6 @@
     4.4              pane.setContentType("text/html");
     4.5              pane.setEditable(false);
     4.6              
     4.7 -            
     4.8              try {
     4.9                  pane.setPage(Resources.class.getResource(resource));
    4.10              } catch (IOException e1) {
     5.1 --- a/src/org/bina/platform/extensions/PluginManager.java	Mon Oct 26 15:32:32 2009 +0100
     5.2 +++ b/src/org/bina/platform/extensions/PluginManager.java	Wed Nov 04 14:54:21 2009 +0100
     5.3 @@ -104,6 +104,7 @@
     5.4  		registerExtensionPoint(PlatformExtensionPoints.imageExporterExtensionPoint);
     5.5  		registerExtensionPoint(PlatformExtensionPoints.welcomeWizardExtensionPoint);
     5.6  		registerExtensionPoint(PlatformExtensionPoints.startType);
     5.7 +		registerExtensionPoint(PlatformExtensionPoints.helpExtensionPoint);
     5.8  	}
     5.9  	
    5.10  	
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/org/bina/platform/gui/IActiveViewChangedListener.java	Wed Nov 04 14:54:21 2009 +0100
     6.3 @@ -0,0 +1,5 @@
     6.4 +package org.bina.platform.gui;
     6.5 +
     6.6 +public interface IActiveViewChangedListener {
     6.7 +	public void viewChanged(View previous, View current);
     6.8 +}
     7.1 --- a/src/org/bina/platform/gui/MainWindow.java	Mon Oct 26 15:32:32 2009 +0100
     7.2 +++ b/src/org/bina/platform/gui/MainWindow.java	Wed Nov 04 14:54:21 2009 +0100
     7.3 @@ -145,6 +145,7 @@
     7.4  	
     7.5  	LinkedList<Perspective> perspectives = null;
     7.6  	LinkedList<PerspectiveChangedListener> perspectiveChangedListener = null;
     7.7 +	LinkedList<IActiveViewChangedListener> activeViewChangedListener = null;
     7.8  	LinkedList<IActiveEditorChangedListener> activeEditorChangedListener = null;
     7.9  	
    7.10  	GridBagConstraints gbc = null;
    7.11 @@ -171,6 +172,7 @@
    7.12  		this.perspectiveChangedListener = new LinkedList<PerspectiveChangedListener>();
    7.13  		
    7.14  		this.activeEditorChangedListener = new LinkedList<IActiveEditorChangedListener>();
    7.15 +		this.activeViewChangedListener = new LinkedList<IActiveViewChangedListener>();
    7.16  		
    7.17  		this.dockable_view = new HashMap<Dockable, View>();
    7.18  		this.dockable_editor = new HashMap<Dockable, Editor>();
    7.19 @@ -267,7 +269,6 @@
    7.20  								updateMenuContainer();
    7.21  							}
    7.22  						}
    7.23 -						System.out.println("Closing done.");
    7.24  					}
    7.25  				}); 
    7.26  				t.setIndeterminate(true);
    7.27 @@ -279,21 +280,29 @@
    7.28  		
    7.29  		control.addFocusListener(new CFocusListener() {
    7.30  			
    7.31 -			Editor last = null;
    7.32 +			Editor lastEditor = null;
    7.33 +			View lastView = null;
    7.34  			
    7.35  			@Override
    7.36  			public void focusGained(CDockable dockable) {
    7.37  				View view = getView(dockable);
    7.38  				if (view instanceof Editor) {
    7.39  					Editor next = (Editor) view;
    7.40 -					if (last != next) {
    7.41 +					if (lastEditor != next) {
    7.42  						for (IActiveEditorChangedListener l : MainWindow.this.activeEditorChangedListener)
    7.43 -							l.editorChanged(last, next);
    7.44 +							l.editorChanged(lastEditor, next);
    7.45  						
    7.46  						updateMenuContainer();
    7.47  					}
    7.48 -					last = next;
    7.49 +					lastEditor = next;
    7.50  				} else if (view != null) {
    7.51 +					View next = view;
    7.52 +					if (lastView != next) {
    7.53 +						for (IActiveViewChangedListener l : MainWindow.this.activeViewChangedListener)
    7.54 +							l.viewChanged(lastView, next);
    7.55 +					}
    7.56 +					lastView = next;
    7.57 +					
    7.58  					view.updateLocalViewActions();
    7.59  				}
    7.60  				
    7.61 @@ -381,6 +390,29 @@
    7.62  		return false;
    7.63  	}
    7.64  	
    7.65 +	public boolean addActiveViewChangedListener(IActiveViewChangedListener l) {
    7.66 +		if (l != null)
    7.67 +			return this.activeViewChangedListener.add(l);
    7.68 +		return false;
    7.69 +	}
    7.70 +	
    7.71 +	public boolean removeActiveViewChangedListener(IActiveViewChangedListener l) {
    7.72 +		if (l != null)
    7.73 +			return this.activeViewChangedListener.remove(l);
    7.74 +		return false;
    7.75 +	}
    7.76 +	
    7.77 +	public void fireActiveViewChangedEvent() {
    7.78 +		View activeView = getActiveView();
    7.79 +		if (activeView != null) {
    7.80 +			for (IActiveViewChangedListener l : MainWindow.this.activeViewChangedListener)
    7.81 +				l.viewChanged(activeView, activeView);
    7.82 +
    7.83 +
    7.84 +			activeView.updateLocalViewActions();
    7.85 +		}
    7.86 +	}
    7.87 +	
    7.88  	Object createDockable(View view) {
    7.89  		if (view instanceof Editor) {
    7.90  			
    7.91 @@ -486,6 +518,18 @@
    7.92  		}
    7.93  		return null;
    7.94  	}
    7.95 +	
    7.96 +	public View getActiveView() {
    7.97 +		Dockable frontDockable = contentArea.getCenter().getFrontDockable();
    7.98 +		if (frontDockable != null) {
    7.99 +			while (frontDockable instanceof StackDockStation)
   7.100 +				frontDockable = ((StackDockStation) frontDockable).getFrontDockable();
   7.101 +						
   7.102 +			View active = dockable_view.get(frontDockable);
   7.103 +			return active;
   7.104 +		}
   7.105 +		return null;
   7.106 +	}
   7.107  
   7.108  	class EditorFactory extends EmptyMultipleCDockableFactory<DefaultMultipleCDockable> {
   7.109  
     8.1 --- a/src/org/bina/platform/gui/wizards/MultiWizardDialog.java	Mon Oct 26 15:32:32 2009 +0100
     8.2 +++ b/src/org/bina/platform/gui/wizards/MultiWizardDialog.java	Wed Nov 04 14:54:21 2009 +0100
     8.3 @@ -271,6 +271,7 @@
     8.4  		}
     8.5  
     8.6  		super.setVisible(value);
     8.7 +		
     8.8      }
     8.9  	
    8.10  	public void setDialogCanBeSkipped(boolean dialogCanBeSkipped) {
     9.1 --- a/src/org/bina/platform/gui/wizards/WizardDialog.java	Mon Oct 26 15:32:32 2009 +0100
     9.2 +++ b/src/org/bina/platform/gui/wizards/WizardDialog.java	Wed Nov 04 14:54:21 2009 +0100
     9.3 @@ -42,6 +42,7 @@
     9.4  
     9.5  import org.bina.platform.Session;
     9.6  import org.bina.platform.environment.IUserPreferences;
     9.7 +import org.bina.platform.gui.IconRepository;
     9.8  import org.bina.platform.utils.swing.SpecialLineBorder;
     9.9  import org.bina.platformx.util.swing.gradient.GradientPanel;
    9.10  
    9.11 @@ -172,12 +173,14 @@
    9.12  		
    9.13  		CellConstraints cc = new CellConstraints();
    9.14  		
    9.15 -		p.add(this.help_button = new JButton("Help"),		cc.xy(2,  2));
    9.16 +		p.add(this.help_button = new JButton(IconRepository.getIcon("apps/help-browser", 20, 20)),		cc.xy(2,  2));
    9.17  		p.add(this.back_button = new JButton("< Back"),		cc.xy(4,  2));
    9.18  		p.add(this.next_button = new JButton("Next >"),		cc.xy(6,  2));
    9.19 -		p.add(this.finish_button = new JButton("Finish!"),	cc.xy(8,  2));
    9.20 +		p.add(this.finish_button = new JButton("Ok"),	cc.xy(8,  2));
    9.21  		p.add(this.cancel_button = new JButton("Cancel"),	cc.xy(10,  2));
    9.22  		
    9.23 +		this.help_button.setBorderPainted(false);
    9.24 +		
    9.25  		this.help_button.addActionListener(new ActionListener() {
    9.26  			public void actionPerformed(ActionEvent e) {
    9.27  				if (WizardDialog.this.pages.isEmpty())
    10.1 --- a/src/org/bina/platform/resources/files/about.html	Mon Oct 26 15:32:32 2009 +0100
    10.2 +++ b/src/org/bina/platform/resources/files/about.html	Wed Nov 04 14:54:21 2009 +0100
    10.3 @@ -4,7 +4,6 @@
    10.4  	<body>
    10.5  	<br>
    10.6  	<center>
    10.7 -	<font size=3 face="Arial, Verdana">
    10.8  		The <b>Biological Network Analyzer</b> is part of the <a href="http://www.bnplusplus.org/">BN++</a> project.<br>
    10.9  		<br>
   10.10  		Homepage: <a href="http://www.bnplusplus.org/bina">http://www.bnplusplus.org/bina/</a><br>
   10.11 @@ -12,7 +11,6 @@
   10.12  		Author: Andreas Gerasch<br>
   10.13  		Contact: <a href="mailto:gerasch@informatik.uni-tuebingen.de">gerasch@informatik.uni-tuebingen.de</a><br>
   10.14  		<br>
   10.15 -	</font>
   10.16  	</center>
   10.17  	</body>
   10.18  </html>
   10.19 \ No newline at end of file
    11.1 --- a/src/org/bina/platform/resources/files/cacheproxy.html	Mon Oct 26 15:32:32 2009 +0100
    11.2 +++ b/src/org/bina/platform/resources/files/cacheproxy.html	Wed Nov 04 14:54:21 2009 +0100
    11.3 @@ -1,10 +1,8 @@
    11.4  <html>
    11.5  <head></head>
    11.6  <body>
    11.7 -<font size="3" face="Helvetica, Arial, Verdana">
    11.8  Where should BiNA save temporarily files (e.g. downloaded files)?<br/>
    11.9  <br/>
   11.10  If you are behind a proxy, please enter your proxy settings below. You can change these settings later in the preferences. 
   11.11 -</font>
   11.12  </body>
   11.13  </html>
   11.14 \ No newline at end of file
    12.1 --- a/src/org/bina/platform/resources/files/license.html	Mon Oct 26 15:32:32 2009 +0100
    12.2 +++ b/src/org/bina/platform/resources/files/license.html	Wed Nov 04 14:54:21 2009 +0100
    12.3 @@ -7,7 +7,6 @@
    12.4         href="http://www.gnu.org/licenses/lgpl-3.0.rdf" /> 
    12.5  </head>
    12.6  <body>
    12.7 -<font size="3" face="Helvetica, Arial, Verdana">
    12.8  <center>
    12.9  This program is free software: you can redistribute it and/or modify
   12.10  it under the terms of the <b>GNU General Public License</b> as published by
   12.11 @@ -196,5 +195,4 @@
   12.12  apply, that proxy's public statement of acceptance of any version is
   12.13  permanent authorization for you to choose that version for the
   12.14  Library.</p>
   12.15 -</font>
   12.16  </body></html>
   12.17 \ No newline at end of file
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/org/bina/platform/resources/files/style.css	Wed Nov 04 14:54:21 2009 +0100
    13.3 @@ -0,0 +1,10 @@
    13.4 +body {
    13.5 +	font-family: Arial, Verdana;
    13.6 +	font-size: 12pt;
    13.7 +	
    13.8 +}
    13.9 +
   13.10 +h1 {
   13.11 +	font-size: 16pt;
   13.12 +	font-weight:bold;
   13.13 +}
   13.14 \ No newline at end of file
    14.1 --- a/src/org/bina/platform/resources/files/usercreation.html	Mon Oct 26 15:32:32 2009 +0100
    14.2 +++ b/src/org/bina/platform/resources/files/usercreation.html	Wed Nov 04 14:54:21 2009 +0100
    14.3 @@ -1,8 +1,6 @@
    14.4  <html>
    14.5  <head></head>
    14.6  <body>
    14.7 -<font size="3" face="Helvetica, Arial, Verdana">
    14.8  You have choosen <b>multi-user</b> mode, please enter your <b>login</b> and <b>password</b> for the new profile.
    14.9 -</font>
   14.10  </body>
   14.11  </html>
   14.12 \ No newline at end of file
    15.1 --- a/src/org/bina/platform/resources/files/usermodeselection.html	Mon Oct 26 15:32:32 2009 +0100
    15.2 +++ b/src/org/bina/platform/resources/files/usermodeselection.html	Wed Nov 04 14:54:21 2009 +0100
    15.3 @@ -1,7 +1,6 @@
    15.4  <html>
    15.5  <head></head>
    15.6  <body>
    15.7 -<font size="3" face="Helvetica, Arial, Verdana">
    15.8  BiNA can manage multiple profiles per user:
    15.9  <br/>
   15.10  <ul>
   15.11 @@ -9,6 +8,5 @@
   15.12  <li>the <b>multi-user</b> mode should be used, if you wish to have multiple workspace settings.</li>
   15.13  </ul>
   15.14  If you're not sure what to choose, select <b>single-user</b> mode.
   15.15 -</font>
   15.16  </body>
   15.17  </html>
   15.18 \ No newline at end of file
    16.1 --- a/src/org/bina/platform/resources/files/welcome.html	Mon Oct 26 15:32:32 2009 +0100
    16.2 +++ b/src/org/bina/platform/resources/files/welcome.html	Wed Nov 04 14:54:21 2009 +0100
    16.3 @@ -3,15 +3,11 @@
    16.4  
    16.5  <body>
    16.6  <center>
    16.7 -<br/>
    16.8 -<font size="5" face="Arial">Welcome to BiNA - the Biological Network Analyzer!</font><br/>
    16.9 -<br/>
   16.10 +<h1>Welcome to BiNA - the Biological Network Analyzer!</h1>
   16.11  </center>
   16.12 -<font size="3" face="Helvetica, Arial, Verdana">
   16.13  This is the first time you run this program. Some features of BiNA require a short configuration before you can start using them.
   16.14  Please, follow the instructions on the next pages.<br/>
   16.15  <br/>
   16.16  To continue, click on the <b>next</b>-button below... 
   16.17 -</font>
   16.18  </body>
   16.19  </html>
   16.20 \ No newline at end of file
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/src/org/bina/platform/resources/help/PlatformHelp.java	Wed Nov 04 14:54:21 2009 +0100
    17.3 @@ -0,0 +1,12 @@
    17.4 +package org.bina.platform.resources.help;
    17.5 +
    17.6 +import org.bina.platformx.views.help.HelpResource;
    17.7 +
    17.8 +public class PlatformHelp extends HelpResource {
    17.9 +
   17.10 +	@Override
   17.11 +	public String getId() {
   17.12 +		return "platform";
   17.13 +	}
   17.14 +
   17.15 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/org/bina/platform/resources/help/help.css	Wed Nov 04 14:54:21 2009 +0100
    18.3 @@ -0,0 +1,21 @@
    18.4 +body {
    18.5 +	font-family: Arial, Verdana;
    18.6 +	font-size: 12pt;
    18.7 +	
    18.8 +	padding: 0 5 0 5;
    18.9 +}
   18.10 +
   18.11 +h1 {
   18.12 +	font-size: 15pt;
   18.13 +	font-weight:bold;
   18.14 +}
   18.15 +
   18.16 +h2 {
   18.17 +	font-size: 12pt;
   18.18 +	font-weight:bold;
   18.19 +}
   18.20 +
   18.21 +h3 {
   18.22 +	font-size: 12pt;
   18.23 +	font-weight:italic;
   18.24 +}
   18.25 \ No newline at end of file
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/org/bina/platform/resources/help/views/outline.html	Wed Nov 04 14:54:21 2009 +0100
    19.3 @@ -0,0 +1,8 @@
    19.4 +<html>
    19.5 +<body>
    19.6 +<h1>Outline View</h1>
    19.7 +
    19.8 +Displays the outline of an editor (e.g. visualization).
    19.9 +
   19.10 +</body>
   19.11 +</html>
   19.12 \ No newline at end of file
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/org/bina/platform/resources/help/views/start.html	Wed Nov 04 14:54:21 2009 +0100
    20.3 @@ -0,0 +1,10 @@
    20.4 +<html>
    20.5 +<body>
    20.6 +<h1>Start View</h1>
    20.7 +
    20.8 +<p>This view displays available pre-defined workflows/wizards.</p>
    20.9 +
   20.10 +<p>Select one and press the next-button below.</p>  
   20.11 +
   20.12 +</body>
   20.13 +</html>
   20.14 \ No newline at end of file
    21.1 Binary file src/org/bina/platform/resources/icons/platform/pastedpic_09252009_101503.png has changed
    22.1 --- a/src/org/bina/platform/resources/tango/actions/system-log-out.svg	Mon Oct 26 15:32:32 2009 +0100
    22.2 +++ b/src/org/bina/platform/resources/tango/actions/system-log-out.svg	Wed Nov 04 14:54:21 2009 +0100
    22.3 @@ -232,7 +232,7 @@
    22.4         y2="43.25"
    22.5         gradientUnits="userSpaceOnUse"
    22.6         gradientTransform="translate(-12.020815,0)" />
    22.7 -    <filter
    22.8 +    <!--filter
    22.9         inkscape:collect="always"
   22.10         x="-0.14153846"
   22.11         width="1.2830769"
   22.12 @@ -255,7 +255,7 @@
   22.13           inkscape:collect="always"
   22.14           stdDeviation="0.76879489"
   22.15           id="feGaussianBlur6453" />
   22.16 -    </filter>
   22.17 +    </filter-->
   22.18      <radialGradient
   22.19         inkscape:collect="always"
   22.20         xlink:href="#linearGradient8662"
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/org/bina/platform/utils/swing/ComponentUtilities.java	Wed Nov 04 14:54:21 2009 +0100
    23.3 @@ -0,0 +1,78 @@
    23.4 +package org.bina.platform.utils.swing;
    23.5 +
    23.6 +import java.awt.Color;
    23.7 +import java.awt.Desktop;
    23.8 +import java.awt.Dimension;
    23.9 +import java.io.IOException;
   23.10 +import java.net.URL;
   23.11 +
   23.12 +import javax.swing.BorderFactory;
   23.13 +import javax.swing.JComponent;
   23.14 +import javax.swing.JScrollPane;
   23.15 +import javax.swing.JTextPane;
   23.16 +import javax.swing.ScrollPaneConstants;
   23.17 +import javax.swing.event.HyperlinkEvent;
   23.18 +import javax.swing.event.HyperlinkListener;
   23.19 +
   23.20 +import org.bina.platform.Core;
   23.21 +
   23.22 +public class ComponentUtilities {
   23.23 +	
   23.24 +	public static JTextPane createHTMLTextPane(URL resource) {
   23.25 +		JTextPane pane = new JTextPane();
   23.26 +		pane.setContentType("text/html");
   23.27 +		pane.setEditable(false);
   23.28 +		pane.addHyperlinkListener(new HyperlinkListener() {
   23.29 +
   23.30 +			@Override
   23.31 +			public void hyperlinkUpdate(final HyperlinkEvent e) {
   23.32 +				if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
   23.33 +					new Thread() {
   23.34 +						@Override
   23.35 +						public void run() {
   23.36 +							try {
   23.37 +								Desktop.getDesktop().browse(e.getURL().toURI());
   23.38 +							} catch (Exception e) {
   23.39 +								e.printStackTrace();
   23.40 +							} 
   23.41 +						}
   23.42 +					}.start();
   23.43 +				}
   23.44 +			}
   23.45 +		});
   23.46 +
   23.47 +		if (resource != null) {
   23.48 +			try {
   23.49 +				pane.setPage(resource);
   23.50 +			} catch (IOException e) {
   23.51 +				Core.logException(e);
   23.52 +			}
   23.53 +		}
   23.54 +
   23.55 +		return pane;
   23.56 +	}
   23.57 +
   23.58 +	public static JScrollPane createPlainEditorScrollPane(JComponent comp) {
   23.59 +
   23.60 +		JScrollPane editorScrollPane = new JScrollPane(comp);
   23.61 +
   23.62 +		editorScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
   23.63 +        editorScrollPane.setBackground(Color.WHITE);
   23.64 +        editorScrollPane.setBorder(BorderFactory.createEmptyBorder());
   23.65 +        
   23.66 +        return editorScrollPane;
   23.67 +	}
   23.68 +	
   23.69 +	public static JScrollPane createPlainEditorScrollPane(JComponent comp, int height) {
   23.70 +
   23.71 +		JScrollPane editorScrollPane = new JScrollPane(comp);
   23.72 +
   23.73 +		editorScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
   23.74 +		editorScrollPane.setPreferredSize(new Dimension(250, height));
   23.75 +        editorScrollPane.setMinimumSize(new Dimension(10, 10));
   23.76 +        editorScrollPane.setBackground(Color.WHITE);
   23.77 +        editorScrollPane.setBorder(BorderFactory.createEmptyBorder());
   23.78 +        
   23.79 +        return editorScrollPane;
   23.80 +	}
   23.81 +}
    24.1 --- a/src/org/bina/platformx/PlatformExtensionPoints.java	Mon Oct 26 15:32:32 2009 +0100
    24.2 +++ b/src/org/bina/platformx/PlatformExtensionPoints.java	Wed Nov 04 14:54:21 2009 +0100
    24.3 @@ -21,6 +21,7 @@
    24.4   */
    24.5  package org.bina.platformx;
    24.6  
    24.7 +import org.bina.platform.extensions.DefaultExtension;
    24.8  import org.bina.platform.extensions.DefaultExtensionPointHandler;
    24.9  import org.bina.platform.extensions.Workspace;
   24.10  import org.bina.platform.extensions.ExtensionPoint;
   24.11 @@ -30,10 +31,13 @@
   24.12  import org.bina.platform.gui.action.PlatformAction;
   24.13  import org.bina.platform.gui.wizards.WizardFactory;
   24.14  import org.bina.platform.gui.wizards.WizardPage;
   24.15 +import org.bina.platform.resources.help.PlatformHelp;
   24.16  import org.bina.platformx.util.swing.export.ImageExporter;
   24.17  import org.bina.platformx.views.ConsoleView;
   24.18  import org.bina.platformx.views.ProgressView;
   24.19  import org.bina.platformx.views.PropertiesView;
   24.20 +import org.bina.platformx.views.help.HelpResource;
   24.21 +import org.bina.platformx.views.help.HelpView;
   24.22  import org.bina.platformx.views.outline.OutlineView;
   24.23  import org.bina.platformx.wizards.start.StartWizard;
   24.24  
   24.25 @@ -59,6 +63,8 @@
   24.26  
   24.27  	public static final ExtensionPoint startType = new ExtensionPoint("org.bina.platform.gui.start", "Start Type", new DefaultExtensionPointHandler("start_type"));
   24.28  	
   24.29 +	public static final ExtensionPoint helpExtensionPoint = new ExtensionPoint("org.bina.platform.help", "Help", new DefaultExtensionPointHandler("help", HelpResource.class));
   24.30 +	
   24.31  
   24.32  	static {
   24.33  		View.viewsExtensionPoint.registerExtension(new View.ViewExtension("console_view", "Console", IconRepository.getIcon("apps/utilities-terminal", 20, 20), ConsoleView.class, true));
   24.34 @@ -66,6 +72,9 @@
   24.35  		View.viewsExtensionPoint.registerExtension(new View.ViewExtension("properties_view", "Properties", null, PropertiesView.class, true));
   24.36  		View.viewsExtensionPoint.registerExtension(new View.ViewExtension("progress_view", "Progress", null, ProgressView.class, true));
   24.37  		View.viewsExtensionPoint.registerExtension(new View.ViewExtension("start_wizard", "Start", null, StartWizard.class, true));
   24.38 +		View.viewsExtensionPoint.registerExtension(new View.ViewExtension("help_view", "Help", null, HelpView.class, true));
   24.39 +		
   24.40 +		helpExtensionPoint.registerExtension(new DefaultExtension<HelpResource>("help", "platform_help", "Platform Help", PlatformHelp.class));
   24.41  	}
   24.42  	
   24.43  }
    25.1 --- a/src/org/bina/platformx/util/swing/AutoCompletion.java	Mon Oct 26 15:32:32 2009 +0100
    25.2 +++ b/src/org/bina/platformx/util/swing/AutoCompletion.java	Wed Nov 04 14:54:21 2009 +0100
    25.3 @@ -108,7 +108,7 @@
    25.4  		
    25.5  		this.keyListener = new KeyAdapter() {
    25.6              public void keyPressed(KeyEvent e) {
    25.7 -            	if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) > 0 && e.getKeyCode() == KeyEvent.VK_SPACE) {
    25.8 +            	if (isTrigger(e)) {
    25.9              		int i = AutoCompletion.this.textField.getCaretPosition();
   25.10              		if (AutoCompletion.this.fullReplacement)
   25.11              			i = 0;
   25.12 @@ -199,6 +199,12 @@
   25.13  
   25.14  	}
   25.15  	
   25.16 +	
   25.17 +	protected boolean isTrigger(KeyEvent e) {
   25.18 +		return (e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) > 0 && e.getKeyCode() == KeyEvent.VK_SPACE;
   25.19 +	}
   25.20 +	
   25.21 +	
   25.22  	private boolean disposed = false;
   25.23  	public synchronized void dispose() {
   25.24  		if (this.disposed) return;
    26.1 --- a/src/org/bina/platformx/views/help/HelpManagement.java	Mon Oct 26 15:32:32 2009 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,129 +0,0 @@
    26.4 -/*
    26.5 - *  Copyright (C) 2004 - 2009 -- Andreas Gerasch
    26.6 - * 
    26.7 - *  This file is part of BiNA.
    26.8 - *
    26.9 - *  BiNA is free software: you can redistribute it and/or modify
   26.10 - *  it under the terms of the GNU Lesser General Public License as published 
   26.11 - *  by the Free Software Foundation, either version 3 of the License, or
   26.12 - *  (at your option) any later version.
   26.13 - *
   26.14 - *  BiNA is distributed in the hope that it will be useful,
   26.15 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   26.16 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   26.17 - *  GNU Lesser General Public License for more details.
   26.18 - *
   26.19 - *  You should have received a copy of the GNU Lesser General Public License
   26.20 - *  along with this program. If not, see <http://www.gnu.org/licenses/>.
   26.21 - *  
   26.22 - *  $Id: HelpManagement.java,v 1.4 2009/07/15 11:10:25 gerasch Exp $
   26.23 - *
   26.24 - */
   26.25 -package org.bina.platformx.views.help;
   26.26 -
   26.27 -import java.awt.KeyEventPostProcessor;
   26.28 -import java.awt.KeyboardFocusManager;
   26.29 -import java.awt.event.FocusEvent;
   26.30 -import java.awt.event.FocusListener;
   26.31 -import java.awt.event.KeyEvent;
   26.32 -import java.util.HashMap;
   26.33 -
   26.34 -import javax.swing.JComponent;
   26.35 -
   26.36 -import org.bina.platform.Session;
   26.37 -import org.bina.platform.gui.MainWindow;
   26.38 -import org.bina.platformx.views.ConsoleView;
   26.39 -
   26.40 -/**
   26.41 - * @author Andreas Gerasch
   26.42 - *
   26.43 - */
   26.44 -public class HelpManagement {
   26.45 -	
   26.46 -	private static HashMap<Session, HelpManagement> session_instance = new HashMap<Session, HelpManagement>();
   26.47 -	
   26.48 -	public static HelpManagement getInstance(Session session) {
   26.49 -		HelpManagement view = session_instance.get(session);
   26.50 -		if (view == null) {
   26.51 -			view = new HelpManagement(session);
   26.52 -			session_instance.put(session, view);
   26.53 -		}
   26.54 -		return view;
   26.55 -	}
   26.56 -	
   26.57 -	private final Session session;
   26.58 -	
   26.59 -	private HashMap<Object, HelpProvider> object_provider = null;
   26.60 -
   26.61 -	private HelpView view;
   26.62 -
   26.63 -	private MainWindow mainWindow;
   26.64 -	
   26.65 -	/**
   26.66 -	 * 
   26.67 -	 */
   26.68 -	public HelpManagement(Session session) {
   26.69 -		this.session = session;
   26.70 -		
   26.71 -		object_provider = new HashMap<Object, HelpProvider>();
   26.72 -		
   26.73 -		mainWindow = session.getMainWindow();
   26.74 -		
   26.75 -		view = HelpView.getInstance(session);
   26.76 -		
   26.77 -		
   26.78 -		// register help action
   26.79 -		KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(new KeyEventPostProcessor() {
   26.80 -
   26.81 -			public boolean postProcessKeyEvent(KeyEvent e) {
   26.82 -				if (e.getKeyCode() == KeyEvent.VK_F1 && (e.getID() & KeyEvent.KEY_RELEASED) == KeyEvent.KEY_RELEASED ) {
   26.83 -					if (e.getSource() instanceof HelpProvider)
   26.84 -						view.showHelp(e.getSource(), (HelpProvider) e.getSource());
   26.85 -					else if (object_provider.containsKey(e.getSource())) {
   26.86 -						view.showHelp(e.getSource(), object_provider.get(e.getSource()));
   26.87 -					} else
   26.88 -						view.showHelp(null, null);
   26.89 -					
   26.90 -					if (e.getComponent() instanceof JComponent)
   26.91 -						((JComponent) e.getComponent()).grabFocus();
   26.92 -					return true;
   26.93 -				}
   26.94 -				return false;
   26.95 -			}
   26.96 -			
   26.97 -		});
   26.98 -		
   26.99 -        mainWindow.addFocusListener(new FocusListener() {
  26.100 -
  26.101 -			public void focusGained(FocusEvent e) {
  26.102 -				if (object_provider.containsKey(e.getSource())) // TODO && view.isVisible())
  26.103 -					view.showHelp(e.getSource(), object_provider.get(e.getSource()));
  26.104 -			}
  26.105 -
  26.106 -			public void focusLost(FocusEvent e) {
  26.107 -				
  26.108 -			}
  26.109 -        	
  26.110 -        });
  26.111 -		
  26.112 -		
  26.113 -	}
  26.114 -	
  26.115 -	public void registerHelpProvider(Object source, HelpProvider provider) {
  26.116 -		object_provider.put(source, provider);
  26.117 -	}
  26.118 -	
  26.119 -	public HelpView getHelpView() {
  26.120 -		return view;
  26.121 -	}
  26.122 -	
  26.123 -	public void showHelpView() {
  26.124 -//		mainWindow.addView(view);
  26.125 -	}
  26.126 -	
  26.127 -	public void showHelpView(Object source, HelpProvider provider) {
  26.128 -		view.showHelp(source, provider);
  26.129 -	}
  26.130 -	
  26.131 -	
  26.132 -}
    27.1 --- a/src/org/bina/platformx/views/help/HelpProvider.java	Mon Oct 26 15:32:32 2009 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,30 +0,0 @@
    27.4 -/*
    27.5 - *  Copyright (C) 2004 - 2009 -- Andreas Gerasch
    27.6 - * 
    27.7 - *  This file is part of BiNA.
    27.8 - *
    27.9 - *  BiNA is free software: you can redistribute it and/or modify
   27.10 - *  it under the terms of the GNU Lesser General Public License as published 
   27.11 - *  by the Free Software Foundation, either version 3 of the License, or
   27.12 - *  (at your option) any later version.
   27.13 - *
   27.14 - *  BiNA is distributed in the hope that it will be useful,
   27.15 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   27.16 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   27.17 - *  GNU Lesser General Public License for more details.
   27.18 - *
   27.19 - *  You should have received a copy of the GNU Lesser General Public License
   27.20 - *  along with this program. If not, see <http://www.gnu.org/licenses/>.
   27.21 - *  
   27.22 - *  $Id: HelpProvider.java,v 1.3 2009/07/15 11:10:25 gerasch Exp $
   27.23 - *
   27.24 - */
   27.25 -package org.bina.platformx.views.help;
   27.26 -
   27.27 -/**
   27.28 - * @author Andreas Gerasch
   27.29 - *
   27.30 - */
   27.31 -public interface HelpProvider {
   27.32 -	public String getHelpText(Object source);
   27.33 -}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/org/bina/platformx/views/help/HelpResource.java	Wed Nov 04 14:54:21 2009 +0100
    28.3 @@ -0,0 +1,13 @@
    28.4 +package org.bina.platformx.views.help;
    28.5 +
    28.6 +import java.net.URL;
    28.7 +
    28.8 +public abstract class HelpResource {
    28.9 +	
   28.10 +	public abstract String getId();
   28.11 +	
   28.12 +	public URL getResource(String link) {
   28.13 +		return this.getClass().getResource(link);
   28.14 +	}
   28.15 +
   28.16 +}
    29.1 --- a/src/org/bina/platformx/views/help/HelpView.java	Mon Oct 26 15:32:32 2009 +0100
    29.2 +++ b/src/org/bina/platformx/views/help/HelpView.java	Wed Nov 04 14:54:21 2009 +0100
    29.3 @@ -21,24 +21,39 @@
    29.4   */
    29.5  package org.bina.platformx.views.help;
    29.6  
    29.7 -import java.awt.Color;
    29.8 +import java.awt.Desktop;
    29.9 +import java.awt.event.ActionEvent;
   29.10 +import java.io.IOException;
   29.11  import java.lang.ref.WeakReference;
   29.12 +import java.net.URL;
   29.13 +import java.util.HashMap;
   29.14 +import java.util.LinkedList;
   29.15  import java.util.WeakHashMap;
   29.16  
   29.17 -import javax.swing.ImageIcon;
   29.18 -import javax.swing.JScrollPane;
   29.19 +import javax.swing.AbstractAction;
   29.20  import javax.swing.JTextPane;
   29.21 +import javax.swing.event.HyperlinkEvent;
   29.22 +import javax.swing.event.HyperlinkListener;
   29.23 +import javax.swing.text.html.HTMLEditorKit;
   29.24 +import javax.swing.text.html.StyleSheet;
   29.25  
   29.26 +import org.bina.platform.Core;
   29.27  import org.bina.platform.Session;
   29.28 +import org.bina.platform.extensions.AbstractExtension;
   29.29 +import org.bina.platform.gui.IActiveViewChangedListener;
   29.30  import org.bina.platform.gui.IconRepository;
   29.31  import org.bina.platform.gui.View;
   29.32 -import org.bina.platform.resources.Resources;
   29.33 +import org.bina.platform.gui.action.IMenuContainer;
   29.34 +import org.bina.platform.resources.help.PlatformHelp;
   29.35 +import org.bina.platform.utils.swing.ComponentUtilities;
   29.36 +import org.bina.platformx.PlatformExtensionPoints;
   29.37  
   29.38  /**
   29.39   * @author Andreas Gerasch
   29.40   *
   29.41   */
   29.42 -public class HelpView extends View {
   29.43 +public class HelpView extends View implements IActiveViewChangedListener {
   29.44 +	
   29.45  	private static final long serialVersionUID = 1264088012706946014L;
   29.46  	
   29.47  	private static WeakHashMap<Session, WeakReference<HelpView>> session_view = new WeakHashMap<Session, WeakReference<HelpView>>();
   29.48 @@ -54,49 +69,166 @@
   29.49  
   29.50  	private JTextPane textPane = null;
   29.51  	
   29.52 +	private HashMap<String, HelpResource> id_help = null; 
   29.53 +	
   29.54 +	private LinkedList<URL> history = null;
   29.55 +	
   29.56  	private HelpView(Session session) {
   29.57          super(session, "help", "Help", IconRepository.getIcon("apps/help-browser", 20, 20));
   29.58 +    
   29.59          
   29.60          
   29.61 -//        setLayout(new BorderLayout());
   29.62 +        id_help = new HashMap<String, HelpResource>();
   29.63 +        
   29.64 +        for (AbstractExtension<?> ae : PlatformExtensionPoints.helpExtensionPoint.getExtensions()) {
   29.65 +        	Class<?> extensionClass = ae.getExtensionClass();
   29.66 +        	try {
   29.67 +				HelpResource help = (HelpResource) extensionClass.newInstance();
   29.68 +				id_help.put(help.getId(), help);
   29.69 +			} catch (Exception e) {
   29.70 +				e.printStackTrace();
   29.71 +			} 
   29.72 +        }
   29.73 +        
   29.74 +        history = new LinkedList<URL>();
   29.75          
   29.76          textPane = new JTextPane();
   29.77 -        textPane.setBackground(new Color(249, 240, 160));
   29.78          textPane.setContentType("text/html");
   29.79          textPane.setEditable(false);
   29.80 -        setComponent(new JScrollPane(textPane));
   29.81 +        textPane.addHyperlinkListener(new HyperlinkListener() {
   29.82 +
   29.83 +			@Override
   29.84 +			public void hyperlinkUpdate(final HyperlinkEvent e) {
   29.85 +				if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
   29.86 +					new Thread() {
   29.87 +						@Override
   29.88 +						public void run() {
   29.89 +							String description = e.getDescription();
   29.90 +							
   29.91 +							if (description.startsWith("/")) {
   29.92 +								description = description.substring(1);
   29.93 +								int i = description.indexOf("/");
   29.94 +								if (i > 0) {
   29.95 +									String id = description.substring(0, i);
   29.96 +									String link = description.substring(i + 1);
   29.97 +									HelpResource helpResource = id_help.get(id);
   29.98 +									if (helpResource != null) {
   29.99 +										URL resource = helpResource.getResource(link);
  29.100 +										addURL(resource);
  29.101 +										updateView();
  29.102 +									}
  29.103 +										
  29.104 +								}
  29.105 +							} else {
  29.106 +								try {
  29.107 +									Desktop.getDesktop().browse(e.getURL().toURI());
  29.108 +								} catch (Exception e) {
  29.109 +									e.printStackTrace();
  29.110 +								} 
  29.111 +							}
  29.112 +							
  29.113 +						}
  29.114 +					}.start();
  29.115 +				}
  29.116 +			}
  29.117 +		});
  29.118 +        
  29.119 +		final StyleSheet styleSheet = new StyleSheet();
  29.120 +		styleSheet.importStyleSheet(HTMLEditorKit.class.getResource(HTMLEditorKit.DEFAULT_CSS));
  29.121 +		styleSheet.importStyleSheet(PlatformHelp.class.getResource("help.css"));
  29.122 +        
  29.123 +		textPane.setEditorKit(new HTMLEditorKit() {
  29.124 +			private static final long serialVersionUID = 8592733449126930157L;
  29.125 +
  29.126 +			@Override
  29.127 +			public void setStyleSheet(StyleSheet s) {
  29.128 +			}
  29.129 +			
  29.130 +			@Override
  29.131 +			public StyleSheet getStyleSheet() {
  29.132 +				return styleSheet;
  29.133 +			}
  29.134 +		});
  29.135 +
  29.136 +        setComponent(ComponentUtilities.createPlainEditorScrollPane(textPane));
  29.137 +        
  29.138 +        session.getMainWindow().addActiveViewChangedListener(this);
  29.139      }
  29.140  	
  29.141 -	public void showHelp(Object source, HelpProvider provider) {
  29.142 -		String s = "";
  29.143 -		if (provider == null) {
  29.144 -			s = "<html><body bgcolor=\"#f9f0a0\"><font size=\"3\">No help available!</font></body></html>";
  29.145 +	@Override
  29.146 +	public void viewChanged(View previous, View current) {
  29.147 +		if (current == this)
  29.148 +			return;
  29.149 +
  29.150 +		history.clear();
  29.151 +		
  29.152 +		if (current instanceof IHelpProvider)
  29.153 +			addURL(((IHelpProvider) current).getHelpResource());
  29.154 +		
  29.155 +		updateView();
  29.156 +	}
  29.157 +	
  29.158 +	private boolean addURL(URL url) {
  29.159 +		if (url == null)
  29.160 +			return false;
  29.161 +		
  29.162 +		if (history.isEmpty())
  29.163 +			history.add(url);
  29.164 +		else if (!history.getLast().equals(url))
  29.165 +			history.add(url);
  29.166 +		else
  29.167 +			return false;
  29.168 +		
  29.169 +		return true;
  29.170 +	}
  29.171 +	
  29.172 +	public synchronized void showURL(URL url) {
  29.173 +		addURL(url);
  29.174 +
  29.175 +		updateView();
  29.176 +	}
  29.177 +	
  29.178 +	private void updateView() {
  29.179 +		if (!history.isEmpty()) {
  29.180 +			URL url = history.getLast();
  29.181 +			try {
  29.182 +				textPane.setPage(url);
  29.183 +			} catch (IOException e) {
  29.184 +				e.printStackTrace();
  29.185 +				Core.logException(e);
  29.186 +			}
  29.187  		} else {
  29.188 -			s = provider.getHelpText(source);
  29.189 -			if (s == null) {
  29.190 -				s = "<html><body bgcolor=\"#f9f0a0\"><font size=\"3\">No help available!</font></body></html>";
  29.191 -			} else if (!s.startsWith("<html>")) {
  29.192 -				s = "<html><body bgcolor=\"#f9f0a0\"><font size=\"3\">" + s + "</font</body></html>";
  29.193 +			try {
  29.194 +				textPane.setPage(PlatformHelp.class.getResource("empty.html"));
  29.195 +			} catch (IOException e) {
  29.196 +				e.printStackTrace();
  29.197 +				Core.logException(e);
  29.198  			}
  29.199  		}
  29.200 -		textPane.setText(s);
  29.201  		
  29.202 -//		mainWindow.addView(this);
  29.203 +		updateLocalViewActions();
  29.204 +		
  29.205  	}
  29.206  	
  29.207 -	
  29.208 -	public void setHelpText(String html) {
  29.209 -		String s = html;
  29.210 -		if (s == null) {
  29.211 -			s = "<html><body bgcolor=\"#f9f0a0\"><font size=\"3\">No help available!</font></body></html>";
  29.212 -		} else if (!s.startsWith("<html>")) {
  29.213 -			s = "<html><body bgcolor=\"#f9f0a0\"><font size=\"3\">" + html + "</font></body></html>";
  29.214 -		}
  29.215 -		textPane.setText(s);
  29.216 +	public synchronized void goBack() {
  29.217 +		if (history.size() > 1)
  29.218 +			history.removeLast();
  29.219 +		
  29.220 +		updateView();
  29.221  	}
  29.222  	
  29.223 -	public void clearHelpText() {
  29.224 -		textPane.setText("");
  29.225 +	@Override
  29.226 +	protected boolean contributeLocalViewActions(IMenuContainer container, String anchor) {
  29.227 +		if (history.size() > 1) {
  29.228 +			container.contributeToolbarItem(anchor, "back", "Back", "actions/go-previous", new AbstractAction() {
  29.229 +				@Override
  29.230 +				public void actionPerformed(ActionEvent e) {
  29.231 +					goBack();
  29.232 +				}
  29.233 +			});
  29.234 +			return true;
  29.235 +		}
  29.236 +		return false;
  29.237  	}
  29.238  	
  29.239  }
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/src/org/bina/platformx/views/help/IHelpProvider.java	Wed Nov 04 14:54:21 2009 +0100
    30.3 @@ -0,0 +1,34 @@
    30.4 +/*
    30.5 + *  Copyright (C) 2004 - 2009 -- Andreas Gerasch
    30.6 + * 
    30.7 + *  This file is part of BiNA.
    30.8 + *
    30.9 + *  BiNA is free software: you can redistribute it and/or modify
   30.10 + *  it under the terms of the GNU Lesser General Public License as published 
   30.11 + *  by the Free Software Foundation, either version 3 of the License, or
   30.12 + *  (at your option) any later version.
   30.13 + *
   30.14 + *  BiNA is distributed in the hope that it will be useful,
   30.15 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   30.16 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   30.17 + *  GNU Lesser General Public License for more details.
   30.18 + *
   30.19 + *  You should have received a copy of the GNU Lesser General Public License
   30.20 + *  along with this program. If not, see <http://www.gnu.org/licenses/>.
   30.21 + *  
   30.22 + *  $Id: HelpProvider.java,v 1.3 2009/07/15 11:10:25 gerasch Exp $
   30.23 + *
   30.24 + */
   30.25 +package org.bina.platformx.views.help;
   30.26 +
   30.27 +import java.net.URL;
   30.28 +
   30.29 +/**
   30.30 + * @author Andreas Gerasch
   30.31 + *
   30.32 + */
   30.33 +public interface IHelpProvider {
   30.34 +	
   30.35 +	public URL getHelpResource();
   30.36 +	
   30.37 +}
    31.1 --- a/src/org/bina/platformx/views/outline/OutlineView.java	Mon Oct 26 15:32:32 2009 +0100
    31.2 +++ b/src/org/bina/platformx/views/outline/OutlineView.java	Wed Nov 04 14:54:21 2009 +0100
    31.3 @@ -22,6 +22,7 @@
    31.4  package org.bina.platformx.views.outline;
    31.5  
    31.6  import java.lang.ref.WeakReference;
    31.7 +import java.net.URL;
    31.8  import java.util.ArrayList;
    31.9  import java.util.ListIterator;
   31.10  import java.util.WeakHashMap;
   31.11 @@ -36,6 +37,8 @@
   31.12  import org.bina.platform.gui.View;
   31.13  import org.bina.platform.gui.action.IMenuContainer;
   31.14  import org.bina.platform.gui.action.MenuContributor;
   31.15 +import org.bina.platform.resources.help.PlatformHelp;
   31.16 +import org.bina.platformx.views.help.IHelpProvider;
   31.17  
   31.18  
   31.19  /**
   31.20 @@ -44,7 +47,7 @@
   31.21   * @author Andreas Gerasch
   31.22   *
   31.23   */
   31.24 -public class OutlineView extends View implements IActiveEditorChangedListener {
   31.25 +public class OutlineView extends View implements IActiveEditorChangedListener, IHelpProvider {
   31.26  	private static final long serialVersionUID = -692326112450687222L;
   31.27  	
   31.28  	private static WeakHashMap<Session, WeakReference<OutlineView>> session_view = new WeakHashMap<Session, WeakReference<OutlineView>>();
   31.29 @@ -100,6 +103,11 @@
   31.30  	}
   31.31  	
   31.32  	@Override
   31.33 +	public URL getHelpResource() {
   31.34 +		return PlatformHelp.class.getResource("views/outline.html");
   31.35 +	}
   31.36 +	
   31.37 +	@Override
   31.38  	protected boolean contributeLocalViewActions(IMenuContainer menuContainer, String anchor) {
   31.39  		  if (outline instanceof MenuContributor) {
   31.40  			  MenuContributor.class.cast(outline).contributeToMenu(menuContainer);
    32.1 --- a/src/org/bina/platformx/wizards/start/StartWizard.java	Mon Oct 26 15:32:32 2009 +0100
    32.2 +++ b/src/org/bina/platformx/wizards/start/StartWizard.java	Wed Nov 04 14:54:21 2009 +0100
    32.3 @@ -22,6 +22,7 @@
    32.4  package org.bina.platformx.wizards.start;
    32.5  
    32.6  import java.lang.ref.WeakReference;
    32.7 +import java.net.URL;
    32.8  import java.util.WeakHashMap;
    32.9  
   32.10  import javax.swing.SwingUtilities;
   32.11 @@ -30,14 +31,16 @@
   32.12  import org.bina.platform.gui.IconRepository;
   32.13  import org.bina.platform.gui.Perspective;
   32.14  import org.bina.platform.gui.wizards.WizardView;
   32.15 +import org.bina.platform.resources.help.PlatformHelp;
   32.16  import org.bina.platformx.util.start.AbstractStartType;
   32.17 +import org.bina.platformx.views.help.IHelpProvider;
   32.18  
   32.19  
   32.20  /**
   32.21   * @author Andreas Gerasch
   32.22   *
   32.23   */
   32.24 -public class StartWizard extends WizardView {
   32.25 +public class StartWizard extends WizardView implements IHelpProvider {
   32.26  
   32.27  	private static WeakHashMap<Session, WeakReference<StartWizard>> session_view = new WeakHashMap<Session, WeakReference<StartWizard>>();
   32.28  	
   32.29 @@ -115,4 +118,19 @@
   32.30  		goNext();
   32.31  		updatePageView();
   32.32  	}
   32.33 +	
   32.34 +	@Override
   32.35 +	public void updatePageView() {
   32.36 +		super.updatePageView();
   32.37 +		session.getMainWindow().fireActiveViewChangedEvent();
   32.38 +	}
   32.39 +	
   32.40 +	
   32.41 +	@Override
   32.42 +	public URL getHelpResource() {
   32.43 +		if (this.pages.getLast() instanceof IHelpProvider)
   32.44 +			return ((IHelpProvider) this.pages.getLast()).getHelpResource();
   32.45 +		
   32.46 +		return PlatformHelp.class.getResource("views/start.html");
   32.47 +	}
   32.48  }