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

Conversion of group dialog to mvvm-pattern #5826

Merged
merged 13 commits into from
Jan 26, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ 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)

### Fixed

- We fixed an issue where the Medline fetcher was only working when JabRef was running from source. [#5645](https://github.com/JabRef/jabref/issues/5645)
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();
}

}
163 changes: 163 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,163 @@
<?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>
<VBox spacing="10.0">
<Label text="%Collect by"/>
<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>
<Button styleClass="icon-button,narrow" onAction="#openHelp">
<graphic>
<JabRefIconView glyph="HELP"/>
</graphic>
<tooltip>
<Tooltip text="%Open Help page"/>
</tooltip>
</Button>
</HBox>
</VBox>
</content>
</DialogPane>
Loading