SmartDesign instead of standard View generating algorithm

Problem definition

Complex applications often deal with complex objects containing dozens and hundreds of properties and including up to several dozen collections. To customize one or more Views able to display such objects, XAF provides a useful solution: the default Views. However, this solution is partial and cannot match extra requirements that often appear within enterprise systems for the next reasons:

  • XAF View generator places all available fields on the View (including the hidden ones), leading to overcomplication of that View and larger system requirements;
  • Sometimes, the application requires a View layout strategy that differs from the XAF default one.

advices_7

advices_8

Solution

Xafari provides the SmartDesign module to implement the following features:

  • An own View layout strategy that creates empty forms (opposite to XAF generator);
  • Such strategy supports defining Views of particular default design in the code and creating new Views;
  • Allows implementing and using custom strategies (it is possible to use several ones simultaneously);
  • The strategy used on a View can be defined as a default one for different layers: a class, an assembly, or the application as a whole.

The following example from Xafari.FeatureCenter demonstrates how to implement a View based on the SmartDesign strategy:

  • c#
  • VB

[CreateListView(Layout = "Byte;Decimal;Double;Float", IsDefaultTreeListView = true)]
[CreateListView(Id = "XafariSmartDesignGeneratorObject_Code1_LookupListView", Layout = "Integer;Long;String", ListViewType = ListViewType.LookupListView)]
[CreateDetailView(Layout = "String;Integer;Double;GroupByte[Byte,Byte,Byte];GroupDecimal[Decimal,Decimal,Decimal];GroupFloat[Float,Float,Float];Objects")]
public class XafarSmartDesignObject : ObjectBase
{
}

<CreateListView(Layout := "Byte;Decimal;Double;Float", IsDefaultTreeListView := True)> _
<CreateListView(Id := "XafariSmartDesignGeneratorObject_Code1_LookupListView", Layout := "Integer;Long;String", ListViewType := ListViewType.LookupListView)> _
<CreateDetailView(Layout := "String;Integer;Double;GroupByte[Byte,Byte,Byte];GroupDecimal[Decimal,Decimal,Decimal];GroupFloat[Float,Float,Float];Objects")> _
Public Class XafarSmartDesignObject
  Inherits ObjectBase
End Class

advices_9

More info on the SmartDesign module can be found in the SmartDesign section.

Effects of using

  • Increasing UI performance;
  • Memory usage optimization.