I have created some custom subclasses of MADescription. When
these descriptions through a web-based web description editor via
aDescription asComponent, there are just too many attributes in the
form for my users to handle. How would I go about showing only a few
attributes like, say Label, Options, and Required as opposed to
showing everything including StringReader StringWriter, etc?
Yep, for end users the descriptions usually have to be filtered to
the most basic properties. This is a copy of the code I used in some
commercial application a few years ago (I just say that because today
there are many more attributes nowadays, so you probably need to add
some more selectors to #rejectedDescriptionFields).
What the following code does is to remove some descriptions from the
description to be edited. Moreover it makes the label to be required.
buildEditor: aDescription title: aString
| desc |
desc := aDescription description reject: [ :each |
includes: each accessor selector ].
desc := desc collect: [ :each |
(each accessor selector = #label)
ifTrue: [ each copy beRequired ]
ifFalse: [ each ] ].
^ (desc asComponentOn: aDescription)
^ #( priority visible readonly persistent nilLabel )
Hope this helps,