Skip to content

Added a "Clear text" button in right click menu within the text boxes#3465

Closed
weidafan wants to merge 5 commits into
JabRef:masterfrom
weidafan:master
Closed

Added a "Clear text" button in right click menu within the text boxes#3465
weidafan wants to merge 5 commits into
JabRef:masterfrom
weidafan:master

Conversation

@weidafan

@weidafan weidafan commented Nov 29, 2017

Copy link
Copy Markdown
Contributor

Adresses koppor#198

It was requested to have a new button within the right click menu of text boxes when creating or editing library entries. See this link for description

We created a new class that extended MenuItem to create the instance of the ClearField.
We added the instance into the menuItem array so that it would be included in the right click menu.

There is a possibility to make each text box a clearable text box, with a red "x" in the corner to clear the text box even quicker. We could not target where to change the type of text box, so that feature still remains.


  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)
  • Manually tested changed features in running JabRef
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • If you changed the localization: Did you run gradle localizationUpdate?

@koppor koppor changed the title Added a "Clear text" button in right click menu within the text boxes kopper/#198 Added a "Clear text" button in right click menu within the text boxes Nov 29, 2017

@tobiasdiez tobiasdiez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!


class ClearField extends MenuItem {

private final TextArea opener;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no need for this private field since the variable is only used in the constructor anyway.

public ClearField(TextArea opener) {
super(Localization.lang("Clear text"));
this.opener = opener;
setOnAction(event -> opener.setText(new NormalizeNamesFormatter().format("")));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use the names formatter here? I think TextArea has a clear method, or otherwise setText("") should work.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I was on the team with Weida that was working on this issue. We now realize that the things you mention were not needed. We were trying to follow how the other menu item classes were built, and that is why we added the private field. We found the class to add the menu item to the menuItem array by finding a similar issue that dealt with the Normalize name option. But we see now that we made it much more complicated than it needed to be. We should be able to fix these this week if we need to.
Thanks

@brandonwalker08

Copy link
Copy Markdown

We also see that the continuous build failed? I'm not sure how adding a small class could break it, so we'll look into this. If anyone sees an issue as well please let us know. Thanks

@Siedlerchr

Copy link
Copy Markdown
Member

Hi, you simply forgot to add a languagefile entry (from the end of the travis log)

    => java.lang.AssertionError: DETECTED LANGUAGE KEYS WHICH ARE NOT IN THE ENGLISH LANGUAGE FILE

1. PASTE THESE INTO THE ENGLISH LANGUAGE FILE

2. EXECUTE: gradlew localizationUpdate

[
Clear_text=Clear_text
] expected:<[]> but was:<[Clear_text (src/main/java/org/jabref/gui/fieldeditors/contextmenu/ClearField.java LANG)]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants