Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jgoodies.binding.tutorial
Class AlbumPresentationModel  view AlbumPresentationModel download AlbumPresentationModel.java

java.lang.Object
  extended byPresentationModel
      extended bycom.jgoodies.binding.tutorial.AlbumPresentationModel

public final class AlbumPresentationModel
extends PresentationModel

In addition to its superclass this class provides a bound read-only property composerEnabled that is true if and only if the underlying Album is non-null and classical. This property is intended to be used by a variety of presentation properties, not just a component's enabled state. You can enable or disable a composer presentation, or switch a composer field's editable property, or to hide and show a larger composer editor section.

I've added the composerEnabled property primarily for learning and demonstration purposes. And I wanted to closely follow the example used in Martin Fowler's description of the Presentation Model pattern. This example shows how "raw" domain object properties can be aggregated or filtered by the presentation model layer for use in the presentation layer.

You may decide to observe the domain property classical directly. And switch to an aggregated property like composerEnabled if the boolean logic behind it becomes more complex. Also note that a UI that buffers the classical property cannot use composerEnabled but would require an separate bufferedComposerEnbled aggregation.

Version:
$Revision: 1.4 $

Nested Class Summary
private  class AlbumPresentationModel.AlbumClassicalChangeHandler
           
 
Field Summary
static java.lang.String PROPERTYNAME_COMPOSER_ENABLED
          The name of the bound read-only property that indicates that a presentation for the composer property should be enabled/disabled, editable/not editable, or visible/hidden.
 
Constructor Summary
AlbumPresentationModel(Album album)
          Constructs an AlbumPresentationModel for the given Album.
 
Method Summary
private  void initEventHandling()
          Registers a listener that is notified about changes in the classical property of the current Album or a new Album.
 boolean isComposerEnabled()
          Checks and answers if the underlying Album is non-null and classical.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTYNAME_COMPOSER_ENABLED

public static final java.lang.String PROPERTYNAME_COMPOSER_ENABLED
The name of the bound read-only property that indicates that a presentation for the composer property should be enabled/disabled, editable/not editable, or visible/hidden.

See Also:
isComposerEnabled() 55 , Constant Field Values
Constructor Detail

AlbumPresentationModel

public AlbumPresentationModel(Album album)
Constructs an AlbumPresentationModel for the given Album.

Method Detail

initEventHandling

private void initEventHandling()
Registers a listener that is notified about changes in the classical property of the current Album or a new Album.


isComposerEnabled

public boolean isComposerEnabled()
Checks and answers if the underlying Album is non-null and classical. This property is intened to be used with a variety of presentation styles that indicate that a composer is absent and cannot be edited. For example a presentations may choose to switch the view's enablement or the editable state, or it may hide or show a field or editor section..