Statistics
| Revision:

root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.gui / src / main / java / es / unex / sextante / gui / algorithm / GeneralOptionsChannelSelectionPanel.java @ 338

History | View | Annotate | Download (2.28 KB)

1
package es.unex.sextante.gui.algorithm;
2

    
3
import info.clearthought.layout.TableLayout;
4

    
5
import java.awt.event.ActionListener;
6

    
7
import javax.swing.JButton;
8
import javax.swing.JPanel;
9

    
10
import es.unex.sextante.core.Sextante;
11
import es.unex.sextante.outputs.Output;
12
import es.unex.sextante.outputs.OutputVectorLayer;
13

    
14
public class GeneralOptionsChannelSelectionPanel
15
         extends
16
            JPanel {
17

    
18
   public static final String   OVERWRITE            = "OVERWRITE";
19
   public static final String   SAVE_TO_TEMP_FILE    = "SET_TEMP_FILE";
20
   public static final String   DO_NOT_CREATE_OUTPUT = "DO_NOT_CREATE_OUTPUT";
21

    
22
   private final ActionListener m_Listener;
23
   private JButton              jButtonSetTempFile;
24
   private JButton              jButtonSetOverwrite;
25
   private JButton              jButtonDoNotCreate;
26
   private final Output         m_Output;
27

    
28

    
29
   public GeneralOptionsChannelSelectionPanel(final Output output,
30
                                              final ActionListener listener) {
31

    
32
      super();
33

    
34
      m_Listener = listener;
35
      m_Output = output;
36

    
37
      initGUI();
38

    
39
   }
40

    
41

    
42
   private void initGUI() {
43

    
44
      this.setLayout(new TableLayout(new double[][] { { 50, TableLayout.FILL, 50 },
45
               { 50, TableLayout.MINIMUM, 50, TableLayout.MINIMUM, 50, TableLayout.MINIMUM, TableLayout.FILL } }));
46

    
47
      //this.setLayout(new FlowLayout());
48

    
49

    
50
      if (m_Output instanceof OutputVectorLayer) {
51
         if (((OutputVectorLayer) m_Output).canOverwrite()) {
52
            jButtonSetOverwrite = new JButton(Sextante.getText("Overwrite"));
53
            jButtonSetOverwrite.addActionListener(m_Listener);
54
            jButtonSetOverwrite.setActionCommand(OVERWRITE);
55
            this.add("1,5", jButtonSetOverwrite);
56
         }
57
      }
58
      jButtonSetTempFile = new JButton(Sextante.getText("Save_to_temp_file"));
59
      jButtonSetTempFile.addActionListener(m_Listener);
60
      jButtonSetTempFile.setActionCommand(SAVE_TO_TEMP_FILE);
61
      this.add("1,1", jButtonSetTempFile);
62

    
63
      jButtonDoNotCreate = new JButton(Sextante.getText("Do_not_create_output"));
64
      jButtonDoNotCreate.addActionListener(m_Listener);
65
      jButtonDoNotCreate.setActionCommand(DO_NOT_CREATE_OUTPUT);
66
      this.add("1,3", jButtonDoNotCreate);
67

    
68
   }
69

    
70

    
71
}