Package info.textgrid.lab.noteeditor.model

Examples of info.textgrid.lab.noteeditor.model.StaffForm


        measureNode.getAnnotsAndSlursAndTupletSpen().add(
            handleScoreChild(measureChildForm, saveAllVariants));
      }
      return measureNode;
    } else if (childForm instanceof StaffForm) {
      StaffForm contentForm = (StaffForm) childForm;
      Staff contentNode = (Staff) contentForm.getMeiNode();
      contentNode.getSbsAndSymbolsAndOrigs().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getSbsAndSymbolsAndOrigs().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof AppForm) {
      AppForm contentForm = (AppForm) childForm;
      App contentNode = (App) contentForm.getMeiNode();
      contentNode.getRdgs().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getRdgs().add(
            (Rdg) handleScoreChild(contentChildForm,
                saveAllVariants));
      }
      if (contentNode.isSetRdgs() && contentNode.getRdgs().isEmpty())
        contentNode.unsetRdgs();
      if (contentNode.isSetN() && contentNode.getN().isEmpty())
        contentNode.setN(null);
      if (!saveAllVariants) {
        for (BasicElement contentChildForm : contentForm.getChildren()) {
          if(contentChildForm instanceof ReadingForm && ((ReadingForm)contentChildForm).isActive() ) {
            MeiNode parentMeiNode = contentForm.getParent().getMeiNode();
            for(BasicElement grandChild : ((ReadingForm)contentChildForm).getChildren()){
              MeiNodeNavigator.addMeiNodeAsChild(parentMeiNode, grandChild.getMeiNode());
            }           
          }
        }
        return null;

      }
      return contentNode;
    } else if (childForm instanceof ReadingForm) {
      Rdg contentNode;
      ReadingForm contentForm = (ReadingForm) childForm;
      if (!saveAllVariants && !contentForm.isActive()) {
        // ignore this very reading
        return null;
      }
      contentNode = (Rdg) contentForm.getMeiNode();
      contentNode.getSources().clear();
      for (SourceBindingWrapper sbw : contentForm
          .getSourceBindingWrappers()) { // insert the wrapped sources
        contentNode.getSources().add(sbw.getSource().getId());
      }
      if (contentNode.getSources().isEmpty())
        contentNode.unsetSources();
      contentNode.getMRestsAndKeySigsAndProports().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getMRestsAndKeySigsAndProports().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof LayerForm) {
      LayerForm contentForm = (LayerForm) childForm;
      Layer contentNode = (Layer) contentForm.getMeiNode();
      contentNode.getBarLinesAndSyllablesAndGaps().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getBarLinesAndSyllablesAndGaps().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof ChordGroupForm) {
      ChordGroupForm contentForm = (ChordGroupForm) childForm;
      Chord contentNode = (Chord) contentForm.getMeiNode();
      contentNode.getRestoresAndArticsAndUnclears().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getRestoresAndArticsAndUnclears().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      if(contentNode.getArtics().isEmpty()) {
        contentNode.unsetArtics();
      }
      return contentNode;
    } else if (childForm instanceof BeamGroupForm) {
      BeamGroupForm contentForm = (BeamGroupForm) childForm;
      Beam contentNode = (Beam) contentForm.getMeiNode();
      contentNode.getFTremsAndChordsAndDamages().clear();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getFTremsAndChordsAndDamages().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof NoteForm) {
      NoteForm contentForm = (NoteForm) childForm;
      Note contentNode = (Note) contentForm.getMeiNode();
      if (contentNode.getArtics().isEmpty())
        contentNode.unsetArtics();
      return contentNode;
    } else if (childForm instanceof RestForm) {
      RestForm contentForm = (RestForm) childForm;
      Rest contentNode = (Rest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof MRestForm) {
      MRestForm contentForm = (MRestForm) childForm;
      MRest contentNode = (MRest) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SpaceForm) {
      SpaceForm contentForm = (SpaceForm) childForm;
      Space contentNode = (Space) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof DynamForm) {
      DynamForm contentForm = (DynamForm) childForm;
      Dynam contentNode = (Dynam) contentForm.getMeiNode();
      for (BasicElement contentChildForm : contentForm.getChildren()) {
        contentNode.getContent().add(
            handleScoreChild(contentChildForm, saveAllVariants));
      }
      return contentNode;
    } else if (childForm instanceof TieForm) {
      TieForm contentForm = (TieForm) childForm;
      Tie contentNode = (Tie) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof SlurForm) {
      SlurForm contentForm = (SlurForm) childForm;
      Slur contentNode = (Slur) contentForm.getMeiNode();
      return contentNode;
    } else if (childForm instanceof FermataForm) {
      FermataForm contentForm = (FermataForm) childForm;
      Fermata contentNode = (Fermata) contentForm.getMeiNode();
      return contentNode;
    } else {
      // write back a node of a currently unknown type
      UnknownMeiNodeForm contentForm = (UnknownMeiNodeForm) childForm;
      return contentForm.getMeiNode();
    }
  }
View Full Code Here


   * insert staffdefs
   */
  private void massInsertStaffdefs() {
    MusicContainerForm rootForm;
    MusicContainerForm staffDefForm;
    StaffForm staffForm;
    StaffDef staffDefMeiNode;
    if (contentWrapper.isStaffDefsCreateNewStaffGroup()) {
      // create new section and set it as new parent
      rootForm = (MusicContainerForm) MusicPlugin.getDefault().getActiveDiagram()
          .getScoreDefForm().getChildren().get(0);
      MusicContainerForm groupForm = new StaffGroupForm();
      insertCompoundCommand(rootForm, groupForm);
      rootForm = groupForm;
    } else {
      rootForm = (MusicContainerForm) MusicPlugin.getDefault()
          .getActiveDiagram().getScoreDefForm().getChildren().get(0);
    }
    for (InsertStaffDefsDialogEntryWrapper newEntry : entryList) {
      staffDefForm = new StaffDefForm();
      staffDefMeiNode = (StaffDef) staffDefForm.getMeiNode();
      staffDefMeiNode.setClefShape(newEntry.getClefShape());
      staffDefMeiNode.setKeySigValue(newEntry.getKeySigValue());
      staffDefMeiNode.setMeterCount(newEntry
          .getMeterCount());
      staffDefMeiNode
          .setMeterUnit(new BigDecimal(newEntry.getMeterUnit()));
      insertCompoundCommand(rootForm, staffDefForm);
    }
    if (contentWrapper.isStaffDefsFillMeasuresWithStaffs()) {
      for(BasicElement child : MeiNodeNavigator
          .findActiveDescendantForm(
              MeasureForm.class,
              MusicPlugin.getDefault().getActiveDiagram())) {
        staffForm = new StaffForm();
        insertCompoundCommand((MusicContainerForm) child,
            staffForm);
        insertCompoundCommand(staffForm, new LayerForm());
      }
    }
View Full Code Here

      insertCompoundCommand(rootForm, measureForm);
      if (wrapper.isMeasuresMeasureContainsStaffsAndLayers()) {
        for (int staffIter = 0; staffIter < MeiNodeNavigator.findActiveDescendantForm(StaffDefForm.class, MusicPlugin.getDefault()
            .getActiveDiagram().getScoreDefForm())
            .size(); staffIter++) {
          singleStaff = new StaffForm();
          insertCompoundCommand(measureForm, singleStaff);
          insertCompoundCommand(singleStaff, new LayerForm());
        }
      }
    }
View Full Code Here

    return appForm;
  }

  private static BasicElement handleMeasureStaff(Staff staff,
      BasicElement parentForm) {
    StaffForm staffForm = new StaffForm();
    staffForm.setParent(parentForm);
    staffForm.setMeiNode(staff);
    for (MeiNode child : staff.getSbsAndSymbolsAndOrigs()) {
      BasicElement handleMeasureContent = handleMeiElement(child,
          staffForm);
      if (handleMeasureContent != null)
        staffForm.addChild(handleMeasureContent);
    }
    return staffForm;
  }
View Full Code Here

    return candidate.equals(StaffForm.class);
  }

  @Override
  public void run() {
    this.child = new StaffForm();
    super.run();
  }
View Full Code Here

TOP

Related Classes of info.textgrid.lab.noteeditor.model.StaffForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.