Share data between views (ViewPart) Equinox - eclipse

got a little question here to Eclipse Plugins.
I have a java class which contains some data, e.g. a linkedlist and some other stuff.
I need this data in 2 views. In one view I want to display some of them, and the other view should show a list with the data. (this is my special case, but I ask the question generally).
So, how can I use this one class in both views? In "normal" java I'd would give a reference when I create the views, but as far as I know this is not possible in eclipse plugins.
My solution is, that the data-class is a singleton. But I don't like this solution, I think this only works in my case.
Hope you got the point :) Do anyone of you know a better solution?
(i'm new in eclipse plugins, there aren't good books or tutorials, aren't there?)

To answer the second question in your post... try this site out for basic tutorials about Eclipse plug-ins and RCP applications.
www.vogella.com/eclipse.html
This answer should help with the first question in your post.

In SWT, all views just show a presentation of the underlying business objects. So when you implement the list and the tree, they just need to have the identical object as input (e.g. when calling treeViewer.setInput(theSharedDataObject)).
Your data class doesn't need to be a singleton for that, you just have to point to the same instance of the data.

Related

Is my thinking about mvvm right?

I'm having a little bit of a hard time getting into mvvm. I'm writing a simple app, Notebook. I have one viewmodel, it's name is actually ViewModel. It has an ObservableCollection of Notes inside and methods to save and load those from Isolated Storage. My only Model is Note.cs, it implements INotifyPropertyChanged and I'm of course RaisingPropertyChanged.
I've also got two view, both of them are user controls. One to display list of notes and one to edit the one chosen from the list.
My questions are:
Where do I create an instance of my vievmodel?
How should I implement going from the page with list of notes to the page with detailed view after choosing one Note to edit? At the
moment I'm saving the index of Note in App.xaml.cs, going to the next page and setting
the DetailedView DataContext to the right Note in OnNavigatedTo, but
I don't think it's actually the perfect solution.
Where should I save my Notes? I guess Application_Closing in App.xaml.cs is the right place to do it, but I'd have to have my viewmodel as a global object there, is this the right approach?
Additional question:
I have to add possibility to group notes. I guess that class Group with dictionary (GroupName, howManyNotes) is going to be allright since I don't have to be able to for example write all notes from selected group. Do you think there's a better approach I should think about?
Thanks for respones,
MichaƂ.
I would suggest you take a look at Calibrun.Micro which is a great framework for MVVM. You can get some sample from the CodePlex.
I have used that in a bunch of Project, and will give you flexibility in case if your project grows in size.
Google for Caliburn.Micro sample and you will find a number of sample for all technologies like WPF, Silverlight, Windows Store, Windows Mobile.
Caliburn.Micro CodePlex

Best practices for designing GUI in GWT

I have recently started studying Google Web Toolkit. I have went through some walkthroughs, and I think I understand the basics and the idea. However, I have some questions on the overall architecture and design of the applications.
Let's start with the GUI. I want to build a "common" web application, where the user first sees a login page. After successful login, the user is redirected to some kind of index page and a menu is added. I created a new LoginComposite for the login page, and tried to design a nice looking HTML table using the GWT Designer. However, I find that really hard to do, as you cannot set any individual properties on the individual cells (TDs)? There's no way to specify colspan or rowspan, and I can't set any padding or margin on the cells themselves. In short, I know exactly how I would have written the HTML code, but I can't translate that to the designer. Is that just me?
Also, I am wondering about the best practice for code layout and design. I went through the StockWatcher tutorial, but that's really not a very realistic web application. For example, I would like to know how I should design different forms (should each be in a own class inheriting the Composite-class)? How should I switch between forms (for example, first a list view, then a form for editing a chosen item from the list, then a totally different page)? If I have one Composite for each page, and instantiate them when needed in my EntryPoint, would that mean that the client will download all the JavaScript for all those Composites at page load? Should I stick with only one HTML page, or should I have many?
These are questions not really covered by any GWT tutorial. If anyone know a good example of a "real" web application built using GWT, I would love to see it.
Thanks for your input!
There are a whole bunch of resources in Google IO talks. For example:
http://www.google.com/events/io/2011/sessions/high-performance-gwt-best-practices-for-writing-smaller-faster-apps.html
http://www.google.com/events/io/2011/sessions/highly-productive-gwt-rapid-development-with-app-engine-objectify-requestfactory-and-gwt-platform.html
http://www.google.com/events/io/2010/sessions/architecting-production-gwt.html
http://www.google.com/events/io/2010/sessions/architecting-performance-gwt.html
http://www.google.com/events/io/2010/sessions/gwt-ui-overhaul.html
http://www.google.com/events/io/2009/sessions/EffectiveGwt.html
Also, don't expect to be able to edit absolutely everything if you are using the GUI to build your GWT app. Good luck!

Using GWT MVP on a single screen application

I apologize in advance as this is one of those "how does this work" type questions. I am a newbie to GWT MVP and I am trying to create a project similar to this one here:
where basically I have a menu of widgets/components that I can drag and drop onto a panel and doing so changes the properties shown in the Property disclosurepanel.
I have been reading about the official GWT MVP framework and they its described it seems like it expects each application state to represented by a whole new page (a View with an associated Place).
I am confused as to how this would work this type of application. That is, an application that has 1 basic screen that never entirely changes (i.e. user never navigates to a whole new screen) with sections that need to communicate to each other (i.e. dropping a widget loads a different set of properties).
I am sure I am misunderstanding something about MVP so if someone can just offer some advice on how to wrap my brain around this that would be great.
It's not impossible to utilize the MVP paradigm with more than one on-screen regions.
You can read about a possible solution in this article. It's the last post of a four-part series. I suggest reading also the preceeding posts from the author with the same tags.

GWT Lazy Loading

I want to develop a GWT application. The application contains 8 modules and all the modules run in a single page.
I have links for all the 7 options on the top.
When the page loads I want only the home content to be loaded and displayed.
Only when the user clicks the menu options, the menu content should load.
Can anyone suggest the best way to achieve this.
This has been addressed in GWT 2.0... First you'll remove the separate entry points you have for each module - since they're all on the same page, you only need one entry point per page.
Then you can use the GWT.runAsync() method at each point that you feel can be a split... it automatically cuts up the code into chunks that are downloaded as and when necessary.
Look here for the docs.
AFAIK, lazily loaded (or pluggable) modules can't be done in GWT. Partly this is due to the way the GWT compiler works - it likes to import all the code that it is ever going to see and then optimises and prunes it as viciously as possible (to make the resulting JS files as small and lead as possible). If it doesn't have access to all the source code up front, it might make optimisations that will break the pluggable modules (especially since nothing in the "core" application may reference the classes that the lazily-loaded modules need to work properly - the GWT compiler would prune those "unused" classes in the core module).
This stackoverflow question from May 09 asks the same thing and has the same answer - it can't be done.
I searched high and low about six months ago for an answer to this problem, because I really wanted to do what I believe you're asking for. Never found a solution.
(I haven't used GWT 2.0 - it might have addressed the issue)
Thank you for your answer. You are right that the whole Javascript code gets downloaded.
But there must be a way like say on of module is View Profile. Only when the user clicks the view Profile link, the widgets related to displaying my profile needs to be created. is this not possible.

How to Choose which Xcode Template to Use?

what if i have ecommerce application?
like i have
1)sale page
2)list of product page(grid view and list view)
3)detail of product
4) zoom images for that product.
what kind of template should i use?
i refer this post but its not clear.
New iPhone App - How to Choose which Xcode Template to Use?
Thanks
If you have a hierarchy of views in which you go from general to specific information, then you want the navigation template.
However, most of the time, the templates are just starting points for learning. In most cases, you will have an app that is a combination so you start with the generic windows-based template and then flesh it out yourself.
If there is a similar application on the AppStore you may like to see how they have approached it, generally there is something similar that can help you clarify how you would like your application to function.
From the sounds of your application idea you would probably be best served by the Navigation template. But after all it is only a template, you can completely change the structure of the application later without needing to start another project.