Author: mfortun Date: 2011-08-30 14:32:15 +0200 (Tue, 30 Aug 2011) New Revision: 1207 Url: http://nuiton.org/repositories/revision/wikitty/1207 Log: *complete how to doc *add some feature into example Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/PublicationContext.java trunk/wikitty-publication/src/site/doc/Faire_une_application_publication.rst trunk/wikitty-publication/src/site/exemple/resourceAppli/src/main/wp/view.htmljs Modified: trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/PublicationContext.java =================================================================== --- trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/PublicationContext.java 2011-08-30 12:19:40 UTC (rev 1206) +++ trunk/wikitty-publication/src/main/java/org/nuiton/wikitty/publication/PublicationContext.java 2011-08-30 12:32:15 UTC (rev 1207) @@ -20,6 +20,10 @@ HttpServletResponse getResponse(); + /** + * the current wikitty proxy + * @return + */ WikittyProxy getWikittyProxy(); /** @@ -28,21 +32,43 @@ * @return */ String makeUrl(String url); - + + /** + * the current wikitty service + * @return + */ WikittyService getWikittyService(); List<String> getMandatoryArguments(); String getArgument(String name); + /** + * Get + * @param name + * @param defaultValue + * @return + */ String getArgument(String name, String defaultValue); + /** + * return the actual return content tye for the page + * @return + */ String getContentType(); + /** + * Set the content type for the return page + * @param contentType + */ void setContentType(String contentType); String toString(); + /** + * the map of the arguments in the context + * @return + */ Map<String,String> getArguments(); } \ No newline at end of file Modified: trunk/wikitty-publication/src/site/doc/Faire_une_application_publication.rst =================================================================== --- trunk/wikitty-publication/src/site/doc/Faire_une_application_publication.rst 2011-08-30 12:19:40 UTC (rev 1206) +++ trunk/wikitty-publication/src/site/doc/Faire_une_application_publication.rst 2011-08-30 12:32:15 UTC (rev 1207) @@ -56,38 +56,125 @@ Interface d'édition: - /[contextData]/edit/.action (avec contextData ce qu'on veut, voir la partie sur le war pour savoir à quoi cela correspond) + * /[contextData]/edit/.action (avec contextData ce qu'on veut, voir la partie sur le war pour savoir à quoi cela correspond) -Quoi mettre dans le code ? --------------------------- +Quoi mettre dans les WikittyPubTex ? +------------------------------------ +Dans le WikittyPubText, le contenu doit être écrit dans le langage correspondant +au mime type. -En quoi l'écrire -**************** +Mais ce n'est pas tout on peut rajouter des éléments issues du binding, qui +est un mécanisme qui permet d'utiliser du java à l'intérieur du code. +Il est possible de faire des interfaces graphique en html, soit en intégrant +le hmtl directement dans le code dans une variable de retour, soit en utilisant +le mécanisme de filtre et des Mime types composé. +par exemple le mime type: + * text/html.javascript signifie que on a du html et que entre les balises <% %> ou <%= %> est du javascript -Langage le bon mime type +Voir partie sur l'ajout de langage et le fonctionnement des filtres pour l'évaluation. - -faire des UI - Bindings ******** +Le mécanisme de binding permet l'import de classe java, l'invocation de méthode +et plein d'autre chose. -Les bindings sont des éléments important dans +Import d'une classe (avec le script engine javascript) : + + * importPackage(org.nuiton.wikitty.entities); +Instanciation: + * var resource = new WikittyResourceImpl(); -Choses possibles avec les Bindings -********************************** +Invocation de méthode: + * resource.setName(wpContext.getArgument("nom")); +Par défaut il y a un certain nombre d'objet disponible en binding: + + * wpEval, correspond à l'instance de la classe java qui évalue couramment le WikittyPub, permet d'évaluer + * wpSubContext, correspond à l'instance de collection contenant + * wpPage, nom de la page + * wpWikitty, wikitty en cours d'évaluation + * wpContext, correspond à l'instance de la classe java du context (voir interface) +Interface de wpContext: + public interface PublicationContext { + HttpServletRequest getRequest(); + HttpServletResponse getResponse(); + + /** + * the current wikitty proxy + * @return + */ + WikittyProxy getWikittyProxy(); + /** + * add context to the url and parameter if necessary + * @param url + * @return + */ + String makeUrl(String url); + + /** + * the current wikitty service + * @return + */ + WikittyService getWikittyService(); + + List<String> getMandatoryArguments(); + + String getArgument(String name); + + /** + * Get + * @param name + * @param defaultValue + * @return + */ + String getArgument(String name, String defaultValue); + + /** + * return the actual return content tye for the page + * @return + */ + String getContentType(); + + /** + * Set the content type for the return page + * @param contentType + */ + void setContentType(String contentType); + + String toString(); + + /** + * the map of the arguments in the context + * @return + */ + Map<String,String> getArguments(); + + } + + +Par exemple + +Construit l'url de l'image en question pour l'affichage + + * <img src='<%=wpContext.makeUrl("/raw/wikittypubuml")%>'/> + + +Intégre le résultat de l'évaluation de Test entre les balises <p> + + * <p><%=wpEval.doAction(wpContext, "Test")%></p> + + Détails de l'exemple -------------------- Modified: trunk/wikitty-publication/src/site/exemple/resourceAppli/src/main/wp/view.htmljs =================================================================== --- trunk/wikitty-publication/src/site/exemple/resourceAppli/src/main/wp/view.htmljs 2011-08-30 12:19:40 UTC (rev 1206) +++ trunk/wikitty-publication/src/site/exemple/resourceAppli/src/main/wp/view.htmljs 2011-08-30 12:32:15 UTC (rev 1207) @@ -111,11 +111,13 @@ </form> +Diagramme uml de la relation: +<img src='<%=wpContext.makeUrl("/raw/wikittypubuml")%>'/> +Juste en dessous intégration du résultat de l'évaluation de WikittyPubText ja Test: +<p><%=wpEval.doAction(wpContext, "Test")%></p> - - </body> </html>