public void onModuleLoad() { RootPanel RootTXOriginal = RootPanel.get("Original"); RootPanel RootMenu = RootPanel.get("Menu"); RootTXOriginal.setSize("100%", "100%"); RootMenu.setStyleName("Root"); RootTXOriginal.setStyleName("Root"); MenuBar menuBar = new MenuBar(false); RootMenu.add(menuBar); menuBar.setWidth("100%"); mntmNewItem = new MenuItem("New item", false, (Command) null); mntmNewItem.setEnabled(false); mntmNewItem.setHTML("Language Editor : " + LenguajeActual.getName()); menuBar.addItem(mntmNewItem); MenuItemSeparator separator = new MenuItemSeparator(); menuBar.addSeparator(separator); MenuItem mntmNewItem_2 = new MenuItem( "New item", false, new Command() { public void execute() { int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget(); Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget); { ((PanelDecorador) WidgetActual).saveAll(); } } }); mntmNewItem_2.setHTML("Save"); menuBar.addItem(mntmNewItem_2); MenuItemSeparator separator_1 = new MenuItemSeparator(); menuBar.addSeparator(separator_1); MenuItem mntmNewItem_1 = new MenuItem( "New item", false, new Command() { public void execute() { int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget(); // Window.alert(Integer.toString(actual_widget2)); // int actual_widget=event.getItem(); // Window.alert(Integer.toString(actual_widget)); Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget); if (!((PanelDecorador) WidgetActual).isSaved()) if (Window.confirm( "The tab is modificated and not saved, Do you want to save the modification")) { ((PanelDecorador) WidgetActual).saveAll(); } Controlador.change2AdminLenguaje(); } }); mntmNewItem_1.setHTML("Back"); menuBar.addItem(mntmNewItem_1); decoratedTabPanel = new DecoratedTabPanel(); RootTXOriginal.add(decoratedTabPanel); decoratedTabPanel.setSize("100%", "100%"); String tamano = "875px"; // Esta encima porque sino salta error al setear la tab del decorador. MainWindowEditor MWE = new MainWindowEditor(LenguajeActual); decoratedTabPanel.add(MWE, "Main Window", true); MWE.setWidth(tamano); // Debajo de la declaracion sino da IndexOutOfBounds decoratedTabPanel.selectTab(0); // Ollente para pasar de pestaƱa decoratedTabPanel.addBeforeSelectionHandler( new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { int actual_widget = decoratedTabPanel.getDeckPanel().getVisibleWidget(); // Window.alert(Integer.toString(actual_widget2)); // int actual_widget=event.getItem(); // Window.alert(Integer.toString(actual_widget)); Widget WidgetActual = decoratedTabPanel.getDeckPanel().getWidget(actual_widget); if (!((PanelDecorador) WidgetActual).isSaved()) if (Window.confirm( "The tab is modificated and not saved, Do you want to save the modification")) ((PanelDecorador) WidgetActual).saveAll(); } }); SpecificationsEditor Specifications = new SpecificationsEditor(LenguajeActual); decoratedTabPanel.add(Specifications, "Specifications", true); Specifications.setWidth(tamano); FilterEditor Filter = new FilterEditor(LenguajeActual); decoratedTabPanel.add(Filter, "Filter", true); Filter.setWidth(tamano); AnnotationEditor Anotation = new AnnotationEditor(LenguajeActual); decoratedTabPanel.add(Anotation, "Annotation", true); Anotation.setWidth(tamano); BrowserEditor Browser = new BrowserEditor(LenguajeActual); decoratedTabPanel.add(Browser, "Browser", true); Browser.setWidth(tamano); VariosEditor varios = new VariosEditor(LenguajeActual); decoratedTabPanel.add(varios, "Others", true); varios.setWidth(tamano); }
public void onModuleLoad() { RootPanel RootTXOriginal = RootPanel.get(); RootPanel RootMenu = RootPanel.get("Menu"); RootTXOriginal.setSize("100%", "100%"); RootMenu.setStyleName("Root"); RootTXOriginal.setStyleName("Root"); YO = this; MenuBar menuBar = new MenuBar(false); RootMenu.add(menuBar); menuBar.setWidth("100%"); MenuItem menuItem = new MenuItem("GroupAdministration", false, (Command) null); menuItem.setHTML("Users Administrator"); menuItem.setEnabled(false); menuBar.addItem(menuItem); MenuItemSeparator separator = new MenuItemSeparator(); menuBar.addSeparator(separator); MenuItem mntmBack = new MenuItem( "Back", false, new Command() { public void execute() { Controlador.change2Administrator(); } }); menuBar.addItem(mntmBack); MenuItem AddLots = new MenuItem( "Masive add", false, new Command() { public void execute() { PanelAddMasibo PAM = new PanelAddMasibo(YO); PAM.setVisible(true); PAM.center(); } }); AddLots.setHTML("Masive add"); menuBar.addItem(AddLots); HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel(); RootTXOriginal.add(horizontalSplitPanel, 0, 25); horizontalSplitPanel.setSize("100%", "100%"); VerticalPanel verticalPanel = new VerticalPanel(); horizontalSplitPanel.setLeftWidget(verticalPanel); verticalPanel.setSize("100%", ""); SimplePanel simplePanel = new SimplePanel(); verticalPanel.add(simplePanel); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); simplePanel.setWidget(horizontalPanel); horizontalPanel.setSize("100%", "100%"); textBox = new TextBox(); textBox.setVisibleLength(50); horizontalPanel.add(textBox); textBox.setWidth("90%"); Button btnNewButton = new Button("New button"); btnNewButton.setText("+"); btnNewButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonCenter"); } }); btnNewButton.addMouseDownHandler( new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonCenterPush"); } }); btnNewButton.addMouseOutHandler( new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonCenter"); } }); btnNewButton.addMouseOverHandler( new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonCenterOver"); } }); btnNewButton.setStyleName("gwt-ButtonCenter"); btnNewButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { String S = ClearText(textBox.getText()); if (isValidEmail(S)) addText(S); else Window.alert(ErrorConstants.ERROR_NO_EMAIL_VALIDO + S); textBox.setText(""); } private native boolean isValidEmail(String email) /*-{ var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid return !reg1.test(email) && reg2.test(email); }-*/; }); horizontalPanel.add(btnNewButton); btnNewButton.setWidth("66px"); btnNewButton.setHTML("+"); verticalPanel_1 = new VerticalPanel(); verticalPanel.add(verticalPanel_1); verticalPanel_1.setWidth("100%"); SaveNewUsers = new Button("Save New Users"); SaveNewUsers.setVisible(false); SaveNewUsers.addClickHandler( new ClickHandler() { private AsyncCallback<Boolean> callback; public void onClick(ClickEvent event) { Pilallamada = new Stack<UserApp>(); int Elementos_a_salvar = verticalPanel_1.getWidgetCount(); for (int i = 0; i < Elementos_a_salvar; i++) { Widget Uno = verticalPanel_1.getWidget(i); Button Dos = (Button) Uno; String Nombre = Dos.getText(); Pilallamada.add(new UserApp(Nombre, Constants.STUDENT)); } if (!Pilallamada.isEmpty()) { callback = new AsyncCallback<Boolean>() { public void onFailure(Throwable caught) { Window.alert("The user could not be saved at this moment"); LoadingPanel.getInstance().hide(); } public void onSuccess(Boolean result) { LoadingPanel.getInstance().hide(); if (!result) Window.alert( "The user " + Pilallamada.peek().getEmail() + " already exists (if you do not see him/her it's because he may be administrator)"); Pilallamada.pop(); if (!Pilallamada.isEmpty()) { LoadingPanel.getInstance().center(); LoadingPanel.getInstance().setLabelTexto("Saving..."); bookReaderServiceHolder.saveUser(Pilallamada.peek(), callback); } else { refreshPanel(); } } }; LoadingPanel.getInstance().center(); LoadingPanel.getInstance().setLabelTexto("Saving..."); bookReaderServiceHolder.saveUser(Pilallamada.peek(), callback); } verticalPanel_1.clear(); SaveNewUsers.setVisible(false); } }); SaveNewUsers.addMouseDownHandler( new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSavePush"); } }); SaveNewUsers.addMouseOutHandler( new MouseOutHandler() { public void onMouseOut(MouseOutEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSave"); } }); SaveNewUsers.addMouseOverHandler( new MouseOverHandler() { public void onMouseOver(MouseOverEvent event) { ((Button) event.getSource()).setStyleName("gwt-ButtonBottonSaveOver"); } }); SaveNewUsers.setStyleName("gwt-ButtonBottonSave"); // SaveNewUsers.setStyleName("gwt-MenuItemMio"); verticalPanel.add(SaveNewUsers); SaveNewUsers.setSize("100%", "100%"); ScrollPanel scrollPanel = new ScrollPanel(); horizontalSplitPanel.setRightWidget(scrollPanel); scrollPanel.setSize("100%", "100%"); stackPanel_1 = new StackPanelMio(); scrollPanel.setWidget(stackPanel_1); // simplePanel.add(stackPanel_1); stackPanel_1.setBotonTipo(new BotonesStackPanelUsersMio("prototipo", new VerticalPanel())); stackPanel_1.setBotonClick( new ClickHandler() { public void onClick(ClickEvent event) { Long Nombre = ((BotonesStackPanelUsersMio) event.getSource()).getEntidad().getID(); LoadingPanel.getInstance().center(); LoadingPanel.getInstance().setLabelTexto("Loading..."); bookReaderServiceHolder.loadUserById( Nombre, new AsyncCallback<UserApp>() { public void onFailure(Throwable caught) { LoadingPanel.getInstance().hide(); } public void onSuccess(UserApp result) { LoadingPanel.getInstance().hide(); if (result.getGroupIds() == null) result.setGroupIds(new ArrayList<Long>()); if (!result.getGroupIds().isEmpty()) if (Window.confirm( InformationConstants.ARE_YOU_SURE_DELETE_USER + result.getGroupIds().size() + InformationConstants.ARE_YOU_SURE_DELETE_USER2)) remove(result.getId()); else { } else { if (Window.confirm( "Are you sure you want to delete this user?, he is not a member of any group")) remove(result.getId()); } } }); } private void remove(Long userId) { LoadingPanel.getInstance().center(); LoadingPanel.getInstance().setLabelTexto("Deleting..."); bookReaderServiceHolder.deleteUserApp( userId, new AsyncCallback<Integer>() { public void onFailure(Throwable caught) { LoadingPanel.getInstance().hide(); Window.alert("Sorry but the user could not be removed, try again later"); } public void onSuccess(Integer result) { LoadingPanel.getInstance().hide(); refreshPanel(); } }); } }); LoadingPanel.getInstance().center(); LoadingPanel.getInstance().setLabelTexto("Loading..."); bookReaderServiceHolder.getUsersApp( new AsyncCallback<ArrayList<UserApp>>() { public void onFailure(Throwable caught) { LoadingPanel.getInstance().hide(); } public void onSuccess(ArrayList<UserApp> result) { LoadingPanel.getInstance().hide(); if (result.size() < 10) { for (UserApp User1 : result) { String Bienvenida; if ((User1.getName() != null) && (!User1.getName().isEmpty())) Bienvenida = User1.getName(); else Bienvenida = User1.getEmail(); EntidadUser E = new EntidadUser(Bienvenida, User1.getId()); stackPanel_1.addBotonLessTen(E); } } else { for (UserApp User1 : result) { String Bienvenida; if ((User1.getName() != null) && (!User1.getName().isEmpty())) Bienvenida = User1.getName(); else Bienvenida = User1.getEmail(); EntidadUser E = new EntidadUser(Bienvenida, User1.getId()); stackPanel_1.addBoton(E); } } stackPanel_1.setSize("100%", "100%"); stackPanel_1.ClearEmpty(); } }); stackPanel_1.setSize("100%", "100%"); }