Skip to content

oeg-upm/gwt-blocks

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GWT User 2.6.1 GWT Inject 2.1.2 GWT Dispatch 1.2.0 GWT Presenter 1.1.1

Guice-servlet 3.0

#GWT-Blocks This respository aims to help for the development of GWT projects.
Add to your projects 3 new widgets: loading box, prettypopup, togglebutton.
Add new events for togglebutton: toggleEvent and hasToggleEvent.
Manages your URL places with PlaceManager.
Better abstraction from presenter-display model.

Table of Contents

  1. Pre-requisites
  2. Compile and install it
  3. Use as library
    3.1. Import the library
    3.2. Use the library
      3.2.a. Use as presenter/display
      3.2.b. Use the widgets
        3.2.b.a. Loading widget
        3.2.b.b. PrettyPopup
        3.2.b.c. ToggleButton
  4. Development guide
  5. Version

1) Pre-requisites

  • Maven 3.0 or later.
  • Java 1.7 or later.
  • Internet connection if you use maven (for downloading dependencies).

2) Compile and install it

To compile, type in a cmd or terminal (On project folder, you need see the pom.xml):

mvn clean install

Maven install the library on local repository.

3) Use as library

3.1) Import the library

  • If you use Maven:
    See https://maven.apache.org/ for more information.
    When you does "mvn clean install" the library is installed locally (On your machine).
    Put the next code on your pom.xml file (of your project) (Change the version and put the latest version):
<dependency>  
  <groupId>name.alexdeleon.lib</groupId>  
  <artifactId>gwt-blocks</artifactId>  
  <version>0.1.0</version>  
</dependency>  

If you want, change the version to another.

  • If you do not use Maven:
    Import the file "target/gwt-block-VERSION.jar" into your project.
    Download and import:
    • GWT user 2.6.1
    • GWT inject 2.1.2
    • GWT Guice 1.2.0
    • GWT Presenter 1.1.1

3.2) Use the library
3.2.a) As presenter/display
Create a new class (Your own presenter/display):

public class MyOwnPresenter extends ControlPresenter<MyOwnPresenter.Display> {

	public interface Display extends WidgetDisplay {
	  ... //Interface methods
	}
	
}

Implements your view:

public class MyOwnView extends Composite implements MyOwnPresenter.Display {
	... //TODO: Implements methods.
}

Create your own injector and bind the display with the presenter:

public class MyOwnInjectorModule extends AbstractPresenterModule {
	@Override
	protected void configure() {
		bindDisplay(MyOwnPresenter.Display.class, MyOwnView.class);
	}
}

Bind your injector to GWT Inject module:

@GinModules( { MyOwnInjectorModule.class})
public interface Injector extends Ginjector {
	MyOwnPresenter getMyOwnPresenter();
	//TODO: Add your others views methods
}

Include the next code on client entrypoint:

Injector injector = null;
try {
	injector = GWT.create(Injector.class);
} catch (Exception e) {
	injector = null;
	Window.alert("An several exception ocurred when load the webpage. "
			+ " Exception: " + e.getMessage() + "."
			+ "Please contact with System Admin");
}
RootLayoutPanel.get().add(injector.getMyOwnPresenter().getDisplay().asWidget());

3.2.b) Use widgets
3.2.b.a) Use Loading widget
Include the follow code on your view:

ImageResource loadingIcon; //TODO: create a loading icon
LoadingWidget.Stylesheet css; //TODO: implements this interface with styles
String loadingMessage = "Loading"; //TODO: your own loading messages for example in spanish "Cargando"
LoadingWidget loadingWidget = new LoadingWidget(loadingIcon, loadingMessage, css);

Use this line for view the widget:

loadingWidget.center();

Use this line for hide the widget:

loadingWidget.hide();  

3.2.b.b) Use PrettyPopup
Create style:
If you want to use the default style put:

PrettyPopup.Stylesheet css = PrettyPopupStylesheetFactory.getDefaultStylesheet();

If you want to use your own style:

PrettyPopup.Stylesheet css = new MyOwnStyleSheet(); //TODO: create your own class that implements PrettyPopup.Stylesheet

Create the popup:

boolean modal = true; //If you want that the popup is modal popup.
PrettyPopup myPopup = new PrettyPopup(css, modal);

Add content to the popup:

myPopup.getContentPanel().add(new HTML("<p>Hello</p>")\/\*My Widgets or views\*\/);

3.2.b.c) Use ToggleButton
Create a toggle button:

CSS css; //TODO Create a css for the button. Example: = MyOwnCss(); that implements ToggleButton.Stylesheet
ToggleButton toggleButton = new ToggleButton(css);
//TODO Add the button to a panel. Example: RootLayoutPanel.get().add(toggleButton);

4) Development guide

For development guide visit the follow link:
Development Guide

5) Version

0.1.0

Packages

No packages published

Languages

  • Java 97.5%
  • CSS 1.3%
  • HTML 1.2%