Package it.unipd.netmus.client.ui

Examples of it.unipd.netmus.client.ui.ProfileView


            @Override
            public void onSuccess(final String user) {

                client_factory.getProfileView().setUser(user);
                final ProfileView profileView = client_factory.getProfileView();

                // Gestore degli eventi DeviceScannedEvent. Questo metodo viene
                // invocato al termine
                // di ogni inserimento di canzoni (sia da USB che da file
                // system)
                client_factory.getEventBus().addHandler(
                        DeviceScannedEvent.TYPE,
                        new DeviceScannedEventHandler() {

                            // L'evento porta con se la lista delle nuove
                            // canzoni inserite, queste
                            // vanno ad aggiornare la libreria dell'utente
                            // mantenuta nell'activity
                            @Override
                            public void onScanDevice(DeviceScannedEvent event) {

                                List<String> tmp_list = new ArrayList<String>();

                                for (SongDTO tmp : event.getNewSongs()) {
                                    if (!tmp.getTitle().equals("")) {

                                        if (current_user
                                                .getMusicLibrary()
                                                .getSongs()
                                                .put(FieldVerifier.generateSongId(
                                                        tmp.getTitle(),
                                                        tmp.getArtist(),
                                                        tmp.getAlbum()),
                                                        new SongSummaryDTO(tmp
                                                                .getArtist(),
                                                                tmp.getTitle(),
                                                                tmp.getAlbum())) == null) {
                                            tmp_list.add(tmp.getArtist());
                                            tmp_list.add(tmp.getTitle());
                                            tmp_list.add(tmp.getAlbum());
                                        }
                                    }
                                }

                                client_factory.getProfileView().paintCatalogo(
                                        tmp_list);

                                if (event.isLastSongs()) {
                                    client_factory.getProfileView()
                                            .sortCatalogo();

                                    String preferred_artist = calculatePreferredArtist(current_user
                                            .getMusicLibrary().getSongs());

                                    // Aggiornamento delle statistiche calcolate
                                    // nel catalogo mantenuto nel client
                                    current_user.getMusicLibrary()
                                            .setPreferred_artist(
                                                    preferred_artist);

                                    // Aggiornamento delle statistiche calcolate
                                    // nel Datastore
                                    library_service_svc.storeStatistics(
                                            current_user.getUser(),
                                            preferred_artist, "", "",
                                            new AsyncCallback<Void>() {
                                                @Override
                                                public void onFailure(
                                                        Throwable caught) {
                                                    client_factory
                                                            .getProfileView()
                                                            .showError(
                                                                    my_constants
                                                                            .storeStatisticsError());

                                                }

                                                @Override
                                                public void onSuccess(
                                                        Void result) {
                                                }
                                            });

                                    // Aggiornamento della lista degli utenti
                                    // affini
                                    setFriendList();

                                }
                            }

                        });

                profileView.setName(name);
                profileView.setPresenter(ProfileActivity.this);

                // inizializzazione dell'UserCompleteDTO mantenuto nell'activity
                user_service_svc.loadProfile(user,
                        new AsyncCallback<UserCompleteDTO>() {
                            @Override
                            public void onFailure(Throwable caught) {
                                client_factory.getProfileView().showError(
                                        my_constants.loadProfileError());
                            }

                            @Override
                            public void onSuccess(UserCompleteDTO result) {
                                current_user = result;

                                List<String> tmp = new ArrayList<String>();
                                for (SongSummaryDTO dto : result
                                        .getMusicLibrary().getSongs().values()) {
                                    tmp.add(dto.getArtist());
                                    tmp.add(dto.getTitle());
                                    tmp.add(dto.getAlbum());
                                }
                                client_factory.getProfileView().paintCatalogo(
                                        tmp);
                                client_factory.getProfileView().sortCatalogo();

                                setPlaylistList();
                                setFriendList();
                                profileView.setUser(user);
                                profileView.setInfo(getSongInfo());
                                editProfileView(user);

                                container_widget.setWidget(profileView
                                        .asWidget());
                                profileView.setLayout();
                               
                                if (tmp.size() == 0) {
                                    // mostra help
                                    client_factory.getProfileView().showHelp();
                                }
View Full Code Here

TOP

Related Classes of it.unipd.netmus.client.ui.ProfileView

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.