Adding a project descrition field to the NewProjectDialog

This commit is contained in:
dcollin 2015-11-04 12:56:20 +01:00
parent 4bcd9aa2a3
commit 016b4b07f5
4 changed files with 17 additions and 11 deletions

View file

@ -346,9 +346,9 @@ public class CoderClient extends Application{
sendProjectTypeReqMsg();
}
@Override
public void create(String newProjectName, String projectType) {
public void create(String newProjectName, String projectType, String projectDescription) {
projectSelectionWindow = newProjectDialog;
sendProjectCreateReqMsg(newProjectName, projectType);
sendProjectCreateReqMsg(newProjectName, projectType, projectDescription);
selectProjectDialog.setProject(newProjectName);
editorWindow.showOnStage(mainStage);
}
@ -362,11 +362,12 @@ public class CoderClient extends Application{
closeCurrentSession();
}
}
private void sendProjectCreateReqMsg(String projectName, String projectType){
private void sendProjectCreateReqMsg(String projectName, String projectType, String projectDescription){
CoderMessage msg = new CoderMessage();
msg.ProjectCreateReq = new ProjectCreateReqMsg();
msg.ProjectCreateReq.name = projectName;
msg.ProjectCreateReq.type = projectType;
msg.ProjectCreateReq.description = projectDescription;
try {
session.send(msg);
} catch (IOException e) {

View file

@ -5,14 +5,16 @@
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="112.0" prefWidth="382.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="144.0" prefWidth="382.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
<children>
<ComboBox fx:id="projectTypeComboBox" layoutX="58.0" layoutY="39.0" onAction="#typeSelection" prefHeight="25.0" prefWidth="196.0" promptText="Select a Project Type" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" />
<Label fx:id="errorMessageLabel" alignment="TOP_LEFT" layoutX="14.0" layoutY="71.0" prefHeight="17.0" prefWidth="237.0" text="Error Message" textFill="RED" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="135.0" AnchorPane.topAnchor="71.0" />
<TextField fx:id="projectNameTextField" layoutX="58.0" layoutY="10.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="314.0" promptText="Project Name" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" />
<Label layoutX="14.0" layoutY="14.0" text="Name" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="14.0" />
<Label layoutX="14.0" layoutY="43.0" text="Type" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="43.0" />
<HBox alignment="CENTER_RIGHT" layoutX="168.0" layoutY="109.0" prefHeight="35.0" prefWidth="127.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0">
<TextField fx:id="projectNameTextField" layoutX="58.0" layoutY="10.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="314.0" promptText="Project Name" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0" />
<Label layoutX="14.0" layoutY="43.0" text="Desc." AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="43.0" />
<TextField fx:id="projectDescriptionTextField" layoutX="97.0" layoutY="80.0" promptText="Description (optional)" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="39.0" />
<Label layoutX="14.0" layoutY="81.0" text="Type" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="72.0" />
<ComboBox fx:id="projectTypeComboBox" layoutX="58.0" layoutY="39.0" onAction="#typeSelection" prefHeight="25.0" prefWidth="196.0" promptText="Select a Project Type" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="68.0" />
<Label fx:id="errorMessageLabel" alignment="TOP_LEFT" layoutX="14.0" layoutY="99.0" prefHeight="35.0" prefWidth="208.0" text="Error Message" textFill="RED" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="164.0" AnchorPane.topAnchor="99.0" />
<HBox alignment="CENTER_RIGHT" layoutX="168.0" layoutY="109.0" prefHeight="35.0" prefWidth="151.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0">
<children>
<Button fx:id="cancelButton" mnemonicParsing="false" onAction="#cancel" text="cancel">
<HBox.margin>

View file

@ -29,6 +29,7 @@ public class NewProjectDialog extends GuiWindow {
@FXML private Button createButton;
@FXML private Button cancelButton;
@FXML private TextField projectNameTextField;
@FXML private TextField projectDescriptionTextField;
@FXML private ComboBox<String> projectTypeComboBox;
@FXML private Label errorMessageLabel;
@ -70,7 +71,7 @@ public class NewProjectDialog extends GuiWindow {
return;
}
for(NewProjectDialogListener listener : this.listeners){
listener.create(projectNameTextField.getText(), projectTypeComboBox.getValue());
listener.create(projectNameTextField.getText(), projectTypeComboBox.getValue(), projectDescriptionTextField.getText());
}
}
@ -92,10 +93,12 @@ public class NewProjectDialog extends GuiWindow {
cancelButton.fire();
}
}
@FXML
protected void typeSelection(ActionEvent event){
enableDisableButton();
}
protected void enableDisableButton(){
createButton.setDisable(true);
if(projectNameTextField.getText() != null && !projectNameTextField.getText().isEmpty()){

View file

@ -4,7 +4,7 @@ public interface NewProjectDialogListener {
public void willShow();
public void create(String projectName, String projectType);
public void create(String projectName, String projectType, String projectDescription);
public void cancel();