Package jpianotrain.staff

Examples of jpianotrain.staff.TuneFactory


  }
 
// ApplicationContextListener
  public void modeChanged() {
    registerTuneFactory();
    TuneFactory tf=null;
    switch (ApplicationContext.getInstance().getMode()) {
    case MIDI_FILES :{
      throw new UnsupportedOperationException("mode is not implemented yet");
    }
    case RANDOM_NOTES:{
      tf=TuneFactory.getRandomFactory();
    }break;
    case LESSONS:{
      throw new UnsupportedOperationException("mode is not implemented yet");
    }
    }
    setLowest(tf.getLowerBoundBass());
    setHighest(tf.getUpperBoundTreble());
    setOctaveRange((getHighest()-getLowest())/12);
    initComponent();
    repaint();
  }
View Full Code Here


 
  private void registerTuneFactory() {
    if (oldFactory!=null) {
      oldFactory.removeListener(this);
    }
    TuneFactory tf=null;
    switch (ApplicationContext.getInstance().getMode()) {
    case MIDI_FILES :{
      throw new UnsupportedOperationException("mode is not implemented yet");
    }
    case RANDOM_NOTES:{
      tf=TuneFactory.getRandomFactory();
    }break;
    case LESSONS:{
      throw new UnsupportedOperationException("mode is not implemented yet");
    }
    }
    if (tf!=null) {
      tf.addListener(this);
      oldFactory=tf;
    }
  }
View Full Code Here

    confPanel.add(numberSpinner, gbc);
    return confPanel;
  }
  @Override
  public void initData() {
    TuneFactory rtf=TuneFactory.getRandomFactory();
    bothHandsCheck.setSelected(rtf.isBothHands());
    lowerBoundBass.setValue(rtf.getLowerBoundBass());
    upperBoundBass.setValue(rtf.getUpperBoundBass());
    lowerBoundTreble.setValue(rtf.getLowerBoundTreble());
    upperBoundTreble.setValue(rtf.getUpperBoundTreble());
   
    if (rtf.getLowerBoundBass()==0 && rtf.getLowerBoundTreble()==0 &&
        rtf.getUpperBoundBass()==0 && rtf.getUpperBoundTreble()==0) {
      lowerBoundBass.setValue(0);
      upperBoundBass.setValue(63);
      lowerBoundTreble.setValue(64);
      upperBoundTreble.setValue(127);
    }
    numberSpinner.setValue(rtf.getNoteCount());

    Scale s=rtf.getScale();
    if (s==null) {
      majorCheck.setSelected(true);
      for (NoteName nn:Scale.MAJOR_SCALES_CLASSIC_EN) {
        scaleBox.addItem(nn);
      }
View Full Code Here

   * ranges. Show error otherwise. Emit some signal so that
   * configuration dialog stays open.
   */
  @Override
  public void saveData() {
    TuneFactory rtf=TuneFactory.getRandomFactory();
    rtf.holdEvents();
    rtf.setBothHands(bothHandsCheck.isSelected());
    rtf.setLowerBoundBass((Integer)lowerBoundBass.getValue());
    rtf.setUpperBoundBass((Integer)upperBoundBass.getValue());
    rtf.setLowerBoundTreble((Integer)lowerBoundTreble.getValue());
    rtf.setUpperBoundTreble((Integer)upperBoundTreble.getValue());
    rtf.setNoteCount((Integer)numberSpinner.getValue());

    Scale s=new Scale((NoteName)scaleBox.getSelectedItem());
    rtf.setScale(s);
    rtf.flushEvents();
  }
View Full Code Here

    JOptionPane.showMessageDialog(ApplicationContext.getInstance().getDefaultDialogOwner(),
      ResourceFactory.getString(MESSAGE_OPERATION_NOT_SUPPORTED));
  }

  private void createForRandomNotes() {
    TuneFactory tf=TuneFactory.getRandomFactory();
    if (tf.getScale()==null) {
      JOptionPane.showMessageDialog(ApplicationContext.getInstance().getDefaultDialogOwner(),
        ResourceFactory.getString(MESSAGE_TUNE_FACTORY_BLANK),
        ResourceFactory.getString(TITLE_ERROR),
        JOptionPane.ERROR_MESSAGE);
    } else {
      tuneReceiver.setTune(tf.create());
    }
  }
View Full Code Here

TOP

Related Classes of jpianotrain.staff.TuneFactory

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.