How to view updated data on one property page updated by another property page without closing the properties in eclipse plugin? - eclipse

I am facing a strange issue!!
I have a set of property page with same storage file.
The scenario is as follow..
For the first time opening the properties by right clicking on the project, list of property pages are viewed. I click on the first property page and make changes then apply the changes to the file.
Now I select the second page, it shows the changes that were applied from the first page.
But now without closing the properties i go back to first page and make changes then apply the changes.
Then again I go to second page it wont show the updated data. The changes that were applied are not viewed until I close the properties and reopen then by right clicking on the project.
My question is
"Is there any way to reflect changes on the pages without closing the properties??"
I appreciate your valuable time you will give for reading and replying..
Plz help

Your problem seems to just absent of reliable model which can notify problem.
If the properties are related IProject.
You should use ScopedPreferenceStore as model.
IScopeContenxt scope = new ProjectScope(myProject);
IPreferenceStore store =
new ScopedPreferenceStore(scope, "myProperties(qualifier)");
IPreferenceStore can manipulate primitive data, default value. And it support property change event. You can create multiple instances of IPreferenceStore, If they have same scope and qualifier then automatically synchronized. So individual page can retrive input model without coupling.

Related

gwt - history - how to "keep" UI state

I tried the example which is showing how to get data from history to re-generate UI; The thing I see mostly in all "history usage" examples are related to UI re-generation only so it is none-static way...
But what about "each UI state may have its unique url something like JSF does with flows"? For example I have app url like a
http://localhost:8080/myapp/MyApp.html
the app default UI contains main menu which is helping to navigate through my test catalog; I tried to make possible keep the UI dynamics in history by building url in this way
http://localhost:8080/myapp/MyApp.html#menu_testcategory_page1
but when I click internet browser "refresh" button the url keeps the same as http://localhost:8080/myapp/MyApp.html#menu_testcategory_page1 but the UI comes back to its default state :(
So my question is
is there an optimal way in pure gwt to stay in the same UI state even after browser's refresh button is clicked (I mean the unload/load window events occur)?
thanks
P.S. gwt 2.3
You should implement Activities and Places pattern: http://www.gwtproject.org/doc/latest/DevGuideMvpActivitiesAndPlaces.html
I am using it for 3 years, and it works very well.
Note, however, that when you reload a page, you lose all of your state, data, etc. If you need to preserve some of it, you can use a combination of a Place (#page1) and a token that tells the corresponding Activity the state of the View representing this Place, i.e. (#page1:item=5).
You probably just forgot to call
History.fireCurrentHistoryState();
from your entry point.

Wicket DefaultDataTable - Refresh it on browser back button

In my application I am using DefaultDataTable with SortableDataProvider which has LoadableDetachableModel as the model.
I used it to display a set of records ( say RecordList page). When I add or remove some records and load the page RecordList again, it displays the changes. However, if I use the back button of the browser and go the RecordList page which was rentered earlier ( before adding/ removing the records ). The DefaultDataTable still has the old sets of records. This is a big issue when records are deleted.
For example, If I delete a record and press back button then the page fails as the record it is trying to show does not exist in the database. Adding does not create an issue because it simply does not get listed in the set of records.
In another page, I just have PageableListView with LoadableDetachableModel. It works fine with out an issue.
There are one or two things that you can do about this.
First please check whether the data provider has the latest data.
Secondly make sure that the set of records with the Data provider is refreshed when the browser back button is hit. Ensure that the data fed to the Data Provider is refreshed in a method other than constructor. Because constructors will not be called when you hit back. So you would need to use a separate method. Ideally you could use the same method, but called from both constructor and when back button is pressed.

overriding setResponsePage() to build breadcrumb

I 'm trying to build my own simple breadcrumb component that pushes a PageRefence onto a List for each and every Link in the application.
Unfortunately, setResponsePage() is final (I use wicket 6).
The only other option that comes to my mind is to add a parameter to my base page constructor. But this would require me to change every link in the app..
Are there any other options?
Since you already have a base page, it's easier to override onBeforeRender() in your base page to update the breadcrumbs list that you'd store in your Session object.
Or am I missing something?
To answer my own question:
In the end I realized, that I do not want to have the breadcrumb updated on each new page.
Therefore I created an object that holds a List of Pagereferences. When I navigate to a new Page, I take the list of the current page, make a copy of it an add the current page. The resulting list is pased onto the new page.
All this is handeld in the base page.
Keeping it in the page, avoids problems with multiple tabs / windows.
Thanks for the help.

GWT Place objects

I'm new to GWT so this may be a dumb question but I didn't find a good answer to it anywhere.
So, how should I create Place objects in GWT? Should I create them as finals in my ClientFactory and reuse them everywhere?
the Place objects Eclipse generates eat a string token as their parameter what should it be?
My Understanding is the following: I should create final Place objects in my ValueChangeHandler for those pages that are static and reuse them everywhere. Those 'Place's that are relatively dynamic should be created like
new MyCoolPlace("MyCoolPlace" + someRandomNumber)
but isn't it kind of dumb using random numbers each time i need to navigate to a new page? also will the history be cleared of the objects which i created say hours ago?
Currently I have a problem with figuring out how this mechanism works:
I have a form. For, say, adding vegetables to the DB
1. User fills it
2. Submits it
3. Gets to a thank you page
4. Clicks a link in the menu to add a new vegetable
5. Gets to the form but it's already pre-filled with the values user previously entered.
I need the form clean on step 5. But if the user clicks the browser's back button on step 3 I want it to be pre-filled.
Question about final:
I think not. They are lightweight objects and places can have values into them. They are not a limited set of places values (at least if you parametrize them).
Question about form values:
The normal behaviour is when yo go back to -let's say- "vegForm" you obtain the clean view (it's because your URL token is simple vegForm). What happens I think it's you're reusing your view without initializing. Your presenter (or whatever has the UI logic) should obtain the view and call "reset()" "init()" or whatever you want.
If you want to hold your values when you go back you should save them in your place object. It is: field values. And your PlaceTokenizer (the object that transform between URL and Place object) should take care of them. By example: vegForm/potato,green,... (don't remember the standard notation).
The problem is how do you save into the URL the values you entered before clicking Save?
What I'd do is "saving" that state into the URL before saving:
History.newItem("vegForm/potato,green,...", false);
And that will get into the history stack. When I say false it means that the GWT History mechanism should not react to that URL avoiding loading the view again. When your user clicks back she should go back to form(with values). If your user clicks back again the she should go back to form(clean).
By example:
User clicks add veg -> #vegForm
User fills data and pless save
-> #vegForm/value1,value2 (saved in History with false argument)
-> #okPage
User clicks back
-> #vegForm/value1,value2 (form with saved data)
User clicks back
-> #vegForm (form without)
Initialization
Take into account you always must initialize the view.
If you don't have params, to clean it (it can be a reused view)
If you have params, to fill the form with them

WorkflowView force refresh when new child Activity is added

My application is using workflow designer rehosting to let end-users develop workflows. I have an Activity available that requires the user set some state. To accomplish this, in the designer I override Initialize(Activity) and show a form which I then use to set values in my Activity. This is for setting the state when the Activity is initially added. I also have a double click event handler in the designer in case they need to edit that state later.
I now have a situation where, depending on the values in the form, I may need to add or remove a child activity. I've been successful in adding the activity, but not always in getting it to show up in the designer.
When Initialize is called, there are no child activities. I may need to add a child Activity. At this point, it works fine and shows up in the designer. The problem happens when they edit it later by double clicking. In my designer, I override OnActivityChanged to detect this. I make the same call to add a child, however the designer is not getting updated. Oddly enough, when the situation is such that the child is removed, the view updates fine.
Stepping through with the debugger shows that I am adding a child activity to the Activities collection. Normally when I have problems updating the view, I can make a call to IComponentChangeService.OnComponentChanged, but I can't seem to find a way to make this work.
Any suggestions?
It looks like I needed to use RemoveActivities and InsertActivities in the designer. It seems as if the designer doesn't listen to list change events on the Activities list. Does anyone know if this is how it's supposed to work?
Have you tried this in your OnActivityChanged event handler?
TypeDescriptor.Refresh(e.Activity);
For my situation, I determined I needed to use RemoveActivities and InsertActivities.