Vaadin + Eclipse Visual Editor NOT reloading/updating Composite components - eclipse

I created a Vaadin Project, then wanted to create a Custom composite and display that as my main window (so i could take advantage of the Visual UI editor). Working with Tomcat Apache Server and the Visual Editor has been a pain! Nothing updates even when i start, stop or restart the server. My mainWindow application will display some Vaadin components and not others. Here is an example i have of my main window code
import com.vaadin.Application;
import com.vaadin.ui.*;
public class DApplication extends Application {
#Override
public void init() {
Window mainWindow = new Window("DApplication");
//Header header = new Header();
//header.setSizeFull();
DHome dHome = new DHome(); // **HERE IS THE COMPOSITE INSTANCE I CREATED IN ECLIPSE**
dHome.setSizeFull();
mainWindow.getContent().setSizeFull();
mainWindow.addComponent(dHome);
setMainWindow(mainWindow);
}
}
Is this a bug or a problem with others using these same tool for making vaadin applications. My application even if i shut off my machine wont update with newly components added to the composite?

When you open the URL for the application, it creates a new user session. The session is preserved even if you reload the page. However, if you use Eclipse, it likes to do hot deployment to Tomcat and you may experience a problem that the application does not return to its initial state after you modify code. As Tomcat likes to persist sessions on server shutdown, the application state can remain even if you restart the server.
Adding the ?restartApplication parameter in the URL tells the Vaadin servlet to create a new Application instance on loading the page. If you also include a URI fragment, the parameter should be given before the fragment.

Related

how to load java class in GWT which is added at run time

What I am trying to do is giving user option to upload a GWT composite
As user upload a java class (which is some layout with GWT widgets) , Our application will displays that layout.
lets says its LoginPageView.java class .
Now what i do is , After uploading I place the class in some Client package, so the class is now com.test.client.LoginPageView.java
Now to open this class and show the layout , I have to do
LoginPageView loginView = new LoginPageView();
RootPanel().get().add(loginView );
and it will display the uploaded layout.
But I dont know the name of the class as it was added at run time , so the loading of the class will be at run time, But how will that be possible at CLIENT side.
Is there any way .
thanks
GWT compiles Java code into JavaScript. This happens before the app is deployed. A user's browser reads the JavaScript file from the server and executes it.
Now, if a user supplies you with a new LoginPage Java class, you need to copy this class into your project in Eclipse (for example), run GWT compiler to create all new permutations, deploy the new code to the server, and ask your user to load the app again.
If a second user gives you a different LoginPage class, you will have to create a different version of your app just for this user, or add both LoginPage classes to your project, and somehow decide which of them to serve to each user. This is possible but the size of your project will keep growing with each new custom class that you add to it.

Eclipse RCP SourceProvider listening for changes

I have a source provider that helps to provide state for enabling buttons and menu items. The enabling part is working correctly. My challenge is how to get the source provider called when various editors / views are activated.
I have implemented IPartListener2 on the source provider but don't see a way to get it registered for all editors and views in a generic way. The getPartService().addPartListerner(this) will register it but only for a specific workbench part. Also the constructor for the Source Provider is called before any part is active so getting a valid part is not working.
What is the best way to register this Source Provider for all editors and views?
Thanks for reading my question and any assistance you can provide.
Use a IWindowListener to listen for workbench windows being activated:
IWorkbench workbench = PlatformUI.getWorkbench();
workbench.addWindowListener(windowListener);
In the windowActivated method of the listener use the window part service to add a part listener for the window:
public void windowActivated(IWorkbenchWindow window)
{
window.getPartService().addPartListener(partListener);
}
As an example see org.eclipse.jdt.internal.debug.ui.actions.ActionDelegateHelper

Generation of .svc-files on IIS fails when using custom RIAServices.T4 code generation

I have a Silverlight application that uses a custom DomainContextGenerator and a custom EntityGenerator:
[DomainServiceClientCodeGenerator("MainCodeGenerator", "C#")]
public class HrCodeGenerator : CSharpClientCodeGenerator
{
protected override EntityGenerator EntityGenerator
{
get { return new HrEntityGenerator(); }
}
protected override DomainContextGenerator DomainContextGenerator
{
get { return new HrDomainContextGenerator(); }
}
}
This class and the referenced generators are contained in a class library referenced by the Host-project of the Silverlight application.
When starting the application in VisualStudio 2012 everything works fine and when I open http://localhost:12345/My-Namespace-MyService.svc in a browser I can see the landing page of the service. When deploying the application to the IIS however the on-the-fly-generation of the .svc-files fails and when opening http://dev.example.com/My-Namespace-MyService.svc I just receive a HTTP 404.
After removing the HrCodeGenerator-class from the project (removing the DomainServiceClientCodeGeneratorAttribute won't do the trick), everything works fine.
Do you have any hint on why it behaves that way and what I can do to prevent that from happening?
I finally solved the issue.
The classes responsible for the client code generation were located in the same library as the services itself. I moved these classes to the web-application project that gets deployed to the server.
I still don't understand how code that gets executed at compile time only and only affects the client side of the application can possibly influence the runtime behavior of the server side of the application. I also don't understand why moving the components to another project fixed the problem.
But as a colleague of mine states: "Sometimes engineering is indistinguishable from magic..."

Run web project on Server Tomcat 7 with Eclipse

I have big web application that uses GWT. When it starts a dialog window is openning on client side for logging. LogDialog consists of two textfields (password and name). Why when I use option Run on Server from Eclipse I can see only loading picture(it appears from beginnig). But then the LogDialog and main menu dont appear. As I know there is one jscript that Browser have to load to show Logdialog. I tried to view web app from GooGle Chrome and I discovered that it doesnt load Cashier.js (jscript file) and shows to me loading picture. What am I doing wrong? How can I catch the error?
As I know GWT compiler generate the client side Javascript code. The web app uses database for storing logname and pass.

Java Web App in Eclipse with Spring Framework not recognizing edits to controller

I was given an existing dashboard at work and am new to the whole Java Servlets with Spring Framework deal.
So the pages that are there work, and the flow is that there is the #RequestMapping annotation for the method inside the controller. For Example
#RequestMapping("/index.do")
public ModelAndView index() throws Exception {
LoginDO oLoginDO = new LoginDO();
return new ModelAndView("index","oLoginDO",oLoginDO);
}
The servlet.xml file maps the views to jsp files, and it's all working.
But my issue is, when I edit the controller.java file and create another method returning a new view, which is for a new page to the webpage, the change isn't being recognized by the servlet. It says "No matching handler method found for servlet request."
Now here's the thing, I believe this is happening because somehow the Spring Framework isn't being "updated" (don't know if this is the right term) when the edits are made in controller.java. I deployed my source code from a WAR file in Eclipse, then run it on a Tomcat server. Here's the deal, my mentor's code is working fine along with the edits, but I believe that he created a Tomcat project, and the project directories are different, and the edits are updated onto the website immediately after a save.
Note that when I change the JSPs to the existing pages, the updates are recognized immediately, it's only when I create a new JSP and a new #RequestMapping annotation along with a new method, it's not working. I even tried print statements within the controller.java and nothings showing.
So I guess this is an Eclipse question and deployment question more than anything, but any help would be great! Not too sure what to do to fix this. I've even tried restarting the server, to no success though. Thanks!
New #RequestMapping methods require the context to be reloaded (updated) to make them be available. When STS (Eclipse) detects changes on a spring bean it reloads the context automatically. If you are having problems with this try redeploying the project or restarting Tomcat.
Also, I wonder if you are you putting that new #RequestMapping method in a new Controller or in an existing one. If it's a new controller, have you added that Controller to the Spring Web Context (e.g. #Controller + component-scan or just adding the bean to de config file).