movie list
This commit is contained in:
@@ -6,8 +6,11 @@ import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.Tabbox;
|
||||
import org.zkoss.zul.Tabs;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
|
||||
public class indexForwardComposer extends GenericForwardComposer<Component>
|
||||
@@ -23,9 +26,31 @@ public class indexForwardComposer extends GenericForwardComposer<Component>
|
||||
@Wire
|
||||
protected Label height;
|
||||
|
||||
@Wire
|
||||
protected Tabbox tabbox;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception
|
||||
{
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
String redir = "";
|
||||
|
||||
try
|
||||
{
|
||||
File file = new File("redir");
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
redir = reader.readLine();
|
||||
reader.close();
|
||||
file.delete();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
if(redir.compareToIgnoreCase("movie") == 0)
|
||||
{
|
||||
tabbox.setSelectedIndex(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,717 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TheMovieDbApi;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.Language;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCrew;
|
||||
import com.omertron.themoviedbapi.model.media.Video;
|
||||
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||
import com.omertron.themoviedbapi.model.movie.ProductionCompany;
|
||||
import com.omertron.themoviedbapi.model.movie.ProductionCountry;
|
||||
import com.omertron.themoviedbapi.model.network.Network;
|
||||
import com.omertron.themoviedbapi.model.person.PersonBasic;
|
||||
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.yamj.api.common.http.SimpleHttpClientBuilder;
|
||||
import org.zkoss.zul.ListModelList;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class movieData
|
||||
{
|
||||
private int m_movieID;
|
||||
private String m_movieTitle;
|
||||
private String m_originalTitle;
|
||||
private String m_backdropPath;
|
||||
private String m_posterPath;
|
||||
private String m_overview;
|
||||
private Date m_releaseDate;
|
||||
private String m_genre;
|
||||
private String m_IMDBID;
|
||||
private String m_originalLanguage;
|
||||
private double m_popularity;
|
||||
private String m_productionCompanies;
|
||||
private String m_productionCountries;
|
||||
private double m_voteAverage;
|
||||
private int m_voteCount;
|
||||
private String m_adult;
|
||||
private String m_belongsToCollection;
|
||||
private double m_budget;
|
||||
private String m_homepage;
|
||||
private double m_revenue;
|
||||
private int m_runtime;
|
||||
private String m_spokenLanguages;
|
||||
private String m_status;
|
||||
private String m_tagline;
|
||||
private String m_video;
|
||||
private String m_cast;
|
||||
private String m_crew;
|
||||
private int m_state;
|
||||
private String m_localPath;
|
||||
private String m_resolution;
|
||||
private ListModelList m_model;
|
||||
|
||||
private final movieDataSource ds = movieDataSource.INSTANCE;
|
||||
|
||||
public movieData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int getMovieID()
|
||||
{
|
||||
return (m_movieID);
|
||||
}
|
||||
|
||||
public void setMovieID(int movieID)
|
||||
{
|
||||
m_movieID = movieID;
|
||||
}
|
||||
|
||||
public String getMovieTitle()
|
||||
{
|
||||
return (m_movieTitle);
|
||||
}
|
||||
|
||||
public void setMovieTitle(String movieTitle)
|
||||
{
|
||||
m_movieTitle = movieTitle;
|
||||
}
|
||||
|
||||
public String getOriginalTitle()
|
||||
{
|
||||
return (m_originalTitle);
|
||||
}
|
||||
|
||||
public void setOriginalTitle(String originalTitle)
|
||||
{
|
||||
m_originalTitle = originalTitle;
|
||||
}
|
||||
|
||||
public String getBackdropPath()
|
||||
{
|
||||
return (m_backdropPath);
|
||||
}
|
||||
|
||||
public void setBackdropPath(String backdropPath)
|
||||
{
|
||||
m_backdropPath = backdropPath;
|
||||
}
|
||||
|
||||
public String getPosterPath()
|
||||
{
|
||||
return (m_posterPath);
|
||||
}
|
||||
|
||||
public void setPosterPath(String posterPath)
|
||||
{
|
||||
m_posterPath = posterPath;
|
||||
}
|
||||
|
||||
public String getOverview()
|
||||
{
|
||||
return (m_overview);
|
||||
}
|
||||
|
||||
public void setOverview(String overview)
|
||||
{
|
||||
m_overview = overview;
|
||||
}
|
||||
|
||||
public Date getReleaseDate()
|
||||
{
|
||||
return (m_releaseDate);
|
||||
}
|
||||
|
||||
public void setReleaseDate(Date releaseDate)
|
||||
{
|
||||
m_releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public String getGenre()
|
||||
{
|
||||
return (m_genre);
|
||||
}
|
||||
|
||||
public void setGenre(String genre)
|
||||
{
|
||||
m_genre = genre;
|
||||
}
|
||||
|
||||
public String getIMDBID()
|
||||
{
|
||||
return (m_IMDBID);
|
||||
}
|
||||
|
||||
public void setIMDBID(String IMDBID)
|
||||
{
|
||||
m_IMDBID = IMDBID;
|
||||
}
|
||||
|
||||
public String getOriginalLanguage()
|
||||
{
|
||||
return (m_originalLanguage);
|
||||
}
|
||||
|
||||
public void setOriginalLanguage(String originalLanguage)
|
||||
{
|
||||
m_originalLanguage = originalLanguage;
|
||||
}
|
||||
|
||||
public double getPopularity()
|
||||
{
|
||||
return (m_popularity);
|
||||
}
|
||||
|
||||
public void setPopularity(double popularity)
|
||||
{
|
||||
m_popularity = popularity;
|
||||
}
|
||||
|
||||
public String getProductionCompanies()
|
||||
{
|
||||
return (m_productionCompanies);
|
||||
}
|
||||
|
||||
public void setProductionCompanies(String productionCompanies)
|
||||
{
|
||||
m_productionCompanies = productionCompanies;
|
||||
}
|
||||
|
||||
public String getProductionCountries()
|
||||
{
|
||||
return (m_productionCountries);
|
||||
}
|
||||
|
||||
public void setProductionCountries(String productionCountries)
|
||||
{
|
||||
m_productionCountries = productionCountries;
|
||||
}
|
||||
|
||||
public double getVoteAverage()
|
||||
{
|
||||
return (m_voteAverage);
|
||||
}
|
||||
|
||||
public void setVoteAverage(double voteAverage)
|
||||
{
|
||||
m_voteAverage = voteAverage;
|
||||
}
|
||||
|
||||
public int getVoteCount()
|
||||
{
|
||||
return (m_voteCount);
|
||||
}
|
||||
|
||||
public void setVoteCount(int voteCount)
|
||||
{
|
||||
m_voteCount = voteCount;
|
||||
}
|
||||
|
||||
public String getAdult()
|
||||
{
|
||||
return (m_adult);
|
||||
}
|
||||
|
||||
public void setAdult(String adult)
|
||||
{
|
||||
m_adult = adult;
|
||||
}
|
||||
|
||||
public String getBelongsToCollection()
|
||||
{
|
||||
return (m_belongsToCollection);
|
||||
}
|
||||
|
||||
public void setBelongsToCollection(String belongsToCollection)
|
||||
{
|
||||
m_belongsToCollection = belongsToCollection;
|
||||
}
|
||||
|
||||
public double getBudget()
|
||||
{
|
||||
return (m_budget);
|
||||
}
|
||||
|
||||
public void setBudget(double budget)
|
||||
{
|
||||
m_budget = budget;
|
||||
}
|
||||
|
||||
public String getHomepage()
|
||||
{
|
||||
return (m_homepage);
|
||||
}
|
||||
|
||||
public void setHomepage(String homepage)
|
||||
{
|
||||
m_homepage = homepage;
|
||||
}
|
||||
|
||||
public double getRevenue()
|
||||
{
|
||||
return (m_revenue);
|
||||
}
|
||||
|
||||
public void setRevenue(double revenue)
|
||||
{
|
||||
m_revenue = revenue;
|
||||
}
|
||||
|
||||
public int getRuntime()
|
||||
{
|
||||
return (m_runtime);
|
||||
}
|
||||
|
||||
public void setRuntime(int runtime)
|
||||
{
|
||||
m_runtime = runtime;
|
||||
}
|
||||
|
||||
public String getSpokenLanguages()
|
||||
{
|
||||
return (m_spokenLanguages);
|
||||
}
|
||||
|
||||
public void setSpokenLanguages(String spokenLanguages)
|
||||
{
|
||||
m_spokenLanguages = spokenLanguages;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return (m_status);
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
public String getTagline()
|
||||
{
|
||||
return (m_tagline);
|
||||
}
|
||||
|
||||
public void setTagline(String tagline)
|
||||
{
|
||||
m_tagline = tagline;
|
||||
}
|
||||
|
||||
public String getVideo()
|
||||
{
|
||||
return (m_video);
|
||||
}
|
||||
|
||||
public void setVideo(String video)
|
||||
{
|
||||
m_video = video;
|
||||
}
|
||||
|
||||
public String getCast()
|
||||
{
|
||||
return (m_cast);
|
||||
}
|
||||
|
||||
public void setCast(String cast)
|
||||
{
|
||||
m_cast = cast;
|
||||
}
|
||||
|
||||
public String getCrew()
|
||||
{
|
||||
return (m_crew);
|
||||
}
|
||||
|
||||
public void setCrew(String crew)
|
||||
{
|
||||
m_crew = crew;
|
||||
}
|
||||
|
||||
public int getState()
|
||||
{
|
||||
return (m_state);
|
||||
}
|
||||
|
||||
public void setState(int state)
|
||||
{
|
||||
m_state = state;
|
||||
}
|
||||
|
||||
public String getLocalPath()
|
||||
{
|
||||
return (m_localPath);
|
||||
}
|
||||
|
||||
public void setLocalPath(String localPath)
|
||||
{
|
||||
m_localPath = localPath;
|
||||
}
|
||||
|
||||
public String getResolution()
|
||||
{
|
||||
return (m_resolution);
|
||||
}
|
||||
|
||||
public void setResolution(String resolution)
|
||||
{
|
||||
m_resolution = resolution;
|
||||
}
|
||||
|
||||
public ListModelList getModel()
|
||||
{
|
||||
return (m_model);
|
||||
}
|
||||
|
||||
public void setModel(ListModelList model)
|
||||
{
|
||||
m_model = model;
|
||||
}
|
||||
|
||||
public boolean save()
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection conn = ds.getConnection();
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.execute("DELETE FROM movie WHERE movieID=" + m_movieID + ";");
|
||||
|
||||
PreparedStatement ps = conn.prepareStatement("INSERT INTO movie (" +
|
||||
"movieID, " +
|
||||
"movieTitle, " +
|
||||
"originalTitle, " +
|
||||
"backdropPath, " +
|
||||
"posterPath, " +
|
||||
"overview, " +
|
||||
"releaseDate, " +
|
||||
"genre, " +
|
||||
"imdbid, " +
|
||||
"originalLanguage, " +
|
||||
"popularity, " +
|
||||
"productionCompanies, " +
|
||||
"productionCountries, " +
|
||||
"voteAverage, " +
|
||||
"voteCount, " +
|
||||
"adult, " +
|
||||
"belongsToCollection, " +
|
||||
"budget, " +
|
||||
"homepage, " +
|
||||
"revenue, " +
|
||||
"runtime, " +
|
||||
"spokenLanguages, " +
|
||||
"status, " +
|
||||
"tagline, " +
|
||||
"video, " +
|
||||
"`cast`, " +
|
||||
"crew, " +
|
||||
"state, " +
|
||||
"localPath, " +
|
||||
"resolution " +
|
||||
") VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"
|
||||
);
|
||||
ps.setInt(1, m_movieID);
|
||||
ps.setString(2, m_movieTitle);
|
||||
ps.setString(3, m_originalTitle);
|
||||
ps.setString(4, m_backdropPath);
|
||||
ps.setString(5, m_posterPath);
|
||||
ps.setString(6, m_overview);
|
||||
ps.setDate(7, m_releaseDate);
|
||||
ps.setString(8, m_genre);
|
||||
ps.setString(9, m_IMDBID);
|
||||
ps.setString(10, m_originalLanguage);
|
||||
ps.setDouble(11, m_popularity);
|
||||
ps.setString(12, m_productionCompanies);
|
||||
ps.setString(13, m_productionCountries);
|
||||
ps.setDouble(14, m_voteAverage);
|
||||
ps.setInt(15, m_voteCount);
|
||||
ps.setString(16, m_adult);
|
||||
ps.setString(17, m_belongsToCollection);
|
||||
ps.setDouble(18, m_budget);
|
||||
ps.setString(19, m_homepage);
|
||||
ps.setDouble(20, m_revenue);
|
||||
ps.setInt(21, m_runtime);
|
||||
ps.setString(22, m_spokenLanguages);
|
||||
ps.setString(23, m_status);
|
||||
ps.setString(24, m_tagline);
|
||||
ps.setString(25, m_video);
|
||||
ps.setString(26, m_cast);
|
||||
ps.setString(27, m_crew);
|
||||
ps.setInt(28, m_state);
|
||||
ps.setString(29, m_localPath);
|
||||
ps.setString(30, m_resolution);
|
||||
|
||||
boolean ret = ps.execute();
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
ds.close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
String personListToString(List<PersonBasic> personList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(PersonBasic p : personList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + p.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String stringListToString(List<String> stringList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(String s : stringList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + s;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String networkListToString(List<Network> networkList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(Network n : networkList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + n.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String productionCompaniesListToString(List<ProductionCompany> productionCompanyList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(ProductionCompany c : productionCompanyList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + c.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String productionCountriesListToString(List<ProductionCountry> productionCountryList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(ProductionCountry c : productionCountryList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + c.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String spokenLanguagesListToString(List<Language> spokenLanguagesList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(Language c : spokenLanguagesList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + c.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
String videoListToString(List<Video> videoList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(Video c : videoList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + c.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String castListToString(List<MediaCreditCast> castList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(MediaCreditCast p : castList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + "|";
|
||||
str = str + p.getName() + "," + p.getCharacter();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String crewListToString(List<MediaCreditCrew> crewList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(MediaCreditCrew p : crewList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + "|";
|
||||
str = str + p.getName() + "," + p.getJob();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String genreListToString(List<Genre> genreList)
|
||||
{
|
||||
String str = "";
|
||||
boolean first = true;
|
||||
|
||||
for(Genre g : genreList)
|
||||
{
|
||||
if(first)
|
||||
first = false;
|
||||
else
|
||||
str = str + ",";
|
||||
str = str + g.getName();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
Date string2Date(String strDate)
|
||||
{
|
||||
if(strDate == null)
|
||||
return new Date(1900, 1, 1);
|
||||
else if(strDate.isEmpty())
|
||||
return new Date(1900, 1, 1);
|
||||
else
|
||||
return Date.valueOf(strDate);
|
||||
}
|
||||
|
||||
public boolean fromTMDB(int id) throws MovieDbException
|
||||
{
|
||||
HttpClient httpClient;
|
||||
HttpTools httpTools;
|
||||
|
||||
httpClient = new SimpleHttpClientBuilder().build();
|
||||
httpTools = new HttpTools(httpClient);
|
||||
|
||||
TheMovieDbApi api = new TheMovieDbApi("a33271b9e54cdcb9a80680eaf5522f1b", httpClient);
|
||||
return fromTMDB(id, api);
|
||||
}
|
||||
|
||||
public boolean fromTMDB(int id, TheMovieDbApi api) throws MovieDbException
|
||||
{
|
||||
String appendToResponse = "credits,external_ids";
|
||||
|
||||
MovieInfo movie = api.getMovieInfo(id, "de", appendToResponse);
|
||||
|
||||
m_movieID = movie.getId();
|
||||
m_movieTitle = movie.getTitle();
|
||||
m_originalTitle = movie.getOriginalTitle();
|
||||
m_backdropPath = movie.getBackdropPath();
|
||||
m_posterPath = movie.getPosterPath();
|
||||
m_overview = movie.getOverview();
|
||||
m_releaseDate = string2Date(movie.getReleaseDate());
|
||||
m_genre = genreListToString(movie.getGenres());
|
||||
m_IMDBID = movie.getImdbID();
|
||||
m_originalLanguage = movie.getOriginalLanguage();
|
||||
m_popularity = movie.getPopularity();
|
||||
m_productionCompanies = productionCompaniesListToString(movie.getProductionCompanies());
|
||||
m_productionCountries = productionCountriesListToString(movie.getProductionCountries());
|
||||
m_voteAverage = movie.getVoteAverage();
|
||||
m_voteCount = movie.getVoteCount();
|
||||
// m_adult = movie;
|
||||
// m_belongsToCollection = movie;
|
||||
m_budget = movie.getBudget();
|
||||
m_homepage = movie.getHomepage();
|
||||
m_revenue = movie.getRevenue();
|
||||
m_runtime = movie.getRuntime();
|
||||
m_spokenLanguages = spokenLanguagesListToString(movie.getSpokenLanguages());
|
||||
m_status = movie.getStatus();
|
||||
m_tagline = movie.getTagline();
|
||||
m_video = videoListToString(movie.getVideos());
|
||||
m_cast = castListToString(movie.getCast());
|
||||
m_crew = crewListToString(movie.getCrew());
|
||||
m_state = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void copyFrom(movieData movie)
|
||||
{
|
||||
setLocalPath(movie.getLocalPath());
|
||||
setResolution(movie.getResolution());
|
||||
setState(movie.getState());
|
||||
}
|
||||
|
||||
public String getMovieStyle()
|
||||
{
|
||||
String style = "";
|
||||
|
||||
String color = "";
|
||||
|
||||
if(m_state == 1)
|
||||
color = "background-color: #C0C0C0;";
|
||||
else if(m_state == 2)
|
||||
color = "background-color: #0000C0; color: #FFFFFF";
|
||||
else
|
||||
color = "background-color: #00C000;";
|
||||
|
||||
style += color;
|
||||
|
||||
return style;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public enum movieDataSource
|
||||
{
|
||||
INSTANCE;
|
||||
|
||||
private static final String url = "jdbc:mysql://localhost:3306/multimedia";
|
||||
private static final String user = "multimedia";
|
||||
private static final String pwd = "WeissIchNicht8";
|
||||
|
||||
private Connection conn = null;
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
}
|
||||
catch(ClassNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private movieDataSource()
|
||||
{
|
||||
// drop the table if it exists
|
||||
try
|
||||
{
|
||||
Statement stmt = this.getStatement();
|
||||
stmt.close();
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
public Statement getStatement() throws SQLException
|
||||
{
|
||||
Statement stmt = null;
|
||||
// get connection
|
||||
conn = DriverManager.getConnection(url, user, pwd);
|
||||
stmt = conn.createStatement();
|
||||
return stmt;
|
||||
}
|
||||
|
||||
public Connection getConnection() throws SQLException
|
||||
{
|
||||
conn = DriverManager.getConnection(url, user, pwd);
|
||||
return conn;
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(conn != null)
|
||||
{
|
||||
conn.close();
|
||||
conn = null;
|
||||
}
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import org.zkoss.image.AImage;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
import java.net.URL;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class movieDetailsForwardComposer extends GenericForwardComposer<Component>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final movieDataSource ds = movieDataSource.INSTANCE;
|
||||
private int opacity = 80;
|
||||
|
||||
@Wire
|
||||
private Window detailsMovie;
|
||||
|
||||
@Wire
|
||||
protected Groupbox overview;
|
||||
|
||||
@Wire
|
||||
protected Label overviewLabel;
|
||||
|
||||
@Wire
|
||||
protected Groupbox settings;
|
||||
|
||||
@Wire
|
||||
protected Textbox localPath;
|
||||
|
||||
@Wire
|
||||
protected Combobox resolution;
|
||||
|
||||
@Wire
|
||||
protected Radiogroup progress;
|
||||
|
||||
@Wire
|
||||
protected Hbox buttons;
|
||||
|
||||
@Wire
|
||||
protected Button saveButton;
|
||||
|
||||
@Wire
|
||||
protected Button cancelButton;
|
||||
|
||||
@Wire
|
||||
protected Button updateButton;
|
||||
|
||||
@Wire
|
||||
protected Button deleteButton;
|
||||
|
||||
private movieData m_movie;
|
||||
private Listitem m_item;
|
||||
private Listitem m_list;
|
||||
|
||||
protected TreeMap<String, Radiogroup> radioGroups = new TreeMap<>();
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception
|
||||
{
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
overview.setStyle("opacity: " + opacity + "%");
|
||||
settings.setStyle("opacity: " + opacity + "%");
|
||||
|
||||
int hD = (int) self.getDesktop().getAttribute("desktopHeight");
|
||||
int wD = (int) self.getDesktop().getAttribute("desktopWidth");
|
||||
|
||||
detailsMovie.setWidth(wD - 10 + "px");
|
||||
detailsMovie.setHeight(hD - 10 + "px");
|
||||
|
||||
if(arg.containsKey("movie"))
|
||||
m_movie = (movieData) arg.get("movie");
|
||||
else
|
||||
detailsMovie.detach();
|
||||
|
||||
if(arg.containsKey("item"))
|
||||
m_item = (Listitem) arg.get("item");
|
||||
else
|
||||
detailsMovie.detach();
|
||||
|
||||
detailsMovie.setAttribute("movie", m_movie);
|
||||
detailsMovie.setAttribute("item", m_item);
|
||||
|
||||
if(m_movie.getBackdropPath() != null)
|
||||
{
|
||||
String uri = "http://image.tmdb.org/t/p/original" + m_movie.getBackdropPath();
|
||||
URL url = new URL(uri);
|
||||
AImage img = new AImage(url);
|
||||
|
||||
int w = Integer.parseInt(detailsMovie.getWidth().replace("px", ""));
|
||||
int h = Integer.parseInt(detailsMovie.getHeight().replace("px", ""));
|
||||
int wI = img.getWidth();
|
||||
int hI = img.getHeight();
|
||||
int wR = w;
|
||||
int hR = hI * w / wI;
|
||||
|
||||
if(hR < h)
|
||||
{
|
||||
hR = h;
|
||||
wR = wI * h / hI;
|
||||
}
|
||||
|
||||
String size = wR + "px " + hR + "px";
|
||||
String format = "overflow:auto; background:url('%1$s') no-repeat center center fixed; -webkit-background-size: " + size + "; -moz-background-size: \" + size + \"; -o-background-size: \" + size + \"; background-size: \" + size + \";";
|
||||
String style = String.format(format, uri);
|
||||
detailsMovie.setContentStyle(style);
|
||||
}
|
||||
|
||||
Statement stmt = ds.getStatement();
|
||||
ResultSet rs = stmt.executeQuery(
|
||||
"SELECT resolution" +
|
||||
" FROM resolution" +
|
||||
" ORDER BY sort;"
|
||||
);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
resolution.appendItem(rs.getString("resolution"));
|
||||
}
|
||||
|
||||
detailsMovie.setTitle(m_movie.getMovieTitle() + " (" + m_movie.getReleaseDate() + ")");
|
||||
overviewLabel.setValue(m_movie.getOverview());
|
||||
localPath.setValue(m_movie.getLocalPath());
|
||||
resolution.setValue(m_movie.getResolution());
|
||||
progress.setSelectedIndex(m_movie.getState()-1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.select.SelectorComposer;
|
||||
import org.zkoss.zk.ui.select.annotation.Listen;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
public class movieDetailsSelectorComposer extends SelectorComposer<Component>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Wire
|
||||
private Window detailsMovie;
|
||||
|
||||
@Wire
|
||||
protected Textbox localPath;
|
||||
|
||||
@Wire
|
||||
protected Combobox resolution;
|
||||
|
||||
@Wire
|
||||
protected Radiogroup progress;
|
||||
|
||||
@Listen("onClick = #saveButton")
|
||||
public void save()
|
||||
{
|
||||
movieData movie = getCurrentValues();
|
||||
movie.save();
|
||||
|
||||
Listitem item = (Listitem) detailsMovie.getAttribute("item");
|
||||
movieData movie1 = (movieData) detailsMovie.getAttribute("movie");
|
||||
ListModelList model = movie1.getModel();
|
||||
int index = item.getIndex();
|
||||
|
||||
movie.setModel(model);
|
||||
model.remove(index);
|
||||
model.add(index, movie);
|
||||
|
||||
detailsMovie.onClose();
|
||||
}
|
||||
|
||||
@Listen("onClick = #cancelButton")
|
||||
public void cancel()
|
||||
{
|
||||
detailsMovie.onClose();
|
||||
}
|
||||
|
||||
@Listen("onClick = #updateButton")
|
||||
public void update()
|
||||
{
|
||||
movieData movie = (movieData) detailsMovie.getAttribute("movie");
|
||||
movieData movieNew;
|
||||
|
||||
try
|
||||
{
|
||||
movieNew = new movieData();
|
||||
movieNew.fromTMDB(movie.getMovieID());
|
||||
movieNew.copyFrom(movie);
|
||||
|
||||
movieNew.save();
|
||||
|
||||
Listitem item = (Listitem) detailsMovie.getAttribute("item");
|
||||
ListModelList model = movie.getModel();
|
||||
|
||||
int index = item.getIndex();
|
||||
|
||||
movieNew.setModel(model);
|
||||
model.remove(index);
|
||||
model.add(index, movieNew);
|
||||
}
|
||||
catch(MovieDbException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
detailsMovie.onClose();
|
||||
}
|
||||
|
||||
@Listen("onClick = #deleteButton")
|
||||
public void delete()
|
||||
{
|
||||
movieData movie = (movieData) detailsMovie.getAttribute("movie");
|
||||
|
||||
Messagebox.show("Are you sure to delete \"" + movie.getMovieTitle() + "\"?", "Confirm Dialog", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION, new org.zkoss.zk.ui.event.EventListener()
|
||||
{
|
||||
public void onEvent(Event evt) throws InterruptedException
|
||||
{
|
||||
if(evt.getName().equals("onYES"))
|
||||
{
|
||||
// alert("Data Saved!");
|
||||
detailsMovie.onClose();
|
||||
}
|
||||
else
|
||||
{
|
||||
detailsMovie.onClose();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private movieData getCurrentValues()
|
||||
{
|
||||
movieData movie = (movieData) detailsMovie.getAttribute("movie");
|
||||
|
||||
movie.setLocalPath(localPath.getValue());
|
||||
movie.setResolution(resolution.getValue());
|
||||
movie.setState(progress.getSelectedIndex()+1);
|
||||
|
||||
return movie;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import at.windesign.application.serie.serieDataSource;
|
||||
import at.windesign.application.serie.serieUtils;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Listbox;
|
||||
|
||||
public class movieListForwardComposer extends GenericForwardComposer
|
||||
{
|
||||
protected Listbox movieList; // autowired
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception
|
||||
{
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
movieDataSource ds = movieDataSource.INSTANCE;
|
||||
movieUtils.loadMovies(ds, movieList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.select.SelectorComposer;
|
||||
import org.zkoss.zk.ui.select.annotation.Listen;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zul.Listbox;
|
||||
import org.zkoss.zul.Listitem;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class movieListSelectorComposer extends SelectorComposer<Component>
|
||||
{
|
||||
@Wire
|
||||
private Listbox movieList;
|
||||
|
||||
@Listen("onDoubleClick = #movieList")
|
||||
public void onClickMovieList()
|
||||
{
|
||||
Listitem item = movieList.getSelectedItem();
|
||||
|
||||
if(item == null)
|
||||
return;
|
||||
|
||||
movieData m = (movieData) item.getValue();
|
||||
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
|
||||
arguments.put("movie", m);
|
||||
arguments.put("item", item);
|
||||
|
||||
String template = "/movie/detailsMovie.zul";
|
||||
Window window = (Window) Executions.createComponents(template, null, arguments);
|
||||
|
||||
window.doModal();
|
||||
}
|
||||
|
||||
@Listen("onClick = #updateAll")
|
||||
public void onClickUpdateAll()
|
||||
{
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
|
||||
arguments.put("movieList", movieList);
|
||||
|
||||
String template = "/movie/updateMovie.zul";
|
||||
Window window = (Window) Executions.createComponents(template, null, arguments);
|
||||
|
||||
window.doModal();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import at.windesign.application.movie.movieData;
|
||||
import org.zkoss.zul.Listbox;
|
||||
import org.zkoss.zul.Listcell;
|
||||
import org.zkoss.zul.Listitem;
|
||||
import org.zkoss.zul.ListitemRenderer;
|
||||
|
||||
public class movieRenderer implements ListitemRenderer
|
||||
{
|
||||
private Listbox movieList;
|
||||
|
||||
@Override
|
||||
public void render(Listitem item, Object o, int i) throws Exception
|
||||
{
|
||||
final movieData data = (movieData) o;
|
||||
|
||||
Listcell movieNameCell = new Listcell(data.getMovieTitle());
|
||||
Listcell movieFirstAiredCell = new Listcell(String.valueOf(data.getReleaseDate()));
|
||||
Listcell movieResolutionCell = new Listcell(data.getResolution());
|
||||
Listcell movieOverviewCell = new Listcell(data.getOverview());
|
||||
|
||||
movieNameCell.setStyle(data.getMovieStyle());
|
||||
movieNameCell.setParent(item);
|
||||
movieFirstAiredCell.setParent(item);
|
||||
movieResolutionCell.setParent(item);
|
||||
movieOverviewCell.setParent(item);
|
||||
|
||||
item.setValue(data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.Listbox;
|
||||
import org.zkoss.zul.Progressmeter;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
public class movieUpdateForwardComposer extends GenericForwardComposer<Component>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int opacity = 80;
|
||||
private Listbox m_movieList;
|
||||
|
||||
@Wire
|
||||
private Window updateMovie;
|
||||
|
||||
@Wire
|
||||
protected Label movieLabel;
|
||||
|
||||
@Wire
|
||||
protected Progressmeter movieProgress;
|
||||
|
||||
@Wire
|
||||
protected Label movieProgressLabel;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception
|
||||
{
|
||||
super.doAfterCompose(comp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Execution;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventQueue;
|
||||
import org.zkoss.zk.ui.event.EventQueues;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.select.SelectorComposer;
|
||||
import org.zkoss.zk.ui.select.annotation.Listen;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
public class movieUpdateSelectorComposer extends SelectorComposer<Component>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int opacity = 80;
|
||||
private Listbox m_movieList;
|
||||
|
||||
@Wire
|
||||
private Window updateMovie;
|
||||
|
||||
@Wire
|
||||
protected Label movieLabel;
|
||||
|
||||
@Wire
|
||||
protected Progressmeter movieProgress;
|
||||
|
||||
@Wire
|
||||
protected Label movieProgressLabel;
|
||||
|
||||
@Wire
|
||||
private Timer timer;
|
||||
|
||||
private static final String QUEUE = "queue";
|
||||
private static final String START = "start";
|
||||
private static final int ONE_HUNDRED = 100;
|
||||
|
||||
private boolean isFinish;
|
||||
|
||||
private int progress;
|
||||
private String movieName;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception
|
||||
{
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
final Execution execution = Executions.getCurrent();
|
||||
|
||||
if(execution.getArg().containsKey("movieList"))
|
||||
m_movieList = (Listbox) execution.getArg().get("movieList");
|
||||
else
|
||||
updateMovie.detach();
|
||||
|
||||
try
|
||||
{
|
||||
Events.echoEvent("onAddNameEvent", timer, null);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Listen("onAddNameEvent = #timer")
|
||||
public void processingMovies()
|
||||
{
|
||||
try
|
||||
{
|
||||
timer.start();
|
||||
|
||||
if(itsNotProcessing())
|
||||
{
|
||||
EventQueue queue = lookupQueue();
|
||||
setUp(queue);
|
||||
start(queue);
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean itsNotProcessing()
|
||||
{
|
||||
return !EventQueues.exists(QUEUE);
|
||||
}
|
||||
|
||||
private EventQueue lookupQueue()
|
||||
{
|
||||
return EventQueues.lookup(QUEUE);
|
||||
}
|
||||
|
||||
private void setUp(final EventQueue queue)
|
||||
{
|
||||
progress = 0;
|
||||
|
||||
queue.subscribe((Event event) ->
|
||||
{
|
||||
doLongOperation();
|
||||
}
|
||||
,
|
||||
(Event event) ->
|
||||
{
|
||||
removeQueue();
|
||||
});
|
||||
}
|
||||
|
||||
private void removeQueue()
|
||||
{
|
||||
EventQueues.remove(QUEUE);
|
||||
}
|
||||
|
||||
private void start(EventQueue queue)
|
||||
{
|
||||
queue.publish(new Event(START));
|
||||
timer.start();
|
||||
}
|
||||
|
||||
private void doLongOperation() throws IOException
|
||||
{
|
||||
doProcess();
|
||||
}
|
||||
|
||||
public void doProcess() throws IOException, IllegalStateException
|
||||
{
|
||||
int total = 0;
|
||||
int current = 0;
|
||||
|
||||
ListModelList list = (ListModelList) m_movieList.getModel();
|
||||
List<movieData> dataList = list.getInnerList();
|
||||
total = dataList.size();
|
||||
|
||||
try
|
||||
{
|
||||
for(movieData data : dataList)
|
||||
{
|
||||
progress = current * 100 / total;
|
||||
movieName = data.getMovieTitle();
|
||||
|
||||
updateMovie(data);
|
||||
|
||||
current++;
|
||||
|
||||
break;
|
||||
}
|
||||
isFinish = true;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Listen("onTimer = #timer")
|
||||
public void fetchingSimulatorTimer() throws FileNotFoundException, IllegalStateException
|
||||
{
|
||||
try
|
||||
{
|
||||
updateProgressmeter();
|
||||
updateLabel();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void updateProgressmeter()
|
||||
{
|
||||
try
|
||||
{
|
||||
movieProgress.setValue(progress);
|
||||
movieProgressLabel.setValue(progress + "%");
|
||||
movieLabel.setValue(movieName);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLabel() throws FileNotFoundException, IllegalStateException
|
||||
{
|
||||
try
|
||||
{
|
||||
if(isFinish)
|
||||
{
|
||||
movieProgressLabel.setValue("Finish!");
|
||||
updateMovie.detach();
|
||||
|
||||
OutputStream tempFile = new FileOutputStream("redir");
|
||||
PrintStream printStream = new PrintStream(tempFile);
|
||||
printStream.print("movie");
|
||||
printStream.close();
|
||||
|
||||
Executions.sendRedirect("");
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTheProgressmeterFull()
|
||||
{
|
||||
return movieProgress.getValue() == ONE_HUNDRED;
|
||||
}
|
||||
|
||||
private void stop()
|
||||
{
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
@Listen("onClick = #btnCancel")
|
||||
public void doCancel()
|
||||
{
|
||||
try
|
||||
{
|
||||
// isBreak = true;
|
||||
removeQueue();
|
||||
timer.stop();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMovie(movieData movie)
|
||||
{
|
||||
movieData movieNew;
|
||||
|
||||
try
|
||||
{
|
||||
movieNew = new movieData();
|
||||
movieNew.fromTMDB(movie.getMovieID());
|
||||
movieNew.copyFrom(movie);
|
||||
|
||||
movieNew.save();
|
||||
}
|
||||
catch(MovieDbException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package at.windesign.application.movie;
|
||||
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class movieUtils
|
||||
{
|
||||
static public void loadMovies(movieDataSource ds, Listbox moviesList)
|
||||
{
|
||||
List<movieData> movieList = new ArrayList<>();
|
||||
SortedMap<Integer, Listheader> listHeader = new TreeMap<>();
|
||||
|
||||
ListModelList movieListModel = new ListModelList();
|
||||
moviesList.setModel(movieListModel);
|
||||
moviesList.setAttribute("listModelList", movieListModel);
|
||||
|
||||
moviesList.getListhead().getChildren().clear();
|
||||
Listhead head = moviesList.getListhead();
|
||||
Listheader movieName = new Listheader("Movie Name");
|
||||
Listheader firstAired = new Listheader("First Aired");
|
||||
Listheader resolution = new Listheader("Resolution");
|
||||
Listheader overview = new Listheader("Overview");
|
||||
|
||||
movieName.setHflex("min");
|
||||
firstAired.setHflex("min");
|
||||
resolution.setHflex("min");
|
||||
overview.setHflex("min");
|
||||
|
||||
head.appendChild(movieName);
|
||||
head.appendChild(firstAired);
|
||||
head.appendChild(resolution);
|
||||
head.appendChild(overview);
|
||||
|
||||
movieRenderer renderer = new movieRenderer();
|
||||
moviesList.setItemRenderer(renderer);
|
||||
|
||||
try
|
||||
{
|
||||
Statement stmt = ds.getStatement();
|
||||
ResultSet rs = stmt.executeQuery(
|
||||
"SELECT movieID, " +
|
||||
" movieTitle, " +
|
||||
" originalTitle, " +
|
||||
" backdropPath, " +
|
||||
" posterPath, " +
|
||||
" overview, " +
|
||||
" releaseDate, " +
|
||||
" genre, " +
|
||||
" imdbid, " +
|
||||
" originalLanguage, " +
|
||||
" popularity, " +
|
||||
" productionCompanies, " +
|
||||
" productionCountries, " +
|
||||
" voteAverage, " +
|
||||
" voteCount, " +
|
||||
" adult, " +
|
||||
" belongsToCollection, " +
|
||||
" budget, " +
|
||||
" homepage, " +
|
||||
" revenue, " +
|
||||
" runtime, " +
|
||||
" spokenLanguages, " +
|
||||
" status, " +
|
||||
" tagline, " +
|
||||
" video, " +
|
||||
" `cast`, " +
|
||||
" crew, " +
|
||||
" state, " +
|
||||
" localPath, " +
|
||||
" resolution " +
|
||||
"FROM multimedia.movie " +
|
||||
"ORDER BY movieTitle, " +
|
||||
" releaseDate;"
|
||||
);
|
||||
|
||||
// fetch all events from database
|
||||
movieData movie;
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
movie = new movieData();
|
||||
|
||||
int movieID = rs.getInt("movieID");
|
||||
|
||||
movie.setMovieID(rs.getInt("movieID"));
|
||||
movie.setMovieTitle(rs.getString("movieTitle"));
|
||||
movie.setOriginalTitle(rs.getString("originalTitle"));
|
||||
movie.setBackdropPath(rs.getString("backdropPath"));
|
||||
movie.setPosterPath(rs.getString("posterPath"));
|
||||
movie.setOverview(rs.getString("overview"));
|
||||
movie.setReleaseDate(rs.getDate("releaseDate"));
|
||||
movie.setGenre(rs.getString("genre"));
|
||||
movie.setIMDBID(rs.getString("IMDBID"));
|
||||
movie.setOriginalLanguage(rs.getString("originalLanguage"));
|
||||
movie.setPopularity(rs.getDouble("popularity"));
|
||||
movie.setProductionCompanies(rs.getString("productionCompanies"));
|
||||
movie.setProductionCountries(rs.getString("productionCountries"));
|
||||
movie.setVoteAverage(rs.getDouble("voteAverage"));
|
||||
movie.setVoteCount(rs.getInt("voteCount"));
|
||||
movie.setAdult(rs.getString("adult"));
|
||||
movie.setBelongsToCollection(rs.getString("belongsToCollection"));
|
||||
movie.setBudget(rs.getDouble("budget"));
|
||||
movie.setHomepage(rs.getString("homepage"));
|
||||
movie.setRevenue(rs.getDouble("revenue"));
|
||||
movie.setRuntime(rs.getInt("runtime"));
|
||||
movie.setSpokenLanguages(rs.getString("spokenLanguages"));
|
||||
movie.setStatus(rs.getString("status"));
|
||||
movie.setTagline(rs.getString("tagline"));
|
||||
movie.setVideo(rs.getString("video"));
|
||||
movie.setCast(rs.getString("cast"));
|
||||
movie.setCrew(rs.getString("crew"));
|
||||
movie.setState(rs.getInt("state"));
|
||||
movie.setLocalPath(rs.getString("localPath"));
|
||||
movie.setResolution(rs.getString("resolution"));
|
||||
|
||||
movieList.add(movie);
|
||||
}
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ds.close();
|
||||
}
|
||||
|
||||
for(movieData movie : movieList)
|
||||
{
|
||||
movieListModel.add(movie);
|
||||
movie.setModel(movieListModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,6 @@ package at.windesign.application.serie;
|
||||
|
||||
import com.omertron.themoviedbapi.MovieDbException;
|
||||
import com.omertron.themoviedbapi.TheMovieDbApi;
|
||||
import com.omertron.themoviedbapi.enumeration.TVMethod;
|
||||
import com.omertron.themoviedbapi.methods.TmdbSeasons;
|
||||
import com.omertron.themoviedbapi.methods.TmdbTV;
|
||||
import com.omertron.themoviedbapi.model.Genre;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
|
||||
import com.omertron.themoviedbapi.model.credits.MediaCreditCrew;
|
||||
@@ -23,7 +20,6 @@ import java.util.Objects;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static org.zkoss.zk.ui.util.Clients.alert;
|
||||
|
||||
class serieData
|
||||
{
|
||||
@@ -499,13 +495,6 @@ class serieData
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
// if(m_seriesStatus == "Ended")
|
||||
// return false;
|
||||
// if(m_seriesStatus == "Canceled")
|
||||
// return false;
|
||||
//
|
||||
// return true;
|
||||
|
||||
if(Objects.equals(m_seriesStatus, "Returning Series"))
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.sql.Statement;
|
||||
|
||||
public enum serieDataSource
|
||||
{
|
||||
|
||||
INSTANCE;
|
||||
|
||||
private static final String url = "jdbc:mysql://localhost:3306/multimedia";
|
||||
|
||||
@@ -13,8 +13,7 @@ import org.zkoss.zk.ui.select.annotation.Listen;
|
||||
import org.zkoss.zk.ui.select.annotation.Wire;
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -171,6 +170,7 @@ public class serieUpdateSelectorComposer extends SelectorComposer<Component>
|
||||
|
||||
current++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
isFinish = true;
|
||||
}
|
||||
@@ -219,6 +219,11 @@ public class serieUpdateSelectorComposer extends SelectorComposer<Component>
|
||||
serieProgressLabel.setValue("Finish!");
|
||||
updateSerie.detach();
|
||||
|
||||
OutputStream tempFile = new FileOutputStream("redir");
|
||||
PrintStream printStream = new PrintStream(tempFile);
|
||||
printStream.print("serie");
|
||||
printStream.close();
|
||||
|
||||
Executions.sendRedirect("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
apply="at.windesign.application.main.indexForwardComposer, org.zkoss.bind.BindComposer"
|
||||
onClientInfo="onClientInfo(event)"
|
||||
>
|
||||
<tabbox id="tb"
|
||||
<tabbox id="tabbox"
|
||||
height="100%"
|
||||
orient="left"
|
||||
>
|
||||
@@ -21,6 +21,9 @@
|
||||
<tabpanel>
|
||||
<include src="/serie/centerSerie.zul"/>
|
||||
</tabpanel>
|
||||
<tabpanel>
|
||||
<include src="/movie/centerMovie.zul"/>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
<zscript>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<div id="centerMovie"
|
||||
vflex="true"
|
||||
apply="at.windesign.application.movie.movieListForwardComposer, at.windesign.application.movie.movieListSelectorComposer"
|
||||
>
|
||||
<hbox width="100%" widths="100%" pack="stretch">
|
||||
<button width="100%"
|
||||
id="updateAll"
|
||||
label="update all"
|
||||
>
|
||||
</button>
|
||||
</hbox>
|
||||
<listbox id="movieList"
|
||||
multiple="true"
|
||||
autopaging="true"
|
||||
vflex="true">
|
||||
<listhead sizable="true"
|
||||
>
|
||||
</listhead>
|
||||
<!-- https://stackoverflow.com/questions/28629458/display-image-from-db-on-zk-zul-listbox-->
|
||||
<!-- https://www.zkoss.org/zksandbox/#u6-->
|
||||
</listbox>
|
||||
</div>
|
||||
@@ -0,0 +1,61 @@
|
||||
<window id="detailsMovie"
|
||||
title=""
|
||||
contentStyle="overflow:auto"
|
||||
border="normal"
|
||||
apply="at.windesign.application.movie.movieDetailsForwardComposer, at.windesign.application.movie.movieDetailsSelectorComposer"
|
||||
width="500px"
|
||||
height="500px"
|
||||
>
|
||||
|
||||
<style>
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 4fr 1fr 1fr;
|
||||
grid-gap: 10px;
|
||||
justify-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<groupbox id="overview"
|
||||
>
|
||||
<caption>Overview</caption>
|
||||
<label id="overviewLabel"
|
||||
value=""/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="settings"
|
||||
>
|
||||
<caption>Settings</caption>
|
||||
|
||||
<nodom>
|
||||
<div sclass="grid"
|
||||
width="100%">
|
||||
<label value="Local Path"/>
|
||||
<label value="Resolution"/>
|
||||
<label value="State"/>
|
||||
<textbox id="localPath"
|
||||
width="100%"
|
||||
tabindex="2"/>
|
||||
<combobox id="resolution"
|
||||
width="100%"
|
||||
tabindex="3"/>
|
||||
<vlayout>
|
||||
<radiogroup id="progress">
|
||||
<radio label="init"/>
|
||||
<radio label="in progress"/>
|
||||
<radio label="done"/>
|
||||
</radiogroup>
|
||||
</vlayout>
|
||||
</div>
|
||||
</nodom>
|
||||
</groupbox>
|
||||
|
||||
<hbox id="buttons"
|
||||
width="100%"
|
||||
pack="center">
|
||||
<button id="saveButton" label="Save"/>
|
||||
<button id="cancelButton" label="Cancel"/>
|
||||
<button id="updateButton" label="Update from TMDB"/>
|
||||
<button id="deleteButton" label="Delete"/>
|
||||
</hbox>
|
||||
</window>
|
||||
@@ -0,0 +1,26 @@
|
||||
<window id="updateMovie"
|
||||
title="update Movies"
|
||||
contentStyle="overflow:auto"
|
||||
border="normal"
|
||||
apply="at.windesign.application.movie.movieUpdateSelectorComposer"
|
||||
width="500px"
|
||||
height="150px">
|
||||
<div class="panel"
|
||||
align="center">
|
||||
<timer id="timer"
|
||||
repeats="true"
|
||||
delay="1000"
|
||||
onCreate="self.stop()"/>
|
||||
<hbox align="center">
|
||||
<progressmeter id="movieProgress"
|
||||
value="0"
|
||||
width="400px"/>
|
||||
<label id="movieProgressLabel"
|
||||
value="0%">
|
||||
</label>
|
||||
</hbox>
|
||||
<label id="movieLabel"
|
||||
value="please wait...">
|
||||
</label>
|
||||
</div>
|
||||
</window>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
at\windesign\application\serie\serieDataSource.class
|
||||
at\windesign\application\serie\serieDetailsSelectorComposer.class
|
||||
at\windesign\application\serie\seasonData.class
|
||||
at\windesign\application\serie\serieRenderer.class
|
||||
at\windesign\application\serie\serieData.class
|
||||
@@ -5,9 +7,7 @@ at\windesign\application\serie\serieUtils.class
|
||||
at\windesign\application\serie\serieDetailsForwardComposer$1.class
|
||||
at\windesign\application\serie\serieDetailsForwardComposer.class
|
||||
at\windesign\application\serie\serieDetailsSelectorComposer$1.class
|
||||
at\windesign\application\serie\serieDataSource.class
|
||||
at\windesign\application\serie\serieListForwardComposer.class
|
||||
at\windesign\application\serie\serieDetailsSelectorComposer.class
|
||||
at\windesign\application\testing\testForwardComposer.class
|
||||
at\windesign\application\serie\episodeData.class
|
||||
at\windesign\application\main\indexForwardComposer.class
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieData.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieDetailsSelectorComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieUpdateSelectorComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieDetailsForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieListForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieUpdateForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieDetailsSelectorComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieUpdateSelectorComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\episodeData.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieRenderer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieDataSource.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\testing\testForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieRenderer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieDataSource.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieListSelectorComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieUpdateForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieListSelectorComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieListForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieDetailsForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\seasonData.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieUtils.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\serie\serieUtils.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\main\indexForwardComposer.java
|
||||
C:\Users\birkeh\ownCloud\dev\IntelliJ\zk\multimedia\src\main\java\at\windesign\application\movie\movieData.java
|
||||
|
||||
Reference in New Issue
Block a user