001package ca.bc.webarts.tools;
002
003
004import ca.bc.webarts.widgets.ColouredLabel;
005import java.awt.Color;
006import java.awt.Font;
007import javax.swing.JComponent;
008import javax.swing.JFrame;
009import javax.swing.JPanel;
010import net.javaprog.ui.wizard.*;
011import net.javaprog.ui.wizard.plaf.*;
012
013
014/**
015 *  An Application class wizard to rename Ogg Vorbis files using the enclosed
016 *  Vorbis comments for Album Artist etc.
017 *
018 * @author    tgutwin
019 */
020public class VOggRenamer extends JFrame
021{
022  protected static Color back_ =  new Color( 210, 210, 210 );
023  protected static Color front_ =  new Color( 0,0,50 );
024
025
026  /**
027   *  Main entry Method for application.
028   *
029   * @param  arg  the args passed on the cmdline.
030   */
031  public static void main( String arg[] )
032  {
033
034    //create data model - use this in listener later on
035    DataModel data = new DataModel();
036    WizardModel model = new DefaultWizardModel( new Step[]{
037    //populate wizard model with custom steps
038        new DirectorySelectionStep(),
039        new RenamePatternStep(),
040        } );
041
042    Wizard wizard = new Wizard( model, "VOggRenamer" );
043    //show wizard
044    wizard.pack();
045    wizard.setLocationRelativeTo( null );
046    wizard.setVisible( true );
047  }
048
049
050  /**
051   *  A Step in the Wizard - the 1st page step.
052   *
053   * @author    tgutwin
054   */
055  static class DirectorySelectionStep extends AbstractStep
056  {
057    /**  Constructor for the DirectorySelection object */
058    public DirectorySelectionStep()
059    {
060      //pass step title and description
061      super( "Ogg Directories", "Welcome to the Ogg Vorbis file renamer." );
062    }
063
064
065    /**
066     *  Is called just before the component will be displayed. This enables the
067     *  step to adjust certain values according to the value of other steps.
068     */
069    public void prepareRendering()
070    {
071      //something to prepare
072    }
073
074
075    /**
076     *  Description of the Method
077     *
078     * @return    the JComponent /JPanel for this step
079     */
080    protected JComponent createComponent()
081    {
082      // Layout and return component shown to the user
083      JPanel stepComponent = new JPanel();
084      stepComponent.add(
085          new ColouredLabel( front_, back_,
086          "Welcome to Toms Ogg Vorbis file renamer." ) );
087      stepComponent.add(
088          new ColouredLabel(  new Color( 210, 210, 210 ), new Color( 0,0,50 ),
089          "This application will guide you through the \n<br>renaming of your Ogg Vorbis files based on the <br>Vorbis comments contained within those files." ) );
090      stepComponent.add(
091          new ColouredLabel( new Color( 210, 210, 210 ), new Color( 0,0,50 ),
092          "Please select the directory to search <br>for Ogg Vorbis files (*.ogg)" ) );
093      return stepComponent;
094    }
095  }
096
097
098    /**
099   *  A Step in the Wizard - the rename pattern step.
100   *
101   * @author    tgutwin
102   */
103  static class RenamePatternStep extends AbstractStep
104  {
105    /**  Constructor for the DirectorySelection object */
106    public RenamePatternStep()
107    {
108      //pass step title and description
109      super( "Rename Pattern", "Set up the file rename pattern" );
110    }
111
112
113    /**
114     *  Is called just before the component will be displayed. This enables the
115     *  step to adjust certain values according to the value of other steps.
116     */
117    public void prepareRendering()
118    {
119      //something to prepare
120    }
121
122
123    /**
124     *  Description of the Method
125     *
126     * @return    Description of the Return Value
127     */
128    protected JComponent createComponent()
129    {
130      // Layout and return component shown to the user
131      JPanel stepComponent = new JPanel();
132      stepComponent.add(
133          new ColouredLabel( new Color( 210, 210, 210 ), new Color( 0,0,50 ),
134          "Please specify the rename pattern." ) );
135      return stepComponent;
136    }
137  }
138
139}
140
141