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

Switching entry tabs using tab #7

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Noah-Martin1
Copy link
Collaborator

Hey Everyone,

This PR has been created because I believe I have completed this issue: #11937.

To solve this, I used a similar approach as @yeonissa in the EditorTextField class. Using the entry tabs provided by EntryEditor, the method, EditorTextField is able to find the current tab, locate its last field, and compare the current TextField in focus to that field. To make this comparison possible, I set each TextField's ID to match the corresponding field's name.

I believe I have tested this well, but I’d appreciate any suggestions from you all before I submit a PR to the main repo.
Thankyou

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Noah Martin added 2 commits October 25, 2024 22:33
…ed fields" because the "CitationKey" isnt created in SimpleEditor.java and therefore hasn't had its textfield id updated.
…ed fields" because the "CitationKey" isnt created in SimpleEditor.java and therefore hasn't had its textfield id updated.
import org.jabref.gui.fieldeditors.contextmenu.EditorContextAction;
import org.jabref.gui.keyboard.KeyBindingRepository;

public class EditorTextField extends TextField implements Initializable, ContextMenuAddable {

private final ContextMenu contextMenu = new ContextMenu();
public static TabPane tabs;

Choose a reason for hiding this comment

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

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck> reported by reviewdog 🐶
Static variable definition in wrong order.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Plz check the styling

@@ -38,6 +48,10 @@ public EditorTextField(final String text) {
ClipBoardManager.addX11Support(this);
}

public static void entryContext(TabPane tab){

Choose a reason for hiding this comment

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

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck> reported by reviewdog 🐶
'{' is not preceded with whitespace.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this also plz check the style

Comment on lines 99 to 132
@FXML
private TabPane tabbed;

@FXML
private Button typeChangeButton;
@FXML
private Button fetcherButton;
@FXML
private Label typeLabel;

@Inject
private BuildInfo buildInfo;
@Inject
private DialogService dialogService;
@Inject
private TaskExecutor taskExecutor;
@Inject
private GuiPreferences preferences;
@Inject
private StateManager stateManager;
@Inject
private ThemeManager themeManager;
@Inject
private FileUpdateMonitor fileMonitor;
@Inject
private CountingUndoManager undoManager;
@Inject
private BibEntryTypesManager bibEntryTypesManager;
@Inject
private KeyBindingRepository keyBindingRepository;
@Inject
private JournalAbbreviationRepository journalAbbreviationRepository;
@Inject
private AiService aiService;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Styling should be improved - I think this won't pass the styling check

Copy link
Collaborator

Choose a reason for hiding this comment

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

See the previous one - it's all in one line

Comment on lines 145 to 146
.root(this)
.load();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is the space removed?

Comment on lines 496 to 501
if (textField != null && lastField != null) {
if (textField.getId() == null) {
return false;
}
return lastField.getDisplayName().equalsIgnoreCase(textField.getId());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is it indented one space deeper

import org.jabref.gui.fieldeditors.contextmenu.EditorContextAction;
import org.jabref.gui.keyboard.KeyBindingRepository;

public class EditorTextField extends TextField implements Initializable, ContextMenuAddable {

private final ContextMenu contextMenu = new ContextMenu();
public static TabPane tabs;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Plz check the styling

@@ -38,6 +48,10 @@ public EditorTextField(final String text) {
ClipBoardManager.addX11Support(this);
}

public static void entryContext(TabPane tab){
Copy link
Collaborator

Choose a reason for hiding this comment

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

this also plz check the style

Comment on lines 64 to 65


Copy link
Collaborator

Choose a reason for hiding this comment

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

remove space pls

Comment on lines 40 to 48
if (isMultiLine) {
EditorTextArea textArea = new EditorTextArea();
textArea.setId(field.getName());
textInput = textArea;
} else {
EditorTextField textField = new EditorTextField();
textField.setId(field.getName());
textInput = textField;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be simplified with

textInput = isMultiLine 
    ? new EditorTextArea() 
    : new EditorTextField();
    
textInput.setId(field.getName());

Comment on lines 57 to 66
protected TextInputControl createTextInputControl(Field field) {
if (isMultiLine) {
EditorTextArea textArea = new EditorTextArea();
textArea.setId(field.getName());
return textArea;
} else {
EditorTextField textField = new EditorTextField();
textField.setId(field.getName());
return textField;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

again, you can see the simplified version above

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.

2 participants