Bug 378032 - [api] provide editor support for required attributes
Summary: [api] provide editor support for required attributes
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 3.11   Edit
Assignee: Leo Dos Santos CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on: 384038
Blocks: 158921
  Show dependency tree
 
Reported: 2012-04-29 12:00 EDT by Benjamin Muskalla CLA
Modified: 2015-03-11 14:52 EDT (History)
2 users (show)

See Also:


Attachments
mylyn/context/zip (15.59 KB, application/octet-stream)
2012-04-29 12:14 EDT, Benjamin Muskalla CLA
no flags Details
cut off error marker on Mac (3.01 KB, image/png)
2014-01-14 08:25 EST, Steffen Pingel CLA
no flags Details
decorators with big fonts (6.09 KB, image/png)
2014-02-17 14:43 EST, Leo Dos Santos CLA
no flags Details
decorators with smallfonts (5.72 KB, image/png)
2014-02-17 14:43 EST, Leo Dos Santos CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2012-04-29 12:00:33 EDT
TaskAttributes should have a notion of "required". Unlike Bugzilla, some connectors have required fields for new task creation that can't be prefilled with some value. Currently, all connectors handle this internally by somehow annotating the UI to help the user and checking for required fields on submission. I could imagine that a metadata attribute similar to read-only would be sufficient for 80% of the cases.
Comment 1 Benjamin Muskalla CLA 2012-04-29 12:06:52 EDT
Pushed initial draft to http://review.mylyn.org/509
Comment 2 Benjamin Muskalla CLA 2012-04-29 12:14:59 EDT
Created attachment 214778 [details]
mylyn/context/zip
Comment 3 Steffen Pingel CLA 2012-05-23 06:14:00 EDT
Thanks Benjamin. The review is now at https://git.eclipse.org/r/#change,6024. I plan on taking a look once the Juno release is settled.
Comment 4 Leo Dos Santos CLA 2013-12-11 19:39:02 EST
Reviews continued on https://git.eclipse.org/r/#/c/19677/ and https://git.eclipse.org/r/#/c/19678/
Comment 5 Sam Davis CLA 2013-12-11 20:05:42 EST
I wonder if we should decorate required fields all the time or only indicate an error when they don't have a value?
Comment 6 Leo Dos Santos CLA 2013-12-11 20:31:47 EST
For now, only decorate when the a required field is empty. This we avoid having 2 types of asterisks in the editor meaning different things, and we avoid having 2 icons denoting requiredness.
Comment 7 Sam Davis CLA 2013-12-17 20:18:16 EST
Thanks very much, Benny and Leo, for the contribution!
Comment 8 Steffen Pingel CLA 2014-01-14 08:22:48 EST
I noticed a few small nits when I tried out the latest task editor:

* When I opened the editor all editors for required attributes were flagged with error markers. I thought these would only show on focus?
* Boolean attributes were showing the error marker even though they had a valid value (i.e. false in that particular case). 

Leo, what are your thoughts?
Comment 9 Steffen Pingel CLA 2014-01-14 08:25:34 EST
Created attachment 238962 [details]
cut off error marker on Mac
Comment 10 Sam Davis CLA 2014-01-14 17:21:39 EST
(In reply to comment #8)
> I noticed a few small nits when I tried out the latest task editor:
> 
> * When I opened the editor all editors for required attributes were flagged with
> error markers. I thought these would only show on focus?

If we did that, users would have to select each attribute to find out whether it was required.
Comment 11 Leo Dos Santos CLA 2014-01-14 20:31:01 EST
(In reply to comment #9)
> Created attachment 238962 [details]
> cut off error marker on Mac

Could be that the padding between label & field is smaller when you run on Mac without the "-Dorg.eclipse.swt.internal.carbon.smallFonts" flag.
Comment 12 Leo Dos Santos CLA 2014-01-14 20:52:17 EST
(In reply to comment #8)
> * Boolean attributes were showing the error marker even though they had a valid
> value (i.e. false in that particular case).
> 
> Leo, what are your thoughts?

I suspect that if a boolean attribute has no value, the BooleanAttributeEditor will still display a default of false, without sending any modification event. I'd need to look into it further.
Comment 13 Sam Davis CLA 2014-01-15 13:11:43 EST
I wonder if this affects single select attributes as well.
Comment 14 Leo Dos Santos CLA 2014-01-15 18:46:41 EST
(In reply to comment #13)
> I wonder if this affects single select attributes as well.

I suspect this would be the case for any single select attribute where the attribute mapper generates a non-empty default.
Comment 15 Sam Davis CLA 2014-01-15 19:27:27 EST
Can we check before displaying the icon that the attribute editor has no value?
Comment 16 Leo Dos Santos CLA 2014-02-06 19:05:13 EST
(In reply to comment #15)
> Can we check before displaying the icon that the attribute editor has no value?

We were, but the check is incorrect for boolean attributes! Here's a review:
21654: 378032: fix for boolean attribute editors that show required decorator [Ie343ba26]
https://git.eclipse.org/r/#/c/21654/
Comment 17 Sam Davis CLA 2014-02-11 21:16:23 EST
(In reply to comment #11)
> (In reply to comment #9)
> > Created attachment 238962 [details]
> > cut off error marker on Mac
> 
> Could be that the padding between label & field is smaller when you run on Mac
> without the "-Dorg.eclipse.swt.internal.carbon.smallFonts" flag.

I am actually seeing some clipping on Windows too, although not as bad as that. For me there is only 1 pixel cut off whereas it looks like for Steffen there are 3.

Here's a fix that shifts the editor control 3 pixels to the right: https://git.eclipse.org/r/21861

I suppose we could make the amount of shifting dependant on the OS but I'm not sure it's worth it for 2 pixels.

I also noticed that AttributeEditorToolkit.createValidator puts the error icon at SWT.BOTTOM whereas here we use TOP. They should probably be the same. My preference is to change AttributeEditorToolkit to use TOP since I think that is the convention and looks better.
Comment 18 Sam Davis CLA 2014-02-11 21:19:39 EST
It should be noted that without the above fix, the decorators created by AttributeEditorToolkit are also clipped. In hindsight we should perhaps have used AttributeEditorToolkit to do these decorations as well but we won't have time to change that before the release.
Comment 19 Steffen Pingel CLA 2014-02-12 04:34:09 EST
(In reply to comment #17)
> I also noticed that AttributeEditorToolkit.createValidator puts the error icon
> at SWT.BOTTOM whereas here we use TOP. They should probably be the same. My
> preference is to change AttributeEditorToolkit to use TOP since I think that is
> the convention and looks better.

Isn't top already used by the content assist hint?
Comment 20 Sam Davis CLA 2014-02-12 14:28:05 EST
Ah, good point! I guess we should use BOTTOM instead so that they don't conflict.
Comment 21 Sam Davis CLA 2014-02-14 17:05:36 EST
I've updated https://git.eclipse.org/r/21861 to address clipping in the people part as well as the attributes section, and to change the error icon to use BOTTOM. Please verify the fix.
Comment 22 Leo Dos Santos CLA 2014-02-17 14:43:26 EST
Created attachment 240046 [details]
decorators with big fonts
Comment 23 Leo Dos Santos CLA 2014-02-17 14:43:56 EST
Created attachment 240047 [details]
decorators with smallfonts
Comment 24 Leo Dos Santos CLA 2014-02-17 14:46:26 EST
I've posted a couple of screen grabs of the required & content assist decorators together on the Mac with smallfonts enabled and disabled. The smallfonts case, the decorators overlap slightly on to each other, but that may just be a case of the Mac text field not being tall enough to accomodate two 8*8 pixel icons. The decorators no longer get clipped by the text field though.
Comment 25 Sam Davis CLA 2014-02-17 19:02:19 EST
Thanks for verifying. I merged the fix.
Comment 26 Sam Davis CLA 2015-03-11 14:52:06 EDT
(In reply to comment #8)
> * Boolean attributes were showing the error marker even though they had a valid
> value (i.e. false in that particular case).

Actually, the attribute did not have any value but the attribute editor has no way to show that so it appeared false. But the task can't be submitted without checking and unchecking the boolean, so since we suppressed the error decorator, we should also initialize the attribute:

43689: BooleanAttributeEditor should initialize attribute to false [I29c92306]
https://git.eclipse.org/r/#/c/43689/