Παρουσίαση με Ετικέτες

ASP.NET Dashboard Designer - XAF integration
20 Απριλίου 16 08:41 πμ | tolisss | 0 σχόλια   

DevExpress released in v15.2.9 an ASP.NET Dashboard Designer (Online Demo). Following eXpandFramework with v15.2.9.3 releases an update to the existing integration of the dashboard suite.

Windows

In the existing windows implementation the end user can use the UI to create a DashboardDefinition, assign a few Business object types as datasources and execute the Edit Dashboard action to run the Designer.

image

Web

Similarly the end user need to perform the same actions to run the ASP.NET dashboard designer and create dashboard over the existing  Business Object domain.

image

As you can see from the images above the eXpandFramework Dashboard module utilize security and syntax highlight editors integrations. The highlight for the win platform is done with the help of DevExpress XtraRichEdit control  and for the web with the help of ACE cloud9 editor.

For those of you interested in the XtraDashboardTester solution you can find and run the related Easytests for the module. Basically the ASP.NET dashboard designer implementation uses a DashboardDesignerPropertyEditor and a DashboardDesignerController.

As always your feedback/question are welcome in our forums.

Δημοσίευση στην κατηγορία: ,
Dashboard web integration module
05 Οκτωβρίου 13 06:10 μμ | tolisss | 0 σχόλια   

I am happy to announce web support for the module discussed in Dashboards in the real world – A Scotland strike! Big thanks to Stephen Manderson for this additional contribution!.

Installation
Drag & drop from the VS toolbox.

image

End Result

image

Please use eXpand forums for your feedback and questions!

p.s. : the module is released with eXpandFrameowork v13.1.7.6.

Δημοσίευση στην κατηγορία:
Dashboards in the real world – A Scotland strike!
22 Φεβρουαρίου 13 09:47 πμ | tolisss | 0 σχόλια   

The DevExpress Universal Subscription now includes an interactive data visualization Dashboard for Windows, the Web and Mobile devices. DevExpress Dashboard helps you deliver solutions that allow any enterprise to visually explore business trends using stunning and easily understood performance indicators.

If you are an XAF user, you already know that a framework such as XAF provides reusable building blocks to quickly build feature-rich business applications for Windows or the Web. In this post, I’ll discuss how Stephen Manderson, an XAF user from Scotland merged the capabilities of XAF and DevExpress Dashboard to create a new reusable XAF Dashboard module.

To best demo this Dashboard integration, we’ll use our XVideoRental RWA demo. The sample is available for your review at the bottom of this post. 

XAF users already know that dashboard support is part of the shipping product.  A few days ago I posted Visiting Dashboards where I discussed possible use case scenarios and extensions of the native implementation in order to deliver dashboard solutions to address real problems without writing any code!

Stephen Manderson was recently asked by a customer if it was possible for end users to create dashboards without going through IT to request changes and modifications to their system. The solution as you can imagine was the migration of the Dashboard Suite to his XAF application.

Stephen’s goals were simple.

  1. Create dashboards like any other BO at runtime.
  2. Pass any number of Target Persistent Object as data sources.
  3. Restrict access to dashboards based on Roles.

The DashboardDesigner

 

This step is really easy, we only need to drag this DashboardDesigner component into a simple empty windows form:

 

image

 

Displaying custom forms in XAF requires no special skills and is well documented: How do I show a custom window?

 

Create dashboards like any other BO at runtime

Working with XAF is straight forward. We have a DX component (DashboardDesigner) and we want to integrate it. Almost all our components are serializable and the DashboardDesigner is no exception. This means that we need a Persistent object to host the Xml for the layout and a collection of XAF BO Types that will be assigned as data sources.

To start we can use the following interface:

public interface IDashboardDefinition {

    int Index { get; set; }

    string Name { get; set; }

    Image Icon { get; set; }

    bool Active { get; set; }

    string Xml { get; set; }

    IList<ITypeWrapper> DashboardTypes { get; }

}

For the sake of simplicity I wont post the full implementation however you can grab it and follow its history in eXpand’s github repo or in the sample at the end of this post.

 

The Xml property along with the Designer’s LoadFromXml method can be used to load the Designer’s layout. So we need:

  1. To create a SimpleAction in a ViewController. We choose a ViewController instead of any other Controller simply because targeting a certain view and not the whole app.
  2. Then we configure the controller a bit further, to activate it only for BO that implements IDashboardDefinition.
  3. Finally we subscribe to SimpleAction’s Execute event, and we load the Windows form with the Dashboard designer component.

public class DashboardDesignerController : ViewController {

    readonly SimpleAction _dashboardEdit;

 

    public DashboardDesignerController() {

        _dashboardEdit = new SimpleAction(this, "DashboardEdit", PredefinedCategory.Edit);

        TargetObjectType = typeof(IDashboardDefinition);

        _dashboardEdit.Execute += dashboardEdit_Execute;

    }

 

    public SimpleAction DashboardEditAction {

        get { return _dashboardEdit; }

    }

 

    void dashboardEdit_Execute(object sender, SimpleActionExecuteEventArgs e) {

        using (var form = new DashboardDesignerForm()) {

            new XPObjectSpaceAwareControlInitializer(form, Application);

            form.LoadTemplate(View.CurrentObject as IDashboardDefinition);

            form.ShowDialog();

        }

    }

 

In the above snippet we chose to implement the LoadTemplate method in the DashboardDesignerForm because the Dashboard’s XML loading is not of XAF concern. This form is simply another separate windows based layer.

Visualizing our business data in the designer

The dashboard designer allows for us to see our XAF data and shape our dashboards in real time as shown:

 

image

 

This designer is similar to our Reports designer but does not offer support for dynamic members aliases. However we covered them in depth in Dynamic member aliases from Application Model.

 

Dashboards in action

 

To visualize our dashboards we have to:

  1. Dynamically populate the navigation menu items

    We want to extend XAF’s functionality therefore we need to find the responsible built-in controller. This leads to ShowNavigationItemController where we can subscribe to its events and populate the navigation items from DashboardDefinition persistent objects. A possible implementation can be found in sample in WinDashboardNavigationController.cs or you can follow its history online.

  2. Modify XAF’s security system to restrict access to dashboards based on Roles.

    Since we really care about making it easy for the business user, the sample is using a possible implementation as discussed in depth in User friendly way to add permissions.

  3. Display the dashboard’s using built-in DashboardViewer control.

    Here we easily can follow an SDK sample: How to show custom forms and controls in XAF (Example). In short we need to create and return a new DashboardViewer control by overriding the CreateControlCore method of a PropertyEditor. In case we want to access extra system info we may use a different class than a PropertyEditor as discussed in Implement Custom Property Editors

Our active dashboards are linked in the “Dashboards” navigation group; this can be renamed and reordered so all changes are reflected within this group. The end result in post’s sample looks like:

 

image

 

image

 

image

What’s next?

Stephen is already working in a State Machine designer plus an integration with XAF’s KPI module which gives dashboard its full power according to his words! Forgot to mention that a web version of Dashboards is coming soon!

Big thanks to Stephen Manderson for sharing this cool XAF implementation with us, I am sure this post/contribution will boost his spirit/cv/carrier a bit Winking smile , We welcome any of you that wants to share it’s cool XAF stuff with the rest of us. Feel free to use our Support Center for this or our community project.

Please do  not forget your feedback about what we discussed today.

Unit next time Happy XAF’ing as always!

Download XVideoRental sample here. The sample contains the following modification

  1. User friendly way to add permission migrated in Common.Win.General namespace.
  2. XVideorental references DynamicMemberAliases.Module from Domain Components+ Calculated properties + Application Model.
  3. XVideorental references ProvidedAssociation.Module from Modifying Business Objects using Attributes.
  4. XVideorental references eXpand’s/Stephen's Dashboard module.
Δημοσίευση στην κατηγορία: ,
Visiting dashboards
07 Νοεμβρίου 12 05:18 πμ | tolisss | 0 σχόλια   

DashboardView is a type of XAF View that is used to display several Views side-by-side. However XAF by default does not provide any connection between these Views. In this post, with the help of XAF model, we will discuss a few abstract connection mechanisms and possible uses of dashboards.

Cascading ListViews

In a dashboard, in order to connect the ListViews we need first to connect their models. This can be done using the following interfaces,

public interface IModelDashboardViewFilter : IModelNode {

 

    [DataSourceProperty("FilteredColumns")]

    IModelColumn FilteredColumn { get; set; }

 

    [DataSourceProperty("DataSourceViews")]

    IModelListView DataSourceView { get; set; }

}

[ModelAbstractClass]

public interface IModelDashboardViewItemEx : IModelDashboardViewItem {

    IModelDashboardViewFilter Filter { get; }

} 

and then extend XAF’s model, see also our documentation on extending the model

public void ExtendModelInterfaces(ModelInterfaceExtenders extenders) {

    extenders.Add<IModelDashboardViewItem, IModelDashboardViewItemEx>();

}

This design allows us to use Model Editor to connect our views. In the following image we see that the selected objects of the Customer_ListView_Calendar are going to filter the Calendar list view on the Receipt.Customer field.

image

Next we see this dashboard view in action, a SchedulerListEditor on the right is filtered by a GridListEditor,

image

Following we see this technic applied to 3 ListViews. The selected pie section of the left View filters the pivot which in its turn filters a LayoutListEditor!

image

Cascading views are as well useful for filtering reports, so by selecting objects on the left View we create a report on the right view and everything is inside a Tabbed MDI environment!

image

Of course we haven’ wrote the code yet but this is the easy part. XAF’s API is so rich and so well designed that is like we speak our native language! The great thing when XAFing is that our code is fully reusable from any project since it has no knowledge of our domain objects.

Let try to form our requirement in English first:
For each ListView in a Dashboard we need to filter another View when the selection is changed

And now in XAF language Smile:

protected override void OnViewControlsCreated() {

    base.OnViewControlsCreated();

    foreach (var result in View.Items.OfType<DashboardViewItem>()) {

        var frame1 = result.Frame;

        if (frame1 != null && frame1.View is ListView) {

            var listView = ((ListView)frame1.View);

            DashboardViewItem result1 = result;

            listView.SelectionChanged += (sender, args) => OnSelectionChanged(new SelectionChangedArgs(listView, result1));

        }

    }

void OnSelectionChanged(SelectionChangedArgs selectionChangedArgs) {

    var dataSourceListView = DataSourceListView((IModelListView)selectionChangedArgs.DashboardViewItemModel.View);

    if (dataSourceListView != null) {

        var dashboardViewItems = View.Items.OfType<DashboardViewItem>();

        foreach (var dashboardViewItem in dashboardViewItems) {

            var modelDashboardViewItemEx = (IModelDashboardViewItemEx)dashboardViewItem.GetModel(View);

            FilteredListView(dataSourceListView, dashboardViewItem, modelDashboardViewItemEx);

        }

    }

Controlling DashboardViewItem visibility

Cascading views are really powerful and soon we will have the need to hide an intermediate view in the chain but being able to filter other views upon it. Therefore we need to add a Visibility property in our model and handle it from our code.

public interface IModelDashboardViewItemEx : IModelDashboardViewItem {

    [DefaultValue(ViewItemVisibility.Show)]

    ViewItemVisibility Visibility { get; set; }

and in a reusable from all projects controller implement the required logic.

protected override void OnActivated() {

    base.OnActivated();

    ((ISupportAppearanceCustomization)View.LayoutManager).CustomizeAppearance += LayoutManagerOnCustomizeAppearance;

 

}

void LayoutManagerOnCustomizeAppearance(object sender, CustomizeAppearanceEventArgs customizeAppearanceEventArgs) {

    var modelDashboardViewItem = View.Model.Items.OfType<IModelDashboardViewItemEx>().FirstOrDefault(item => item.Id == customizeAppearanceEventArgs.Name);

    if (modelDashboardViewItem != null)

        ((IAppearanceVisibility)customizeAppearanceEventArgs.Item).Visibility = modelDashboardViewItem.Visibility;

}

Displaying HTML Messages

A DashboardView does not have direct dependency with our domain objects. Therefore we can easily use it, even at runtime, to display static text view items and other controls (ControlDetailItem) or images (StaticImage).

image

XAF has great support for HTML Formatting so a Static Text like “<u><b>Hello</b></u>” will render the following:

image

Simulating View inheritance

XAF does not support View inheritance however we can extend our model and support it. Lets take the case that we have a very complex listview and we want to display it in both in MasterDetail and ListViewOnly modes without the need to support two View versions. For this we have to extend again the model, this time by a MasterDetailMode property and implement the logic in a ViewController.

[ModelAbstractClass]

public interface IModelDashboardViewItemEx : IModelDashboardViewItem {

    MasterDetailMode? MasterDetailMode { get; set; }

public class DashboardInteractionController : ViewController<DashboardView>, IModelExtender {

    protected override void OnViewControlsCreated() {

        base.OnViewControlsCreated();

        ResetMasterDetailModes();

    }

    void ResetMasterDetailModes() {

        foreach (var masterDetailMode in _masterDetailModes) {

            masterDetailMode.Key.MasterDetailMode = masterDetailMode.Value;

        }

        _masterDetailModes.Clear();

    }

 

    protected override void OnActivated() {

        base.OnActivated();

        foreach (var item in View.GetItems<DashboardViewItem>().Select(item => item.GetModel(View)).OfType<IModelDashboardViewItemEx>()) {

            AssignMasterDetailModes(item);

        }

    }

 

    void AssignMasterDetailModes(IModelDashboardViewItemEx modelDashboardViewItem) {

        if (modelDashboardViewItem.MasterDetailMode.HasValue) {

            var modelListView = modelDashboardViewItem.View as IModelListView;

            if (modelListView != null) {

                _masterDetailModes.Add(modelListView, modelListView.MasterDetailMode);

                modelListView.MasterDetailMode = modelDashboardViewItem.MasterDetailMode.Value;

            }

        }

    }

Since XAF has a great modularization system the core classes/implementations of the above ideas are included in this zip file. However we will not update the contents of the zip file. For locating up to date versions each file in the zip has an OnlineRepoLocation attribute that points to eXpandFramework’s Github repository.

This post adds a few more tools in our development library that can leverage the XAF power using the Model. When we “model” there are three basic advantages:

  1. We can use these model tools at runtime. For this XAF already provides a runtime time Model Editor.
  2. We create robust unbreakable code and since we model instead of developing we mostly have no bugs only wrong configuration!
  3. Implementations are reusable from all our projects!

Next post we will boost our R&D times even further and discuss a bit about Security system policies.

P.S.: We are preparing detailed samples demonstrating all the above ideas Smile, stay tuned!

If some of you have invented similar ways to connect your dashboards. You can use our support center and share them with the rest of the community.

Happy XAFing!


Δημοσίευση στην κατηγορία: ,

Search

Go

Το Ιστολόγιο

Ιστορικό Δημοσιεύσεων

Συνδρομές