Package name.pehl.karaka.client.model

Examples of name.pehl.karaka.client.model.Highlighter


    @Override
    public void onFindActivity(final Request request, final Callback callback)
    {
        final String query = request.getQuery();
        final Highlighter highlighter = new Highlighter(query);
        dispatcher.execute(new FindActivityAction(query), new KarakaCallback<FindActivityResult>(getEventBus())
        {
            @Override
            public void onSuccess(final FindActivityResult result)
            {
                List<Activity> activities = result.getActivities();
                if (!activities.isEmpty())
                {
                    List<NamedModelSuggestion<Activity>> suggestions = new ArrayList<NamedModelSuggestion<Activity>>();
                    for (Activity activity : activities)
                    {
                        StringBuilder displayString = new StringBuilder();
                        displayString.append(activity.getName());
                        if (activity.getDescription() != null)
                        {
                            displayString.append(": ").append(activity.getDescription());
                        }
                        if (activity.getProject() != null)
                        {
                            displayString.append(", (Project: ").append(activity.getProject().getName()).append(")");
                        }
                        NamedModelSuggestion<Activity> suggestion = new NamedModelSuggestion<Activity>(activity,
                                activity.getName(), highlighter.highlight(displayString.toString()));
                        suggestions.add(suggestion);
                    }
                    callback.onSuggestionsReady(request, new Response(suggestions));
                }
            }
View Full Code Here

TOP

Related Classes of name.pehl.karaka.client.model.Highlighter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.