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

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

Introduction

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

Prototype

public boolean remove(int index) 

Source Link

Usage

From source file:com.google.gerrit.client.changes.PublishCommentScreen.java

License:Apache License

@Override
public void remove(CommentEditorPanel editor) {
    commentEditors.remove(editor);//www.java  2 s  .com

    // The editor should be embedded into a panel holding all
    // editors for the same file.
    //
    FlowPanel parent = (FlowPanel) editor.getParent();
    parent.remove(editor);

    // If the panel now holds no editors, remove it.
    //
    int editorCount = 0;
    for (Widget w : parent) {
        if (w instanceof CommentEditorPanel) {
            editorCount++;
        }
    }
    if (editorCount == 0) {
        parent.removeFromParent();
    }

    // If that was the last file with a draft, remove the heading.
    //
    if (draftsPanel.getWidgetCount() == 1) {
        draftsPanel.clear();
    }
}

From source file:com.pronoiahealth.olhie.client.pages.newbook.widgets.NewBookDroppablePanel.java

License:Open Source License

@PostConstruct
protected void postConstruct() {
    // handler for clicking download button on a BookItemDisplay
    downloadClickHandler = new BookassetActionClickCallbackHandler() {
        @Override/*  ww  w .j  a v  a2s  .c o m*/
        public boolean handleButtonClick(com.google.gwt.user.client.Event e, String baDescId, String baId,
                String viewType) {
            downloadBookAssetEvent.fire(new DownloadBookAssetEvent(baId));
            return false;
        }
    };

    // handler for clicking asset detail on a BookItemDisplay
    this.assetDetailClickHandler = new BookassetActionClickCallbackHandler() {
        @Override
        public boolean handleButtonClick(com.google.gwt.user.client.Event e, String baDescId, String baId,
                String viewType) {
            bookdescriptionDetailRequestEvent.fire(new BookdescriptionDetailRequestEvent(baDescId, baId));
            return false;
        }
    };

    // handler for clicking remove button on a BookItemDisplay
    this.removeClickHandler = new BookassetActionClickCallbackHandler() {
        @Override
        public boolean handleButtonClick(com.google.gwt.user.client.Event e, String baDescId, String baId,
                String viewType) {

            // Find the item in the list
            // and remove it
            FlowPanel fp = getInnerPanel();
            int cnt = fp.getWidgetCount();
            for (int i = 0; i < cnt; i++) {
                // if the child is a BookItemDisplay
                Widget bidW = fp.getWidget(i);
                if (bidW instanceof BookItemDisplay) {
                    BookItemDisplay item = (BookItemDisplay) bidW;
                    if (item.getBadId().equals(baDescId)) {
                        bookItemDisplayDisposer.dispose(item);
                        fp.remove(item);
                        break;
                    }
                }
            }

            // Reorder the remaining items
            Map<String, Integer> assetOrderMap = getReorderMap();

            // Tell the database about the changes
            updateBookassetdescriptionOrderEvent
                    .fire(new UpdateBookassetdescriptionsForBookEvent(assetOrderMap, baDescId));

            // Indicates that this method will handle the event
            return false;
        }
    };

    // handler for clicking view button on a BookItemDisplay
    this.viewClickHandler = new BookassetActionClickCallbackHandler() {

        @Override
        public boolean handleButtonClick(com.google.gwt.user.client.Event e, String baDescId, String baId,
                String viewType) {
            showViewBookassetDialogEvent.fire(new ShowViewBookassetDialogEvent(baId, viewType));
            return false;
        }
    };
}

From source file:edu.caltech.ipac.firefly.ui.searchui.ImageSelectUI.java

public Widget makeUI() {
    final FlowPanel panel = new FlowPanel();

    UserServices.App.getInstance().getMissionConfig(dsInfo.getId().toLowerCase(),
            new BaseCallback<MissionTag>() {
                @Override//from   ww w .  j  ava2s. c  om
                public void doSuccess(MissionTag result) {
                    if (result != null) {

                        final List<ImageSetTag> iltag = result.getImagesetList();
                        if (iltag.size() > 0) {
                            panel.clear();

                            EnumFieldDef fd = new EnumFieldDef("imageSets");
                            fd.setOrientation(EnumFieldDef.Orientation.Vertical);
                            final List<EnumFieldDef.Item> items = new ArrayList<EnumFieldDef.Item>(
                                    iltag.size());

                            for (final ImageSetTag aTag : iltag) {
                                items.add(new EnumFieldDef.Item(aTag.getName(), aTag.getTitle()));
                            }
                            fd.addItems(items);
                            final RadioGroupInputField rgFld = new RadioGroupInputField(fd);
                            GwtUtil.setStyles(rgFld, "padding", "5px", "display", "inline-block",
                                    "verticalAlign", "top", "width", "25%", "height", "200px", "overflow",
                                    "auto");
                            rgFld.addValueChangeHandler(new ValueChangeHandler<String>() {
                                public void onValueChange(ValueChangeEvent<String> event) {
                                    String newVal = event.getValue();
                                    for (int i = 0; i < items.size(); i++) {
                                        if (items.get(i).getName().equals(newVal)) {
                                            currentImageSet = iltag.get(i);
                                            FormTag ftag = currentImageSet.getForm();
                                            if (form != null)
                                                panel.remove(1);
                                            form = GwtUtil.createSearchForm(ftag, null, null);
                                            GwtUtil.setStyles(form, "backgroundColor", "white", "border",
                                                    "1px solid black", "display", "inline-block",
                                                    "verticalAlign", "top", "width", "70%", "height", "200px",
                                                    "overflow", "auto");
                                            panel.add(form);
                                            break;
                                        }
                                    }
                                }
                            });

                            panel.add(rgFld);

                            rgFld.setValue(items.get(0).getName());
                            if (rgFld.isVisible()) {
                                ValueChangeEvent.fire(rgFld, items.get(0).getName());
                            }

                        }
                    } else {
                        Label label = new Label("Image View is not ready yet for " + dsInfo.getUserDesc());
                        panel.add(label);
                        form = null;
                        currentImageSet = null;
                    }
                }
            });

    panel.addStyleName("expand-fully");
    return GwtUtil.wrap(panel, 20, 20, 20, 20);
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.view.FiltersView.java

License:Open Source License

private void addRemoveFilterEvent(Image removeImage, final FlowPanel filters,
        final HorizontalPanel panelToRemove, final DateFilter dateFilterToRemove) {
    removeImage.addClickHandler(new ClickHandler() {
        @Override// ww w.  java  2 s  . co  m
        public void onClick(ClickEvent event) {
            filters.remove(panelToRemove);
            dateFilters.remove(dateFilterToRemove);
            fireDateFilterChangeEvent();
        }
    });
}

From source file:org.bonitasoft.console.client.view.cases.CaseHistoryWidget.java

License:Open Source License

protected FlowPanel buildSummaryPanel(final CaseItem anItem) {

    final FlowPanel theSummaryWrapper = new FlowPanel();
    final Label theSummary = new Label(patterns.caseStartedBy(myCase.getStartedBy().getValue()));
    theSummaryWrapper.add(theSummary);/*from   ww w.j  ava2s. c  om*/
    if (UserRightsManager.getInstance().isAllowed(RuleType.PROCESS_INSTANTIATION_DETAILS_VIEW,
            anItem.getProcessUUID().getValue())) {
        theSummary.setStylePrimaryName(CSSClassManager.POPUP_MENU_ENTRY);
        theSummary.addClickHandler(new ClickHandler() {
            private boolean formIsVisible = false;
            private InstantiationStepEditor myViewer;

            public void onClick(ClickEvent aEvent) {
                toggleSummaryView();
            }

            private void toggleSummaryView() {
                if (formIsVisible) {
                    if (myViewer != null) {
                        theSummaryWrapper.remove(myViewer);
                        if (DOMUtils.getInstance().isInternetExplorer()) {
                            myViewer = null;
                        }
                        formIsVisible = false;
                    }
                } else {
                    if (myViewer == null) {
                        myViewer = new InstantiationStepEditor(myStepItemDataSource, myCase, myCaseDataSource,
                                myProcessDataSource);
                        theSummaryWrapper.add(myViewer);
                    } else {
                        theSummaryWrapper.add(myViewer);
                    }

                    formIsVisible = true;
                }

            }
        });
    }
    return theSummaryWrapper;
}

From source file:org.bonitasoft.console.client.view.cases.CaseHistoryWidget.java

License:Open Source License

protected FlowPanel buildSummaryPanel(final StepItem anItem) {
    final String theExecutionSummary;
    if (anItem.getExecutionSummary() != null && anItem.getExecutionSummary().length() > 0) {
        theExecutionSummary = anItem.getExecutionSummary();
    } else {//from w  w  w.jav a 2  s  .c  o m
        switch (anItem.getState()) {
        case ABORTED:
            theExecutionSummary = patterns.stepExecutionSummaryAborted(anItem.getLabel());
            break;
        case CANCELLED:
            theExecutionSummary = patterns.stepExecutionSummaryCancelled(anItem.getLabel());
            break;
        case SKIPPED:
            theExecutionSummary = patterns.stepExecutionSummarySkipped(anItem.getLabel());
            break;
        default:
            theExecutionSummary = patterns.stepExecutionSummaryFinished(anItem.getLabel());
            break;
        }
    }

    final FlowPanel theSummaryWrapper = new FlowPanel();
    final Label theSummary = new Label(theExecutionSummary);
    theSummaryWrapper.add(theSummary);
    if (UserRightsManager.getInstance().isAllowed(RuleType.ACTIVITY_DETAILS_READ,
            anItem.getUUID().getStepDefinitionUUID())) {
        theSummary.setStylePrimaryName(CSSClassManager.POPUP_MENU_ENTRY);
        theSummary.addClickHandler(new ClickHandler() {
            private boolean formIsVisible = false;
            private StepEditor myStepEditor;

            public void onClick(ClickEvent aEvent) {
                toggleSummaryView();
            }

            private void toggleSummaryView() {
                if (formIsVisible) {
                    if (myStepEditor != null) {
                        theSummaryWrapper.remove(myStepEditor);
                        if (DOMUtils.getInstance().isInternetExplorer()) {
                            myStepEditor = null;
                        }
                        formIsVisible = false;
                    }
                } else {
                    if (myStepEditor == null) {
                        myStepEditor = new StepEditor(myStepItemDataSource, anItem, true, myCaseDataSource,
                                myProcessDataSource, (UserDataSource) null);
                        theSummaryWrapper.add(myStepEditor);
                    } else {
                        theSummaryWrapper.add(myStepEditor);
                    }

                    formIsVisible = true;
                }

            }
        });
    }
    return theSummaryWrapper;
}

From source file:org.bonitasoft.console.client.view.steps.StepCommentPanel.java

License:Open Source License

protected void initContent() {
    int theNumberOfComment = myStep.getNumberOfComments();
    updateCommentHeader(theNumberOfComment);
    mySwitchVisibilityLink.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent aEvent) {
            if (mySwitchVisibilityLink.getText().equals(constants.show())) {
                myStepDataSource.getStepCommentFeed(myStep.getUUID(), new AsyncHandler<List<CommentItem>>() {
                    public void handleFailure(Throwable t) {
                    };/*from w  w  w .  ja  va 2s . c  o  m*/

                    public void handleSuccess(List<CommentItem> aNewCommentList) {
                        if (aNewCommentList != null) {
                            updateCommentPanel(aNewCommentList);
                            updateCommentHeader(aNewCommentList.size());
                        } else {
                            if (myCommentList.getHTML().length() > 0) {
                                myCommentList.setText(null);
                            }

                        }
                    }

                });
            } else {
                // the link is 'hide'.
                myCommentList.setText(null);
                mySwitchVisibilityLink.setText(constants.show());
            }
        }
    });

    myAddCommentLink.addClickHandler(new ClickHandler() {

        public void onClick(final ClickEvent aEvent) {
            if (myNewCommentDialogBox == null) {
                buildNewCommentDialogBox();
            }
            myNewCommentDialogBox.center();
            myNewCommentTextArea.setFocus(true);
        }
    });

    final FlowPanel theHeader = new FlowPanel();
    theHeader.setStyleName("bos_step_comment_header");

    theHeader.add(myTitle);
    theHeader.add(mySwitchVisibilityLink);
    if (!myStep.getCase().isArchived()) {
        myStep.getCase().addModelChangeListener(CaseItem.HISTRORY_PROPERTY, new ModelChangeListener() {

            public void modelChange(ModelChangeEvent aEvt) {
                theHeader.remove(myAddCommentLink);

            }
        });
        theHeader.add(myAddCommentLink);
    }

    myOuterPanel.add(theHeader);
    myOuterPanel.add(myCommentList);

}

From source file:org.cruxframework.crux.widgets.client.uploader.AbstractFileUploader.java

License:Apache License

protected void resetFileInput() {
    FlowPanel buttonsPanel = (FlowPanel) fileInput.getParent();
    int index = buttonsPanel.getWidgetIndex(fileInput);
    buttonsPanel.remove(index);

    String text = fileInput.getText();
    boolean multiple = fileInput.isMultiple();
    fileInput = initFileInput();//from   w  w w. jav  a2  s. com
    fileInput.setText(text);
    fileInput.setMultiple(multiple);
    buttonsPanel.insert(fileInput, index);
}

From source file:org.datacleaner.monitor.wizard.JobWizardController.java

License:Open Source License

private void createAndShowWizardFinishedContentPanel(final String jobName, final Button closeButton) {
    final FlowPanel contentPanel = new FlowPanel();
    contentPanel.addStyleName("WizardFinishedPanel");

    if (jobName != null && clientConfig.isScheduleEditor()) {

        contentPanel.add(_loadingIndicator);
        setContent(contentPanel);/*  w  ww .  java2  s. co  m*/

        getSchedule(new Runnable() {

            @Override
            public void run() {

                final Anchor triggerAnchor = createTriggerAnchor(jobName);
                final Anchor schedulingAnchor = createSchedulingAnchor(jobName);

                // TODO: Previously there was a "Monitor this job's
                // metrics on the dashboard" anchor as well. Add it?

                contentPanel.remove(_loadingIndicator);

                populateContentPanel(jobName, closeButton, contentPanel);
                contentPanel.add(triggerAnchor);
                contentPanel.add(schedulingAnchor);

            }
        }, jobName);
    } else {
        populateContentPanel(jobName, closeButton, contentPanel);
    }
}

From source file:org.eclipse.che.ide.part.widgets.panemenu.EditorPaneMenuWidget.java

License:Open Source License

/** {@inheritDoc} */
@Override/*from  www  . j a  v  a  2 s .  c  om*/
public void removeItem(@NotNull EditorPaneMenuItem item) {
    FlowPanel targetPanel = item instanceof PaneMenuActionItemWidget ? actionsPanel : itemsPanel;
    targetPanel.remove(item);
}