Changeset 22035


Ignore:
Timestamp:
2010-05-05T13:34:01+12:00 (14 years ago)
Author:
sjm84
Message:

The "Local Collection Analysis" check box now starts mat.sh if checked and opens a web browser if it is not checked

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/mat/trunk/src/org/greenstone/admin/guiext/ControlPanel.java

    r22004 r22035  
    2121import java.awt.event.ItemListener;
    2222
     23import java.util.Properties;
     24
     25import java.io.FileInputStream;
     26
     27import org.greenstone.server.BrowserLauncher;
     28
    2329import org.greenstone.admin.guiext.BasePanel;
    2430
     
    2834{
    2935    JPanel _controlPanel = null;
     36    JCheckBox _localAnalysis = null;
    3037   
    3138    public ControlPanel()
     
    7077    web_tool_checkbox.setVisible(false);
    7178
    72     JCheckBox java_tool_checkbox = new JCheckBox("Local Collection Analysis");
    73     java_tool_checkbox.addItemListener(new checkBoxStatus(mat));
    74     java_tool_checkbox.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
     79    _localAnalysis = new JCheckBox("Local Collection Analysis");
     80    _localAnalysis.setBorder(BorderFactory.createEmptyBorder(0,0,0,0));
    7581   
    7682    GridLayout gridLayout3 = new GridLayout(3,3);
     
    9298    control_pane.setLayout(new BoxLayout(control_pane, BoxLayout.Y_AXIS));
    9399
    94     control_content_pane.add(java_tool_checkbox);
     100    control_content_pane.add(_localAnalysis);
    95101    control_content_pane.add(Box.createRigidArea(new Dimension(10,5)));
    96102    control_content_pane.add(Box.createRigidArea(new Dimension(10,5)));
     
    130136    }
    131137
    132     class checkBoxStatus implements ItemListener{
    133 
    134     private Mat adaptee;
    135    
    136     public checkBoxStatus(Mat adaptee){
    137        
    138         this.adaptee = adaptee;
    139     }
    140    
    141     public void itemStateChanged(ItemEvent e) {
    142        
    143         JCheckBox source = (JCheckBox)e.getItemSelectable();
    144        
    145         if (source == adaptee.java_tool_checkbox) {
    146         if(source.isSelected()){
    147             adaptee.start_button.setEnabled(true);
    148         }
    149         else{
    150             adaptee.start_button.setEnabled(false);
    151         }
    152         }
    153         else{
    154         }
    155     }
    156     }
    157 
    158138    class aListener implements ActionListener {
    159139   
     
    169149   
    170150        if(button.getName().equalsIgnoreCase("Analyse")){
    171         execute_application();
     151        if(_localAnalysis.isSelected()){
     152            execute_application();
     153        }
     154        else{
     155            try{
     156            Properties properties = new Properties();
     157            FileInputStream fis = new FileInputStream(GAI.getGSDL3Home() + System.getProperty("file.separator") + "build.properties");
     158            properties.load(fis);
     159            fis.close();
     160            Thread bl = new BrowserLauncher("", "http://" + properties.getProperty("tomcat.server") + ":" + properties.getProperty("tomcat.port") + "/mat/analyse");
     161            bl.run();
     162            }
     163            catch(Exception ex){
     164            ex.printStackTrace();
     165            }
     166        }
    172167        }
    173168    }
Note: See TracChangeset for help on using the changeset viewer.