BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Private Attributes | Static Private Attributes | List of all members
BALL::VIEW::ServerWidget Class Reference

#include <BALL/VIEW/KERNEL/serverWidget.h>

Inheritance diagram for BALL::VIEW::ServerWidget:
QObject BALL::VIEW::ModularWidget BALL::Embeddable BALL::VIEW::ConnectionObject

Classes

class  BALLViewServer
 
class  NotCompositeObject
 

Public Member Functions

Constructors
 ServerWidget (QWidget *parent=0, const char *name=0)
 
 ServerWidget (const ServerWidget &server)
 
Destructors
virtual ~ServerWidget ()
 
virtual void clear ()
 
Accessors: inspectors and mutators
virtual void activate ()
 
virtual void deactivate ()
 
void setPort (const int port)
 
int getPort () const
 
void registerObjectCreator (const ObjectCreator &s)
 
void unregisterObjectCreator ()
 
ObjectCreatorgetObjectCreator ()
 
const ObjectCreatorgetObjectCreator () const
 
virtual void initializeWidget (MainControl &main_control)
 
virtual void finalizeWidget (MainControl &main_control)
 
virtual void initializePreferencesTab (Preferences &preferences)
 
virtual void finalizePreferencesTab (Preferences &preferences)
 
virtual void applyPreferences ()
 
debuggers and diagnostics
virtual bool isValid () const
 
virtual void dump (std::ostream &s=std::cout, Size depth=0) const
 
virtual void changeLock (bool lock)
 
- Public Member Functions inherited from BALL::VIEW::ModularWidget
void setWorkingDirFromFilename_ (String filename)
 
virtual void showHelp (const String &url)
 
 ModularWidget (const char *name="<ModularWidget>")
 
 ModularWidget (const ModularWidget &widget)
 
virtual ~ModularWidget ()
 
virtual void destroy ()
 
virtual void checkMenu (MainControl &main_control)
 
QAction * insertMenuEntry (Position parent_id, const String &name, const QObject *receiver=0, const char *slot=0, const String &description="", QKeySequence accel=QKeySequence())
 
void setMenuHint (const String &hint)
 
void setMenuHelp (const String &url)
 
virtual void registerForHelpSystem (const QObject *object, const String &url)
 
virtual void addToolBarEntries (QToolBar *main_tb)
 
void setIcon (const String &filename, bool add_to_main_toolbar=true)
 
virtual void fetchPreferences (INIFile &inifile)
 
virtual void writePreferences (INIFile &inifile)
 
bool lockComposites ()
 
bool unlockComposites ()
 Unlock the Composites. More...
 
MainControlgetMainControl () const
 
virtual void setStatusbarText (const String &text, bool important=false)
 
virtual void setStatusbarText (const QString &text, bool important=false)
  More...
 
String getWorkingDir ()
 Implemented for convenience. More...
 
void setWorkingDir (const String &dir)
 Implemented for convenience. More...
 
FragmentDBgetFragmentDB () const
 
virtual bool canHandle (const String &) const
 
virtual bool openFile (const String &)
 
- Public Member Functions inherited from BALL::Embeddable
 Embeddable (const String &identifier="<Embeddable>")
 
 Embeddable (const Embeddable &embeddable)
 
virtual ~Embeddable ()
 
void setIdentifier (const String &identifier)
 
const StringgetIdentifier () const
 
void unregisterThis ()
 
virtual void registerThis ()
 
- Public Member Functions inherited from BALL::VIEW::ConnectionObject
 ConnectionObject ()
 
virtual ~ConnectionObject ()
 
void registerConnectionObject (ConnectionObject &object)
 
void unregisterConnectionObject (ConnectionObject &object)
 
bool isConnectionObjectRegistered (const ConnectionObject &object)
 
ConnectionObjectgetParent () const
 
ConnectionObjectgetRoot ()
 
virtual void onNotify (Message *message)
 

Private Attributes

BALLViewServer server_
 
ObjectCreatorobject_creator_
 
int port_
 
ServerPreferencesserver_preferences_
 
QLabel * server_icon_
 

Static Private Attributes

static const char * mini_ray_xpm_ []
 

Signals and Slots

void handleLocking (bool lock)
 
void lockRequested (bool lock)
 

Additional Inherited Members

- Public Types inherited from BALL::Embeddable
typedef std::vector< Embeddable * > EmbeddableVector
 
- Static Public Member Functions inherited from BALL::VIEW::ModularWidget
static void registerWidget (ModularWidget *mwidget) throw (Exception::NullPointer)
 
- Protected Member Functions inherited from BALL::VIEW::ConnectionObject
void onNotify_ (Message *message)
 
void notify_ (Message *message)
 
void notify_ (Message &message)
 
- Static Protected Member Functions inherited from BALL::Embeddable
static void registerInstance_ (const std::type_info &type, const Embeddable *instance)
 
static void unregisterInstance_ (const Embeddable *instance)
 
static Size countInstances_ (const std::type_info &type)
 
static EmbeddablegetInstance_ (const std::type_info &type, Position index)
 
static EmbeddablegetInstance_ (const std::type_info &type, const String &identifier)
 
- Protected Attributes inherited from BALL::VIEW::ModularWidget
QAction * window_menu_entry_
 
bool show_window_enty_
 
bool default_visible_
 
QAction * last_action_
 
QList< QAction * > main_toolbar_actions_
 

Detailed Description

ServerWidget class. The class ServerWidget handles all incoming PersistentObject objects, converts them into Composite objects (if possible) and sents them through the ConnectionObject tree with the message NewCompositeMessage. Also it stores all received Composite objects and replaces them if the same Composite object is received again. If a Composite object is replaced the message RemovedCompositeMessage will be sent through the ConnectionObject tree and after that the the message NewCompositeMessage with the new received composite will be sent.

Definition at line 59 of file serverWidget.h.

Constructor & Destructor Documentation

BALL::VIEW::ServerWidget::ServerWidget ( QWidget parent = 0,
const char *  name = 0 
)

Default Constructor. The state of this server is:

  • no object creator registered
  • server listening on VIEW_DEFAULT_PORT if activated
    See Also
    ModularWidget
BALL::VIEW::ServerWidget::ServerWidget ( const ServerWidget server)
virtual BALL::VIEW::ServerWidget::~ServerWidget ( )
virtual

Destructor.

Member Function Documentation

virtual void BALL::VIEW::ServerWidget::activate ( )
inlinevirtual

Start the server.

Definition at line 169 of file serverWidget.h.

virtual void BALL::VIEW::ServerWidget::applyPreferences ( )
virtual

Apply the preferences of the specific tab. This method applies the preferences of the own tab ServerPreferences to this server. This method is called automatically by the method applyPreferencesTab of the class MainControl. See ModularWidget for more information concerning preferences tabs.

Parameters
preferencesthe Preferences dialog of the MainControl
See Also
applyPreferencesTab
ServerPreferences
Preferences

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::changeLock ( bool  lock)
virtual

This function is used by the server thread to handle locking of composites across several threads.

The protocol is rather complicated: the server thread reacts to a connection, creates a composite, calls changeLock(), this emits the signal "lockRequested", which is finally handled in the slot handleLocking(). The reason for this involved setup is the separation of server and GUI threads, which does not allow to safely lock the composites in the server thread.

virtual void BALL::VIEW::ServerWidget::clear ( )
virtual

Explicit default initialization. Calls ConnectionObject::clear.

See Also
ConnectionObject::clear

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::deactivate ( )
inlinevirtual

Stop the server.

Definition at line 173 of file serverWidget.h.

virtual void BALL::VIEW::ServerWidget::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const
virtual

Dump the current state of this server to the output ostream with a dumping depth.

Parameters
soutput stream where to output the state of this server
depththe dumping depth
See Also
ConnectionObject::dump

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::finalizePreferencesTab ( Preferences preferences)
virtual

Remove the preferences tab. This method removes the ServerPreferences tab of this server from the Preferences dialog of the MainControl. This method is called automatically by the method aboutToExit method of the class MainControl at the end of the application. See ModularWidget for more information concerning preferences tabs.

Parameters
preferencesthe Preferences dialog of the MainControl
See Also
aboutToExit
ServerPreferences
Preferences

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::finalizeWidget ( MainControl main_control)
virtual

Remove the server widget. This method deletes the icon of this server and removes it from MainControl. This method will be called by aboutToExit of the class MainControl.

See Also
ModularWidget
aboutToExit

Reimplemented from BALL::VIEW::ModularWidget.

ObjectCreator& BALL::VIEW::ServerWidget::getObjectCreator ( )

Return the ObjectCreator.

const ObjectCreator& BALL::VIEW::ServerWidget::getObjectCreator ( ) const

Return the ObjectCreator, const version.

int BALL::VIEW::ServerWidget::getPort ( ) const

Return the server port. Return the port of this server.

Returns
int the port of this server
void BALL::VIEW::ServerWidget::handleLocking ( bool  lock)
slot
virtual void BALL::VIEW::ServerWidget::initializePreferencesTab ( Preferences preferences)
virtual

Initialize a preferences tab for the server. This method creates the preferences tab ServerPreferences for this server and inserts it into the Preferences dialog of the MainControl. This method is called automatically by the method show of the class MainControl at the start of the application. See ModularWidget for more information concerning preferences tabs.

Parameters
preferencesthe Preferences dialog of the MainControl
See Also
show
ServerPreferences
Preferences

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::initializeWidget ( MainControl main_control)
virtual

Initialize the server widget. This method initializes the icon of this server and adds it to MainControl. This method will be called by show of the class MainControl.

See Also
ModularWidget
show

Reimplemented from BALL::VIEW::ModularWidget.

virtual bool BALL::VIEW::ServerWidget::isValid ( ) const
virtual

Internal state and consistency self-validation. Calls {ConnectionObject::isValid}.

Returns
bool true if the internal state of this server is correct
See Also
ConnectionObject::isValid

Reimplemented from BALL::VIEW::ConnectionObject.

void BALL::VIEW::ServerWidget::lockRequested ( bool  lock)
signal
void BALL::VIEW::ServerWidget::registerObjectCreator ( const ObjectCreator s)

Register a ObjectCreator that is used for converting PersistentObject objects into Composite objects. Every ObjectCreator, that is still registered, when a ServerWidget instance is destructed, will be deleted.

See Also
ObjectCreator
void BALL::VIEW::ServerWidget::setPort ( const int  port)

Set the server port.

Parameters
portthe new port
void BALL::VIEW::ServerWidget::unregisterObjectCreator ( )

Reset the ObjectCreator. After calling this method PersistentObject objects will be converted using the default ObjectCreator.

See Also
ObjectCreator

Member Data Documentation

const char* BALL::VIEW::ServerWidget::mini_ray_xpm_[]
staticprivate

Definition at line 322 of file serverWidget.h.

ObjectCreator* BALL::VIEW::ServerWidget::object_creator_
private

private storage variables.

Definition at line 315 of file serverWidget.h.

int BALL::VIEW::ServerWidget::port_
private

Definition at line 318 of file serverWidget.h.

BALLViewServer BALL::VIEW::ServerWidget::server_
private

The actual server thread

Definition at line 311 of file serverWidget.h.

QLabel* BALL::VIEW::ServerWidget::server_icon_
private

Definition at line 321 of file serverWidget.h.

ServerPreferences* BALL::VIEW::ServerWidget::server_preferences_
private

Definition at line 320 of file serverWidget.h.