@Override public void filmSuccesfullyRated(FichaPelicula film) { this.setFilm(film); boolean flag = !film.getNotaUsuario().equals("-1"); yourMarkLabel.setVisible(flag); usersMarkFrame.setVisible(flag); usersMarkLabel.setText(film.getNotaUsuario()); usersMarkLabel.setVisible(flag); }
public boolean addTransmission(HelperItem item) { if (!initialized) { return false; } try { String itemType = ""; boolean alreadyExists = false; if (item.getClass() == FichaPelicula.class) { FichaPelicula film = (FichaPelicula) item; alreadyExists = itemAlreadyExists(film.getTitulo(), FICHAPELICULA_ITEM_TYPE); itemType = Transmision.TRANSMISSION_TYPE_FILM; } else if (item.getClass() == Artista.class) { Artista artist = (Artista) item; alreadyExists = itemAlreadyExists(artist.getNombre(), ARTISTA_ITEM_TYPE); itemType = Transmision.TRANSMISSION_TYPE_ARTIST; } else if (item.getClass() == Disco.class) { Disco album = (Disco) item; alreadyExists = itemAlreadyExists(album.getNombre(), album.getArtista(), ALBUM_ITEM_TYPE); itemType = Transmision.TRANSMISSION_TYPE_ALBUM; } if (alreadyExists) { return true; } Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Transmision t = new Transmision(); t.setTipoItem(itemType); t.setFecha(new Date()); t.setHelperItem(item); t.setRated(false); session.save(item); session.save(t); session.getTransaction().commit(); return true; } catch (Exception exc) { return false; } }
private void initLabels() { System.out.println("Detalles de \n" + this.getFilm()); FichaPelicula film = this.getFilm(); try { if (film.getImageUrl() != null) { imageURL = new URL(film.getImageUrl()); Thread t = new Thread(this); t.start(); } } catch (MalformedURLException e) { System.out.println("BAD URL: " + film.getImageUrl()); } UtilTools tools = new UtilTools(); titleLabel.setText(film.getTitulo()); tools.setToolTipText(titleLabel, film.getTitulo()); originalTitleLabel.setText(film.getTituloOriginal()); tools.setToolTipText(originalTitleLabel, film.getTituloOriginal()); if (film.getDirector() != null) { for (int i = 0; i < film.getDirector().length; i++) { JLabel directorLabel = new JLabel("<HTML><U>" + film.getDirector()[i] + "<U><HTML>"); directorLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); directorLabel.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JLabel tag = (JLabel) e.getSource(); if (e.getClickCount() == 1) { searchDirector(tag.getText()); } } }); directorLabel.setFont(new Font("Tahoma", Font.PLAIN, 11)); directorsPane.add(directorLabel); } } sinopsisTextPane.setText(film.getSinopsis()); if (film.getReparto() != null) { castingList.setListData(film.getReparto()); } else { castingScrollPane.setEnabled(false); } if (film.getPremios() != null) { prizesList.setListData(film.getPremios()); } else { prizesScrollPane.setEnabled(false); } if (film.getCriticas() != null) { reviewsTable.setModel(new ReviewsTableModel(mainFrame, this.getFilm())); reviewsTable.getColumnModel().getColumn(2).setCellRenderer(new JTableButtonRenderer()); reviewsTable.addMouseListener(new JTableButtonMouseListener(reviewsTable)); DefaultTableCellRenderer leftRenderer = new DefaultTableCellRenderer(); leftRenderer.setHorizontalAlignment(JLabel.LEFT); reviewsTable.getColumnModel().getColumn(0).setCellRenderer(leftRenderer); reviewsTable.setRowHeight(35); reviewsTable.getColumnModel().getColumn(0).setPreferredWidth(100); reviewsTable.getColumnModel().getColumn(1).setPreferredWidth(10); reviewsTable.getColumnModel().getColumn(2).setPreferredWidth(40); } else { reviewsScrollPane.setEnabled(false); } countryLabel.setText(film.getPais()); tools.setToolTipText(countryLabel, film.getPais()); yearLabel.setText(film.getAño()); markLabel.setText(film.getValoracion()); boolean userLogged = FilmAffinityBot.getInstance().isLogged(); yourMarkLabel.setVisible(userLogged); usersMarkFrame.setVisible(userLogged); usersMarkLabel.setText( !userLogged || film.getNotaUsuario() == null || (film.getNotaUsuario().equals("-1")) ? "" : film.getNotaUsuario()); usersMarkLabel.setVisible(userLogged); twinSoulsMarkFrame.setVisible(userLogged); twinSoulsMarkLabel.setText(film.getNotaAlmasGemelas()); twinSoulsMarkLabel.setVisible(userLogged); rateButton.setEnabled(userLogged); }