org.gudy.azureus2.ui.swt.pluginsimpl
Class UISWTViewImpl

java.lang.Object
  extended by org.gudy.azureus2.ui.swt.pluginsimpl.UISWTViewImpl
All Implemented Interfaces:
AEDiagnosticsEvidenceGenerator, UIPluginView, UISWTView, UISWTViewCore

public class UISWTViewImpl
extends Object
implements UISWTViewCore, AEDiagnosticsEvidenceGenerator

This class creates an IView that triggers UISWTViewEventListener appropriately

Author:
TuxPaper

Field Summary
static String CFG_PREFIX
           
 
Fields inherited from interface org.gudy.azureus2.ui.swt.pluginsimpl.UISWTViewCore
CONTROLTYPE_SKINOBJECT
 
Fields inherited from interface org.gudy.azureus2.ui.swt.plugins.UISWTView
CONTROLTYPE_AWT, CONTROLTYPE_SWT
 
Constructor Summary
UISWTViewImpl(String sParentID, String sViewID, UISWTViewEventListener eventListener, Object _initialDatasource)
           
 
Method Summary
 void closeView()
          Closes the view
 void generate(IndentWriter writer)
           
 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.
 int getControlType()
           
 Object getDataSource()
          Retrieve the data sources related to this view.
 UISWTViewEventListener getEventListener()
           
 String getFullTitle()
          Called in order to set / update the title of this View.
 Object getInitialDataSource()
           
 UISWTView getParentView()
           
 PluginInterface getPluginInterface()
          Gets the plugin interface associated with this view, null if none defined
 PluginUISWTSkinObject getSkinObject()
           
 String getTitleID()
          Messagebundle ID for title
 UIPluginViewToolBarListener getToolBarListener()
           
 Object getUserData(Object key)
           
 String getViewID()
          ID of the view
 void initialize(org.eclipse.swt.widgets.Composite parent)
          This method is called when the view is instanciated, it should initialize all GUI components.
 void refreshToolBarItems(Map<String,Long> list)
           
 boolean requestClose()
           
 void setControlType(int iControlType)
          Sets the type of control this view uses.
 void setParentView(UISWTView p)
           
 void setSkinObject(PluginUISWTSkinObject skinObject, org.eclipse.swt.widgets.Composite c)
           
 void setTitle(String title)
          Override the default title with a new one.
 void setToolBarListener(UIPluginViewToolBarListener l)
           
 void setUseCoreDataSource(boolean useCoreDataSource)
           
 void setUserData(Object key, Object data)
           
 boolean toolBarItemActivated(ToolBarItem item, long activationType, Object datasource)
           
 void triggerEvent(int eventType, Object data)
          Trigger an event for this view
protected  boolean triggerEventRaw(int eventType, Object data)
           
 boolean useCoreDataSource()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CFG_PREFIX

public static final String CFG_PREFIX
See Also:
Constant Field Values
Constructor Detail

UISWTViewImpl

public UISWTViewImpl(String sParentID,
                     String sViewID,
                     UISWTViewEventListener eventListener,
                     Object _initialDatasource)
              throws Exception
Throws:
Exception
Method Detail

getEventListener

public UISWTViewEventListener getEventListener()
Specified by:
getEventListener in interface UISWTViewCore

getInitialDataSource

public Object getInitialDataSource()
Specified by:
getInitialDataSource in interface UISWTView

getDataSource

public Object getDataSource()
Description copied from interface: UISWTView
Retrieve the data sources related to this view.

Specified by:
getDataSource in interface UIPluginView
Specified by:
getDataSource in interface UISWTView
Returns:
Depending on the parent view you added your view to, the Object will be:
UISWTInstance.VIEW_MAIN- null
UISWTInstance.VIEW_MYTORRENTS- Download
UISWTInstance.VIEW_TORRENT_PEERS- Peer
If created by UISWTInstance.openMainView(String, UISWTViewEventListener, Object), value will be the value set.

May return null if no data source is selected, or while processing the UISWTViewEvent.TYPE_CREATE event.


setParentView

public void setParentView(UISWTView p)

getParentView

public UISWTView getParentView()
Specified by:
getParentView in interface UISWTView

getViewID

public String getViewID()
Description copied from interface: UIPluginView
ID of the view

Specified by:
getViewID in interface UIPluginView
Returns:
ID of the view

closeView

public void closeView()
Description copied from interface: UIPluginView
Closes the view

Specified by:
closeView in interface UIPluginView

setControlType

public void setControlType(int iControlType)
Description copied from interface: UISWTView
Sets the type of control this view uses. Set before view initialization.

The default value is UISWTView.CONTROLTYPE_SWT

Specified by:
setControlType in interface UISWTView

getControlType

public int getControlType()
Specified by:
getControlType in interface UISWTView
Returns:
CONTROLTYPE_*

triggerEvent

public void triggerEvent(int eventType,
                         Object data)
Description copied from interface: UISWTView
Trigger an event for this view

Specified by:
triggerEvent in interface UISWTView
Parameters:
eventType - Event to trigger UISWTViewEvent}
data - data to send with trigger

triggerEventRaw

protected boolean triggerEventRaw(int eventType,
                                  Object data)

setTitle

public void setTitle(String title)
Description copied from interface: UISWTView
Override the default title with a new one. After setting this, you should use the UISWTViewEvent.TYPE_LANGUAGEUPDATE to update your title to the new language.

Specified by:
setTitle in interface UISWTView
Parameters:
title - new Title

getPluginInterface

public PluginInterface getPluginInterface()
Description copied from interface: UISWTView
Gets the plugin interface associated with this view, null if none defined

Specified by:
getPluginInterface in interface UIPluginView
Specified by:
getPluginInterface in interface UISWTView

getComposite

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

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

getTitleID

public String getTitleID()
Description copied from interface: UISWTViewCore
Messagebundle ID for title

Specified by:
getTitleID in interface UISWTViewCore

getFullTitle

public String getFullTitle()
Description copied from interface: UISWTViewCore
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.

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

initialize

public void initialize(org.eclipse.swt.widgets.Composite parent)
Description copied from interface: UISWTViewCore
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 UISWTViewCore
Parameters:
parent - the parent composite. Each view should create a child composite, and then use this child composite to add all elements to.

requestClose

public boolean requestClose()
Returns:

useCoreDataSource

public boolean useCoreDataSource()
Specified by:
useCoreDataSource in interface UISWTViewCore

setUseCoreDataSource

public void setUseCoreDataSource(boolean useCoreDataSource)
Specified by:
setUseCoreDataSource in interface UISWTViewCore

getSkinObject

public PluginUISWTSkinObject getSkinObject()
Specified by:
getSkinObject in interface UISWTViewCore

setSkinObject

public void setSkinObject(PluginUISWTSkinObject skinObject,
                          org.eclipse.swt.widgets.Composite c)
Specified by:
setSkinObject in interface UISWTViewCore

generate

public void generate(IndentWriter writer)
Specified by:
generate in interface AEDiagnosticsEvidenceGenerator

toolBarItemActivated

public boolean toolBarItemActivated(ToolBarItem item,
                                    long activationType,
                                    Object datasource)

refreshToolBarItems

public void refreshToolBarItems(Map<String,Long> list)

setToolBarListener

public void setToolBarListener(UIPluginViewToolBarListener l)
Specified by:
setToolBarListener in interface UIPluginView

getToolBarListener

public UIPluginViewToolBarListener getToolBarListener()
Specified by:
getToolBarListener in interface UIPluginView

setUserData

public void setUserData(Object key,
                        Object data)
Specified by:
setUserData in interface UISWTViewCore

getUserData

public Object getUserData(Object key)
Specified by:
getUserData in interface UISWTViewCore