org.gudy.azureus2.ui.swt.views
Class AbstractIView

java.lang.Object
  extended by org.gudy.azureus2.ui.swt.views.AbstractIView
All Implemented Interfaces:
org.gudy.azureus2.ui.swt.IconBarEnabler, org.gudy.azureus2.ui.swt.mainwindow.Refreshable, IView
Direct Known Subclasses:
PluginView, UISWTPluginView

public abstract class AbstractIView
extends java.lang.Object
implements IView

Author:
René

Field Summary
protected  org.gudy.azureus2.core3.util.AEMonitor this_mon
           
 
Constructor Summary
AbstractIView()
           
 
Method Summary
 void dataSourceChanged(java.lang.Object newDataSource)
          Called when the selected dataSource has changed.
 void delete()
          A basic implementation that disposes the composite Should be called with super.delete() from any extending class.
 void generateDiagnostics(org.gudy.azureus2.core3.util.IndentWriter writer)
          Called when Azureus generates Diagnostics.
 org.eclipse.swt.widgets.Composite getComposite()
          This method is called after initialize so that the Tab is set its control Caller is the GUI Thread.
 java.lang.String getData()
          Data 'could' store a key to a language file, in order to support multi-language titles
 java.lang.String getFullTitle()
          Called in order to set / update the title of this View.
 java.lang.String getShortTitle()
          Called in order to set / update the short title of this view.
 void initialize(org.eclipse.swt.widgets.Composite composite)
          This method is called when the view is instanciated, it should initialize all GUI components.
 boolean isEnabled(java.lang.String itemKey)
           
 boolean isSelected(java.lang.String itemKey)
           
 void itemActivated(java.lang.String itemKey)
           
 void refresh()
          This method is called on each refresh.
 void updateLanguage()
          Called when the language needs updating
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

this_mon

protected org.gudy.azureus2.core3.util.AEMonitor this_mon
Constructor Detail

AbstractIView

public AbstractIView()
Method Detail

initialize

public void initialize(org.eclipse.swt.widgets.Composite composite)
Description copied from interface: IView
This method is called when the view is instanciated, it should initialize all GUI components. Must NOT be blocking, or it'll freeze the whole GUI. Caller is the GUI Thread.

Specified by:
initialize in interface IView
Parameters:
composite - the parent composite. Each view should create a child composite, and then use this child composite to add all elements to.

getComposite

public org.eclipse.swt.widgets.Composite getComposite()
Description copied from interface: IView
This method is called after initialize so that the Tab is set its control Caller is the GUI Thread.

Specified by:
getComposite in interface IView
Returns:
the Composite that should be set as the control for the Tab item

refresh

public void refresh()
Description copied from interface: org.gudy.azureus2.ui.swt.mainwindow.Refreshable
This method is called on each refresh. The view should not instanciate a Thread to refresh itself, unless this is for async purposes. In which case, don't forget to call the display.asyncexec method. Called by the GUI Thread

Specified by:
refresh in interface org.gudy.azureus2.ui.swt.mainwindow.Refreshable

delete

public void delete()
A basic implementation that disposes the composite Should be called with super.delete() from any extending class. Images, Colors and such SWT handles must be disposed by the class itself.

Specified by:
delete in interface IView

getData

public java.lang.String getData()
Description copied from interface: IView
Data 'could' store a key to a language file, in order to support multi-language titles

Specified by:
getData in interface IView
Returns:
a String which is the key of this view title.

getFullTitle

public java.lang.String getFullTitle()
Called in order to set / update the title of this View. When the view is being displayed in a tab, the full title is used for the tooltip. By default, this function will return text from the message bundles which correspond to the key returned in #getData()

Specified by:
getFullTitle in interface IView
Returns:
the full title for the view

getShortTitle

public final java.lang.String getShortTitle()
Called in order to set / update the short title of this view. When the view is being displayed in a tab, the short title is used for the tab's text. By default, this function will return the full title. If the full title is over 30 characters, it will be trimmed and "..." will be added

Specified by:
getShortTitle in interface IView
Returns:
A short title for the view

updateLanguage

public void updateLanguage()
Description copied from interface: IView
Called when the language needs updating

Specified by:
updateLanguage in interface IView

isEnabled

public boolean isEnabled(java.lang.String itemKey)
Specified by:
isEnabled in interface org.gudy.azureus2.ui.swt.IconBarEnabler

isSelected

public boolean isSelected(java.lang.String itemKey)
Specified by:
isSelected in interface org.gudy.azureus2.ui.swt.IconBarEnabler

itemActivated

public void itemActivated(java.lang.String itemKey)
Specified by:
itemActivated in interface org.gudy.azureus2.ui.swt.IconBarEnabler

generateDiagnostics

public void generateDiagnostics(org.gudy.azureus2.core3.util.IndentWriter writer)
Description copied from interface: IView
Called when Azureus generates Diagnostics. Write any diagnostic information you want to the writer.

Specified by:
generateDiagnostics in interface IView

dataSourceChanged

public void dataSourceChanged(java.lang.Object newDataSource)
Description copied from interface: IView
Called when the selected dataSource has changed. If this view is dependent upon a selected datasource, implement this function and update your view.

Specified by:
dataSourceChanged in interface IView
Parameters:
newDataSource - null if no datasource is selected. May be an array of Object[] if multiple dataSources are selected