Skip to content

Commit

Permalink
9 - Track detail
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandervalach committed Apr 3, 2020
1 parent 6f4e473 commit 7cddd57
Show file tree
Hide file tree
Showing 41 changed files with 771 additions and 27 deletions.
Binary file not shown.
Binary file not shown.

This file was deleted.

2 changes: 2 additions & 0 deletions 9 - Track detail/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions 9 - Track detail/.idea/ant.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions 9 - Track detail/.idea/artifacts/JavaFXApp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions 9 - Track detail/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions 9 - Track detail/.idea/description.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 9 - Track detail/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions 9 - Track detail/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions 9 - Track detail/.idea/libraries/jfxrt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions 9 - Track detail/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 9 - Track detail/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions 9 - Track detail/.idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions 9 - Track detail/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions 9 - Track detail/9 - Track detail.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jfxrt" level="project" />
</component>
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,32 @@

<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.GridPane?>

<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TableColumn?>

<?import javafx.scene.layout.AnchorPane?>
<GridPane fx:id="app" alignment="CENTER" minWidth="800" minHeight="600"
vgap="10.0" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.tracks.AllController">
vgap="10.0" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.tracks.TracksController">

<Label id="banner" alignment="CENTER" text="Skladby" GridPane.columnIndex="0" GridPane.rowIndex="0" GridPane.columnSpan="2"/>

<TableView fx:id="tracksTable" GridPane.rowIndex="1" GridPane.columnIndex="1">
<columns>
<TableColumn fx:id="title" prefWidth="300" text="Názov"/>
<TableColumn fx:id="artist" prefWidth="300" text="Interprét"/>
<TableColumn fx:id="title" prefWidth="200" text="Názov"/>
<TableColumn fx:id="artist" prefWidth="200" text="Interprét"/>
</columns>
</TableView>

<!--
<AnchorPane GridPane.rowIndex="1" GridPane.columnIndex="2">
<GridPane vgap="10.0" hgap="10.0">
<Label text="Odosielateľ - prijímateľ:" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label fx:id="lblReciever" GridPane.columnIndex="2" GridPane.rowIndex="1"/>
<Label text="Suma:" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label fx:id="lblSum" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
<Label text="Dátum:" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label fx:id="lblDate" GridPane.columnIndex="2" GridPane.rowIndex="3"/>
<Label text="Poznámka:" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label fx:id="lblNote" GridPane.columnIndex="2" GridPane.rowIndex="4"/>
<Label text="Názov:" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Label fx:id="trackTitle" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Label text="Interprét:" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Label fx:id="trackArtist" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
</GridPane>
</AnchorPane>
-->

<HBox spacing="10" alignment="bottom_left" GridPane.columnIndex="0"
GridPane.rowIndex="2" GridPane.columnSpan="2" minHeight="50">
Expand Down
71 changes: 71 additions & 0 deletions 9 - Track detail/src/controller/BaseController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package controller;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.layout.GridPane;
import model.Identity;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ResourceBundle;

public abstract class BaseController implements Initializable {

@FXML
protected GridPane app;

protected Identity identity;

protected String viewURL;

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
identity = Identity.getInstance();

// Na začiatku si načítame URL
viewURL = System.getProperty("user.dir") + "/src/view/";
}

/**
* Logs out user
*/
protected void logout() {
identity.logOut();
identity = Identity.getInstance();
switchScene( "login");
}

/**
* Switches between different scenes
* @param view scene to be viewed
* */
public void switchScene(String view) {
/*
if (identity != null) {
System.out.println("Identity: " + identity.getUsername());
} else {
System.out.println("No identity");
}
*/

try {
// Odstránime obsah view, ktorý je momentálne zobrazený
app.getChildren().clear();

// Absolútna URL k danému fxml súboru
URL fxmlURL = getLocation(view);

// Vymeníme za nový obsah
app.getChildren().add(FXMLLoader.load(fxmlURL));
} catch (IOException e) {
e.printStackTrace();
}
}

protected URL getLocation (String view) throws MalformedURLException {
return Paths.get(viewURL + view + ".fxml").toUri().toURL();
}
}
Loading

0 comments on commit 7cddd57

Please sign in to comment.