@Override public void onModuleLoad() { addList(); mainPanel.setLeftWidget(listbox); setListitems(); listbox.setWidth("100%"); listbox.setHeight("100%"); listbox.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { String testcaseName = listbox.getItemText(listbox.getSelectedIndex()); TestcaseWrapper widget = map.get(testcaseName); widget.show(); panel.clear(); panel.add(widget); } }); mainPanel.setSplitPosition("300px"); mainPanel.setRightWidget(panel); RootPanel.get().add(mainPanel); }
private void onWindowResized(int height) { // Adjust the split panel to take up the available room in the window. int newHeight = height - splitPanel.getAbsoluteTop() - 44; if (newHeight < 1) newHeight = 1; splitPanel.setHeight("" + newHeight); inner.setHeight("" + newHeight); /*if(isFileListShowing()){ getFileList().setHeight("" + (newHeight-50)); }*/ }
@Override public void init(HorizontalSplitPanel panel) { this.panel = panel; final String fullSize = "100%"; super.init(panel); setHeight(panel.container, fullSize); setHeight(panel.getElement(LEFT), fullSize); setHeight(panel.getElement(RIGHT), fullSize); setHeight(panel.getSplitElement(), fullSize); }
public void init(HorizontalSplitPanel panel) { this.panel = panel; DOM.setStyleAttribute(panel.getElement(), "position", "relative"); expandToFitParentHorizontally(panel.getElement(LEFT)); expandToFitParentHorizontally(panel.getElement(RIGHT)); expandToFitParentHorizontally(panel.getSplitElement()); expandToFitParentUsingCssOffsets(panel.container); // Right now, both panes are stacked on top of each other // on either the left side or the right side of the containing // panel. This happens because both panes have position:absolute // and no left/top values. The panes will be on the left side // if the directionality is LTR, and on the right side if the // directionality is RTL. In the LTR case, we need to snap the // right pane to the right of the container, and in the RTL case, // we need to snap the left pane to the left of the container. if (LocaleInfo.getCurrentLocale().isRTL()) { setLeft(panel.getElement(LEFT), "0px"); } else { setRight(panel.getElement(RIGHT), "0px"); } }
/** * Set the splitter's position in units of pixels. * * <p>px represents the splitter's position as a distance of px pixels from the left edge of the * container. This is true even in a bidi environment. Callers of this method must be aware of * this constraint. */ public void setSplitPositionUsingPixels(int px) { final Element splitElem = panel.getSplitElement(); final int rootElemWidth = getOffsetWidth(panel.container); final int splitElemWidth = getOffsetWidth(splitElem); // This represents an invalid state where layout is incomplete. This // typically happens before DOM attachment, but I leave it here as a // precaution because negative width/height style attributes produce // errors on IE. if (rootElemWidth < splitElemWidth) { return; } // Compute the new right side width. int newRightWidth = rootElemWidth - px - splitElemWidth; // Constrain the dragging to the physical size of the panel. if (px < 0) { px = 0; newRightWidth = rootElemWidth - splitElemWidth; } else if (newRightWidth < 0) { px = rootElemWidth - splitElemWidth; newRightWidth = 0; } final Element rightElem = panel.getElement(RIGHT); // Set the width of the left side. setWidth(panel.getElement(LEFT), px + "px"); // Move the splitter to the right edge of the left element. setLeft(splitElem, px + "px"); // Move the right element to the right of the splitter. setLeft(rightElem, (px + splitElemWidth) + "px"); updateRightWidth(rightElem, newRightWidth); }
@Override public void init(HorizontalSplitPanel panel) { this.panel = panel; final Element elem = panel.getElement(); // Prevents inherited text-align settings from interfering with the // panel's layout. The setting we choose must be bidi-sensitive, // as left-alignment is the default with LTR directionality, and // right-alignment is the default with RTL directionality. if (LocaleInfo.getCurrentLocale().isRTL()) { elem.getStyle().setTextAlign(TextAlign.RIGHT); } else { elem.getStyle().setTextAlign(TextAlign.LEFT); } DOM.setStyleAttribute(elem, "position", "relative"); /* * Technically, these are snapped to the top and bottom, but IE doesn't * provide a reliable way to make that happen, so a resize listener is * wired up to control the height of these elements. */ addAbsolutePositoning(panel.getElement(LEFT)); addAbsolutePositoning(panel.getElement(RIGHT)); addAbsolutePositoning(panel.getSplitElement()); expandToFitParentUsingPercentages(panel.container); if (LocaleInfo.getCurrentLocale().isRTL()) { // Snap the left pane to the left edge of the container. We // only need to do this when layout is RTL; if we don't, the // left pane will overlap the right pane. setLeft(panel.getElement(LEFT), "0px"); } }
@Override public void onModuleLoad() { // Initialize the singleton before calling the constructors of the // various widgets that might call GSS.get(). singleton = this; parseUserCredentials(); topPanel = new TopPanel(GSS.images); topPanel.setWidth("100%"); messagePanel.setWidth("100%"); messagePanel.setVisible(false); search = new Search(images); searchStatus.add(search, DockPanel.WEST); searchStatus.add(userDetailsPanel, DockPanel.EAST); searchStatus.setCellHorizontalAlignment(userDetailsPanel, HasHorizontalAlignment.ALIGN_RIGHT); searchStatus.setCellVerticalAlignment(search, HasVerticalAlignment.ALIGN_MIDDLE); searchStatus.setCellVerticalAlignment(userDetailsPanel, HasVerticalAlignment.ALIGN_MIDDLE); searchStatus.setWidth("100%"); fileList = new FileList(images); searchResults = new SearchResults(images); // Inner contains the various lists. inner.sinkEvents(Event.ONCONTEXTMENU); inner.setAnimationEnabled(true); inner.getTabBar().addStyleName("gss-MainTabBar"); inner.getDeckPanel().addStyleName("gss-MainTabPanelBottom"); inner.add( fileList, createHeaderHTML(AbstractImagePrototype.create(images.folders()), "Files"), true); inner.add( groups, createHeaderHTML(AbstractImagePrototype.create(images.groups()), "Groups"), true); inner.add( searchResults, createHeaderHTML(AbstractImagePrototype.create(images.search()), "Search Results"), true); // inner.add(new CellTreeView(images), // createHeaderHTML(AbstractImagePrototype.create(images.search()), "Cell tree sample"), true); inner.setWidth("100%"); inner.selectTab(0); inner.addSelectionHandler( new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int tabIndex = event.getSelectedItem(); // TreeItem treeItem = GSS.get().getFolders().getCurrent(); switch (tabIndex) { case 0: // Files tab selected // fileList.clearSelectedRows(); fileList.updateCurrentlyShowingStats(); break; case 1: // Groups tab selected groups.updateCurrentlyShowingStats(); updateHistory("Groups"); break; case 2: // Search tab selected searchResults.clearSelectedRows(); searchResults.updateCurrentlyShowingStats(); updateHistory("Search"); break; } } }); // If the application starts with no history token, redirect to a new "Files" state String initToken = History.getToken(); if (initToken.length() == 0) History.newItem("Files"); // Add history listener to handle any history events History.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String tokenInput = event.getValue(); String historyToken = handleSpecialFolderNames(tokenInput); try { if (historyToken.equals("Search")) inner.selectTab(2); else if (historyToken.equals("Groups")) inner.selectTab(1); else if (historyToken.equals("Files") || historyToken.length() == 0) inner.selectTab(0); else { /*TODO: CELLTREE PopupTree popupTree = GSS.get().getFolders().getPopupTree(); TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken); SelectionEvent.fire(popupTree, treeObj); */ } } catch (IndexOutOfBoundsException e) { inner.selectTab(0); } } }); // Add the left and right panels to the split panel. splitPanel.setLeftWidget(treeView); splitPanel.setRightWidget(inner); splitPanel.setSplitPosition("25%"); splitPanel.setSize("100%", "100%"); splitPanel.addStyleName("gss-splitPanel"); // Create a dock panel that will contain the menu bar at the top, // the shortcuts to the left, the status bar at the bottom and the // right panel taking the rest. VerticalPanel outer = new VerticalPanel(); outer.add(topPanel); outer.add(searchStatus); outer.add(messagePanel); outer.add(splitPanel); outer.add(statusPanel); outer.setWidth("100%"); outer.setCellHorizontalAlignment(messagePanel, HasHorizontalAlignment.ALIGN_CENTER); outer.setSpacing(4); // Hook the window resize event, so that we can adjust the UI. Window.addResizeHandler(this); // Clear out the window's built-in margin, because we want to take // advantage of the entire client area. Window.setMargin("0px"); // Finally, add the outer panel to the RootPanel, so that it will be // displayed. RootPanel.get().add(outer); // Call the window resized handler to get the initial sizes setup. Doing // this in a deferred command causes it to occur after all widgets' // sizes have been computed by the browser. DeferredCommand.addCommand( new Command() { @Override public void execute() { onWindowResized(Window.getClientHeight()); } }); }
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%"); }
public void setSplitPosition(String pos) { final Element leftElem = panel.getElement(LEFT); setWidth(leftElem, pos); setSplitPositionUsingPixels(getOffsetWidth(leftElem)); }