Example usage for com.google.gwt.user.client.ui VerticalPanel remove

List of usage examples for com.google.gwt.user.client.ui VerticalPanel remove

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui VerticalPanel remove.

Prototype

@Override
    public boolean remove(Widget w) 

Source Link

Usage

From source file:cc.alcina.framework.gwt.client.stdlayout.MainTabPanel.java

License:Apache License

public MainTabPanel(ArrayList<IsWidget> buttons) {
    super();/*from w  w w .ja  v  a2 s  .  com*/
    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.dimdim.conference.ui.common.client.list.ListPanel.java

License:Open Source License

public void moveEntryPanelSection(ListEntryPanel listEntryPanel, int oldRank, int newRank) {
    //      Window.alert("Old rank:"+oldRank+", new rank:"+newRank);
    VerticalPanel sectionPanel = getSectionPanel(oldRank);
    //      Window.alert("Old section:"+sectionPanel.toString());
    boolean reDrawRequired = false;
    if (sectionPanel == this.scrollableEntriesPanel) {
        this.scrollablePanels.remove(listEntryPanel);
    }//  w  w  w  . ja v  a  2s. c  om
    if (listEntryPanel.isPanelVisible()) {
        sectionPanel.remove(listEntryPanel);
        reDrawRequired = true;
    }
    sectionPanel = getSectionPanel(newRank);
    addEntryPanelToSection(sectionPanel, listEntryPanel);
    this.browseControl.numberOfPanelsChanged();
    if (reDrawRequired) {
        this.browseControl.showCurrentPage();
    }
}

From source file:com.dimdim.conference.ui.common.client.list.ListPanel.java

License:Open Source License

public void removeEntryPanel(ListEntry listEntry) {
    ListEntryPanel listEntryPanel = (ListEntryPanel) this.listEntriesTable.get(listEntry.getId());
    if (listEntryPanel != null) {
        VerticalPanel sectionPanel = getSectionPanel(listEntry.getDisplayRank());
        if (sectionPanel == this.firstEntryPanel || sectionPanel == this.secondEntryPanel) {
            sectionPanel.remove(listEntryPanel);
            this.listEntriesTable.remove(listEntry.getId());
            this.browseControl.numberOfPanelsChanged();
        } else {/*  w w w  .j  a  v  a2  s. c  o  m*/
            //            Window.alert("1");
            this.listEntriesTable.remove(listEntry.getId());
            //            Window.alert("2");
            if (sectionPanel == this.scrollableEntriesPanel) {
                //               Window.alert("3");
                this.scrollablePanels.remove(listEntryPanel);
            }
            this.browseControl.numberOfPanelsChanged();
            //            Window.alert("4");
            if (listEntryPanel.isPanelVisible()) {
                sectionPanel.remove(listEntryPanel);
                //   The panel is currently visible so some additional movement in the
                //   scroll might be required.
                this.browseControl.showCurrentPage();
            }
        }
    }
}

From source file:com.dimdim.conference.ui.common.client.list.ListPanel.java

License:Open Source License

protected void showPageSection(VerticalPanel sectionPanel, int start, int num, boolean hideAllFirst) {
    //      Window.alert("Showing page:"+start+"-"+num);
    /*/*from www  .  j  av  a 2s.co  m*/
    if (hideAllFirst)
    {
       for (int i=0; i<size; i++)
       {
    Widget w = sectionPanel.getWidget(i);
    //            Window.alert("Showing widget:"+w);
    w.removeStyleName("list-entry-panel-gap");
    w.setVisible(false);
       }
    }
    */
    //   First remove the entries from the scrollable section.
    int size = sectionPanel.getWidgetCount();
    //      Window.alert("Number of visible panels -- "+size);
    for (int i = size - 1; i >= 0; i--) {
        try {
            sectionPanel.remove(i);
        } catch (Exception e) {
            Window.alert(e.getMessage());
        }
    }

    //   Now add the panels from the panels vector into the display panel
    //   Here i<size
    //      int maxScrollable = this.getNumberOfScrollableEntries();
    size = this.scrollablePanels.size();
    for (int i = 0; i < size; i++) {
        //         Window.alert("Panel -- "+i);
        ListEntryPanel lep = (ListEntryPanel) this.scrollablePanels.elementAt(i);
        if (i < start) {
            //            Window.alert("Setting panel non visible");
            lep.setPanelVisible(false);
        } else if (i < start + num) {
            //            Window.alert("Settng panel visible");
            lep.setPanelVisible(true);
            this.scrollableEntriesPanel.add(lep);
            this.scrollableEntriesPanel.setCellWidth(lep, "100%");
        } else {
            //            Window.alert("Setting panel non visible");
            lep.setPanelVisible(false);
        }
    }
    /*
    for (int i=start; i<start+maxScrollable && i<start+num && i<size; i++)
    {
       ListEntryPanel lep = (ListEntryPanel)this.scrollablePanels.elementAt(i);
    //         Window.alert("Showing widget:"+w);
    //         w.addStyleName("list-entry-panel-gap");
       this.scrollableEntriesPanel.add(lep);
       this.scrollableEntriesPanel.setCellWidth(lep,"100%");
    }
    */
}

From source file:com.ephesoft.dcma.gwt.foldermanager.client.view.widget.DisplayDialogBox.java

License:Open Source License

public DisplayDialogBox(Map<Integer, String> fileIndexVsNameMap, final HandlerManager eventBus) {
    super();/*from   w w  w .j  ava  2 s . c  o m*/
    setWidget(BINDER.createAndBindUi(this));
    this.eventBus = eventBus;
    final VerticalPanel labelPanel = new VerticalPanel();
    if (fileIndexVsNameMap != null && !fileIndexVsNameMap.isEmpty()) {
        for (final Entry<Integer, String> labelString : fileIndexVsNameMap.entrySet()) {
            totalCounter++;
            final HorizontalPanel horizontalPanel = new HorizontalPanel();
            HTML html = new HTML(FolderManagementConstants.REMOVE_ICON_FOLDER_GIF);
            Label label = new Label(labelString.getValue());
            horizontalPanel.add(html);
            horizontalPanel.add(label);
            horizontalPanel.setSpacing(3);
            labelPanel.add(horizontalPanel);
            html.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent arg0) {
                    labelPanel.remove(horizontalPanel);
                    if (--totalCounter == 0) {
                        addNoFilesLabel(labelPanel);
                    }
                    eventBus.fireEvent(new RemoveAttachmentEvent(labelString.getKey()));
                }

            });

        }
    } else {
        addNoFilesLabel(labelPanel);
    }
    addStyleName(FolderManagementConstants.CSS_CONFIGURABLE_DIALOG_BOX);
    Button closeButton = new Button(LocaleDictionary.get().getConstantValue(FolderManagementConstants.CLOSE),
            new ClickHandler() {

                @Override
                public void onClick(ClickEvent arg0) {
                    hide();
                }
            });
    HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.add(closeButton);
    horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.add(labelPanel);
    scrollPanel.setWidth(_200PX);
    scrollPanel.setHeight(_200PX);
    scrollPanel.addStyleName(FolderManagementConstants.BORDER);
    setHeight(_100PX);
    verticalPanel.add(scrollPanel);
    verticalPanel.add(horizontalButtonPanel);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    setModal(true);
    setVisible(true);
    show();
    center();
    closeButton.setFocus(true);
}

From source file:com.google.appinventor.client.editor.youngandroid.palette.YoungAndroidPalettePanel.java

License:Open Source License

private void removePaletteItem(SimplePaletteItem component, ComponentCategory category) {
    VerticalPanel panel = categoryPanels.get(category);
    panel.remove(component);
}

From source file:com.gwt.conn.client.Dashboard.java

/**
 * Called whenever a menu needs to be loaded. Parameter "message" is
 * displayed after loading./*  w  w w. j a va 2 s .  c o  m*/
 */
public static void loadMenu(final Menu menu, String message, boolean internet) {
    // this is used so that buttons don't do anything when clicked
    // if the contents that the button would load are already visible
    // need to use storage to save state of editor when interacting with
    // buttons
    storage.setItem("curDashPage", "vis"); // default to visual editor first

    // initialize panels for widgets to be placed in
    final VerticalPanel dashboardPan = new VerticalPanel();
    dashboardPan.addStyleName("marginlessPanel"); // interacts with Connfrontend.css

    dashboardPan.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dashboardPan.setSize("100%", "100%");
    final HorizontalPanel buttonPan = new HorizontalPanel();
    buttonPan.addStyleName("marginPanel");

    // initialize buttons and put them into the button panel
    final Button visualButton = new Button("Visual Editor");
    final Button dataButton = new Button("Data Editor");
    visualButton.addStyleName("myButton");
    dataButton.addStyleName("myButton");
    buttonPan.add(visualButton);
    buttonPan.add(dataButton);

    // put the button panel in the dashboard panel
    dashboardPan.add(buttonPan);
    dashboardPan.setCellHeight(buttonPan, "0%");

    // get static instances of all possible editor app contents
    final Frame previewContent = Previewer.getPreviewer(menu);
    final HorizontalPanel visualContent = VisualEditor.getVisualEditor(menu, previewContent, internet);
    final HorizontalPanel dataContent = DataEditor.getDataEditor(menu);

    // put the dashboard panel in the root panel
    dashboardPan.add(visualContent); // load visual editor by default
    dashboardPan.setCellHeight(visualContent, "100%");
    RootPanel.get().add(dashboardPan, 0, 0);

    // handler for visualButton shows the visual editor
    class VisualHandler implements ClickHandler {
        public void onClick(ClickEvent event) {
            String cur = storage.getItem("curDashPage");
            if (cur.equals("dat")) {
                dashboardPan.remove(dataContent);
                storage.setItem("curDashPage", "vis");
                dashboardPan.add(visualContent);
                dashboardPan.setCellHeight(visualContent, "100%");
            }
        }
    }
    final VisualHandler visualHandler = new VisualHandler();
    visualButton.addClickHandler(visualHandler);

    // handler for dataButton shows the data editor
    class DataHandler implements ClickHandler {
        public void onClick(ClickEvent event) {
            String cur = storage.getItem("curDashPage");
            if (cur.equals("vis")) {
                dashboardPan.remove(visualContent);
                storage.setItem("curDashPage", "dat");
                dashboardPan.add(dataContent);
                dashboardPan.setCellHeight(dataContent, "100%");
            }
        }
    }

    final DataHandler dataHandler = new DataHandler();
    dataButton.addClickHandler(dataHandler);

    if (internet == false)
        showNoInternetError();
    // internet connection detected, so attach synchronize button to the dashboard
    else {
        // attach a push-to-server button
        final Button pushButton = new Button("Synchronize");
        pushButton.addStyleName("myButton");
        buttonPan.add(pushButton);
        class PushHandler implements ClickHandler {
            public void onClick(ClickEvent event) {

                boolean internetStill = Communicate.hasInternet();
                if (internetStill) {
                    // false because not authenticating
                    Communicate.sync(menu.getName(), storage.getItem("restID"), false);
                } else {
                    buttonPan.remove(pushButton);
                    showNoInternetError();
                }
            }
        }
        final PushHandler pushHandler = new PushHandler();
        pushButton.addClickHandler(pushHandler);

    }
}

From source file:com.hazelcast.monitor.client.ClusterWidgets.java

License:Open Source License

public void deRegister(MonitoringPanel panel) {
    panel.deRegister(this);
    VerticalPanel rightPanel = (VerticalPanel) mainPanel.getRightWidget();
    rightPanel.remove(panel.getPanelWidget());
}

From source file:com.square.composant.ged.square.client.composant.popup.Popup.java

License:Open Source License

/** {@inheritDoc} */
public void setWidget(Widget w, final Integer spacing) {
    final VerticalPanel layoutPanel = (VerticalPanel) dialogBox.getWidget();
    layoutPanel.setWidth(POURCENT_100);/*from ww w. java2s.  c o m*/
    if (spacing != null) {
        layoutPanel.setSpacing(spacing);
    }
    if (widget != w) {
        if (widget != null) {
            layoutPanel.remove(widget);
        }
        widget = w;
        layoutPanel.add(widget);
    }
}

From source file:de.catma.ui.client.ui.tagger.menu.TagMenuPopup.java

License:Open Source License

public TagMenuPopup(TaggerEditor vTagger, String lastSelectedColor) {
    super(true);// w  w w .  j av  a2  s  . c o m
    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("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
        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);
}