A newbie question on cairngorm - apache-flex

I am very new to Flex (started learning a couple of days back), I now have some understanding on how to create user interfaces with Flex and how to do MVC with Cairngorm and I really started liking it. But I am still lost with changing views using Cairngorm or entirely in Flex. Being a Java/J2EE developer for more than 10 years, it helps me understanding new technologies comparing it with Java. Typically in java world or in any MVC framework, the controller once got the updated modal it redirects or sets the new view to the user. Lets say once I added a new movie to movie database, I want to show the user a view Movie screen and when he deletes a movie I want to take user to list of all movies. The example which I have seen so far(including the diagram explorer) are just changing the modal values and the data is updating in the same view (using [Bindable]), but my question is how to change the view depending on the result or if it's a fault I want to take user to a different screen. How to do that in flex and in Cairngorm. Are there any best practices available and somebody please point me to right direction/resource. Thanks in advance.

The usual way to do this with Cairngorm is to put the data about the state of the application (eg. the screen the user is on) in the model too. You can, for example, use the ViewStack as the main container of the different parts of your application and bind it's selectedIndex to a variable in the model which will be used to control the screen that is displayed to the user. Putting it shortly - the state of the application is a reflection of the model.

You may also want to take a look at the Mate framework. We recently switched to Mate after using Cairngorm because we found it was a much easier framework to use and understand.
For your example, you would have a faultHandler event listener that would call whatever method you wanted in your model. You could easily use that to show or hide whatever you needed to.

Related

Sending a model for use throughout all views linked from a layout

I am working on a web service built on ASP.NET MVC 4 and have run into some trouble figuring out how to manage a model after log in so that it is widely available to all action functions created in the back end.
For example) Let's say I have built a service that allows a user to log in and manage multiple databases. After he logs in he is redirected to a view that allows him to pick which database he would like to manage, which inherits the old layout. After he clicks on the database he wants to manage, the model of this database is passed to the index view of a manage controller which utilizes a different layout than before. All of the managing action links are coded in the layout but the model was passed to the index page. He needs the model to be available for all the ActionResults in the managing controller, but a model can't be passed to a layout, so this is where I'm stuck.
Does anyone know of any good references or guides on how I can utilize a model throughout a whole layout? Or something a long these lines? I'm not sure the technique I used for this problem was the best but I don't know how else to go about this. If anyone knows a better technique of going about this please let me know.
Thank you!

Flash Builder Data Passing between Split Views

I have a SplitViewNavigator with two split views. In one of the views I have a list and in another one I have questions. User must solve the question and when user click send button, he will see another question.
But when user click to send button in one view, how can i know this in the other view? I'm a newbie in Flash Builder and I'm searching for this for hours.
Thanks for any help
There are many ways to do this. One is through the view using bubbling events, but that way is not recommended since you're not mixing business level behaviour with UI behaviour. I would recommend that you look at application frameworks for Flex, like RobotLegs or Parsley which definitely does stuff like this very easily.

should I move from caliburn to caliburn.micro

I'm developing an infrastructure for a major project currently based on caliburn 1.
It works fine but it seems like the future is in caliburn micro, am I right?
If I do, how do I implement filters? How do I specify view to a view viewnodel (non conventional)?
And whats the best place to put my splash logic (not root model)
I recommend moving to Caliburn.Micro as it's simpler and easier to extend. It is where any future innovations will be made and it has a larger more active community. As far as filters go, you can actually build them and plug them in. See here Marco's post You can add non-conventional view specification as well. You just plug into the view locator and teach it how to find views. For example, if you want to use an attribute, you can just have the locator look for that attribute first, use it if found, otherwise fall back to the default behavior. Regarding splash logic, you can do that by customizing the Bootstrapper.

.NET Grid using paging - search and scroll to result

I have an ASP .NET web application. I'm fairly new to .Net but a longtime SQL and Java programmer. I have a requirement to implement a search feature as it is currently implemented in the legacy application. There is a pageable grid of data displayed and a search box. You type your search criteria and the grid pages to the first match. A "next match" button pages to the next item etc. This way the user sees where their search item falls in the hierarchy of the data. I have seen examples where the search criteria filters the data, limiting the data results. This is not what I need.
Can someone please point me in the right direction for this? Is it possible with .NET?
I have some crazy custom ideas but I don't want to reinvent the wheel.
Edit - To clarify, is there an existing .Net control or functionality that does this?
You said this was an existing application and that you normally write Java, so I would presume the existing app is written in Java. Java and C# are very similar, so you could almost write the one side by side from the other.
As for the logic of how to do this, how does the existing app do it? Why reinvent the wheel? You've only been asked to recode the logic into a new platform. Don't give up the years of experience the existing solution provides.

Having a UI layer and presentation layer

Let's say I'm on a list page and I
page to, say, page 10. Then I select
a record on that page and redirect to detail
page. After that, I click on the edit
to redirect to the edit page.
After I update the record I'm redirected back to
the detail page. I, then, press back
to go back list to continue my browsing from
where I left off. The key here is
where I left off in the list which is
page 10.
What is the best way to handle this?
Initially, I put a hidden field called page number in each of the webforms and pass it along with the querystring back and forth. Seemed like a lot or a bit redundant checking the querystring on each page and passing it.
I was wondering if there are some other ways. for instance, I've been reading about a separation between the UI and the presentation layer is a good idea (for larger scale apps). To me I understand it as all click handler events will yield control over to the presentation layer which is just a plain class?
Is this correct? Also, is the presentation layer suppose to implement something particular? I know this could probably be saved in session but could someone humor me and show me how to use a presentation layer to handle this (I know it would be overkill but is it possible?)
I don't think there is THE best way. Everything depends of what you achieve to do, ie. the requirements of the whole project.
After all, according to the description, I don't even understand why are you having three pages to do a single thing. By the way, ASP.NET data controls handle mostly everything for you, so you don't even have to ask yourself how to do this (except if you have serious reasons to avoid ASP.NET controls).
For example, a simple <asp:ListView /> will let you list items page per page and show details when a single item is selected. Edition of an element is also quite easy.
What you are asking for is well... large and could span multiple blog posts to give a complete understanding of UI Design Patterns.
I have a small example of MVP with Asp.Net here: What is the best way to reuse pages from one website in another?
However, it is not exhaustive. If you really want information on this you should do some looking into a framework such as WebForms MVP, or ASP.Net MVC.
Check out ASP.NET MVC. It is a framework which goes on top of ASP.NET to do the separation between the presentation layer and business layer.
For simplicity, what you are describing is a very good example of the perfect place to use Asp.Net Dynamic Data.
It's incredibly easy and powerful, and easy to modify once you dig into it a bit. I'd start with the videos here: http://www.asp.net/dynamicdata
I've been using this more and more on every project, for at least the simple CRUD portion of it. I really can't express how much I love this tool now that I'm used to it.

Resources