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

Add group coloring in maintable as replacement for marked entries #3769

Merged
merged 7 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from 5 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
41 changes: 0 additions & 41 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -560,47 +560,6 @@ public void update() {
(BaseAction) () -> JabRefExecutorService.INSTANCE.execute(new DuplicateSearch(BasePanel.this)));
*/

// TODO
//actions.put(Actions.MARK_ENTRIES, new MarkEntriesAction(frame, 0));

actions.put(Actions.UNMARK_ENTRIES, (BaseAction) () -> {
try {
List<BibEntry> bes = mainTable.getSelectedEntries();
if (bes.isEmpty()) {
output(Localization.lang("This operation requires one or more entries to be selected."));
return;
}
NamedCompound ce = new NamedCompound(Localization.lang("Unmark entries"));
for (BibEntry be : bes) {
EntryMarker.unmarkEntry(be, false, bibDatabaseContext.getDatabase(), ce);
}
ce.end();
getUndoManager().addEdit(ce);
markBaseChanged();
String outputStr;
if (bes.size() == 1) {
outputStr = Localization.lang("Unmarked selected entry");
} else {
outputStr = Localization.lang("Unmarked all %0 selected entries", Integer.toString(bes.size()));
}
output(outputStr);
} catch (Throwable ex) {
LOGGER.warn("Could not unmark", ex);
}
});

actions.put(Actions.UNMARK_ALL, (BaseAction) () -> {
NamedCompound ce = new NamedCompound(Localization.lang("Unmark all"));

for (BibEntry be : bibDatabaseContext.getDatabase().getEntries()) {
EntryMarker.unmarkEntry(be, false, bibDatabaseContext.getDatabase(), ce);
}
ce.end();
getUndoManager().addEdit(ce);
markBaseChanged();
output(Localization.lang("Unmarked all entries"));
});

// Note that we can't put the number of entries that have been reverted into the undoText as the concrete number cannot be injected
actions.put(new SpecialFieldValueViewModel(SpecialField.RELEVANCE.getValues().get(0)).getCommand(),
new SpecialFieldViewModel(SpecialField.RELEVANCE, undoManager).getSpecialFieldAction(
Expand Down
199 changes: 0 additions & 199 deletions src/main/java/org/jabref/gui/EntryMarker.java

This file was deleted.

19 changes: 13 additions & 6 deletions src/main/java/org/jabref/gui/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ public enum JabRefIcons implements JabRefIcon {
COMMENT(MaterialDesignIcon.COMMENT),
REDO(MaterialDesignIcon.REDO),
UNDO(MaterialDesignIcon.UNDO),
MARK_ENTRIES(MaterialDesignIcon.BOOKMARK),
MARKER(MaterialDesignIcon.MARKER),
UNMARK_ENTRIES(MaterialDesignIcon.BOOKMARK_OUTLINE),
REFRESH(MaterialDesignIcon.REFRESH),
DELETE_ENTRY(MaterialDesignIcon.DELETE),
SEARCH(MaterialDesignIcon.MAGNIFY),
Expand Down Expand Up @@ -296,12 +294,11 @@ public enum JabRefIcons implements JabRefIcon {
BLOG(MaterialDesignIcon.RSS), /* css: rss */
GLOBAL_SEARCH(MaterialDesignIcon.EARTH), /* css: earth */
DATE_PICKER(MaterialDesignIcon.CALENDAR), /* css: calendar */
DEFAULT_GROUP_ICON(MaterialDesignIcon.LABEL_OUTLINE), /* css: label-outline */
DEFAULT_GROUP_ICON_COLORED(MaterialDesignIcon.CHECKBOX_BLANK_CIRCLE),
DEFAULT_GROUP_ICON(MaterialDesignIcon.LABEL_OUTLINE),
ALL_ENTRIES_GROUP_ICON(DefaultGroupsFactory.ALL_ENTRIES_GROUP_DEFAULT_ICON),
IMPORT_EXPORT(MaterialDesignIcon.SWAP_VERTICAL),
CLOSE_JABREF(MaterialDesignIcon.GLASSDOOR),
// STILL MISSING:
GROUP_REGULAR(Color.RED, MaterialDesignIcon.SYNC);
CLOSE_JABREF(MaterialDesignIcon.GLASSDOOR);

private final JabRefIcon icon;

Expand Down Expand Up @@ -337,6 +334,11 @@ public JabRefIcon disabled() {
return icon.disabled();
}

@Override
public JabRefIcon withColor(javafx.scene.paint.Color color) {
return icon.withColor(color);
}

private class InternalFileIcon implements JabRefIcon {

private final ImageIcon imageIcon;
Expand Down Expand Up @@ -364,6 +366,11 @@ public Node getGraphicNode() {
public JabRefIcon disabled() {
throw new NotImplementedException("Cannot create disabled version of a file-based icon");
}

@Override
public JabRefIcon withColor(javafx.scene.paint.Color color) {
throw new NotImplementedException("Cannot create colored version of a file-based icon");
}
}

public Button asButton() {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/InternalMaterialDesignIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public JabRefIcon disabled() {
return new InternalMaterialDesignIcon(ColorUtil.toFX(IconTheme.DEFAULT_DISABLED_COLOR), icons);
}

@Override
public JabRefIcon withColor(Color color) {
return new InternalMaterialDesignIcon(color, icons);
}

public String getCode() {
return this.unicode;
}
Expand Down
18 changes: 1 addition & 17 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,6 @@ public class JabRefFrame extends BorderPane implements OutputPrinter {
// Note: GeneralAction's constructor automatically gets translations
// for the name and message strings.

private final AbstractAction mark = new GeneralAction(Actions.MARK_ENTRIES, Localization.menuTitle("Mark entries"),
Localization.lang("Mark entries"), Globals.getKeyPrefs().getKey(KeyBinding.MARK_ENTRIES), IconTheme.JabRefIcons.MARK_ENTRIES.getIcon());
private final JMenu markSpecific = JabRefFrame.subMenu(Localization.menuTitle("Mark specific color"));
private final AbstractAction unmark = new GeneralAction(Actions.UNMARK_ENTRIES,
Localization.menuTitle("Unmark entries"), Localization.lang("Unmark entries"),
Globals.getKeyPrefs().getKey(KeyBinding.UNMARK_ENTRIES), IconTheme.JabRefIcons.UNMARK_ENTRIES.getIcon());
private final AbstractAction unmarkAll = new GeneralAction(Actions.UNMARK_ALL, Localization.menuTitle("Unmark all"));
private final AbstractAction toggleRelevance = new GeneralAction(
new SpecialFieldValueViewModel(SpecialField.RELEVANCE.getValues().get(0)).getCommand(),
new SpecialFieldValueViewModel(SpecialField.RELEVANCE.getValues().get(0)).getMenuString(),
Expand Down Expand Up @@ -805,16 +798,7 @@ private MenuBar createMenu() {
factory.createMenuItem(StandardActions.SEND_AS_EMAIL, new OldDatabaseCommandWrapper(Actions.SEND_AS_EMAIL, this, Globals.stateManager)),

new SeparatorMenuItem());
/*
edit.add(mark);
for (int i = 0; i < EntryMarker.MAX_MARKING_LEVEL; i++) {
markSpecific.add(new MarkEntriesAction(this, i).getMenuItem());
}
edit.add(markSpecific);
edit.add(unmark);
edit.add(unmarkAll);
edit.addSeparator();
*/

/* TODO
if (Globals.prefs.getBoolean(JabRefPreferences.SPECIALFIELDSENABLED)) {
boolean menuitem = false;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/gui/JabRefIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javax.swing.Icon;

import javafx.scene.Node;
import javafx.scene.paint.Color;

public interface JabRefIcon {
Icon getIcon();
Expand All @@ -12,4 +13,6 @@ public interface JabRefIcon {
Node getGraphicNode();

JabRefIcon disabled();

JabRefIcon withColor(Color color);
}
3 changes: 0 additions & 3 deletions src/main/java/org/jabref/gui/actions/Actions.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public enum Actions {
EXPORT_TO_CLIPBOARD,
MAKE_KEY,
MANAGE_SELECTORS,
MARK_ENTRIES,
MERGE_DATABASE,
MERGE_ENTRIES,
MERGE_WITH_FETCHED_ENTRY,
Expand Down Expand Up @@ -59,8 +58,6 @@ public enum Actions {
TOGGLE_PREVIEW,
UNABBREVIATE,
UNDO,
UNMARK_ALL,
UNMARK_ENTRIES,
WRITE_XMP,
PRINT_PREVIEW,
togglePrinted,
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/org/jabref/gui/groups/GroupMatcher.java

This file was deleted.

Loading