Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Suggestion needed on UI fields editability


Clive_c wrote:

Hi Gurus,

I have a web application that persist some information. The information are displayed on the UI and the editability of the fields are dependent on certain condition/fields. Even the buttons are constraint by these conditions and fields.

Right now, these conditions/logic of determining if a field is editable or a button should be enable/disabled are encapsulated in a class. Is there anyway I can better manage them?

Appreciate responses from all.

Posted for user by Athen.

Your rating: None Average: 4 (1 vote)

Enums?

Clive, Interesting question. You could use an enum per field, listing the "functional" status of a field. The enum could contain a method like
public boolean isEditable() {...}
If the status of one or more other fields determines whether or not a field can be edited, you could use a state model for the set of fields and associate every state with a list of fields that can be edited. Fields that are not in that list are not editable by default.

Describe your problem.

Describe your problem.

Right now, these

Right now, these conditions/logic of determining if a field is editable or a button should be enable/disabled are encapsulated in a class.

interesting...

hm...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <p> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br /> <br> <strike>
  • Lines and paragraphs break automatically.
  • Use <!--pagebreak--> to create page breaks.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
Just checking to see if you're an actual person rather than a spammer. Sorry for the inconvenience.