Search in sources :

Example 6 with NonNull

use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.

the class MxlPageMargins method read.

@NonNull
public static MxlPageMargins read(XmlReader reader) {
    // read attributes first, before moving forward to child elements
    MxlMarginType type = MxlMarginType.read(reader);
    // read child elements
    MxlAllMargins value = MxlAllMargins.read(reader);
    return new MxlPageMargins(value, type);
}
Also used : MxlMarginType(com.xenoage.zong.musicxml.types.enums.MxlMarginType) MxlAllMargins(com.xenoage.zong.musicxml.types.groups.MxlAllMargins) NonNull(com.xenoage.utils.annotations.NonNull)

Example 7 with NonNull

use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.

the class MxlPartGroup method read.

@NonNull
public static MxlPartGroup read(XmlReader reader) {
    // attributes
    MxlStartStop type = MxlStartStop.read(reader.getAttributeNotNull("type"));
    String number = notNull(reader.getAttribute("number"), defaultNumber);
    // elements
    String groupName = null;
    String groupAbbreviation = null;
    MxlGroupSymbol groupSymbol = null;
    MxlGroupBarline groupBarline = null;
    while (reader.openNextChildElement()) {
        String n = reader.getElementName();
        switch(n) {
            case "group-name":
                groupName = reader.getTextNotNull();
                break;
            case "group-abbreviation":
                groupAbbreviation = reader.getTextNotNull();
                break;
            case "group-symbol":
                groupSymbol = MxlGroupSymbol.read(reader);
                break;
            case "group-barline":
                groupBarline = MxlGroupBarline.read(reader);
                break;
        }
        reader.closeElement();
    }
    return new MxlPartGroup(groupName, groupAbbreviation, groupSymbol, groupBarline, type, number);
}
Also used : MxlStartStop(com.xenoage.zong.musicxml.types.enums.MxlStartStop) NonNull(com.xenoage.utils.annotations.NonNull)

Example 8 with NonNull

use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.

the class MxlCredit method read.

@NonNull
public static MxlCredit read(XmlReader reader) {
    int page = notNull(reader.getAttributeInt("page"), defaultPage);
    MxlCreditContent content = null;
    while (reader.openNextChildElement()) {
        String n = reader.getElementName();
        if (n.equals("credit-image")) {
            content = MxlImage.read(reader);
            reader.closeElement();
            break;
        } else if (n.equals(MxlCreditWords.elemName)) {
            content = MxlCreditWords.read(reader);
            // element is already closed at this point
            break;
        }
        reader.closeElement();
    }
    if (content == null)
        throw reader.dataException("empty " + elemName);
    return new MxlCredit(content, page);
}
Also used : MxlCreditContent(com.xenoage.zong.musicxml.types.choice.MxlCreditContent) NonNull(com.xenoage.utils.annotations.NonNull)

Example 9 with NonNull

use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.

the class MxlScorePartwise method read.

@NonNull
public static MxlScorePartwise read(XmlReader reader, ErrorHandler errorHandler) {
    // attributes
    String version = notNull(reader.getAttribute("version"), defaultVersion);
    // elements
    MxlScoreHeader scoreHeader = new MxlScoreHeader();
    List<MxlPart> parts = alist();
    while (reader.openNextChildElement()) {
        if (reader.getElementName().equals(MxlPart.elemName))
            parts.add(MxlPart.read(reader));
        else
            scoreHeader.readElement(reader, errorHandler);
        reader.closeElement();
    }
    scoreHeader.check(reader);
    if (parts.size() < 1)
        throw reader.dataException("no parts found");
    return new MxlScorePartwise(scoreHeader, parts, version);
}
Also used : MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) MxlScoreHeader(com.xenoage.zong.musicxml.types.groups.MxlScoreHeader) NonNull(com.xenoage.utils.annotations.NonNull)

Example 10 with NonNull

use of com.xenoage.utils.annotations.NonNull in project Zong by Xenoage.

the class ScoreFormatReader method read.

@NonNull
public ScoreFormat read() {
    scoreFormat = new ScoreFormat();
    if (mxlDefaults != null) {
        readInterlineSpace();
        mxlLayout = mxlDefaults.getLayout();
        if (mxlLayout != null) {
            readSystemLayout();
            readStaffLayouts();
        }
        readLyricsFont();
    }
    return scoreFormat;
}
Also used : ScoreFormat(com.xenoage.zong.core.format.ScoreFormat) NonNull(com.xenoage.utils.annotations.NonNull)

Aggregations

NonNull (com.xenoage.utils.annotations.NonNull)20 MxlColor (com.xenoage.zong.musicxml.types.attributes.MxlColor)4 MxlPrintStyle (com.xenoage.zong.musicxml.types.attributes.MxlPrintStyle)4 MxlPosition (com.xenoage.zong.musicxml.types.attributes.MxlPosition)2 MxlEditorialVoice (com.xenoage.zong.musicxml.types.groups.MxlEditorialVoice)2 Color (com.xenoage.utils.color.Color)1 FontInfo (com.xenoage.utils.font.FontInfo)1 Size2f (com.xenoage.utils.math.geom.Size2f)1 XmlReader (com.xenoage.utils.xml.XmlReader)1 ScoreFormat (com.xenoage.zong.core.format.ScoreFormat)1 FormattedTextStyle (com.xenoage.zong.core.text.FormattedTextStyle)1 MxlCreditContent (com.xenoage.zong.musicxml.types.choice.MxlCreditContent)1 MxlAccidentalText (com.xenoage.zong.musicxml.types.enums.MxlAccidentalText)1 MxlBarStyle (com.xenoage.zong.musicxml.types.enums.MxlBarStyle)1 MxlBeamValue (com.xenoage.zong.musicxml.types.enums.MxlBeamValue)1 MxlGroupBarlineValue (com.xenoage.zong.musicxml.types.enums.MxlGroupBarlineValue)1 MxlGroupSymbolValue (com.xenoage.zong.musicxml.types.enums.MxlGroupSymbolValue)1 MxlLeftCenterRight (com.xenoage.zong.musicxml.types.enums.MxlLeftCenterRight)1 MxlMarginType (com.xenoage.zong.musicxml.types.enums.MxlMarginType)1 MxlNoteTypeValue (com.xenoage.zong.musicxml.types.enums.MxlNoteTypeValue)1