org.rapla.facade
Class RaplaComponent

java.lang.Object
  extended by org.rapla.facade.RaplaComponent
Direct Known Subclasses:
RaplaGUIComponent

public class RaplaComponent
extends Object

Base class for most components. Eases access to frequently used services, e.g. I18nBundle.


Field Summary
protected  I18nBundle childBundle
           
 
Constructor Summary
RaplaComponent(RaplaContext context)
           
 
Method Summary
 boolean canModify(Object object)
          returns if the current user is allowed to modify the object.
 boolean canUserAllocateSomething(User user)
          returns if the user has allocation rights for one or more resource
protected  void checkServiceState()
           
 PluginDescriptor findDescriptor(String pluginClassName)
           
protected  AppointmentFormater getAppointmentFormater()
          lookup AppointmentFormater from the serviceManager
 String getChildBundleName()
           
protected  ClientFacade getClientFacade()
           
protected  Container getContainer()
           
protected  RaplaContext getContext()
           
protected  I18nBundle getI18n()
          lookup I18nBundle from the serviceManager
 ImageIcon getIcon(String key)
          calls getI18n().getIcon(key)
protected  Locale getLocale()
           
protected  Logger getLogger()
           
protected  ModificationModule getModification()
          lookup ModificationModule from the serviceManager
 String getName(Object object)
          returns a translation for the object name into the selected language.
protected  PeriodModel getPeriodModel()
          lookup PeriodModel from the serviceManager
protected  QueryModule getQuery()
          lookup QueryModule from the serviceManager
protected  RaplaLocale getRaplaLocale()
          lookup RaplaLocale from the context
protected  Object getService(String role)
          lookup the service in the serviceManager under the specified key: serviceManager.lookup(role).
 String getString(String key)
          calls getI18n().getString(key)
 String getStringAsHTML(String key)
          calls "<html>" + getI18n().getString(key) + "</html>"
protected  UpdateModule getUpdateModule()
          lookup UpdateModule from the serviceManager
protected  User getUser()
           
protected  UserModule getUserModule()
          lookup UserModule from the serviceManager
 boolean isAdmin()
          returns if the session user is admin
 boolean isModifyPreferencesAllowed()
           
 boolean isRegisterer()
          returns if the session user is a registerer
 Preferences newEditablePreferences()
           
 void setChildBundleName(String childBundleName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

childBundle

protected I18nBundle childBundle
Constructor Detail

RaplaComponent

public RaplaComponent(RaplaContext context)
               throws RaplaException
Throws:
RaplaException
Method Detail

getChildBundleName

public String getChildBundleName()

setChildBundleName

public void setChildBundleName(String childBundleName)

getContainer

protected Container getContainer()
                          throws RaplaException
Throws:
RaplaException

checkServiceState

protected void checkServiceState()

isAdmin

public boolean isAdmin()
returns if the session user is admin


isRegisterer

public boolean isRegisterer()
returns if the session user is a registerer


isModifyPreferencesAllowed

public boolean isModifyPreferencesAllowed()

canUserAllocateSomething

public boolean canUserAllocateSomething(User user)
                                 throws RaplaException
returns if the user has allocation rights for one or more resource

Throws:
RaplaException

canModify

public boolean canModify(Object object)
returns if the current user is allowed to modify the object.


getUser

protected User getUser()
                throws RaplaException
Throws:
RaplaException

getLogger

protected Logger getLogger()

getService

protected Object getService(String role)
lookup the service in the serviceManager under the specified key: serviceManager.lookup(role).

Throws:
IllegalStateException - if GUIComponent wasn't serviced. No service method called
UnsupportedOperationException - if service not available.

getContext

protected RaplaContext getContext()

getRaplaLocale

protected RaplaLocale getRaplaLocale()
lookup RaplaLocale from the context


getLocale

protected Locale getLocale()

getI18n

protected I18nBundle getI18n()
lookup I18nBundle from the serviceManager


getAppointmentFormater

protected AppointmentFormater getAppointmentFormater()
lookup AppointmentFormater from the serviceManager


getPeriodModel

protected PeriodModel getPeriodModel()
lookup PeriodModel from the serviceManager


getQuery

protected QueryModule getQuery()
lookup QueryModule from the serviceManager


getClientFacade

protected ClientFacade getClientFacade()

getModification

protected ModificationModule getModification()
lookup ModificationModule from the serviceManager


getUpdateModule

protected UpdateModule getUpdateModule()
lookup UpdateModule from the serviceManager


getUserModule

protected UserModule getUserModule()
lookup UserModule from the serviceManager


getName

public String getName(Object object)
returns a translation for the object name into the selected language. If a translation into the selected language is not possible an english translation will be tried next. If theres no translation for the default language, the first available translation will be used.


getString

public String getString(String key)
calls getI18n().getString(key)


getStringAsHTML

public String getStringAsHTML(String key)
calls "<html>" + getI18n().getString(key) + "</html>"


getIcon

public ImageIcon getIcon(String key)
calls getI18n().getIcon(key)


newEditablePreferences

public Preferences newEditablePreferences()
                                   throws RaplaException
Throws:
RaplaException

findDescriptor

public PluginDescriptor findDescriptor(String pluginClassName)
                                throws RaplaException
Throws:
RaplaException


Copyright © 2000-2006 Rapla Team. All Rights Reseserved.