Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mylyn-integrators] How to make an attribute hidden in Mylyn 3.0?

> You set the hidden attribute with in your TaskAttributes enumerated
> class that your class that Extends TaskAttributeMapper calls.   Take a
> look at the Trac TaskAttribute enum class for an example.  In the Mantis
> Connector for Mylyn, our enum entry was setup like the following:
>
> ADDITIONAL_INFO(Key.ADDITIONAL_INFO, "Additional Information:",
> TaskAttribute.TYPE_LONG_RICH_TEXT, true, false),

I agree that using an enum is a good pattern to define the static part of the 
task schema for a connector. The TracAttribute class is very similar to the 
one described by David. The only difference is that in TracAttribute the 
boolean parameters have been replaced by an enum called Flag, e.g.:

  REPORTER(Key.REPORTER, "Reporter:", TaskAttribute.USER_REPORTER,           
TaskAttribute.TYPE_PERSON, Flag.READ_ONLY),

I find that slightly easier to read. With the list of booleans I could never 
remember which one specified the hidden flag and which one was for the read 
only flag.

Whether an attribute is included in the attribute section of the task editor 
or not is determined by the kind flag in the attribute meta data:

 TaskAttribute attr = taskData.getRoot().createAttribute("attributeId");
 TaskAttributeMetaData metaData = attr.getMetaData();
 metaData.defaults();
 metaData.setKind(TaskAttribute.KIND_DEFAULT);

Currently KIND_DEFAULT is the only supported kind but in the future other 
kinds maybe added, e.g. KIND_PEOPLE for displaying additional attributes in 
the people section. Attributes that do not have a kind are "hidden".

The other thing that is important is to set a valid type:

 metaData.setType(TaskAttribute.TYPE_SHORT_TEXT);

The type determines the type of control that is used for editing (see 
AttributeEditorFactory). Default types that are supported by the framework 
are defined by the TaskAttribute.TYPE_* constants.

Steffen

-- 
Steffen Pingel - steffenp@xxxxxx - http://steffenpingel.de


Back to the top