Verified Owner
Top Description Inners Fields Constructors Methods
org.jabref.logic.openoffice.style

public Class JStyle

extends Object
implements Comparable<JStyle>, OOStyle
Class Inheritance
All Implemented Interfaces
org.jabref.logic.openoffice.style.OOStyle, java.lang.Comparable
Annotations
@AllowedToUseClassGetResource:Required for jstyle loading
Imports
java.io.IOException, .InputStream, .InputStreamReader, .Reader, java.nio.charset.StandardCharsets, java.nio.file.Files, .Path, java.util.Collections, .HashMap, .List, .Map, .Objects, .Optional, .Set, .SortedSet, .TreeSet, java.util.regex.Pattern, org.jabref.architecture.AllowedToUseClassGetResource, org.jabref.logic.journals.JournalAbbreviationRepository, org.jabref.logic.layout.Layout, .LayoutFormatter, .LayoutFormatterPreferences, .LayoutHelper, org.jabref.model.entry.field.FieldFactory, .OrFields, .StandardField, org.jabref.model.entry.types.EntryType, .EntryTypeFactory, org.jabref.model.openoffice.ootext.OOFormat, .OOText, org.jabref.model.openoffice.style.CitationMarkerEntry, .CitationMarkerNormEntry, .CitationMarkerNumericBibEntry, .CitationMarkerNumericEntry, .CitationType, .NonUniqueCitationMarker, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

This class embodies a bibliography formatting for OpenOffice, which is composed of the following elements:
  1. Each OO BIB entry type must have a formatting. A formatting is an array of elements, each of which is either a piece of constant text, an entry field value, or a tab. Each element has a character format associated with it.

  2. Many field values (e.g. author) need to be formatted before input to OpenOffice. The style has the responsibility of formatting all field values. Formatting is handled by 0-n JabRef LayoutFormatter classes.

  3. If the entries are not numbered, a citation marker must be produced for each entry. This operation is performed for each JabRef BibEntry.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final JournalAbbreviationRepository
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private final Map<EntryType, Layout>
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private final Map<String, Object>
private static final String
private Layout
public static final String
private final LayoutFormatter
private static final String
private boolean
fromResource

Flag indicating whether this style is loaded from internal resources (true) or from an external file (false).

private static final String
private static final String
private static final String
private static final String
private boolean
private static final String
public static final String
private final SortedSet<String>
private static final String
private static final String
private final LayoutFormatterPreferences
private String
private static final Logger
private static final String
public static final String
public static final String
public static final String
private String
private static final String
private static final Pattern
private static final String
private static final String
private final String
path

Path used to identify the style file.

private final Map<String, Object>
private static final String
private static final Pattern
public static final String
public static final String
private static final String
private static final String
private final Path
styleFile

Reference to the style file on the filesystem.

private long
private static final String
private static final String
public static final String
public static final String
private static final String
private boolean
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public
JStyle(@NonNull Path styleFile, @NonNull LayoutFormatterPreferences layoutPreferences, JournalAbbreviationRepository abbreviationRepository)

public
JStyle(@NonNull String resourcePath, @NonNull LayoutFormatterPreferences layoutPreferences, JournalAbbreviationRepository abbreviationRepository)

Method Summary

Modifier and TypeMethod and Description
protected void
addJournal(String journalName)

public int
compareTo(JStyle other)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public OOText

Returns:

The formatted citation. The result does not include the standard wrappers: OOFormat.setLocaleNone() and OOFormat.setCharStyle(). These are added by decorateCitationMarker()
createCitationMarker
(List<CitationMarkerEntry>
The list of entries providing the data.
citationMarkerEntries
,
boolean
Signals whether a parenthesized citation or an in-text citation is wanted.
inParenthesis
,
NonUniqueCitationMarker
THROWS : Should throw if finds that uniqueLetters provided do not make the entries unique.
nonUniqueCitationMarkerHandling
)

Format the marker for the in-text citation according to this BIB style.

public OOText
createCitationMarker(List<CitationMarkerEntry> citationMarkerEntries, CitationType citationType, NonUniqueCitationMarker nonUniqueCitationMarkerHandling)

As createCitationMarker(List, boolean, NonUniqueCitationMarker), but takes the presentation from the citation type of the group, so that the partial and bracket-less citation types of https://github.com/JabRef/jabref/issues/7861 are handled as well.

public OOText
decorateCitationMarker(OOText citationText)

Add setLocaleNone and optionally setCharStyle(CitationCharacterFormat) around citationText.

public void
ensureUpToDate()

If this style was initialized from a file on disk, reload the style if the file has been modified since it was read.

public boolean
equals(Object object)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

protected OrFields
getAuthorFieldNames()

Returns: Names of fields containing authors: the first non-empty field will be used.

protected String
protected String
public String
public String
public String
public String
getAuthorNamesListMarkupBefore()

Author list, excluding " et al."

protected String
getAuthorSeparator()

The String to add between author names except the last two: "[Smith{, }Jones and Brown]"

public String
public String
getAuthorsPartMarkupBefore()

Author list, including " et al."

protected Map<EntryType, Layout>
public boolean

Returns:

the value
getBooleanCitProperty
(String
The property key
key
)

Get boolean property.

protected String
getBracketAfter()

Closing parenthesis after citation

private String
getBracketAfterInList()

Closing parenthesis after citation marker in the bibliography

pack-priv String
protected String
getBracketBefore()

Opening parenthesis before citation (or year, for in-text)

private String
getBracketBeforeInList()

Opening parenthesis before citation marker in the bibliography.

public String
public String
public String
public String
getCitationGroupMarkupBefore()

Should citation markers be italicized?

protected String
protected Map<String, Object>
public Layout
public String
getEtAlString()

The String to represent authors that are not mentioned, e.g. " et al."

protected LayoutFormatter
public Path
public OOText
public String
getGroupedNumbersSeparator()

Used in number ranges like "10-13" in numbered citations.

public int
protected boolean
public boolean
public Set<String>
protected LayoutFormatterPreferences
public String
protected int
getMaxAuthors()

The maximum number of authors to write out in full without using "et al." Set to -1 to always write out all authors.

public int
public int
getMinimumGroupingCount()

Minimal number of consecutive citation numbers needed to start replacing with an range like "10-13".

public boolean
public String
public OOText
public OOText

Returns:

The text for the citation.
getNumCitationMarker2
(List<CitationMarkerNumericEntry> entries)

Format a number-based citation marker for the given entries.

public OOText
getNumCitationMarker2(List<CitationMarkerNumericEntry> entries, int minGroupingCount)

For some tests we need to override minGroupingCount.

public OOText
getNumCitationMarkerForBibliography(CitationMarkerNumericBibEntry entry)

Format a number-based bibliography label for the given number.

protected String
getOxfordComma()

The String to put after the second to last author in case of three or more authors: (A, B{,} and C)

protected String
public String
protected Map<String, Object>
public Object

Returns:

The property value, or null if it doesn't exist.
getProperty
(String
The property name.
propName
)

Get a style property.

public Layout
public String
getReferenceHeaderParagraphFormat()

Name of paragraph format (within OO/LO) to be used for the title of the bibliography.

public OOText
getReferenceHeaderText()

Title for the bibliography.

public String
getReferenceParagraphFormat()

Name of paragraph format (within OO/LO) to be used for the entries in the bibliography.

public String
private String
protected String
protected OrFields
getYearFieldNames()

Returns: Field containing year, with fallback fields.

protected String
protected String
private void
handleJournalsLine(String line)

Parse a line providing a journal name for which this style is valid.

private void
handlePropertiesLine(String
The line containing the formatter names.
line
,
Map<String, Object> map)

Parse a line providing a property name and value.

private void
handleStructureLine(String
The string containing the structure description.
line
)

Parse a line providing bibliography structure information for an entry type.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private void
public boolean

Returns:

true to indicate that citations should be in bold.
isBoldCitations
()

Convenience method for checking whether citation markers should be bold.

public boolean
public boolean

Returns:

true to indicate that citations should be in italics.
isFormatCitations
()

Convenience method for checking whether citation markers formatted according to the results of the isItalicCitations() and isBoldCitations() methods.

public boolean

Returns:

True if an internal style
isInternalStyle
()

Implements org.jabref.logic.openoffice.style.OOStyle.isInternalStyle.

Indicate if it is an internal style

public boolean

Returns:

true to indicate that citations should be in italics.
isItalicCitations
()

Convenience method for checking whether citation markers should be italicized.

public boolean

Returns:

true if we use numbered citations, false otherwise.
isNumberEntries
()

Convenience method for checking the property for whether we use number citations or author-year citations.

public boolean

Returns:

true to sort by appearance, false to sort alphabetically.
isSortByPosition
()

Convenience method for checking the property for whether we sort the bibliography according to their order of appearance in the text.

private boolean

Returns:

true if the file has not been modified, false otherwise.
isUpToDate
()

If this style was initialized from a file on disk, check whether the file is unmodified since initialization.

public boolean

Returns:

true if the file could be parsed as a style file, false otherwise.
isValid
()

After initializing this style from a file, this method can be used to check whether the file appeared to be a proper style file.

private void
private void
reload()

If this style was initialized from a file on disk, reload the style information.

protected void
private void
protected void
setIsDefaultLayoutPresent(boolean isPresent)

protected void
setLocalCopy(String contentsOfJstyleFile)

protected void
setName(String nameOfTheStyle)

protected void
setValid(boolean isValid)

public boolean
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait