1919import src .client .gui .visual .VisualSNA ;
2020import src .client .gui .visual .VisualSNT ;
2121import src .client .gui .visual .VisualTasp ;
22+ import src .client .register .request .RegistrationService ;
23+ import src .client .register .request .RegistrationServiceAsync ;
2224
2325import com .google .gwt .core .shared .GWT ;
2426import com .google .gwt .event .dom .client .ClickEvent ;
2527import com .google .gwt .event .dom .client .ClickHandler ;
28+ import com .google .gwt .user .client .rpc .AsyncCallback ;
2629import com .google .gwt .user .client .ui .Button ;
2730import com .google .gwt .user .client .ui .Composite ;
2831import com .google .gwt .user .client .ui .DialogBox ;
4043import com .google .gwt .user .client .Command ;
4144import com .google .gwt .user .client .Window ;
4245
46+ /**
47+ *
48+ * @author User
49+ *
50+ */
4351public class mainGui extends Composite {
4452
4553 // Attributes
@@ -52,8 +60,10 @@ public class mainGui extends Composite {
5260 private HorizontalPanel hPanel3 = new HorizontalPanel ();
5361 private TextBox txt1 , txt2 , txt3 , txt4 , txt5 ;
5462 private FlexTable stocksFlexTable = new FlexTable ();
55- private mainGui mVisual = this ;
63+ private mainGui mVisual = this ;
5664
65+ private RegistrationServiceAsync loginService = GWT
66+ .create (RegistrationService .class );
5767 DockPanel dockPanel = new DockPanel ();
5868
5969 /**
@@ -79,20 +89,21 @@ public class mainGui extends Composite {
7989 */
8090 public static String INITIAL_TEXT = "% start \n %%\n \n \n \n %%\n " ;
8191
82- // Methods
92+ // Methods
8393 // -----------------------------------------------------------------------
8494 /**
8595 * Constructor del panel de gramáticas al que se le pasa el servicio.
8696 *
87- * @param serviceImp Implementacion del servicio.
97+ * @param serviceImp
98+ * Implementacion del servicio.
8899 */
89100 public mainGui (GrammarServiceClientImp serviceImp ) {
90101 buildMenuBar ();
91102 buildGrammarPanel (serviceImp );
92- //Añadimos los elementos al panel raiz.
103+ // Añadimos los elementos al panel raiz.
93104 RootPanel .get ().add (barMenuPanel );
94105 RootPanel .get ().add (editorGrammarPanel );
95- }//manGui
106+ }// manGui
96107
97108 /**
98109 * Constructor del panel de gramáticas al que se le pasa la gramática.
@@ -107,7 +118,7 @@ public mainGui(GrammarServiceClientImp serviceImp, Grammar grammar) {
107118 mGrammar = grammar ;
108119 grammarArea .setText (grammar .toString ());
109120 }// mainGui
110-
121+
111122 /**
112123 *
113124 * @param serviceImp
@@ -195,7 +206,7 @@ private void buildGrammarPanel(GrammarServiceClientImp serviceImp) {
195206 dockPanel .add (vPanel2 , DockPanel .WEST );
196207
197208 editorGrammarPanel .add (dockPanel );
198- }//buildGrammarPanel
209+ }// buildGrammarPanel
199210
200211 /**
201212 *
@@ -209,7 +220,7 @@ public void onClick(ClickEvent event) {
209220 String textcheck = grammarArea .getText ();
210221 serviceImp .checkContent (textcheck );
211222 }
212- }//Btn1ClickHandler
223+ }// Btn1ClickHandler
213224
214225 /**
215226 * Renombrar
@@ -223,12 +234,9 @@ public void onClick(ClickEvent event) {
223234 String textcheck = grammarArea .getText ();
224235 serviceImp .checkContent (textcheck );
225236 new RenameSymbolDialog (mVisual , mGrammar ).show ();
226-
227237 }
228238 }
229239
230-
231-
232240 /**
233241 *
234242 * @param grammar
@@ -240,7 +248,18 @@ public void updateLabel(Grammar grammar) {
240248
241249 term = term .substring (1 , term .length () - 1 );
242250 noTerm = noTerm .substring (1 , noTerm .length () - 1 );
251+ /* loginService.userAction(new AsyncCallback() {
252+ @Override
253+ public void onFailure(Throwable caught) {
254+ Window.alert("Error ");
255+ }
256+
257+ @Override
258+ public void onSuccess(Object result) {
259+ Window.alert("Acierto ");
243260
261+ }
262+ });*/
244263 mGrammar = grammar ;
245264 txt2 .setText (((Integer ) grammar .getProductions ().size ()).toString ());
246265 txt3 .setText (grammar .getAxiom ().toString ());
@@ -260,7 +279,7 @@ public void updateLabel(Grammar grammar) {
260279 txt1 .setText (sms .regular ());
261280 break ;
262281 }
263- }//updateLabel
282+ }// updateLabel
264283
265284 /**
266285 *
@@ -273,31 +292,33 @@ public void execute() {
273292
274293 }
275294 };
276-
295+
277296 Command download = new Command () {
278297 public void execute () {
279- //String url = GWT.getModuleBaseURL() + "downloadService?fileInfo1=" + fileInfo1;
280- //Window.open( url, "_blank", "status=0,toolbar=0,menubar=0,location=0");
281- //Window.open(GWT.getHostPageBaseURL() + "/file.rar", "name", "enabled");
282- Window .open ("http://127.0.0.1:8888/file.rar" , "_self" , "enabled" );
298+ // String url = GWT.getModuleBaseURL() +
299+ // "downloadService?fileInfo1=" + fileInfo1;
300+ // Window.open( url, "_blank",
301+ // "status=0,toolbar=0,menubar=0,location=0");
302+ // Window.open(GWT.getHostPageBaseURL() + "/file.rar", "name",
303+ // "enabled");
304+ Window .open ("http://127.0.0.1:8888/file.rar" , "_self" ,
305+ "enabled" );
283306
284307 }
285308 };
286-
309+
287310 Command about = new Command () {
288311 public void execute () {
289312 Window .Location .replace ("http://thoth-project.herokuapp.com/" );
290313 }
291314 };
292-
293315
294- //Cambio de idioma
316+ // Cambio de idioma
295317 CommandLang spanish = new CommandLang ("es" );
296318 CommandLang deutschland = new CommandLang ("de" );
297319 CommandLang french = new CommandLang ("fr" );
298- CommandLang english = new CommandLang ("en" );
320+ CommandLang english = new CommandLang ("en" );
299321
300-
301322 Command eliminate_SNT = new Command () {
302323 public void execute () {
303324 serviceImp .checkContent (grammarArea .getText ());
@@ -513,7 +534,7 @@ public void onClick(ClickEvent event) {
513534 }
514535 }
515536 };
516-
537+
517538 MenuBar fooMenu = new MenuBar (true );
518539 fooMenu .addItem ("Abrir" , cmd );
519540 fooMenu .addItem ("Guardar" , download );
@@ -543,14 +564,14 @@ public void onClick(ClickEvent event) {
543564 algorithmMenu .addItem (sms .tasp (), tasp );
544565
545566 MenuBar selectIdiom = new MenuBar (true );
546- selectIdiom .addItem ("Castellano" , spanish );//Command(spanish));
567+ selectIdiom .addItem ("Castellano" , spanish );// Command(spanish));
547568 selectIdiom .addItem ("Deutsch" , deutschland );
548569 selectIdiom .addItem ("Français" , french );
549570 selectIdiom .addItem ("English" , english );
550571
551572 MenuBar helpMenu = new MenuBar (true );
552573 helpMenu .addItem (sms .about (), about );
553-
574+
554575 MenuBar menu = new MenuBar ();
555576 menu .addItem (sms .file (), fooMenu );
556577 menu .addSeparator ();
@@ -634,6 +655,7 @@ public void openFiFo() {
634655 barMenuPanel .clear ();
635656 new VisualFirstFollow (mGrammar );
636657 }
658+
637659 // TASP
638660 public void openTASP () {
639661 editorGrammarPanel .clear ();
0 commit comments