r4 - in refComp/client: . src/main/java/fr/inra/refcomp src/main/java/fr/inra/refcomp/client src/main/java/fr/inra/refcomp/client/constants src/main/java/fr/inra/refcomp/client/resources src/main/java/fr/inra/refcomp/client/services src/main/java/fr/inra/refcomp/service src/main/resources/fr/inra/refcomp src/main/resources/fr/inra/refcomp/public src/main/resources/fr/inra/refcomp/resources src/main/webapp/WEB-INF src/test/java/fr/inra/refcomp/client
Author: jcouteau Date: 2010-11-04 09:13:00 +0100 (Thu, 04 Nov 2010) New Revision: 4 Url: http://chorem.org/repositories/revision/incubator/4 Log: Nice login page + header for next pages Added: refComp/client/src/main/java/fr/inra/refcomp/RefComp.gwt.xml refComp/client/src/main/java/fr/inra/refcomp/client/Login.ui.xml refComp/client/src/main/java/fr/inra/refcomp/client/RefComp.java refComp/client/src/main/java/fr/inra/refcomp/client/SearchResults.java refComp/client/src/main/java/fr/inra/refcomp/client/constants/ refComp/client/src/main/java/fr/inra/refcomp/client/constants/Footer.java refComp/client/src/main/java/fr/inra/refcomp/client/constants/Footer.ui.xml refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.java refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.ui.xml refComp/client/src/main/java/fr/inra/refcomp/client/resources/ refComp/client/src/main/java/fr/inra/refcomp/client/resources/Style.java refComp/client/src/main/java/fr/inra/refcomp/client/resources/refcomp.css refComp/client/src/main/java/fr/inra/refcomp/client/services/ refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginService.java refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginServiceAsync.java refComp/client/src/main/java/fr/inra/refcomp/service/ refComp/client/src/main/java/fr/inra/refcomp/service/LoginServiceImpl.java refComp/client/src/main/java/fr/inra/refcomp/service/Skill.java refComp/client/src/main/java/fr/inra/refcomp/service/SkillService.java refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceAsync.java refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceImpl.java refComp/client/src/main/resources/fr/inra/refcomp/public/RefComp.html refComp/client/src/main/resources/fr/inra/refcomp/public/SearchResults.html refComp/client/src/main/resources/fr/inra/refcomp/resources/ refComp/client/src/main/resources/fr/inra/refcomp/resources/refcomp.css Removed: refComp/client/src/main/java/fr/inra/refcomp/Login.gwt.xml refComp/client/src/main/java/fr/inra/refcomp/Search.gwt.xml refComp/client/src/main/resources/fr/inra/refcomp/public/Login.html refComp/client/src/test/java/fr/inra/refcomp/client/GwtTestSample.java Modified: refComp/client/pom.xml refComp/client/src/main/java/fr/inra/refcomp/client/Login.java refComp/client/src/main/java/fr/inra/refcomp/client/Search.java refComp/client/src/main/resources/fr/inra/refcomp/public/Search.html refComp/client/src/main/webapp/WEB-INF/web.xml Modified: refComp/client/pom.xml =================================================================== --- refComp/client/pom.xml 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/pom.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -31,6 +31,18 @@ <artifactId>gwt-servlet</artifactId> </dependency> + <dependency> + <groupId>org.gwtmultipage</groupId> + <artifactId>gwtmultipage-core</artifactId> + <version>1.0.0.Beta5</version> + </dependency> + + <dependency> + <groupId>fr.inra.refcomp</groupId> + <artifactId>services</artifactId> + <version>0.1-SNAPSHOT</version> + </dependency> + </dependencies> <!-- ************************************************************* --> Deleted: refComp/client/src/main/java/fr/inra/refcomp/Login.gwt.xml =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/Login.gwt.xml 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/java/fr/inra/refcomp/Login.gwt.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -1,16 +0,0 @@ -<!DOCTYPE module PUBLIC "//gwt-module/" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.2/distro-source/core/src/gwt-module.dtd"> -<module> - - <!-- Inherit the core Web Toolkit stuff. --> - <inherits name='com.google.gwt.user.User'/> - - <!-- inherit css based theme --> - <inherits name='com.google.gwt.user.theme.standard.Standard'/> - - <!-- Specify the app entry point class. --> - <entry-point class='fr.inra.refcomp.client.Login'/> - - <!-- Specify the application specific style sheet. --> - <stylesheet src='Application.css' /> - -</module> Added: refComp/client/src/main/java/fr/inra/refcomp/RefComp.gwt.xml =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/RefComp.gwt.xml (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/RefComp.gwt.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,18 @@ +<!DOCTYPE module PUBLIC "//gwt-module/" + "http://google-web-toolkit.googlecode.com/svn/tags/1.6.2/distro-source/core/src/gwt-module.dtd"> +<module> + + <!-- Inherit the core Web Toolkit stuff. --> + <inherits name='com.google.gwt.user.User'/> + <inherits name="com.google.gwt.uibinder.UiBinder"/> + + <!-- inherit css based theme --> + <inherits name='com.google.gwt.user.theme.standard.Standard'/> + + <!-- Specify the app entry point class. --> + <entry-point class='fr.inra.refcomp.client.RefComp'/> + + <!-- Specify the application specific style sheet. --> + <stylesheet src='Application.css'/> + +</module> \ No newline at end of file Deleted: refComp/client/src/main/java/fr/inra/refcomp/Search.gwt.xml =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/Search.gwt.xml 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/java/fr/inra/refcomp/Search.gwt.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -1,17 +0,0 @@ -<!DOCTYPE module PUBLIC "//gwt-module/" - "http://google-web-toolkit.googlecode.com/svn/tags/1.6.2/distro-source/core/src/gwt-module.dtd"> -<module> - - <!-- Inherit the core Web Toolkit stuff. --> - <inherits name='com.google.gwt.user.User'/> - - <!-- inherit css based theme --> - <inherits name='com.google.gwt.user.theme.standard.Standard'/> - - <!-- Specify the app entry point class. --> - <entry-point class='fr.inra.refcomp.client.Search'/> - - <!-- Specify the application specific style sheet. --> - <stylesheet src='Application.css'/> - -</module> \ No newline at end of file Modified: refComp/client/src/main/java/fr/inra/refcomp/client/Login.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/Login.java 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/java/fr/inra/refcomp/client/Login.java 2010-11-04 08:13:00 UTC (rev 4) @@ -1,41 +1,128 @@ package fr.inra.refcomp.client; -import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.StyleInjector; import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.logical.shared.ValueChangeEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.uibinder.client.UiTemplate; import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextBox; +import fr.inra.refcomp.client.constants.Header; +import fr.inra.refcomp.client.resources.Style; +import fr.inra.refcomp.client.services.LoginService; +import fr.inra.refcomp.client.services.LoginServiceAsync; /** * User: couteau * Date: 3 nov. 2010 */ -public class Login implements EntryPoint { +public class Login extends Composite { - Label loginLabel = new Label("Login : "); - TextBox loginBox = new TextBox(); - Label pwdLabel = new Label("Password : "); - TextBox pwdBox = new TextBox(); - Button button = new Button("Submit"); - - public void onModuleLoad() { - RootPanel.get("loginLabel").add(loginLabel); - RootPanel.get("loginBox").add(loginBox); - RootPanel.get("pwdLabel").add(pwdLabel); - RootPanel.get("pwdBox").add(pwdBox); - RootPanel.get("submitButton").add(button); + private final LoginServiceAsync loginService = GWT + .create(LoginService.class); - button.addClickHandler(new ClickHandler(){ - public void onClick(ClickEvent event) { - //Window.Location.assign("Search/Search.html"); - Window.Location.replace("../fr.inra.refcomp.Search/Search.html"); - //Window.open("Search.html", "_self", ""); - } - }); + @UiTemplate("Login.ui.xml") + interface MyUiBinder extends UiBinder<Panel, Login> { + } + private static final MyUiBinder binder = GWT.create(MyUiBinder.class); + + @UiField(provided = true) + final Style res; + + private static boolean stylesInjected = false; + + public Login() { + this.res = GWT.create(Style.class); + + // Inject only once. + if (!stylesInjected) { + StyleInjector.injectStylesheet(res.style().getText()); + stylesInjected = true; + } + + initWidget(binder.createAndBindUi(this)); } + @UiField + TextBox loginBox; + + @UiField + TextBox passwordBox; + + @UiField + Label completionLabel1; + + @UiField + Label completionLabel2; + + private Boolean tooShort = false; + + /* + * Method name is not relevant, the binding is done according to the class + * of the parameter. + */ + + @UiHandler("buttonSubmit") + void doClickSubmit(ClickEvent event) { + if (tooShort) { + loginService.login(loginBox.getValue(), passwordBox.getValue(), + new AsyncCallback<Boolean>() { + @Override + public void onFailure(Throwable caught) { + Window.alert("Server communication error"); + } + + @Override + public void onSuccess(Boolean result) { + if (result){ + RootPanel content = RootPanel.get("content"); + RootPanel header = RootPanel.get("header"); + + content.clear(); + + header.clear(); + header.add(new Header()); + + } else { + Window.alert("Login failed, try with admin/admin"); + } + } + }); + } else { + Window.alert("Login or Password is too short"); + } + } + + @UiHandler("loginBox") + void loginBoxValueChanged(ValueChangeEvent<String> event) { + if (event.getValue().length() < 3) { + completionLabel1.setText("Login too short (Size must be >3)"); + tooShort = false; + } else { + tooShort = true; + completionLabel1.setText(""); + } + } + + @UiHandler("passwordBox") + void passwordBoxValueChanged(ValueChangeEvent<String> event) { + if (event.getValue().length() < 3) { + tooShort = false; + completionLabel2.setText("Password too short (Size must be >3)"); + } else { + tooShort = true; + completionLabel2.setText(""); + } + } + + } Added: refComp/client/src/main/java/fr/inra/refcomp/client/Login.ui.xml =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/Login.ui.xml (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/Login.ui.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,28 @@ +<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' + xmlns:gwt='urn:import:com.google.gwt.user.client.ui'> + + <ui:with field='res' type='fr.inra.refcomp.client.resources.Style'/> + + <gwt:HTMLPanel> + <div align="center"> + <gwt:VerticalPanel styleName="{res.style.background}"> + <gwt:Label text="Login" styleName="{res.style.greyText}"/> + <gwt:TextBox ui:field="loginBox" + styleName="{res.style.box}"/> + <gwt:Label text="Password" styleName="{res.style.greyText}"/> + <gwt:TextBox ui:field="passwordBox" styleName="{res.style.box}"/> + <gwt:HorizontalPanel verticalAlignment="ALIGN_MIDDLE"> + <gwt:Button ui:field="buttonSubmit" text="Submit" + styleName="{res.style.loginButton}"/> + <gwt:CheckBox ui:field="myCheckBox"/> + <gwt:Label ui:field="myLabel" text="Remember me" + styleName="{res.style.greyText}"/> + </gwt:HorizontalPanel> + <gwt:Label ui:field="completionLabel1" + styleName="{res.style.greyText}"/> + <gwt:Label ui:field="completionLabel2" + styleName="{res.style.greyText}"/> + </gwt:VerticalPanel> + </div> + </gwt:HTMLPanel> +</ui:UiBinder> \ No newline at end of file Added: refComp/client/src/main/java/fr/inra/refcomp/client/RefComp.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/RefComp.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/RefComp.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,16 @@ +package fr.inra.refcomp.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.user.client.ui.RootPanel; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class RefComp implements EntryPoint { + public void onModuleLoad() { + + RootPanel.get("content").add(new Login()); + + } +} Modified: refComp/client/src/main/java/fr/inra/refcomp/client/Search.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/Search.java 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/java/fr/inra/refcomp/client/Search.java 2010-11-04 08:13:00 UTC (rev 4) @@ -2,8 +2,11 @@ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.TextBox; +import org.gwtmultipage.client.UrlPatternEntryPoint; /** * User: couteau @@ -12,11 +15,12 @@ public class Search implements EntryPoint { Label searchLabel = new Label("Search"); + TextBox searchBox = new TextBox(); + Button searchButton = new Button("Search"); public void onModuleLoad(){ - GWT.log("Hello World!", null); - - RootPanel.get("test").add(searchLabel); - + RootPanel.get("searchLabel").add(searchLabel); + RootPanel.get("searchBox").add(searchBox); + RootPanel.get("searchButton").add(searchButton); } } Added: refComp/client/src/main/java/fr/inra/refcomp/client/SearchResults.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/SearchResults.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/SearchResults.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,22 @@ +package fr.inra.refcomp.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.RootPanel; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class SearchResults implements EntryPoint { + + public void onModuleLoad(){ + Label searchLabel = new Label("Search"); + Label searchedText = new Label("Java"); + + RootPanel.get("searchLabel").add(searchLabel); + RootPanel.get("searchedText").add(searchedText); + + } + +} Added: refComp/client/src/main/java/fr/inra/refcomp/client/constants/Footer.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/constants/Footer.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/constants/Footer.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,8 @@ +package fr.inra.refcomp.client.constants; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class Footer { +} Added: refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,90 @@ +package fr.inra.refcomp.client.constants; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.StyleInjector; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.uibinder.client.UiTemplate; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Panel; +import com.google.gwt.user.client.ui.RootPanel; +import fr.inra.refcomp.client.Login; +import fr.inra.refcomp.client.resources.Style; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class Header extends Composite { + @UiTemplate("Header.ui.xml") + interface MyUiBinder extends UiBinder<Panel, Header> { + } + + private static final MyUiBinder binder = GWT.create(MyUiBinder.class); + + @UiField(provided = true) + final Style res; + + private static boolean stylesInjected = false; + + public Header() { + this.res = GWT.create(Style.class); + + // Inject only once. + if (!stylesInjected) { + StyleInjector.injectStylesheet(res.style().getText()); + stylesInjected = true; + } + + initWidget(binder.createAndBindUi(this)); + } + + @UiHandler("buttonLogout") + void doClickLogout(ClickEvent event) { + + RootPanel content = RootPanel.get("content"); + RootPanel header = RootPanel.get("header"); + RootPanel footer = RootPanel.get("footer"); + + content.clear(); + header.clear(); + footer.clear(); + + content.add(new Login()); + } + + @UiHandler("buttonMySkills") + void doClickMySkills(ClickEvent event) { + + Window.alert("Not implemented yet"); + } + + @UiHandler("buttonAdminSkills") + void doClickAdminSkills(ClickEvent event) { + + Window.alert("Not implemented yet"); + } + + @UiHandler("buttonAdminCati") + void doClickAdminCati(ClickEvent event) { + + Window.alert("Not implemented yet"); + } + + @UiHandler("buttonAdminServices") + void doClickAdminServices(ClickEvent event) { + + Window.alert("Not implemented yet"); + } + + @UiHandler("buttonAdminUsers") + void doClickAdminUsers(ClickEvent event) { + + Window.alert("Not implemented yet"); + } +} Added: refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.ui.xml =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.ui.xml (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/constants/Header.ui.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,22 @@ +<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' + xmlns:gwt='urn:import:com.google.gwt.user.client.ui'> + + <ui:with field='res' type='fr.inra.refcomp.client.resources.Style'/> + + <gwt:HTMLPanel> + <gwt:HorizontalPanel verticalAlignment="ALIGN_MIDDLE"> + <gwt:Button ui:field="buttonLogout" text="Logout" + styleName="{res.style.loginButton}"/> + <gwt:Button ui:field="buttonMySkills" text="My Skills" + styleName="{res.style.loginButton}"/> + <gwt:Button ui:field="buttonAdminSkills" text="Admin. Skills" + styleName="{res.style.loginButton}"/> + <gwt:Button ui:field="buttonAdminCati" text="Admin. Cati" + styleName="{res.style.loginButton}"/> + <gwt:Button ui:field="buttonAdminServices" text="Admin. Services" + styleName="{res.style.loginButton}"/> + <gwt:Button ui:field="buttonAdminUsers" text="Admin. Users" + styleName="{res.style.loginButton}"/> + </gwt:HorizontalPanel> + </gwt:HTMLPanel> +</ui:UiBinder> \ No newline at end of file Added: refComp/client/src/main/java/fr/inra/refcomp/client/resources/Style.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/resources/Style.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/resources/Style.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,28 @@ +package fr.inra.refcomp.client.resources; + +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; + +/** + * User: couteau + * Date: 4 nov. 2010 + */ +public interface Style extends ClientBundle{ + + /** + * Sample CssResource. + */ + public interface MyCss extends CssResource { + String greyText(); + + String loginButton(); + + String box(); + + String background(); + } + + @ClientBundle.Source("refcomp.css") + MyCss style(); + +} Added: refComp/client/src/main/java/fr/inra/refcomp/client/resources/refcomp.css =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/resources/refcomp.css (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/resources/refcomp.css 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,36 @@ +.greyText { + font-family: "Lucida Grande", Arial, Sans-serif; + color: #778899; + font-size: 11px; + text-align: left; +} + +.loginButton { + border: 1px solid #3399DD; + color: #FFFFFF; + background: #3322DD; + font-size: 11px; + font-weight: bold; + margin: 0 5px 0 0; + padding: 4px 10px 5px; + text-shadow: 0 -1px 0 #3399DD; +} + +.box { + border: 1px solid #AACCEE; + display: block; + font-size: 12px; + margin: 0 0 5px; + padding: 3px; + width: 203px; +} + +.background { + background-color: #DDEEF6; + border: 1px none transparent; + color: #778899; + font-size: 11px; + margin-left: -8px; + margin-top: 5px; + padding: 6px; +} Added: refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginService.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginService.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginService.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,14 @@ +package fr.inra.refcomp.client.services; + +import com.google.gwt.user.client.rpc.RemoteService; +import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; + +/** + * User: couteau + * Date: 4 nov. 2010 + */ +@RemoteServiceRelativePath("login") +public interface LoginService extends RemoteService { + Boolean login(String login, String password); +} + Added: refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginServiceAsync.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginServiceAsync.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/client/services/LoginServiceAsync.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,12 @@ +package fr.inra.refcomp.client.services; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +/** + * User: couteau + * Date: 4 nov. 2010 + */ +public interface LoginServiceAsync { + void login(String login, String password, AsyncCallback<Boolean> callback); +} + Added: refComp/client/src/main/java/fr/inra/refcomp/service/LoginServiceImpl.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/service/LoginServiceImpl.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/service/LoginServiceImpl.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,20 @@ +package fr.inra.refcomp.service; + +import com.google.gwt.user.server.rpc.RemoteServiceServlet; +import fr.inra.refcomp.client.services.LoginService; + +/** + * User: couteau + * Date: 4 nov. 2010 + */ +public class LoginServiceImpl extends RemoteServiceServlet implements + LoginService { + + public Boolean login(String login, String password) { + if (login.equals("admin") && password.equals("admin")) + return true; + else + return false; + } +} + Added: refComp/client/src/main/java/fr/inra/refcomp/service/Skill.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/service/Skill.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/service/Skill.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,62 @@ +package fr.inra.refcomp.service; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class Skill { + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public String getLinkedSkill() { + return linkedSkill; + } + + public void setLinkedSkill(String linkedSkill) { + this.linkedSkill = linkedSkill; + } + + public String getRight() { + return right; + } + + public void setRight(String right) { + this.right = right; + } + + protected String name; + protected String level; + protected String comment; + protected String linkedSkill; + protected String right; + + public Skill(String name, String level, String comment, String linkedSkill, String right){ + this.name=name; + this.level=level; + this.comment=comment; + this.linkedSkill=linkedSkill; + this.right=right; + } +} Added: refComp/client/src/main/java/fr/inra/refcomp/service/SkillService.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/service/SkillService.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/service/SkillService.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,15 @@ +package fr.inra.refcomp.service; + +import com.google.gwt.user.client.rpc.RemoteService; +import java.util.List; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public interface SkillService extends RemoteService { + + List<Skill> getAllSkills(); + + void addSkill(Skill skill); +} Added: refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceAsync.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceAsync.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceAsync.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,14 @@ +package fr.inra.refcomp.service; + +import com.google.gwt.user.client.rpc.AsyncCallback; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public interface SkillServiceAsync { + + void getAllSkills(AsyncCallback callback); + + void addSkill(AsyncCallback callback); +} Added: refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceImpl.java =================================================================== --- refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceImpl.java (rev 0) +++ refComp/client/src/main/java/fr/inra/refcomp/service/SkillServiceImpl.java 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,25 @@ +package fr.inra.refcomp.service; + +import java.util.ArrayList; +import java.util.List; + +/** + * User: couteau + * Date: 3 nov. 2010 + */ +public class SkillServiceImpl implements SkillService { + protected List<Skill> skills; + + public SkillServiceImpl(){ + skills = new ArrayList<Skill>(); + skills.add(new Skill("Hervé Richard", "Maîtrise", "Enfin pas trop quand même", "R","CIAM")); + } + + public List<Skill> getAllSkills(){ + return skills; + } + + public void addSkill(Skill skill){ + skills.add(skill); + } +} Deleted: refComp/client/src/main/resources/fr/inra/refcomp/public/Login.html =================================================================== --- refComp/client/src/main/resources/fr/inra/refcomp/public/Login.html 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/resources/fr/inra/refcomp/public/Login.html 2010-11-04 08:13:00 UTC (rev 4) @@ -1,43 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<!-- The HTML 4.01 Transitional DOCTYPE declaration--> -<!-- above set at the top of the file will set --> -<!-- the browser's rendering engine into --> -<!-- "Quirks Mode". Replacing this declaration --> -<!-- with a "Standards Mode" doctype is supported, --> -<!-- but may lead to some differences in layout. --> - -<html> - <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8"> - - <title>RefComp - Login</title> - - <meta name='gwt:module' content='fr.inra.refcomp.client.Login'> - - <!-- --> - <!-- This script loads your compiled module. --> - <!-- If you add any GWT meta tags, they must --> - <!-- be added before this line. --> - <!-- --> - <script type="text/javascript" language="javascript" src="fr.inra.refcomp.Login.nocache.js"></script> - </head> - - <body> - - <div id="login"> - <div id="loginForm"> - <span id="loginLabel"></span> - <span id="loginBox"></span> - <span id="pwdLabel"></span> - <span id="pwdBox"></span> - <div id="submitButton"></div> - </div> - <div id="register"></div> - <div id="forgot"></div> - </div> - - <!-- OPTIONAL: include this if you want history support --> - <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> - - </body> -</html> \ No newline at end of file Added: refComp/client/src/main/resources/fr/inra/refcomp/public/RefComp.html =================================================================== --- refComp/client/src/main/resources/fr/inra/refcomp/public/RefComp.html (rev 0) +++ refComp/client/src/main/resources/fr/inra/refcomp/public/RefComp.html 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,30 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> + + <title>RefComp - Search</title> + + <meta name='gwt:module' content='fr.inra.refcomp.client.SearchResults'> + + <!-- --> + <!-- This script loads your compiled module. --> + <!-- If you add any GWT meta tags, they must --> + <!-- be added before this line. --> + <!-- --> + <script type="text/javascript" language="javascript" src="fr.inra.refcomp.RefComp.nocache.js"></script> +</head> +<body> + +<div id="header"></div> + +<div id="content"></div> + +<div id="footer"></div> + + + <!-- OPTIONAL: include this if you want history support --> + <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> +</body> +</html> \ No newline at end of file Modified: refComp/client/src/main/resources/fr/inra/refcomp/public/Search.html =================================================================== --- refComp/client/src/main/resources/fr/inra/refcomp/public/Search.html 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/resources/fr/inra/refcomp/public/Search.html 2010-11-04 08:13:00 UTC (rev 4) @@ -16,11 +16,25 @@ <script type="text/javascript" language="javascript" src="fr.inra.refcomp.Search.nocache.js"></script> </head> <body> -<div id="test"> +<div id="header"> + <span id="Logout"></span> + <span id="mySkills"></span> + <span id="adminSkills"></span> + <span id="adminCati"></span> + <span id="adminServices"></span> + <span id="adminUsers"></span> </div> +<div id="content"> + <span id="searchLabel"></span> + <span id="searchBox"></span> + <span id="searchButton"></span> +</div> +<div id="footer"></div> + + <!-- OPTIONAL: include this if you want history support --> <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> </body> Added: refComp/client/src/main/resources/fr/inra/refcomp/public/SearchResults.html =================================================================== --- refComp/client/src/main/resources/fr/inra/refcomp/public/SearchResults.html (rev 0) +++ refComp/client/src/main/resources/fr/inra/refcomp/public/SearchResults.html 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,43 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> + + <title>RefComp - Search</title> + + <meta name='gwt:module' content='fr.inra.refcomp.client.SearchResults'> + + <!-- --> + <!-- This script loads your compiled module. --> + <!-- If you add any GWT meta tags, they must --> + <!-- be added before this line. --> + <!-- --> + <script type="text/javascript" language="javascript" src="fr.inra.refcomp.SearchResults.nocache.js"></script> +</head> +<body> +<div id="header"> + <span id="Logout"></span> + <span id="mySkills"></span> + <span id="adminSkills"></span> + <span id="adminCati"></span> + <span id="adminServices"></span> + <span id="adminUsers"></span> + +</div> + +<div id="facets"></div> + +<div id="content"> + <span id="searchLabel"></span> + <span id="searchedText"></span> + <div id="searchResults"></div> +</div> + +<div id="footer"></div> + + + <!-- OPTIONAL: include this if you want history support --> + <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> +</body> +</html> \ No newline at end of file Added: refComp/client/src/main/resources/fr/inra/refcomp/resources/refcomp.css =================================================================== --- refComp/client/src/main/resources/fr/inra/refcomp/resources/refcomp.css (rev 0) +++ refComp/client/src/main/resources/fr/inra/refcomp/resources/refcomp.css 2010-11-04 08:13:00 UTC (rev 4) @@ -0,0 +1,36 @@ +.greyText { + font-family: "Lucida Grande", Arial, Sans-serif; + color: #778899; + font-size: 11px; + text-align: left; +} + +.loginButton { + border: 1px solid #3399DD; + color: #FFFFFF; + background: #3322DD; + font-size: 11px; + font-weight: bold; + margin: 0 5px 0 0; + padding: 4px 10px 5px; + text-shadow: 0 -1px 0 #3399DD; +} + +.box { + border: 1px solid #AACCEE; + display: block; + font-size: 12px; + margin: 0 0 5px; + padding: 3px; + width: 203px; +} + +.background { + background-color: #DDEEF6; + border: 1px none transparent; + color: #778899; + font-size: 11px; + margin-left: -8px; + margin-top: 5px; + padding: 6px; +} Modified: refComp/client/src/main/webapp/WEB-INF/web.xml =================================================================== --- refComp/client/src/main/webapp/WEB-INF/web.xml 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/main/webapp/WEB-INF/web.xml 2010-11-04 08:13:00 UTC (rev 4) @@ -8,4 +8,25 @@ <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> + + <servlet> + <servlet-name>SkillService</servlet-name> + <servlet-class>fr.inra.refcomp.service.SkillServiceImpl + </servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>SkillService</servlet-name> + <url-pattern>/fr.inra.refcomp.RefComp/skillService</url-pattern> + </servlet-mapping> + + <servlet> + <servlet-name>LoginService</servlet-name> + <servlet-class>fr.inra.refcomp.service.LoginServiceImpl + </servlet-class> + </servlet> + <servlet-mapping> + <servlet-name>LoginService</servlet-name> + <url-pattern>/fr.inra.refcomp.RefComp/loginService</url-pattern> + </servlet-mapping> + </web-app> Deleted: refComp/client/src/test/java/fr/inra/refcomp/client/GwtTestSample.java =================================================================== --- refComp/client/src/test/java/fr/inra/refcomp/client/GwtTestSample.java 2010-11-03 15:15:50 UTC (rev 3) +++ refComp/client/src/test/java/fr/inra/refcomp/client/GwtTestSample.java 2010-11-04 08:13:00 UTC (rev 4) @@ -1,20 +0,0 @@ -package fr.inra.refcomp.client; - -import com.google.gwt.junit.client.GWTTestCase; - -public class GwtTestSample - extends GWTTestCase -{ - - public String getModuleName() - { - return "fr.inra.Application"; - } - - public void testSomething() - { - // Not much to actually test in this sample app - // Ideally you would test your Controller here (NOT YOUR UI) - // (Make calls to RPC services, test client side model objects, test client side logic, etc) - } -} \ No newline at end of file
participants (1)
-
jcouteau@users.chorem.org