Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature block content edit view [View] #416

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f959350
Add logic as a parameter to BlockContentEditView
HemanshuGandhi Apr 7, 2020
28b79a0
Refactor methods in BlockContentEditView
HemanshuGandhi Apr 7, 2020
865ed2c
Standardize code convention
HemanshuGandhi Apr 7, 2020
512e3a3
Add Edit Modal skeleton
HemanshuGandhi Apr 8, 2020
6897708
Fix checkstyle violations
HemanshuGandhi Apr 8, 2020
e4b01db
Link up edit modal to logic for updating block content
HemanshuGandhi Apr 8, 2020
656e688
fix checkstyle violations
HemanshuGandhi Apr 8, 2020
febe0d4
Fix window resizing bug
HemanshuGandhi Apr 8, 2020
b94893d
Add background darken effect when Edit modal is showing
HemanshuGandhi Apr 8, 2020
5a3faa6
Allow exiting of edit modal on pressing esc
HemanshuGandhi Apr 8, 2020
55b048c
Add dropshadow to edit modal
HemanshuGandhi Apr 8, 2020
f6516c1
Change edit modal to appear minimalistic
HemanshuGandhi Apr 8, 2020
3440e47
Remove unused import
HemanshuGandhi Apr 8, 2020
b0b437b
Merge branch 'master' into feature-block-content-edit-view
HemanshuGandhi Apr 8, 2020
50a51dc
Remove commented line in EditCommand
HemanshuGandhi Apr 9, 2020
9bfed5f
Merge branch 'feature-block-content-edit-view' of https://github.com/…
HemanshuGandhi Apr 9, 2020
0f372d9
Refactor methods in BlockContentEditView
HemanshuGandhi Apr 9, 2020
1855a38
Remove window darkening bug when other applications are opened
HemanshuGandhi Apr 9, 2020
3f2659b
Edit javadoc for #setKeyboardListeners
HemanshuGandhi Apr 10, 2020
962adaa
Merge branch 'master' into feature-block-content-edit-view
HemanshuGandhi Apr 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/main/java/com/notably/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static java.util.Objects.requireNonNull;

import com.notably.logic.commands.exceptions.CommandException;
import com.notably.model.Model;

/**
Expand All @@ -15,10 +14,9 @@ public class EditCommand extends Command {
/**
* Edit the Block body of the current directory.
* @param notablyModel used to access the tree structure.
* @throws CommandException
*/
public void execute(Model notablyModel) {
requireNonNull(notablyModel);
notablyModel.setBlockEditable(true);
}
}

28 changes: 24 additions & 4 deletions src/main/java/com/notably/view/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javafx.fxml.FXML;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextInputControl;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.StackPane;
Expand Down Expand Up @@ -47,6 +48,9 @@ public class MainWindow extends ViewPart<Stage> {
@FXML
private MenuItem helpMenuItem;

@FXML
private VBox mainWindow;

@FXML
private StackPane sideBarPlaceholder;

Expand All @@ -62,14 +66,12 @@ public class MainWindow extends ViewPart<Stage> {
public MainWindow(Stage primaryStage, Logic logic, Model model) {
super(FXML, primaryStage);

// Set dependencies
this.primaryStage = primaryStage;
this.logic = logic;
this.model = model;

// Configure the VIEW
setWindowDefaultSize(logic.getGuiSettings());

//setWindowSettings(primaryStage);
setAccelerators();

initializeHelpWindow(model);
Expand All @@ -79,6 +81,24 @@ public Stage getPrimaryStage() {
return primaryStage;
}

/**
* Provides an alternative way to set the settings of the main window, as an alternative
* to doing so via fxml tags.
*
* @param primaryStage the stage corresponding to the main app window.
*/
private void setWindowSettings(Stage primaryStage) {
primaryStage.focusedProperty().addListener(((observable, unused, isFocused) -> {
if (isFocused) {
mainWindow.setEffect(null);
} else {
ColorAdjust colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(-0.4);
mainWindow.setEffect(colorAdjust);
}
}));
}

HemanshuGandhi marked this conversation as resolved.
Show resolved Hide resolved
private void setAccelerators() {
setAccelerator(helpMenuItem, KeyCombination.valueOf("F1"));
}
Expand Down Expand Up @@ -125,7 +145,7 @@ void fillInnerParts() {
sidebarTreeView = new SideBarTreeView(model.getBlockTree(), model.currentlyOpenPathProperty());
sideBarPlaceholder.getChildren().add(sidebarTreeView.getRoot());

blockContent = new BlockContent(blockContentPlaceholder, model);
blockContent = new BlockContent(blockContentPlaceholder, logic, model);

suggestionsWindowView = new SuggestionsWindowView(model.getSuggestions(), model.responseTextProperty());
suggestionsWindow.getChildren().add(suggestionsWindowView.getRoot());
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/notably/view/blockcontent/BlockContent.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.notably.view.blockcontent;

import java.util.Objects;
import static com.notably.commons.util.CollectionUtil.requireAllNonNull;

import com.notably.logic.Logic;
import com.notably.model.Model;

import javafx.scene.layout.StackPane;
Expand All @@ -10,15 +11,15 @@
* View of the currently open block's content.
*/
public class BlockContent {

private final BlockContentDisplayView blockContentDisplayView;
private final BlockContentEditView blockContentEditView;

public BlockContent(StackPane blockContentPlaceholder, Model model) {
Objects.requireNonNull(blockContentPlaceholder);
Objects.requireNonNull(model);
public BlockContent(StackPane blockContentPlaceholder, Logic logic, Model model) {
requireAllNonNull(blockContentPlaceholder, model, logic);

blockContentDisplayView = new BlockContentDisplayView(model);
blockContentEditView = new BlockContentEditView(model);
blockContentEditView = new BlockContentEditView(logic, model);

// TODO: Integrate BlockContentEditView
blockContentPlaceholder.getChildren().addAll(blockContentDisplayView.getRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* Read-only and rendered view of the currently open block's content.
*/
public class BlockContentDisplayView extends ViewPart<WebView> {
private static final String FXML = "blockcontent/BlockContentDisplayView.fxml";

private static final String FXML = "blockcontent/BlockContentDisplayView.fxml";
private final Model model;

@FXML
Expand Down
Loading