Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360386

Summary: Editable tables: Enhanced functionalities
Product: z_Archived Reporter: Matthias Fischer <mfi>
Component: ScoutAssignee: Project Inbox <scout.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: ivan.motsch, zimmermann
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Matthias Fischer CLA 2011-10-10 02:40:26 EDT
Build Identifier: M20110210-1200

To use an editable table as a fast editing way of separate objects, i miss the following functionalities:
- Show the codes of a smartfield hierarchical in a smartfield column
- No method like execPrepareLookup is available in a smartfield column
- MaxLength of a text column
- Define a column as mandatory

Reproducible: Always
Comment 1 Ivan Motsch CLA 2011-10-10 07:39:11 EDT
In General:
All of this can be done in your code using the AbstractColumn.execPrepareEdit.

Simply override in your column: 
execPrepareEdit()
and either make the super call or re-implement it fully customized.

That way you can decorate, enhance and modify the editing field in any way and then return the field.

Specific:
The following (proposed) properties will be included in the column as configured properties:
- Show the codes of a smartfield hierarchical in a smartfield column
- MaxLength of a text column
- Define a column as mandatory

The following callback is already there:
- execPrepareLookup is available in the AbstractSmartfieldColumn and is used inside prepareEditInternal
Comment 2 Ivan Motsch CLA 2011-10-10 07:58:39 EDT
added AbstractColumn.getConfiguredMandatory default false

added AbstractStringColumn.getConfiguredMaxLength default 4000

added AbstractSmartColumn.getConfiguredBrowseHierarchy default false
Comment 3 Matthias Fischer CLA 2011-10-10 09:45:48 EDT
Task to do: 
- Implement a solution for mandatory columns.

Possible solution:
- Check the mandatory state of the table (all cells of a mandatory column), when the form gets stored. Like the normal fields on a form.
- Append the message 'Missing madatory values' like: "Table A - Column B"
- If the missing madatory cell is the first message, preselect the row in the table and make sure, the given column is visible.
Comment 4 Ivan Motsch CLA 2011-10-11 08:23:30 EDT
added new method ITable.requestFocusInCell

added new method IContentProblemDescriptor IFormField.getContentProblemDescriptor() that provides a delegate for fields with problems or issues. It supports for activation of the field/cell etc.

That way when an editable table cell is mandatory it will be checked once the form is saved/validated and automatically activate the cell in editing mode using ITable.requestFocusInCell.

If the field/table is in a tab that is not yet active, the tab (recursively) is activated so to show the missing field.
Comment 5 Ivan Motsch CLA 2011-10-11 08:25:29 EDT
*** Bug 358059 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Fischer CLA 2011-10-18 09:12:11 EDT
Task 1:
MaxLength behaviour on StringFields and StringColumns is not the same.
Testcase: Define a StringField and a StringColumn with MaxLength = 60. Copy a long text (Ctrl+c) with over 60 characters. Fill both fields with paste (Ctrl+v).

StringField: A messagebox appears and the first 60 copied characters are still in the field.
StringColumn: A messagebox appears but the field is empty.

Task 2:
A hidden (visible = false), mandatory column on a table can be empty. That should not be possible.

Task 3:
If i store a form with empty mandatory fields, a dialog appears with a message and a list of all open mandatory fields. If there are two empty mandatory columns, only one column is shown in the message. In the message i want to see all empty mandatory fields and columns.
Comment 7 Ivan Motsch CLA 2011-10-19 09:24:22 EDT
Task 1:
Fixed

Task 2:
Fixed.
Since scout cannot guess which (hidden) columns should be checked, it simply makes all columns that have the flag editable=true visible before checking.

Task 3:
Fixed.

This will be committed today but i need some break first.
Comment 8 Matthias Fischer CLA 2011-10-20 05:57:58 EDT
Just to clarify task 2:
Scout can only check a column validation if a column is visible. So the process to check a column validation is now as follows:
- if the column is editable, go further
- if the column is invisible, make it visible
- check the validation
- if the column is valid, make it invisble

This is how it works in the background, the user doesn't see if i column gets visible and then changes back to invisilbe.
If a validation of an invisble, mandatory column fails, then the column is visible for the user, because he has to manually change something in the column.
Comment 9 Ivan Motsch CLA 2011-10-20 06:04:24 EDT
Thanks for the clarification, thats absolutely right.
Sorry for the delay, will commit today.
Comment 10 Ivan Motsch CLA 2011-10-20 06:58:12 EDT
Fixed and in svn.
Comment 11 Matthias Fischer CLA 2011-10-24 04:30:27 EDT
Task 1: Test OK
Task 2: Test NOK
Task 3: Test OK

Problem Task 2:
If i store a table with a hidden mandatory field (has a valid value), the user can see, how the column is set to visible and then set back to invisible. If it is possible, the user shouldn't see this process.
Comment 12 Ivan Motsch CLA 2011-11-11 04:25:06 EST
Task 2: OK
Managed to distinguish between editable on column and table level
- IColumn.isCellEditable checks enabled and execEditable, but not visible property
- ITable.isCellEditable checks IColum.isCellEditable and IColumn.isVisible

The ui (swing, swt, rap) layer always calls ITable.isCellEditable
The model table validator in AbstractTableField calls IColumn.isCellEditable
and can thus make validation without making the column visible.

When the column contains invalid editable cells it is made visible.
Comment 13 Matthias Fischer CLA 2011-11-14 03:47:24 EST
Test successful, thanks!
Comment 14 Matthias Zimmermann CLA 2012-07-09 06:50:21 EDT
ticket closed.
deliverd as part of eclipse scout 3.8.0 (juno release train)