ICE Push not working for me.

Hi

I am facing problem in integrating ICE PUsh in my application. I would like to go for it due to issues in Table which not reflecting the underlying the data(Domain object updating it and UI not reflectin the changes.

Please find below the steps what i did for the integration and correct me if i am wrong.

  1. Put the jar in WEB-INF/lib folder
  2. Created Instance in class which extended Application.

public class ComplexityEstimationApplication extends Application {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private User user=null;
	private ICEPush pusher; 

	public void init() {
		Window mainWindow = new ComplexityEstimationMainWindow(this);
		setMainWindow(mainWindow);
		mainWindow.setApplication(this);
		pusher=new ICEPush();
		setTheme("turbopettheme");
		getUser();
	}
	public ICEPush getICEPush()
	{
		return pusher;
	}
  1. I need to call the push from TAB. Data needs to be refreshed for the table. From here, i dont know, how to call application object inside my tab. Right now, i did below thing.

public class EstimateTabSheet extends VerticalLayout implements
	a) 	Button.ClickListener, Save {
	Project project;
	ComplexityEstimationApplication application;

b) Passing to constructor of Tabbed Component


public EstimateTabSheet(ComplexityEstimationApplication application,Project project, ModelConfig modelConfig, int flag) {

}

c) Inside i have one button and inwhich i am passing the application object.


public void buttonClick(ClickEvent event) {
if (event.getButton().equals(test)) {
				test(this.application);
}

d) inside test method i am calling the push


public void test(ComplexityEstimationApplication application) {
		ProjectDelegate projectDelegate = (ProjectDelegate) BeanFactory
				.getInstance().getBean("projectDelegate");
		try {
			projectDelegate.calculate(project);
			application.getICEPush().push();
			
			

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

and i am getting the below exceptions

java.lang.RuntimeException: Must be attached to an application to push
at org.vaadin.artur.icepush.ICEPush.push(ICEPush.java:55)
at com.honeywell.htt.turbopet.ui.estimate.EstimateTabSheet.test(EstimateTabSheet.java:260)
at com.honeywell.htt.turbopet.ui.estimate.EstimateTabSheet.buttonClick(EstimateTabSheet.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)

Please correct me where i am wrong and share correct steps for doing this. Thanks in adv for your help on this.

I don’t see where you are adding the pusher as a component of your main window.

It is our main component(EstimateTabSheet ) and inwhich i need to invoke push(). Basically my question is, i am initializing it correctly in application startup(Class which extends in application). I dont know how to call it in inside some component. i need to call getICEPush() method from my component. I dont know how to do that.

If it is not make sense, let me know. i will share further details if required.

public class EstimateTabSheet extends VerticalLayout implements Button.ClickListener, Save { Project project; ComplexityEstimationApplication application;

public EstimateTabSheet(ComplexityEstimationApplication application,Project project, ModelConfig modelConfig, int flag) {
this.application=application;
}

public void buttonClick(ClickEvent event) {
// TODO Auto-generated method stub

		if (event.getButton().equals(save)) {
			save();
			saveProject(event);
		} else if (event.getButton().equals(submit)) {
			submitProject(event);
		} else if (event.getButton().equals(revert)) {
			revertProject(event);
		} else if (event.getButton().equals(reset)) {
			resetProject();
		} else if (event.getButton().equals(test)) {
		[b]
test(this.application);

[/b]

	}

public void test(ComplexityEstimationApplication application) {
ProjectDelegate projectDelegate = (ProjectDelegate) BeanFactory
.getInstance().getBean(“projectDelegate”);
try {
projectDelegate.calculate(project);
//application.getICEPush().push();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

Look at line 22 in the demo in the source (
click here
)

The pusher needs to be added as a component to your main window. When you call push (no matter where you do it), it is that component, located in the top-level window of your application, that will process things and make sure the client code fetches all the outstanding updates you just pushed.

If you don’t add the pusher as a component, or if it gets detached, you will get the message you describe (“not attached”).