Skip to content

Commit

Permalink
Merge pull request #5826 from calixtus/group_dialog_mvvm
Browse files Browse the repository at this point in the history
Conversion of group dialog to mvvm-pattern
  • Loading branch information
calixtus authored Jan 26, 2020
2 parents 0407d9a + 584abac commit eccfb57
Show file tree
Hide file tree
Showing 13 changed files with 888 additions and 845 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Changed

- We cleaned up the group add/edit dialog. [#5826](https://github.com/JabRef/jabref/pull/5826)
- We reintroduced the index column. [#5844](https://github.com/JabRef/jabref/pull/5844)

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@

.button {
-fx-background-color: transparent;
-fx-border-color: rgba(0, 0, 0, 0.23);
-fx-border-color: -fx-outer-border; /* rgba(0, 0, 0, 0.23); */
-fx-border-width: 1px;
-fx-border-radius: 4px;
-fx-padding: 0.5em 1em 0.5em 1em;
Expand Down Expand Up @@ -1121,3 +1121,7 @@ We want to have a look that matches our icons in the tool-bar */
-fx-font-weight: bold;
-fx-label-padding: 5 0 10 10;
}

TextFlow * {
-fx-fill: -fx-text-background-color;
}
32 changes: 0 additions & 32 deletions src/main/java/org/jabref/gui/groups/GroupDescriptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,6 @@ public class GroupDescriptions {
private GroupDescriptions() {
}

public static String getDescriptionForPreview(String field, String expr, boolean caseSensitive, boolean regExp) {
String header = regExp ? Localization.lang(
"This group contains entries whose <b>%0</b> field contains the regular expression <b>%1</b>",
field, expr) : Localization.lang(
"This group contains entries whose <b>%0</b> field contains the keyword <b>%1</b>",
field, expr);
String caseSensitiveText = caseSensitive ? Localization.lang("case sensitive") : Localization
.lang("case insensitive");
String footer = regExp ? Localization
.lang("Entries cannot be manually assigned to or removed from this group.") : Localization.lang(
"Additionally, entries whose <b>%0</b> field does not contain "
+ "<b>%1</b> can be assigned manually to this group by selecting them "
+ "then using either drag and drop or the context menu. "
+ "This process adds the term <b>%1</b> to "
+ "each entry's <b>%0</b> field. "
+ "Entries can be removed manually from this group by selecting them "
+ "then using the context menu. "
+ "This process removes the term <b>%1</b> from "
+ "each entry's <b>%0</b> field.",
field, expr);
return String.format("%s (%s). %s", header, caseSensitiveText, footer);
}

public static String getShortDescriptionKeywordGroup(KeywordGroup keywordGroup, boolean showDynamic) {
StringBuilder sb = new StringBuilder();
sb.append("<b>");
Expand Down Expand Up @@ -65,14 +42,6 @@ public static String getShortDescriptionKeywordGroup(KeywordGroup keywordGroup,

}

public static String getDescriptionForPreview() {
return Localization.lang("This group contains entries based on manual assignment. "
+ "Entries can be assigned to this group by selecting them "
+ "then using either drag and drop or the context menu. "
+ "Entries can be removed from this group by selecting them "
+ "then using the context menu.");
}

public static String getShortDescriptionExplicitGroup(ExplicitGroup explicitGroup) {
StringBuilder sb = new StringBuilder();
sb.append("<b>").append(explicitGroup.getName()).append("</b> - ").append(Localization.lang("static group"));
Expand Down Expand Up @@ -118,5 +87,4 @@ public static String getShortDescription(SearchGroup searchGroup, boolean showDy
}
return sb.toString();
}

}
166 changes: 166 additions & 0 deletions src/main/java/org/jabref/gui/groups/GroupDialog.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import org.jabref.gui.icon.JabRefIconView?>

<DialogPane prefHeight="300.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/10.0.2-internal"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.groups.GroupDialogView">
<content>
<fx:define>
<ToggleGroup fx:id="hierarchicalContext"/>
<ToggleGroup fx:id="type"/>
<ToggleGroup fx:id="autoGroupOptions"/>
</fx:define>
<VBox spacing="10.0" minWidth="200">
<padding>
<Insets bottom="4.0" left="4.0" right="4.0" top="4.0"/>
</padding>
<VBox>
<Label text="%Name"/>
<TextField fx:id="nameField"/>
</VBox>
<VBox>
<Label text="%Description"/>
<TextField fx:id="descriptionField"/>
</VBox>
<HBox spacing="10.0">
<VBox HBox.hgrow="ALWAYS">
<Label text="%Icon"/>
<TextField fx:id="iconField"/>
</VBox>
<VBox layoutX="10.0" layoutY="10.0" minWidth="130.0" maxWidth="130.0" prefWidth="130.0">
<Label text="%Color"/>
<ColorPicker fx:id="colorField"/>
</VBox>
<VBox>
<Label text="%Hierarchical context"/>
<ComboBox fx:id="hierarchicalContextCombo" minWidth="130.0" maxWidth="130.0" prefWidth="130.0"/>
</VBox>
</HBox>
<HBox alignment="BOTTOM_LEFT">
<Label text="%Collect by" styleClass="sectionHeader"/>
<HBox HBox.hgrow="ALWAYS"/>
<Button styleClass="icon-button,narrow" onAction="#openHelp">
<graphic>
<JabRefIconView glyph="HELP"/>
</graphic>
<tooltip>
<Tooltip text="%Open Help page"/>
</tooltip>
</Button>
</HBox>
<HBox>
<VBox spacing="10.0">
<RadioButton fx:id="explicitRadioButton" toggleGroup="$type" wrapText="true"
text="%Explicit selection">
<tooltip>
<Tooltip text="%Statically group entries by manual assignment"/>
</tooltip>
</RadioButton>
<RadioButton fx:id="keywordsRadioButton" toggleGroup="$type" wrapText="true"
text="%Searching for keywords">
<tooltip>
<Tooltip text="%Dynamically group entries by searching a field for a keyword"/>
</tooltip>
</RadioButton>
<RadioButton fx:id="searchRadioButton" toggleGroup="$type" wrapText="true"
text="%Free search expression">
<tooltip>
<Tooltip text="%Dynamically group entries by a free-form search expression"/>
</tooltip>
</RadioButton>
<RadioButton fx:id="autoRadioButton" toggleGroup="$type" wrapText="true"
text="%Specified keywords">
<tooltip>
<Tooltip text="%Automatically create groups"/>
</tooltip>
</RadioButton>
<RadioButton fx:id="texRadioButton" toggleGroup="$type" wrapText="true"
text="%Cited entries">
<tooltip>
<Tooltip text="%Group containing entries cited in a given TeX file"/>
</tooltip>
</RadioButton>
</VBox>
<Separator orientation="VERTICAL"/>
<StackPane HBox.hgrow="ALWAYS">
<VBox visible="${keywordsRadioButton.selected}" spacing="10.0">
<VBox>
<Label text="%Field"/>
<TextField fx:id="keywordGroupSearchField"/>
</VBox>
<VBox>
<Label text="%Keyword"/>
<TextField fx:id="keywordGroupSearchTerm"/>
</VBox>
<HBox spacing="10.0">
<CheckBox fx:id="keywordGroupCaseSensitive" text="Case sensitive"/>
<CheckBox fx:id="keywordGroupRegex" text="Regular expression"/>
</HBox>
</VBox>
<VBox visible="${searchRadioButton.selected}" spacing="10.0">
<VBox>
<Label text="%Search expression"/>
<TextField fx:id="searchGroupSearchTerm"/>
</VBox>
<HBox spacing="10.0">
<CheckBox fx:id="searchGroupCaseSensitive" text="Case sensitive"/>
<CheckBox fx:id="searchGroupRegex" text="Regular expression"/>
</HBox>
</VBox>
<VBox visible="${autoRadioButton.selected}" spacing="10.0">
<RadioButton fx:id="autoGroupKeywordsOption" toggleGroup="$autoGroupOptions"
text="Generate groups from keywords in a BibTeX field"/>
<VBox spacing="10.0">
<padding>
<Insets left="20.0"/>
</padding>
<HBox spacing="10.0">
<VBox HBox.hgrow="ALWAYS">
<Label text="%Field to group by"/>
<TextField fx:id="autoGroupKeywordsField"
disable="${!autoGroupKeywordsOption.selected}"/>
</VBox>
<VBox>
<Label text="%Delimiter(s)"/>
<HBox spacing="10.0">
<TextField fx:id="autoGroupKeywordsDeliminator" prefWidth="30.0"
disable="${!autoGroupKeywordsOption.selected}">
<tooltip>
<Tooltip text="%Keyword delimiter"/>
</tooltip>
</TextField>
<TextField fx:id="autoGroupKeywordsHierarchicalDeliminator" prefWidth="30.0"
disable="${!autoGroupKeywordsOption.selected}">
<tooltip>
<Tooltip text="%Hierarchical keyword delimiter"/>
</tooltip>
</TextField>
</HBox>
</VBox>
</HBox>
</VBox>
<RadioButton fx:id="autoGroupPersonsOption" toggleGroup="$autoGroupOptions"
text="Generate groups for author last names"/>
<VBox>
<padding>
<Insets left="20.0"/>
</padding>
<Label text="%Field to group by"/>
<TextField fx:id="autoGroupPersonsField" disable="${!autoGroupPersonsOption.selected}"/>
</VBox>
</VBox>
<VBox visible="${texRadioButton.selected}">
<Label text="%Aux file"/>
<HBox spacing="10.0">
<TextField fx:id="texGroupFilePath" HBox.hgrow="ALWAYS" prefHeight="30.0"/>
<Button onAction="#texGroupBrowse" text="%Browse" prefHeight="30.0"/>
</HBox>
</VBox>
</StackPane>
</HBox>
</VBox>
</content>
</DialogPane>
Loading

0 comments on commit eccfb57

Please sign in to comment.