Improved create project disabled button logic
This commit is contained in:
parent
de1eba7164
commit
4bcd9aa2a3
3 changed files with 19 additions and 10 deletions
24
src/com/coder/client/gui/newProject/NewProjectDialog.java
Normal file → Executable file
24
src/com/coder/client/gui/newProject/NewProjectDialog.java
Normal file → Executable file
|
|
@ -80,22 +80,30 @@ public class NewProjectDialog extends GuiWindow {
|
|||
listener.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
protected void keyPressed(KeyEvent event){
|
||||
if(projectNameTextField.getText() != null && !projectNameTextField.getText().isEmpty()){
|
||||
if(projectTypeComboBox.getValue() != null && !projectTypeComboBox.getValue().isEmpty()){
|
||||
createButton.setDisable(false);
|
||||
}
|
||||
}
|
||||
enableDisableButton();
|
||||
|
||||
if(event.getCode().equals(KeyCode.ENTER)){
|
||||
createButton.fire();
|
||||
}else if(event.getCode().equals(KeyCode.ESCAPE)){
|
||||
cancelButton.fire();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: react to combo box changes
|
||||
@FXML
|
||||
protected void typeSelection(ActionEvent event){
|
||||
enableDisableButton();
|
||||
}
|
||||
protected void enableDisableButton(){
|
||||
createButton.setDisable(true);
|
||||
if(projectNameTextField.getText() != null && !projectNameTextField.getText().isEmpty()){
|
||||
if(projectTypeComboBox.getValue() != null && !projectTypeComboBox.getValue().isEmpty()){
|
||||
createButton.setDisable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue