Package com.biglybt.ui.swt.pifimpl
Class UISWTViewImpl
java.lang.Object
com.biglybt.ui.swt.pifimpl.UISWTViewImpl
- All Implemented Interfaces:
UIToolBarActivationListener
,UIToolBarEnablerBase
,UIPluginView
,UIPluginViewToolBarListener
,UISWTView
,UISWTViewCore
- Direct Known Subclasses:
BaseMdiEntry
This class creates an view that triggers
UISWTViewEventListener
appropriately-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected org.eclipse.swt.widgets.Composite
private boolean
protected Object
private static final boolean
private boolean
private boolean
Whether to destroy view on deactivation (view becomes hidden).private UISWTViewEventListener
private UISWTViewBuilderCore
private boolean
private int
protected final String
private Object
private Boolean
private org.eclipse.swt.widgets.Composite
private UISWTView
private final Set<UIPluginViewToolBarListener>
protected SWTSkin
protected PluginUISWTSkinObject
protected static final String
private String
protected static long
private boolean
private ViewTitleInfo
Fields inherited from interface com.biglybt.ui.swt.pif.UISWTView
CONTROLTYPE_AWT, CONTROLTYPE_SWT
Fields inherited from interface com.biglybt.ui.swt.pifimpl.UISWTViewCore
CONTROLTYPE_SKINOBJECT
Fields inherited from interface com.biglybt.pif.ui.toolbar.UIToolBarActivationListener
ACTIVATIONTYPE_HELD, ACTIVATIONTYPE_NORMAL, ACTIVATIONTYPE_RIGHTCLICK
-
Constructor Summary
ConstructorsConstructorDescriptionUISWTViewImpl
(UISWTViewBuilderCore builder, boolean doCreate) UISWTViewImpl
(String id) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToolbarEnabler
(UIToolBarEnablerBase enabler) buildStandAlone
(SWTSkinObjectContainer soParent) static SWTSkinObjectContainer
buildStandAlone
(SWTSkinObjectContainer soParent, SWTSkin skin, String id, Object datasource, int controlType, UISWTViewBuilderCore original_builder) boolean
void
Closes the viewvoid
create()
org.eclipse.swt.widgets.Composite
This method is called after initialize so that the Tab is set its control Caller is the GUI Thread.int
Retrieve the data sources related to this view.Called in order to set / update the title of this View.Get the original datasource that was set to the viewGet parent view, if one existsGets the plugin interface associated with this view, null if none definedMessagebundle ID for titlegetUserData
(Object key) ID of the viewboolean
void
initialize
(org.eclipse.swt.widgets.Composite parent) This method is called when the view is instanciated, it should initialize all GUI components.boolean
boolean
boolean
Retrieve whether this view can be destroyed onUISWTViewEvent.TYPE_FOCUSLOST
private static String
protected void
void
refreshToolBarItems
(Map<String, Long> list) Fill in list with the toolbar ids and states you wish to setvoid
removeToolbarEnabler
(UIToolBarEnablerBase enabler) void
setControlType
(int iControlType) Sets the type of control this view uses.void
setDatasource
(Object datasource) void
setDelayInitializeToFirstActivate
(boolean delayInitializeToFirstActivate) void
setDestroyOnDeactivate
(boolean b) To save memory/CPU, views are sometimes destroyed onUISWTViewEvent.TYPE_FOCUSLOST
void
setEventListener
(UISWTViewEventListener _eventListener, UISWTViewBuilderCore builder, boolean doCreate) protected void
setMasterComposite
(org.eclipse.swt.widgets.Composite masterComposite) void
setParentView
(UISWTView parentView) void
void
Override the default title with a new one.protected void
setTitleID
(String titleID) protected boolean
setTitleIDSupport
(String titleID) protected boolean
setTitleSupport
(String title) void
protected void
setToolbarVisibility
(boolean visible) void
setUseCoreDataSource
(boolean useCoreDataSource) void
setUserData
(Object key, Object data) void
private void
boolean
toolBarItemActivated
(ToolBarItem item, long activationType, Object datasource) XXX Should have been UIToolBarItemprivate boolean
triggerBooleanEvent
(int eventType, Object data) void
triggerEvent
(int eventType, Object data) Trigger an event for this viewprotected boolean
triggerEventRaw
(int eventType, Object data) boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.pif.ui.UIPluginViewToolBarListener
isActive
-
Field Details
-
CFG_PREFIX
- See Also:
-
SO_ID_ENTRY_WRAPPER
- See Also:
-
uniqueNumber
protected static long uniqueNumber -
delayInitializeToFirstActivate
private boolean delayInitializeToFirstActivate -
DEBUG_TRIGGERS
private static final boolean DEBUG_TRIGGERS- See Also:
-
skinObject
-
initialDatasource
-
parentView
-
skin
-
datasource
-
useCoreDataSource
private boolean useCoreDataSource -
eventListener
-
composite
protected org.eclipse.swt.widgets.Composite composite -
id
-
titleID
-
iControlType
private int iControlType -
isShown
-
user_data
-
haveSentInitialize
private boolean haveSentInitialize -
created
private boolean created -
destroyOnDeactivate
private boolean destroyOnDeactivateWhether to destroy view on deactivation (view becomes hidden). Note that views can be rebuilt after being destroyed (ie. when shown again) -
masterComposite
private org.eclipse.swt.widgets.Composite masterComposite -
setToolBarEnablers
-
eventListenerBuilder
-
viewTitleInfo
-
-
Constructor Details
-
UISWTViewImpl
-
UISWTViewImpl
public UISWTViewImpl(UISWTViewBuilderCore builder, boolean doCreate) throws UISWTViewEventCancelledException - Throws:
UISWTViewEventCancelledException
-
-
Method Details
-
setEventListener
public void setEventListener(UISWTViewEventListener _eventListener, UISWTViewBuilderCore builder, boolean doCreate) throws UISWTViewEventCancelledException - Throws:
UISWTViewEventCancelledException
-
create
- Throws:
UISWTViewEventCancelledException
-
getEventListener
- Specified by:
getEventListener
in interfaceUISWTView
- Specified by:
getEventListener
in interfaceUISWTViewCore
-
getEventListenerBuilder
- Specified by:
getEventListenerBuilder
in interfaceUISWTViewCore
-
setViewTitleInfo
- Specified by:
setViewTitleInfo
in interfaceUISWTViewCore
-
getViewTitleInfo
- Specified by:
getViewTitleInfo
in interfaceUISWTViewCore
-
getInitialDataSource
Description copied from interface:UISWTView
Get the original datasource that was set to the view- Specified by:
getInitialDataSource
in interfaceUISWTView
-
setDatasource
-
getDataSource
Description copied from interface:UISWTView
Retrieve the data sources related to this view.- Specified by:
getDataSource
in interfaceUIPluginView
- Specified by:
getDataSource
in interfaceUISWTView
- Specified by:
getDataSource
in interfaceUISWTViewCore
- Returns:
- Returns data source, based on
UISWTViewCore.useCoreDataSource()
-
setParentView
- Specified by:
setParentView
in interfaceUISWTViewCore
-
getParentView
Description copied from interface:UISWTView
Get parent view, if one exists- Specified by:
getParentView
in interfaceUISWTView
-
getViewID
Description copied from interface:UIPluginView
ID of the view- Specified by:
getViewID
in interfaceUIPluginView
- Returns:
- ID of the view
-
closeView
public void closeView()Description copied from interface:UIPluginView
Closes the view- Specified by:
closeView
in interfaceUIPluginView
-
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 interfaceUISWTView
-
getControlType
public int getControlType()- Specified by:
getControlType
in interfaceUISWTView
- Returns:
- CONTROLTYPE_*
-
triggerEvent
Description copied from interface:UISWTView
Trigger an event for this view- Specified by:
triggerEvent
in interfaceUISWTView
- Parameters:
eventType
- Event to triggerUISWTViewEvent
}data
- data to send with trigger
-
isContentDisposed
public boolean isContentDisposed()- Specified by:
isContentDisposed
in interfaceUISWTView
-
padRight
-
triggerBooleanEvent
-
triggerEventRaw
-
setTitle
Description copied from interface:UISWTView
Override the default title with a new one. After setting this, you should use theUISWTViewEvent.TYPE_LANGUAGEUPDATE
to update your title to the new language. -
setTitleSupport
-
setTitleID
-
setTitleIDSupport
-
refreshTitle
protected void refreshTitle() -
getPluginInterface
Description copied from interface:UISWTView
Gets the plugin interface associated with this view, null if none defined Important Note
BiglyBT 2.0.0.0 and below will only return aPluginInterface
during theUISWTViewEvent.TYPE_CREATE
event. After this event is processed, the return value will be null. 2.0.0.1 and later will always return aPluginInterface
- Specified by:
getPluginInterface
in interfaceUIPluginView
- Specified by:
getPluginInterface
in interfaceUISWTView
-
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 interfaceUISWTViewCore
- Returns:
- the Composite that should be set as the control for the Tab item
-
getTitleID
Description copied from interface:UISWTViewCore
Messagebundle ID for title- Specified by:
getTitleID
in interfaceUISWTViewCore
-
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 interfaceUISWTViewCore
- 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 interfaceUISWTViewCore
- Parameters:
parent
- the parent composite. Each view should create a child composite, and then use this child composite to add all elements to.
-
swt_triggerInitialize
private void swt_triggerInitialize() -
useCoreDataSource
public boolean useCoreDataSource()- Specified by:
useCoreDataSource
in interfaceUISWTViewCore
-
setUseCoreDataSource
public void setUseCoreDataSource(boolean useCoreDataSource) - Specified by:
setUseCoreDataSource
in interfaceUISWTViewCore
-
getPluginSkinObject
- Specified by:
getPluginSkinObject
in interfaceUISWTViewCore
-
setPluginSkinObject
- Specified by:
setPluginSkinObject
in interfaceUISWTViewCore
-
toolBarItemActivated
Description copied from interface:UIToolBarActivationListener
XXX Should have been UIToolBarItem- Specified by:
toolBarItemActivated
in interfaceUIToolBarActivationListener
-
refreshToolBarItems
Description copied from interface:UIPluginViewToolBarListener
Fill in list with the toolbar ids and states you wish to set- Specified by:
refreshToolBarItems
in interfaceUIPluginViewToolBarListener
-
setToolBarListener
- Specified by:
setToolBarListener
in interfaceUIPluginView
-
getToolBarListener
- Specified by:
getToolBarListener
in interfaceUIPluginView
-
getToolbarEnablers
-
hasToolbarEnableers
public boolean hasToolbarEnableers() -
addToolbarEnabler
-
removeToolbarEnabler
-
setToolbarVisibility
protected void setToolbarVisibility(boolean visible) -
setUserData
- Specified by:
setUserData
in interfaceUISWTViewCore
-
getUserData
- Specified by:
getUserData
in interfaceUISWTViewCore
-
setDestroyOnDeactivate
public void setDestroyOnDeactivate(boolean b) Description copied from interface:UISWTView
To save memory/CPU, views are sometimes destroyed onUISWTViewEvent.TYPE_FOCUSLOST
This allows overriding of the default behaviour
- Specified by:
setDestroyOnDeactivate
in interfaceUISWTView
-
isDestroyOnDeactivate
public boolean isDestroyOnDeactivate()Description copied from interface:UISWTView
Retrieve whether this view can be destroyed onUISWTViewEvent.TYPE_FOCUSLOST
- Specified by:
isDestroyOnDeactivate
in interfaceUISWTView
-
isDelayInitializeToFirstActivate
public boolean isDelayInitializeToFirstActivate() -
setDelayInitializeToFirstActivate
public void setDelayInitializeToFirstActivate(boolean delayInitializeToFirstActivate) -
setMasterComposite
protected void setMasterComposite(org.eclipse.swt.widgets.Composite masterComposite) -
buildStandAlone
- Specified by:
buildStandAlone
in interfaceUISWTViewCore
-
buildStandAlone
public static SWTSkinObjectContainer buildStandAlone(SWTSkinObjectContainer soParent, SWTSkin skin, String id, Object datasource, int controlType, UISWTViewBuilderCore original_builder) -
canBuildStandAlone
public boolean canBuildStandAlone()- Specified by:
canBuildStandAlone
in interfaceUISWTViewCore
-