Example usage for com.google.gwt.user.client.ui DisclosurePanel isOpen

List of usage examples for com.google.gwt.user.client.ui DisclosurePanel isOpen

Introduction

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

Prototype

boolean isOpen

To view the source code for com.google.gwt.user.client.ui DisclosurePanel isOpen.

Click Source Link

Usage

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

private Widget buildTestHeaderWidget(String header, String addText) {
    final ListBox options = new ListBox();
    for (TestCase test : otherTests) {
        options.addItem(test.getExternalId() + " " + test.getTitle(), String.valueOf(test.getInternalId()));
    }/*from   w  w  w. j  a va  2 s .co  m*/
    VerticalPanel addForm = new VerticalPanel();
    addForm.add(options);

    final DisclosurePanel disclosure = new DisclosurePanel();
    Button button = new Button(" Add ", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long id = Long.parseLong((options.getValue(options.getSelectedIndex())));
            presenter.assignTestCaseToCapability(capability.getCapabilityId(), id);
            disclosure.setOpen(false);
            TestCase test = getTestCaseById(id);
            test.setTargetCapabilityId(capability.getCapabilityId());
            refresh();
        }
    });
    addForm.add(button);
    disclosure.setAnimationEnabled(true);
    disclosure.setOpen(false);
    disclosure.setContent(addForm);

    HorizontalPanel title = new HorizontalPanel();
    title.add(new Label(header));
    addTestAnchor = new Anchor(addText);
    addTestAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosure.setOpen(!disclosure.isOpen());
        }
    });
    addTestAnchor.setVisible(isEditable);
    title.add(addTestAnchor);

    VerticalPanel everything = new VerticalPanel();
    everything.add(title);
    everything.add(disclosure);
    return everything;
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

private Widget buildBugHeaderWidget(String header, String addText) {
    final ListBox options = new ListBox();
    for (Bug bug : otherBugs) {
        options.addItem(bug.getExternalId() + " " + bug.getTitle(), String.valueOf(bug.getInternalId()));
    }/*w  w  w .ja va2  s  .co m*/
    VerticalPanel addForm = new VerticalPanel();
    addForm.add(options);

    final DisclosurePanel disclosure = new DisclosurePanel();
    Button button = new Button(" Add ", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long id = Long.parseLong((options.getValue(options.getSelectedIndex())));
            presenter.assignBugToCapability(capability.getCapabilityId(), id);
            disclosure.setOpen(false);
            Bug bug = getBugById(id);
            bug.setTargetCapabilityId(capability.getCapabilityId());
            refresh();
        }
    });
    addForm.add(button);
    disclosure.setAnimationEnabled(true);
    disclosure.setOpen(false);
    disclosure.setContent(addForm);

    HorizontalPanel title = new HorizontalPanel();
    title.add(new Label(header));
    addBugAnchor = new Anchor(addText);
    addBugAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosure.setOpen(!disclosure.isOpen());
        }
    });
    addBugAnchor.setVisible(isEditable);
    title.add(addBugAnchor);

    VerticalPanel everything = new VerticalPanel();
    everything.add(title);
    everything.add(disclosure);
    return everything;
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.CapabilityDetailsViewImpl.java

License:Apache License

private Widget buildCheckinHeaderWidget(String header, String addText) {
    final ListBox options = new ListBox();
    for (Checkin checkin : otherCheckins) {
        options.addItem(checkin.getExternalId() + " " + checkin.getSummary(),
                String.valueOf(checkin.getInternalId()));
    }//w  ww .  j a  v  a 2  s. c o  m
    VerticalPanel addForm = new VerticalPanel();
    addForm.add(options);

    final DisclosurePanel disclosure = new DisclosurePanel();
    Button button = new Button(" Add ", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            long id = Long.parseLong((options.getValue(options.getSelectedIndex())));
            presenter.assignCheckinToCapability(capability.getCapabilityId(), id);
            disclosure.setOpen(false);
            Checkin checkin = getCheckinById(id);
            checkin.setTargetCapabilityId(capability.getCapabilityId());
            refresh();
        }
    });
    addForm.add(button);
    disclosure.setAnimationEnabled(true);
    disclosure.setOpen(false);
    disclosure.setContent(addForm);

    HorizontalPanel title = new HorizontalPanel();
    title.add(new Label(header));
    addCheckinAnchor = new Anchor(addText);
    addCheckinAnchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosure.setOpen(!disclosure.isOpen());
        }
    });
    addCheckinAnchor.setVisible(isEditable);
    title.add(addCheckinAnchor);

    VerticalPanel everything = new VerticalPanel();
    everything.add(title);
    everything.add(disclosure);
    return everything;
}

From source file:fr.aliasource.webmail.client.reader.AbstractMessageWidget.java

License:GNU General Public License

protected VerticalPanel showQuotedText(String body) {
    VerticalPanel newBody = new VerticalPanel();
    newBody.addStyleName("messageText");

    if (body == null) {
        return newBody;
    }//w ww  .j  a  va  2  s .  com

    if (body.contains("<table") || body.contains("<div") || body.contains("<blockquote")
            || body.contains("<ul")) {
        newBody.add(new HTML(body));
        return newBody;
    }

    body = body.replace("<br>\n", "\n");
    body = body.replace("<BR>\n", "\n");
    body = body.replace("<br/>\n", "\n");
    body = body.replace("<BR/>\n", "\n");

    body = body.replace("<br>", "\n");
    body = body.replace("<BR>", "\n");
    body = body.replace("<br/>", "\n");
    body = body.replace("<BR/>", "\n");

    String[] lines = body.split("\n");
    StringBuilder quoted = new StringBuilder();
    StringBuilder text = new StringBuilder();

    for (int i = 0; i < lines.length; i++) {
        if (lines[i].startsWith("&gt;")) {
            quoted.append(lines[i]).append("<br/>");
            final DisclosurePanel quotedText = new DisclosurePanel();
            final Label quotedHeader = new Label("- " + I18N.strings.showQuotedText() + " -");
            if (i + 1 < lines.length && !lines[i + 1].startsWith("&gt;")) {

                quotedHeader.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent ev) {
                        if (!quotedText.isOpen()) {
                            quotedHeader.setText("- " + I18N.strings.hideQuotedText() + " -");
                        } else {
                            quotedHeader.setText("- " + I18N.strings.showQuotedText() + " -");
                        }
                    }
                });

                quotedText.setHeader(quotedHeader);
                quotedText.setStyleName("quotedText");
                quotedText.add(new HTML(quoted.toString()));
                newBody.add(quotedText);
                quoted.delete(0, quoted.length());
            } else if (i + 1 == lines.length) {
                quotedText.setHeader(quotedHeader);
                quotedText.setStyleName("quotedText");
                quotedText.add(new HTML(quoted.toString()));
                newBody.add(quotedText);
                quoted.delete(0, quoted.length());
            }

        } else {
            text.append(lines[i]).append("<br/>");

            if (i + 1 < lines.length && lines[i + 1].startsWith("&gt;")) {
                newBody.add(new HTML(text.toString()));
                text.delete(0, text.length());
            } else {
                if (text.length() > 0) {
                    newBody.add(new HTML(text.toString()));
                    text.delete(0, text.length());
                }
            }
        }
    }

    return newBody;
}