Skip to content

Commit dea3a72

Browse files
committed
finalizing
1 parent 418660b commit dea3a72

3 files changed

Lines changed: 34 additions & 22 deletions

File tree

src/main/java/project/fileshare/Controllers/ShareMenuController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ public void setDialogStage(Stage dialogStage) {
2727

2828
@FXML
2929
public void handleShareButton(ActionEvent actionEvent) throws SQLException {
30-
System.out.println(file.getFileName());
31-
System.out.println(shareWithField.getText());
32-
System.out.println(getIdFromUsername(shareWithField.getText()));
3330
try {
3431
shareFile(getFileID(file.getFileName(), userIdForManager), getIdFromUsername(shareWithField.getText()), "read", userIdForManager);
3532
} catch (SQLException e) {

src/main/java/project/fileshare/JDBC/FilesShareDAO.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ public static void shareFile(int fileID, int sharedWithID, String permission, in
5757
ps.setString(3, permission);
5858
ps.setInt(4, ownerID);
5959

60-
ps.executeUpdate();
60+
try {
61+
ps.executeUpdate();
62+
} catch (SQLException e) {
63+
System.out.println("Error sharing file. File might already be shared or username is incorrect: " + e);
64+
}
6165

6266
connection.close();
6367
}

src/main/resources/project/fileshare/dashboard.fxml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,64 @@
1111
<?import javafx.scene.layout.BorderPane?>
1212
<?import javafx.scene.layout.VBox?>
1313

14-
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="project.fileshare.Controllers.DashboardController">
14+
<AnchorPane xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1"
15+
fx:controller="project.fileshare.Controllers.DashboardController"
16+
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
17+
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
1518
<children>
16-
<BorderPane prefHeight="600.0" prefWidth="800.0">
19+
<BorderPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
20+
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
1721
<bottom>
18-
<ToolBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
22+
<ToolBar prefHeight="40.0" BorderPane.alignment="CENTER">
1923
<items>
2024
<Button mnemonicParsing="false" onAction="#logOut" text="Log Out" />
2125
</items>
2226
</ToolBar>
2327
</bottom>
2428
<top>
25-
<Button mnemonicParsing="false" onAction="#uploadFile" prefHeight="25.0" prefWidth="76.0" text="Upload File" textAlignment="CENTER" BorderPane.alignment="TOP_LEFT">
29+
<Button mnemonicParsing="false" onAction="#uploadFile" text="Upload File"
30+
textAlignment="CENTER" BorderPane.alignment="TOP_LEFT">
2631
<BorderPane.margin>
2732
<Insets left="20.0" top="10.0" />
2833
</BorderPane.margin>
2934
</Button>
3035
</top>
3136
<center>
32-
<TabPane fx:id="tabPane" prefHeight="397.0" prefWidth="800.0" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
37+
<TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE" BorderPane.alignment="CENTER">
3338
<tabs>
3439
<Tab text="My Files">
3540
<content>
36-
<VBox>
41+
<VBox VBox.vgrow="ALWAYS">
3742
<children>
38-
<TableView fx:id="filesTable" prefHeight="450.0" prefWidth="800.0" VBox.vgrow="ALWAYS">
43+
<TableView fx:id="filesTable" VBox.vgrow="ALWAYS">
3944
<columns>
40-
<TableColumn fx:id="fileTableType" prefWidth="150.0" text="Type" />
41-
<TableColumn fx:id="fileTableName" prefWidth="400.0" text="Name" />
42-
<TableColumn fx:id="fileTableSize" prefWidth="150.0" text="Size" />
45+
<TableColumn fx:id="fileTableType" text="Type" />
46+
<TableColumn fx:id="fileTableName" text="Name" />
47+
<TableColumn fx:id="fileTableSize" text="Size" />
4348
</columns>
49+
<columnResizePolicy>
50+
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
51+
</columnResizePolicy>
4452
</TableView>
4553
</children>
4654
</VBox>
4755
</content>
4856
</Tab>
4957
<Tab text="Shared With Me">
5058
<content>
51-
<VBox>
59+
<VBox VBox.vgrow="ALWAYS">
5260
<children>
53-
<TableView fx:id="sharedFilesTable" prefHeight="450.0" prefWidth="800.0" VBox.vgrow="ALWAYS">
61+
<TableView fx:id="sharedFilesTable" VBox.vgrow="ALWAYS">
5462
<columns>
55-
<TableColumn fx:id="sharedFileTableType" prefWidth="100.0" text="Type" />
56-
<TableColumn fx:id="sharedFileTableName" prefWidth="300.0" text="Name" />
57-
<TableColumn fx:id="sharedFileTableSize" prefWidth="100.0" text="Size" />
58-
<TableColumn fx:id="sharedFileTableOwner" prefWidth="150.0" text="Owner" />
59-
<TableColumn fx:id="sharedFileTablePermissions" prefWidth="150.0" text="Permissions" />
63+
<TableColumn fx:id="sharedFileTableType" text="Type" />
64+
<TableColumn fx:id="sharedFileTableName" text="Name" />
65+
<TableColumn fx:id="sharedFileTableSize" text="Size" />
66+
<TableColumn fx:id="sharedFileTableOwner" text="Owner" />
67+
<TableColumn fx:id="sharedFileTablePermissions" text="Permissions" />
6068
</columns>
69+
<columnResizePolicy>
70+
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
71+
</columnResizePolicy>
6172
</TableView>
6273
</children>
6374
</VBox>
@@ -71,4 +82,4 @@
7182
</center>
7283
</BorderPane>
7384
</children>
74-
</AnchorPane>
85+
</AnchorPane>

0 commit comments

Comments
 (0)