javax.rad.genui.control
Class AbstractControllable<C extends IComponent>

java.lang.Object
  extended by javax.rad.genui.UIResource<C>
      extended by javax.rad.genui.UIComponent<C>
          extended by javax.rad.genui.control.AbstractControllable<C>
Type Parameters:
C - instance of IComponent
All Implemented Interfaces:
IControllable, ITranslatable, IComponent, IResource, INamedObject, ITranslator
Direct Known Subclasses:
UIChart, UIEditor, UITable, UITree

public abstract class AbstractControllable<C extends IComponent>
extends UIComponent<C>
implements IControllable

Base class for all genui IControl implementations. It handles the notification of the controler on focus gained. Therefore a focus listener is added to the technology dependent control. All commands are deligated to seperate is[Command]Enabled and do[Command] functions, to allow easy overwriting.


Field Summary
 
Fields inherited from class javax.rad.genui.UIComponent
bTranslate, lLastTranslationModified, parent, popupMenu
 
Fields inherited from class javax.rad.genui.UIResource
uiResource
 
Fields inherited from interface javax.rad.model.ui.IControllable
COMMAND_DELETE, COMMAND_DUPLICATE, COMMAND_EDIT, COMMAND_EXPORT, COMMAND_FIRST, COMMAND_INSERT, COMMAND_INSERT_SUB, COMMAND_LAST, COMMAND_NEXT, COMMAND_PREVIOUS, COMMAND_RESTORE, COMMAND_SEARCH
 
Constructor Summary
protected AbstractControllable(C pComponent)
          Creates a new instance of AbstractControllable.
 
Method Summary
 void addNotify()
          Makes this UIComponent displayable by adding it to an UIContainer.
static ICellFormatter createCellFormatter(java.lang.Object pCellFormatter, java.lang.String pMethodName)
          Creates a cell formatter instance with the given object and method name.
static INodeFormatter createNodeFormatter(java.lang.Object pNodeFormatter, java.lang.String pMethodName)
          Creates a node formatter instance with the given object and method name.
 void doCommand(java.lang.String pCommand)
          Performs the command.
 void doDelete()
          Performs a delete on the current DataBook.
 void doDuplicate()
          Sends the duplicate action to all listeners.
 void doEdit()
          Starts editing.
 void doExport()
          Performs the CSV Export of the current DataBook.
 void doFirst()
          Selects the first row in the current DataBook.
 void doInsert()
          Performs an insert on the current DataBook.
 void doInsertSub()
          Performs an insert on the sub DataBook.
 void doLast()
          Selects the last row in the current DataBook.
 void doNext()
          Selects the next row in the current DataBook.
 void doNotifyController()
          Notify the controller, that focus has changed.
 void doPrevious()
          Selects the previous row in the current DataBook.
 void doRestore()
          Performs a restore on the current DataBook.
 void doSearch()
          Shows the search options.
 IController getController()
          Gets the IController for this IControllable.
 boolean isCommandEnabled(java.lang.String pCommand)
          Gets true, if the command should be enabled.
 boolean isDeleteEnabled()
          True, if delete should be enabled.
 boolean isDuplicateEnabled()
          Gets the duplicate button visibility.
 boolean isEditEnabled()
          Gets the edit button visibility.
 boolean isExportEnabled()
          Gets the export button visibility.
 boolean isFirstEnabled()
          True, if first should be enabled.
 boolean isInsertEnabled()
          True, if new should be enabled.
 boolean isInsertSubEnabled()
          True, if new sub should be enabled.
 boolean isLastEnabled()
          True, if last should be enabled.
 boolean isNextEnabled()
          True, if next should be enabled.
 boolean isPreviousEnabled()
          True, if previous should be enabled.
 boolean isRestoreEnabled()
          True, if restore should be enabled.
 boolean isSearchEnabled()
          Gets the search button visibility.
 void removeNotify()
          Makes this UIComponent undisplayable by removing it to an UIContainer.
 void setController(IController pController)
          Sets the IController for this IControllable.
 
Methods inherited from class javax.rad.genui.UIComponent
beforeAddNotify, capture, createComponentName, createComponentNamePrefix, debug, doEventKey, doTriggerPopMenu, equals, error, eventComponentMoved, eventComponentResized, eventFocusGained, eventFocusLost, eventKey, eventKeyPressed, eventKeyReleased, eventKeyTyped, eventMouseClicked, eventMouseEntered, eventMouseExited, eventMousePressed, eventMouseReleased, getBackground, getBounds, getComponentUIResource, getCurrentTranslation, getCursor, getDefaultName, getEventSource, getExistingNames, getFactory, getFont, getForeground, getLocation, getLocationOffset, getLocationRelativeTo, getMaximumSize, getMinimumSize, getName, getParent, getPopupMenu, getPreferredSize, getResource, getRootName, getSize, getStyle, getTabIndex, getToolTipText, getTranslation, getUIComponent, hashCode, incrementNameIfExists, info, invokeAndWait, invokeAndWait, invokeInThread, invokeInThread, invokeLater, invokeLater, isBackgroundSet, isBeforeNotified, isCursorSet, isEnabled, isFocusable, isFontSet, isForegroundSet, isMaximumSizeSet, isMinimumSizeSet, isNotified, isPreferredSizeSet, isTranslationChanged, isTranslationEnabled, isVisible, requestFocus, setBackground, setBounds, setBounds, setCursor, setDefaultName, setEnabled, setEventSource, setFocusable, setFont, setForeground, setLocation, setLocation, setLocationRelativeTo, setMaximumSize, setMaximumSize, setMinimumSize, setMinimumSize, setName, setParent, setPopupMenu, setPreferredSize, setPreferredSize, setRootName, setSize, setSize, setStyle, setTabIndex, setToolTipText, setTranslation, setTranslationEnabled, setUIComponent, setVisible, translate, updateTranslation
 
Methods inherited from class javax.rad.genui.UIResource
eventResourceChanged, eventResourceChanged, fireResourceChanged, getObject, getObjectNames, getUIResource, hasResourceHandler, putObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.model.ui.IControllable
getActiveDataBook
 

Constructor Detail

AbstractControllable

protected AbstractControllable(C pComponent)
Creates a new instance of AbstractControllable.

Parameters:
pComponent - the Component.
See Also:
IComponent
Method Detail

getController

public IController getController()
Gets the IController for this IControllable.

Specified by:
getController in interface IControllable
Returns:
the IController

setController

public void setController(IController pController)
Sets the IController for this IControllable.

Specified by:
setController in interface IControllable
Parameters:
pController - the IController

isCommandEnabled

public boolean isCommandEnabled(java.lang.String pCommand)
Gets true, if the command should be enabled.

Specified by:
isCommandEnabled in interface IControllable
Parameters:
pCommand - the command
Returns:
true, if the command should be enabled.

doCommand

public void doCommand(java.lang.String pCommand)
               throws java.lang.Throwable
Performs the command.

Specified by:
doCommand in interface IControllable
Parameters:
pCommand - the command
Throws:
java.lang.Throwable - if the command fails.

addNotify

public void addNotify()
Makes this UIComponent displayable by adding it to an UIContainer. This method is called internally by the genui and should not be called directly.

Overrides:
addNotify in class UIComponent<C extends IComponent>
See Also:
UIComponent.removeNotify(), UIComponent.isNotified()

removeNotify

public void removeNotify()
Makes this UIComponent undisplayable by removing it to an UIContainer.

This method is called by the genui internally and should not be called directly. Code overriding this method should call super.removeNotify as the first line of the overriding method.

Overrides:
removeNotify in class UIComponent<C extends IComponent>
See Also:
UIComponent.addNotify(), UIComponent.isNotified()

doNotifyController

public void doNotifyController()
Notify the controller, that focus has changed.


isFirstEnabled

public boolean isFirstEnabled()
True, if first should be enabled.

Returns:
True, if first should be enabled.

doFirst

public void doFirst()
             throws ModelException
Selects the first row in the current DataBook. (same level in hierarchy)

Throws:
ModelException - if selecting the first row is not possible

isLastEnabled

public boolean isLastEnabled()
True, if last should be enabled.

Returns:
True, if last should be enabled.

doLast

public void doLast()
            throws ModelException
Selects the last row in the current DataBook. (same level in hierarchy)

Throws:
ModelException - if selecting the last row is not possible

isPreviousEnabled

public boolean isPreviousEnabled()
True, if previous should be enabled.

Returns:
True, if previous should be enabled.

doPrevious

public void doPrevious()
                throws ModelException
Selects the previous row in the current DataBook. (same level in hierarchy)

Throws:
ModelException - if selecting the previous row is not possible

isNextEnabled

public boolean isNextEnabled()
True, if next should be enabled.

Returns:
True, if next should be enabled.

doNext

public void doNext()
            throws ModelException
Selects the next row in the current DataBook. (same level in hierarchy)

Throws:
ModelException - if selecting the next is not possible

isInsertEnabled

public boolean isInsertEnabled()
True, if new should be enabled.

Returns:
True, if new should be enabled.

doInsert

public void doInsert()
              throws ModelException
Performs an insert on the current DataBook. (same level in hierarchy)

Throws:
ModelException - if insert is not possible

isInsertSubEnabled

public boolean isInsertSubEnabled()
True, if new sub should be enabled.

Returns:
True, if new sub should be enabled.

doInsertSub

public void doInsertSub()
                 throws ModelException
Performs an insert on the sub DataBook. (next level in hierarchy)

Throws:
ModelException - if insert sub is not possible

isDeleteEnabled

public boolean isDeleteEnabled()
True, if delete should be enabled.

Returns:
True, if delete should be enabled.

doDelete

public void doDelete()
              throws ModelException
Performs a delete on the current DataBook.

Throws:
ModelException - if delete is not possible

isRestoreEnabled

public boolean isRestoreEnabled()
True, if restore should be enabled.

Returns:
True, if restore should be enabled.

doRestore

public void doRestore()
               throws ModelException
Performs a restore on the current DataBook.

Throws:
ModelException - if restore is not possible

isDuplicateEnabled

public boolean isDuplicateEnabled()
Gets the duplicate button visibility.

Returns:
true if visible, false otherwise

doDuplicate

public void doDuplicate()
                 throws ModelException
Sends the duplicate action to all listeners.

Throws:
ModelException - if an duplicate error occurs

isExportEnabled

public boolean isExportEnabled()
Gets the export button visibility.

Returns:
true if visible, false otherwise

doExport

public void doExport()
              throws java.lang.Throwable
Performs the CSV Export of the current DataBook.

Throws:
java.lang.Throwable - if an export error occurs

isEditEnabled

public boolean isEditEnabled()
Gets the edit button visibility.

Returns:
true if visible, false otherwise

doEdit

public void doEdit()
            throws ModelException
Starts editing.

Throws:
ModelException - if an edit error occurs

isSearchEnabled

public boolean isSearchEnabled()
Gets the search button visibility.

Returns:
true if visible, false otherwise

doSearch

public void doSearch()
              throws ModelException
Shows the search options.

Throws:
ModelException - if an export error occurs

createCellFormatter

public static ICellFormatter createCellFormatter(java.lang.Object pCellFormatter,
                                                 java.lang.String pMethodName)
Creates a cell formatter instance with the given object and method name.

Parameters:
pCellFormatter - the object.
pMethodName - the method name.
Returns:
the cell formatter.

createNodeFormatter

public static INodeFormatter createNodeFormatter(java.lang.Object pNodeFormatter,
                                                 java.lang.String pMethodName)
Creates a node formatter instance with the given object and method name.

Parameters:
pNodeFormatter - the object.
pMethodName - the method name.
Returns:
the cell formatter.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.