Example usage for com.google.gwt.user.client.ui Label setText

List of usage examples for com.google.gwt.user.client.ui Label setText

Introduction

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

Prototype

public void setText(String text) 

Source Link

Document

Sets the label's content to the given text.

Usage

From source file:org.errai.samples.rpcdemo.client.local.RPCDemo.java

License:Apache License

@PostConstruct
public void init() {
    final Button checkMemoryButton = new Button("Check Memory Free");
    final Label memoryFreeLabel = new Label();

    final TextBox inputOne = new TextBox();
    final TextBox inputTwo = new TextBox();
    final Button appendTwoStrings = new Button("Append");
    final Label appendResult = new Label();

    checkMemoryButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            testService.call(new RemoteCallback<Long>() {
                @Override//from   w ww  .j  a  v  a2 s.c  o  m
                public void callback(Long response) {
                    memoryFreeLabel.setText("Free Memory: " + response);
                }
            }).getMemoryFree();
        }
    });

    appendTwoStrings.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            testService.call(new RemoteCallback<String>() {
                public void callback(String response) {
                    appendResult.setText(response);
                }
            }).append(inputOne.getText(), inputTwo.getText());
        }
    });

    final Button voidReturn = new Button("Test Add", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            testService.call(new RemoteCallback<Long>() {
                public void callback(Long response) {
                    appendResult.setText(String.valueOf(response));
                }
            }).add(parseLong(inputOne.getText()), parseLong(inputTwo.getText()));
        }
    });

    final Button dates = new Button("Dates", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            MessageBuilder.createCall(new RemoteCallback<List<Date>>() {
                public void callback(List<Date> response) {
                    appendResult.setText("");
                    for (Date d : response)
                        appendResult.setText(appendResult.getText() + " " + d.toString());
                }
            }, TestService.class).getDates();
        }
    });

    final Button date = new Button("Date", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            MessageBuilder.createCall(new RemoteCallback<Date>() {
                public void callback(Date response) {
                    appendResult.setText(response.toString());
                }
            }, TestService.class).getDate();
        }
    });

    final Button exception = new Button("Exception", new ClickHandler() {
        public void onClick(ClickEvent clickEvent) {
            MessageBuilder.createCall(new RemoteCallback<Void>() {
                public void callback(Void response) {
                }
            }, new BusErrorCallback() {
                public boolean error(Message message, Throwable throwable) {
                    try {
                        throw throwable;
                    } catch (TestException e) {
                        Window.alert("Success! TestException received from remote call.");
                    } catch (Throwable t) {
                        GWT.log("An unexpected error has occured", t);
                    }
                    return false;
                }
            }, TestService.class).exception();
        }
    });

    VerticalPanel vPanel = new VerticalPanel();
    HorizontalPanel memoryFreeTest = new HorizontalPanel();
    memoryFreeTest.add(checkMemoryButton);
    memoryFreeTest.add(memoryFreeLabel);
    vPanel.add(memoryFreeTest);

    HorizontalPanel appendTest = new HorizontalPanel();
    appendTest.add(inputOne);
    appendTest.add(inputTwo);
    appendTest.add(appendTwoStrings);
    appendTest.add(appendResult);

    vPanel.add(appendTest);
    vPanel.add(voidReturn);
    vPanel.add(dates);
    vPanel.add(date);
    vPanel.add(exception);
    RootPanel.get().add(vPanel);
}

From source file:org.eurekastreams.web.client.ui.common.form.elements.PersonLookupFormElement.java

License:Apache License

/**
 * Constructor.//www  .  j  av  a  2s .  c  o m
 *
 * @param inTitle
 *            title for the dialog
 * @param inLookupText
 *            the lookup text
 * @param inInstructions
 *            instructions for the dialog
 * @param inKey
 *            the key to be used in the map when data is sent to the server
 * @param inPersons
 *            people initially in the element
 * @param inRequired
 *            whether this element represents required data
 */
public PersonLookupFormElement(final String inTitle, final String inLookupText, final String inInstructions,
        final String inKey, final Collection<PersonModelView> inPersons, final boolean inRequired) {
    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().personLookupFormElement());
    // persons will get populated below using the addPersonMethod()
    // persons = new HashSet<Person>(inPersons);
    key = inKey;
    label.setText(inTitle);
    label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    Label requiredLabel = new Label();
    Label instructions = new Label();

    Label lookup = new Label(inLookupText);
    lookup.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton());
    lookup.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLookupButton());
    lookup.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            dialogContent = new EmployeeLookupContent(getSaveCommand());
            Dialog.showCentered(dialogContent);
        }
    });

    if (inRequired) {
        requiredLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().requiredFormLabel());
        requiredLabel.setText("(required)");
    }

    instructions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
    instructions.setText(inInstructions);

    this.add(label);
    this.add(instructions);
    this.add(requiredLabel);
    this.add(resultPanel);
    this.add(lookup);

    for (PersonModelView person : inPersons) {
        addPerson(person);
    }
}

From source file:org.eurekastreams.web.client.ui.common.form.elements.PersonModelViewLookupFormElement.java

License:Apache License

/**
 * Constructor./*from  ww w.jav a2 s .c  o m*/
 *
 * @param inTitle
 *            title for the dialog
 * @param inLookupText
 *            the lookup text
 * @param inInstructions
 *            instructions for the dialog
 * @param inKey
 *            the key to be used in the map when data is sent to the server
 * @param inPersons
 *            people initially in the element
 * @param inRequired
 *            whether this element represents required data
 */
public PersonModelViewLookupFormElement(final String inTitle, final String inLookupText,
        final String inInstructions, final String inKey, final Collection<PersonModelView> inPersons,
        final boolean inRequired) {
    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().personLookupFormElement());
    // persons will get populated below using the addPersonMethod()
    // persons = new HashSet<Person>(inPersons);
    key = inKey;
    label.setText(inTitle);
    label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    Label requiredLabel = new Label();
    Label instructions = new Label();

    Label lookup = new Label(inLookupText);
    lookup.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton());
    lookup.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLookupButton());
    lookup.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            dialogContent = new EmployeeLookupContent(getSaveCommand());
            Dialog.showCentered(dialogContent);
        }
    });

    if (inRequired) {
        requiredLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().requiredFormLabel());
        requiredLabel.setText("(required)");
    }

    instructions.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
    instructions.setText(inInstructions);

    this.add(label);
    this.add(instructions);
    this.add(requiredLabel);
    this.add(resultPanel);
    this.add(lookup);

    for (PersonModelView person : inPersons) {
        addPerson(person);
    }
}

From source file:org.eurekastreams.web.client.ui.common.notification.dialog.NotificationsDialogContent.java

License:Apache License

/**
 * Causes the source to apply the current display string to the widget.
 *
 * @param source/*w w w.  j av a2s .co  m*/
 *            Source.
 */
private void updateDisplayString(final Source source) {
    Label widget = source.getWidget();
    if (usingMozillaBinding(widget.getElement())) {
        int index = sourceFiltersPanel.getWidgetIndex(widget);
        if (index >= 0) {
            widget.removeFromParent();
            widget.setText(source.getDisplayString());
            sourceFiltersPanel.insert(widget, index);
        }
    } else {
        widget.setText(source.getDisplayString());
    }
}

From source file:org.eurekastreams.web.client.ui.pages.profile.settings.EmploymentPanel.java

License:Apache License

/**
 * Default constructor.//from   w w  w .  j a  va  2  s . c om
 *
 * @param job
 *            The job being displayed.
 * @param readOnly
 *            If the data can be edited.
 * @param inPageHistoryToken
 *            The page history token.
 */
public EmploymentPanel(final Job job, final boolean readOnly, final String inPageHistoryToken) {
    pageHistoryToken = inPageHistoryToken;

    this.setStyleName(StaticResourceBundle.INSTANCE.coreCss().employment());

    if (!readOnly) {
        EditPanel editControls = new EditPanel(employmentPanel, Mode.EDIT_AND_DELETE);

        employmentPanel.add(editControls);

        editControls.addEditClickHandler(new ClickHandler() {
            public void onClick(final ClickEvent event) {
                employmentPanel.setVisible(false);
                updateEmploymentPanel.setVisible(true);
            }
        });

        editControls.addDeleteClickHandler(new ClickHandler() {
            public void onClick(final ClickEvent event) {
                if (new WidgetJSNIFacadeImpl().confirm("Are you sure you want to delete this position?")) {
                    PersonalEmploymentModel.getInstance().delete(job.getId());
                }
            }
        });

        Session.getInstance().getEventBus().addObserver(BackgroundEmploymentEditCanceledEvent.class,
                new Observer<BackgroundEmploymentEditCanceledEvent>() {
                    public void update(final BackgroundEmploymentEditCanceledEvent arg1) {
                        employmentPanel.setVisible(true);
                        updateEmploymentPanel.setVisible(false);
                    }
                });

        updateEmploymentPanel = new CreateOrUpdateEmploymentPanel(job, pageHistoryToken);
        updateEmploymentPanel.setVisible(false);

        this.add(updateEmploymentPanel);
    }

    Hyperlink title = new Hyperlink(job.getTitle(), Session.getInstance()
            .generateUrl(new CreateUrlRequest(Page.SEARCH, "", getSearchParams(job.getTitle()))));
    title.setStyleName(StaticResourceBundle.INSTANCE.coreCss().title());
    employmentPanel.add(title);

    Hyperlink companyName = new Hyperlink(job.getCompanyName(), Session.getInstance()
            .generateUrl(new CreateUrlRequest(Page.SEARCH, "", getSearchParams(job.getCompanyName()))));
    companyName.setStyleName(StaticResourceBundle.INSTANCE.coreCss().subTitle());
    Label employmentDates = new Label();
    if (job.getDateTo() == null) {
        employmentDates
                .setText(Integer.toString(YEAR_CONVERSION + job.getDateFrom().getYear()) + " - " + "Present");
    } else {
        employmentDates.setText(Integer.toString(YEAR_CONVERSION + job.getDateFrom().getYear()) + " - "
                + Integer.toString(YEAR_CONVERSION + job.getDateTo().getYear()));
    }
    employmentDates.setStyleName(StaticResourceBundle.INSTANCE.coreCss().description());

    Label description = new Label(job.getDescription());
    description.setStyleName(StaticResourceBundle.INSTANCE.coreCss().description());

    this.add(employmentPanel);

    employmentPanel.add(companyName);
    employmentPanel.add(employmentDates);
    employmentPanel.add(description);
}

From source file:org.eurekastreams.web.client.ui.pages.profile.settings.GroupProfileSettingsTabContent.java

License:Apache License

/**
 * Setter.//from  ww  w  . j av a  2s  . co  m
 *
 * @param entity
 *            the group whose settings will be changed
 */
public void setEntity(final DomainGroupModelView entity) {
    // Set the banner.
    Session.getInstance().getEventBus().notifyObservers(new SetBannerEvent(entity));

    final FormBuilder form = new FormBuilder("", GroupModel.getInstance(), Method.UPDATE);

    EventBus.getInstance().addObserver(UpdatedGroupResponseEvent.class,
            new Observer<UpdatedGroupResponseEvent>() {
                public void update(final UpdatedGroupResponseEvent arg1) {
                    Session.getInstance().getEventBus().notifyObservers(new UpdateHistoryEvent(
                            new CreateUrlRequest(Page.GROUPS, arg1.getResponse().getShortName())));

                    Session.getInstance().getEventBus().notifyObservers(new ShowNotificationEvent(
                            new Notification("Your group has been successfully saved")));
                }
            });

    form.addFormElement(new ValueOnlyFormElement(DomainGroupModelView.ID_KEY, Long.toString(entity.getId())));
    form.addFormElement(new ValueOnlyFormElement(DomainGroupModelView.SHORT_NAME_KEY, entity.getShortName()));

    AvatarUploadFormElement avatarFormEl = new AvatarUploadFormElement("Avatar",
            "Select a JPG, PNG or GIF image from your computer. The maxium file size is 4MB"
                    + " and will be cropped to 990 x 100 pixels high.",
            "/eurekastreams/groupavatarupload?groupName=" + entity.getShortName(),
            Session.getInstance().getActionProcessor(),
            new AvatarUploadStrategy<DomainGroupModelView>(entity, "resizeGroupAvatar", EntityType.GROUP));
    form.addWidget(avatarFormEl);

    form.addFormDivider();

    form.addFormElement(new BasicTextBoxFormElement(MAX_NAME, false, "Group Name",
            DomainGroupModelView.NAME_KEY, entity.getName(), "", true));
    form.addFormDivider();

    form.addFormElement(new BasicTextAreaFormElement(DomainGroup.MAX_DESCRIPTION_LENGTH, "Description",
            DomainGroupModelView.DESCRIPTION_KEY, entity.getDescription(),
            "Enter a few sentences that describe the purpose of your group's stream.  "
                    + "This description will appear beneath your avatar "
                    + "and in the profile search results pages.",
            false));

    form.addFormDivider();

    AutoCompleteItemDropDownFormElement keywords = new AutoCompleteItemDropDownFormElement("Keywords",
            DomainGroupModelView.KEYWORDS_KEY,
            DomainFormatUtility.buildCapabilitiesStringFromStrings(entity.getCapabilities()),
            "Add keywords that describe your group and the topics your members will be talking about. Separate "
                    + "keywords with a comma. Including keywords helps others find your group when searching "
                    + "profiles.",
            false, "/resources/autocomplete/capability/", "itemNames", ",");
    keywords.setMaxLength(MAX_KEYWORDS);

    form.addFormElement(keywords);
    form.addFormDivider();

    form.addFormElement(new BasicTextBoxFormElement("Website URL", "url", entity.getUrl(),
            "If your group has a website, you can enter the URL above", false));
    form.addFormDivider();

    String coordinstructions = "The group coordinators will be responsible for managing the organization profile, "
            + "and moderating the group's activity stream";

    form.addFormElement(new PersonModelViewLookupFormElement("Group Coordinators", "Add Coordinator",
            coordinstructions, DomainGroupModelView.COORDINATORS_KEY, entity.getCoordinators(), true));

    form.addFormDivider();

    final Label currentPrivacySettingLabel = new Label();
    currentPrivacySettingLabel.setText("Privacy Settings");
    currentPrivacySettingLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formLabel());
    final FlowPanel currentPrivacySettingDescription = new FlowPanel();
    final Label currentPrivacySettingDescriptionTitle = new Label();
    currentPrivacySettingDescriptionTitle.setText(entity.isPublic() ? "Public" : "Private");
    currentPrivacySettingDescriptionTitle
            .addStyleName(StaticResourceBundle.INSTANCE.coreCss().formStaticValue());
    final Label currentPrivacySettingDescriptionInfo = new Label();
    if (entity.isPublic()) {
        currentPrivacySettingDescriptionInfo.setText(
                "Public groups are visible to all users and accessible " + "through a profile search.");
    } else {
        currentPrivacySettingDescriptionInfo.setText("Access to private groups is restricted to employees"
                + " approved by the group's coordinators.  Group coordinators can view a list of pending "
                + "requests by going to the admin tab on the group's profile.");
    }
    currentPrivacySettingDescriptionInfo
            .addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
    currentPrivacySettingDescription.add(currentPrivacySettingDescriptionTitle);
    currentPrivacySettingDescription.add(currentPrivacySettingDescriptionInfo);
    currentPrivacySettingDescription
            .addStyleName(StaticResourceBundle.INSTANCE.coreCss().privacySettingsValue());
    final FlowPanel currentPrivacySettingPanel = new FlowPanel();
    currentPrivacySettingPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formElement());
    currentPrivacySettingPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().privacySettings());
    currentPrivacySettingPanel.add(currentPrivacySettingLabel);
    currentPrivacySettingPanel.add(currentPrivacySettingDescription);
    form.addWidget(currentPrivacySettingPanel);

    if (!entity.isPublic()) {
        final HTML privateNote = new HTML("<span class=\"form-static-value\">Please Note:</span> "
                + "This group's name and description will be visible whenever employees browse or"
                + " search profiles.");
        privateNote.addStyleName(StaticResourceBundle.INSTANCE.coreCss().privacySettingsNote());
        privateNote.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formInstructions());
        currentPrivacySettingPanel.add(privateNote);
    }

    form.addFormDivider();

    // TODO: evidently this is supposed to go away
    BasicCheckBoxFormElement blockWallPost = new BasicCheckBoxFormElement("Stream Moderation",
            DomainGroupModelView.STREAM_POSTABLE_KEY, "Allow others to post to your group's stream", false,
            entity.isStreamPostable());
    BasicCheckBoxFormElement blockCommentPost = new BasicCheckBoxFormElement(null,
            DomainGroupModelView.STREAM_COMMENTABLE_KEY,
            "Allow others to comment on activity in your group's stream", false, entity.isCommentable());

    blockWallPost.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamModeration());
    blockCommentPost.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamModeration());
    blockCommentPost.addStyleName(StaticResourceBundle.INSTANCE.coreCss().commentModeration());

    form.addFormElement(blockWallPost);
    form.addFormElement(blockCommentPost);
    form.addFormDivider();

    // ---- Action buttons ----

    deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formDeleteGroupButton());
    deleteButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formButton());

    deleteButton.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
            if (new WidgetJSNIFacadeImpl().confirm("Are sure that you want to delete this group? "
                    + "Deleting the group will remove the profile from the system along with "
                    + "all of the activity that has been posted to its stream.")) {
                form.turnOffChangeCheck();
                processingSpinny.setVisible(true);
                deleteButton.setVisible(false);

                // TODO - might should put this in GroupModel (and mark it as Deletable) but there's no
                // custom onFailure ability there yet.
                Session.getInstance().getActionProcessor().makeRequest("deleteGroupAction", entity.getId(),
                        new AsyncCallback<Boolean>() {
                            public void onSuccess(final Boolean result) {
                                // adds notification to top of page
                                Session.getInstance().getEventBus()
                                        .notifyObservers(new ShowNotificationEvent(new Notification(
                                                "The group '" + entity.getName() + "' has been deleted")));

                                // navigates away from settings page to the parent org profile page
                                Session.getInstance().getEventBus()
                                        .notifyObservers(new UpdateHistoryEvent(new CreateUrlRequest(
                                                Page.PEOPLE,
                                                Session.getInstance().getCurrentPerson().getAccountId())));
                            }

                            public void onFailure(final Throwable caught) {
                                // adds notification to top of page
                                Session.getInstance().getEventBus()
                                        .notifyObservers(new ShowNotificationEvent(
                                                new Notification("An error has occured and the group '"
                                                        + entity.getName() + "' was not deleted")));
                            }
                        });
            }
        }
    });

    form.addWidgetToFormContainer(deleteButton);

    processingSpinny.setVisible(false);
    processingSpinny.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formSubmitSpinny());
    form.addWidgetToFormContainer(processingSpinny);

    form.setOnCancelHistoryToken(
            Session.getInstance().generateUrl(new CreateUrlRequest(Page.GROUPS, entity.getShortName())));

    panel.add(form);
}

From source file:org.eurekastreams.web.client.ui.pages.profile.settings.stream.EditFeedSubscriptionPanel.java

License:Apache License

/**
 * Default Constructor.//w  ww .j  a  v a 2 s . c  o m
 * 
 * @param inMetaData
 *            The metadata of the selected plugin
 * @param mode
 *            The mode of the panel
 */
public EditFeedSubscriptionPanel(final GadgetMetaDataDTO inMetaData, final Method mode) {
    metaData = inMetaData;

    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().streamPluginsFeedSubscriptionsContainer());

    Label feedSubscriptionsHeader = new Label();

    if (mode == Method.INSERT) {
        feedSubscriptionsHeader.setText("Add a New Plugin");
    } else if (mode == Method.UPDATE) {
        feedSubscriptionsHeader.setText("Edit Plugin");
        this.addStyleName(
                StaticResourceBundle.INSTANCE.coreCss().streamPluginsFeedSubscriptionsContainerEdit());
    }

    feedSubscriptionsHeader.addStyleName(StaticResourceBundle.INSTANCE.coreCss().header());
    this.add(feedSubscriptionsHeader);

}

From source file:org.eurekastreams.web.client.ui.pages.profile.widgets.BreadcrumbPanel.java

License:Apache License

/**
 * Put the breadcrumbs on the display./* w ww  . jav a  2 s.c  om*/
 * 
 * @param breadcrumbs
 *            the crumbs.
 * @param thisItem
 *            the display name of the end node in the breadcrumb trail.
 * @param showParent
 *            flag to show this item's direct parent in the trail; only orgs do not need to show this.
 * @param showItemLink
 *            flag to show this item in the trail as a link that wipes out all params when clicked.
 */
private void displayBreadcrumbs(final ArrayList<BreadcrumbDTO> breadcrumbs, final String thisItem,
        final boolean showParent, final boolean showItemLink) {
    Label separator;

    this.clear();

    HashMap<String, String> params = new HashMap<String, String>();
    params.put("tab", "Stream");

    for (BreadcrumbDTO crumb : breadcrumbs) {
        Hyperlink crumbLink = new Hyperlink(crumb.getText(), Session.getInstance()
                .generateUrl(new CreateUrlRequest(crumb.getPage(), crumb.getView(), params)));
        this.add(crumbLink);

        separator = new Label(">");
        separator.addStyleName(StaticResourceBundle.INSTANCE.coreCss().breadcrumbSeparator());
        this.add(separator);
    }

    if (showItemLink) {
        Hyperlink crumbLink = new Hyperlink(thisItem,
                Session.getInstance().generateUrl(new CreateUrlRequest(new HashMap<String, String>(), true)));
        crumbLink.addStyleName(StaticResourceBundle.INSTANCE.coreCss().breadcrumbLabel());
        this.add(crumbLink);
    } else {
        Label label = new Label();
        label.setText(thisItem);
        label.addStyleName(StaticResourceBundle.INSTANCE.coreCss().breadcrumbLabel());
        this.add(label);
    }
}

From source file:org.eurekastreams.web.client.ui.pages.search.SearchResultItemRenderer.java

License:Apache License

/**
 * @param result//from   www .j av a  2 s  .c om
 *            the result to render.
 *
 * @return the result as a widget.
 */
public Panel render(final ModelView result) {
    Panel resultWidget;

    if (result instanceof PersonModelView) {
        resultWidget = (Panel) personRenderer.render((PersonModelView) result);
    } else if (result instanceof DomainGroupModelView) {
        resultWidget = (Panel) groupRenderer.render((DomainGroupModelView) result);
    } else {
        resultWidget = new FlowPanel();
        resultWidget.add(new Label("Unknown Result Type"));
    }

    Object[] resultArr = result.getFieldMatch().getMatchedFieldKeys().toArray();

    FlowPanel matchedWidget = new FlowPanel();

    if (resultArr.length > 0) {
        Label resultsLbl = new Label("Matches found in: ");
        matchedWidget.add(resultsLbl);
        matchedWidget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().searchMetadata());
        resultWidget.add(matchedWidget);
    }

    for (int i = 0; i < resultArr.length; i++) {
        Label keyLabel = new Label(humanReadableMetadataKeys.get(resultArr[i]));

        if (i + 1 < resultArr.length) {
            keyLabel.setText(keyLabel.getText() + ", ");
        }

        keyLabel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().searchMetadataKey());

        matchedWidget.add(keyLabel);
    }

    return resultWidget;
}

From source file:org.fourthline.konto.client.report.view.ReportResultViewImpl.java

License:Open Source License

@Override
public void setReportLines(LineReportCriteria criteria, Map<AccountType, ReportLines> linesByType) {
    reportPanel.clear();//from   w  ww . j  a va2 s  .c o m

    LineReportType reportType = criteria.getType();

    Label titleLabel = new Label(reportType.getLabel());
    titleLabel.addStyleName(style.titleLabel());
    Label titleLabelSub = new Label(reportType.getLabelSub(dateFormat, criteria));
    titleLabelSub.addStyleName(style.titleLabelSub());
    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.addStyleName(style.titlePanel());
    titlePanel.add(titleLabel);
    titlePanel.add(titleLabelSub);
    reportPanel.add(titlePanel);

    for (Map.Entry<AccountType, ReportLines> me : linesByType.entrySet()) {

        VerticalPanel blockPanel = new VerticalPanel();
        blockPanel.addStyleName(style.blockPanel());

        HorizontalPanel blockTitlePanel = new HorizontalPanel();
        blockTitlePanel.addStyleName(style.blockTitlePanel());
        Label blockLabel = new Label(me.getKey().getLabel());
        blockLabel.addStyleName(style.blockLabel());
        blockTitlePanel.add(blockLabel);

        Label blockSumLabel = new Label();
        blockSumLabel.addStyleName(style.blockSumLabel());
        blockSumLabel.setText(reportType.getTypeSum(roundFractions, me.getKey(), linesByType));
        blockTitlePanel.add(blockSumLabel);

        blockPanel.add(blockTitlePanel);

        ReportLinesTable linesTable = new ReportLinesTable(new ReportLinesTable.Resources() {
            @Override
            public ReportLinesTable.Style style() {
                return style;
            }
        }) {
            @Override
            protected void onLineClick(LedgerCoordinates ledgerCoordinates) {
                presenter.goTo(new LedgerPlace(ledgerCoordinates));
            }
        };
        linesTable.setDateFormat(dateFormat);
        linesTable.setRoundFractions(roundFractions);
        linesTable.setValue(me.getValue(), criteria);
        linesTable.addStyleName(style.linesTable());
        blockPanel.add(linesTable);

        reportPanel.add(blockPanel);
    }

    String totalSum = reportType.getTotalSum(roundFractions, linesByType);
    if (totalSum != null) {
        Label totalLabel = new Label(totalSum);
        totalLabel.addStyleName(style.totalSumLabel());
        VerticalPanel totalPanel = new VerticalPanel();
        totalPanel.addStyleName(style.totalPanel());
        totalPanel.add(totalLabel);
        reportPanel.add(totalPanel);
    }

    getWidget().setVisible(true);
}