Showing posts with label gxt. Show all posts
Showing posts with label gxt. Show all posts

Wednesday, March 4, 2015

GWT / GXT: difference between WEBAPP and RESOURCES project's directories in storing resources e.g. images, css

Basic things you should remember about RIA structure:

WEB-INF directory holds everything on server e.g. Apache Tomcat servlet container lets say in "private" access i.e. nothing there is assessable by direct URL, only through the call to the server made by your app. 

This means that WEB-INF resources are accessible to the classloader of your Web-Application and not directly visible for the public.
-----------------------------------------------------------------------
So: if you'll store your resources in webapp directory, then after the build all that resources WILL HAVE public access e.g. directly assessable for everyone from their browser e.g. by URL.

If you want to insure your resources privacy e.g. images, css, properties etc you should put them inside of resources directory, NOT in webapp. Thus, after build they will be copied (stored) in WEB-INF directory.

Nevertheless, all your resources you use and store in your packages inside of src/main/java tree will be stored thereafter in WEB_INF/classes along with compiled source, which is not good because they should not be compiled. For this reason it is better to create some public directory for them on the same level of *.gwt.xml or in resources directory.



Monday, January 5, 2015

Create GXT 3 project example

Here is the way you could create GXT 3 project.
You would use Maven Archetype with a little workaround of pom.xml and code.

Form CLI execute:

mvn archetype:generate    -DarchetypeGroupId=org.codehaus.mojo    -DarchetypeArtifactId=gwt-maven-plugin    -DarchetypeVersion=2.7.0

Then:

mvn gwt:verify
mvn gwt:run

At this point you will be able to run pure GWT demo.

Now is the GXT time:

In root html file add following line as the first stylesheet
<link rel="stylesheet" type="text/css" href="MyModule/reset.css">

Remove the table for the Web Application Starter project. We don’t need it for this guide.

Add the line below to the *.gwt.xml
<inherits name="com.sencha.gxt.ui.GXT" />
And remove the following line from the same file:
<inherits name="com.google.gwt.user.theme.standard.Standard" />
Inside of the main root class that implements EntryPoint leave only this:
public void onModuleLoad() {
    BasicTabExample tabs = new BasicTabExample();
    RootPanel.get().add(tabs);
}


Create in the same package of the root class this class:

Tuesday, March 25, 2014

GXT how to implement window with proper layout for content

Window is ContentPanel
setLayout( new FitLayout )
add( LayoutContainer )
        VBoxLayout layout = new VBoxLayout();
layout.setPadding(new Padding(5));
layout.setVBoxLayoutAlign(VBoxLayout.VBoxLayoutAlign.LEFT);
layout.setPack(BoxLayout.BoxLayoutPack.START);

(LayoutContainer).setLayout(layout);
        add( button )
        add( safeHtmlText )

window.layout();


Tuesday, February 11, 2014

The way to highlite grid's selected rows in GXT v2

public void colorLockedGridRows() {
Grid grid = gridView.getGrid();
ListStore<BeanModel> store = grid.getStore();

for (BeanModel model : store.getModels()) {
SecurityGroupVO bean = model.getBean();
if ( bean.isLocked() ) {
Element row = grid.getView().getRow(model);
row.addClassName("locked-row-background-color");
}
}
}