| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <!-- |
|---|
| 3 | Document : Docs |
|---|
| 4 | Created on : Nov 28, 2010, 1:55:24 PM |
|---|
| 5 | Author : hcarralero |
|---|
| 6 | --> |
|---|
| 7 | <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf"> |
|---|
| 8 | <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/> |
|---|
| 9 | <f:view> |
|---|
| 10 | <webuijsf:page id="page1"> |
|---|
| 11 | <webuijsf:html id="html1"> |
|---|
| 12 | <webuijsf:head id="head1" title="TOLJava-WebDEMO==> Documentación"> |
|---|
| 13 | <webuijsf:link id="link1" url="/resources/stylesheet.css"/> |
|---|
| 14 | <webuijsf:script type="text/javascript" url="sh/scripts/shCore.js"/> |
|---|
| 15 | <webuijsf:script type="text/javascript" url="sh/scripts/shBrushJava.js"/> |
|---|
| 16 | <webuijsf:link id="link2" rel="stylesheet" type="text/css" url="sh/styles/shCore.css"/> |
|---|
| 17 | <webuijsf:link id="link3" rel="stylesheet" type="text/css" url="sh/styles/shThemeDefault.css"/> |
|---|
| 18 | </webuijsf:head> |
|---|
| 19 | <webuijsf:body id="body1" style="background-color: rgb(224, 224, 255); -rave-layout: grid"> |
|---|
| 20 | <webuijsf:form id="form1"> |
|---|
| 21 | <div style="left: 0px; top: 0px; position: absolute; width: 100%"> |
|---|
| 22 | <jsp:directive.include file="Encabezado.jspf"/> |
|---|
| 23 | </div> |
|---|
| 24 | <div style="left: 2px; top: 68px; position: absolute; width: 200px"> |
|---|
| 25 | <jsp:directive.include file="MenuIzquierdo.jspf"/> |
|---|
| 26 | </div> |
|---|
| 27 | <h:panelGrid id="pnlDocs" style="border: 1px solid navy; left: 202px; top: 68px; position: absolute"> |
|---|
| 28 | <webuijsf:staticText id="staticText1" |
|---|
| 29 | style="border-bottom: solid navy 1px; background-color: rgb(204, 204, 255); color: navy; font-size: 18px; font-variant: small-caps; font-weight: bolder; height: 28px; text-align: center; width: 100%" text="Intérprete de TOLJava"/> |
|---|
| 30 | <webuijsf:tabSet id="tsInterprete" selected="tabCodigoFuente"> |
|---|
| 31 | <webuijsf:tab id="tabCodigoFuente" text="Intérprete"> |
|---|
| 32 | <h:panelGrid id="gridPanel2" style="border: 1px solid teal; height: 32px; text-align: left; width: 100%"> |
|---|
| 33 | <webuijsf:staticText id="staticText3" |
|---|
| 34 | style="border-bottom: solid navy 2px; background-color: rgb(155, 230, 251); color: navy; font-size: 14px; font-variant: small-caps; font-weight: bolder; height: 21px; text-align: left; width: 100%" text="Panel de Ejecución de Código TOL"/> |
|---|
| 35 | <webuijsf:label id="label1" text="Escriba el CÃDIGO TOL que desea EJECUTAR:"/> |
|---|
| 36 | <webuijsf:textArea binding="#{Interprete.taCodigo}" columns="96" id="taCodigo" rows="8"/> |
|---|
| 37 | <webuijsf:button actionExpression="#{Interprete.btnEjecutarCodigo_action}" id="btnEjecutarCodigo" text="Ejecutar el Código"/> |
|---|
| 38 | <webuijsf:staticText binding="#{Interprete.stxtResultadoEjecutar}" escape="false" id="stxtResultadoEjecutar"/> |
|---|
| 39 | </h:panelGrid> |
|---|
| 40 | </webuijsf:tab> |
|---|
| 41 | <webuijsf:tab id="tabCodigo" text="Código Fuente"> |
|---|
| 42 | <h:panelGrid id="gridPanel1" style="border: 1px solid teal; height: 32px; text-align: left; width: 100%"> |
|---|
| 43 | <webuijsf:staticText id="staticText2" |
|---|
| 44 | style="border-bottom: solid navy 2px; background-color: rgb(155, 230, 251); color: navy; font-size: 14px; font-variant: small-caps; font-weight: bolder; height: 21px; text-align: left; width: 100%" text="Panel de Revisión del Código Fuente"/> |
|---|
| 45 | <pre class="brush: java; highlight:[2, 5, 10]; toolbar: false;"> |
|---|
| 46 | //Se deben importar las clases a usar del paquete de TOLJava |
|---|
| 47 | import com.hcarralero.toljava.TOLMachine; |
|---|
| 48 | ... |
|---|
| 49 | //Se crea una instancia de TOLMachine, la cual nos sirve para acceder al Intérprete de TOL |
|---|
| 50 | TOLMachine tm= new TOLMachine(); |
|---|
| 51 | //Usamos una cadena para almacenar el código TOL a ejecutar |
|---|
| 52 | //En este caso la variable 'code' toma el código ingresado por el usuario en la caja de texto |
|---|
| 53 | String code= (String)this.taExpDemo01.getText(); |
|---|
| 54 | //Se ejecuta el código ingresado. El resultado es un arreglo de cadenas Object |
|---|
| 55 | res[]= tm.execute(code); |
|---|
| 56 | //La primera cadena representa el número de errores detectado por el Intérprete de TOL |
|---|
| 57 | String strNE= (String)res[0]; try { |
|---|
| 58 | //Usamos un método para convertir la cadena en un número |
|---|
| 59 | //ne contendrá el número de errores, 0 significa que no hubo errores |
|---|
| 60 | int ne= Integer.parse(strNE); |
|---|
| 61 | //El resto de los elementos son los mensajes producidos por el Intérprete de TOL |
|---|
| 62 | //Los mensajes |
|---|
| 63 | } catch (NumberFormatException ex) { |
|---|
| 64 | //Si se llega a este punto se habrá producido un error inesperado |
|---|
| 65 | } |
|---|
| 66 | </pre> |
|---|
| 67 | <webuijsf:script type="text/javascript"> |
|---|
| 68 | SyntaxHighlighter.all() |
|---|
| 69 | </webuijsf:script> |
|---|
| 70 | </h:panelGrid> |
|---|
| 71 | </webuijsf:tab> |
|---|
| 72 | </webuijsf:tabSet> |
|---|
| 73 | </h:panelGrid> |
|---|
| 74 | </webuijsf:form> |
|---|
| 75 | </webuijsf:body> |
|---|
| 76 | </webuijsf:html> |
|---|
| 77 | </webuijsf:page> |
|---|
| 78 | </f:view> |
|---|
| 79 | </jsp:root> |
|---|