Changeset 406
- Timestamp:
- 03/09/12 16:31:28 (12 years ago)
- Location:
- tapas
- Files:
-
- 1 deleted
- 9 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
tapas/common/implementation/com/ether/MethodDescription.java
r376 r406 1 1 package com.ether; 2 3 import com.ether.annotation.ControllerMethod; 4 import org.jetbrains.annotations.NotNull; 5 import org.jetbrains.annotations.Nullable; 2 6 3 7 import java.lang.reflect.Method; 4 8 import java.util.ArrayList; 5 9 import java.util.List; 6 7 import org.jetbrains.annotations.NotNull;8 import org.jetbrains.annotations.Nullable;9 10 import com.ether.annotation.ControllerMethod;11 10 12 11 public class MethodDescription … … 16 15 _method = method; 17 16 _view = annotation.view(); 17 _defaultView = annotation.defaultView(); 18 18 _isJsonResult = annotation.jsonResult(); 19 _isLoginMandatory = annotation.loginMandatory(); 20 _isRequestMandatory = annotation.requestMandatory(); 21 _isBackofficeMethod = annotation.backofficeMethod(); 19 22 _params = new ArrayList<ParamDescription>(); 20 23 } … … 34 37 { 35 38 return _view; 39 } 40 41 public void setView( @NotNull final String view ) 42 { 43 _view = view; 44 } 45 46 @Nullable 47 public String getDefaultView() 48 { 49 return _defaultView; 50 } 51 52 public void setDefaultView( @Nullable final String defaultView ) 53 { 54 _defaultView = defaultView; 36 55 } 37 56 … … 64 83 } 65 84 85 public Boolean isLoginMandatory() 86 { 87 return _isLoginMandatory; 88 } 89 90 public void setLoginMandatory( final Boolean loginMandatory ) 91 { 92 _isLoginMandatory = loginMandatory; 93 } 94 95 public Boolean isRequestMandatory() 96 { 97 return _isRequestMandatory; 98 } 99 100 public void setRequestMandatory( final Boolean requestMandatory ) 101 { 102 _isRequestMandatory = requestMandatory; 103 } 104 105 public Boolean isBackofficeMethod() 106 { 107 return _isBackofficeMethod; 108 } 109 110 public void setBackofficeMethod( final Boolean backofficeMethod ) 111 { 112 _isBackofficeMethod = backofficeMethod; 113 } 114 66 115 @NotNull 67 116 private Method _method; 68 117 @NotNull 69 118 private String _view; 119 @Nullable 120 private String _defaultView; 70 121 private Boolean _isJsonResult; 71 122 @Nullable 72 123 private List<ParamDescription> _params; 124 private Boolean _isLoginMandatory; 125 private Boolean _isRequestMandatory; 126 private Boolean _isBackofficeMethod; 73 127 } -
tapas/common/implementation/com/ether/annotation/ControllerMethod.java
r376 r406 1 1 package com.ether.annotation; 2 3 import org.jetbrains.annotations.NotNull; 4 import org.jetbrains.annotations.Nullable; 2 5 3 6 import java.lang.annotation.ElementType; … … 6 9 import java.lang.annotation.Target; 7 10 8 import org.jetbrains.annotations.NotNull;9 10 11 @Retention(RetentionPolicy.RUNTIME) 11 12 @Target(ElementType.METHOD) 12 13 public @interface ControllerMethod 13 14 { 14 @NotNull 15 String view() default ""; 15 @NotNull String view() default ""; 16 16 17 @NotNull18 17 boolean jsonResult() default false; 18 19 boolean loginMandatory() default false; 20 21 boolean requestMandatory() default false; 22 23 boolean backofficeMethod() default false; 24 25 @Nullable String defaultView() default ""; 19 26 } -
tapas/web/project/formTapas.jsp
r402 r406 1 <%@ page import="com.ether.Context" %>2 1 <%@ page import="com.ether.WebException" %> 3 2 <%@ page contentType="text/html;charset=UTF-8" language="java" %> … … 29 28 <div id="errors"></div> 30 29 31 <BR/>32 <%=Context.getPageURI( request )%><BR/>33 <%=Context.getRelativePageURI( request )%><BR/>34 <%=Context.getRelativePath( request )%><BR/>35 <%=Context.getWebroot( request )%><BR/>36 <%=request.getQueryString()%><BR/>37 <%=request.getContextPath()%><BR/>38 <%=request.getPathInfo()%><BR/>39 <%=request.getServletPath()%><BR/>40 <%=request.getRequestURL()%><BR/>41 42 43 30 <script type="text/javascript"> 44 31 var tapasTexts = $A( "" ); 45 46 32 tapasTexts["label.submitButton"] = '<spring:message code="label.submitButton"/>'; 47 33 tapasTexts["<%=WebException.WebCode.ERROR_JSON_TAPAS_IS_NULL%>"] = "<spring:message code="error.ERROR_JSON_TAPAS_IS_NULL"/>"; 48 49 34 50 35 var interfaceTapas = new InterfaceTapas(); -
tapas/web/resources/templates/templateEther.jsp
r404 r406 124 124 var templateTexts = $A( "" ); 125 125 templateTexts["label.home"] = '<spring:message code="label.home"/>'; 126 templateTexts["label.language.to. fr"] = '<spring:message code="label.language.to.fr"/>';127 templateTexts["label.language. to.en"] = '<spring:message code="label.language.to.en"/>';126 templateTexts["label.language.to.switch"] = '<spring:message code="label.language.to.switch"/>'; 127 templateTexts["label.language.value.to.switch"] = '<spring:message code="label.language.value.to.switch"/>'; 128 128 templateTexts["label.mail"] = '<spring:message code="label.mail"/>'; 129 129 templateTexts["label.map"] = '<spring:message code="label.map"/>'; -
tapas/web/resources/templates/templateEther_script.jsp
r404 r406 1 <%@ page import="com.ether.Context" %>2 3 1 <script type="text/javascript"> 4 2 var InterfaceTemplate = Class.create( { … … 12 10 13 11 /** *********** VARIABLES *********** **/ 14 this.isLanguageFr = <%=Context.getLangue(request).equals( "fr" )%>;15 12 // TODO : vérifier cette adresse de webmaster !!!! 16 13 this.webmaster = "rboipsl@ipsl.jussieu.fr"; … … 24 21 { 25 22 var mailButton = new Button( {value:templateTexts["label.mail"], parent:this.containerTools, id:"button_mail", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickMail, this )} ); 26 27 // var valueLanguage = templateTexts["label.language.fr"]; 28 // if( this.isLanguageFr ) 29 // valueLanguage = templateTexts["label.language.en"]; 30 31 <%--var languageButton = new Button( {value: templateTexts["label.language.<%=Context.getLocale( request )%>"], parent:this.containerTools, id:"button_language", className: "red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} );--%> 32 var languageButton = new Button( {value:templateTexts["label.language.to.<%=Context.getLocale( request )%>"], parent:this.containerTools, id:"button_language", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} ); 23 var languageButton = new Button( {value:templateTexts["label.language.to.switch"], parent:this.containerTools, id:"button_language", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickLanguage, this )} ); 33 24 var homeButton = new Button( {value:templateTexts["label.home"], parent:this.containerTools, id:"button_home", className: "red_button", classNameText:"red_button_text", onClick:this.onClickHome} ); 34 25 }, 35 26 36 27 // REQUESTS ******************************************************** 28 requestChangeLocale: function() 29 { 30 $.ajax( { 31 url: "project?methodName=setLocale&language=" + templateTexts["label.language.value.to.switch"], 32 success:function() 33 { 34 location.reload(); 35 } 36 } ); 37 }, 38 39 // HANDLES ******************************************************** = retours ajax 40 handleChangeLocale: function( result ) 41 { 42 var bob = jQuery.parseJSON( result ).result; 43 alert( bob ); 44 }, 37 45 38 46 // EVENTS ******************************************************** … … 44 52 onClickLanguage: function() 45 53 { 46 this.path = "<%=request.getContextPath()%>"; 47 this.webmaster = "<%=Context.getWebmaster(request)%>"; 48 49 alert( "<%=request.getQueryString()%>||<%=Context.getRelativePath( request )%>||<%=Context.getRelativePageURI(request)%>" ); 50 51 this.relativePageUri = <%=request.getQueryString() != null%> ? "<%=Context.getRelativePath( request )%>?<%=request.getQueryString()%>" : "<%=Context.getRelativePageURI(request)%>"; 52 53 alert( this.relativePageUri + " " +<%=Context.isFrench(request)%> ); 54 if( <%=Context.isFrench(request)%> ) 55 document.location.href = this.path + this.relativePageUri + "&language=en"; 56 else 57 document.location.href = this.path + this.relativePageUri + "&language=fr"; 54 this.requestChangeLocale(); 58 55 }, 59 56 -
tapas/web/src/com/ether/Controller.java
r402 r406 35 35 @ControllerMethod(view = VIEW_FORM_TAPAS) 36 36 public Map<String, Object> viewForm() 37 throws WebException 38 { 37 throws WebException{ 39 38 return new HashMap<String, Object>(); 40 39 } -
tapas/web/src/com/ether/ControllerEther.java
r402 r406 37 37 extends AbstractController 38 38 { 39 /** 40 * This method is used to change Locale with the framework Spring 41 * 42 * @throws WebException 43 */ 44 @ControllerMethod() 45 public void setLocale() 46 throws WebException 47 { 48 } 49 39 50 @Override 40 51 @Nullable … … 81 92 // Parse parameters 82 93 final Object[] params = buildParams( methodDescription, request ); 94 95 if( methodDescription.isRequestMandatory() ) 96 params[params.length - 1] = request; 83 97 84 98 final Object result; -
tapas/web/src/messages_en.properties
r404 r406 1 1 inWork=Work in progress.. 2 2 language=English 3 label.language.to.en=French 4 label.language.to.fr=English 5 label.language=Language 3 label.language.to.switch=French 4 label.language.value.to.switch=fr 6 5 7 6 app.title=Tapas -
tapas/web/src/messages_fr.properties
r404 r406 1 1 inWork=Page en cours de construction.. 2 2 language=Français 3 label.language.to.en=Français 4 label.language.to.fr=Anglais 5 label.language=Langue 3 label.language.to.switch=Anglais 4 label.language.value.to.switch=en 6 5 7 6 app.title=Tapas
Note: See TracChangeset
for help on using the changeset viewer.