0

I have created a dashboard that is Singleton. But I want to refresh(reload the default values) it every time a button is clicked. What could be best possible way to achieve this?

Code for the class:

public class UserDashboard extends Composite{ private static UserDashboard userDash= new UserDashboard(); private UserDashboard(){ initWidget(uiBinder.createAndBindUi(this)); } public static UserDashboard getDashInstance(){ return userDash; }} 
2
  • 2
    What do you mean by refresh? Commented Apr 21, 2015 at 9:29
  • @DarshanLila reload the default content. Commented Apr 21, 2015 at 9:31

1 Answer 1

2

Just add a method which refreshes the singleton instance without recreating it.
You can put any meaning into refreshes (whatever appropriate).

Sign up to request clarification or add additional context in comments.

3 Comments

then i need to explicitly set all the values to the default? there are lot many classes running on top of this class. Can't go on setting their values to default.
@Forkmohit "then i need to explicitly set all the values to the default" >>> What do you suggest instead?
posted this question for suggestions only.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.