smmdbapi part 4
* added additional information and finished ui design
This commit is contained in:
parent
fe88271c90
commit
1b828d6e4b
|
@ -1 +1,2 @@
|
|||
/application/
|
||||
/datatypes/
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.TextFlow?>
|
||||
|
||||
<AnchorPane prefHeight="600.0" prefWidth="892.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
||||
<children>
|
||||
|
@ -85,7 +87,18 @@
|
|||
</AnchorPane>
|
||||
<AnchorPane fx:id="smmdbAnchorPane" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||
<children>
|
||||
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="350.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="400.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="314.0" prefWidth="267.0" AnchorPane.bottomAnchor="67.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
|
||||
<content>
|
||||
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="510.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="510.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</JFXButton>
|
||||
</children></AnchorPane>
|
||||
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="38.0" maxWidth="100.0" onAction="#playBtnAction" ripplerFill="#c92a2a" text="play" visible="false" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="396.0" AnchorPane.rightAnchor="396.0" AnchorPane.topAnchor="555.0">
|
||||
<font>
|
||||
|
|
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.
|
@ -9,10 +9,12 @@
|
|||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import javafx.scene.text.TextFlow?>
|
||||
|
||||
<AnchorPane prefHeight="600.0" prefWidth="892.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
|
||||
<children>
|
||||
|
@ -85,7 +87,18 @@
|
|||
</AnchorPane>
|
||||
<AnchorPane fx:id="smmdbAnchorPane" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
|
||||
<children>
|
||||
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="350.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="400.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="314.0" prefWidth="267.0" AnchorPane.bottomAnchor="67.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
|
||||
<content>
|
||||
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="510.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="510.0">
|
||||
<font>
|
||||
<Font name="System Bold" size="14.0" />
|
||||
</font>
|
||||
</JFXButton>
|
||||
</children></AnchorPane>
|
||||
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="38.0" maxWidth="100.0" onAction="#playBtnAction" ripplerFill="#c92a2a" text="play" visible="false" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="396.0" AnchorPane.rightAnchor="396.0" AnchorPane.topAnchor="555.0">
|
||||
<font>
|
||||
|
|
|
@ -22,6 +22,9 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
@ -41,9 +44,9 @@ import com.jfoenix.controls.JFXTreeTableColumn;
|
|||
import com.jfoenix.controls.JFXTreeTableView;
|
||||
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
|
||||
|
||||
import datatypes.CourseTableDataType;
|
||||
import datatypes.SmmdbApiDataType;
|
||||
import datatypes.UIROMDataType;
|
||||
import datatypes.CourseTableDataType;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.animation.ParallelTransition;
|
||||
import javafx.animation.TranslateTransition;
|
||||
|
@ -74,6 +77,7 @@ import javafx.scene.paint.Color;
|
|||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.TextFlow;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.util.Duration;
|
||||
|
@ -101,14 +105,17 @@ public class MainWindowController {
|
|||
@FXML
|
||||
private JFXButton romTFBtn;
|
||||
|
||||
@FXML
|
||||
private JFXButton smmdbDownloadBtn;
|
||||
|
||||
@FXML
|
||||
private JFXButton playBtn;
|
||||
|
||||
@FXML
|
||||
JFXButton timePlayedBtn;
|
||||
private JFXButton lastTimePlayedBtn;
|
||||
|
||||
@FXML
|
||||
private JFXButton lastTimePlayedBtn;
|
||||
JFXButton timePlayedBtn;
|
||||
|
||||
@FXML
|
||||
private JFXHamburger menuHam;
|
||||
|
@ -119,6 +126,9 @@ public class MainWindowController {
|
|||
@FXML
|
||||
private JFXTextField romTextField;
|
||||
|
||||
@FXML
|
||||
private TextFlow smmdbTextFlow;
|
||||
|
||||
@FXML
|
||||
private JFXColorPicker colorPicker;
|
||||
|
||||
|
@ -140,12 +150,18 @@ public class MainWindowController {
|
|||
@FXML
|
||||
private ScrollPane scrollPaneMain;
|
||||
|
||||
@FXML
|
||||
private ScrollPane smmdbScrollPane;
|
||||
|
||||
@FXML
|
||||
private VBox sideMenuVBox;
|
||||
|
||||
@FXML
|
||||
private HBox topHBox;
|
||||
|
||||
@FXML
|
||||
private ImageView smmdbImageView;
|
||||
|
||||
|
||||
@FXML
|
||||
private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
|
||||
|
@ -237,9 +253,9 @@ public class MainWindowController {
|
|||
applyColor();
|
||||
|
||||
//initialize courseTable
|
||||
titleColumn.setPrefWidth(150);
|
||||
starsColumn.setPrefWidth(85);
|
||||
downloadsColumn.setPrefWidth(115);
|
||||
titleColumn.setPrefWidth(168);
|
||||
downloadsColumn.setPrefWidth(130);
|
||||
starsColumn.setPrefWidth(100);
|
||||
|
||||
courseTreeTable.setRoot(root);
|
||||
courseTreeTable.setShowRoot(false);
|
||||
|
@ -497,6 +513,20 @@ public class MainWindowController {
|
|||
for (int i = 0; i < courses.size(); i++) {
|
||||
if (courses.get(i).getId() == id) {
|
||||
|
||||
if (courses.get(i).getHasimage() == 1) {
|
||||
try {
|
||||
URL url = new URL("http://smmdb.ddns.net/img/courses/thumbnails/" + id + ".pic");
|
||||
Image image = new Image(url.toURI().toString());
|
||||
smmdbImageView.setImage(image);
|
||||
} catch (MalformedURLException | URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
//TODO show an image if none was found
|
||||
// Image image = new Image(url.toURI().toString());
|
||||
// smmdbImageView.setImage(image);
|
||||
}
|
||||
|
||||
//TODO show additional information and download option
|
||||
System.out.println(i);
|
||||
}
|
||||
|
@ -626,6 +656,18 @@ public class MainWindowController {
|
|||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void smmdbDownloadBtnAction(ActionEvent event){
|
||||
//TODO implement download
|
||||
System.out.println("this needs to be implemented ^^");
|
||||
try {
|
||||
URL url = new URL("smmdb.ddns.net/courses/" + id);
|
||||
} catch (MalformedURLException e) {
|
||||
System.err.println("something went wrong during downloading the course");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void cemuTextFieldAction(ActionEvent event){
|
||||
setCemuPath(cemuTextField.getText());
|
||||
|
@ -918,6 +960,7 @@ public class MainWindowController {
|
|||
playBtn.setStyle("-fx-text-fill: WHITE; -fx-font-family: Roboto Medium;");
|
||||
cemuTFBtn.setStyle(btnStyleWhite);
|
||||
romTFBtn.setStyle(btnStyleWhite);
|
||||
smmdbDownloadBtn.setStyle(btnStyleWhite);
|
||||
playBtn.setStyle(btnStyleWhite);
|
||||
|
||||
aboutBtn.setGraphic(info_white);
|
||||
|
@ -936,6 +979,7 @@ public class MainWindowController {
|
|||
playBtn.setStyle("-fx-text-fill: BLACK; -fx-font-family: Roboto Medium;");
|
||||
cemuTFBtn.setStyle(btnStyleBlack);
|
||||
romTFBtn.setStyle(btnStyleBlack);
|
||||
smmdbDownloadBtn.setStyle(btnStyleBlack);
|
||||
playBtn.setStyle(btnStyleBlack);
|
||||
|
||||
aboutBtn.setGraphic(info_black);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SmmdbApiQuery {
|
|||
|
||||
//if value is 9 or "notset" the api returned NULL as value
|
||||
for (int i = 0; i < courseIDs.size(); i++) {
|
||||
int id, owner, coursetype, leveltype, difficulty, lastmodified, uploaded, downloads, stars, ispackage, updatereq;
|
||||
int id, owner, coursetype, leveltype, difficulty, lastmodified, uploaded, downloads, stars, hasimage, ispackage, updatereq;
|
||||
String nintendoid, title;
|
||||
JsonObject singleObject = mainObject.get(courseIDs.get(i).toString()).asObject();
|
||||
|
||||
|
@ -99,6 +99,11 @@ public class SmmdbApiQuery {
|
|||
} catch (Exception e) {
|
||||
stars = 9;
|
||||
}
|
||||
try {
|
||||
hasimage = singleObject.getInt("hasimage", 0);
|
||||
} catch (Exception e) {
|
||||
hasimage = 9;
|
||||
}
|
||||
try {
|
||||
ispackage = singleObject.getInt("ispackage", 0);
|
||||
} catch (Exception e) {
|
||||
|
@ -121,7 +126,7 @@ public class SmmdbApiQuery {
|
|||
}
|
||||
|
||||
course.add(new SmmdbApiDataType(id, owner, coursetype, leveltype, difficulty, lastmodified, uploaded, downloads,
|
||||
stars, ispackage, updatereq, nintendoid, title));
|
||||
stars, hasimage, ispackage, updatereq, nintendoid, title));
|
||||
}
|
||||
|
||||
return course;
|
||||
|
|
|
@ -19,14 +19,15 @@ public class SmmdbApiDataType {
|
|||
private final IntegerProperty uploaded = new SimpleIntegerProperty();
|
||||
private final IntegerProperty downloads = new SimpleIntegerProperty();
|
||||
private final IntegerProperty stars = new SimpleIntegerProperty();
|
||||
private final IntegerProperty hasimage = new SimpleIntegerProperty();
|
||||
private final IntegerProperty ispackage = new SimpleIntegerProperty();
|
||||
private final IntegerProperty updatereq = new SimpleIntegerProperty();
|
||||
private final StringProperty nintendoid = new SimpleStringProperty();
|
||||
private final StringProperty title = new SimpleStringProperty();
|
||||
|
||||
public SmmdbApiDataType(final int id, final int owner, final int coursetype, final int leveltype, final int difficulty,
|
||||
final int lastmodified, final int uploaded, final int downloads, final int stars, final int ispackage,
|
||||
final int updatereq, final String nintendoid, final String title) {
|
||||
final int lastmodified, final int uploaded, final int downloads, final int stars, final int hasimage,
|
||||
final int ispackage, final int updatereq, final String nintendoid, final String title) {
|
||||
this.id.set(id);
|
||||
this.owner.set(owner);
|
||||
this.coursetype.set(coursetype);
|
||||
|
@ -36,6 +37,7 @@ public class SmmdbApiDataType {
|
|||
this.uploaded.set(uploaded);
|
||||
this.downloads.set(downloads);
|
||||
this.stars.set(stars);
|
||||
this.hasimage.set(hasimage);
|
||||
this.ispackage.set(ispackage);
|
||||
this.updatereq.set(updatereq);
|
||||
this.nintendoid.set(nintendoid);
|
||||
|
@ -82,6 +84,10 @@ public class SmmdbApiDataType {
|
|||
return stars;
|
||||
}
|
||||
|
||||
public IntegerProperty hasimageProperty(){
|
||||
return hasimage;
|
||||
}
|
||||
|
||||
public IntegerProperty ispackageProperty(){
|
||||
return ispackage;
|
||||
}
|
||||
|
@ -130,6 +136,10 @@ public class SmmdbApiDataType {
|
|||
return starsProperty().get();
|
||||
}
|
||||
|
||||
public int getHasimage() {
|
||||
return hasimageProperty().get();
|
||||
}
|
||||
|
||||
public int getIspackage() {
|
||||
return ispackageProperty().get();
|
||||
}
|
||||
|
@ -182,6 +192,10 @@ public class SmmdbApiDataType {
|
|||
starsProperty().set(stars);
|
||||
}
|
||||
|
||||
public final void setHasimage(int hasimage) {
|
||||
hasimageProperty().set(hasimage);
|
||||
}
|
||||
|
||||
public final void setIspackage(int ispackage) {
|
||||
ispackageProperty().set(ispackage);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue