Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 170568 - [api] add spinner support to task editor attributes
Summary: [api] add spinner support to task editor attributes
Status: CLOSED MOVED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: dev   Edit
Hardware: PC Windows XP
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 170569 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-15 18:59 EST by Lubos Pochman CLA
Modified: 2009-08-19 22:27 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lubos Pochman CLA 2007-01-15 18:59:45 EST
It would be nice if RepositoryTaskAttribute supports also DatePicker (currently text field/single value and combo/option is supported).
Then the date picker could be used do diplay/get/set connector specific dates (currently text field/single value has to be used) that are not covered in task planning stuff.
Comment 1 Willian Mitsuda CLA 2007-01-16 09:02:14 EST
Lubos, are you talking about the new Date/Time control from Eclipse 3.3 (bug#19945)?

If so, I think you'll have to wait until Mik decide to use 3.3 APIs.

Anyway, once this is authorized, I think they will review every place where the custom date/time picker is used and replace with the SWT control.
Comment 2 Lubos Pochman CLA 2007-01-16 11:35:34 EST
No, I am talking about import org.eclipse.mylar.tasks.ui.DatePicker Mylar already uses in AbstractNewRepositoryEditor and in other places.
It just would be handy to extend RepositoryTaskAttribute to support this DatePicker and Spinner so they can be used by connector developer for date or number data specific to connector.

This has nothing to do with new Eclipse 3.3 date picker.
Comment 3 Willian Mitsuda CLA 2007-01-16 11:42:57 EST
Ops, sorry!
Comment 4 Lubos Pochman CLA 2007-01-16 11:46:30 EST
No, that was good question. I should have clarify about which DatePicker I mean.
BTW, if there is an interest, I can try to implement it and submit patch.
Comment 5 Mik Kersten CLA 2007-01-21 22:09:13 EST
Lubos: I'm not quite sure what you mean by "extend RepositoryTaskAttribute to support this DatePicker", because RepositoryTaskAttribute is just a class that holds data, and the way that date attributes are created is a UI concern that's separate.  Could you outline a concrete example of how you want this to work?  Then I will be able to give you suggestoins for creating the patch.
Comment 6 Mik Kersten CLA 2007-01-21 22:13:00 EST
OK, I think I know what you mean now: you probably want the attributes section of the task editor to support editing via a spinner and a date picker.  That sounds good, and the one thing to keep in mind is that RepositoryTaskAttribute should not be changed to support this, since it should not know anything about UI.  Since you're interested in providing a patch I'll assign to you for the time being.
Comment 7 Mik Kersten CLA 2007-01-21 22:13:15 EST
*** Bug 170569 has been marked as a duplicate of this bug. ***
Comment 8 Eugene Kuleshov CLA 2007-01-21 22:20:09 EST
Mik, it may make sense to add something like "type" to RepositoryTaskAttribute. I.e. text, date, etc... Then UI can render the form based on the type information.
Comment 9 Lubos Pochman CLA 2007-01-22 11:13:27 EST
Mik, I am not sure how to implement it without changing RepositoryTaskAttribute. Of course I would retain all the current functionality and backward compatibility, but I would have to extend it either based on a type member variable as Eugene suggested or based on method calls (like it is done in case of options now).
But because UI uses RepositoryTaskAttribute to create appropriate UI widgets for the attributes, RepositoryTaskAttribute should be extended to support spinner and date picker (and possibly more in the future...) and then the editor UI should make use of the extended RepositoryTaskAttribute functionality. Let me know if this suggestion makes sense.
Comment 10 Mik Kersten CLA 2007-01-22 12:15:27 EST
Rob: you've been wrestling with this need to keep the data and presentation/editing separate, so please advise Lubos.
Comment 11 Robert Elves CLA 2007-01-23 13:15:58 EST
Lubos: Holding of options etc is what we want to eliminate from the RepositoryTaskData. The RepositoryTaskData ideally should only hold the data that represents the current state of a repository task (not options available per field, ie. spinner ranges, defaults etc). There are a few reasons for this: 1) bloat in offline storage 2) stale options   ...among other reasons.  To avoid these issues we've created the following tasks to pull this data out of RepoositoryTaskData:

150680: [api] Generalize repository configuration persistence and move into tasklist
https://bugs.eclipse.org/bugs/show_bug.cgi?id=150680

Eventually options (spinner ranges etc) will come from RepositoryConfiguration when pulled up into tasks.core.

Since options will become available from repositoryconfiguration, I imagine a mapping to type could happen there eliminating the need for a type on the repositoryTaskAttribtue as well no? Adding type to RepositorTaskAttribute may be a reasonable compromise though. Thoughts?
Comment 12 Lubos Pochman CLA 2007-01-23 14:58:23 EST
Eliminating RepositorTaskAttribute from RepositorTaskData or eliminating options from RepositorTaskAttribute means change in API and therefore no backward compatibility of the API. That is bad for connector developers, because they will have to modify, upgrade their connectors.

Still both Spinner and DatePicker hold just one value (not a set of pssible option), so it does reflect the state of the repository task (unlike options).
Simple adding setDate() and setNumber() would bew enough (the type can be maintained internally in RepositorTaskAttribute without caller setting it).
Then UI would just check for date or number and create apropriate widget.
Comment 13 Robert Elves CLA 2007-01-23 16:06:18 EST
 (In reply to comment #12)
> Eliminating RepositorTaskAttribute from RepositorTaskData or eliminating options
> from RepositorTaskAttribute means change in API and therefore no backward
> compatibility of the API. That is bad for connector developers, because they
> will have to modify, upgrade their connectors.

Yes, if this change is to happen for 2.0 we will make the transition as easy as possible.

> Still both Spinner and DatePicker hold just one value (not a set of pssible
> option), so it does reflect the state of the repository task (unlike options).
> Simple adding setDate() and setNumber() would bew enough (the type can be
> maintained internally in RepositorTaskAttribute without caller setting it).
> Then UI would just check for date or number and create appropriate widget.
And what is the api call for this check for date or number (getType())?

Comment 14 Lubos Pochman CLA 2007-01-23 19:12:59 EST
Either with getType or based on data content like it is now (if (attribute.hasOptions() && !attribute.isReadOnly())). I would prefer getType().
Comment 15 Robert Elves CLA 2007-01-23 20:33:08 EST
Wouldn't getType() give you everything you need.... without the need for get/setDate get/setNumber? Then based on type we can interpret/display/update the attribute value appropriately. In the case of a date field we could use the ITaskDataHandler.getDateForAttributeType() method to extract a usable date?
Comment 16 Robert Elves CLA 2007-01-23 20:33:08 EST
Wouldn't getType() give you everything you need.... without the need for get/setDate get/setNumber? Then based on type we can interpret/display/update the attribute value appropriately. In the case of a date field we could use the ITaskDataHandler.getDateForAttributeType() method to extract a usable date?
Comment 17 Lubos Pochman CLA 2007-01-24 12:17:32 EST
getType() would be great. The type can be derived internally from data.
RepositorTaskAttribute can support:
setValue(String)
setValue(Integer)
setValue(Long)
setValue(Double)
setValue(Date)
Based on the set value the type is assigned.
Then UI can use getType() to decide which widget to render.
For Spinner/number it would also be nice to be able to optionally set min, max and step:
setMinValue()
setMaxValue()
setStepValue()
Comment 18 Robert Elves CLA 2007-01-25 12:43:08 EST
Longterm this may be the solution but short term would it be possible to do something along the lines of what we've done for Bugzilla time tracking?  We override createCustomAttributeLayout and call BugzillaTaskEditor.addBugzillaTimeTracker() which renders the attributes (including date picker) as needed?
Comment 19 Lubos Pochman CLA 2007-01-25 12:50:18 EST
Rob, I do not have to have it right now. When developing the connector, I realized I cannot use the same UI widgets for date and number as the one used in planning section. In short term I can use text fields (single attribute value), but that doesn't have build in validation and it doesn't look as good.
I would be happy to come up with patch for 2.0. I just need to know if it is OK to submit a patch and if the patch has fighting chance to being looked at 8-).
Comment 20 Robert Elves CLA 2007-01-25 13:38:16 EST
Lets wait till M1 is out then revisit this design discussion (setting target to M2). It's great that you are willing to contribute a patch for this! There are other bugs that we'll need to consider when when we revisit this.  There are plans to refactor what RepositoryTaskData holds (as I mentioned above) and where configuration data is held (bug#150680) but we're also looking at how it is stored offline (bug#160389).
Comment 21 Mik Kersten CLA 2007-01-25 15:08:56 EST
Lubos: note that this isn't about the Planning section, but about a custom section that appears under the attributes if the Bugzilla repository has time tracking enabled.  You should be able to do something very similar for your custom attributes, and do things like your own range checking.  Look through the bugzilla editor for time tracking stuff to get an idea of how it deals with these special attributes.
Comment 22 Lubos Pochman CLA 2007-01-25 15:14:47 EST
I was bringing up planning section as an example of the widgets, yes I do mean using it in attributes section. But by adding support to RepositorTaskAttribute for number, date, ... it makes it much easier for connector developer to use them (you do not need to subclass and do it yourself).
Comment 23 Robert Elves CLA 2007-05-10 15:03:56 EDT
TaskData and offline refactoring scheduled for RC0
Comment 24 Steffen Pingel CLA 2008-03-30 04:58:27 EDT
Support for date pickers has been added as part of the editor refactoring for 3.0. I haven't added support for spinners or a data type that accepts a range of integer values, yet. It's not overly complicated but I am not sure how well spinners render on forms and if this needs to be part of the framework or is better contributed by connectors. Are there other connectors that would benefit from support for spinners to edit task attributes?
Comment 25 Steffen Pingel CLA 2008-04-12 23:44:17 EDT
I have removed the milestone for now. We can reconsider if there is indication that spinners should be provided as part of the standard attribute editor API.
Comment 26 Eclipse Webmaster CLA 2022-11-15 11:45:08 EST
Mylyn has been restructured, and our issue tracking has moved to GitHub [1].

We are closing ~14K Bugzilla issues to give the new team a fresh start. If you feel that this issue is still relevant, please create a new one on GitHub.

[1] https://github.com/orgs/eclipse-mylyn