List of usage examples for com.google.gwt.user.client.ui VerticalPanel insert
public void insert(Widget w, int beforeIndex)
From source file:asquare.gwt.tests.circularbinding.client.Demo.java
License:Apache License
private Widget createDemoPanel() { VerticalPanel outer = new VerticalPanel(); final TextArea output = new TextArea(); outer.add(output);// ww w . ja v a 2s . c o m Label label = new Label("Click me"); label.addMouseDownHandler(new MouseDownHandler() { public void onMouseDown(MouseDownEvent event) { // this works output.setText("x=" + DOM2.eventGetClientX()); // this results in an infinite loop output.setText(output.getText() + "\r\ny=" + DOM2.eventGetClientY()); } }); DOM.setStyleAttribute(label.getElement(), "border", "solid black 1px"); outer.insert(label, 0); return outer; }
From source file:cc.alcina.framework.gwt.client.stdlayout.MainTabPanel.java
License:Apache License
public MainTabPanel(ArrayList<IsWidget> buttons) { super();/*from w ww .j a v a2 s . co m*/ this.buttons = buttons; VerticalPanel vp = (VerticalPanel) getWidget(); dockPanel = new DockPanel(); dockPanel.setStyleName("alcina-MainMenu"); dockPanel.setWidth("100%"); mainMenuContainer = new FlowPanel(); mainMenuContainer.setStyleName("alcina-MainMenuContainer"); mainMenuContainer.add(dockPanel); tabBarProt = (TabBar) vp.getWidget(0); vp.remove(tabBarProt); if (isWrapCenterContainer()) { centerContainer = new SpanPanel(); centerContainer.add(tabBarProt); dockPanel.add(centerContainer, DockPanel.CENTER); } else { dockPanel.add(tabBarProt, DockPanel.CENTER); } bp = createButtonsPanel(); refreshButtonPanelVis(); dockPanel.add(bp, DockPanel.EAST); dockPanel.setCellHorizontalAlignment(bp, DockPanel.ALIGN_RIGHT); vp.insert(mainMenuContainer, 0); customizeDock(); vp.insert(toolbarHolder, 1); vp.getWidget(1).setWidth("100%"); noTabContentHolder.setVisible(false); noTabContentHolder.setStyleName("content alcina-ContentFrame alcina-MainContent"); vp.add(noTabContentHolder); vp.setWidth("100%"); addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() { public void onBeforeSelection(BeforeSelectionEvent<Integer> event) { int tabIndex = event.getItem(); getDeckPanel().setVisible(tabIndex >= 0); if (tabIndex != -1) { noTabContentHolder.clear(); } noTabContentHolder.setVisible(tabIndex == -1); } }); }
From source file:com.google.appinventor.client.editor.youngandroid.palette.OrderedPaletteHelper.java
License:Open Source License
@Override public final void addPaletteItem(VerticalPanel panel, SimplePaletteItem component) { int index = Collections.binarySearch(componentsAddedSoFar, component, componentsComparator); int insertionPos = -index - 1; componentsAddedSoFar.add(insertionPos, component); panel.insert(component, insertionPos); }
From source file:de.catma.ui.client.ui.tagger.menu.TagMenuPopup.java
License:Open Source License
public TagMenuPopup(TaggerEditor vTagger, String lastSelectedColor) { super(true);//from w ww . java2s .com getElement().addClassName("tagmenu-popup"); this.setText("Annotations"); this.vTagger = vTagger; this.lastSelectedColor = lastSelectedColor; root = new TreeItem("Available annotations"); final Tree tree = new Tree(); tree.addItem(root); root.setState(true); root.setStyleName("tagger_menu_root"); final VerticalPanel vPanel = new VerticalPanel(); if (vTagger.hasSelection()) { final VerticalPanel annotationCreationPanel = new VerticalPanel(); annotationCreationPanel.setSpacing(5); annotationCreationPanel.setWidth("100%"); final TextArea annotationBodyInput = new TextArea(); annotationBodyInput.setWidth("90%"); annotationCreationPanel.add(annotationBodyInput); final HorizontalPanel annotationCreationButtonPanel = new HorizontalPanel(); annotationCreationButtonPanel.setSpacing(5); final Label colorLabel = new HTML(" "); final ColorPicker colorPicker = new ColorPicker() { @Override public void onChange(Widget sender) { super.onChange(sender); colorLabel.getElement().setAttribute("style", "background:#" + this.getHexColor() + ";"); } }; try { if (lastSelectedColor != null) { colorPicker.setHex(lastSelectedColor); } else { int[] randomColor = getRandomColor(); colorPicker.setRGB(randomColor[0], randomColor[1], randomColor[2]); } } catch (Exception e) { // well... } colorLabel.getElement().setAttribute("style", "background:#" + colorPicker.getHexColor() + ";"); HorizontalPanel colorPanel = new HorizontalPanel(); colorPanel.setSpacing(5); PushButton colorButton = new PushButton("Change color..."); colorPanel.add(colorButton); colorPanel.add(colorLabel); HandlerRegistration colorButtonReg = colorButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { annotationCreationPanel.insert(colorPicker, annotationCreationPanel.getWidgetIndex(annotationCreationButtonPanel)); TagMenuPopup.this.center(); } }); handlerRegistrations.add(colorButtonReg); annotationCreationPanel.add(colorPanel); PushButton saveButton = new PushButton("Save"); //saveButton.setStylePrimaryName("tagger-pushButton"); HandlerRegistration saveButtonReg = saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // TagMenuPopup.this.vTagger.createAndAddTagIntance(colorPicker.getHexColor()); TagMenuPopup.this.lastSelectedColor = colorPicker.getHexColor(); hide(); } }); handlerRegistrations.add(saveButtonReg); PushButton cancelButton = new PushButton("Cancel"); //cancelButton.setStylePrimaryName("tagger-pushButton"); annotationCreationButtonPanel.add(saveButton); annotationCreationButtonPanel.add(cancelButton); annotationCreationPanel.add(annotationCreationButtonPanel); PushButton addAnnotationButton = new PushButton("Add annotation..."); //addAnnotationButton.setStylePrimaryName("tagger-pushButton"); HandlerRegistration addAnnotationBtReg = addAnnotationButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vPanel.insert(annotationCreationPanel, vPanel.getWidgetIndex(tree)); } }); handlerRegistrations.add(addAnnotationBtReg); vPanel.add(addAnnotationButton); HandlerRegistration cancelButtonReg = cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { annotationBodyInput.setText(""); vPanel.remove(annotationCreationPanel); } }); handlerRegistrations.add(cancelButtonReg); } vPanel.add(tree); vPanel.setStylePrimaryName("tagger_menu"); setWidget(vPanel); }
From source file:org.mobicents.servlet.management.client.router.RequestColumnsContainer.java
License:Open Source License
private void populateRouterNodes(DARRoute[] routes) { AbsolutePanel boundaryPanel = this; boundaryPanel.add(buildTitles());//from www . j a v a 2 s. c o m boundaryPanel.setSize(UserInterface.WIDTH, UserInterface.HEIGHT); addStyleName(CSS_SSM); routeColumns = new VerticalPanel[COLUMNS.length]; PickupDragController columnDragController = new PickupDragController(boundaryPanel, false); columnDragController.setBehaviorMultipleSelection(false); final PickupDragController widgetDragController = new PickupDragController(boundaryPanel, false); widgetDragController.setBehaviorMultipleSelection(false); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.addStyleName(CSS_CONTAINER); horizontalPanel.setSpacing(SPACING); boundaryPanel.add(horizontalPanel); IndexedDropController columnDropController = new IndexedDropController(horizontalPanel); columnDragController.registerDropController(columnDropController); for (int col = 0; col < COLUMNS.length; col++) { VerticalPanel columnCompositePanel = new VerticalPanel(); columnCompositePanel.addStyleName(CSS_SSM_COLUMN_COMPOSITE); final VerticalPanel verticalPanel = new VerticalPanel(); routeColumns[col] = verticalPanel; verticalPanel.addStyleName(CSS_CONTAINER); verticalPanel.setSpacing(SPACING); horizontalPanel.add(columnCompositePanel); NoInsertAtEndIndexedDropController widgetDropController = new NoInsertAtEndIndexedDropController( verticalPanel); widgetDragController.registerDropController(widgetDropController); HTML groupDragHandle = new HTML("<div class='group-drag-handle'/>"); columnCompositePanel.add(groupDragHandle); columnCompositePanel.add(verticalPanel); columnDragController.makeDraggable(columnCompositePanel, groupDragHandle); for (int q = 0; q < routes.length; q++) { if (COLUMNS[col].equals(routes[q].getRequest())) { for (int w = 0; w < routes[q].getNodes().length; w++) { ApplicationRouteNodeEditor widget = new ApplicationRouteNodeEditor(routes[q].getNodes()[w]); verticalPanel.add(widget); widgetDragController.makeDraggable(widget, widget.getDragHandle()); } } } Label spacerLabel = new Label(""); spacerLabel.setPixelSize(199, 50); verticalPanel.add(spacerLabel); Button addApplicationButton = new Button("Add application", new ButtonListenerAdapter() { public void onClick(Button button, EventObject e) { ApplicationRouteNodeEditor widget = new ApplicationRouteNodeEditor(); verticalPanel.insert(widget, verticalPanel.getWidgetCount() - 1); widgetDragController.makeDraggable(widget, widget.getDragHandle()); } }); addApplicationButton.setWidth("100%"); columnCompositePanel.add(addApplicationButton); } }
From source file:org.onebusaway.webapp.gwt.common.widgets.VerticalMultiColumnPanel.java
License:Apache License
/** Add widget to the panel. */ public void insert(Widget w, int beforeIndex) { _numWidgets++;//from ww w. ja va 2 s. c o m // add new column if needed if (_hp.getWidgetCount() * _maxWidgetsPerColumn < _numWidgets) { VerticalPanel vp = new VerticalPanel(); _hp.add(vp); } // insert widget int column = beforeIndex / _maxWidgetsPerColumn; int position = beforeIndex % _maxWidgetsPerColumn; ((VerticalPanel) _hp.getWidget(column)).insert(w, position); // "carry" overflow to next columns as needed for (int i = 0; i < _hp.getWidgetCount() - 1; i++) { VerticalPanel vp1 = (VerticalPanel) _hp.getWidget(i); if (vp1.getWidgetCount() > _maxWidgetsPerColumn) { VerticalPanel vp2 = (VerticalPanel) _hp.getWidget(i + 1); Widget move = vp1.getWidget(_maxWidgetsPerColumn); vp2.insert(move, 0); vp1.remove(move); } } }
From source file:org.openxdata.querybuilder.client.view.DisplayFieldsView.java
private void moveItemUp(VerticalPanel vertialPanel, Widget widget) { int index = vertialPanel.getWidgetIndex(widget); if (index == 1) return;//from w w w . ja va 2 s. c om vertialPanel.remove(widget); vertialPanel.insert(widget, index - 1); }
From source file:org.openxdata.querybuilder.client.view.DisplayFieldsView.java
private void moveItemDown(VerticalPanel vertialPanel, Widget widget) { int index = vertialPanel.getWidgetIndex(widget); if (widget instanceof SortColumnWidget && index == vertialPanel.getWidgetCount() - 1) return;//from w w w . ja v a 2 s . c om else if (widget instanceof DisplayColumnWidget && index == vertialPanel.getWidgetCount() - 2) return; vertialPanel.remove(widget); vertialPanel.insert(widget, index + 1); }