This commit is contained in:
Ziver Koc 2015-11-04 23:39:01 +01:00
commit 2b86fb4ce6
4 changed files with 17 additions and 11 deletions

View file

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

View file

@ -5,14 +5,16 @@
<?import java.lang.*?> <?import java.lang.*?>
<?import javafx.scene.layout.*?> <?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> <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="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" /> <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" />
<HBox alignment="CENTER_RIGHT" layoutX="168.0" layoutY="109.0" prefHeight="35.0" prefWidth="127.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="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> <children>
<Button fx:id="cancelButton" mnemonicParsing="false" onAction="#cancel" text="cancel"> <Button fx:id="cancelButton" mnemonicParsing="false" onAction="#cancel" text="cancel">
<HBox.margin> <HBox.margin>

View file

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

View file

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