Skip to content

Commit fb19cd2

Browse files
javierParamojavierParamo
javierParamo
authored and
javierParamo
committed
Version 1.0
1 parent 472fa3c commit fb19cd2

File tree

190 files changed

+366
-380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+366
-380
lines changed

Aplicacion/Thoth-Web/src/src/client/GrammarService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ public interface GrammarService extends RemoteService {
3030
* @return
3131
*/
3232
public Grammar checkContent(String grammar);
33-
}
33+
}//GrammarService

Aplicacion/Thoth-Web/src/src/client/GrammarServiceAsync.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ public interface GrammarServiceAsync {
2626
* @param callback
2727
*/
2828
void checkContent(String grammar, AsyncCallback callback);
29-
}
29+
}//GrammarServiceAsync

Aplicacion/Thoth-Web/src/src/client/GrammarServiceClientImp.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import src.client.gui.mainGui;
55

66
import com.google.gwt.core.shared.GWT;
7+
import com.google.gwt.user.client.Window;
78
import com.google.gwt.user.client.rpc.AsyncCallback;
89
import com.google.gwt.user.client.rpc.ServiceDefTarget;
910

@@ -21,7 +22,7 @@
2122
public class GrammarServiceClientImp {
2223

2324
/**
24-
*
25+
* Servicio
2526
*/
2627
private GrammarServiceAsync service;
2728

@@ -42,7 +43,7 @@ public GrammarServiceClientImp(String url) {
4243
endpoint.setServiceEntryPoint(url);
4344

4445
this.mainGUI = new mainGui(this);
45-
}//GrammarServiceClientImp
46+
}// GrammarServiceClientImp
4647

4748
/**
4849
* Contructor de GrammarService en el lado del cliente al que se le pasa
@@ -59,7 +60,7 @@ public GrammarServiceClientImp(String url, Grammar grammar) {
5960
endpoint.setServiceEntryPoint(url);
6061

6162
this.mainGUI = new mainGui(this, grammar);
62-
}//GrammarServiceClientImp
63+
}// GrammarServiceClientImp
6364

6465
/**
6566
* Contructor de GrammarService en el lado del cliente al que se le pasa
@@ -76,29 +77,32 @@ public GrammarServiceClientImp(String url, String grammarText) {
7677
endpoint.setServiceEntryPoint(url);
7778

7879
this.mainGUI = new mainGui(this, grammarText);
79-
}//GrammarServiceClientImp
80+
}// GrammarServiceClientImp
8081

8182
/**
8283
* Función de ayuda que llama a la clase mainGui.
8384
*
8485
* @return intancia de la clase.
8586
*/
86-
public mainGui getManGUI(){
87+
public mainGui getManGUI() {
8788
return this.mainGUI;
8889
}
89-
90+
9091
/**
9192
* Checkeo del contenido en el textArea de mainGui realiza la peticion al
9293
* servidor.
9394
*
94-
* @param grammar gramatica a checkear.
95+
* @param grammar
96+
* gramatica a checkear.
9597
*/
9698
public void checkContent(String grammar) {
9799
this.service.checkContent(grammar, new AsyncCallback<Object>() {
98100

99101
@Override
100102
public void onFailure(Throwable caught) {
101-
System.out.println("Ha ocurrido un error");
103+
104+
if (caught instanceof Exception)
105+
Window.alert("Eroooorororororor!");
102106

103107
}
104108

@@ -109,11 +113,9 @@ public void onSuccess(Object result) {
109113
mainGUI.updateLabel(grammar);
110114
}
111115

112-
if (result instanceof Exception) {
113-
System.out.println("Ha ocurrido un error");
114-
}
115116
}
116117

117118
});
118-
}//checkContent
119-
}//GrammarServiceClientImp
119+
}// checkContent
120+
121+
}// GrammarServiceClientImp

Aplicacion/Thoth-Web/src/src/client/gui/mainGui.java

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import src.client.core.grammar.TypeHandler;
66
import src.client.gui.mediator.MediatorClear;
77
import src.client.gui.mediator.MediatorRecursive;
8+
import src.client.gui.utils.AboutDialog;
89
import src.client.gui.utils.CommandLang;
910
import src.client.gui.utils.MessageMessages;
1011
import src.client.gui.utils.RenameSymbolDialog;
@@ -133,7 +134,7 @@ public class mainGui extends Composite {
133134
/**
134135
* Texto inicial del TextArea
135136
*/
136-
public static String INITIAL_TEXT = "% start \n%%\n\n\n\n%%\n";
137+
public static String INITIAL_TEXT = "% start --Axioma \n%%\n\n--Producciones\n\n%%\n";
137138

138139
// Methods
139140
// -----------------------------------------------------------------------
@@ -284,17 +285,19 @@ private class BtnCheckHandler implements ClickHandler {
284285
public void onClick(ClickEvent event) {
285286
String textcheck = grammarArea.getText();
286287
serviceImp.checkContent(textcheck);
287-
288-
regService.grammarReg(grammarArea.getText(), new AsyncCallback<Object>() {
289-
//Fallo, mensaje de error.
290-
public void onFailure(Throwable caught) {
291288

292-
}
293-
//Exito
294-
public void onSuccess(Object user) {
289+
regService.grammarReg(grammarArea.getText(),
290+
new AsyncCallback<Object>() {
291+
// Fallo, mensaje de error.
292+
public void onFailure(Throwable caught) {
295293

296-
}
297-
});
294+
}
295+
296+
// Éxito
297+
public void onSuccess(Object user) {
298+
;
299+
}
300+
});
298301
}
299302
}// BtnCheckHandler
300303

@@ -313,6 +316,8 @@ public void onClick(ClickEvent event) {
313316
}
314317
}// BtnRenameHandler
315318

319+
public int var = 0;
320+
316321
/**
317322
* Actualiza la gramática asociada al panel.<br>
318323
* Actualiza las propiedades de la gramática que se muestran en la parte
@@ -355,23 +360,10 @@ public void updateLabel(Grammar grammar) {
355360
*/
356361
private void buildMenuBar() {
357362

358-
Command cmd = new Command() {
359-
public void execute() {
360-
Window.alert("You selected a menu item!");
361-
362-
}
363-
};
364-
365-
Command download = new Command() {
366-
public void execute() {
367-
Window.open("http://127.0.0.1:8888/file.rar", "_self",
368-
"enabled");
369-
}
370-
};
371-
363+
// Info del proyecto
372364
Command about = new Command() {
373365
public void execute() {
374-
Window.Location.replace("http://thoth-project.herokuapp.com/");
366+
new AboutDialog();
375367
}
376368
};
377369

@@ -386,9 +378,9 @@ public void execute() {
386378
public void execute() {
387379
serviceImp.checkContent(grammarArea.getText());
388380
if (mGrammar.getType() == TypeHandler.CHOMSKY
389-
|| mGrammar.getType() == TypeHandler.DEPENDENT)
381+
|| mGrammar.getType() == TypeHandler.DEPENDENT) {
390382
ShowDialog.incorrectTypeGrammar();
391-
else {
383+
} else {
392384

393385
openSNT();
394386
}
@@ -640,12 +632,11 @@ public void onClick(ClickEvent event) {
640632
MenuBar helpMenu = new MenuBar(true);
641633
helpMenu.addItem(mMsg.about(), about);
642634

643-
menu.addItem(mMsg.help(), helpMenu);
644-
menu.addSeparator();
645635
menu.addItem(mMsg.algorithms(), algorithmMenu);
646636
menu.addSeparator();
647637
menu.addItem(mMsg.language(), selectIdiom);
648-
638+
menu.addSeparator();
639+
menu.addItem(mMsg.help(), helpMenu);
649640

650641
// salida de sessión con nombre del usuario
651642
getUserName();
@@ -690,7 +681,7 @@ public void writeUserName(String name) {
690681
logoutMenu.addItem("Logout", logoutFunction);
691682

692683
menu.addSeparator();
693-
menu.addItem(name, logoutMenu);
684+
menu.addItem(mMsg.user() + " " + name, logoutMenu);
694685
}// writeUserName
695686

696687
/**
@@ -716,6 +707,7 @@ public void onSuccess(Object result) {
716707

717708
// Elimina Símbolos no Terminales
718709
public void openSNT() {
710+
// checkOnAlgortihm();
719711
editorGrammarPanel.clear();
720712
barMenuPanel.clear();
721713
new VisualSNT(mGrammar);
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
package src.client.gui.utils;
2+
3+
import com.google.gwt.core.shared.GWT;
4+
import com.google.gwt.event.dom.client.ClickEvent;
5+
import com.google.gwt.event.dom.client.ClickHandler;
6+
import com.google.gwt.user.client.Window;
7+
import com.google.gwt.user.client.ui.Anchor;
8+
import com.google.gwt.user.client.ui.Button;
9+
import com.google.gwt.user.client.ui.DialogBox;
10+
import com.google.gwt.user.client.ui.HTML;
11+
import com.google.gwt.user.client.ui.HorizontalPanel;
12+
import com.google.gwt.user.client.ui.Image;
13+
import com.google.gwt.user.client.ui.PushButton;
14+
import com.google.gwt.user.client.ui.VerticalPanel;
15+
16+
/**
17+
* <b>Descripción</b><br>
18+
* Clase para mostrar el Acerca de...
19+
* <p>
20+
* <b>Detalles</b><br>
21+
* Se trata de un popup panel que muestra los datos de los autores.
22+
* </p>
23+
*
24+
* @author Francisco Javier Páramo Arnáiz
25+
* @version 1.0
26+
*/
27+
public class AboutDialog extends DialogBox {
28+
29+
// Attributes
30+
// -----------------------------------------------------------------
31+
32+
/**
33+
* Variable para la internacionalización de los textos
34+
*/
35+
private MessageMessages mMsg = GWT.create(MessageMessages.class);
36+
37+
/**
38+
* Botón aceptar para realizar el renombrado.
39+
*/
40+
private Button mAccept;
41+
42+
/**
43+
* Botón para el enlace del proyecto en gitHub
44+
*/
45+
private PushButton btnGuit;
46+
47+
// Methods
48+
// -----------------------------------------------------------------
49+
50+
/**
51+
* Constructor completo del DialogBox con info del proyecto.
52+
*
53+
*/
54+
public AboutDialog() {
55+
56+
// características del recuadro de diálogo.
57+
setText(mMsg.about());
58+
setAnimationEnabled(true);
59+
setGlassEnabled(true);
60+
center();
61+
// Panel donde van colocados los elementos
62+
VerticalPanel aboutTextPanel = new VerticalPanel();
63+
VerticalPanel generalPanel = new VerticalPanel();
64+
HorizontalPanel topPanel = new HorizontalPanel();
65+
HorizontalPanel coopPanel = new HorizontalPanel();
66+
HorizontalPanel buttonPanel = new HorizontalPanel();
67+
68+
HorizontalPanel authorPanel = new HorizontalPanel();
69+
HTML author = new HTML (mMsg.author());
70+
author.setStyleName("header");
71+
authorPanel.add(author);
72+
73+
HorizontalPanel tutorsPanel = new HorizontalPanel();
74+
HTML tutors = new HTML (mMsg.tutors());
75+
tutors.setStyleName("header");
76+
tutorsPanel.add(tutors);
77+
78+
topPanel.setSpacing(10);
79+
coopPanel.setSpacing(10);
80+
buttonPanel.setSpacing(10);
81+
82+
HTML about = new HTML("Project developed by:");
83+
about.setStyleName("Panel-Text");
84+
85+
// Enlaces a los correos de los autores
86+
Anchor linkAlumn = new Anchor("Francisco Javier Páramo Arnaiz", false,
87+
"mailto:fpa0019@alu.ubu.es");
88+
89+
Anchor linkTutor1 = new Anchor("D. Álvar Arnaiz González", false,
90+
"mailto:alvarag@ubu.es");
91+
Anchor linkTutor2 = new Anchor("Dr. César Ignacio García Osorio",
92+
false, "mailto:cgosorio@ubu.es");
93+
94+
btnGuit = new PushButton(new Image("/images/github.png"));
95+
96+
97+
topPanel.add(btnGuit);
98+
topPanel.add(about);
99+
authorPanel.add(linkAlumn);
100+
101+
tutorsPanel.add(linkTutor1);
102+
tutorsPanel.add(linkTutor2);
103+
aboutTextPanel.add(topPanel);
104+
coopPanel.add(authorPanel);
105+
coopPanel.add(tutorsPanel);
106+
aboutTextPanel.add(coopPanel);
107+
// Botón
108+
mAccept = new Button(mMsg.accept());
109+
buttonPanel.add(mAccept);
110+
111+
generalPanel.add(aboutTextPanel);
112+
generalPanel.add(buttonPanel);
113+
setWidget(generalPanel);
114+
115+
buildListeners();
116+
}// AboutDialog
117+
118+
/**
119+
* Asigna la funcionalidad de los botones.
120+
*/
121+
public void buildListeners() {
122+
// Botón aceptar.
123+
mAccept.addClickHandler(new ClickHandler() {
124+
public void onClick(ClickEvent event) {
125+
AboutDialog.this.hide();
126+
}
127+
});
128+
// Botón de gitHub
129+
btnGuit.addClickHandler(new ClickHandler() {
130+
public void onClick(ClickEvent event) {
131+
Window.open(
132+
"https://github.com/javierParamo94/Thoth-in-JavaScript",
133+
"_blank", "");
134+
}
135+
});
136+
137+
}// buildListeners
138+
}// AboutDialog
139+

0 commit comments

Comments
 (0)