Skip to content

Commit

Permalink
Merge pull request #5355 from JabRef/fixGroupColor
Browse files Browse the repository at this point in the history
Fix default group color
  • Loading branch information
Siedlerchr authored Sep 26, 2019
2 parents d1307a8 + c0ab692 commit 8644ef7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- After assigning an entry to a group, the item count is now properly colored to reflect the new membership of the entry. [#3112](https://github.com/JabRef/jabref/issues/3112)
- The group panel is now properly updated when switching between libraries (or when closing/opening one). [#3142](https://github.com/JabRef/jabref/issues/3142)
- We fixed an error where the number of matched entries shown in the group pane was not updated correctly. [#4441](https://github.com/JabRef/jabref/issues/4441)
- We fixed an error where the default color of a new group was white instead of dark gray. [#4868](https://github.com/JabRef/jabref/issues/4868)
- We fixed an error mentioning "javafx.controls/com.sun.javafx.scene.control" that was thrown when interacting with the toolbar.
- We fixed an error where a cleared search was restored after switching libraries. [#4846](https://github.com/JabRef/jabref/issues/4846)
- We fixed an exception which occured when trying to open a non existing file from the "Recent files"-menu [#5334](https://github.com/JabRef/jabref/issues/5334)
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/groups/GroupDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.jabref.JabRefGUI;
import org.jabref.gui.BasePanel;
import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.search.rules.describer.SearchDescribers;
import org.jabref.gui.util.BaseDialog;
import org.jabref.gui.util.FileDialogConfiguration;
Expand Down Expand Up @@ -370,11 +371,12 @@ groupName, getContext(),
// configure for current type
if (editedGroup == null) {
// creating new group -> defaults!
colorField.setValue(IconTheme.getDefaultGroupColor());
explicitRadioButton.setSelected(true);
setContext(GroupHierarchyType.INDEPENDENT);
} else {
nameField.setText(editedGroup.getName());
editedGroup.getColor().ifPresent(colorField::setValue);
colorField.setValue(editedGroup.getColor().orElse(IconTheme.getDefaultGroupColor()));
descriptionField.setText(editedGroup.getDescription().orElse(""));
iconField.setText(editedGroup.getIconName().orElse(""));
setContext(editedGroup.getHierarchicalContext());
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,8 @@ public JabRefIcon getIcon() {
}

private JabRefIcon createDefaultIcon() {
Optional<Color> color = groupNode.getGroup().getColor();
if (color.isPresent()) {
return IconTheme.JabRefIcons.DEFAULT_GROUP_ICON_COLORED.withColor(color.get());
} else {
return IconTheme.JabRefIcons.DEFAULT_GROUP_ICON_COLORED.withColor(Color.web("#8a8a8a"));
}
Color color = groupNode.getGroup().getColor().orElse(IconTheme.getDefaultGroupColor());
return IconTheme.JabRefIcons.DEFAULT_GROUP_ICON_COLORED.withColor(color);
}

private Optional<JabRefIcon> parseIcon(String iconCode) {
Expand Down Expand Up @@ -248,7 +244,7 @@ boolean isMatchedBy(String searchString) {
}

public Color getColor() {
return groupNode.getGroup().getColor().orElse(IconTheme.getDefaultColor());
return groupNode.getGroup().getColor().orElse(IconTheme.getDefaultGroupColor());
}

public String getPath() {
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@

public class IconTheme {

/**
* JabRef's default color
*/
public static final Color DEFAULT_COLOR = JabRefPreferences.getInstance().getColor(JabRefPreferences.ICON_ENABLED_COLOR);
public static final Color DEFAULT_DISABLED_COLOR = JabRefPreferences.getInstance().getColor(JabRefPreferences.ICON_DISABLED_COLOR);
public static final javafx.scene.paint.Color SELECTED_COLOR = javafx.scene.paint.Color.web("#50618F");
private static final String DEFAULT_ICON_PATH = "/images/external/red.png";
Expand Down Expand Up @@ -60,8 +56,8 @@ private static InputStream getJabRefMaterialDesignIconsStream() throws IOExcepti
return IconTheme.class.getResource("/fonts/JabRefMaterialDesign.ttf").openStream();
}

public static Color getDefaultColor() {
return DEFAULT_COLOR;
public static Color getDefaultGroupColor() {
return Color.web("#8a8a8a");
}

public static Image getJabRefImageFX() {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/preferences/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ public class JabRefPreferences implements PreferencesService {
public static final String ACTIVE_FIELD_EDITOR_BACKGROUND_COLOR = "activeFieldEditorBackgroundColor";
public static final String INVALID_FIELD_BACKGROUND_COLOR = "invalidFieldBackgroundColor";
public static final String VALID_FIELD_BACKGROUND_COLOR = "validFieldBackgroundColor";
public static final String ICON_ENABLED_COLOR = "iconEnabledColor";
public static final String ICON_DISABLED_COLOR = "iconDisabledColor";
public static final String FONT_SIZE = "fontSize";
public static final String OVERRIDE_DEFAULT_FONT_SIZE = "overrideDefaultFontSize";
Expand Down Expand Up @@ -600,7 +599,6 @@ private JabRefPreferences() {
defaults.put(FIELD_EDITOR_TEXT_COLOR, "0:0:0");

// default icon colors
defaults.put(ICON_ENABLED_COLOR, "0:0:0");
defaults.put(ICON_DISABLED_COLOR, "200:200:200");

defaults.put(URL_COLUMN, Boolean.TRUE);
Expand Down

0 comments on commit 8644ef7

Please sign in to comment.