Skip to content

Commit

Permalink
Merge pull request #10 from airavata-courses/prkumoda_develop
Browse files Browse the repository at this point in the history
ui for prestage upload in seagrid-rich-client
  • Loading branch information
karankotz authored Sep 16, 2018
2 parents f5c8f7a + 6eaf83a commit 29f17e4
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import org.seagrid.desktop.ui.home.model.ExperimentListModel;
import org.seagrid.desktop.ui.home.model.ProjectTreeModel;
import org.seagrid.desktop.ui.home.model.TreeModel;
import org.seagrid.desktop.ui.prestageupload.PrestageUploadWindow;
import org.seagrid.desktop.ui.project.ProjectWindow;
import org.seagrid.desktop.ui.storage.MassStorageBrowserWindow;
import org.seagrid.desktop.util.SEAGridConfig;
Expand Down Expand Up @@ -112,6 +113,9 @@ public class HomeController {
@FXML
private Button createExperimentButton;

@FXML
private Button uploadInputFilesButton;

@FXML
private TreeView<TreeModel> projectsTreeView;

Expand Down Expand Up @@ -218,7 +222,7 @@ public void initialize() {
notificationLabel.setStyle("-fx-border-color: white;");
notificationLabel.setMaxWidth(Double.MAX_VALUE);
try{
java.util.List<Notification> messages = AiravataManager.getInstance().getNotifications();
List<Notification> messages = AiravataManager.getInstance().getNotifications();
final Index index = new Index();
index.index = 0;
if (messages != null && messages.size() > 0) {
Expand Down Expand Up @@ -295,6 +299,13 @@ public void initMenuBar() {
"Failed to open Storage Browser");
}
});
uploadInputFilesButton.setOnMouseClicked(event -> {
try {
PrestageUploadWindow.displayUploadFiles();
} catch (IOException e) {
e.printStackTrace();
}
});
nanocadBtn.setOnAction(event ->
SwingUtilities.invokeLater(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.seagrid.desktop.ui.prestageupload;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import org.seagrid.desktop.ui.experiment.create.ExperimentCreateWindow;
import org.seagrid.desktop.ui.prestageupload.controller.PrestageUploadController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

public class PrestageUploadWindow extends Application{
private final static Logger logger = LoggerFactory.getLogger(PrestageUploadWindow.class);

private static Stage createPrimaryStage;

@Override
public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/views/prestageupload/upload-files.fxml"));
primaryStage.setTitle("SEAGrid Desktop Client - Prestage Upload");
primaryStage.setScene(new Scene(root, 400, 150));
primaryStage.show();
}

public static void displayUploadFiles() throws IOException {
if(createPrimaryStage == null || !createPrimaryStage.isShowing()) {
createPrimaryStage = new Stage();
FXMLLoader loader = new FXMLLoader(ExperimentCreateWindow.class.getResource(
"/views/prestageupload/upload-files.fxml"));
Parent root = loader.load();
createPrimaryStage.setTitle("SEAGrid Desktop Client - Prestage Upload");
createPrimaryStage.setScene(new Scene(root, 400, 150));
createPrimaryStage.initModality(Modality.WINDOW_MODAL);
createPrimaryStage.show();
}
createPrimaryStage.requestFocus();
}

public static void main(String[] args) {
launch(args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.seagrid.desktop.ui.prestageupload.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.stage.FileChooser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

public class PrestageUploadController {
private final static Logger logger = LoggerFactory.getLogger(PrestageUploadController.class);

@FXML
private Button pickFile;

@FXML
private Button saveButton;

private FileChooser fileChooser;

@FXML
public GridPane preuploadGridPane;

@FXML
public void initialize() {

pickFile.setOnAction(event -> {
fileChooser = new FileChooser();
fileChooser.setTitle("Open Resource File");
File selectedFiles = fileChooser.showOpenDialog(null);
});
}


}
5 changes: 5 additions & 0 deletions src/main/resources/views/home/home.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
</HBox.margin>
</Button>
<Button fx:id="browseMassStorageBtn" mnemonicParsing="false" text="Storage" HBox.margin="$x5" />
<Button fx:id="uploadInputFilesButton" mnemonicParsing="false" text="Upload Input Files">
<HBox.margin>
<Insets bottom="3.0" right="3.0" top="3.0" fx:id="x5" />
</HBox.margin>
</Button>
<Button id="browseMassStorageBtn" fx:id="nanocadBtn" mnemonicParsing="false" text="Nanocad" visible="false" HBox.margin="$x5" />
<Button id="browseMassStorageBtn" fx:id="jamberooBtn" mnemonicParsing="false" text="Jamberoo" visible="false">
<HBox.margin>
Expand Down
43 changes: 43 additions & 0 deletions src/main/resources/views/prestageupload/upload-files.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.*?>
<StackPane prefWidth="350.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="org.seagrid.desktop.ui.prestageupload.controller.PrestageUploadController">
<children>
<StackPane>
<children>
<VBox spacing="10.0">
<children>
<GridPane fx:id="preuploadGridPane" prefHeight="120.0" prefWidth="250.0">
<children>
<Label text="Select File" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Button fx:id="pickFile" mnemonicParsing="false" text="Upload" GridPane.columnIndex="1"
GridPane.rowIndex="0" onAction="#initialize">

</Button>
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="148.0" minWidth="10.0" prefWidth="109.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="228.0" minWidth="10.0" prefWidth="189.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
<StackPane prefHeight="-1.0" prefWidth="-1.0">
<children>
<Button fx:id="saveButton" alignment="BOTTOM_LEFT" defaultButton="true" mnemonicParsing="false" text="Save" StackPane.alignment="BOTTOM_LEFT" />
</children>
</StackPane>
</children>
</VBox>
</children>
</StackPane>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</StackPane>

0 comments on commit 29f17e4

Please sign in to comment.