at.spardat.xma.page
Class Notebook

java.lang.Object
  extended byat.spardat.xma.page.Notebook
All Implemented Interfaces:
java.util.EventListener, org.eclipse.swt.events.HelpListener, IEmbeddable, at.spardat.xma.boot.component.IXMAControl, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.internal.SWTEventListener

public class Notebook
extends java.lang.Object
implements IEmbeddable, org.eclipse.swt.events.SelectionListener, org.eclipse.swt.events.HelpListener

Manages a Collection of NotebookPages and the corresponding SWT-TabFolder.


Constructor Summary
Notebook(PageClient parent)
          Initializes the Notebook inside the given PageClient.
 
Method Summary
 void addPage(int index, NotebookPage page)
          Adds a NotebookPage to the existing NotebookPages at the given index.
 void addPage(NotebookPage page)
          Adds a NotebookPage to the existing NotebookPages of this Notebook.
 org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parentComp)
          Creates the SWT-Composite of the PageClient which is the TabFolder of the Notebook.
 void determineStateBase()
          Delegates the call of PageClient.determineStateBase() to the active page.
 void enterBase()
          Notify the active NotebookPage, that the PageClient is becoming visible by calling PageClient.enterBase() on the active NotebookPage.
 NotebookPage getActivePage()
          Gets the active NotebookPage.
 int getActivePageIndex()
          Gets the active NotebookPage.
 org.eclipse.swt.widgets.Composite getComposite()
          Gets the SWT-Composite of the PageClient which is the TabFolder of the Notebook.
 java.lang.String getContextString()
           
 at.spardat.xma.boot.component.IDialog getDialog()
          Gets the containing dialog of the PageClient by calling PageClient.getDialog() on the active NotebookPage.
 NotebookPage getPage(int index)
          Gets the NotebookPage with the given index.
 PageClient getParent()
          Gets the PageClient containig this Notebook.
 org.eclipse.swt.widgets.TabFolder getTabFolder()
          Gets the TabFolder of the Notebook.
 void helpRequested(org.eclipse.swt.events.HelpEvent event)
          Eventhandler called by SWT every time F1 is pressed inside the tabfolder.
 void initGUI()
          Creates the Widgets of all NotebookPages by calling NotebookPage.initGUI() on all NotebookPages.
 void leaveBase()
          Notify the active NotebookPage, that the PageClient no longer is visible by calling PageClient.leaveBase() on the active NotebookPage.
 void removeModel()
          Removes the WidgetModels of all NotebookPages by calling PageClient.removeWidgetModels() on all NotebookPages.
 void removePage(NotebookPage page)
          Removes a NotebookPage from the exisiting NotebookPages of this Notebook.
 void removeWidgetsBase()
          Notify all NotebookPages, that the Widgets are disposed by calling PageClient.removeWidgets() on all NotebookPages.
 void setActivePage(int index)
          Activates the NotebookPage with the given index.
 void setActivePage(NotebookPage page)
          Activates the given NotebookPage.
 void setDialog(at.spardat.xma.boot.component.IDialog dialog)
          Sets the containing dialog of the PageClient by calling PageClient.setDialog(IDialog) on all NotebookPages.
 void setEventsEnabled(boolean enabled)
          Enables/disables GUI-events all NotebookPages.
 void stateChangedBase()
          Notify the active NotebookPage of a possible Change in the PageModels by calling PageClient.stateChangedBase() the active NotebookPage.
 void stateChangedBaseImpl()
          Delegates the call of PageClient.stateChangedBaseImpl() to the active page.
 void stateChangedExtend()
          Delegates the call of PageClient.stateChangedExtend() to the active page.
 void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent event)
          Only needed because of the implementet Interface SelectionListener.
 void widgetSelected(org.eclipse.swt.events.SelectionEvent event)
          Eventhandler called by SWT every time a Tab in the TabFolder is selected by the GUI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Notebook

public Notebook(PageClient parent)
Initializes the Notebook inside the given PageClient.

Parameters:
parent - the PageClient containing this Notebook.
Method Detail

getTabFolder

public org.eclipse.swt.widgets.TabFolder getTabFolder()
Gets the TabFolder of the Notebook. The TabFolder is the corresponding Control in SWT.

Returns:
the TabFolder of the Notebook.

createComposite

public org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parentComp)
Creates the SWT-Composite of the PageClient which is the TabFolder of the Notebook.

Specified by:
createComposite in interface at.spardat.xma.boot.component.IXMAControl
Parameters:
parentComp - the SWT-Composite which shall be the parent of the created SWT-Composite.
Returns:
the TabFolder of the Notebook.

getComposite

public org.eclipse.swt.widgets.Composite getComposite()
Gets the SWT-Composite of the PageClient which is the TabFolder of the Notebook.

Specified by:
getComposite in interface at.spardat.xma.boot.component.IXMAControl
Returns:
the SWT-Composite corresponding to this PageClient

getParent

public PageClient getParent()
Gets the PageClient containig this Notebook.

Returns:
the PageClient containing this Notebook.

getPage

public NotebookPage getPage(int index)
Gets the NotebookPage with the given index. This NotebookPage belongs to the Tab on the TabFolder with the same index.

Parameters:
index - the index for the NotebookPage.
Returns:
the NotebookPage for that index.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range.

addPage

public void addPage(NotebookPage page)
Adds a NotebookPage to the existing NotebookPages of this Notebook. The new NotebookPage is appended at the end of the list.

Parameters:
page - the NotebookPage to add.

addPage

public void addPage(int index,
                    NotebookPage page)
Adds a NotebookPage to the existing NotebookPages at the given index. The new NotebookPage is insertet at the given index position.

Parameters:
index - the index at which the new NotebookPage is to be inserted.
page - the NotebookPage to add.

removePage

public void removePage(NotebookPage page)
Removes a NotebookPage from the exisiting NotebookPages of this Notebook.

Parameters:
page - the NotebookPage to remove.

setActivePage

public void setActivePage(int index)
Activates the NotebookPage with the given index. The new active PageClient will become visible inside the Notebook. This implies selecting the corresponding Tab on the TabFolder.

Parameters:
index - the index of the NotebookPage to activate.
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range.

setActivePage

public void setActivePage(NotebookPage page)
Activates the given NotebookPage. The new active PageClient will become visible inside the Notebook. This implies selecting the corresponding Tab on the TabFolder.

Parameters:
page - the NotebookPage to activate.
Throws:
java.lang.IllegalArgumentException - if the NotebookPage is not part of the Notebook.

getActivePage

public NotebookPage getActivePage()
Gets the active NotebookPage. The active NotebookPage is the NotebookPage that is visible inside the Notebook.

Returns:
the currently active NotebookPage.

getActivePageIndex

public int getActivePageIndex()
Gets the active NotebookPage. The active NotebookPage is the NotebookPage that is visible inside the Notebook.

Returns:
the currently active NotebookPage.

widgetSelected

public void widgetSelected(org.eclipse.swt.events.SelectionEvent event)
Eventhandler called by SWT every time a Tab in the TabFolder is selected by the GUI. It is not called if Tabfolder.setSelection() is called programatically. This causes a switch of the active NotebookPage. The currently active NotebookPage is deactivated. The NotebookPage corresponding to the selected Tab is activated.

Specified by:
widgetSelected in interface org.eclipse.swt.events.SelectionListener
Parameters:
event - the SWT-Event that happended.

widgetDefaultSelected

public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent event)
Only needed because of the implementet Interface SelectionListener. Not used.

Specified by:
widgetDefaultSelected in interface org.eclipse.swt.events.SelectionListener

helpRequested

public void helpRequested(org.eclipse.swt.events.HelpEvent event)
Eventhandler called by SWT every time F1 is pressed inside the tabfolder. Shows the help-uri of the active NotebookPage in a browser window.

Specified by:
helpRequested in interface org.eclipse.swt.events.HelpListener
Parameters:
event - the SWT-Event that happened.

setDialog

public void setDialog(at.spardat.xma.boot.component.IDialog dialog)
Sets the containing dialog of the PageClient by calling PageClient.setDialog(IDialog) on all NotebookPages.

Specified by:
setDialog in interface IEmbeddable
Parameters:
dialog -

getDialog

public at.spardat.xma.boot.component.IDialog getDialog()
Gets the containing dialog of the PageClient by calling PageClient.getDialog() on the active NotebookPage.

Specified by:
getDialog in interface IEmbeddable

initGUI

public void initGUI()
Creates the Widgets of all NotebookPages by calling NotebookPage.initGUI() on all NotebookPages.

Specified by:
initGUI in interface at.spardat.xma.boot.component.IXMAControl

enterBase

public void enterBase()
Notify the active NotebookPage, that the PageClient is becoming visible by calling PageClient.enterBase() on the active NotebookPage.

Specified by:
enterBase in interface at.spardat.xma.boot.component.IXMAControl

stateChangedBase

public void stateChangedBase()
Notify the active NotebookPage of a possible Change in the PageModels by calling PageClient.stateChangedBase() the active NotebookPage.

Specified by:
stateChangedBase in interface at.spardat.xma.boot.component.IXMAControl

determineStateBase

public void determineStateBase()
Delegates the call of PageClient.determineStateBase() to the active page.

Specified by:
determineStateBase in interface IEmbeddable

stateChangedExtend

public void stateChangedExtend()
Delegates the call of PageClient.stateChangedExtend() to the active page.

Specified by:
stateChangedExtend in interface IEmbeddable

stateChangedBaseImpl

public void stateChangedBaseImpl()
Delegates the call of PageClient.stateChangedBaseImpl() to the active page.

Specified by:
stateChangedBaseImpl in interface IEmbeddable

leaveBase

public void leaveBase()
Notify the active NotebookPage, that the PageClient no longer is visible by calling PageClient.leaveBase() on the active NotebookPage.

Specified by:
leaveBase in interface at.spardat.xma.boot.component.IXMAControl

removeWidgetsBase

public void removeWidgetsBase()
Notify all NotebookPages, that the Widgets are disposed by calling PageClient.removeWidgets() on all NotebookPages.

Specified by:
removeWidgetsBase in interface at.spardat.xma.boot.component.IXMAControl

removeModel

public void removeModel()
Removes the WidgetModels of all NotebookPages by calling PageClient.removeWidgetModels() on all NotebookPages.

Specified by:
removeModel in interface at.spardat.xma.boot.component.IXMAControl

getContextString

public java.lang.String getContextString()
Specified by:
getContextString in interface IEmbeddable
Returns:
the string to show as context in the enclosing AppShell or dialog.

setEventsEnabled

public void setEventsEnabled(boolean enabled)
Enables/disables GUI-events all NotebookPages.

Specified by:
setEventsEnabled in interface IEmbeddable
Parameters:
enabled -