Changeset 17516

Show
Ignore:
Timestamp:
10.10.2008 13:49:43 (11 years ago)
Author:
oranfry
Message:

made pages reinitialise just before they are shown and added an option to selectinput to change the locale, the end result of this being that you can change the language of the installer as it runs

Location:
release-kits/shared/ant-installer
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • release-kits/shared/ant-installer/src/org/tp23/antinstaller/input/SelectInput.java

    r17514 r17516  
    7070        } 
    7171        public String getText() { 
    72             if( org.tp23.antinstaller.Installer.langPack != null ){ 
    73                 return org.tp23.antinstaller.Installer.langPack.getString(getProperty() + "." + idx +".displayText"); 
     72            if( org.tp23.antinstaller.Installer.langPack != null ) { 
     73                String r = org.tp23.antinstaller.Installer.langPack.getString( getProperty() + "." + idx + ".displayText" ); 
     74                if ( r != null ) return r; 
    7475            } 
    7576            return text; 
     
    8182        if ( useAsLocale ) { 
    8283            //expect something like 'en' or or something like 'en_US' 
     84            Locale newLocale = null; 
    8385            if ( value.length() == 2 ) { 
    84                 Locale.setDefault( new Locale(value) ); 
     86                newLocale = new Locale(value); 
     87                Locale.setDefault( newLocale ); 
    8588            } else if ( value.length() == 5 ) { 
    86                 Locale.setDefault( new Locale(value.substring(0,2), value.substring(3,5)) ); 
     89                newLocale = new Locale(value.substring(0,2), value.substring(3,5)); 
     90                Locale.setDefault( newLocale ); 
    8791            } //else { you're out of luck } 
    88             org.tp23.antinstaller.Installer.langPack = ResourceBundle.getBundle("resources.LanguagePack"); 
     92            org.tp23.antinstaller.Installer.langPack = ResourceBundle.getBundle("resources.LanguagePack", newLocale ); 
    8993        } 
    9094    } 
  • release-kits/shared/ant-installer/src/org/tp23/antinstaller/renderer/swing/SimpleInputPageRenderer.java

    r15206 r17516  
    9999 
    100100    public void instanceInit() throws Exception { 
    101  
    102101        ToolTipManager.sharedInstance().setInitialDelay(0); 
    103102        ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE); 
    104  
    105  
    106103        overflow = ((SimpleInputPage)page).isOverflow(); 
    107104        if(overflow){ 
  • release-kits/shared/ant-installer/src/org/tp23/antinstaller/renderer/swing/SwingPageRenderer.java

    r17514 r17516  
    1717 
    1818import java.awt.BorderLayout; 
     19import java.awt.FlowLayout; 
    1920import java.awt.Color; 
    2021import java.awt.Dimension; 
     
    5354     
    5455    // holds the next back buttons etc 
    55     private JPanel controlPanel = new JPanel(); 
     56    private JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER,20,3)); 
    5657 
    5758    private JButton backButton = new JButton(); 
     
    107108    } 
    108109         
    109      
     110    public void reInit() { 
     111        backButton.setText(org.tp23.antinstaller.Installer.langPack.getString("backButton"));// "<< Back"); 
     112        cancelButton.setText(org.tp23.antinstaller.Installer.langPack.getString("cancelButton"));// "Cancel"); 
     113        nextButton.setText(org.tp23.antinstaller.Installer.langPack.getString("nextButton"));// "Next >>"); 
     114        finishButton.setText(ctx.getInstaller().getFinishButtonText()); 
     115        titleLabel.setText(page.getDisplayText()); 
     116    } 
     117 
    110118    private void jbInit() throws Exception { 
    111119         
  • release-kits/shared/ant-installer/src/org/tp23/antinstaller/runtime/SwingRunner.java

    r17514 r17516  
    272272        for (int i = 0; i < pages.length; i++) { 
    273273            SwingPageRenderer renderer = RendererFactory.getSwingPageRenderer(pages[i]); 
    274             if (i == 0) { 
    275                 renderer.getBackButton().setEnabled(false); 
    276             } 
     274            if (i == 0) renderer.getBackButton().setEnabled(false); 
    277275            renderer.setContext(swingCtx); 
    278276            renderer.setPageCompletionListener(this); 
     
    287285 
    288286    protected void renderNext(SwingPageRenderer renderer) throws ClassNotFoundException, InstallException { 
     287        try { 
     288            renderer.instanceInit(); 
     289            renderer.reInit(); 
     290        } catch ( Exception e ) { 
     291            System.err.println( "Couldn't initialise a page" ); 
     292            System.exit(1); 
     293        } 
     294 
     295 
    289296        renderer.updateDefaultValues(); 
    290297        frame.getContentPane().removeAll();