LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.control
Class LyEditTableController

java.lang.Object
  extended by leon.control.LyController
      extended by leon.control.LyAreaController
          extended by leon.control.LyPanelController
              extended by leon.control.LySimpleTableController
                  extended by leon.control.LyTableController
                      extended by leon.control.LyMultiPageTableController
                          extended by leon.control.LyEditTableController
All Implemented Interfaces:
java.lang.Runnable, LyGetSessionInterface, LyContextInterface, LyFastFilterEndInterface, LyFilterEndInterface, LyFindInterface, LyGetActionInterface, LySelectFileListenerInterface, LySortEndInterface, LyAdvancedWorkSpaceListener, LyGuiListener, LyWorkSpaceListener, LyGetClassInfoInterface, LyInfoListener, LyEvaluator, LyDemandListener, LyPrintListenerInterface, LyAnswerInterface, LyQuestionAnswerInterface, LySetPrintModeInterface
Direct Known Subclasses:
LyRelationTableController

public class LyEditTableController
extends LyMultiPageTableController

This class implements an editable table controller. Fields displayed in the table may be modified automatically. It is associated with a builder (LyTableBuilder) and a behavior that implements LyTableBehaviorInterface. Usually, this behavior is implemented by an instance of LyTableBehavior

See Also:
LySimpleTableBuilder, LyTableController, LyTableBehaviorInterface

Field Summary
static java.lang.String __VERSION
          File Version
static java.lang.String DEMAND_ALT_ADD
          Demand id : ALT+ADD key demand.
static java.lang.String DEMAND_ALT_DOWN
          Demand id : ALT+DOWN key demand.
static java.lang.String DEMAND_ALT_LEFT
          Demand id : ALT+LEFT key demand.
static java.lang.String DEMAND_ALT_RIGHT
          Demand id : ALT+RIGHT key demand.
static java.lang.String DEMAND_ALT_UP
          Demand id : ALT+UP key demand.
static java.lang.String DEMAND_CANCEL_ROW
          Demand id : Cancel row.
static java.lang.String DEMAND_COPY_CELLS
          Demand id : Copy cells.
static java.lang.String DEMAND_PASTE_CELLS
          Demand id : Paste cells.
static java.lang.String DEMAND_RESTORE
          Restore inputs.
static java.lang.String DEMAND_VALIDATE_ROW
          Demand id : Validate row.
static int MAX_COLUMN_WIDTH
          Max column width
static boolean TOOLBAR_FOR_UNCHANGED_OBJECTS
          Indicates if a toolbar is visible for unchanged objects
 
Fields inherited from class leon.control.LyMultiPageTableController
IMPACT_OUTSIDE_OF_CURRENT_VIEW, SELECT_PAGE
 
Fields inherited from class leon.control.LyTableController
MAX_OBJECTS_COUNT_FOR_CONTEXT_FILTER
 
Fields inherited from class leon.control.LySimpleTableController
DEMAND_CHOOSE_COLUMNS, DEMAND_COPY_CELL_CONTENT, DEMAND_FIX_COLUMN, DEMAND_GROUP_BY, DEMAND_INVERT_STATUS_SORT, DEMAND_LIST_DISPLAY, DEMAND_NEXT_PAGE, DEMAND_PREVIOUS_PAGE, DEMAND_PRINT_TABLE, DEMAND_REVERSE, DEMAND_ROW_TOOL, DEMAND_SORT_BY, DEMAND_SORT_DEFAULT, DEMAND_SORT_EXTEND, DEMAND_SORT_REVERSE, DEMAND_SORT_WIZARD, DEMAND_STATUS_SORT, DEMAND_SUB_TOOL_ACTION, DEMAND_UNFIX_COLUMN, EMPTY_CELL, FOOTER_ROW_PREFIX, MESSAGE_OBJECTS_COUNT, SECTION_ROW_PREFIX
 
Fields inherited from class leon.control.LyPanelController
DEMAND_DEFAULT_FOR_MOBILE_PREFERENCE, DEMAND_DEFAULT_PREFERENCE, DEMAND_PREFERENCE_TARGET, DEMAND_SAVE_PREFERENCE, DEMAND_SELECT_ALL, DEMAND_SHARED_PREFERENCE, DEMAND_UNSELECT_ALL, EXTEND_SIMPLE_FILTER, EXTENDED_FILTER_NEW, FAST_FILTER, FILTER_ACTIVE, FILTER_SET, PREFERENCE_TARGET_ACTION, PREFERENCE_TARGET_CLASS, SIMPLE_FILTER_NEW
 
Fields inherited from class leon.control.LyAreaController
DEFAULT_MENU_ITEM_IMAGE_SIZE, DEMAND_APPLY, DEMAND_CANCEL, DEMAND_CLOSE, DEMAND_CREATE_CHART, DEMAND_DELETE_CHART, DEMAND_DELETE_OBJECTINFOS, DEMAND_DELETE_PREFERENCE, DEMAND_UPDATE_VIEW, DEMAND_VALIDATE
 
Fields inherited from class leon.control.LyController
_nbControllers, _nextId, CONTROLLER_ID_SEP, DEFAULT_IMAGE_FORMAT, DEMAND_HELP, ID_SEP
 
Constructor Summary
LyEditTableController(LySession session, LyController parent, LyAction action, LyClassInfo classInfo, LyObjectList context)
          Constructor.
 
Method Summary
 void actionDemand(LyActionDemand demand)
          Invoked when an action notification is sent to this listener.
 LyRow buildRow(LyObject object, LyInfoList<LyFieldInfo> fields, LyInfoList<LyFieldInfo> statusFields)
          Current builder of a new row.
 boolean canBeEditable(LyFieldInfo fieldInfo)
          Checks if given field info can be editable or not.
 void clearViewCache()
          Clears all cached data for this controller (especially the view and the component).
 boolean enableShowMessage()
          Indicates wether an error message may be shown or not.
 void enableShowMessage(boolean status)
          Indicates wether an error message may be shown or not.
 short endValidate()
          Internal use.
 void free(LyController controller)
          Free this controller on request of the specified controller.
 LyObjectList getContent()
          Get content of the table.
 int getDisplayListDataIndex()
          Get index of fields value column.
 LyFieldInfo getFieldInfoDisplayList(int colIndex)
          Get index of fieldInfo in fields when in list mode.
 LyEditTableSetController getInternalCreateController()
          Internal create controlle: for internal use only.
 java.lang.String getModificationsColor()
          Get the color resource for cells containing modifications.
 LyEditTableSetController getSetController(LyObject object)
          For internal use, maintain a list of setControllers related to objects being modified.
 java.util.BitSet getSetFieldMarks()
          Access to edition field marks used to build the controlled view.
 LyAction getStatusAction(LyObject object)
          Retrieve the status action for an object.
 boolean hasViewLimit()
          Indicates if the action has a view limit.
 boolean isAutoCommit()
          Indicates whether auto-commit is set or not.
 boolean isDynamicEditionMode()
          Checks if the dynamic edition mode is set or not.
 boolean isEditable()
          Checks if the controlled form is editable or not.
 boolean isEditable(LyObject object, LyFieldInfo fieldInfo)
          Checks if given field info is editable or not.
 boolean isEnabled()
          Checks if the controlled form is enabled or not.
 void loadPage(boolean next)
          Go to next or previous page.
 boolean objectAdded(LyWorkSpaceEvent event)
          Called when an object is added in the dynamic object list.
 boolean objectRemoved(LyWorkSpaceEvent event)
          Called when an object is removed from the dynamic object list.
 void reset(boolean full)
          Overridden to clean set controllers table and to cancel edition state.
 void selectionDemand(LySelectionDemand demand)
          Invoked when an action occurs.
 boolean setContext(LyWorkSpace context)
          Set the current context for the controller.
 LyEditTableSetController setControllerFactory(LyObject object)
          utility method (factory) to create setControllers related to objects being modified This method may be overriden in subclasses.
 void setEditable(boolean editable)
          Set boolean indicating if the controlled form is editable or not.
 void setEnabled(boolean enabled)
          Set boolean indicating if the controlled form is enabled or not.
 void setFields(LyInfoList<LyFieldInfo> fields)
          Sets the displayed fields for this controller.
 void setFixedColumnWidth(LyFieldInfo fieldInfo)
          Forces the width of a column.
 void setPage(int page)
          Set current page being displayed If this page is greater than the lastPage value, the method will take the page 'modulo' getLastPage() value.
 void setSetFieldMarks(java.util.BitSet fieldMarks)
          Set edition field marks used to build the controlled view.
 void showError(LyObject object, LyError error)
          Show an error for the specified object.
 boolean startCellEdition(LyObject object, int colIndex)
          Starts the edition of a cell (dynamic edition mode only).
 boolean startCellEdition(LyObject object, int colIndex, boolean showRow)
          Starts the edition of a cell (dynamic edition mode only).
 short startValidate()
          Internal use.
 void updateRowObject(LyObject object)
          Updates the row for a given object.
 boolean useEditTable()
          Checks if an edit table is used for editing composition relations.
 short validate(LyEditTableSetController setController)
          Validate edition of given controller.
 short validateChanges()
          Public method to validate all editions.
 
Methods inherited from class leon.control.LyMultiPageTableController
getLastPage, getPage, isDisplayNextPreviousTools, isDisplayPagesNumber, isPaginated, selectRow, setClassFilter, setLastModified, setPrintMode, setSort
 
Methods inherited from class leon.control.LyTableController
completeMessages, print, selectObject, selectObjects
 
Methods inherited from class leon.control.LySimpleTableController
allowSortOnField, clearTranslatedStringMap, dragDropDemand, enablesMultiSelection, endFastFilter, endSort, findObject, fixColumn, getBehaviorInterface, getClassFilter, getClassInfo, getColsNumberListDisplay, getColumnSize, getComplexFields, getFastFilterFieldInfo, getFastFilterValue, getFieldMarks, getFields, getLimit, getPanelComponent, getRealFields, getSelection, getSelection, getSort, getStatusFieldInfos, getTableComponent, getTableComponentFields, getTableComponentFields, hasDisplayListToggleButton, hasPrintMode, isDisplayList, isDisplayListShowFields, isFastFilterExtended, isFastFilterSet, isFopMode, isImageColumn, isStatusColumn, menuDemand, objectChanged, objectStateChanged, printList, questionAnswer, run, selectAllObjects, selectObject, setFieldMarks, setFopMode, setPreference, showObject, translate
 
Methods inherited from class leon.control.LyPanelController
buildFilter, closeBorderPanel, endFilter, getFilter, getFilterController, getFilterEditorController, getPreference, getRefreshTime, isFilterActive, isHorizontal, objectUserEvent, setFilter, setIdle, setRefreshTime, updatePreferencesMenu, workSpaceEventsGrouped
 
Methods inherited from class leon.control.LyAreaController
canClose, canFree, completeMenuBar, free, getAction, getAreaStackController, getBehavior, getBuilder, getContext, getContextClient, getContextTitle, getDefaultAction, getEnvironment, getFastEditionAction, getHelpFile, getImage, getImageTooltip, getInfoLabel, getInfoLabel, getKeyValue, getLabel, getLastModified, getMenuItemImage, getName, getParameter, getParameter, getParameterMarks, getParent, getParent, getParentAreaController, getShortLabel, getTarget, getTitle, getViewController, getViewController, hasMark, hasNotMark, hasViewController, hideView, infoEvent, initialize, isInitialized, isOutlined, isViewResizable, reset, selectFileDemand, setContext, setContextClient, setViewController, showView, showView, testParameter, toString, update, updateTitleBar
 
Methods inherited from class leon.control.LyController
activateViewDemand, demandPerformed, getApplication, getClassInfo, getComponent, getId, getImage, getImage, getImage, getImage, getImageFromPrefix, getImageFromPrefix, getImageFromPrefix, getName, getObjectId, getSession, getUserData, getView, getViewManager, helpDemand, hideView, isFreed, isIdle, setBuilder, setBuilderClass, setName, setUserData, showError, showWarning, updateViewFromValues
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface leon.control.LyContextInterface
getContext
 
Methods inherited from interface leon.data.LyAdvancedWorkSpaceListener
objectUserEvent, workSpaceEventsGrouped
 
Methods inherited from interface leon.control.LyFilterEndInterface
endFilter, getFilter
 
Methods inherited from interface leon.control.LyFastFilterEndInterface
getFilter
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File Version

See Also:
Constant Field Values

TOOLBAR_FOR_UNCHANGED_OBJECTS

public static boolean TOOLBAR_FOR_UNCHANGED_OBJECTS
Indicates if a toolbar is visible for unchanged objects


DEMAND_RESTORE

public static final java.lang.String DEMAND_RESTORE
Restore inputs.


DEMAND_VALIDATE_ROW

public static final java.lang.String DEMAND_VALIDATE_ROW
Demand id : Validate row.


DEMAND_CANCEL_ROW

public static final java.lang.String DEMAND_CANCEL_ROW
Demand id : Cancel row.


DEMAND_COPY_CELLS

public static final java.lang.String DEMAND_COPY_CELLS
Demand id : Copy cells.


DEMAND_PASTE_CELLS

public static final java.lang.String DEMAND_PASTE_CELLS
Demand id : Paste cells.


DEMAND_ALT_UP

public static final java.lang.String DEMAND_ALT_UP
Demand id : ALT+UP key demand.


DEMAND_ALT_DOWN

public static final java.lang.String DEMAND_ALT_DOWN
Demand id : ALT+DOWN key demand.


DEMAND_ALT_LEFT

public static final java.lang.String DEMAND_ALT_LEFT
Demand id : ALT+LEFT key demand.


DEMAND_ALT_RIGHT

public static final java.lang.String DEMAND_ALT_RIGHT
Demand id : ALT+RIGHT key demand.


DEMAND_ALT_ADD

public static java.lang.String DEMAND_ALT_ADD
Demand id : ALT+ADD key demand.


MAX_COLUMN_WIDTH

public static int MAX_COLUMN_WIDTH
Max column width

Constructor Detail

LyEditTableController

public LyEditTableController(LySession session,
                             LyController parent,
                             LyAction action,
                             LyClassInfo classInfo,
                             LyObjectList context)
Constructor.

Parameters:
session - current session associated to the controller. The controller automatically registers on the specified session.
parent - parent controller (or null for 'root' controller). Controller hierarchy indicates a child controller (for example a dialog created from a main view)
action - related action. If an action is specified, the controller uses action parameters (action name, action specific XML view description ...)
classInfo - class info for objects displayed in the list.
context - current context (may be null if the view is not contextual to a list of objects).
Method Detail

reset

public void reset(boolean full)
Overridden to clean set controllers table and to cancel edition state.

Overrides:
reset in class LyMultiPageTableController
Parameters:
full - indicates if a full reset (view + data) must be performed

loadPage

public void loadPage(boolean next)
Go to next or previous page.

Overrides:
loadPage in class LyMultiPageTableController
Parameters:
next - true if we go to next page.

hasViewLimit

public boolean hasViewLimit()
Indicates if the action has a view limit.

Overrides:
hasViewLimit in class LyMultiPageTableController
Returns:
true if the action has a view limit, false otherwise

setPage

public void setPage(int page)
Set current page being displayed If this page is greater than the lastPage value, the method will take the page 'modulo' getLastPage() value. (Circular).

Overrides:
setPage in class LyMultiPageTableController
Parameters:
page - current page we want to show

setContext

public boolean setContext(LyWorkSpace context)
Set the current context for the controller.

Specified by:
setContext in interface LyContextInterface
Overrides:
setContext in class LyMultiPageTableController
Parameters:
context - Current context, or null if no context is set for the view
Returns:
true if successfull
See Also:
LyContextInterface.getContext()

buildRow

public LyRow buildRow(LyObject object,
                      LyInfoList<LyFieldInfo> fields,
                      LyInfoList<LyFieldInfo> statusFields)
Current builder of a new row.

Overrides:
buildRow in class LySimpleTableController
Parameters:
object - object added in the contextual list, and which should set the content of row cells.
fields - list of fields which should be seen.
statusFields - list of fields which may set the status icon.
Returns:
LyRow the new Row description (XML description) which is added in the LyTable component.
See Also:
LyMultiPageTableController.insertRow(leon.data.LyObject, int, boolean)

getStatusAction

public LyAction getStatusAction(LyObject object)
Retrieve the status action for an object.

Parameters:
object - object of the action.
Returns:
the status action for this object or null if there is no status action on this object.

getModificationsColor

public java.lang.String getModificationsColor()
Get the color resource for cells containing modifications.

Returns:
the color for modified cells

setFixedColumnWidth

public void setFixedColumnWidth(LyFieldInfo fieldInfo)
Forces the width of a column.
When a column is fixed, its width will not be computed with an approximation made with data.

Parameters:
fieldInfo - the field whose coulmn width must be fixed.

setControllerFactory

public LyEditTableSetController setControllerFactory(LyObject object)
utility method (factory) to create setControllers related to objects being modified This method may be overriden in subclasses.

Parameters:
object - current object being modified
Returns:
current setController. If no set controller is currently related, a new one is created.

selectionDemand

public void selectionDemand(LySelectionDemand demand)
Invoked when an action occurs.

Overrides:
selectionDemand in class LyMultiPageTableController
Parameters:
demand - selection event created from the view. User interaction.
See Also:
LyController.selectionDemand(leon.view.event.LySelectionDemand)

actionDemand

public void actionDemand(LyActionDemand demand)
Invoked when an action notification is sent to this listener.

This method is called by demandPerformed and may be overriden in subclasses.

Default implementation makes nothing.

Overrides:
actionDemand in class LyMultiPageTableController
Parameters:
demand - demand parameters sent by the view component.
See Also:
LyController.demandPerformed(leon.view.event.LyDemand)

startCellEdition

public boolean startCellEdition(LyObject object,
                                int colIndex)
Starts the edition of a cell (dynamic edition mode only). This method cancels the edition in the table if called with negative values (for example a call to startCellEdition(null,-1) will cancel the edition).

Parameters:
object - the object to edit.
colIndex - the index of the cell column to be edited.
Returns:
true if the cell is in edition mode at the end of the treatment, false otherwise.

startCellEdition

public boolean startCellEdition(LyObject object,
                                int colIndex,
                                boolean showRow)
Starts the edition of a cell (dynamic edition mode only). This method cancels the edition in the table if called with negative values (for example a call to startCellEdition(null,-1) will cancel the edition).

Parameters:
object - the object to edit.
colIndex - the index of the cell column to be edited.
showRow - indicates whether edited row must be shown on view manager.
Returns:
true if the cell is in edition mode at the end of the treatment, false otherwise.

validateChanges

public short validateChanges()
Public method to validate all editions.

Returns:
the validation status
See Also:
LyFormInterface

validate

public short validate(LyEditTableSetController setController)
Validate edition of given controller.

Parameters:
setController - the controller to validate
Returns:
the validation status
See Also:
LyFormInterface

startValidate

public short startValidate()
Internal use. Called when the parent form is starting validation.

Returns:
the validation status
See Also:
LyFormInterface

endValidate

public short endValidate()
Internal use. Called when the parent form is ending validation.

Returns:
the validation status
See Also:
LyFormInterface

setFields

public void setFields(LyInfoList<LyFieldInfo> fields)
Sets the displayed fields for this controller.

Overrides:
setFields in class LySimpleTableController
Parameters:
fields - List of fields to display in the table. If null, return to default list of fields.

free

public void free(LyController controller)
Free this controller on request of the specified controller.

Overrides:
free in class LySimpleTableController
Parameters:
controller - controller instance which requested the freeing of this controller. If the controller is the parent, this controller is freed otherwise the method does nothing.
See Also:
LyAreaController.free()

clearViewCache

public void clearViewCache()
Clears all cached data for this controller (especially the view and the component).

This method may be invoked for memory optimization, but the controller is still valid and may be used. (Unlike free) Further usage, needs to rebuild internal component & view which may be time consuming.

Overrides:
clearViewCache in class LySimpleTableController

updateRowObject

public void updateRowObject(LyObject object)
Updates the row for a given object.

Parameters:
object - the object whose row must be updated.

objectAdded

public boolean objectAdded(LyWorkSpaceEvent event)
Called when an object is added in the dynamic object list.

Specified by:
objectAdded in interface LyWorkSpaceListener
Overrides:
objectAdded in class LySimpleTableController
Parameters:
event - the workspace event
Returns:
true if the event was handled
See Also:
LyWorkSpaceListener.objectAdded(leon.data.LyWorkSpaceEvent)

objectRemoved

public boolean objectRemoved(LyWorkSpaceEvent event)
Called when an object is removed from the dynamic object list.

Specified by:
objectRemoved in interface LyWorkSpaceListener
Overrides:
objectRemoved in class LySimpleTableController
Parameters:
event - the workspace event
Returns:
true if the event was handled
See Also:
LyWorkSpaceListener.objectRemoved(leon.data.LyWorkSpaceEvent)

getSetController

public LyEditTableSetController getSetController(LyObject object)
For internal use, maintain a list of setControllers related to objects being modified.

Parameters:
object - current object being modified
Returns:
current setController. If no set controller is currently related, a new one is created.

enableShowMessage

public boolean enableShowMessage()
Indicates wether an error message may be shown or not.

Returns:
true if raising popup message is active, false otherwise

enableShowMessage

public void enableShowMessage(boolean status)
Indicates wether an error message may be shown or not.

Parameters:
status - true if raising popup message is active, false otherwise

setSetFieldMarks

public void setSetFieldMarks(java.util.BitSet fieldMarks)
Set edition field marks used to build the controlled view.

Parameters:
fieldMarks - marks to set

getSetFieldMarks

public java.util.BitSet getSetFieldMarks()
Access to edition field marks used to build the controlled view.

Returns:
the field marks

isEditable

public boolean isEditable(LyObject object,
                          LyFieldInfo fieldInfo)
Checks if given field info is editable or not.

Parameters:
object - the object to check
fieldInfo - the field to check
Returns:
true if the field for the given object is editable

canBeEditable

public boolean canBeEditable(LyFieldInfo fieldInfo)
Checks if given field info can be editable or not.

Parameters:
fieldInfo - the field to check
Returns:
true if the field can be edited

isEditable

public boolean isEditable()
Checks if the controlled form is editable or not.

Returns:
the editable status of this controller

setEditable

public void setEditable(boolean editable)
Set boolean indicating if the controlled form is editable or not.

Parameters:
editable - the editable status

getInternalCreateController

public LyEditTableSetController getInternalCreateController()
Internal create controlle: for internal use only.

Returns:
the internal create controller

isEnabled

public boolean isEnabled()
Checks if the controlled form is enabled or not.

Returns:
the enabled status

isDynamicEditionMode

public boolean isDynamicEditionMode()
Checks if the dynamic edition mode is set or not.

Returns:
the dynamic edition mode status

isAutoCommit

public boolean isAutoCommit()
Indicates whether auto-commit is set or not.

Returns:
true if auto-commit is set, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Set boolean indicating if the controlled form is enabled or not.

Parameters:
enabled - the enabled status

getContent

public LyObjectList getContent()
Get content of the table.

Overrides:
getContent in class LySimpleTableController
Returns:
the list of objects being displayed

useEditTable

public boolean useEditTable()
Checks if an edit table is used for editing composition relations.

Returns:
true if we use edit table for relations

showError

public void showError(LyObject object,
                      LyError error)
Show an error for the specified object. If object is null or if the resource LY_SHOWN_ERRORS_ON_OBJECTS is set to true, the error message is shown in a popup window else the specified error is added to the object.

Overrides:
showError in class LyController
Parameters:
object - The object in error
error - The error o show
See Also:
LyController.showError(String)

getFieldInfoDisplayList

public LyFieldInfo getFieldInfoDisplayList(int colIndex)
Get index of fieldInfo in fields when in list mode.

Parameters:
colIndex - index of column.
Returns:
fieldInfo in the column

getDisplayListDataIndex

public int getDisplayListDataIndex()
Get index of fields value column.

Returns:
index of fields value column

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com