Changeset 912

Show
Ignore:
Timestamp:
10/18/06 00:40:54 (2 years ago)
Author:
alban
Message:

[Bug 147] add resources support for setup wizard and use setup icon

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/source/org/kolaka/freecast/setup/Main.java

    r909 r912  
    4545  private SourceReceiverConfiguration receiverConfiguration; 
    4646  private final ReceiverConfigurationLoader receiverConfigurationLoader = new ReceiverConfigurationLoader(); 
     47  private Resources resources; 
    4748 
    4849  public Main() { 
     
    5455    receiverConfiguration = loadReceiverConfiguration(configuration); 
    5556 
    56     Resources resources = new ConfigurableResources(Configurations.subset(configuration, "gui.setup")); 
     57    resources = new ConfigurableResources(Configurations.subset(configuration, "gui.setup")); 
    5758  } 
    5859 
     
    7576 
    7677  protected void run() throws Exception { 
    77     final ReceiverWizardModel model = new ReceiverWizardModel(); 
     78    final ReceiverWizardModel model = new ReceiverWizardModel(resources); 
    7879    model.setReceiverConfiguration(receiverConfiguration); 
    7980 
  • trunk/source/org/kolaka/freecast/setup/ReceiverConfigurationWizardStep.java

    r883 r912  
    2525 
    2626import java.awt.GridBagConstraints; 
    27 import java.awt.GridBagLayout; 
    2827import java.awt.Insets; 
    29 import java.util.ResourceBundle; 
    3028 
    3129import javax.swing.JComponent; 
    3230import javax.swing.JLabel; 
    3331 
    34 import org.kolaka.freecast.swing.ResourceBundles; 
     32import org.kolaka.freecast.swing.Resources; 
    3533import org.kolaka.freecast.transport.receiver.ReceiverConfiguration; 
    3634import org.pietschy.wizard.InvalidStateException; 
    37 import org.pietschy.wizard.PanelWizardStep; 
    38 import org.pietschy.wizard.WizardModel; 
    3935 
    40 public abstract class ReceiverWizardStep extends PanelWizardStep { 
     36public abstract class ReceiverConfigurationWizardStep extends ReceiverWizardStep { 
    4137 
    42   private final ResourceBundle bundle = ResourceBundles.getBundle(getClass()); 
    43    
    44   protected ReceiverWizardModel model; 
    45  
    46   protected ReceiverWizardStep() { 
    47     super("Setup Broadcast content", ""); 
    48     setSummary(bundle.getString("summary")); 
    49     setLayout(new GridBagLayout()); 
     38  protected ReceiverConfigurationWizardStep(Resources resources) { 
     39    super(resources); 
    5040     
    5141    GridBagConstraints textConstraints = createConstraints(); 
    5242    textConstraints.gridwidth = GridBagConstraints.REMAINDER; 
    5343    textConstraints.insets = new Insets(15, 0, 15, 0); 
    54     add(new JLabel(bundle.getString("explanation")), textConstraints); 
     44    add(new JLabel(getBundle().getString("explanation")), textConstraints); 
    5545     
    5646    GridBagConstraints viewConstraints = createConstraints(); 
     
    6151  } 
    6252   
    63   protected ResourceBundle getBundle() { 
    64     return bundle; 
    65   } 
    66  
    6753  protected abstract JComponent createView(); 
    6854 
    69   /** 
    70    * @return 
    71    */ 
    72   protected GridBagConstraints createConstraints() { 
    73     return new GridBagConstraints(); 
    74   } 
    75  
    76   public void init(WizardModel model) { 
    77     this.model = (ReceiverWizardModel) model; 
    78   } 
    79    
    8055  public void prepare() { 
    8156    ReceiverConfiguration configuration = model.getConfiguration(); 
  • trunk/source/org/kolaka/freecast/setup/ReceiverPlaylistStep.java

    r883 r912  
    3939 
    4040import org.kolaka.freecast.swing.BaseAction; 
     41import org.kolaka.freecast.swing.Resources; 
    4142import org.kolaka.freecast.transport.receiver.PlaylistEncoderReceiverConfiguration; 
    4243import org.kolaka.freecast.transport.receiver.ReceiverConfiguration; 
    4344import org.pietschy.wizard.InvalidStateException; 
    4445 
    45 public class ReceiverPlaylistStep extends ReceiverWizardStep { 
     46public class ReceiverPlaylistStep extends ReceiverConfigurationWizardStep { 
     47 
     48  public ReceiverPlaylistStep(Resources resources) { 
     49    super(resources); 
     50  } 
    4651 
    4752  private static final long serialVersionUID = -7503124420884640976L; 
  • trunk/source/org/kolaka/freecast/setup/ReceiverShoutClientStep.java

    r883 r912  
    3333import javax.swing.JPanel; 
    3434 
     35import org.kolaka.freecast.swing.Resources; 
    3536import org.kolaka.freecast.transport.receiver.ReceiverConfiguration; 
    3637import org.kolaka.freecast.transport.receiver.ShoutClientReceiverConfiguration; 
    3738import org.pietschy.wizard.InvalidStateException; 
    3839 
    39 public class ReceiverShoutClientStep extends ReceiverWizardStep { 
     40public class ReceiverShoutClientStep extends ReceiverConfigurationWizardStep { 
     41 
     42  public ReceiverShoutClientStep(Resources resources) { 
     43    super(resources); 
     44  } 
    4045 
    4146  private static final long serialVersionUID = -7503124420884640976L; 
  • trunk/source/org/kolaka/freecast/setup/ReceiverShoutServerStep.java

    r883 r912  
    3535import javax.swing.text.NumberFormatter; 
    3636 
     37import org.kolaka.freecast.swing.Resources; 
    3738import org.kolaka.freecast.transport.receiver.ReceiverConfiguration; 
    3839import org.kolaka.freecast.transport.receiver.ShoutServerReceiverConfiguration; 
    3940import org.pietschy.wizard.InvalidStateException; 
    4041 
    41 public class ReceiverShoutServerStep extends ReceiverWizardStep { 
     42public class ReceiverShoutServerStep extends ReceiverConfigurationWizardStep { 
     43 
     44  protected ReceiverShoutServerStep(Resources resources) { 
     45    super(resources); 
     46  } 
    4247 
    4348  private static final long serialVersionUID = -7503124420884640976L; 
  • trunk/source/org/kolaka/freecast/setup/ReceiverShowStep.java

    r883 r912  
    2424package org.kolaka.freecast.setup; 
    2525 
    26 import org.pietschy.wizard.PanelWizardStep; 
    27 import org.pietschy.wizard.WizardModel; 
     26import org.kolaka.freecast.swing.Resources; 
    2827 
    29 public class ReceiverShowStep extends PanelWizardStep { 
     28public class ReceiverShowStep extends ReceiverWizardStep { 
    3029   
    3130  private static final long serialVersionUID = 4158908758209666698L; 
    3231 
    33   public ReceiverShowStep() { 
    34     super("Broadcast content", "Confirm the configuration"); 
     32  public ReceiverShowStep(Resources resources) { 
     33    super(resources); 
     34     
    3535    // setLayout(new GridBagLayout()); 
    3636    setComplete(true); 
     
    3939  } 
    4040   
    41   private ReceiverWizardModel model; 
    4241  private ReceiverShowPanel panel; 
    43  
    44   public void init(WizardModel model) { 
    45     this.model = (ReceiverWizardModel) model; 
    46   } 
    4742 
    4843  public void prepare() { 
  • trunk/source/org/kolaka/freecast/setup/ReceiverTypeStep.java

    r909 r912  
    2525 
    2626import java.awt.GridBagConstraints; 
    27 import java.awt.GridBagLayout; 
    2827import java.awt.Insets; 
    2928import java.awt.event.ItemEvent; 
    3029import java.awt.event.ItemListener; 
    3130import java.util.Map; 
    32 import java.util.ResourceBundle; 
    3331import java.util.TreeMap; 
    3432 
     
    3735 
    3836import org.apache.commons.logging.LogFactory; 
    39 import org.kolaka.freecast.swing.ResourceBundles; 
     37import org.kolaka.freecast.swing.Resources; 
    4038import org.pietschy.wizard.InvalidStateException; 
    41 import org.pietschy.wizard.PanelWizardStep; 
    4239import org.pietschy.wizard.WizardModel; 
    4340 
    44 public class ReceiverTypeStep extends PanelWizardStep { 
     41public class ReceiverTypeStep extends ReceiverWizardStep { 
    4542 
    4643  private static final long serialVersionUID = 3952637776668476330L; 
    4744   
    48   private ResourceBundle bundle = ResourceBundles.getBundle(getClass()); 
    49  
    5045  private static String[] TYPES = new String[] { 
    5146    ReceiverWizardModel.TYPE_DEFAULT, ReceiverWizardModel.TYPE_PLAYLIST, 
     
    5651  private Map buttons = new TreeMap(); 
    5752 
    58   public ReceiverTypeStep() { 
    59     super("Setup Broadcast content",""); 
    60     setSummary(bundle.getString("summary")); 
    61     setLayout(new GridBagLayout()); 
     53  public ReceiverTypeStep(Resources resources) { 
     54    super(resources); 
    6255 
    6356    GridBagConstraints constraints = new GridBagConstraints(); 
     
    7164      final String type = TYPES[i]; 
    7265 
    73       final JRadioButton button = new JRadioButton(bundle.getString(type)); 
     66      final JRadioButton button = new JRadioButton(getBundle().getString(type)); 
    7467      buttons.put(type, button); 
    7568      button.addItemListener(new ItemListener() { 
  • trunk/source/org/kolaka/freecast/setup/ReceiverWizardModel.java

    r910 r912  
    3131import org.apache.commons.collections.MapUtils; 
    3232import org.apache.commons.logging.LogFactory; 
     33import org.kolaka.freecast.swing.Resources; 
    3334import org.kolaka.freecast.transport.receiver.PlaylistEncoderReceiverConfiguration; 
    3435import org.kolaka.freecast.transport.receiver.ReceiverConfiguration; 
     
    6465    ) ; 
    6566   
    66   public ReceiverWizardModel() { 
    67     super(createPath()); 
     67  public ReceiverWizardModel(Resources resources) { 
     68    super(createPath(resources)); 
    6869  } 
    6970 
    70   private static Path createPath() { 
     71  private static Path createPath(Resources resources) { 
    7172    BranchingPath path = new BranchingPath(); 
    72     path.addStep(new ReceiverTypeStep()); 
     73    path.addStep(new ReceiverTypeStep(resources)); 
    7374     
    74     Path finalStep = new SimplePath(new ReceiverShowStep()); 
     75    Path finalStep = new SimplePath(new ReceiverShowStep(resources)); 
    7576     
    7677    path.addBranch(finalStep, new ConfigurationClassCondition(TestReceiverConfiguration.class)); 
    7778     
    78     SimplePath playlistPath = new SimplePath(new ReceiverPlaylistStep()); 
     79    SimplePath playlistPath = new SimplePath(new ReceiverPlaylistStep(resources)); 
    7980    path.addBranch(playlistPath, new ConfigurationClassCondition(PlaylistEncoderReceiverConfiguration.class)); 
    8081    playlistPath.setNextPath(finalStep); 
    8182 
    82     SimplePath shoutServerPath = new SimplePath(new ReceiverShoutServerStep()); 
     83    SimplePath shoutServerPath = new SimplePath(new ReceiverShoutServerStep(resources)); 
    8384    path.addBranch(shoutServerPath, new ConfigurationClassCondition(ShoutServerReceiverConfiguration.class)); 
    8485    shoutServerPath.setNextPath(finalStep); 
    8586 
    86     SimplePath shoutClientPath = new SimplePath(new ReceiverShoutClientStep()); 
     87    SimplePath shoutClientPath = new SimplePath(new ReceiverShoutClientStep(resources)); 
    8788    path.addBranch(shoutClientPath, new ConfigurationClassCondition(ShoutClientReceiverConfiguration.class)); 
    8889    shoutClientPath.setNextPath(finalStep); 
  • trunk/source/org/kolaka/freecast/setup/SetupAction.java

    r908 r912  
    6464         
    6565        public void actionPerformed(ActionEvent event) { 
    66     final ReceiverWizardModel model = new ReceiverWizardModel(); 
     66    final ReceiverWizardModel model = new ReceiverWizardModel(resources); 
    6767     
    6868    SourceReceiverConfiguration configuration = (SourceReceiverConfiguration) node.getReceiverControler().getReceiverConfiguration(); 
  • trunk/source/org/kolaka/freecast/swing/ResourcesException.java

    r405 r912  
    2727 * @author <a href="mailto:alban.peignier@free.fr">Alban Peignier </a> 
    2828 */ 
    29 public class ResourcesException extends Exception { 
     29public class ResourcesException extends RuntimeException { 
    3030 
    3131        /**