Skip to content

Commit

Permalink
feature JabRef#6189 popOver implemented
Browse files Browse the repository at this point in the history
- popover implemented and located above assigned button
- ready to display relevant information once implemented
  • Loading branch information
LukasGutenberg committed Mar 4, 2021
1 parent d4afb81 commit 0a2857d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/fieldeditors/JournalEditor.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<Tooltip text="%Switches between full and abbreviated journal name if the journal name is known."/>
</tooltip>
</Button>
<Button onAction="#getJournalStatistics"
<Button fx:id="journalStatisticsButton"
onAction="#getJournalStatistics"
styleClass="icon-button">
<graphic>
<JabRefIconView glyph="VIEW_JOURNAL_STATISTICS"/>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/fieldeditors/JournalEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;

import org.jabref.gui.autocompleter.AutoCompletionTextInputBinding;
Expand All @@ -19,6 +20,7 @@ public class JournalEditor extends HBox implements FieldEditorFX {

@FXML private JournalEditorViewModel viewModel;
@FXML private EditorTextField textField;
@FXML private Button journalStatisticsButton;

public JournalEditor(Field field,
JournalAbbreviationRepository journalAbbreviationRepository,
Expand Down Expand Up @@ -60,6 +62,6 @@ private void toggleAbbreviation() {

@FXML
private void getJournalStatistics() {
viewModel.getJournalStatistics();
viewModel.getJournalStatistics(journalStatisticsButton);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.jabref.gui.fieldeditors;

import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

import org.controlsfx.control.PopOver;

public class JournalEditorPopOver {

public void openPopOver(Button journalStatisticsButton) {

Label text1 = new Label("This is a text field");
Label text2 = new Label("This is another textfield");
Label text3 = new Label("Lorem ipsum dolor sit amet");
VBox vBox = new VBox(text1, text2, text3);
PopOver popOver = new PopOver(vBox);

popOver.setArrowLocation(PopOver.ArrowLocation.BOTTOM_CENTER);

popOver.show(journalStatisticsButton, 0);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Optional;

import javafx.scene.control.Button;

import org.jabref.gui.autocompleter.SuggestionProvider;
import org.jabref.logic.integrity.FieldCheckers;
import org.jabref.logic.journals.JournalAbbreviationRepository;
Expand Down Expand Up @@ -33,7 +35,9 @@ public void toggleAbbreviation() {
}
}

public void getJournalStatistics() {
System.out.println("hello world");
public void getJournalStatistics(Button journalStatisticsButton) {
JournalEditorPopOver popOver = new JournalEditorPopOver();
popOver.openPopOver(journalStatisticsButton);

}
}

0 comments on commit 0a2857d

Please sign in to comment.